diff --git a/docs/130.1611eafa.iframe.bundle.js b/docs/130.1611eafa.iframe.bundle.js deleted file mode 100644 index 68b0ec7f..00000000 --- a/docs/130.1611eafa.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_readyplayerme_visage=self.webpackChunk_readyplayerme_visage||[]).push([[130],{"./node_modules/@react-three/drei/core/Sparkles.js":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{P:function(){return Sparkles}});var esm_extends=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/extends.js"),react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js");function shaderMaterial(uniforms,vertexShader,fragmentShader,onInit){const material=class material extends three_module.ShaderMaterial{constructor(parameters={}){const entries=Object.entries(uniforms);super({uniforms:entries.reduce(((acc,[name,value])=>({...acc,...three_module.UniformsUtils.clone({[name]:{value:value}})})),{}),vertexShader:vertexShader,fragmentShader:fragmentShader}),this.key="",entries.forEach((([name])=>Object.defineProperty(this,name,{get:()=>this.uniforms[name].value,set:v=>this.uniforms[name].value=v}))),Object.assign(this,parameters),onInit&&onInit(this)}};return material.key=three_module.MathUtils.generateUUID(),material}const SparklesImplMaterial=shaderMaterial({time:0,pixelRatio:1}," uniform float pixelRatio;\n uniform float time;\n attribute float size; \n attribute float speed; \n attribute float opacity;\n attribute vec3 noise;\n attribute vec3 color;\n varying vec3 vColor;\n varying float vOpacity;\n void main() {\n vec4 modelPosition = modelMatrix * vec4(position, 1.0);\n modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2;\n modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2;\n modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2;\n vec4 viewPosition = viewMatrix * modelPosition;\n vec4 projectionPostion = projectionMatrix * viewPosition;\n gl_Position = projectionPostion;\n gl_PointSize = size * 25. * pixelRatio;\n gl_PointSize *= (1.0 / - viewPosition.z);\n vColor = color;\n vOpacity = opacity;\n }",` varying vec3 vColor;\n varying float vOpacity;\n void main() {\n float distanceToCenter = distance(gl_PointCoord, vec2(0.5));\n float strength = 0.05 / distanceToCenter - 0.1;\n gl_FragColor = vec4(vColor, strength * vOpacity);\n #include \n #include <${(()=>parseInt(three_module.REVISION.replace(/\D+/g,"")))()>=154?"colorspace_fragment":"encodings_fragment"}>\n }`),isFloat32Array=def=>def&&def.constructor===Float32Array,isVector=v=>v instanceof three_module.Vector2||v instanceof three_module.Vector3||v instanceof three_module.Vector4,normalizeVector=v=>Array.isArray(v)?v:isVector(v)?v.toArray():[v,v,v];function usePropAsIsOrAsAttribute(count,prop,setDefault){return react.useMemo((()=>{if(void 0!==prop){if(isFloat32Array(prop))return prop;if(prop instanceof three_module.Color){const a=Array.from({length:3*count},(()=>{return[(v=prop).r,v.g,v.b];var v})).flat();return Float32Array.from(a)}if(isVector(prop)||Array.isArray(prop)){const a=Array.from({length:3*count},(()=>normalizeVector(prop))).flat();return Float32Array.from(a)}return Float32Array.from({length:count},(()=>prop))}return Float32Array.from({length:count},setDefault)}),[prop])}const Sparkles=react.forwardRef((({noise:noise=1,count:count=100,speed:speed=1,opacity:opacity=1,scale:scale=1,size:size,color:color,children:children,...props},forwardRef)=>{react.useMemo((()=>(0,index_99983b2d_esm.e)({SparklesImplMaterial:SparklesImplMaterial})),[]);const ref=react.useRef(null),dpr=(0,index_99983b2d_esm.A)((state=>state.viewport.dpr)),_scale=normalizeVector(scale),positions=react.useMemo((()=>Float32Array.from(Array.from({length:count},(()=>_scale.map(three_module.MathUtils.randFloatSpread))).flat())),[count,..._scale]),sizes=usePropAsIsOrAsAttribute(count,size,Math.random),opacities=usePropAsIsOrAsAttribute(count,opacity),speeds=usePropAsIsOrAsAttribute(count,speed),noises=usePropAsIsOrAsAttribute(3*count,noise),colors=usePropAsIsOrAsAttribute(void 0===color?3*count:count,isFloat32Array(color)?color:new three_module.Color(color),(()=>1));return(0,index_99983b2d_esm.C)((state=>{ref.current&&ref.current.material&&(ref.current.material.time=state.clock.elapsedTime)})),react.useImperativeHandle(forwardRef,(()=>ref.current),[]),react.createElement("points",(0,esm_extends.Z)({key:`particle-${count}-${JSON.stringify(scale)}`},props,{ref:ref}),react.createElement("bufferGeometry",null,react.createElement("bufferAttribute",{attach:"attributes-position",args:[positions,3]}),react.createElement("bufferAttribute",{attach:"attributes-size",args:[sizes,1]}),react.createElement("bufferAttribute",{attach:"attributes-opacity",args:[opacities,1]}),react.createElement("bufferAttribute",{attach:"attributes-speed",args:[speeds,1]}),react.createElement("bufferAttribute",{attach:"attributes-color",args:[colors,3]}),react.createElement("bufferAttribute",{attach:"attributes-noise",args:[noises,3]})),children||react.createElement("sparklesImplMaterial",{transparent:!0,pixelRatio:dpr,depthWrite:!1}))}))},"./src/components/Avatar/Avatar.stories.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Animated:function(){return Animated},HalfBody:function(){return HalfBody},Showcase:function(){return Showcase},Static:function(){return Static},_DragNDrop:function(){return _DragNDrop},__namedExportsOrder:function(){return __namedExportsOrder}});var _Static$parameters,_Static$parameters2,_Static$parameters2$d,_Showcase$parameters,_Showcase$parameters2,_Showcase$parameters3,_Animated$parameters,_Animated$parameters2,_Animated$parameters3,_HalfBody$parameters,_HalfBody$parameters2,_HalfBody$parameters3,_DragNDrop$parameters,_DragNDrop$parameters2,_DragNDrop$parameters3,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),src_services__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/services/index.ts"),_react_three_drei__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./node_modules/@react-three/drei/core/Sparkles.js"),src_components_FileDropper_FileDropper_component__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/FileDropper/FileDropper.component.tsx"),src_services_Environment_service__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/services/Environment.service.ts"),src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/services/Stories.service.ts"),_index__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/Avatar/index.ts"),_Lights_Lights_component__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/Lights/Lights.component.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js"),Avatar=function Avatar(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_index__WEBPACK_IMPORTED_MODULE_5__.q,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args),{},{children:args.children}))},Sparkles=function Sparkles(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_react_three_drei__WEBPACK_IMPORTED_MODULE_9__.P,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args))},Template=function Template(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Avatar,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args))},Static=Template.bind({});Static.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({modelSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("female.glb"),animationSrc:void 0,poseSrc:void 0,environment:"soft",scale:1,shadows:!0,idleRotation:!1,headMovement:!1,fov:50,cameraZoomTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.ZOOM_TARGET,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.FEMALE,bloom:{luminanceThreshold:1,luminanceSmoothing:1,mipmapBlur:!0,kernelSize:1,intensity:1,materialIntensity:1},background:{color:"rgb(9,20,26)"},style:{},onLoaded:function onLoaded(){return console.info("EVENT: static avatar loaded")},onLoading:function onLoading(){return console.info("EVENT: loading static avatar")}},_Lights_Lights_component__WEBPACK_IMPORTED_MODULE_6__.E.defaultProps),Static.argTypes={headMovement:{control:!1},halfBody:{control:!1},animationSrc:{control:!1},poseSrc:{control:!1},fov:{control:{type:"range",min:30,max:100,step:1}}};var Showcase=function Showcase(args){var _args$bloom,_useState=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null===(_args$bloom=args.bloom)||void 0===_args$bloom?void 0:_args$bloom.materialIntensity),_useState2=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__.Z)(_useState,2),currentValue=_useState2[0],setCurrentValue=_useState2[1],_useState3=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!0),_useState4=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__.Z)(_useState3,2),increasing=_useState4[0],setIncreasing=_useState4[1],pulsatingBloom=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args.bloom),{},{intensity:1,materialIntensity:currentValue});return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){var animationInterval=setInterval((function(){null!=args&&args.ambientOcclusion||setCurrentValue(increasing?function(prevValue){var newValue=prevValue+.3;return newValue>=9?(setIncreasing(!1),9):newValue}:function(prevValue){var newValue=prevValue-.3;return newValue<=1?(setIncreasing(!0),1):newValue})}),60);return function(){return clearInterval(animationInterval)}}),[currentValue,increasing,1,9,null==args?void 0:args.ambientOcclusion]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Avatar,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args),{},{effects:{ambientOcclusion:null==args?void 0:args.ambientOcclusion,bloom:pulsatingBloom},children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Sparkles,{color:"white",count:50,opacity:.9,scale:5,size:.5,speed:.35})}))};Showcase.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.FEMALE,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,modelSrc:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.HI.one,animationSrc:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.jb.one,scale:1,bloom:{luminanceThreshold:1,luminanceSmoothing:1,mipmapBlur:!0,kernelSize:1,intensity:1,materialIntensity:1},background:{color:"#282038"},dpr:2,environment:"soft",shadows:!1,emotion:{jawOpen:.1,mouthSmileLeft:.2,mouthSmileRight:.1,mouthPressLeft:.1,cheekSquintLeft:.3,eyeLookOutLeft:.6,eyeLookInRight:.6,mouthDimpleLeft:.3},ambientOcclusion:!1},_Lights_Lights_component__WEBPACK_IMPORTED_MODULE_6__.E.defaultProps),Showcase.argTypes=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.nx),{},{modelSrc:{options:Object.values(src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.HI),control:{type:"select"}},animationSrc:{options:Object.values(src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.jb),control:{type:"select"}},environment:{table:{disable:!0}},keyLightIntensity:{table:{disable:!0}},keyLightColor:{table:{disable:!0}},fillLightIntensity:{table:{disable:!0}},fillLightColor:{table:{disable:!0}},fillLightPosition:{table:{disable:!0}},backLightIntensity:{table:{disable:!0}},backLightColor:{table:{disable:!0}},backLightPosition:{table:{disable:!0}},lightTarget:{table:{disable:!0}},fov:{table:{disable:!0}}});var Animated=Template.bind({});Animated.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.args),{},{modelSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("male-emissive.glb"),animationSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("male-idle.glb"),cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.MALE,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,emotion:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.idle,onLoaded:function onLoaded(){return console.info("EVENT: animated avatar loaded")},onLoading:function onLoading(){return console.info("EVENT: loading animated avatar")}}),Animated.argTypes={poseSrc:{control:!1},emotion:{options:{idle:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.idle,angry:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.angry,smile:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.smile,sad:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.sad},defaultValue:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.idle,control:{type:"select"}},fov:{control:{type:"range",min:30,max:100,step:1}}};var HalfBody=Template.bind({});HalfBody.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.args),{},{modelSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("half-body.glb"),halfBody:!0,cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.HALF_BODY,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.INITIAL_DISTANCE.HALF_BODY,onLoaded:function onLoaded(){return console.info("EVENT: half body avatar loaded")},onLoading:function onLoading(){return console.info("EVENT: loading half body avatar")}});var _DragNDrop=function DropTemplate(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(src_components_FileDropper_FileDropper_component__WEBPACK_IMPORTED_MODULE_2__.s,{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Avatar,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args))})}.bind({});_DragNDrop.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.args),{},{modelSrc:void 0,animationSrc:void 0,poseSrc:"",environment:"soft",cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.FEMALE,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,onLoaded:function onLoaded(){return console.info("EVENT: binary file loaded")},onLoading:function onLoading(){return console.info("EVENT: loading avatar from binary file")}}),_DragNDrop.argTypes={modelSrc:{control:!1},animationSrc:{control:!1},headMovement:{control:!1},environment:{control:{type:"text"}}},__webpack_exports__.default={title:"Components/Avatar",component:Avatar,argTypes:{keyLightIntensity:{control:{type:"range",min:0,max:20,step:.1}},keyLightColor:{control:"color"},fillLightIntensity:{control:{type:"range",min:0,max:20,step:.1}},fillLightColor:{control:"color"},backLightIntensity:{control:{type:"range",min:0,max:20,step:.1}},backLightColor:{control:"color"},cameraTarget:{control:{type:"range",min:0,max:10,step:.01}},scale:{control:{type:"range",min:.01,max:10,step:.01}},cameraInitialDistance:{control:{type:"range",min:0,max:2.5,step:.01}},onLoaded:{control:!1},environment:{options:Object.keys(src_services_Environment_service__WEBPACK_IMPORTED_MODULE_3__.s$),control:{type:"select"}},fov:{control:{type:"range",min:30,max:100,step:1}}}},Static.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_Static$parameters=Static.parameters)||void 0===_Static$parameters?void 0:_Static$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => "},null===(_Static$parameters2=Static.parameters)||void 0===_Static$parameters2||null===(_Static$parameters2$d=_Static$parameters2.docs)||void 0===_Static$parameters2$d?void 0:_Static$parameters2$d.source)})}),Showcase.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Showcase.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_Showcase$parameters=Showcase.parameters)||void 0===_Showcase$parameters?void 0:_Showcase$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:'(args: AvatarProps & {\n ambientOcclusion?: boolean;\n}) => {\n const [currentValue, setCurrentValue] = useState(args.bloom?.materialIntensity);\n const [increasing, setIncreasing] = useState(true);\n const pulsatingBloom = {\n ...args.bloom,\n intensity: 1.0,\n materialIntensity: currentValue\n };\n useEffect(() => {\n const animationInterval = setInterval(() => {\n if (args?.ambientOcclusion) {\n return;\n }\n if (increasing) {\n setCurrentValue(prevValue => {\n const newValue = prevValue! + stepSize;\n if (newValue >= maxValue) {\n setIncreasing(false);\n return maxValue;\n }\n return newValue;\n });\n } else {\n setCurrentValue(prevValue => {\n const newValue = prevValue! - stepSize;\n if (newValue <= initialValue) {\n setIncreasing(true);\n return initialValue;\n }\n return newValue;\n });\n }\n }, animationUpdateStepMs);\n return () => clearInterval(animationInterval);\n }, [currentValue, increasing, initialValue, maxValue, args?.ambientOcclusion]);\n return \n \n ;\n}'},null===(_Showcase$parameters2=Showcase.parameters)||void 0===_Showcase$parameters2||null===(_Showcase$parameters3=_Showcase$parameters2.docs)||void 0===_Showcase$parameters3?void 0:_Showcase$parameters3.source)})}),Animated.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Animated.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_Animated$parameters=Animated.parameters)||void 0===_Animated$parameters?void 0:_Animated$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => "},null===(_Animated$parameters2=Animated.parameters)||void 0===_Animated$parameters2||null===(_Animated$parameters3=_Animated$parameters2.docs)||void 0===_Animated$parameters3?void 0:_Animated$parameters3.source)})}),HalfBody.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},HalfBody.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_HalfBody$parameters=HalfBody.parameters)||void 0===_HalfBody$parameters?void 0:_HalfBody$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => "},null===(_HalfBody$parameters2=HalfBody.parameters)||void 0===_HalfBody$parameters2||null===(_HalfBody$parameters3=_HalfBody$parameters2.docs)||void 0===_HalfBody$parameters3?void 0:_HalfBody$parameters3.source)})}),_DragNDrop.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},_DragNDrop.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_DragNDrop$parameters=_DragNDrop.parameters)||void 0===_DragNDrop$parameters?void 0:_DragNDrop$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => \n \n "},null===(_DragNDrop$parameters2=_DragNDrop.parameters)||void 0===_DragNDrop$parameters2||null===(_DragNDrop$parameters3=_DragNDrop$parameters2.docs)||void 0===_DragNDrop$parameters3?void 0:_DragNDrop$parameters3.source)})});var __namedExportsOrder=["Static","Showcase","Animated","HalfBody","_DragNDrop"];Showcase.__docgenInfo={description:"",methods:[],displayName:"Showcase",props:{ambientOcclusion:{required:!1,tsType:{name:"boolean"},description:""}}}},"./src/components/FileDropper/FileDropper.component.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{s:function(){return FileDropper}});var regeneratorRuntime=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),asyncToGenerator=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),react=__webpack_require__("./node_modules/react/index.js"),FileDropper_module_fileDropContainer="FileDropper_fileDropContainer__-KZmt",FileDropper_module_placeholder="FileDropper_placeholder__zVZlo",jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),FileDropper=function FileDropper(_ref){var children=_ref.children,_ref$placeholder=_ref.placeholder,placeholder=void 0===_ref$placeholder?"Drag n' Drop a .glb model here, then Drop an animation .glb or .fbx":_ref$placeholder,ref=(0,react.useRef)(null),_useState=(0,react.useState)(""),_useState2=(0,slicedToArray.Z)(_useState,2),modelSrc=_useState2[0],setModelSrc=_useState2[1],_useState3=(0,react.useState)(""),_useState4=(0,slicedToArray.Z)(_useState3,2),animationSrc=_useState4[0],setAnimationSrc=_useState4[1],getBase64=function getBase64(file){return new Promise((function(resolve,reject){var reader=new FileReader;reader.readAsDataURL(file),reader.onload=function(){return resolve(reader.result)},reader.onerror=function(error){return reject(error)}}))},handleDrag=function handleDrag(e){e.preventDefault(),e.stopPropagation()},handleDragIn=function handleDragIn(e){e.preventDefault(),e.stopPropagation()},handleDragOut=function handleDragOut(e){e.preventDefault(),e.stopPropagation()},handleDrop=function(){var _ref2=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee(e){var _e$dataTransfer,_name,_name2,file;return(0,regeneratorRuntime.Z)().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if(e.preventDefault(),e.stopPropagation(),"file"!==(null===(_e$dataTransfer=e.dataTransfer)||void 0===_e$dataTransfer?void 0:_e$dataTransfer.items[0].kind)){_context.next=18;break}if(file=e.dataTransfer.items[0].getAsFile(),null!==(_name=file.name)&&void 0!==_name&&_name.endsWith(".glb")||null!==(_name2=file.name)&&void 0!==_name2&&_name2.endsWith(".fbx")){_context.next=6;break}return _context.abrupt("return");case 6:if(""!==modelSrc){_context.next=12;break}return _context.t0=setModelSrc,_context.next=10,getBase64(file);case 10:_context.t1=_context.sent,(0,_context.t0)(_context.t1);case 12:if(""===modelSrc){_context.next=18;break}return _context.t2=setAnimationSrc,_context.next=16,getBase64(file);case 16:_context.t3=_context.sent,(0,_context.t2)(_context.t3);case 18:case"end":return _context.stop()}}),_callee)})));return function handleDrop(_x){return _ref2.apply(this,arguments)}}();return(0,react.useEffect)((function(){var element=ref.current;return element.addEventListener("dragenter",handleDragIn),element.addEventListener("dragleave",handleDragOut),element.addEventListener("dragover",handleDrag),element.addEventListener("drop",handleDrop),function(){element.removeEventListener("dragenter",handleDragIn),element.removeEventListener("dragleave",handleDragOut),element.removeEventListener("dragover",handleDrag),element.removeEventListener("drop",handleDrop)}})),(0,jsx_runtime.jsx)("div",{className:FileDropper_module_fileDropContainer,ref:ref,children:modelSrc.length<1?(0,jsx_runtime.jsx)("div",{className:FileDropper_module_placeholder,children:placeholder}):react.Children.map(react.Children.toArray(children),(function(child){return(0,react.cloneElement)(child,{modelSrc:modelSrc,animationSrc:animationSrc})}))})};FileDropper.__docgenInfo={description:"This component is only for using in Storybook for showcasing drag'n'drop functionality.",methods:[],displayName:"FileDropper",props:{placeholder:{defaultValue:{value:"`Drag n' Drop a .glb model here, then Drop an animation .glb or .fbx`",computed:!1},required:!1}}}},"./src/services/Stories.service.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{HI:function(){return modelPresets},eE:function(){return emotions},jb:function(){return animationPresets},nx:function(){return ignoreArgTypesOnExamples}});var _Models_service__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/services/Models.service.tsx"),disableTable={table:{disable:!0}},ignoreArgTypesOnExamples=["modelSrc","animationSrc","poseSrc","halfBody","shadows","cameraTarget","cameraInitialDistance","style","idleRotation","emotion","background","capture","loader","dpr","className","headMovement","cameraZoomTarget","bloom","onLoadedEffect","onLoadedAnimation","children","environment","ambientLightColor","dirLightColor","spotLightColor","ambientLightIntensity","dirLightIntensity","spotLightIntensity","spotLightAngle","onLoaded","onLoading","fov","spotLightPosition","dirLightPosition","scale"].reduce((function(acc,key){return acc[key]=disableTable,acc}),{}),modelPresets={one:"https://models.readyplayer.me/64d61e9e17883fd73ebe5eb7.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0",two:"https://models.readyplayer.me/64d61f67f0367d07504924be.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0",three:"https://models.readyplayer.me/64d62255f0367d0750492913.glb?lod=0&morphTargets=ARKit,Eyes Extra&textureAtlas=none",five:"https://models.readyplayer.me/64d6235e2d3bea6e4267b01d.glb?lod=0&morphTargets=ARKit,Eyes Extra&textureAtlas=none",six:"https://models.readyplayer.me/64d5d4eb651a0d350005c672.glb?lod=0&morphTargets=ARKit,Eyes Extra&textureAtlas=none",seven:"https://models.readyplayer.me/64e3055495439dfcf3f0b665.glb?morphTargets=ARKit,Eyes%20Extra&textureAtlas=none"},animationPresets={one:(0,_Models_service__WEBPACK_IMPORTED_MODULE_0__.gT)("male-idle-1.fbx"),two:(0,_Models_service__WEBPACK_IMPORTED_MODULE_0__.gT)("male-idle-2.fbx"),three:(0,_Models_service__WEBPACK_IMPORTED_MODULE_0__.gT)("male-idle-3.fbx")},emotions={idle:{},angry:{mouthDimpleLeft:.48,mouthShrugLower:.385,eyeSquintLeft:.63,eyeSquintRight:.614,browDownLeft:.842,browDownRight:.56,noseSneerLeft:.3,noseSneerRight:.3},smile:{eyeSquintLeft:.4,eyeSquintRight:.2,mouthSmileLeft:.37,mouthSmileRight:.36,mouthShrugUpper:.27,browInnerUp:.3,browOuterUpLeft:.37,browOuterUpRight:.49},sad:{eyeWideLeft:.5,eyeWideRight:.4,mouthPucker:.19,mouthFrownLeft:.6,mouthFrownRight:.6,mouthRollLower:.33,mouthRollUpper:.02,mouthShrugLower:.4,browInnerUp:.78,noseSneerLeft:.115,noseSneerRight:.1}}}}]); \ No newline at end of file diff --git a/docs/130.7b316c9c.iframe.bundle.js b/docs/130.7b316c9c.iframe.bundle.js new file mode 100644 index 00000000..e3fef406 --- /dev/null +++ b/docs/130.7b316c9c.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_readyplayerme_visage=self.webpackChunk_readyplayerme_visage||[]).push([[130],{"./node_modules/@react-three/drei/core/Sparkles.js":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{P:function(){return Sparkles}});var esm_extends=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/extends.js"),react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js");function shaderMaterial(uniforms,vertexShader,fragmentShader,onInit){const material=class material extends three_module.ShaderMaterial{constructor(parameters={}){const entries=Object.entries(uniforms);super({uniforms:entries.reduce(((acc,[name,value])=>({...acc,...three_module.UniformsUtils.clone({[name]:{value:value}})})),{}),vertexShader:vertexShader,fragmentShader:fragmentShader}),this.key="",entries.forEach((([name])=>Object.defineProperty(this,name,{get:()=>this.uniforms[name].value,set:v=>this.uniforms[name].value=v}))),Object.assign(this,parameters),onInit&&onInit(this)}};return material.key=three_module.MathUtils.generateUUID(),material}const SparklesImplMaterial=shaderMaterial({time:0,pixelRatio:1}," uniform float pixelRatio;\n uniform float time;\n attribute float size; \n attribute float speed; \n attribute float opacity;\n attribute vec3 noise;\n attribute vec3 color;\n varying vec3 vColor;\n varying float vOpacity;\n void main() {\n vec4 modelPosition = modelMatrix * vec4(position, 1.0);\n modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2;\n modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2;\n modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2;\n vec4 viewPosition = viewMatrix * modelPosition;\n vec4 projectionPostion = projectionMatrix * viewPosition;\n gl_Position = projectionPostion;\n gl_PointSize = size * 25. * pixelRatio;\n gl_PointSize *= (1.0 / - viewPosition.z);\n vColor = color;\n vOpacity = opacity;\n }",` varying vec3 vColor;\n varying float vOpacity;\n void main() {\n float distanceToCenter = distance(gl_PointCoord, vec2(0.5));\n float strength = 0.05 / distanceToCenter - 0.1;\n gl_FragColor = vec4(vColor, strength * vOpacity);\n #include \n #include <${(()=>parseInt(three_module.REVISION.replace(/\D+/g,"")))()>=154?"colorspace_fragment":"encodings_fragment"}>\n }`),isFloat32Array=def=>def&&def.constructor===Float32Array,isVector=v=>v instanceof three_module.Vector2||v instanceof three_module.Vector3||v instanceof three_module.Vector4,normalizeVector=v=>Array.isArray(v)?v:isVector(v)?v.toArray():[v,v,v];function usePropAsIsOrAsAttribute(count,prop,setDefault){return react.useMemo((()=>{if(void 0!==prop){if(isFloat32Array(prop))return prop;if(prop instanceof three_module.Color){const a=Array.from({length:3*count},(()=>{return[(v=prop).r,v.g,v.b];var v})).flat();return Float32Array.from(a)}if(isVector(prop)||Array.isArray(prop)){const a=Array.from({length:3*count},(()=>normalizeVector(prop))).flat();return Float32Array.from(a)}return Float32Array.from({length:count},(()=>prop))}return Float32Array.from({length:count},setDefault)}),[prop])}const Sparkles=react.forwardRef((({noise:noise=1,count:count=100,speed:speed=1,opacity:opacity=1,scale:scale=1,size:size,color:color,children:children,...props},forwardRef)=>{react.useMemo((()=>(0,index_99983b2d_esm.e)({SparklesImplMaterial:SparklesImplMaterial})),[]);const ref=react.useRef(null),dpr=(0,index_99983b2d_esm.A)((state=>state.viewport.dpr)),_scale=normalizeVector(scale),positions=react.useMemo((()=>Float32Array.from(Array.from({length:count},(()=>_scale.map(three_module.MathUtils.randFloatSpread))).flat())),[count,..._scale]),sizes=usePropAsIsOrAsAttribute(count,size,Math.random),opacities=usePropAsIsOrAsAttribute(count,opacity),speeds=usePropAsIsOrAsAttribute(count,speed),noises=usePropAsIsOrAsAttribute(3*count,noise),colors=usePropAsIsOrAsAttribute(void 0===color?3*count:count,isFloat32Array(color)?color:new three_module.Color(color),(()=>1));return(0,index_99983b2d_esm.C)((state=>{ref.current&&ref.current.material&&(ref.current.material.time=state.clock.elapsedTime)})),react.useImperativeHandle(forwardRef,(()=>ref.current),[]),react.createElement("points",(0,esm_extends.Z)({key:`particle-${count}-${JSON.stringify(scale)}`},props,{ref:ref}),react.createElement("bufferGeometry",null,react.createElement("bufferAttribute",{attach:"attributes-position",args:[positions,3]}),react.createElement("bufferAttribute",{attach:"attributes-size",args:[sizes,1]}),react.createElement("bufferAttribute",{attach:"attributes-opacity",args:[opacities,1]}),react.createElement("bufferAttribute",{attach:"attributes-speed",args:[speeds,1]}),react.createElement("bufferAttribute",{attach:"attributes-color",args:[colors,3]}),react.createElement("bufferAttribute",{attach:"attributes-noise",args:[noises,3]})),children||react.createElement("sparklesImplMaterial",{transparent:!0,pixelRatio:dpr,depthWrite:!1}))}))},"./src/components/Avatar/Avatar.stories.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Animated:function(){return Animated},HalfBody:function(){return HalfBody},Showcase:function(){return Showcase},Static:function(){return Static},_DragNDrop:function(){return _DragNDrop},__namedExportsOrder:function(){return __namedExportsOrder}});var _Static$parameters,_Static$parameters2,_Static$parameters2$d,_Showcase$parameters,_Showcase$parameters2,_Showcase$parameters3,_Animated$parameters,_Animated$parameters2,_Animated$parameters3,_HalfBody$parameters,_HalfBody$parameters2,_HalfBody$parameters3,_DragNDrop$parameters,_DragNDrop$parameters2,_DragNDrop$parameters3,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),src_services__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/services/index.ts"),_react_three_drei__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./node_modules/@react-three/drei/core/Sparkles.js"),src_components_FileDropper_FileDropper_component__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/FileDropper/FileDropper.component.tsx"),src_services_Environment_service__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/services/Environment.service.ts"),src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/services/Stories.service.ts"),_index__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/Avatar/index.ts"),_Lights_Lights_component__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/Lights/Lights.component.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js"),Avatar=function Avatar(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_index__WEBPACK_IMPORTED_MODULE_5__.q,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args),{},{children:args.children}))},Sparkles=function Sparkles(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_react_three_drei__WEBPACK_IMPORTED_MODULE_9__.P,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args))},Template=function Template(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Avatar,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args))},Static=Template.bind({});Static.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({modelSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("female.glb"),animationSrc:void 0,poseSrc:void 0,environment:"soft",scale:1,shadows:!0,idleRotation:!1,headMovement:!1,fov:50,cameraZoomTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.ZOOM_TARGET,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.FEMALE,bloom:{luminanceThreshold:1,luminanceSmoothing:1,mipmapBlur:!0,kernelSize:1,intensity:1,materialIntensity:1},background:{color:"rgb(9,20,26)"},style:{},materialConfig:{emissiveIntensity:3.3},onLoaded:function onLoaded(){return console.info("EVENT: static avatar loaded")},onLoading:function onLoading(){return console.info("EVENT: loading static avatar")}},_Lights_Lights_component__WEBPACK_IMPORTED_MODULE_6__.E.defaultProps),Static.argTypes={headMovement:{control:!1},halfBody:{control:!1},animationSrc:{control:!1},poseSrc:{control:!1},fov:{control:{type:"range",min:30,max:100,step:1}}};var Showcase=function Showcase(args){var _args$bloom,_useState=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null===(_args$bloom=args.bloom)||void 0===_args$bloom?void 0:_args$bloom.materialIntensity),_useState2=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__.Z)(_useState,2),currentValue=_useState2[0],setCurrentValue=_useState2[1],_useState3=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!0),_useState4=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__.Z)(_useState3,2),increasing=_useState4[0],setIncreasing=_useState4[1],pulsatingBloom=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args.bloom),{},{intensity:1,materialIntensity:currentValue});return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){var animationInterval=setInterval((function(){null!=args&&args.ambientOcclusion||setCurrentValue(increasing?function(prevValue){var newValue=prevValue+.3;return newValue>=9?(setIncreasing(!1),9):newValue}:function(prevValue){var newValue=prevValue-.3;return newValue<=1?(setIncreasing(!0),1):newValue})}),60);return function(){return clearInterval(animationInterval)}}),[currentValue,increasing,1,9,null==args?void 0:args.ambientOcclusion]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Avatar,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args),{},{effects:{ambientOcclusion:null==args?void 0:args.ambientOcclusion,bloom:pulsatingBloom},children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Sparkles,{color:"white",count:50,opacity:.9,scale:5,size:.5,speed:.35})}))};Showcase.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.FEMALE,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,modelSrc:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.HI.one,animationSrc:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.jb.one,scale:1,bloom:{luminanceThreshold:1,luminanceSmoothing:1,mipmapBlur:!0,kernelSize:1,intensity:1,materialIntensity:1},background:{color:"#282038"},dpr:2,environment:"soft",shadows:!1,emotion:{jawOpen:.1,mouthSmileLeft:.2,mouthSmileRight:.1,mouthPressLeft:.1,cheekSquintLeft:.3,eyeLookOutLeft:.6,eyeLookInRight:.6,mouthDimpleLeft:.3},ambientOcclusion:!1},_Lights_Lights_component__WEBPACK_IMPORTED_MODULE_6__.E.defaultProps),Showcase.argTypes=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.nx),{},{modelSrc:{options:Object.values(src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.HI),control:{type:"select"}},animationSrc:{options:Object.values(src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.jb),control:{type:"select"}},environment:{table:{disable:!0}},keyLightIntensity:{table:{disable:!0}},keyLightColor:{table:{disable:!0}},fillLightIntensity:{table:{disable:!0}},fillLightColor:{table:{disable:!0}},fillLightPosition:{table:{disable:!0}},backLightIntensity:{table:{disable:!0}},backLightColor:{table:{disable:!0}},backLightPosition:{table:{disable:!0}},lightTarget:{table:{disable:!0}},fov:{table:{disable:!0}}});var Animated=Template.bind({});Animated.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.args),{},{modelSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("male-emissive.glb"),animationSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("male-idle.glb"),cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.MALE,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,emotion:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.idle,onLoaded:function onLoaded(){return console.info("EVENT: animated avatar loaded")},onLoading:function onLoading(){return console.info("EVENT: loading animated avatar")}}),Animated.argTypes={poseSrc:{control:!1},emotion:{options:{idle:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.idle,angry:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.angry,smile:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.smile,sad:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.sad},defaultValue:src_services_Stories_service__WEBPACK_IMPORTED_MODULE_4__.eE.idle,control:{type:"select"}},fov:{control:{type:"range",min:30,max:100,step:1}}};var HalfBody=Template.bind({});HalfBody.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.args),{},{modelSrc:(0,src_services__WEBPACK_IMPORTED_MODULE_1__.gT)("half-body.glb"),halfBody:!0,cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.HALF_BODY,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.INITIAL_DISTANCE.HALF_BODY,onLoaded:function onLoaded(){return console.info("EVENT: half body avatar loaded")},onLoading:function onLoading(){return console.info("EVENT: loading half body avatar")}});var _DragNDrop=function DropTemplate(args){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(src_components_FileDropper_FileDropper_component__WEBPACK_IMPORTED_MODULE_2__.s,{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(Avatar,(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},args))})}.bind({});_DragNDrop.args=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.args),{},{modelSrc:void 0,animationSrc:void 0,poseSrc:"",environment:"soft",cameraTarget:_index__WEBPACK_IMPORTED_MODULE_5__.b.TARGET.FULL_BODY.FEMALE,cameraInitialDistance:_index__WEBPACK_IMPORTED_MODULE_5__.b.CONTROLS.FULL_BODY.MAX_DISTANCE,onLoaded:function onLoaded(){return console.info("EVENT: binary file loaded")},onLoading:function onLoading(){return console.info("EVENT: loading avatar from binary file")}}),_DragNDrop.argTypes={modelSrc:{control:!1},animationSrc:{control:!1},headMovement:{control:!1},environment:{control:{type:"text"}}},__webpack_exports__.default={title:"Components/Avatar",component:Avatar,argTypes:{keyLightIntensity:{control:{type:"range",min:0,max:20,step:.1}},keyLightColor:{control:"color"},fillLightIntensity:{control:{type:"range",min:0,max:20,step:.1}},fillLightColor:{control:"color"},backLightIntensity:{control:{type:"range",min:0,max:20,step:.1}},backLightColor:{control:"color"},cameraTarget:{control:{type:"range",min:0,max:10,step:.01}},scale:{control:{type:"range",min:.01,max:10,step:.01}},cameraInitialDistance:{control:{type:"range",min:0,max:2.5,step:.01}},onLoaded:{control:!1},environment:{options:Object.keys(src_services_Environment_service__WEBPACK_IMPORTED_MODULE_3__.s$),control:{type:"select"}},fov:{control:{type:"range",min:30,max:100,step:1}}}},Static.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Static.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_Static$parameters=Static.parameters)||void 0===_Static$parameters?void 0:_Static$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => "},null===(_Static$parameters2=Static.parameters)||void 0===_Static$parameters2||null===(_Static$parameters2$d=_Static$parameters2.docs)||void 0===_Static$parameters2$d?void 0:_Static$parameters2$d.source)})}),Showcase.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Showcase.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_Showcase$parameters=Showcase.parameters)||void 0===_Showcase$parameters?void 0:_Showcase$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:'(args: AvatarProps & {\n ambientOcclusion?: boolean;\n}) => {\n const [currentValue, setCurrentValue] = useState(args.bloom?.materialIntensity);\n const [increasing, setIncreasing] = useState(true);\n const pulsatingBloom = {\n ...args.bloom,\n intensity: 1.0,\n materialIntensity: currentValue\n };\n useEffect(() => {\n const animationInterval = setInterval(() => {\n if (args?.ambientOcclusion) {\n return;\n }\n if (increasing) {\n setCurrentValue(prevValue => {\n const newValue = prevValue! + stepSize;\n if (newValue >= maxValue) {\n setIncreasing(false);\n return maxValue;\n }\n return newValue;\n });\n } else {\n setCurrentValue(prevValue => {\n const newValue = prevValue! - stepSize;\n if (newValue <= initialValue) {\n setIncreasing(true);\n return initialValue;\n }\n return newValue;\n });\n }\n }, animationUpdateStepMs);\n return () => clearInterval(animationInterval);\n }, [currentValue, increasing, initialValue, maxValue, args?.ambientOcclusion]);\n return \n \n ;\n}'},null===(_Showcase$parameters2=Showcase.parameters)||void 0===_Showcase$parameters2||null===(_Showcase$parameters3=_Showcase$parameters2.docs)||void 0===_Showcase$parameters3?void 0:_Showcase$parameters3.source)})}),Animated.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},Animated.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_Animated$parameters=Animated.parameters)||void 0===_Animated$parameters?void 0:_Animated$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => "},null===(_Animated$parameters2=Animated.parameters)||void 0===_Animated$parameters2||null===(_Animated$parameters3=_Animated$parameters2.docs)||void 0===_Animated$parameters3?void 0:_Animated$parameters3.source)})}),HalfBody.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},HalfBody.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_HalfBody$parameters=HalfBody.parameters)||void 0===_HalfBody$parameters?void 0:_HalfBody$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => "},null===(_HalfBody$parameters2=HalfBody.parameters)||void 0===_HalfBody$parameters2||null===(_HalfBody$parameters3=_HalfBody$parameters2.docs)||void 0===_HalfBody$parameters3?void 0:_HalfBody$parameters3.source)})}),_DragNDrop.parameters=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},_DragNDrop.parameters),{},{docs:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({},null===(_DragNDrop$parameters=_DragNDrop.parameters)||void 0===_DragNDrop$parameters?void 0:_DragNDrop$parameters.docs),{},{source:(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_8__.Z)({originalSource:"args => \n \n "},null===(_DragNDrop$parameters2=_DragNDrop.parameters)||void 0===_DragNDrop$parameters2||null===(_DragNDrop$parameters3=_DragNDrop$parameters2.docs)||void 0===_DragNDrop$parameters3?void 0:_DragNDrop$parameters3.source)})});var __namedExportsOrder=["Static","Showcase","Animated","HalfBody","_DragNDrop"];Showcase.__docgenInfo={description:"",methods:[],displayName:"Showcase",props:{ambientOcclusion:{required:!1,tsType:{name:"boolean"},description:""}}}},"./src/components/FileDropper/FileDropper.component.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{s:function(){return FileDropper}});var regeneratorRuntime=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),asyncToGenerator=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),react=__webpack_require__("./node_modules/react/index.js"),FileDropper_module_fileDropContainer="FileDropper_fileDropContainer__-KZmt",FileDropper_module_placeholder="FileDropper_placeholder__zVZlo",jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),FileDropper=function FileDropper(_ref){var children=_ref.children,_ref$placeholder=_ref.placeholder,placeholder=void 0===_ref$placeholder?"Drag n' Drop a .glb model here, then Drop an animation .glb or .fbx":_ref$placeholder,ref=(0,react.useRef)(null),_useState=(0,react.useState)(""),_useState2=(0,slicedToArray.Z)(_useState,2),modelSrc=_useState2[0],setModelSrc=_useState2[1],_useState3=(0,react.useState)(""),_useState4=(0,slicedToArray.Z)(_useState3,2),animationSrc=_useState4[0],setAnimationSrc=_useState4[1],getBase64=function getBase64(file){return new Promise((function(resolve,reject){var reader=new FileReader;reader.readAsDataURL(file),reader.onload=function(){return resolve(reader.result)},reader.onerror=function(error){return reject(error)}}))},handleDrag=function handleDrag(e){e.preventDefault(),e.stopPropagation()},handleDragIn=function handleDragIn(e){e.preventDefault(),e.stopPropagation()},handleDragOut=function handleDragOut(e){e.preventDefault(),e.stopPropagation()},handleDrop=function(){var _ref2=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee(e){var _e$dataTransfer,_name,_name2,file;return(0,regeneratorRuntime.Z)().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if(e.preventDefault(),e.stopPropagation(),"file"!==(null===(_e$dataTransfer=e.dataTransfer)||void 0===_e$dataTransfer?void 0:_e$dataTransfer.items[0].kind)){_context.next=18;break}if(file=e.dataTransfer.items[0].getAsFile(),null!==(_name=file.name)&&void 0!==_name&&_name.endsWith(".glb")||null!==(_name2=file.name)&&void 0!==_name2&&_name2.endsWith(".fbx")){_context.next=6;break}return _context.abrupt("return");case 6:if(""!==modelSrc){_context.next=12;break}return _context.t0=setModelSrc,_context.next=10,getBase64(file);case 10:_context.t1=_context.sent,(0,_context.t0)(_context.t1);case 12:if(""===modelSrc){_context.next=18;break}return _context.t2=setAnimationSrc,_context.next=16,getBase64(file);case 16:_context.t3=_context.sent,(0,_context.t2)(_context.t3);case 18:case"end":return _context.stop()}}),_callee)})));return function handleDrop(_x){return _ref2.apply(this,arguments)}}();return(0,react.useEffect)((function(){var element=ref.current;return element.addEventListener("dragenter",handleDragIn),element.addEventListener("dragleave",handleDragOut),element.addEventListener("dragover",handleDrag),element.addEventListener("drop",handleDrop),function(){element.removeEventListener("dragenter",handleDragIn),element.removeEventListener("dragleave",handleDragOut),element.removeEventListener("dragover",handleDrag),element.removeEventListener("drop",handleDrop)}})),(0,jsx_runtime.jsx)("div",{className:FileDropper_module_fileDropContainer,ref:ref,children:modelSrc.length<1?(0,jsx_runtime.jsx)("div",{className:FileDropper_module_placeholder,children:placeholder}):react.Children.map(react.Children.toArray(children),(function(child){return(0,react.cloneElement)(child,{modelSrc:modelSrc,animationSrc:animationSrc})}))})};FileDropper.__docgenInfo={description:"This component is only for using in Storybook for showcasing drag'n'drop functionality.",methods:[],displayName:"FileDropper",props:{placeholder:{defaultValue:{value:"`Drag n' Drop a .glb model here, then Drop an animation .glb or .fbx`",computed:!1},required:!1}}}},"./src/services/Stories.service.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{HI:function(){return modelPresets},eE:function(){return emotions},jb:function(){return animationPresets},nx:function(){return ignoreArgTypesOnExamples}});var _Models_service__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/services/Models.service.tsx"),disableTable={table:{disable:!0}},ignoreArgTypesOnExamples=["modelSrc","animationSrc","poseSrc","halfBody","shadows","cameraTarget","cameraInitialDistance","style","idleRotation","emotion","background","capture","loader","dpr","className","headMovement","cameraZoomTarget","bloom","onLoadedEffect","onLoadedAnimation","children","environment","ambientLightColor","dirLightColor","spotLightColor","ambientLightIntensity","dirLightIntensity","spotLightIntensity","spotLightAngle","onLoaded","onLoading","fov","spotLightPosition","dirLightPosition","scale"].reduce((function(acc,key){return acc[key]=disableTable,acc}),{}),modelPresets={one:"https://models.readyplayer.me/64d61e9e17883fd73ebe5eb7.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0",two:"https://models.readyplayer.me/64d61f67f0367d07504924be.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0",three:"https://models.readyplayer.me/64d62255f0367d0750492913.glb?lod=0&morphTargets=ARKit,Eyes Extra&textureAtlas=none",five:"https://models.readyplayer.me/64d6235e2d3bea6e4267b01d.glb?lod=0&morphTargets=ARKit,Eyes Extra&textureAtlas=none",six:"https://models.readyplayer.me/64d5d4eb651a0d350005c672.glb?lod=0&morphTargets=ARKit,Eyes Extra&textureAtlas=none",seven:"https://models.readyplayer.me/64e3055495439dfcf3f0b665.glb?morphTargets=ARKit,Eyes%20Extra&textureAtlas=none"},animationPresets={one:(0,_Models_service__WEBPACK_IMPORTED_MODULE_0__.gT)("male-idle-1.fbx"),two:(0,_Models_service__WEBPACK_IMPORTED_MODULE_0__.gT)("male-idle-2.fbx"),three:(0,_Models_service__WEBPACK_IMPORTED_MODULE_0__.gT)("male-idle-3.fbx")},emotions={idle:{},angry:{mouthDimpleLeft:.48,mouthShrugLower:.385,eyeSquintLeft:.63,eyeSquintRight:.614,browDownLeft:.842,browDownRight:.56,noseSneerLeft:.3,noseSneerRight:.3},smile:{eyeSquintLeft:.4,eyeSquintRight:.2,mouthSmileLeft:.37,mouthSmileRight:.36,mouthShrugUpper:.27,browInnerUp:.3,browOuterUpLeft:.37,browOuterUpRight:.49},sad:{eyeWideLeft:.5,eyeWideRight:.4,mouthPucker:.19,mouthFrownLeft:.6,mouthFrownRight:.6,mouthRollLower:.33,mouthRollUpper:.02,mouthShrugLower:.4,browInnerUp:.78,noseSneerLeft:.115,noseSneerRight:.1}}}}]); \ No newline at end of file diff --git a/docs/176.983fb1d3.iframe.bundle.js b/docs/176.983fb1d3.iframe.bundle.js deleted file mode 100644 index 72b21329..00000000 --- a/docs/176.983fb1d3.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_readyplayerme_visage=self.webpackChunk_readyplayerme_visage||[]).push([[176],{"./src/components/Avatar/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{q:function(){return Avatar_component},b:function(){return CAMERA}});var controls,objectSpread2=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),ContactShadows=__webpack_require__("./node_modules/@react-three/drei/core/ContactShadows.js"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),OrbitControls=__webpack_require__("./node_modules/three-stdlib/controls/OrbitControls.js"),services=__webpack_require__("./src/services/index.ts"),progress=Number.POSITIVE_INFINITY,CameraControls=function CameraControls(_ref){var cameraTarget=_ref.cameraTarget,cameraInitialDistance=_ref.cameraInitialDistance,cameraZoomTarget=_ref.cameraZoomTarget,_ref$headScale=_ref.headScale,headScale=void 0===_ref$headScale?1:_ref$headScale,_ref$controlsMinDista=_ref.controlsMinDistance,controlsMinDistance=void 0===_ref$controlsMinDista?.4:_ref$controlsMinDista,_ref$controlsMaxDista=_ref.controlsMaxDistance,controlsMaxDistance=void 0===_ref$controlsMaxDista?2.5:_ref$controlsMaxDista,_ref$updateCameraTarg=_ref.updateCameraTargetOnZoom,updateCameraTargetOnZoom=void 0!==_ref$updateCameraTarg&&_ref$updateCameraTarg,cameraZoomTargetRef=(0,react.useRef)(cameraZoomTarget),_useThree=(0,index_99983b2d_esm.A)(),camera=_useThree.camera,gl=_useThree.gl,fallbackCameraTarget=cameraTarget||1.475+headScale/10,headScaleAdjustedMinDistance=controlsMinDistance+headScale/10;return(0,react.useEffect)((function(){var _cameraZoomTargetRef$,_cameraZoomTargetRef$2,_cameraZoomTargetRef$3;return(null===(_cameraZoomTargetRef$=cameraZoomTargetRef.current)||void 0===_cameraZoomTargetRef$?void 0:_cameraZoomTargetRef$.x)===(null==cameraZoomTarget?void 0:cameraZoomTarget.x)&&(null===(_cameraZoomTargetRef$2=cameraZoomTargetRef.current)||void 0===_cameraZoomTargetRef$2?void 0:_cameraZoomTargetRef$2.y)===(null==cameraZoomTarget?void 0:cameraZoomTarget.y)&&(null===(_cameraZoomTargetRef$3=cameraZoomTargetRef.current)||void 0===_cameraZoomTargetRef$3?void 0:_cameraZoomTargetRef$3.z)===(null==cameraZoomTarget?void 0:cameraZoomTarget.z)||(cameraZoomTargetRef.current=cameraZoomTarget,progress=0),(controls=new OrbitControls.z(camera,gl.domElement)).enableRotate=!1,controls.enablePan=!1,controls.minDistance=headScaleAdjustedMinDistance,controls.maxDistance=controlsMaxDistance,controls.minPolarAngle=1.4,controls.maxPolarAngle=1.4,controls.target.set(0,fallbackCameraTarget,0),controls.update(),cameraInitialDistance&&progress===Number.POSITIVE_INFINITY&&(camera.position.z=cameraInitialDistance,controls.update()),function(){controls.dispose()}}),[cameraInitialDistance,camera,controlsMinDistance,controlsMaxDistance,fallbackCameraTarget,gl.domElement,headScaleAdjustedMinDistance,cameraZoomTarget]),(0,index_99983b2d_esm.C)((function(_,delta){updateCameraTargetOnZoom&&function updateCameraTarget(camera,target,minDistance,maxDistance){if(controls){var distance=controls.target.distanceTo(camera.position),pivot=((distance=(0,services.uZ)(distance,maxDistance,minDistance))-minDistance)/(maxDistance-minDistance);controls.target.set(0,target-.6*pivot,0)}}(camera,fallbackCameraTarget,headScaleAdjustedMinDistance,controlsMaxDistance),function updateCameraFocus(camera,delta,target){target&&progress<=1&&(camera.position.setX((0,services.t7)(camera.position.x,target.x,progress)),camera.position.setZ((0,services.t7)(camera.position.z,target.z,progress)),progress+=delta)}(camera,delta,cameraZoomTarget),controls&&controls.update()})),null},Environment_component=__webpack_require__("./src/components/Scene/Environment.component.tsx"),BaseCanvas=__webpack_require__("./src/components/BaseCanvas/index.ts"),slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),regeneratorRuntime=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),asyncToGenerator=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),Model=__webpack_require__("./src/components/Models/Model/index.ts"),Animation_service=__webpack_require__("./src/services/Animation.service.ts"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),currentRotation=0,AnimationModel=function AnimationModel(_ref){var modelSrc=_ref.modelSrc,animationSrc=_ref.animationSrc,_ref$rotation=_ref.rotation,rotation=void 0===_ref$rotation?Math.PI/180*20:_ref$rotation,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,_ref$idleRotation=_ref.idleRotation,idleRotation=void 0!==_ref$idleRotation&&_ref$idleRotation,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,_ref$headMovement=_ref.headMovement,headMovement=void 0!==_ref$headMovement&&_ref$headMovement,emotion=_ref.emotion,bloom=_ref.bloom,ref=(0,react.useRef)(null),_useState=(0,react.useState)(!0),_useState2=(0,slicedToArray.Z)(_useState,2),animationRunning=_useState2[0],setAnimationRunning=_useState2[1],scene=(0,services.Jr)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes,animationClip=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee(){return(0,regeneratorRuntime.Z)().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.abrupt("return",(0,Animation_service.$)(animationSrc));case 1:case"end":return _context.stop()}}),_callee)}))),[animationSrc]),animationMixer=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee2(){var mixer,animation;return(0,regeneratorRuntime.Z)().wrap((function _callee2$(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:if(mixer=new three_module.AnimationMixer(nodes.Armature),!animationRunning){_context2.next=3;break}return _context2.abrupt("return",mixer);case 3:return _context2.t0=mixer,_context2.next=6,animationClip;case 6:return _context2.t1=_context2.sent,(animation=_context2.t0.clipAction.call(_context2.t0,_context2.t1)).fadeIn(0),animation.play(),mixer.update(0),_context2.abrupt("return",mixer);case 12:case"end":return _context2.stop()}}),_callee2)}))),[animationRunning,animationClip,nodes.Armature]);return(0,index_99983b2d_esm.C)(function(){var _ref4=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee3(state,delta){var _yield$animationMixer;return(0,regeneratorRuntime.Z)().wrap((function _callee3$(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:return _context3.next=2,animationMixer;case 2:if(_context3.t1=_yield$animationMixer=_context3.sent,_context3.t0=null===_context3.t1,_context3.t0){_context3.next=6;break}_context3.t0=void 0===_yield$animationMixer;case 6:if(!_context3.t0){_context3.next=10;break}_context3.next=11;break;case 10:_yield$animationMixer.update(delta);case 11:if(idleRotation){_context3.next=13;break}return _context3.abrupt("return");case 13:null!=ref&&ref.current&&(currentRotation+=.2*delta,ref.current.rotation.y=rotation+Math.sin(currentRotation)/3);case 14:case"end":return _context3.stop()}}),_callee3)})));return function(_x,_x2){return _ref4.apply(this,arguments)}}()),(0,services.bx)({nodes:nodes,enabled:headMovement}),(0,services.Kx)(nodes,emotion),(0,services.FB)("blink",nodes),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{modelRef:ref,scene:scene,scale:scale,onLoaded:onLoaded,onSpawnAnimationFinish:function onSpawnAnimationFinish(){setAnimationRunning(!1)},bloom:bloom})};AnimationModel.__docgenInfo={description:"",methods:[],displayName:"AnimationModel",props:{rotation:{defaultValue:{value:"20 * (Math.PI / 180)",computed:!1},required:!1},scale:{defaultValue:{value:"1",computed:!1},required:!1},idleRotation:{defaultValue:{value:"false",computed:!1},required:!1},headMovement:{defaultValue:{value:"false",computed:!1},required:!1}}};var AnimationModelContainer=function AnimationModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(AnimationModel,(0,objectSpread2.Z)({setModelFallback:setFallback},props))})};AnimationModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"AnimationModelContainer"};__webpack_require__("./src/components/Models/FloatingModel/index.ts");var HalfBodyModel_component_currentRotation=0,HalfBodyModel=function HalfBodyModel(_ref){var modelSrc=_ref.modelSrc,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,_ref$rotation=_ref.rotation,rotation=void 0===_ref$rotation?Math.PI/180*20:_ref$rotation,_ref$idleRotation=_ref.idleRotation,idleRotation=void 0!==_ref$idleRotation&&_ref$idleRotation,emotion=_ref.emotion,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,_ref$headMovement=_ref.headMovement,headMovement=void 0!==_ref$headMovement&&_ref$headMovement,bloom=_ref.bloom,ref=(0,react.useRef)(null),scene=(0,services.Jr)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes;return scene.traverse((function(object){var node=object;"Wolf3D_Hands"===node.name&&(node.visible=!1),"RightHand"===node.name&&node.position.set(0,-2,0),"LeftHand"===node.name&&node.position.set(0,-2,0)})),(0,index_99983b2d_esm.C)((function(state,delta){idleRotation&&null!=ref&&ref.current&&(HalfBodyModel_component_currentRotation+=.2*delta,ref.current.rotation.y=rotation+Math.sin(HalfBodyModel_component_currentRotation)/3)})),(0,services.bx)({nodes:nodes,isHalfBody:!0,enabled:headMovement}),(0,services.FB)("blink",nodes),(0,services.Kx)(nodes,emotion),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{modelRef:ref,scene:scene,scale:scale,onLoaded:onLoaded,bloom:bloom})};HalfBodyModel.__docgenInfo={description:"",methods:[],displayName:"HalfBodyModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1},rotation:{defaultValue:{value:"20 * (Math.PI / 180)",computed:!1},required:!1},idleRotation:{defaultValue:{value:"false",computed:!1},required:!1},headMovement:{defaultValue:{value:"false",computed:!1},required:!1}}};var HalfBodyModelContainer=function HalfBodyModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(HalfBodyModel,(0,objectSpread2.Z)({setModelFallback:setFallback},props))})};HalfBodyModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"HalfBodyModelContainer"};var StaticModel=__webpack_require__("./src/components/Models/StaticModel/index.ts"),PoseModel=function PoseModel(_ref){var modelSrc=_ref.modelSrc,poseSrc=_ref.poseSrc,modelRef=_ref.modelRef,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,emotion=_ref.emotion,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,bloom=_ref.bloom,scene=(0,services.Jr)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes,pose=(0,services.Jr)(poseSrc),sourceNodes=(0,index_99983b2d_esm.D)(pose.scene).nodes;return(0,services.bu)(nodes,sourceNodes),(0,services.Kx)(nodes,emotion),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{modelRef:modelRef,scene:scene,scale:scale,onLoaded:onLoaded,bloom:bloom})};PoseModel.__docgenInfo={description:"",methods:[],displayName:"PoseModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}};var PoseModelContainer=function PoseModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(PoseModel,(0,objectSpread2.Z)({setModelFallback:setFallback},props))})};PoseModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"PoseModelContainer"};__webpack_require__("./src/services/Environment.service.ts");var EnvironmentModel=function EnvironmentModel(_ref){var environment=_ref.environment,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,transform=new services.wx,scene=(0,services.Jr)(environment).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes;return(0,services.xD)(nodes,setModelFallback),(0,react.useEffect)((function(){return(0,services.DK)(onLoaded)}),[scene,onLoaded]),(0,jsx_runtime.jsx)("group",{children:Object.keys(nodes).map((function(key){var node=nodes[key];return"Mesh"===node.type?(0,jsx_runtime.jsx)("mesh",{receiveShadow:!0,scale:scale,position:transform.position,rotation:transform.rotation,geometry:node.geometry,material:node.material,morphTargetInfluences:node.morphTargetInfluences||[]},node.name):null}))})};EnvironmentModel.__docgenInfo={description:"",methods:[],displayName:"EnvironmentModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}};var EffectComposer=__webpack_require__("./node_modules/@react-three/postprocessing/dist/EffectComposer.js"),SSAO=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/SSAO.js"),Vignette=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/Vignette.js"),BrightnessContrast=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/BrightnessContrast.js"),HueSaturation=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/HueSaturation.js"),esm_react=__webpack_require__("./node_modules/jotai/esm/react.mjs"),Capture_component=__webpack_require__("./src/components/Capture/Capture.component.tsx"),Box_component=__webpack_require__("./src/components/Background/Box/Box.component.tsx"),Background=__webpack_require__("./src/components/Background/index.ts"),Loader_module_loader="Loader_loader__DwtSp",Loader_module_dots="Loader_dots__2HwYS",Loader_module_dot="Loader_dot__8Tb8I",Loader=function Loader(){return(0,jsx_runtime.jsx)("div",{className:Loader_module_loader,children:(0,jsx_runtime.jsx)("div",{className:Loader_module_dots,children:[1,2,3].map((function(it){return(0,jsx_runtime.jsx)("div",{className:Loader_module_dot},it)}))})})};Loader.__docgenInfo={description:"",methods:[],displayName:"Loader"};var components_Loader=Loader,effects_Bloom=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/Bloom.js"),Bloom=function Bloom(_ref){var _ref$luminanceThresho=_ref.luminanceThreshold,luminanceThreshold=void 0===_ref$luminanceThresho?1:_ref$luminanceThresho,_ref$luminanceSmoothi=_ref.luminanceSmoothing,luminanceSmoothing=void 0===_ref$luminanceSmoothi?1:_ref$luminanceSmoothi,_ref$mipmapBlur=_ref.mipmapBlur,mipmapBlur=void 0===_ref$mipmapBlur||_ref$mipmapBlur,_ref$intensity=_ref.intensity,intensity=void 0===_ref$intensity?.1:_ref$intensity,_ref$kernelSize=_ref.kernelSize,kernelSize=void 0===_ref$kernelSize?0:_ref$kernelSize;return(0,jsx_runtime.jsx)(effects_Bloom.d,{luminanceThreshold:luminanceThreshold,luminanceSmoothing:luminanceSmoothing,mipmapBlur:mipmapBlur,intensity:intensity,kernelSize:kernelSize})};Bloom.__docgenInfo={description:"",methods:[],displayName:"Bloom",props:{luminanceThreshold:{defaultValue:{value:"1",computed:!1},required:!1},luminanceSmoothing:{defaultValue:{value:"1",computed:!1},required:!1},mipmapBlur:{defaultValue:{value:"true",computed:!1},required:!1},intensity:{defaultValue:{value:"0.1",computed:!1},required:!1},kernelSize:{defaultValue:{value:"0",computed:!1},required:!1}}};var Bloom_component=Bloom,build=__webpack_require__("./node_modules/postprocessing/build/index.js"),Lights_component=__webpack_require__("./src/components/Lights/Lights.component.tsx"),defineProperty=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),GLTFLoader=__webpack_require__("./node_modules/three-stdlib/loaders/GLTFLoader.js"),MultipleAnimationModel=function MultipleAnimationModel(_ref){var modelSrc=_ref.modelSrc,animations=_ref.animations,activeAnimation=_ref.activeAnimation,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,onLoaded=_ref.onLoaded,emotion=_ref.emotion,bloom=_ref.bloom,groupRef=(0,react.useRef)(null),mixerRef=(0,react.useRef)(null),_useState=(0,react.useState)({}),_useState2=(0,slicedToArray.Z)(_useState,2),loadedAnimations=_useState2[0],setLoadedAnimations=_useState2[1],_useState3=(0,react.useState)(null),_useState4=(0,slicedToArray.Z)(_useState3,2),activeAction=_useState4[0],setActiveAction=_useState4[1],scene=(0,services.O1)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes;return(0,react.useEffect)((function(){return scene&&groupRef.current&&(groupRef.current.add(scene),mixerRef.current=new three_module.AnimationMixer(scene)),function(){var _mixerRef$current;null===(_mixerRef$current=mixerRef.current)||void 0===_mixerRef$current||_mixerRef$current.stopAllAction()}}),[scene]),(0,react.useEffect)((function(){var loader=new GLTFLoader.E;Object.keys(animations).forEach((function(name){loader.load(animations[name],(function(gltf){var newClip=gltf.animations[0];setLoadedAnimations((function(prev){return(0,objectSpread2.Z)((0,objectSpread2.Z)({},prev),{},(0,defineProperty.Z)({},name,newClip))}))}))}))}),[animations]),(0,react.useEffect)((function(){var mixer=mixerRef.current,newClip=loadedAnimations[activeAnimation];if(newClip&&mixer){var newAction=mixer.clipAction(newClip),prevAction=activeAction;prevAction&&(newAction.reset(),newAction.crossFadeFrom(prevAction,.5,!0)),newAction.play(),setActiveAction(newAction)}}),[activeAnimation,loadedAnimations,activeAction,nodes.Armature]),(0,index_99983b2d_esm.C)((function(state,delta){var _mixerRef$current2;null===(_mixerRef$current2=mixerRef.current)||void 0===_mixerRef$current2||_mixerRef$current2.update(delta)})),(0,services.Kx)(nodes,emotion),(0,services.FB)("blink",nodes),(0,jsx_runtime.jsx)(Model.H,{modelRef:groupRef,scene:scene,scale:scale,onLoaded:onLoaded,bloom:bloom})};MultipleAnimationModel.__docgenInfo={description:"",methods:[],displayName:"MultipleAnimationModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}};var spawnAtom=__webpack_require__("./src/state/spawnAtom.ts"),CAMERA={TARGET:{FULL_BODY:{MALE:1.65,FEMALE:1.55},HALF_BODY:.6},INITIAL_DISTANCE:{FULL_BODY:.4,HALF_BODY:.5},CONTROLS:{FULL_BODY:{MIN_DISTANCE:.5,MAX_DISTANCE:3.2,ZOOM_TARGET:new three_module.Vector3(-.11,0,3.2)},HALF_BODY:{MIN_DISTANCE:.4,MAX_DISTANCE:1.4,ZOOM_TARGET:new three_module.Vector3(-.15,0,.55)}}},Avatar=function Avatar(_ref){var _effects$bloom,_effects$bloom2,_effects$bloom3,_effects$bloom4,_effects$bloom5,modelSrc=_ref.modelSrc,_ref$animationSrc=_ref.animationSrc,animationSrc=void 0===_ref$animationSrc?void 0:_ref$animationSrc,_ref$animations=_ref.animations,animations=void 0===_ref$animations?void 0:_ref$animations,_ref$activeAnimation=_ref.activeAnimation,activeAnimation=void 0===_ref$activeAnimation?void 0:_ref$activeAnimation,_ref$poseSrc=_ref.poseSrc,poseSrc=void 0===_ref$poseSrc?void 0:_ref$poseSrc,_ref$environment=_ref.environment,environment=void 0===_ref$environment?"soft":_ref$environment,_ref$halfBody=_ref.halfBody,halfBody=void 0!==_ref$halfBody&&_ref$halfBody,_ref$shadows=_ref.shadows,shadows=void 0!==_ref$shadows&&_ref$shadows,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,_ref$cameraTarget=_ref.cameraTarget,cameraTarget=void 0===_ref$cameraTarget?CAMERA.TARGET.FULL_BODY.MALE:_ref$cameraTarget,_ref$cameraInitialDis=_ref.cameraInitialDistance,cameraInitialDistance=void 0===_ref$cameraInitialDis?CAMERA.INITIAL_DISTANCE.FULL_BODY:_ref$cameraInitialDis,style=_ref.style,emotion=_ref.emotion,_ref$idleRotation=_ref.idleRotation,idleRotation=void 0!==_ref$idleRotation&&_ref$idleRotation,capture=_ref.capture,background=_ref.background,onLoaded=_ref.onLoaded,onLoading=_ref.onLoading,dpr=_ref.dpr,className=_ref.className,_ref$headMovement=_ref.headMovement,headMovement=void 0!==_ref$headMovement&&_ref$headMovement,_ref$cameraZoomTarget=_ref.cameraZoomTarget,cameraZoomTarget=void 0===_ref$cameraZoomTarget?CAMERA.CONTROLS.FULL_BODY.ZOOM_TARGET:_ref$cameraZoomTarget,onLoadedEffect=_ref.onLoadedEffect,onLoadedAnimation=_ref.onLoadedAnimation,children=_ref.children,effects=_ref.effects,keyLightIntensity=_ref.keyLightIntensity,keyLightColor=_ref.keyLightColor,fillLightIntensity=_ref.fillLightIntensity,fillLightColor=_ref.fillLightColor,fillLightPosition=_ref.fillLightPosition,backLightIntensity=_ref.backLightIntensity,backLightColor=_ref.backLightColor,backLightPosition=_ref.backLightPosition,lightTarget=_ref.lightTarget,_ref$fov=_ref.fov,fov=void 0===_ref$fov?50:_ref$fov,setSpawnState=(0,esm_react.b9)(spawnAtom.O);(0,react.useEffect)((function(){setSpawnState({onLoadedEffect:onLoadedEffect,onLoadedAnimation:onLoadedAnimation})}),[onLoadedAnimation,onLoadedEffect,setSpawnState]);var AvatarModel=(0,react.useMemo)((function(){return(0,services.w9)(modelSrc)?activeAnimation&&!halfBody&&animations?(0,jsx_runtime.jsx)(MultipleAnimationModel,{emotion:emotion,modelSrc:modelSrc,animations:animations,activeAnimation:activeAnimation,scale:scale,onLoaded:onLoaded,bloom:null==effects?void 0:effects.bloom}):animationSrc&&!halfBody&&(0,services.w9)(animationSrc)?(0,jsx_runtime.jsx)(AnimationModelContainer,{emotion:emotion,modelSrc:modelSrc,animationSrc:animationSrc,scale:scale,idleRotation:idleRotation,onLoaded:onLoaded,headMovement:headMovement,bloom:null==effects?void 0:effects.bloom}):halfBody?(0,jsx_runtime.jsx)(HalfBodyModelContainer,{emotion:emotion,modelSrc:modelSrc,scale:scale,idleRotation:idleRotation,onLoaded:onLoaded,headMovement:headMovement,bloom:null==effects?void 0:effects.bloom}):(0,services.w9)(poseSrc)?(0,jsx_runtime.jsx)(PoseModelContainer,{emotion:emotion,modelSrc:modelSrc,scale:scale,poseSrc:poseSrc,onLoaded:onLoaded,bloom:null==effects?void 0:effects.bloom}):(0,jsx_runtime.jsx)(StaticModel.P,{modelSrc:modelSrc,scale:scale,onLoaded:onLoaded,emotion:emotion,bloom:null==effects?void 0:effects.bloom}):null}),[modelSrc,activeAnimation,halfBody,animations,animationSrc,poseSrc,scale,onLoaded,emotion,null==effects?void 0:effects.bloom,idleRotation,headMovement]);(0,react.useEffect)((function(){return(0,services.DK)(onLoading)}),[modelSrc,animationSrc,onLoading]);var enablePostProcessing=Boolean((null==effects?void 0:effects.ambientOcclusion)||(null==effects?void 0:effects.bloom)||(null==effects?void 0:effects.vignette));return(0,jsx_runtime.jsxs)(BaseCanvas.u,{enablePostProcessing:enablePostProcessing,position:new three_module.Vector3(0,0,3),fov:fov,style:style,dpr:dpr,className:className,children:[(0,jsx_runtime.jsx)(Environment_component.q,{environment:environment,enablePostProcessing:enablePostProcessing}),(0,jsx_runtime.jsx)(CameraControls,{cameraTarget:cameraTarget,cameraInitialDistance:cameraInitialDistance,cameraZoomTarget:cameraZoomTarget,controlsMinDistance:halfBody?CAMERA.CONTROLS.HALF_BODY.MIN_DISTANCE:CAMERA.CONTROLS.FULL_BODY.MIN_DISTANCE,controlsMaxDistance:halfBody?CAMERA.CONTROLS.HALF_BODY.MAX_DISTANCE:CAMERA.CONTROLS.FULL_BODY.MAX_DISTANCE,updateCameraTargetOnZoom:!halfBody}),AvatarModel,children,shadows&&(0,jsx_runtime.jsx)(ContactShadows.j,{position:[0,0,0],opacity:2,scale:10,blur:1,far:1}),(null==background?void 0:background.src)&&(0,jsx_runtime.jsx)(Box_component.x,(0,objectSpread2.Z)({},background)),capture&&(0,jsx_runtime.jsx)(Capture_component.Z,(0,objectSpread2.Z)({},capture)),(null==background?void 0:background.color)&&(0,jsx_runtime.jsx)(Background.l,{color:background.color}),enablePostProcessing&&(0,jsx_runtime.jsx)(EffectComposer.x,{autoClear:!0,multisampling:4,enableNormalPass:null==effects?void 0:effects.ambientOcclusion,children:(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(null==effects?void 0:effects.ambientOcclusion)&&(0,jsx_runtime.jsx)(SSAO.K,{blendFunction:build.YQ.MULTIPLY,distanceScaling:!1,radius:.08,bias:.01,intensity:3,samples:31,worldDistanceThreshold:24,worldDistanceFalloff:0,worldProximityThreshold:0,worldProximityFalloff:6,fade:.02,rings:8}),(null==effects?void 0:effects.bloom)&&(0,jsx_runtime.jsx)(Bloom_component,{luminanceThreshold:null==effects||null===(_effects$bloom=effects.bloom)||void 0===_effects$bloom?void 0:_effects$bloom.luminanceThreshold,luminanceSmoothing:null==effects||null===(_effects$bloom2=effects.bloom)||void 0===_effects$bloom2?void 0:_effects$bloom2.luminanceSmoothing,intensity:null==effects||null===(_effects$bloom3=effects.bloom)||void 0===_effects$bloom3?void 0:_effects$bloom3.intensity,kernelSize:null==effects||null===(_effects$bloom4=effects.bloom)||void 0===_effects$bloom4?void 0:_effects$bloom4.kernelSize,mipmapBlur:null==effects||null===(_effects$bloom5=effects.bloom)||void 0===_effects$bloom5?void 0:_effects$bloom5.mipmapBlur}),(null==effects?void 0:effects.vignette)&&(0,jsx_runtime.jsx)(Vignette.s,{eskil:!1,offset:.5,darkness:.5}),(0,jsx_runtime.jsx)(BrightnessContrast.F,{brightness:.025,contrast:.25}),(0,jsx_runtime.jsx)(HueSaturation.v,{hue:0,saturation:-.2})]})}),(0,jsx_runtime.jsx)(Lights_component.Z,{keyLightIntensity:keyLightIntensity,keyLightColor:keyLightColor,fillLightIntensity:fillLightIntensity,fillLightColor:fillLightColor,fillLightPosition:fillLightPosition,backLightIntensity:backLightIntensity,backLightColor:backLightColor,backLightPosition:backLightPosition,lightTarget:lightTarget})]})},AvatarWrapper=function AvatarWrapper(props){var _props$loader;return(0,jsx_runtime.jsx)(react.Suspense,{fallback:null!==(_props$loader=props.loader)&&void 0!==_props$loader?_props$loader:(0,jsx_runtime.jsx)(components_Loader,{}),children:(0,jsx_runtime.jsx)(esm_react.zt,{children:(0,jsx_runtime.jsx)(Avatar,(0,objectSpread2.Z)({},props))})})};AvatarWrapper.__docgenInfo={description:"",methods:[],displayName:"AvatarWrapper",props:{modelSrc:{required:!0,tsType:{name:"union",raw:"string | Blob",elements:[{name:"string"},{name:"Blob"}]},description:"Arbitrary binary data (base64 string, Blob) of a `.glb` file or path (URL) to a `.glb` resource."},animationSrc:{required:!1,tsType:{name:"union",raw:"string | Blob",elements:[{name:"string"},{name:"Blob"}]},description:"Arbitrary binary data (base64 string, Blob) of a `.glb|.fbx` file or path (URL) to a `.glb|.fbx` resource.\nThe animation will be run for the 3D model provided in `modelSrc`."},poseSrc:{required:!1,tsType:{name:"union",raw:"string | Blob",elements:[{name:"string"},{name:"Blob"}]},description:"Arbitrary binary data (base64 string, Blob) or a path (URL) to `.glb` file which will be used to map Bone placements onto the underlying 3D model.\nApplied when not specifying an animation."},halfBody:{required:!1,tsType:{name:"boolean"},description:""},shadows:{required:!1,tsType:{name:"boolean"},description:"Enable rendering shadows on ground."},scale:{required:!1,tsType:{name:"number"},description:"Size of the rendered GLB model."},cameraTarget:{required:!1,tsType:{name:"number"},description:"Camera target on Y-axis."},cameraInitialDistance:{required:!1,tsType:{name:"number"},description:"Initial Z-axis distance from the object upon render."},style:{required:!1,tsType:{name:"CSSProperties"},description:"Apply styling to canvas DOM element.\nNote that background property can not be set via style prop, it will always be overridden to `transparent`.\nInstead, use `background` prop for that purpose."},idleRotation:{required:!1,tsType:{name:"boolean"},description:"Applies an idle rotation to the animated and half-body models."},emotion:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"number"}],raw:"Record"},description:"Applies a face emotion of the model."},background:{required:!1,tsType:{name:"Background"},description:"Allows adding a background image and background color to the scene.\nMake sure that image is loadable to prevent bg errors.\nbackground.src - Accepts URL string.\nbackground.color - Accepts Hexadeximal, RGB, X11 color name, HSL string, doesn't support CSS gradients."},capture:{required:!1,tsType:{name:"CaptureType"},description:"Return base64 image after making screenshot of the canvas."},loader:{required:!1,tsType:{name:"ReactNode"},description:"Pass custom fallback component."},dpr:{required:!1,tsType:{name:"Dpr"},description:"Device Pixel Ratio."},className:{required:!1,tsType:{name:"string"},description:"Custom style classes for canvas."},headMovement:{required:!1,tsType:{name:"boolean"},description:"Enable head tracking cursor movements."},cameraZoomTarget:{required:!1,tsType:{name:"Vector3"},description:"Initialise and update camera movement on Z-Axis.\nDefaults to full-body zoom distance."},onLoadedEffect:{required:!1,tsType:{name:"SpawnState['onLoadedEffect']",raw:"SpawnState['onLoadedEffect']"},description:"Spawn effect when model is loaded into scene."},onLoadedAnimation:{required:!1,tsType:{name:"SpawnState['onLoadedAnimation']",raw:"SpawnState['onLoadedAnimation']"},description:"Spawn animation when model is loaded into scene."},fov:{required:!1,tsType:{name:"number"},description:"Field of view of the camera."},effects:{required:!1,tsType:{name:"EffectConfiguration"},description:"Control some effects like post-processing effects"},children:{required:!1,tsType:{name:"ReactNode"},description:"Use any three.js(fiber, post-processing) compatible components to render in the scene."},animations:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"string"}],raw:"Record"},description:""},activeAnimation:{required:!1,tsType:{name:"string"},description:""}},composes:["LightingProps","EnvironmentProps","Omit"]};var Avatar_component=AvatarWrapper},"./src/components/Lights/Lights.component.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{E:function(){return LIGHT_CONFIG},Z:function(){return Lights_component}});var slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),react=__webpack_require__("./node_modules/react/index.js"),defineProperty=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),toConsumableArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js"),definedProps=function definedProps(obj){return function fromEntries(arr){return Object.assign.apply(Object,[{}].concat((0,toConsumableArray.Z)(arr.map((function(_ref){var _ref2=(0,slicedToArray.Z)(_ref,2),k=_ref2[0],v=_ref2[1];return(0,defineProperty.Z)({},k,v)})))))}(Object.entries(obj).filter((function(_ref4){var _ref5=(0,slicedToArray.Z)(_ref4,2);_ref5[0];return void 0!==_ref5[1]})))},three_module=__webpack_require__("./node_modules/three/build/three.module.js"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),LIGHT_CONFIG=Object.freeze({fillLightAngle:Math.PI/3,backLightAngle:Math.PI/8,keyLightAngle:Math.PI,silhouetteLightAngle:1.5*Math.PI,keyLightPosition:new three_module.Vector3(.5,1.55,.5),liftLightPosition:new three_module.Vector3(.25,1.7,2),dirLightPosition:new three_module.Vector3(-.75,2.5,-1),silhouetteLightPosition:new three_module.Vector3(-1.5,.1,-1.5),defaultProps:{keyLightIntensity:.8,keyLightColor:"#FFFFFF",fillLightIntensity:3,fillLightColor:"#6794FF",fillLightPosition:new three_module.Vector3(-.5,1.6,-.5),backLightIntensity:6,backLightColor:"#FFB878",backLightPosition:new three_module.Vector3(.5,1.6,-1),lightTarget:new three_module.Vector3(0,1.7,0)}}),Lights=function Lights(lightingProps){var _Object$assign=Object.assign(LIGHT_CONFIG.defaultProps,definedProps(lightingProps)),keyLightIntensity=_Object$assign.keyLightIntensity,keyLightColor=_Object$assign.keyLightColor,fillLightIntensity=_Object$assign.fillLightIntensity,fillLightColor=_Object$assign.fillLightColor,fillLightPosition=_Object$assign.fillLightPosition,backLightIntensity=_Object$assign.backLightIntensity,backLightColor=_Object$assign.backLightColor,backLightPosition=_Object$assign.backLightPosition,lightTarget=_Object$assign.lightTarget,scene=(0,index_99983b2d_esm.A)().scene,_useState=(0,react.useState)({head:new three_module.Object3D,shoe:new three_module.Object3D}),targets=(0,slicedToArray.Z)(_useState,1)[0];return(0,react.useEffect)((function(){targets.head.position.copy(lightTarget),targets.shoe.position.set(0,0,0),scene.add(targets.head),scene.add(targets.shoe)}),[]),(0,jsx_runtime.jsxs)("group",{children:[(0,jsx_runtime.jsx)("spotLight",{position:fillLightPosition,target:targets.head,angle:LIGHT_CONFIG.fillLightAngle,color:fillLightColor,intensity:fillLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:backLightPosition,target:targets.head,angle:LIGHT_CONFIG.backLightAngle,color:backLightColor,intensity:backLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:LIGHT_CONFIG.keyLightPosition,target:targets.head,angle:LIGHT_CONFIG.keyLightAngle,color:keyLightColor,intensity:keyLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:LIGHT_CONFIG.liftLightPosition,target:targets.shoe,angle:LIGHT_CONFIG.keyLightAngle,color:keyLightColor,intensity:.25*keyLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:LIGHT_CONFIG.silhouetteLightPosition,target:targets.head,angle:LIGHT_CONFIG.silhouetteLightAngle,color:keyLightColor,intensity:.25*keyLightIntensity,castShadow:!0})]})};Lights.__docgenInfo={description:"",methods:[],displayName:"Lights"};var Lights_component=Lights}}]); \ No newline at end of file diff --git a/docs/257.6310e7e8.iframe.bundle.js b/docs/257.6310e7e8.iframe.bundle.js new file mode 100644 index 00000000..1ff90daf --- /dev/null +++ b/docs/257.6310e7e8.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_readyplayerme_visage=self.webpackChunk_readyplayerme_visage||[]).push([[257],{"./src/components/Avatar/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{q:function(){return Avatar_component},b:function(){return CAMERA}});var controls,objectSpread2=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),ContactShadows=__webpack_require__("./node_modules/@react-three/drei/core/ContactShadows.js"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),OrbitControls=__webpack_require__("./node_modules/three-stdlib/controls/OrbitControls.js"),services=__webpack_require__("./src/services/index.ts"),progress=Number.POSITIVE_INFINITY,CameraControls=function CameraControls(_ref){var cameraTarget=_ref.cameraTarget,cameraInitialDistance=_ref.cameraInitialDistance,cameraZoomTarget=_ref.cameraZoomTarget,_ref$headScale=_ref.headScale,headScale=void 0===_ref$headScale?1:_ref$headScale,_ref$controlsMinDista=_ref.controlsMinDistance,controlsMinDistance=void 0===_ref$controlsMinDista?.4:_ref$controlsMinDista,_ref$controlsMaxDista=_ref.controlsMaxDistance,controlsMaxDistance=void 0===_ref$controlsMaxDista?2.5:_ref$controlsMaxDista,_ref$updateCameraTarg=_ref.updateCameraTargetOnZoom,updateCameraTargetOnZoom=void 0!==_ref$updateCameraTarg&&_ref$updateCameraTarg,cameraZoomTargetRef=(0,react.useRef)(cameraZoomTarget),_useThree=(0,index_99983b2d_esm.A)(),camera=_useThree.camera,gl=_useThree.gl,fallbackCameraTarget=cameraTarget||1.475+headScale/10,headScaleAdjustedMinDistance=controlsMinDistance+headScale/10;return(0,react.useEffect)((function(){var _cameraZoomTargetRef$,_cameraZoomTargetRef$2,_cameraZoomTargetRef$3;return(null===(_cameraZoomTargetRef$=cameraZoomTargetRef.current)||void 0===_cameraZoomTargetRef$?void 0:_cameraZoomTargetRef$.x)===(null==cameraZoomTarget?void 0:cameraZoomTarget.x)&&(null===(_cameraZoomTargetRef$2=cameraZoomTargetRef.current)||void 0===_cameraZoomTargetRef$2?void 0:_cameraZoomTargetRef$2.y)===(null==cameraZoomTarget?void 0:cameraZoomTarget.y)&&(null===(_cameraZoomTargetRef$3=cameraZoomTargetRef.current)||void 0===_cameraZoomTargetRef$3?void 0:_cameraZoomTargetRef$3.z)===(null==cameraZoomTarget?void 0:cameraZoomTarget.z)||(cameraZoomTargetRef.current=cameraZoomTarget,progress=0),(controls=new OrbitControls.z(camera,gl.domElement)).enableRotate=!1,controls.enablePan=!1,controls.minDistance=headScaleAdjustedMinDistance,controls.maxDistance=controlsMaxDistance,controls.minPolarAngle=1.4,controls.maxPolarAngle=1.4,controls.target.set(0,fallbackCameraTarget,0),controls.update(),cameraInitialDistance&&progress===Number.POSITIVE_INFINITY&&(camera.position.z=cameraInitialDistance,controls.update()),function(){controls.dispose()}}),[cameraInitialDistance,camera,controlsMinDistance,controlsMaxDistance,fallbackCameraTarget,gl.domElement,headScaleAdjustedMinDistance,cameraZoomTarget]),(0,index_99983b2d_esm.C)((function(_,delta){updateCameraTargetOnZoom&&function updateCameraTarget(camera,target,minDistance,maxDistance){if(controls){var distance=controls.target.distanceTo(camera.position),pivot=((distance=(0,services.uZ)(distance,maxDistance,minDistance))-minDistance)/(maxDistance-minDistance);controls.target.set(0,target-.6*pivot,0)}}(camera,fallbackCameraTarget,headScaleAdjustedMinDistance,controlsMaxDistance),function updateCameraFocus(camera,delta,target){target&&progress<=1&&(camera.position.setX((0,services.t7)(camera.position.x,target.x,progress)),camera.position.setZ((0,services.t7)(camera.position.z,target.z,progress)),progress+=delta)}(camera,delta,cameraZoomTarget),controls&&controls.update()})),null},Environment_component=__webpack_require__("./src/components/Scene/Environment.component.tsx"),BaseCanvas=__webpack_require__("./src/components/BaseCanvas/index.ts"),slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),regeneratorRuntime=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),asyncToGenerator=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),Model=__webpack_require__("./src/components/Models/Model/index.ts"),Animation_service=__webpack_require__("./src/services/Animation.service.ts"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),currentRotation=0,AnimationModel=function AnimationModel(_ref){var modelSrc=_ref.modelSrc,animationSrc=_ref.animationSrc,_ref$rotation=_ref.rotation,rotation=void 0===_ref$rotation?Math.PI/180*20:_ref$rotation,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,_ref$idleRotation=_ref.idleRotation,idleRotation=void 0!==_ref$idleRotation&&_ref$idleRotation,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,_ref$headMovement=_ref.headMovement,headMovement=void 0!==_ref$headMovement&&_ref$headMovement,emotion=_ref.emotion,bloom=_ref.bloom,materialConfig=_ref.materialConfig,ref=(0,react.useRef)(null),_useState=(0,react.useState)(!0),_useState2=(0,slicedToArray.Z)(_useState,2),animationRunning=_useState2[0],setAnimationRunning=_useState2[1],scene=(0,services.Jr)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes,animationClip=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee(){return(0,regeneratorRuntime.Z)().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.abrupt("return",(0,Animation_service.$)(animationSrc));case 1:case"end":return _context.stop()}}),_callee)}))),[animationSrc]),animationMixer=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee2(){var mixer,animation;return(0,regeneratorRuntime.Z)().wrap((function _callee2$(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:if(mixer=new three_module.AnimationMixer(nodes.Armature),!animationRunning){_context2.next=3;break}return _context2.abrupt("return",mixer);case 3:return _context2.t0=mixer,_context2.next=6,animationClip;case 6:return _context2.t1=_context2.sent,(animation=_context2.t0.clipAction.call(_context2.t0,_context2.t1)).fadeIn(0),animation.play(),mixer.update(0),_context2.abrupt("return",mixer);case 12:case"end":return _context2.stop()}}),_callee2)}))),[animationRunning,animationClip,nodes.Armature]);return(0,index_99983b2d_esm.C)(function(){var _ref4=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee3(state,delta){var _yield$animationMixer;return(0,regeneratorRuntime.Z)().wrap((function _callee3$(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:return _context3.next=2,animationMixer;case 2:if(_context3.t1=_yield$animationMixer=_context3.sent,_context3.t0=null===_context3.t1,_context3.t0){_context3.next=6;break}_context3.t0=void 0===_yield$animationMixer;case 6:if(!_context3.t0){_context3.next=10;break}_context3.next=11;break;case 10:_yield$animationMixer.update(delta);case 11:if(idleRotation){_context3.next=13;break}return _context3.abrupt("return");case 13:null!=ref&&ref.current&&(currentRotation+=.2*delta,ref.current.rotation.y=rotation+Math.sin(currentRotation)/3);case 14:case"end":return _context3.stop()}}),_callee3)})));return function(_x,_x2){return _ref4.apply(this,arguments)}}()),(0,services.bx)({nodes:nodes,enabled:headMovement}),(0,services.Kx)(nodes,emotion),(0,services.FB)("blink",nodes),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{modelRef:ref,scene:scene,scale:scale,onLoaded:onLoaded,onSpawnAnimationFinish:function onSpawnAnimationFinish(){setAnimationRunning(!1)},bloom:bloom,materialConfig:materialConfig})};AnimationModel.__docgenInfo={description:"",methods:[],displayName:"AnimationModel",props:{rotation:{defaultValue:{value:"20 * (Math.PI / 180)",computed:!1},required:!1},scale:{defaultValue:{value:"1",computed:!1},required:!1},idleRotation:{defaultValue:{value:"false",computed:!1},required:!1},headMovement:{defaultValue:{value:"false",computed:!1},required:!1}}};var AnimationModelContainer=function AnimationModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(AnimationModel,(0,objectSpread2.Z)({setModelFallback:setFallback},props))})};AnimationModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"AnimationModelContainer"};__webpack_require__("./src/components/Models/FloatingModel/index.ts");var HalfBodyModel_component_currentRotation=0,HalfBodyModel=function HalfBodyModel(_ref){var modelSrc=_ref.modelSrc,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,_ref$rotation=_ref.rotation,rotation=void 0===_ref$rotation?Math.PI/180*20:_ref$rotation,_ref$idleRotation=_ref.idleRotation,idleRotation=void 0!==_ref$idleRotation&&_ref$idleRotation,emotion=_ref.emotion,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,_ref$headMovement=_ref.headMovement,headMovement=void 0!==_ref$headMovement&&_ref$headMovement,bloom=_ref.bloom,materialConfig=_ref.materialConfig,ref=(0,react.useRef)(null),scene=(0,services.Jr)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes;return scene.traverse((function(object){var node=object;"Wolf3D_Hands"===node.name&&(node.visible=!1),"RightHand"===node.name&&node.position.set(0,-2,0),"LeftHand"===node.name&&node.position.set(0,-2,0)})),(0,index_99983b2d_esm.C)((function(state,delta){idleRotation&&null!=ref&&ref.current&&(HalfBodyModel_component_currentRotation+=.2*delta,ref.current.rotation.y=rotation+Math.sin(HalfBodyModel_component_currentRotation)/3)})),(0,services.bx)({nodes:nodes,isHalfBody:!0,enabled:headMovement}),(0,services.FB)("blink",nodes),(0,services.Kx)(nodes,emotion),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{modelRef:ref,scene:scene,scale:scale,onLoaded:onLoaded,bloom:bloom,materialConfig:materialConfig})};HalfBodyModel.__docgenInfo={description:"",methods:[],displayName:"HalfBodyModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1},rotation:{defaultValue:{value:"20 * (Math.PI / 180)",computed:!1},required:!1},idleRotation:{defaultValue:{value:"false",computed:!1},required:!1},headMovement:{defaultValue:{value:"false",computed:!1},required:!1}}};var HalfBodyModelContainer=function HalfBodyModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(HalfBodyModel,(0,objectSpread2.Z)({setModelFallback:setFallback},props))})};HalfBodyModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"HalfBodyModelContainer"};var StaticModel=__webpack_require__("./src/components/Models/StaticModel/index.ts"),PoseModel=function PoseModel(_ref){var modelSrc=_ref.modelSrc,poseSrc=_ref.poseSrc,modelRef=_ref.modelRef,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,emotion=_ref.emotion,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,bloom=_ref.bloom,materialConfig=_ref.materialConfig,scene=(0,services.Jr)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes,pose=(0,services.Jr)(poseSrc),sourceNodes=(0,index_99983b2d_esm.D)(pose.scene).nodes;return(0,services.bu)(nodes,sourceNodes),(0,services.Kx)(nodes,emotion),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{modelRef:modelRef,scene:scene,scale:scale,onLoaded:onLoaded,bloom:bloom,materialConfig:materialConfig})};PoseModel.__docgenInfo={description:"",methods:[],displayName:"PoseModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}};var PoseModelContainer=function PoseModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(PoseModel,(0,objectSpread2.Z)({setModelFallback:setFallback},props))})};PoseModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"PoseModelContainer"};var MultipleAnimationModel=function MultipleAnimationModel(_ref){var modelSrc=_ref.modelSrc,animations=_ref.animations,activeAnimation=_ref.activeAnimation,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,emotion=_ref.emotion,bloom=_ref.bloom,animationConfig=_ref.animationConfig,materialConfig=_ref.materialConfig,mixerRef=(0,react.useRef)(null),activeActionRef=(0,react.useRef)(null),animationTimeRef=(0,react.useRef)(0),_useState=(0,react.useState)({}),_useState2=(0,slicedToArray.Z)(_useState,2),loadedAnimations=_useState2[0],setLoadedAnimations=_useState2[1],scene=(0,services.O1)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes;return(0,react.useEffect)((function(){var loadAllAnimations=function(){var _ref2=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee2(){var clips;return(0,regeneratorRuntime.Z)().wrap((function _callee2$(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return clips={},_context2.next=3,Promise.all(Object.keys(animations).map(function(){var _ref3=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee(name){var newClip;return(0,regeneratorRuntime.Z)().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.next=2,(0,Animation_service.$)(animations[name]);case 2:newClip=_context.sent,clips[name]=newClip;case 4:case"end":return _context.stop()}}),_callee)})));return function(_x){return _ref3.apply(this,arguments)}}()));case 3:setLoadedAnimations(clips);case 4:case"end":return _context2.stop()}}),_callee2)})));return function loadAllAnimations(){return _ref2.apply(this,arguments)}}();loadAllAnimations()}),[animations]),(0,react.useEffect)((function(){if(scene){var mixer=new three_module.AnimationMixer(scene);if(mixerRef.current=mixer,activeActionRef.current){var newAction=mixer.clipAction(activeActionRef.current.getClip());newAction.play(),mixer.update(animationTimeRef.current),activeActionRef.current=newAction}}return function(){var _mixerRef$current,_mixerRef$current2;null===(_mixerRef$current=mixerRef.current)||void 0===_mixerRef$current||_mixerRef$current.stopAllAction(),null===(_mixerRef$current2=mixerRef.current)||void 0===_mixerRef$current2||_mixerRef$current2.uncacheRoot(scene)}}),[scene]),(0,react.useEffect)((function(){var mixer=mixerRef.current,prevAction=activeActionRef.current,newClip=loadedAnimations[activeAnimation];if(newClip&&mixer&&(!prevAction||prevAction.getClip().name!==newClip.name)){var _animationConfig$cros,newAction=mixer.clipAction(newClip);if(activeActionRef.current=newAction,prevAction)newAction.reset(),newAction.crossFadeFrom(prevAction,null!==(_animationConfig$cros=null==animationConfig?void 0:animationConfig.crossfadeDuration)&&void 0!==_animationConfig$cros?_animationConfig$cros:.5,!0);newAction.play()}}),[activeAnimation,loadedAnimations,animationConfig]),(0,index_99983b2d_esm.C)((function(state,delta){var _mixerRef$current3,_activeActionRef$curr;null===(_mixerRef$current3=mixerRef.current)||void 0===_mixerRef$current3||_mixerRef$current3.update(delta),animationTimeRef.current=(null===(_activeActionRef$curr=activeActionRef.current)||void 0===_activeActionRef$curr?void 0:_activeActionRef$curr.time)||0})),(0,services.Kx)(nodes,emotion),(0,services.FB)("blink",nodes),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{scene:scene,scale:scale,onLoaded:onLoaded,bloom:bloom,materialConfig:materialConfig})};MultipleAnimationModel.__docgenInfo={description:"",methods:[],displayName:"MultipleAnimationModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}};__webpack_require__("./src/services/Environment.service.ts");var EnvironmentModel=function EnvironmentModel(_ref){var environment=_ref.environment,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,transform=new services.wx,scene=(0,services.Jr)(environment).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes;return(0,services.xD)(nodes,setModelFallback),(0,react.useEffect)((function(){return(0,services.DK)(onLoaded)}),[scene,onLoaded]),(0,jsx_runtime.jsx)("group",{children:Object.keys(nodes).map((function(key){var node=nodes[key];return"Mesh"===node.type?(0,jsx_runtime.jsx)("mesh",{receiveShadow:!0,scale:scale,position:transform.position,rotation:transform.rotation,geometry:node.geometry,material:node.material,morphTargetInfluences:node.morphTargetInfluences||[]},node.name):null}))})};EnvironmentModel.__docgenInfo={description:"",methods:[],displayName:"EnvironmentModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}};var EffectComposer=__webpack_require__("./node_modules/@react-three/postprocessing/dist/EffectComposer.js"),SSAO=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/SSAO.js"),Vignette=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/Vignette.js"),BrightnessContrast=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/BrightnessContrast.js"),HueSaturation=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/HueSaturation.js"),esm_react=__webpack_require__("./node_modules/jotai/esm/react.mjs"),Capture_component=__webpack_require__("./src/components/Capture/Capture.component.tsx"),Box_component=__webpack_require__("./src/components/Background/Box/Box.component.tsx"),Background=__webpack_require__("./src/components/Background/index.ts"),Loader_module_loader="Loader_loader__DwtSp",Loader_module_dots="Loader_dots__2HwYS",Loader_module_dot="Loader_dot__8Tb8I",Loader=function Loader(){return(0,jsx_runtime.jsx)("div",{className:Loader_module_loader,children:(0,jsx_runtime.jsx)("div",{className:Loader_module_dots,children:[1,2,3].map((function(it){return(0,jsx_runtime.jsx)("div",{className:Loader_module_dot},it)}))})})};Loader.__docgenInfo={description:"",methods:[],displayName:"Loader"};var components_Loader=Loader,effects_Bloom=__webpack_require__("./node_modules/@react-three/postprocessing/dist/effects/Bloom.js"),Bloom=function Bloom(_ref){var _ref$luminanceThresho=_ref.luminanceThreshold,luminanceThreshold=void 0===_ref$luminanceThresho?1:_ref$luminanceThresho,_ref$luminanceSmoothi=_ref.luminanceSmoothing,luminanceSmoothing=void 0===_ref$luminanceSmoothi?1:_ref$luminanceSmoothi,_ref$mipmapBlur=_ref.mipmapBlur,mipmapBlur=void 0===_ref$mipmapBlur||_ref$mipmapBlur,_ref$intensity=_ref.intensity,intensity=void 0===_ref$intensity?.1:_ref$intensity,_ref$kernelSize=_ref.kernelSize,kernelSize=void 0===_ref$kernelSize?0:_ref$kernelSize;return(0,jsx_runtime.jsx)(effects_Bloom.d,{luminanceThreshold:luminanceThreshold,luminanceSmoothing:luminanceSmoothing,mipmapBlur:mipmapBlur,intensity:intensity,kernelSize:kernelSize})};Bloom.__docgenInfo={description:"",methods:[],displayName:"Bloom",props:{luminanceThreshold:{defaultValue:{value:"1",computed:!1},required:!1},luminanceSmoothing:{defaultValue:{value:"1",computed:!1},required:!1},mipmapBlur:{defaultValue:{value:"true",computed:!1},required:!1},intensity:{defaultValue:{value:"0.1",computed:!1},required:!1},kernelSize:{defaultValue:{value:"0",computed:!1},required:!1}}};var Bloom_component=Bloom,build=__webpack_require__("./node_modules/postprocessing/build/index.js"),Lights_component=__webpack_require__("./src/components/Lights/Lights.component.tsx"),spawnAtom=__webpack_require__("./src/state/spawnAtom.ts"),CAMERA={TARGET:{FULL_BODY:{MALE:1.65,FEMALE:1.55},HALF_BODY:.6},INITIAL_DISTANCE:{FULL_BODY:.4,HALF_BODY:.5},CONTROLS:{FULL_BODY:{MIN_DISTANCE:.5,MAX_DISTANCE:3.2,ZOOM_TARGET:new three_module.Vector3(-.11,0,3.2)},HALF_BODY:{MIN_DISTANCE:.4,MAX_DISTANCE:1.4,ZOOM_TARGET:new three_module.Vector3(-.15,0,.55)}}},Avatar=function Avatar(_ref){var _effects$bloom,_effects$bloom2,_effects$bloom3,_effects$bloom4,_effects$bloom5,modelSrc=_ref.modelSrc,_ref$animationSrc=_ref.animationSrc,animationSrc=void 0===_ref$animationSrc?void 0:_ref$animationSrc,_ref$animations=_ref.animations,animations=void 0===_ref$animations?void 0:_ref$animations,_ref$activeAnimation=_ref.activeAnimation,activeAnimation=void 0===_ref$activeAnimation?void 0:_ref$activeAnimation,_ref$poseSrc=_ref.poseSrc,poseSrc=void 0===_ref$poseSrc?void 0:_ref$poseSrc,_ref$environment=_ref.environment,environment=void 0===_ref$environment?"soft":_ref$environment,_ref$halfBody=_ref.halfBody,halfBody=void 0!==_ref$halfBody&&_ref$halfBody,_ref$shadows=_ref.shadows,shadows=void 0!==_ref$shadows&&_ref$shadows,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,_ref$cameraTarget=_ref.cameraTarget,cameraTarget=void 0===_ref$cameraTarget?CAMERA.TARGET.FULL_BODY.MALE:_ref$cameraTarget,_ref$cameraInitialDis=_ref.cameraInitialDistance,cameraInitialDistance=void 0===_ref$cameraInitialDis?CAMERA.INITIAL_DISTANCE.FULL_BODY:_ref$cameraInitialDis,style=_ref.style,emotion=_ref.emotion,_ref$idleRotation=_ref.idleRotation,idleRotation=void 0!==_ref$idleRotation&&_ref$idleRotation,capture=_ref.capture,background=_ref.background,onLoaded=_ref.onLoaded,onLoading=_ref.onLoading,dpr=_ref.dpr,className=_ref.className,_ref$headMovement=_ref.headMovement,headMovement=void 0!==_ref$headMovement&&_ref$headMovement,_ref$cameraZoomTarget=_ref.cameraZoomTarget,cameraZoomTarget=void 0===_ref$cameraZoomTarget?CAMERA.CONTROLS.FULL_BODY.ZOOM_TARGET:_ref$cameraZoomTarget,onLoadedEffect=_ref.onLoadedEffect,onLoadedAnimation=_ref.onLoadedAnimation,children=_ref.children,effects=_ref.effects,keyLightIntensity=_ref.keyLightIntensity,keyLightColor=_ref.keyLightColor,fillLightIntensity=_ref.fillLightIntensity,fillLightColor=_ref.fillLightColor,fillLightPosition=_ref.fillLightPosition,backLightIntensity=_ref.backLightIntensity,backLightColor=_ref.backLightColor,backLightPosition=_ref.backLightPosition,lightTarget=_ref.lightTarget,_ref$fov=_ref.fov,fov=void 0===_ref$fov?50:_ref$fov,animationConfig=_ref.animationConfig,materialConfig=_ref.materialConfig,setSpawnState=(0,esm_react.b9)(spawnAtom.O);(0,react.useEffect)((function(){setSpawnState({onLoadedEffect:onLoadedEffect,onLoadedAnimation:onLoadedAnimation})}),[onLoadedAnimation,onLoadedEffect,setSpawnState]);var AvatarModel=(0,react.useMemo)((function(){return(0,services.w9)(modelSrc)?activeAnimation&&!halfBody&&animations?(0,jsx_runtime.jsx)(MultipleAnimationModel,{emotion:emotion,modelSrc:modelSrc,animations:animations,activeAnimation:activeAnimation,scale:scale,onLoaded:onLoaded,bloom:null==effects?void 0:effects.bloom,animationConfig:animationConfig,materialConfig:materialConfig}):animationSrc&&!halfBody&&(0,services.w9)(animationSrc)?(0,jsx_runtime.jsx)(AnimationModelContainer,{emotion:emotion,modelSrc:modelSrc,animationSrc:animationSrc,scale:scale,idleRotation:idleRotation,onLoaded:onLoaded,headMovement:headMovement,bloom:null==effects?void 0:effects.bloom,materialConfig:materialConfig}):halfBody?(0,jsx_runtime.jsx)(HalfBodyModelContainer,{emotion:emotion,modelSrc:modelSrc,scale:scale,idleRotation:idleRotation,onLoaded:onLoaded,headMovement:headMovement,bloom:null==effects?void 0:effects.bloom,materialConfig:materialConfig}):(0,services.w9)(poseSrc)?(0,jsx_runtime.jsx)(PoseModelContainer,{emotion:emotion,modelSrc:modelSrc,scale:scale,poseSrc:poseSrc,onLoaded:onLoaded,bloom:null==effects?void 0:effects.bloom,materialConfig:materialConfig}):(0,jsx_runtime.jsx)(StaticModel.P,{modelSrc:modelSrc,scale:scale,onLoaded:onLoaded,emotion:emotion,bloom:null==effects?void 0:effects.bloom,materialConfig:materialConfig}):null}),[modelSrc,activeAnimation,halfBody,animations,animationSrc,poseSrc,scale,onLoaded,emotion,null==effects?void 0:effects.bloom,idleRotation,headMovement,animationConfig,materialConfig]);(0,react.useEffect)((function(){return(0,services.DK)(onLoading)}),[modelSrc,animationSrc,onLoading]);var enablePostProcessing=Boolean((null==effects?void 0:effects.ambientOcclusion)||(null==effects?void 0:effects.bloom)||(null==effects?void 0:effects.vignette));return(0,jsx_runtime.jsxs)(BaseCanvas.u,{enablePostProcessing:enablePostProcessing,position:new three_module.Vector3(0,0,3),fov:fov,style:style,dpr:dpr,className:className,children:[(0,jsx_runtime.jsx)(Environment_component.q,{environment:environment,enablePostProcessing:enablePostProcessing}),(0,jsx_runtime.jsx)(CameraControls,{cameraTarget:cameraTarget,cameraInitialDistance:cameraInitialDistance,cameraZoomTarget:cameraZoomTarget,controlsMinDistance:halfBody?CAMERA.CONTROLS.HALF_BODY.MIN_DISTANCE:CAMERA.CONTROLS.FULL_BODY.MIN_DISTANCE,controlsMaxDistance:halfBody?CAMERA.CONTROLS.HALF_BODY.MAX_DISTANCE:CAMERA.CONTROLS.FULL_BODY.MAX_DISTANCE,updateCameraTargetOnZoom:!halfBody}),AvatarModel,children,shadows&&(0,jsx_runtime.jsx)(ContactShadows.j,{position:[0,0,0],opacity:2,scale:10,blur:1,far:1}),(null==background?void 0:background.src)&&(0,jsx_runtime.jsx)(Box_component.x,(0,objectSpread2.Z)({},background)),capture&&(0,jsx_runtime.jsx)(Capture_component.Z,(0,objectSpread2.Z)({},capture)),(null==background?void 0:background.color)&&(0,jsx_runtime.jsx)(Background.l,{color:background.color}),enablePostProcessing&&(0,jsx_runtime.jsx)(EffectComposer.x,{autoClear:!0,multisampling:4,enableNormalPass:null==effects?void 0:effects.ambientOcclusion,children:(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(null==effects?void 0:effects.ambientOcclusion)&&(0,jsx_runtime.jsx)(SSAO.K,{blendFunction:build.YQ.MULTIPLY,distanceScaling:!1,radius:.08,bias:.01,intensity:3,samples:31,worldDistanceThreshold:24,worldDistanceFalloff:0,worldProximityThreshold:0,worldProximityFalloff:6,fade:.02,rings:8}),(null==effects?void 0:effects.bloom)&&(0,jsx_runtime.jsx)(Bloom_component,{luminanceThreshold:null==effects||null===(_effects$bloom=effects.bloom)||void 0===_effects$bloom?void 0:_effects$bloom.luminanceThreshold,luminanceSmoothing:null==effects||null===(_effects$bloom2=effects.bloom)||void 0===_effects$bloom2?void 0:_effects$bloom2.luminanceSmoothing,intensity:null==effects||null===(_effects$bloom3=effects.bloom)||void 0===_effects$bloom3?void 0:_effects$bloom3.intensity,kernelSize:null==effects||null===(_effects$bloom4=effects.bloom)||void 0===_effects$bloom4?void 0:_effects$bloom4.kernelSize,mipmapBlur:null==effects||null===(_effects$bloom5=effects.bloom)||void 0===_effects$bloom5?void 0:_effects$bloom5.mipmapBlur}),(null==effects?void 0:effects.vignette)&&(0,jsx_runtime.jsx)(Vignette.s,{eskil:!1,offset:.5,darkness:.5}),(0,jsx_runtime.jsx)(BrightnessContrast.F,{brightness:.025,contrast:.25}),(0,jsx_runtime.jsx)(HueSaturation.v,{hue:0,saturation:-.2})]})}),(0,jsx_runtime.jsx)(Lights_component.Z,{keyLightIntensity:keyLightIntensity,keyLightColor:keyLightColor,fillLightIntensity:fillLightIntensity,fillLightColor:fillLightColor,fillLightPosition:fillLightPosition,backLightIntensity:backLightIntensity,backLightColor:backLightColor,backLightPosition:backLightPosition,lightTarget:lightTarget})]})},AvatarWrapper=function AvatarWrapper(props){var _props$loader;return(0,jsx_runtime.jsx)(react.Suspense,{fallback:null!==(_props$loader=props.loader)&&void 0!==_props$loader?_props$loader:(0,jsx_runtime.jsx)(components_Loader,{}),children:(0,jsx_runtime.jsx)(esm_react.zt,{children:(0,jsx_runtime.jsx)(Avatar,(0,objectSpread2.Z)({},props))})})};AvatarWrapper.__docgenInfo={description:"",methods:[],displayName:"AvatarWrapper",props:{modelSrc:{required:!0,tsType:{name:"union",raw:"string | Blob",elements:[{name:"string"},{name:"Blob"}]},description:"Arbitrary binary data (base64 string, Blob) of a `.glb` file or path (URL) to a `.glb` resource."},animationSrc:{required:!1,tsType:{name:"union",raw:"string | Blob",elements:[{name:"string"},{name:"Blob"}]},description:"Arbitrary binary data (base64 string, Blob) of a `.glb|.fbx` file or path (URL) to a `.glb|.fbx` resource.\nThe animation will be run for the 3D model provided in `modelSrc`."},poseSrc:{required:!1,tsType:{name:"union",raw:"string | Blob",elements:[{name:"string"},{name:"Blob"}]},description:"Arbitrary binary data (base64 string, Blob) or a path (URL) to `.glb` file which will be used to map Bone placements onto the underlying 3D model.\nApplied when not specifying an animation."},halfBody:{required:!1,tsType:{name:"boolean"},description:""},shadows:{required:!1,tsType:{name:"boolean"},description:"Enable rendering shadows on ground."},scale:{required:!1,tsType:{name:"number"},description:"Size of the rendered GLB model."},cameraTarget:{required:!1,tsType:{name:"number"},description:"Camera target on Y-axis."},cameraInitialDistance:{required:!1,tsType:{name:"number"},description:"Initial Z-axis distance from the object upon render."},style:{required:!1,tsType:{name:"CSSProperties"},description:"Apply styling to canvas DOM element.\nNote that background property can not be set via style prop, it will always be overridden to `transparent`.\nInstead, use `background` prop for that purpose."},idleRotation:{required:!1,tsType:{name:"boolean"},description:"Applies an idle rotation to the animated and half-body models."},emotion:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"number"}],raw:"Record"},description:"Applies a face emotion of the model."},background:{required:!1,tsType:{name:"Background"},description:"Allows adding a background image and background color to the scene.\nMake sure that image is loadable to prevent bg errors.\nbackground.src - Accepts URL string.\nbackground.color - Accepts Hexadeximal, RGB, X11 color name, HSL string, doesn't support CSS gradients."},capture:{required:!1,tsType:{name:"CaptureType"},description:"Return base64 image after making screenshot of the canvas."},loader:{required:!1,tsType:{name:"ReactNode"},description:"Pass custom fallback component."},dpr:{required:!1,tsType:{name:"Dpr"},description:"Device Pixel Ratio."},className:{required:!1,tsType:{name:"string"},description:"Custom style classes for canvas."},headMovement:{required:!1,tsType:{name:"boolean"},description:"Enable head tracking cursor movements."},cameraZoomTarget:{required:!1,tsType:{name:"Vector3"},description:"Initialise and update camera movement on Z-Axis.\nDefaults to full-body zoom distance."},onLoadedEffect:{required:!1,tsType:{name:"SpawnState['onLoadedEffect']",raw:"SpawnState['onLoadedEffect']"},description:"Spawn effect when model is loaded into scene."},onLoadedAnimation:{required:!1,tsType:{name:"SpawnState['onLoadedAnimation']",raw:"SpawnState['onLoadedAnimation']"},description:"Spawn animation when model is loaded into scene."},fov:{required:!1,tsType:{name:"number"},description:"Field of view of the camera."},effects:{required:!1,tsType:{name:"EffectConfiguration"},description:"Control some effects like post-processing effects"},children:{required:!1,tsType:{name:"ReactNode"},description:"Use any three.js(fiber, post-processing) compatible components to render in the scene."},animations:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"string"}],raw:"Record"},description:""},activeAnimation:{required:!1,tsType:{name:"string"},description:""},animationConfig:{required:!1,tsType:{name:"AnimationConfiguration"},description:"Control properties of animations."},materialConfig:{required:!1,tsType:{name:"MaterialConfiguration"},description:"Control properties of materials."}},composes:["LightingProps","EnvironmentProps","Omit"]};var Avatar_component=AvatarWrapper},"./src/components/Lights/Lights.component.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{E:function(){return LIGHT_CONFIG},Z:function(){return Lights_component}});var slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),react=__webpack_require__("./node_modules/react/index.js"),defineProperty=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),toConsumableArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js"),definedProps=function definedProps(obj){return function fromEntries(arr){return Object.assign.apply(Object,[{}].concat((0,toConsumableArray.Z)(arr.map((function(_ref){var _ref2=(0,slicedToArray.Z)(_ref,2),k=_ref2[0],v=_ref2[1];return(0,defineProperty.Z)({},k,v)})))))}(Object.entries(obj).filter((function(_ref4){var _ref5=(0,slicedToArray.Z)(_ref4,2);_ref5[0];return void 0!==_ref5[1]})))},three_module=__webpack_require__("./node_modules/three/build/three.module.js"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),LIGHT_CONFIG=Object.freeze({fillLightAngle:Math.PI/3,backLightAngle:Math.PI/8,keyLightAngle:Math.PI,silhouetteLightAngle:1.5*Math.PI,keyLightPosition:new three_module.Vector3(.5,1.55,.5),liftLightPosition:new three_module.Vector3(.25,1.7,2),dirLightPosition:new three_module.Vector3(-.75,2.5,-1),silhouetteLightPosition:new three_module.Vector3(-1.5,.1,-1.5),defaultProps:{keyLightIntensity:.8,keyLightColor:"#FFFFFF",fillLightIntensity:3,fillLightColor:"#6794FF",fillLightPosition:new three_module.Vector3(-.5,1.6,-.5),backLightIntensity:6,backLightColor:"#FFB878",backLightPosition:new three_module.Vector3(.5,1.6,-1),lightTarget:new three_module.Vector3(0,1.7,0)}}),Lights=function Lights(lightingProps){var _Object$assign=Object.assign(LIGHT_CONFIG.defaultProps,definedProps(lightingProps)),keyLightIntensity=_Object$assign.keyLightIntensity,keyLightColor=_Object$assign.keyLightColor,fillLightIntensity=_Object$assign.fillLightIntensity,fillLightColor=_Object$assign.fillLightColor,fillLightPosition=_Object$assign.fillLightPosition,backLightIntensity=_Object$assign.backLightIntensity,backLightColor=_Object$assign.backLightColor,backLightPosition=_Object$assign.backLightPosition,lightTarget=_Object$assign.lightTarget,scene=(0,index_99983b2d_esm.A)().scene,_useState=(0,react.useState)({head:new three_module.Object3D,shoe:new three_module.Object3D}),targets=(0,slicedToArray.Z)(_useState,1)[0];return(0,react.useEffect)((function(){targets.head.position.copy(lightTarget),targets.shoe.position.set(0,0,0),scene.add(targets.head),scene.add(targets.shoe)}),[]),(0,jsx_runtime.jsxs)("group",{children:[(0,jsx_runtime.jsx)("spotLight",{position:fillLightPosition,target:targets.head,angle:LIGHT_CONFIG.fillLightAngle,color:fillLightColor,intensity:fillLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:backLightPosition,target:targets.head,angle:LIGHT_CONFIG.backLightAngle,color:backLightColor,intensity:backLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:LIGHT_CONFIG.keyLightPosition,target:targets.head,angle:LIGHT_CONFIG.keyLightAngle,color:keyLightColor,intensity:keyLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:LIGHT_CONFIG.liftLightPosition,target:targets.shoe,angle:LIGHT_CONFIG.keyLightAngle,color:keyLightColor,intensity:.25*keyLightIntensity,castShadow:!0}),(0,jsx_runtime.jsx)("spotLight",{position:LIGHT_CONFIG.silhouetteLightPosition,target:targets.head,angle:LIGHT_CONFIG.silhouetteLightAngle,color:keyLightColor,intensity:.25*keyLightIntensity,castShadow:!0})]})};Lights.__docgenInfo={description:"",methods:[],displayName:"Lights"};var Lights_component=Lights}}]); \ No newline at end of file diff --git a/docs/742.0d8aae0c.iframe.bundle.js b/docs/742.0d8aae0c.iframe.bundle.js new file mode 100644 index 00000000..6619504a --- /dev/null +++ b/docs/742.0d8aae0c.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_readyplayerme_visage=self.webpackChunk_readyplayerme_visage||[]).push([[742],{"./src/components/Background/Box/Box.component.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{x:function(){return Box}});var _home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),three__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/three/build/three.module.js"),_react_three_fiber__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js"),_excluded=["src"],Box=function Box(_ref){var _ref$src=_ref.src,src=void 0===_ref$src?"":_ref$src,baseProps=(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_2__.Z)(_ref,_excluded),ref=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),texture=(0,_react_three_fiber__WEBPACK_IMPORTED_MODULE_3__.F)(three__WEBPACK_IMPORTED_MODULE_4__.TextureLoader,src);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("mesh",(0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__.Z)((0,_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_5__.Z)({ref:ref,castShadow:!0,receiveShadow:!0},baseProps),{},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("boxBufferGeometry",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("meshPhysicalMaterial",{map:texture})]}))};Box.__docgenInfo={description:"",methods:[],displayName:"Box",props:{src:{defaultValue:{value:"''",computed:!1},required:!1}}}},"./src/components/Background/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{l:function(){return BackgroundColor}});__webpack_require__("./node_modules/react/index.js");var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),BackgroundColor=function BackgroundColor(_ref){var color=_ref.color;return(0,jsx_runtime.jsx)("color",{attach:"background",args:[color]})};BackgroundColor.__docgenInfo={description:"",methods:[],displayName:"BackgroundColor"};__webpack_require__("./src/components/Background/Box/Box.component.tsx")},"./src/components/BaseCanvas/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{u:function(){return BaseCanvas}});var objectSpread2=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),react_three_fiber_esm=(__webpack_require__("./node_modules/react/index.js"),__webpack_require__("./node_modules/@react-three/fiber/dist/react-three-fiber.esm.js")),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),Client_service=__webpack_require__("./src/services/Client.service.ts"),BaseCanvas_module_base_canvas="BaseCanvas_base-canvas__7RHH3",jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),BASE_DPR=Client_service.Y?window.devicePixelRatio:1,BaseCanvas=function BaseCanvas(_ref){var enablePostProcessing=_ref.enablePostProcessing,_ref$children=_ref.children,children=void 0===_ref$children?void 0:_ref$children,_ref$fov=_ref.fov,fov=void 0===_ref$fov?50:_ref$fov,_ref$position=_ref.position,position=void 0===_ref$position?new three_module.Vector3(0,0,5):_ref$position,style=_ref.style,_ref$dpr=_ref.dpr,dpr=void 0===_ref$dpr?[.5*BASE_DPR,2]:_ref$dpr,className=_ref.className;return(0,jsx_runtime.jsx)(react_three_fiber_esm.Xz,{className:"".concat(BaseCanvas_module_base_canvas," ").concat(null!=className?className:""),shadows:"soft",gl:{preserveDrawingBuffer:!0,alpha:!0,toneMapping:three_module.ACESFilmicToneMapping,toneMappingExposure:1.8},flat:enablePostProcessing,dpr:dpr,camera:{fov:fov,position:position},resize:{scroll:!0,debounce:{scroll:50,resize:0}},style:(0,objectSpread2.Z)((0,objectSpread2.Z)({},style),{},{background:"transparent"}),children:children},fov)};BaseCanvas.__docgenInfo={description:"",methods:[],displayName:"BaseCanvas",props:{children:{defaultValue:{value:"undefined",computed:!0},required:!1},fov:{defaultValue:{value:"50",computed:!1},required:!1},position:{defaultValue:{value:"new Vector3(0, 0, 5)",computed:!1},required:!1},dpr:{defaultValue:{value:"[BASE_DPR * 0.5, 2]",computed:!1},required:!1}}}},"./src/components/Capture/Capture.component.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_react_three_fiber__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js"),Capture=function Capture(_ref){var trigger=_ref.trigger,settings=_ref.settings,callBack=_ref.callBack,gl=(0,_react_three_fiber__WEBPACK_IMPORTED_MODULE_2__.A)((function(state){return state.gl})),type=(null==settings?void 0:settings.type)||"image/png",quality=(null==settings?void 0:settings.quality)||.1;return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){if(trigger){var _capture=gl.domElement.toDataURL(type,quality);callBack(_capture)}}),[trigger]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.Fragment,{})};Capture.__docgenInfo={description:"",methods:[],displayName:"Capture"},__webpack_exports__.Z=Capture},"./src/components/Models/FloatingModel/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{q:function(){return FloatingModelContainer}});var objectSpread2=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),react=__webpack_require__("./node_modules/react/index.js"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),Model=__webpack_require__("./src/components/Models/Model/index.ts"),services=__webpack_require__("./src/services/index.ts"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),FloatingModel=function FloatingModel(_ref){var modelSrc=_ref.modelSrc,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,onLoaded=_ref.onLoaded,bloom=_ref.bloom,ref=(0,react.useRef)(null),scene=(0,services.Jr)(modelSrc).scene;return(0,index_99983b2d_esm.C)((function(state){var t=state.clock.getElapsedTime();null!=ref&&ref.current&&(ref.current.rotation.y=Math.sin(t/2)/8,ref.current.position.y=(1+Math.sin(t/1.5))/-9)})),(0,jsx_runtime.jsx)(Model.H,{modelRef:ref,scale:scale,scene:scene,onLoaded:onLoaded,bloom:bloom})};FloatingModel.__docgenInfo={description:"",methods:[],displayName:"FloatingModel",props:{scale:{defaultValue:{value:"1.0",computed:!1},required:!1}}};var FloatingModelContainer=function FloatingModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(FloatingModel,(0,objectSpread2.Z)((0,objectSpread2.Z)({},props),{},{setModelFallback:setFallback}))})};FloatingModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"FloatingModelContainer"}},"./src/components/Models/Model/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{H:function(){return Model}});var slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),react=__webpack_require__("./node_modules/react/index.js"),services=__webpack_require__("./src/services/index.ts"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),Client_service=__webpack_require__("./src/services/Client.service.ts"),esm_react=__webpack_require__("./node_modules/jotai/esm/react.mjs"),regeneratorRuntime=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),asyncToGenerator=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),Animation_service=__webpack_require__("./src/services/Animation.service.ts"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),SpawnEffect=function SpawnEffect(_ref){var onLoadedEffect=_ref.onLoadedEffect,onLoadedEffectFinish=_ref.onLoadedEffectFinish,ref=(0,react.useRef)(null),_React$useState=react.useState(!0),_React$useState2=(0,slicedToArray.Z)(_React$useState,2),effectRunning=_React$useState2[0],setEffectRunning=_React$useState2[1],mountEffectScene=(0,services.Jr)(onLoadedEffect.src).scene,mountEffectNode=(0,index_99983b2d_esm.D)(mountEffectScene).nodes;(0,react.useEffect)((function(){effectRunning||(0,services.DK)(onLoadedEffectFinish)}),[onLoadedEffectFinish,effectRunning]);var animationLoadedEffect=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee(){return(0,regeneratorRuntime.Z)().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.abrupt("return",(0,Animation_service.$)((null==onLoadedEffect?void 0:onLoadedEffect.animationSrc)||onLoadedEffect.src));case 1:case"end":return _context.stop()}}),_callee)}))),[null==onLoadedEffect?void 0:onLoadedEffect.animationSrc,onLoadedEffect.src]),spawnEffectMixer=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee2(){var mixer,loadedEffect,animation;return(0,regeneratorRuntime.Z)().wrap((function _callee2$(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return mixer=new three_module.AnimationMixer(mountEffectNode.Scene),_context2.next=3,animationLoadedEffect;case 3:if(loadedEffect=_context2.sent){_context2.next=7;break}return setEffectRunning(!1),_context2.abrupt("return",mixer);case 7:return(animation=mixer.clipAction(loadedEffect)).setLoop(three_module.LoopRepeat,(null==onLoadedEffect?void 0:onLoadedEffect.loop)||1),animation.clampWhenFinished=!0,animation.play(),mixer.addEventListener("finished",(function(){animation.fadeOut(.5),setEffectRunning(!1)})),_context2.abrupt("return",mixer);case 13:case"end":return _context2.stop()}}),_callee2)}))),[mountEffectNode.Scene,animationLoadedEffect,null==onLoadedEffect?void 0:onLoadedEffect.loop]);return(0,index_99983b2d_esm.C)(function(){var _ref4=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee3(state,delta){var _yield$spawnEffectMix;return(0,regeneratorRuntime.Z)().wrap((function _callee3$(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:return _context3.next=2,spawnEffectMixer;case 2:if(_context3.t1=_yield$spawnEffectMix=_context3.sent,_context3.t0=null===_context3.t1,_context3.t0){_context3.next=6;break}_context3.t0=void 0===_yield$spawnEffectMix;case 6:if(!_context3.t0){_context3.next=10;break}_context3.next=11;break;case 10:_yield$spawnEffectMix.update(delta);case 11:case"end":return _context3.stop()}}),_callee3)})));return function(_x,_x2){return _ref4.apply(this,arguments)}}()),(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:effectRunning&&(0,jsx_runtime.jsx)("primitive",{modelRef:ref,object:mountEffectScene})})};SpawnEffect.__docgenInfo={description:"",methods:[],displayName:"SpawnEffect"};var SpawnAnimation=function SpawnAnimation(_ref){var avatar=_ref.avatar,onLoadedAnimationFinish=_ref.onLoadedAnimationFinish,onLoadedAnimation=_ref.onLoadedAnimation,_React$useState=react.useState(!0),_React$useState2=(0,slicedToArray.Z)(_React$useState,2),animationRunning=_React$useState2[0],setAnimationRunning=_React$useState2[1];(0,react.useEffect)((function(){animationRunning||(0,services.DK)(onLoadedAnimationFinish)}),[onLoadedAnimationFinish,animationRunning]);var avatarNode=(0,index_99983b2d_esm.D)(avatar).nodes,animationClip=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee(){return(0,regeneratorRuntime.Z)().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.abrupt("return",(0,Animation_service.$)((null==onLoadedAnimation?void 0:onLoadedAnimation.src)||""));case 1:case"end":return _context.stop()}}),_callee)}))),[null==onLoadedAnimation?void 0:onLoadedAnimation.src]),animationMixerAvatar=(0,react.useMemo)((0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee2(){var mixer,animation;return(0,regeneratorRuntime.Z)().wrap((function _callee2$(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:if(mixer=new three_module.AnimationMixer(avatarNode.Armature),avatarNode.Armature){_context2.next=3;break}return _context2.abrupt("return",mixer);case 3:return _context2.t0=mixer,_context2.next=6,animationClip;case 6:return _context2.t1=_context2.sent,(animation=_context2.t0.clipAction.call(_context2.t0,_context2.t1)).setLoop(three_module.LoopRepeat,(null==onLoadedAnimation?void 0:onLoadedAnimation.loop)||1),animation.clampWhenFinished=!0,animation.play(),mixer.addEventListener("finished",(function(){animation.fadeOut(.5),setAnimationRunning(!1)})),_context2.abrupt("return",mixer);case 13:case"end":return _context2.stop()}}),_callee2)}))),[avatarNode.Armature,null==onLoadedAnimation?void 0:onLoadedAnimation.loop,animationClip]);return(0,index_99983b2d_esm.C)(function(){var _ref4=(0,asyncToGenerator.Z)((0,regeneratorRuntime.Z)().mark((function _callee3(state,delta){var _yield$animationMixer;return(0,regeneratorRuntime.Z)().wrap((function _callee3$(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:return _context3.next=2,animationMixerAvatar;case 2:if(_context3.t1=_yield$animationMixer=_context3.sent,_context3.t0=null===_context3.t1,_context3.t0){_context3.next=6;break}_context3.t0=void 0===_yield$animationMixer;case 6:if(!_context3.t0){_context3.next=10;break}_context3.next=11;break;case 10:_yield$animationMixer.update(delta);case 11:case"end":return _context3.stop()}}),_callee3)})));return function(_x,_x2){return _ref4.apply(this,arguments)}}()),(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})};SpawnAnimation.__docgenInfo={description:"",methods:[],displayName:"SpawnAnimation"};var spawnAtom=__webpack_require__("./src/state/spawnAtom.ts"),Spawn=function Spawn(_ref){var _animationProps$onLoa,_animationProps$onLoa2,avatar=_ref.avatar,onSpawnFinish=_ref.onSpawnFinish,animationProps=(0,esm_react.Dv)(spawnAtom.O),usesMountEffect=(0,services.w9)(null==animationProps||null===(_animationProps$onLoa=animationProps.onLoadedEffect)||void 0===_animationProps$onLoa?void 0:_animationProps$onLoa.src),usesMountAnimation=(0,services.w9)(null==animationProps||null===(_animationProps$onLoa2=animationProps.onLoadedAnimation)||void 0===_animationProps$onLoa2?void 0:_animationProps$onLoa2.src),_React$useState=react.useState(usesMountEffect),_React$useState2=(0,slicedToArray.Z)(_React$useState,2),effectRunning=_React$useState2[0],setEffectRunning=_React$useState2[1],_React$useState3=react.useState(usesMountAnimation),_React$useState4=(0,slicedToArray.Z)(_React$useState3,2),animationRunning=_React$useState4[0],setAnimationRunning=_React$useState4[1];(0,react.useEffect)((function(){animationRunning||effectRunning||(0,services.DK)(onSpawnFinish)}),[onSpawnFinish,effectRunning,animationRunning]);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[usesMountEffect&&(0,jsx_runtime.jsx)(SpawnEffect,{onLoadedEffect:animationProps.onLoadedEffect,onLoadedEffectFinish:function onLoadedEffectFinish(){setEffectRunning(!1)}}),usesMountAnimation&&(0,jsx_runtime.jsx)(SpawnAnimation,{onLoadedAnimation:animationProps.onLoadedAnimation,avatar:avatar,onLoadedAnimationFinish:function onLoadedAnimationFinish(){setAnimationRunning(!1)}})]})};Spawn.__docgenInfo={description:"",methods:[],displayName:"Spawn"};var Model=function Model(_ref){var scene=_ref.scene,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,modelRef=_ref.modelRef,onLoaded=_ref.onLoaded,onSpawnAnimationFinish=_ref.onSpawnAnimationFinish,bloom=_ref.bloom,materialConfig=_ref.materialConfig,materials=(0,index_99983b2d_esm.D)(scene).materials,gl=(0,index_99983b2d_esm.A)().gl,_useState=(0,react.useState)(!1),_useState2=(0,slicedToArray.Z)(_useState,2),isTouching=_useState2[0],setIsTouching=_useState2[1],_useState3=(0,react.useState)(null),_useState4=(0,slicedToArray.Z)(_useState3,2),touchEvent=_useState4[0],setTouchEvent=_useState4[1],setTouchingOn=function setTouchingOn(e){Client_service.Y&&window.TouchEvent&&e instanceof TouchEvent&&setTouchEvent(e),setIsTouching(!0)},setTouchingOff=function setTouchingOff(e){Client_service.Y&&window.TouchEvent&&e instanceof TouchEvent&&setTouchEvent(null),setIsTouching(!1)};(0,services._U)(scene);var onTouchMove=(0,react.useCallback)((function(event){if(isTouching&&event instanceof MouseEvent&&(scene.rotation.y+=.005*event.movementX),Client_service.Y&&isTouching&&window.TouchEvent&&event instanceof TouchEvent){var movementX=Math.round(event.touches[0].pageX-touchEvent.touches[0].pageX);scene.rotation.y+=.005*movementX,setTouchEvent(event)}}),[isTouching,touchEvent,scene]);(0,services.Zm)(materials,bloom,materialConfig),scene.traverse((function(object){var node=object;node.isMesh&&(node.castShadow=!0),"SkinnedMesh"===node.type&&(node.receiveShadow=!0)})),(0,react.useEffect)((function(){return(0,services.DK)(onLoaded)}),[scene,materials,onLoaded]),(0,react.useEffect)((function(){return gl.domElement.addEventListener("mousedown",setTouchingOn),gl.domElement.addEventListener("touchstart",setTouchingOn,{passive:!0}),window.addEventListener("mouseup",setTouchingOff),gl.domElement.addEventListener("touchend",setTouchingOff),gl.domElement.addEventListener("touchcancel",setTouchingOff),window.addEventListener("mousemove",onTouchMove),gl.domElement.addEventListener("touchmove",onTouchMove,{passive:!0}),function(){gl.domElement.removeEventListener("mousedown",setTouchingOn),gl.domElement.removeEventListener("touchstart",setTouchingOn),window.removeEventListener("mouseup",setTouchingOff),gl.domElement.removeEventListener("touchend",setTouchingOff),gl.domElement.removeEventListener("touchcancel",setTouchingOff),window.removeEventListener("mousemove",onTouchMove),gl.domElement.removeEventListener("touchmove",onTouchMove)}}));var spawnComponent=(0,react.useMemo)((function(){return(0,jsx_runtime.jsx)(Spawn,{avatar:scene,onSpawnFinish:onSpawnAnimationFinish})}),[onSpawnAnimationFinish]);return(0,jsx_runtime.jsxs)("group",{ref:modelRef,dispose:null,rotation:[0,0,0],children:[(0,jsx_runtime.jsx)("primitive",{object:scene,scale:scale}),spawnComponent]})};Model.__docgenInfo={description:"",methods:[],displayName:"Model",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}}},"./src/components/Models/StaticModel/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{P:function(){return StaticModelContainer}});var objectSpread2=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),slicedToArray=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),react=__webpack_require__("./node_modules/react/index.js"),Model=__webpack_require__("./src/components/Models/Model/index.ts"),services=__webpack_require__("./src/services/index.ts"),index_99983b2d_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/index-99983b2d.esm.js"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),StaticModel=function StaticModel(_ref){var modelSrc=_ref.modelSrc,modelRef=_ref.modelRef,_ref$scale=_ref.scale,scale=void 0===_ref$scale?1:_ref$scale,setModelFallback=_ref.setModelFallback,onLoaded=_ref.onLoaded,emotion=_ref.emotion,bloom=_ref.bloom,materialConfig=_ref.materialConfig,scene=(0,services.Jr)(modelSrc).scene,nodes=(0,index_99983b2d_esm.D)(scene).nodes;return(0,services.Kx)(nodes,emotion),(0,services.xD)(nodes,setModelFallback),(0,jsx_runtime.jsx)(Model.H,{modelRef:modelRef,scene:scene,scale:scale,onLoaded:onLoaded,bloom:bloom,materialConfig:materialConfig})};StaticModel.__docgenInfo={description:"",methods:[],displayName:"StaticModel",props:{scale:{defaultValue:{value:"1",computed:!1},required:!1}}};var StaticModelContainer=function StaticModelContainer(props){var _useState=(0,react.useState)((0,jsx_runtime.jsx)(jsx_runtime.Fragment,{})),_useState2=(0,slicedToArray.Z)(_useState,2),fallback=_useState2[0],setFallback=_useState2[1];return(0,jsx_runtime.jsx)(react.Suspense,{fallback:fallback,children:(0,jsx_runtime.jsx)(StaticModel,(0,objectSpread2.Z)({setModelFallback:setFallback},props))})};StaticModelContainer.__docgenInfo={description:"Contains model to handle suspense fallback.",methods:[],displayName:"StaticModelContainer"}},"./src/components/Scene/Environment.component.tsx":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{q:function(){return Environment}});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_react_three_drei__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/@react-three/drei/core/Environment.js"),src_services_Environment_service__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/services/Environment.service.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js"),Environment=function Environment(_ref){var environment=_ref.environment,enablePostProcessing=_ref.enablePostProcessing,config=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((function(){return{files:environment in src_services_Environment_service__WEBPACK_IMPORTED_MODULE_1__.s$?(0,src_services_Environment_service__WEBPACK_IMPORTED_MODULE_1__.G2)(environment):environment}}),[environment]),environmentIntensity=enablePostProcessing?12:4;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_react_three_drei__WEBPACK_IMPORTED_MODULE_3__.qA,{files:config.files,environmentIntensity:environmentIntensity})};Environment.__docgenInfo={description:"",methods:[],displayName:"Environment"}},"./src/services/Animation.service.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$:function(){return loadAnimationClip}});var _home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),_home_runner_work_visage_visage_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),three_stdlib__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/three-stdlib/loaders/FBXLoader.js"),three_stdlib__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/three-stdlib/loaders/GLTFLoader.js"),_meshopt_decoder__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/services/meshopt_decoder.ts"),fbxLoader=new three_stdlib__WEBPACK_IMPORTED_MODULE_1__.y,gltfLoader=new three_stdlib__WEBPACK_IMPORTED_MODULE_2__.E;function normaliseFbxAnimation(fbx){for(var index=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,tracks=fbx.animations[index].tracks,i=0;i0&&source.every(validateSource);if("string"==typeof source){var fileEndExpression=new RegExp(/(.glb|.fbx|.fbx[?].*|.glb[?].*)$/g),uploadFileExpression=new RegExp(/^data:application\/octet-stream;base64,/g),gltfModelExpression=new RegExp(/^data:model\/gltf-binary;base64,/g);return fileEndExpression.test(source)||uploadFileExpression.test(source)||gltfModelExpression.test(source)}return source instanceof Blob&&"model/gltf-binary"===source.type},isValidFormat=function isValidFormat(source){var isValid=validateSource(source);return source&&!isValid&&console.warn("Provided GLB/FBX is invalid. Check docs for supported formats: https://github.com/readyplayerme/visage"),isValid},clamp=function clamp(value,max,min){return Math.min(Math.max(min,value),max)},lerp=function lerp(start,end){var time=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.05;return start*(1-time)+end*time},normaliseMaterialsConfig=function normaliseMaterialsConfig(materials,bloomConfig,materialConfig){Object.values(materials).forEach((function(material){var _ref,_bloomConfig$material,mat=material;(mat.map&&(mat.map.minFilter=three__WEBPACK_IMPORTED_MODULE_3__.LinearFilter,mat.depthWrite=!0),mat.name.toLowerCase().includes("hair")&&(mat.roughness=.9),mat.emissiveMap)&&(mat.emissiveIntensity=null!==(_ref=null!==(_bloomConfig$material=null==bloomConfig?void 0:bloomConfig.materialIntensity)&&void 0!==_bloomConfig$material?_bloomConfig$material:null==materialConfig?void 0:materialConfig.emissiveIntensity)&&void 0!==_ref?_ref:3.3)}))},useHeadMovement=function useHeadMovement(_ref2){var nodes=_ref2.nodes,_ref2$isHalfBody=_ref2.isHalfBody,isHalfBody=void 0!==_ref2$isHalfBody&&_ref2$isHalfBody,_ref2$distance=_ref2.distance,distance=void 0===_ref2$distance?2:_ref2$distance,_ref2$activeRotation=_ref2.activeRotation,activeRotation=void 0===_ref2$activeRotation?.2:_ref2$activeRotation,_ref2$rotationMargin=_ref2.rotationMargin,rotationMargin=void 0===_ref2$rotationMargin?new three__WEBPACK_IMPORTED_MODULE_3__.Vector2(5,10):_ref2$rotationMargin,_ref2$enabled=_ref2.enabled,enabled=void 0!==_ref2$enabled&&_ref2$enabled,rad=Math.PI/180,currentPos=new three__WEBPACK_IMPORTED_MODULE_3__.Vector2(0,0),targetPos=new three__WEBPACK_IMPORTED_MODULE_3__.Vector2(0,0),activeDistance=distance-(isHalfBody?1:0),eyeRotationOffsetX=isHalfBody?90*rad:0,neckBoneRotationOffsetX=(isHalfBody?-5:10)*rad,mapRange=function mapRange(value,inMin,inMax,outMin,outMax){return(clamp(value,inMax,inMin)-inMin)*(outMax-outMin)/(inMax-inMin)+outMin};(0,_react_three_fiber__WEBPACK_IMPORTED_MODULE_4__.C)((function(state){if(enabled&&nodes.Neck&&nodes.Head&&nodes.RightEye&&nodes.LeftEye){var cameraToHeadDistance=state.camera.position.distanceTo(nodes.Head.position),cameraRotation=Math.abs(state.camera.rotation.z);cameraToHeadDistance1&&void 0!==arguments[1]?arguments[1]:new Transform;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("group",{children:Object.keys(nodes).map((function(key){var node=nodes[key];return"SkinnedMesh"===node.type?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("skinnedMesh",{castShadow:!0,receiveShadow:!0,scale:transform.scale,position:transform.position,rotation:transform.rotation,geometry:node.geometry,material:node.material,skeleton:node.skeleton,morphTargetInfluences:node.morphTargetInfluences||[]},node.name):"Mesh"===node.type?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("mesh",{attach:function attach(parent,self){return parent.add(self),self.parent=node.parent,function(){return parent.remove(self)}},castShadow:!0,receiveShadow:!0,scale:node.scale,position:node.position,rotation:node.rotation,geometry:node.geometry,material:node.material,morphTargetInfluences:node.morphTargetInfluences||[]},node.name):null}))})}(nodes))}),[setter,nodes])},triggerCallback=function triggerCallback(callback){"function"==typeof callback&&callback()},expressions={blink:[{morphTarget:"eyesClosed",morphTargetIndex:-1,offset:0,duration:.2},{morphTarget:"eyeSquintLeft",morphTargetIndex:-1,offset:0,duration:.2},{morphTarget:"eyeSquintRight",morphTargetIndex:-1,offset:0,duration:.2}]},useIdleExpression=function useIdleExpression(expression,nodes){var headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.head,selectedExpression=expression in expressions?expressions[expression]:void 0,timeout=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),duration=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(Number.POSITIVE_INFINITY);(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){if(null!=headMesh&&headMesh.morphTargetDictionary&&selectedExpression)for(var i=0;isection.offset){var pivot=(duration.current-section.offset)/section.duration*Math.PI,morphInfluence=Math.sin(pivot);headMesh.morphTargetInfluences[section.morphTargetIndex]=morphInfluence}}else headMesh.morphTargetInfluences[section.morphTargetIndex]=0}}}),[null==headMesh?void 0:headMesh.morphTargetInfluences,selectedExpression,duration.current,timeout.current]),setNextInterval=function setNextInterval(){duration.current=0;var delay=3e3*Math.random()+3e3;clearTimeout(timeout.current),timeout.current=setTimeout(setNextInterval,delay)};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){return selectedExpression&&(timeout.current=setTimeout(setNextInterval,3e3)),function(){clearTimeout(timeout.current)}}),[selectedExpression]),(0,_react_three_fiber__WEBPACK_IMPORTED_MODULE_4__.C)((function(_,delta){headMesh&&selectedExpression&&animateExpression(delta)}))}},"./src/services/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{DK:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.DK},FB:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.FB},Jr:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.Jr},Kx:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.Kx},O1:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.O1},Zm:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.Zm},_U:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__._U},bu:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.bu},bx:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.bx},gT:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.gT},t7:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.t7},uZ:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.uZ},w9:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.w9},wx:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.wx},xD:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.xD}});var _Models_service__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/services/Models.service.tsx")},"./src/services/meshopt_decoder.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{z:function(){return MeshoptDecoder}});var MeshoptDecoder=function(){var 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]),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]);if("object"!=typeof WebAssembly)return{supported:!1};var instance,wasm=WebAssembly.validate(detector)?"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;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9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bavc;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",ready=WebAssembly.instantiate(unpack(wasm),{}).then((function(result){(instance=result.instance).exports.__wasm_call_ctors()}));function unpack(data){for(var result=new Uint8Array(data.length),i=0;i96?ch-97:ch>64?ch-39:ch+4}var write=0;for(i=0;i0?function decodeWorker(count,size,source,mode,filter){for(var worker=workers[0],i=1;i1&&void 0!==arguments[1]?arguments[1]:0,tracks=fbx.animations[index].tracks,i=0;i0&&source.every(validateSource);if("string"==typeof source){var fileEndExpression=new RegExp(/(.glb|.fbx|.fbx[?].*|.glb[?].*)$/g),uploadFileExpression=new RegExp(/^data:application\/octet-stream;base64,/g),gltfModelExpression=new RegExp(/^data:model\/gltf-binary;base64,/g);return fileEndExpression.test(source)||uploadFileExpression.test(source)||gltfModelExpression.test(source)}return source instanceof Blob&&"model/gltf-binary"===source.type},isValidFormat=function isValidFormat(source){var isValid=validateSource(source);return source&&!isValid&&console.warn("Provided GLB/FBX is invalid. Check docs for supported formats: https://github.com/readyplayerme/visage"),isValid},clamp=function clamp(value,max,min){return Math.min(Math.max(min,value),max)},lerp=function lerp(start,end){var time=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.05;return start*(1-time)+end*time},normaliseMaterialsConfig=function normaliseMaterialsConfig(materials,bloomConfig){Object.values(materials).forEach((function(material){var mat=material;mat.map&&(mat.map.minFilter=three__WEBPACK_IMPORTED_MODULE_3__.LinearFilter,mat.depthWrite=!0),mat.name.toLowerCase().includes("hair")&&(mat.roughness=.9),mat.emissiveMap&&(mat.emissiveIntensity=(null==bloomConfig?void 0:bloomConfig.materialIntensity)||3.3)}))},useHeadMovement=function useHeadMovement(_ref){var nodes=_ref.nodes,_ref$isHalfBody=_ref.isHalfBody,isHalfBody=void 0!==_ref$isHalfBody&&_ref$isHalfBody,_ref$distance=_ref.distance,distance=void 0===_ref$distance?2:_ref$distance,_ref$activeRotation=_ref.activeRotation,activeRotation=void 0===_ref$activeRotation?.2:_ref$activeRotation,_ref$rotationMargin=_ref.rotationMargin,rotationMargin=void 0===_ref$rotationMargin?new three__WEBPACK_IMPORTED_MODULE_3__.Vector2(5,10):_ref$rotationMargin,_ref$enabled=_ref.enabled,enabled=void 0!==_ref$enabled&&_ref$enabled,rad=Math.PI/180,currentPos=new three__WEBPACK_IMPORTED_MODULE_3__.Vector2(0,0),targetPos=new three__WEBPACK_IMPORTED_MODULE_3__.Vector2(0,0),activeDistance=distance-(isHalfBody?1:0),eyeRotationOffsetX=isHalfBody?90*rad:0,neckBoneRotationOffsetX=(isHalfBody?-5:10)*rad,mapRange=function mapRange(value,inMin,inMax,outMin,outMax){return(clamp(value,inMax,inMin)-inMin)*(outMax-outMin)/(inMax-inMin)+outMin};(0,_react_three_fiber__WEBPACK_IMPORTED_MODULE_4__.C)((function(state){if(enabled&&nodes.Neck&&nodes.Head&&nodes.RightEye&&nodes.LeftEye){var cameraToHeadDistance=state.camera.position.distanceTo(nodes.Head.position),cameraRotation=Math.abs(state.camera.rotation.z);cameraToHeadDistance1&&void 0!==arguments[1]?arguments[1]:new Transform;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("group",{children:Object.keys(nodes).map((function(key){var node=nodes[key];return"SkinnedMesh"===node.type?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("skinnedMesh",{castShadow:!0,receiveShadow:!0,scale:transform.scale,position:transform.position,rotation:transform.rotation,geometry:node.geometry,material:node.material,skeleton:node.skeleton,morphTargetInfluences:node.morphTargetInfluences||[]},node.name):"Mesh"===node.type?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("mesh",{attach:function attach(parent,self){return parent.add(self),self.parent=node.parent,function(){return parent.remove(self)}},castShadow:!0,receiveShadow:!0,scale:node.scale,position:node.position,rotation:node.rotation,geometry:node.geometry,material:node.material,morphTargetInfluences:node.morphTargetInfluences||[]},node.name):null}))})}(nodes))}),[setter,nodes])},triggerCallback=function triggerCallback(callback){"function"==typeof callback&&callback()},expressions={blink:[{morphTarget:"eyesClosed",morphTargetIndex:-1,offset:0,duration:.2},{morphTarget:"eyeSquintLeft",morphTargetIndex:-1,offset:0,duration:.2},{morphTarget:"eyeSquintRight",morphTargetIndex:-1,offset:0,duration:.2}]},useIdleExpression=function useIdleExpression(expression,nodes){var headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.head,selectedExpression=expression in expressions?expressions[expression]:void 0,timeout=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),duration=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(Number.POSITIVE_INFINITY);(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){if(null!=headMesh&&headMesh.morphTargetDictionary&&selectedExpression)for(var i=0;isection.offset){var pivot=(duration.current-section.offset)/section.duration*Math.PI,morphInfluence=Math.sin(pivot);headMesh.morphTargetInfluences[section.morphTargetIndex]=morphInfluence}}else headMesh.morphTargetInfluences[section.morphTargetIndex]=0}}}),[null==headMesh?void 0:headMesh.morphTargetInfluences,selectedExpression,duration.current,timeout.current]),setNextInterval=function setNextInterval(){duration.current=0;var delay=3e3*Math.random()+3e3;clearTimeout(timeout.current),timeout.current=setTimeout(setNextInterval,delay)};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((function(){return selectedExpression&&(timeout.current=setTimeout(setNextInterval,3e3)),function(){clearTimeout(timeout.current)}}),[selectedExpression]),(0,_react_three_fiber__WEBPACK_IMPORTED_MODULE_4__.C)((function(_,delta){headMesh&&selectedExpression&&animateExpression(delta)}))}},"./src/services/index.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{DK:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.DK},FB:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.FB},Jr:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.Jr},Kx:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.Kx},O1:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.O1},Zm:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.Zm},_U:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__._U},bu:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.bu},bx:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.bx},gT:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.gT},t7:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.t7},uZ:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.uZ},w9:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.w9},wx:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.wx},xD:function(){return _Models_service__WEBPACK_IMPORTED_MODULE_0__.xD}});var _Models_service__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/services/Models.service.tsx")},"./src/services/meshopt_decoder.ts":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{z:function(){return MeshoptDecoder}});var MeshoptDecoder=function(){var 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]),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]);if("object"!=typeof WebAssembly)return{supported:!1};var instance,wasm=WebAssembly.validate(detector)?"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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Ehokavcj;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",ready=WebAssembly.instantiate(unpack(wasm),{}).then((function(result){(instance=result.instance).exports.__wasm_call_ctors()}));function unpack(data){for(var result=new Uint8Array(data.length),i=0;i96?ch-97:ch>64?ch-39:ch+4}var write=0;for(i=0;i0?function decodeWorker(count,size,source,mode,filter){for(var worker=workers[0],i=1;i \ No newline at end of file + import './main.cab8498d.iframe.bundle.js'; \ No newline at end of file diff --git a/docs/main.18d0ac05.iframe.bundle.js b/docs/main.cab8498d.iframe.bundle.js similarity index 92% rename from docs/main.18d0ac05.iframe.bundle.js rename to docs/main.cab8498d.iframe.bundle.js index 6c145415..38dee089 100644 --- a/docs/main.18d0ac05.iframe.bundle.js +++ b/docs/main.cab8498d.iframe.bundle.js @@ -1 +1 @@ -(self.webpackChunk_readyplayerme_visage=self.webpackChunk_readyplayerme_visage||[]).push([[179],{"./.storybook/preview.js":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{__namedExportsOrder:function(){return __namedExportsOrder},parameters:function(){return parameters}});var parameters={layout:"fullscreen",controls:{matchers:{color:/(background|color)$/i,date:/Date$/}}},__namedExportsOrder=["parameters"]},"./src lazy recursive ^\\.\\/.*$ include: (?:\\/src(?:\\/(?%21\\.)(?:(?:(?%21(?:^%7C\\/)\\.).)*?)\\/%7C\\/%7C$)(?%21\\.)(?=.)[^/]*?\\.stories\\.(tsx%7Cmdx))$":function(module,__unused_webpack_exports,__webpack_require__){var map={"./components/Avatar/Avatar.stories":["./src/components/Avatar/Avatar.stories.tsx",576,140,742,176,130,989],"./components/Avatar/Avatar.stories.tsx":["./src/components/Avatar/Avatar.stories.tsx",576,140,742,176,130,989],"./components/Avatar/Debug.stories":["./src/components/Avatar/Debug.stories.tsx",576,140,135,742,176,877],"./components/Avatar/Debug.stories.tsx":["./src/components/Avatar/Debug.stories.tsx",576,140,135,742,176,877],"./components/Avatar/Examples.stories":["./src/components/Avatar/Examples.stories.tsx",576,140,742,176,130,960],"./components/Avatar/Examples.stories.tsx":["./src/components/Avatar/Examples.stories.tsx",576,140,742,176,130,960],"./components/Exhibit/Exhibit.stories":["./src/components/Exhibit/Exhibit.stories.tsx",576,152,742,22],"./components/Exhibit/Exhibit.stories.tsx":["./src/components/Exhibit/Exhibit.stories.tsx",576,152,742,22]};function webpackAsyncContext(req){if(!__webpack_require__.o(map,req))return Promise.resolve().then((function(){var e=new Error("Cannot find module '"+req+"'");throw e.code="MODULE_NOT_FOUND",e}));var ids=map[req],id=ids[0];return Promise.all(ids.slice(1).map(__webpack_require__.e)).then((function(){return __webpack_require__(id)}))}webpackAsyncContext.keys=function(){return Object.keys(map)},webpackAsyncContext.id="./src lazy recursive ^\\.\\/.*$ include: (?:\\/src(?:\\/(?%21\\.)(?:(?:(?%21(?:^%7C\\/)\\.).)*?)\\/%7C\\/%7C$)(?%21\\.)(?=.)[^/]*?\\.stories\\.(tsx%7Cmdx))$",module.exports=webpackAsyncContext},"./storybook-config-entry.js":function(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__){"use strict";var dist=__webpack_require__("./node_modules/@storybook/global/dist/index.mjs"),external_STORYBOOK_MODULE_PREVIEW_API_=__webpack_require__("@storybook/preview-api"),external_STORYBOOK_MODULE_CHANNELS_=__webpack_require__("@storybook/channels");const importers=[async path=>{if(!/^\.[\\/](?:src(?:\/(?!\.)(?:(?:(?!(?:^|\/)\.).)*?)\/|\/|$)(?!\.)(?=.)[^/]*?\.stories\.(tsx|mdx))$/.exec(path))return;const pathRemainder=path.substring(6);return __webpack_require__("./src lazy recursive ^\\.\\/.*$ include: (?:\\/src(?:\\/(?%21\\.)(?:(?:(?%21(?:^%7C\\/)\\.).)*?)\\/%7C\\/%7C$)(?%21\\.)(?=.)[^/]*?\\.stories\\.(tsx%7Cmdx))$")("./"+pathRemainder)}];const channel=(0,external_STORYBOOK_MODULE_CHANNELS_.createBrowserChannel)({page:"preview"});external_STORYBOOK_MODULE_PREVIEW_API_.addons.setChannel(channel),"DEVELOPMENT"===dist.global.CONFIG_TYPE&&(window.__STORYBOOK_SERVER_CHANNEL__=channel);const preview=new external_STORYBOOK_MODULE_PREVIEW_API_.PreviewWeb;window.__STORYBOOK_PREVIEW__=preview,window.__STORYBOOK_STORY_STORE__=preview.storyStore,window.__STORYBOOK_ADDONS_CHANNEL__=channel,window.__STORYBOOK_CLIENT_API__=new external_STORYBOOK_MODULE_PREVIEW_API_.ClientApi({storyStore:preview.storyStore}),preview.initialize({importFn:async function importFn(path){for(let i=0;iimporters[i](path),x());if(moduleExports)return moduleExports}var x},getProjectAnnotations:()=>(0,external_STORYBOOK_MODULE_PREVIEW_API_.composeConfigs)([__webpack_require__("./node_modules/@storybook/react/preview.js"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/docs/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/actions/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/backgrounds/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/measure/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/outline/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/highlight/preview.mjs"),__webpack_require__("./.storybook/preview.js")])})},"@storybook/channels":function(module){"use strict";module.exports=__STORYBOOK_MODULE_CHANNELS__},"@storybook/client-logger":function(module){"use strict";module.exports=__STORYBOOK_MODULE_CLIENT_LOGGER__},"@storybook/core-events":function(module){"use strict";module.exports=__STORYBOOK_MODULE_CORE_EVENTS__},"@storybook/preview-api":function(module){"use strict";module.exports=__STORYBOOK_MODULE_PREVIEW_API__}},function(__webpack_require__){__webpack_require__.O(0,[690],(function(){return moduleId="./storybook-config-entry.js",__webpack_require__(__webpack_require__.s=moduleId);var moduleId}));__webpack_require__.O()}]); \ No newline at end of file +(self.webpackChunk_readyplayerme_visage=self.webpackChunk_readyplayerme_visage||[]).push([[179],{"./.storybook/preview.js":function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{__namedExportsOrder:function(){return __namedExportsOrder},parameters:function(){return parameters}});var parameters={layout:"fullscreen",controls:{matchers:{color:/(background|color)$/i,date:/Date$/}}},__namedExportsOrder=["parameters"]},"./src lazy recursive ^\\.\\/.*$ include: (?:\\/src(?:\\/(?%21\\.)(?:(?:(?%21(?:^%7C\\/)\\.).)*?)\\/%7C\\/%7C$)(?%21\\.)(?=.)[^/]*?\\.stories\\.(tsx%7Cmdx))$":function(module,__unused_webpack_exports,__webpack_require__){var map={"./components/Avatar/Avatar.stories":["./src/components/Avatar/Avatar.stories.tsx",576,140,742,257,130,989],"./components/Avatar/Avatar.stories.tsx":["./src/components/Avatar/Avatar.stories.tsx",576,140,742,257,130,989],"./components/Avatar/Debug.stories":["./src/components/Avatar/Debug.stories.tsx",576,140,135,742,257,877],"./components/Avatar/Debug.stories.tsx":["./src/components/Avatar/Debug.stories.tsx",576,140,135,742,257,877],"./components/Avatar/Examples.stories":["./src/components/Avatar/Examples.stories.tsx",576,140,742,257,130,960],"./components/Avatar/Examples.stories.tsx":["./src/components/Avatar/Examples.stories.tsx",576,140,742,257,130,960],"./components/Exhibit/Exhibit.stories":["./src/components/Exhibit/Exhibit.stories.tsx",576,152,742,22],"./components/Exhibit/Exhibit.stories.tsx":["./src/components/Exhibit/Exhibit.stories.tsx",576,152,742,22]};function webpackAsyncContext(req){if(!__webpack_require__.o(map,req))return Promise.resolve().then((function(){var e=new Error("Cannot find module '"+req+"'");throw e.code="MODULE_NOT_FOUND",e}));var ids=map[req],id=ids[0];return Promise.all(ids.slice(1).map(__webpack_require__.e)).then((function(){return __webpack_require__(id)}))}webpackAsyncContext.keys=function(){return Object.keys(map)},webpackAsyncContext.id="./src lazy recursive ^\\.\\/.*$ include: (?:\\/src(?:\\/(?%21\\.)(?:(?:(?%21(?:^%7C\\/)\\.).)*?)\\/%7C\\/%7C$)(?%21\\.)(?=.)[^/]*?\\.stories\\.(tsx%7Cmdx))$",module.exports=webpackAsyncContext},"./storybook-config-entry.js":function(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__){"use strict";var dist=__webpack_require__("./node_modules/@storybook/global/dist/index.mjs"),external_STORYBOOK_MODULE_PREVIEW_API_=__webpack_require__("@storybook/preview-api"),external_STORYBOOK_MODULE_CHANNELS_=__webpack_require__("@storybook/channels");const importers=[async path=>{if(!/^\.[\\/](?:src(?:\/(?!\.)(?:(?:(?!(?:^|\/)\.).)*?)\/|\/|$)(?!\.)(?=.)[^/]*?\.stories\.(tsx|mdx))$/.exec(path))return;const pathRemainder=path.substring(6);return __webpack_require__("./src lazy recursive ^\\.\\/.*$ include: (?:\\/src(?:\\/(?%21\\.)(?:(?:(?%21(?:^%7C\\/)\\.).)*?)\\/%7C\\/%7C$)(?%21\\.)(?=.)[^/]*?\\.stories\\.(tsx%7Cmdx))$")("./"+pathRemainder)}];const channel=(0,external_STORYBOOK_MODULE_CHANNELS_.createBrowserChannel)({page:"preview"});external_STORYBOOK_MODULE_PREVIEW_API_.addons.setChannel(channel),"DEVELOPMENT"===dist.global.CONFIG_TYPE&&(window.__STORYBOOK_SERVER_CHANNEL__=channel);const preview=new external_STORYBOOK_MODULE_PREVIEW_API_.PreviewWeb;window.__STORYBOOK_PREVIEW__=preview,window.__STORYBOOK_STORY_STORE__=preview.storyStore,window.__STORYBOOK_ADDONS_CHANNEL__=channel,window.__STORYBOOK_CLIENT_API__=new external_STORYBOOK_MODULE_PREVIEW_API_.ClientApi({storyStore:preview.storyStore}),preview.initialize({importFn:async function importFn(path){for(let i=0;iimporters[i](path),x());if(moduleExports)return moduleExports}var x},getProjectAnnotations:()=>(0,external_STORYBOOK_MODULE_PREVIEW_API_.composeConfigs)([__webpack_require__("./node_modules/@storybook/react/preview.js"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/docs/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/actions/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/backgrounds/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/measure/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/outline/preview.mjs"),__webpack_require__("./node_modules/@storybook/addon-essentials/dist/highlight/preview.mjs"),__webpack_require__("./.storybook/preview.js")])})},"@storybook/channels":function(module){"use strict";module.exports=__STORYBOOK_MODULE_CHANNELS__},"@storybook/client-logger":function(module){"use strict";module.exports=__STORYBOOK_MODULE_CLIENT_LOGGER__},"@storybook/core-events":function(module){"use strict";module.exports=__STORYBOOK_MODULE_CORE_EVENTS__},"@storybook/preview-api":function(module){"use strict";module.exports=__STORYBOOK_MODULE_PREVIEW_API__}},function(__webpack_require__){__webpack_require__.O(0,[690],(function(){return moduleId="./storybook-config-entry.js",__webpack_require__(__webpack_require__.s=moduleId);var moduleId}));__webpack_require__.O()}]); \ No newline at end of file diff --git a/docs/project.json b/docs/project.json index b1fd0600..ce873516 100644 --- a/docs/project.json +++ b/docs/project.json @@ -1 +1 @@ -{"generatedAt":1727102696117,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"CRA","packageName":"react-scripts","version":"5.0.1"},"packageManager":{"type":"npm","version":"10.7.0"},"typescriptOptions":{"reactDocgen":"react-docgen","check":true},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-webpack5","options":{}},"builder":"@storybook/builder-webpack5","renderer":"@storybook/react","storybookVersion":"7.3.2","storybookVersionSpecifier":"7.3.2","language":"typescript","storybookPackages":{"@storybook/addon-actions":{"version":"7.3.2"},"@storybook/addon-interactions":{"version":"7.3.2"},"@storybook/addon-links":{"version":"7.3.2"},"@storybook/node-logger":{"version":"7.3.2"},"@storybook/react":{"version":"7.3.2"},"@storybook/react-webpack5":{"version":"7.3.2"},"@storybook/testing-library":{"version":"0.2.0"},"eslint-plugin-storybook":{"version":"0.6.13"},"storybook":{"version":"7.3.2"}},"addons":{"@storybook/addon-essentials":{"version":"7.3.2"},"@storybook/preset-create-react-app":{"version":"7.3.2"}}} +{"generatedAt":1727347914181,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":true,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"CRA","packageName":"react-scripts","version":"5.0.1"},"packageManager":{"type":"npm","version":"10.7.0"},"typescriptOptions":{"reactDocgen":"react-docgen","check":true},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-webpack5","options":{}},"builder":"@storybook/builder-webpack5","renderer":"@storybook/react","storybookVersion":"7.3.2","storybookVersionSpecifier":"7.3.2","language":"typescript","storybookPackages":{"@storybook/addon-actions":{"version":"7.3.2"},"@storybook/addon-interactions":{"version":"7.3.2"},"@storybook/addon-links":{"version":"7.3.2"},"@storybook/node-logger":{"version":"7.3.2"},"@storybook/react":{"version":"7.3.2"},"@storybook/react-webpack5":{"version":"7.3.2"},"@storybook/testing-library":{"version":"0.2.0"},"eslint-plugin-storybook":{"version":"0.6.13"},"storybook":{"version":"7.3.2"}},"addons":{"@storybook/addon-essentials":{"version":"7.3.2"},"@storybook/preset-create-react-app":{"version":"7.3.2"}}} diff --git a/docs/runtime~main.80c313af.iframe.bundle.js b/docs/runtime~main.8222fea2.iframe.bundle.js similarity index 98% rename from docs/runtime~main.80c313af.iframe.bundle.js rename to docs/runtime~main.8222fea2.iframe.bundle.js index 53726840..8f2a1ad3 100644 --- a/docs/runtime~main.80c313af.iframe.bundle.js +++ b/docs/runtime~main.8222fea2.iframe.bundle.js @@ -1 +1 @@ -!function(){"use strict";var deferred,leafPrototypes,getProto,inProgress,__webpack_modules__={},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(void 0!==cachedModule)return cachedModule.exports;var module=__webpack_module_cache__[moduleId]={id:moduleId,loaded:!1,exports:{}};return __webpack_modules__[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}__webpack_require__.m=__webpack_modules__,__webpack_require__.amdO={},deferred=[],__webpack_require__.O=function(result,chunkIds,fn,priority){if(!chunkIds){var notFulfilled=1/0;for(i=0;i=priority)&&Object.keys(__webpack_require__.O).every((function(key){return __webpack_require__.O[key](chunkIds[j])}))?chunkIds.splice(j--,1):(fulfilled=!1,priority0&&deferred[i-1][2]>priority;i--)deferred[i]=deferred[i-1];deferred[i]=[chunkIds,fn,priority]},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,{a:getter}),getter},getProto=Object.getPrototypeOf?function(obj){return Object.getPrototypeOf(obj)}:function(obj){return obj.__proto__},__webpack_require__.t=function(value,mode){if(1&mode&&(value=this(value)),8&mode)return value;if("object"==typeof value&&value){if(4&mode&&value.__esModule)return value;if(16&mode&&"function"==typeof value.then)return value}var ns=Object.create(null);__webpack_require__.r(ns);var def={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var current=2&mode&&value;"object"==typeof current&&!~leafPrototypes.indexOf(current);current=getProto(current))Object.getOwnPropertyNames(current).forEach((function(key){def[key]=function(){return value[key]}}));return def.default=function(){return value},__webpack_require__.d(ns,def),ns},__webpack_require__.d=function(exports,definition){for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},__webpack_require__.f={},__webpack_require__.e=function(chunkId){return Promise.all(Object.keys(__webpack_require__.f).reduce((function(promises,key){return __webpack_require__.f[key](chunkId,promises),promises}),[]))},__webpack_require__.u=function(chunkId){return({22:"components-Exhibit-Exhibit-stories",877:"components-Avatar-Debug-stories",960:"components-Avatar-Examples-stories",989:"components-Avatar-Avatar-stories"}[chunkId]||chunkId)+"."+{22:"2aba2a82",77:"397dacae",130:"1611eafa",135:"c0b7df5b",140:"a6128e7c",152:"00429889",176:"983fb1d3",213:"75309cdc",238:"ca8ac7f0",253:"2e3b41a1",341:"0048daa7",355:"1ed6cf43",434:"5a97dc57",576:"ad2dabc8",613:"80c3158e",615:"e29af5bf",622:"d56d0ceb",628:"76b8bffc",652:"e4668753",693:"10b56cce",699:"8aa78ce0",729:"83c965d9",742:"b6487675",744:"766ba7a7",760:"34212037",877:"8d45f161",960:"9b7b9263",966:"e1f4c7a5",983:"583a3211",989:"f35a83bc"}[chunkId]+".iframe.bundle.js"},__webpack_require__.miniCssF=function(chunkId){return"static/css/"+{22:"components-Exhibit-Exhibit-stories",877:"components-Avatar-Debug-stories",960:"components-Avatar-Examples-stories",989:"components-Avatar-Avatar-stories"}[chunkId]+"."+{22:"92cfe9bd",877:"c5dd9ee4",960:"23c859da",989:"30f6ce25"}[chunkId]+".chunk.css"},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)},inProgress={},__webpack_require__.l=function(url,done,key,chunkId){if(inProgress[url])inProgress[url].push(done);else{var script,needAttach;if(void 0!==key)for(var scripts=document.getElementsByTagName("script"),i=0;i=priority)&&Object.keys(__webpack_require__.O).every((function(key){return __webpack_require__.O[key](chunkIds[j])}))?chunkIds.splice(j--,1):(fulfilled=!1,priority0&&deferred[i-1][2]>priority;i--)deferred[i]=deferred[i-1];deferred[i]=[chunkIds,fn,priority]},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,{a:getter}),getter},getProto=Object.getPrototypeOf?function(obj){return Object.getPrototypeOf(obj)}:function(obj){return obj.__proto__},__webpack_require__.t=function(value,mode){if(1&mode&&(value=this(value)),8&mode)return value;if("object"==typeof value&&value){if(4&mode&&value.__esModule)return value;if(16&mode&&"function"==typeof value.then)return value}var ns=Object.create(null);__webpack_require__.r(ns);var def={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var current=2&mode&&value;"object"==typeof current&&!~leafPrototypes.indexOf(current);current=getProto(current))Object.getOwnPropertyNames(current).forEach((function(key){def[key]=function(){return value[key]}}));return def.default=function(){return value},__webpack_require__.d(ns,def),ns},__webpack_require__.d=function(exports,definition){for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},__webpack_require__.f={},__webpack_require__.e=function(chunkId){return Promise.all(Object.keys(__webpack_require__.f).reduce((function(promises,key){return __webpack_require__.f[key](chunkId,promises),promises}),[]))},__webpack_require__.u=function(chunkId){return({22:"components-Exhibit-Exhibit-stories",877:"components-Avatar-Debug-stories",960:"components-Avatar-Examples-stories",989:"components-Avatar-Avatar-stories"}[chunkId]||chunkId)+"."+{22:"2aba2a82",77:"397dacae",130:"7b316c9c",135:"c0b7df5b",140:"a6128e7c",152:"00429889",213:"75309cdc",238:"ca8ac7f0",253:"2e3b41a1",257:"6310e7e8",341:"0048daa7",355:"1ed6cf43",434:"5a97dc57",576:"ad2dabc8",613:"80c3158e",615:"e29af5bf",622:"d56d0ceb",628:"76b8bffc",652:"e4668753",693:"10b56cce",699:"8aa78ce0",729:"83c965d9",742:"0d8aae0c",744:"766ba7a7",760:"34212037",877:"8d45f161",960:"9b7b9263",966:"e1f4c7a5",983:"583a3211",989:"f35a83bc"}[chunkId]+".iframe.bundle.js"},__webpack_require__.miniCssF=function(chunkId){return"static/css/"+{22:"components-Exhibit-Exhibit-stories",877:"components-Avatar-Debug-stories",960:"components-Avatar-Examples-stories",989:"components-Avatar-Avatar-stories"}[chunkId]+"."+{22:"92cfe9bd",877:"c5dd9ee4",960:"23c859da",989:"30f6ce25"}[chunkId]+".chunk.css"},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)},inProgress={},__webpack_require__.l=function(url,done,key,chunkId){if(inProgress[url])inProgress[url].push(done);else{var script,needAttach;if(void 0!==key)for(var scripts=document.getElementsByTagName("script"),i=0;i", "", "", "global-externals:react", "../../../node_modules/react-reconciler/cjs/react-reconciler-constants.production.min.js", "../../../node_modules/react-reconciler/constants.js", "../../../node_modules/scheduler/cjs/scheduler.production.min.js", "../../../node_modules/scheduler/index.js", "../../../node_modules/react-reconciler/cjs/react-reconciler.production.min.js", "../../../node_modules/react-reconciler/index.js", "../../../node_modules/react/cjs/react-jsx-runtime.production.min.js", "../../../node_modules/react/jsx-runtime.js", "../../../node_modules/debounce/index.js", "../../../node_modules/.cache/sb-manager/storybook-7/manager-bundle.js", "../../../.storybook/manager.js", "global-externals:@storybook/addons", "../../../.storybook/theme.js", "global-externals:@storybook/theming", "../../../src/services/index.ts", "../../../src/services/Models.service.tsx", "../../../node_modules/three/build/three.module.js", "../../../node_modules/@react-three/fiber/dist/react-three-fiber.esm.js", "../../../node_modules/@react-three/fiber/dist/index-99983b2d.esm.js", "../../../node_modules/zustand/esm/index.js", "../../../node_modules/suspend-react/index.js", "../../../node_modules/react-use-measure/dist/web.js", "../../../node_modules/its-fine/src/index.tsx", "../../../node_modules/three-stdlib/index.js", "../../../node_modules/src/math/ConvexHull.js", "../../../node_modules/src/misc/ConvexObjectBreaker.js", "../../../node_modules/src/misc/Gyroscope.js", "../../../node_modules/src/misc/WebGL.ts", "../../../node_modules/potpack/index.mjs", "../../../node_modules/src/renderers/CSS2DRenderer.js", "../../../node_modules/src/renderers/CSS3DRenderer.js", "../../../node_modules/src/textures/FlakesTexture.ts", "../../../node_modules/src/modifiers/CurveModifier.ts", "../../../node_modules/src/types/helpers.ts", "../../../node_modules/src/utils/BufferGeometryUtils.ts", "../../../node_modules/src/modifiers/SimplifyModifier.ts", "../../../node_modules/src/_polyfill/constants.ts", "../../../node_modules/src/exporters/GLTFExporter.js", "../../../node_modules/fflate/esm/browser.js", "../../../node_modules/src/exporters/DRACOExporter.ts", "../../../node_modules/src/libs/mmdparser.js", "../../../node_modules/src/animation/CCDIKSolver.js", "../../../node_modules/src/animation/MMDPhysics.js", "../../../node_modules/src/animation/MMDAnimationHelper.js", "../../../node_modules/src/objects/BatchedMesh.ts", "../../../node_modules/src/objects/Reflector.js", "../../../node_modules/src/objects/Refractor.js", "../../../node_modules/src/objects/ShadowMesh.js", "../../../node_modules/src/objects/Lensflare.js", "../../../node_modules/src/objects/MarchingCubes.js", "../../../node_modules/src/math/SimplexNoise.ts", "../../../node_modules/src/geometries/LightningStrike.js", "../../../node_modules/src/objects/ReflectorForSSRPass.js", "../../../node_modules/src/objects/Sky.ts", "../../../node_modules/src/objects/Water2.js", "../../../node_modules/src/utils/RoughnessMipmapper.js", "../../../node_modules/src/shaders/UnpackDepthRGBAShader.ts", "../../../node_modules/src/shaders/BokehShader2.ts", "../../../node_modules/src/math/MeshSurfaceSampler.js", "../../../node_modules/src/math/OBB.js", "../../../node_modules/src/math/Capsule.js", "../../../node_modules/src/math/ImprovedNoise.js", "../../../node_modules/src/math/Octree.js", "../../../node_modules/src/controls/FirstPersonControls.ts", "../../../node_modules/src/controls/PointerLockControls.ts", "../../../node_modules/src/controls/OrbitControls.ts", "../../../node_modules/src/controls/ArcballControls.ts", "../../../node_modules/src/postprocessing/Pass.ts", "../../../node_modules/src/shaders/DigitalGlitch.ts", "../../../node_modules/src/shaders/HalftoneShader.ts", "../../../node_modules/src/shaders/SMAAShader.ts", "../../../node_modules/src/shaders/FilmShader.ts", "../../../node_modules/src/shaders/CopyShader.ts", "../../../node_modules/src/shaders/SSAOShader.ts", "../../../node_modules/src/postprocessing/SSAOPass.js", "../../../node_modules/src/shaders/BokehShader.ts", "../../../node_modules/src/shaders/LuminosityShader.ts", "../../../node_modules/src/shaders/ToneMapShader.ts", "../../../node_modules/src/shaders/LuminosityHighPassShader.ts", "../../../node_modules/src/postprocessing/UnrealBloomPass.js", "../../../node_modules/src/shaders/SAOShader.ts", "../../../node_modules/src/shaders/DepthLimitedBlurShader.ts", "../../../node_modules/src/postprocessing/SAOPass.js", "../../../node_modules/src/shaders/AfterimageShader.ts", "../../../node_modules/src/shaders/DotScreenShader.ts", "../../../node_modules/src/shaders/SSRShader.ts", "../../../node_modules/src/postprocessing/SSRPass.js", "../../../node_modules/src/shaders/ConvolutionShader.ts", "../../../node_modules/src/webxr/ARButton.ts", "../../../node_modules/src/_polyfill/LoaderUtils.js", "../../../node_modules/src/loaders/GLTFLoader.js", "../../../node_modules/src/webxr/OculusHandPointerModel.js", "../../../node_modules/src/webxr/VRButton.ts", "../../../node_modules/src/libs/MotionControllers.ts", "../../../node_modules/src/webxr/XRHandPrimitiveModel.js", "../../../node_modules/src/geometries/RoundedBoxGeometry.js", "../../../node_modules/src/csm/CSMFrustum.js", "../../../node_modules/src/csm/CSM.js", "../../../node_modules/src/shaders/ACESFilmicToneMappingShader.ts", "../../../node_modules/src/shaders/BasicShader.ts", "../../../node_modules/src/shaders/BleachBypassShader.ts", "../../../node_modules/src/shaders/BlendShader.ts", "../../../node_modules/src/shaders/BrightnessContrastShader.ts", "../../../node_modules/src/shaders/ColorCorrectionShader.ts", "../../../node_modules/src/shaders/ColorifyShader.ts", "../../../node_modules/src/shaders/DOFMipMapShader.ts", "../../../node_modules/src/shaders/FXAAShader.ts", "../../../node_modules/src/shaders/FocusShader.ts", "../../../node_modules/src/shaders/FreiChenShader.ts", "../../../node_modules/src/shaders/FresnelShader.ts", "../../../node_modules/src/shaders/GammaCorrectionShader.ts", "../../../node_modules/src/shaders/GodRaysShader.ts", "../../../node_modules/src/shaders/HorizontalBlurShader.ts", "../../../node_modules/src/shaders/HorizontalTiltShiftShader.ts", "../../../node_modules/src/shaders/HueSaturationShader.ts", "../../../node_modules/src/shaders/KaleidoShader.ts", "../../../node_modules/src/shaders/MirrorShader.ts", "../../../node_modules/src/shaders/NormalMapShader.ts", "../../../node_modules/src/shaders/ParallaxShader.ts", "../../../node_modules/src/shaders/PixelShader.ts", "../../../node_modules/src/shaders/RGBShiftShader.ts", "../../../node_modules/src/shaders/SepiaShader.ts", "../../../node_modules/src/shaders/SobelOperatorShader.ts", "../../../node_modules/src/shaders/TechnicolorShader.ts", "../../../node_modules/src/shaders/ToonShader.ts", "../../../node_modules/src/shaders/TriangleBlurShader.ts", "../../../node_modules/src/shaders/VerticalBlurShader.ts", "../../../node_modules/src/shaders/VerticalTiltShiftShader.ts", "../../../node_modules/src/shaders/VignetteShader.ts", "../../../node_modules/src/shaders/VolumeShader.ts", "../../../node_modules/src/shaders/WaterRefractionShader.ts", "../../../node_modules/src/interactive/InteractiveGroup.js", "../../../node_modules/src/interactive/SelectionBox.js", "../../../node_modules/src/physics/AmmoPhysics.js", "../../../node_modules/src/effects/AsciiEffect.js", "../../../node_modules/src/loaders/FBXLoader.js", "../../../node_modules/src/loaders/FontLoader.ts", "../../../node_modules/src/_polyfill/Data3DTexture.js", "../../../node_modules/src/loaders/XLoader.js", "../../../node_modules/src/libs/chevrotain.js", "../../../node_modules/src/utils/WorkerPool.js", "../../../node_modules/src/libs/ktx-parse.js", "../../../node_modules/src/libs/zstddec.ts", "../../../node_modules/src/_polyfill/CompressedCubeTexture.js", "../../../node_modules/src/_polyfill/CompressedArrayTexture.js", "../../../node_modules/src/loaders/KTX2Loader.js", "../../../node_modules/src/libs/lottie.js", "../../../node_modules/src/libs/opentype.js", "../../../node_modules/src/loaders/EXRLoader.js", "../../../node_modules/src/loaders/BasisTextureLoader.js", "../../../node_modules/src/loaders/LDrawLoader.js", "../../../node_modules/src/loaders/OBJLoader.js", "../../../node_modules/src/loaders/KTXLoader.js", "../../../node_modules/src/loaders/DRACOLoader.js", "../../../node_modules/src/loaders/lwo/LWO2Parser.js", "../../../node_modules/src/loaders/lwo/LWO3Parser.js", "../../../node_modules/src/lines/LineSegmentsGeometry.js", "../../../node_modules/src/lines/Wireframe.js", "../../../node_modules/src/lines/LineSegments2.js", "../../../node_modules/src/helpers/VertexTangentsHelper.js", "../../../node_modules/src/helpers/VertexNormalsHelper.js", "../../../node_modules/src/deprecated/Geometry.js", "../../../node_modules/src/libs/MeshoptDecoder.ts", "../../../src/services/meshopt_decoder.ts"], - "sourcesContent": ["", "", "", "export default __REACT__;\nconst { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version } = __REACT__;\nexport { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version };", "/**\n * @license React\n * react-reconciler-constants.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';exports.ConcurrentRoot=1;exports.ContinuousEventPriority=4;exports.DefaultEventPriority=16;exports.DiscreteEventPriority=1;exports.IdleEventPriority=536870912;exports.LegacyRoot=0;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-reconciler-constants.production.min.js');\n} else {\n module.exports = require('./cjs/react-reconciler-constants.development.js');\n}\n", "/**\n * @license React\n * scheduler.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';function f(a,b){var c=a.length;a.push(b);a:for(;0>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n", "/**\n * @license React\n * react-reconciler.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nmodule.exports = function $$$reconciler($$$hostConfig) {\n var exports = {};\n'use strict';var aa=require(\"react\"),ba=require(\"scheduler\"),ca=Object.assign;function n(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;ch||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{bc=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?ac(a):\"\"}var dc=Object.prototype.hasOwnProperty,ec=[],fc=-1;function gc(a){return{current:a}}\nfunction x(a){0>fc||(a.current=ec[fc],ec[fc]=null,fc--)}function y(a,b){fc++;ec[fc]=a.current;a.current=b}var hc={},A=gc(hc),B=gc(!1),ic=hc;function jc(a,b){var c=a.type.contextTypes;if(!c)return hc;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction C(a){a=a.childContextTypes;return null!==a&&void 0!==a}function kc(){x(B);x(A)}function lc(a,b,c){if(A.current!==hc)throw Error(n(168));y(A,b);y(B,c)}function mc(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(n(108,xa(a)||\"Unknown\",e));return ca({},c,d)}\nfunction nc(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||hc;ic=A.current;y(A,a);y(B,B.current);return!0}function oc(a,b,c){var d=a.stateNode;if(!d)throw Error(n(169));c?(a=mc(a,b,ic),d.__reactInternalMemoizedMergedChildContext=a,x(B),x(A),y(A,a)):x(B);y(B,c)}var qc=Math.clz32?Math.clz32:pc,rc=Math.log,sc=Math.LN2;function pc(a){a>>>=0;return 0===a?32:31-(rc(a)/sc|0)|0}var tc=64,uc=4194304;\nfunction vc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function wc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=vc(h):(f&=g,0!==f&&(d=vc(f)))}else g=c&~e,0!==g?d=vc(g):0!==f&&(d=vc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}function Bc(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-qc(b);a[b]=c}\nfunction Cc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0>=g;e-=g;Nd=1<<32-qc(b)+e|c<u?(t=w,w=null):t=w.sibling;var q=r(e,w,h[u],k);if(null===q){null===w&&(w=t);break}a&&w&&null===q.alternate&&b(e,w);g=f(q,g,u);null===m?l=q:m.sibling=q;m=q;w=t}if(u===h.length)return c(e,w),I&&Pd(e,u),l;if(null===w){for(;uu?(q=m,m=null):q=m.sibling;var V=r(e,m,t.value,k);if(null===V){null===m&&(m=q);break}a&&m&&null===V.alternate&&b(e,m);g=f(V,g,u);null===w?l=V:w.sibling=V;w=V;m=q}if(t.done)return c(e,\nm),I&&Pd(e,u),l;if(null===m){for(;!t.done;u++,t=h.next())t=v(e,t.value,k),null!==t&&(g=f(t,g,u),null===w?l=t:w.sibling=t,w=t);I&&Pd(e,u);return l}for(m=d(e,m);!t.done;u++,t=h.next())t=z(m,e,u,t.value,k),null!==t&&(a&&null!==t.alternate&&m.delete(null===t.key?u:t.key),g=f(t,g,u),null===w?l=t:w.sibling=t,w=t);a&&m.forEach(function(a){return b(e,a)});I&&Pd(e,u);return l}function da(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ia&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==\nf){switch(f.$$typeof){case fa:a:{for(var k=f.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ia){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===ra&&he(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=fe(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ia?(d=ne(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=le(f.type,f.key,f.props,null,a.mode,h),h.ref=fe(a,d,f),h.return=\na,a=h)}return g(a);case ha:a:{for(l=f.key;null!==d;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=me(f,a.mode,h);d.return=a;a=d}return g(a);case ra:return l=f._init,da(a,d,l(f._payload),h)}if(Ea(f))return q(a,d,f,h);if(ua(f))return N(a,d,f,h);ge(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&\n6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=ke(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return da}var oe=ie(!0),pe=ie(!1),qe={},re=gc(qe),se=gc(qe),te=gc(qe);function ue(a){if(a===qe)throw Error(n(174));return a}function ve(a,b){y(te,b);y(se,a);y(re,qe);a=Ga(b);x(re);y(re,a)}function we(){x(re);x(se);x(te)}function xe(a){var b=ue(te.current),c=ue(re.current);b=Ha(c,a.type,b);c!==b&&(y(se,a),y(re,b))}function ye(a){se.current===a&&(x(re),x(se))}var J=gc(0);\nfunction ze(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||Ib(c)||Jb(c)))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var Ae=[];\nfunction Be(){for(var a=0;ac?c:4;a(!0);var d=De.transition;De.transition={};try{a(!1),b()}finally{D=c,De.transition=d}}function rf(){return Re().memoizedState}function sf(a,b,c){var d=zd(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};tf(a)?uf(b,c):(vf(a,b,c),c=H(),a=Ad(a,d,c),null!==a&&wf(a,b,d))}\nfunction df(a,b,c){var d=zd(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(tf(a))uf(b,e);else{vf(a,b,e);var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(Rc(h,g))return}catch(k){}finally{}c=H();a=Ad(a,d,c);null!==a&&wf(a,b,d)}}function tf(a){var b=a.alternate;return a===K||null!==b&&b===K}\nfunction uf(a,b){Ge=Fe=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function vf(a,b,c){null!==F&&0!==(a.mode&1)&&0===(G&2)?(a=b.interleaved,null===a?(c.next=c,null===md?md=[b]:md.push(b)):(c.next=a.next,a.next=c),b.interleaved=c):(a=b.pending,null===a?c.next=c:(c.next=a.next,a.next=c),b.pending=c)}function wf(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Dc(a,c)}}\nvar Oe={readContext:ld,useCallback:O,useContext:O,useEffect:O,useImperativeHandle:O,useInsertionEffect:O,useLayoutEffect:O,useMemo:O,useReducer:O,useRef:O,useState:O,useDebugValue:O,useDeferredValue:O,useTransition:O,useMutableSource:O,useSyncExternalStore:O,useId:O,unstable_isNewReconciler:!1},Le={readContext:ld,useCallback:function(a,b){Qe().memoizedState=[a,void 0===b?null:b];return a},useContext:ld,useEffect:hf,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ff(4194308,\n4,lf.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ff(4194308,4,a,b)},useInsertionEffect:function(a,b){return ff(4,2,a,b)},useMemo:function(a,b){var c=Qe();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Qe();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=sf.bind(null,K,a);return[d.memoizedState,a]},useRef:function(a){var b=\nQe();a={current:a};return b.memoizedState=a},useState:cf,useDebugValue:nf,useDeferredValue:function(a){var b=cf(a),c=b[0],d=b[1];hf(function(){var b=De.transition;De.transition={};try{d(a)}finally{De.transition=b}},[a]);return c},useTransition:function(){var a=cf(!1),b=a[0];a=qf.bind(null,a[1]);Qe().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=K,e=Qe();if(I){if(void 0===c)throw Error(n(407));c=c()}else{c=b();if(null===F)throw Error(n(349));\n0!==(Ee&30)||af(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;hf(Ye.bind(null,d,f,a),[a]);d.flags|=2048;Ze(9,$e.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Qe(),b=F.identifierPrefix;if(I){var c=Od;var d=Nd;c=(d&~(1<<32-qc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=He++;0Uf&&(b.flags|=128,d=!0,Qf(e,!1),b.lanes=4194304)}else{if(!d)if(a=ze(f),null!==a){if(b.flags|=128,d=!0,a=a.updateQueue,null!==a&&(b.updateQueue=a,b.flags|=4),Qf(e,!0),null===e.tail&&\"hidden\"===e.tailMode&&!f.alternate&&!I)return P(b),null}else 2*E()-e.renderingStartTime>Uf&&1073741824!==c&&(b.flags|=128,d=!0,Qf(e,!1),b.lanes=4194304);e.isBackwards?(f.sibling=b.child,b.child=f):(a=e.last,null!==a?a.sibling=f:b.child=f,e.last=f)}if(null!==\ne.tail)return b=e.tail,e.rendering=b,e.tail=b.sibling,e.renderingStartTime=E(),b.sibling=null,a=J.current,y(J,d?a&1|2:a&1),b;P(b);return null;case 22:case 23:return Vf(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(Wf&1073741824)&&(P(b),Ua&&b.subtreeFlags&6&&(b.flags|=8192)):P(b),null;case 24:return null;case 25:return null}throw Error(n(156,b.tag));}var Xf=ea.ReactCurrentOwner,kd=!1;\nfunction R(a,b,c,d){b.child=null===a?pe(b,null,c,d):oe(b,a.child,c,d)}function Yf(a,b,c,d,e){c=c.render;var f=b.ref;jd(b,e);d=Ke(a,b,c,d,f,e);c=Pe();if(null!==a&&!kd)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Zf(a,b,e);I&&c&&Rd(b);b.flags|=1;R(a,b,d,e);return b.child}\nfunction $f(a,b,c,d,e){if(null===a){var f=c.type;if(\"function\"===typeof f&&!ag(f)&&void 0===f.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=f,bg(a,b,f,d,e);a=le(c.type,null,d,b,b.mode,e);a.ref=b.ref;a.return=b;return b.child=a}f=a.child;if(0===(a.lanes&e)){var g=f.memoizedProps;c=c.compare;c=null!==c?c:Zc;if(c(g,d)&&a.ref===b.ref)return Zf(a,b,e)}b.flags|=1;a=je(f,d);a.ref=b.ref;a.return=b;return b.child=a}\nfunction bg(a,b,c,d,e){if(null!==a&&Zc(a.memoizedProps,d)&&a.ref===b.ref)if(kd=!1,0!==(a.lanes&e))0!==(a.flags&131072)&&(kd=!0);else return b.lanes=a.lanes,Zf(a,b,e);return cg(a,b,c,d,e)}\nfunction dg(a,b,c){var d=b.pendingProps,e=d.children,f=null!==a?a.memoizedState:null;if(\"hidden\"===d.mode)if(0===(b.mode&1))b.memoizedState={baseLanes:0,cachePool:null},y(eg,Wf),Wf|=c;else if(0!==(c&1073741824))b.memoizedState={baseLanes:0,cachePool:null},d=null!==f?f.baseLanes:c,y(eg,Wf),Wf|=d;else return a=null!==f?f.baseLanes|c:c,b.lanes=b.childLanes=1073741824,b.memoizedState={baseLanes:a,cachePool:null},b.updateQueue=null,y(eg,Wf),Wf|=a,null;else null!==f?(d=f.baseLanes|c,b.memoizedState=null):\nd=c,y(eg,Wf),Wf|=d;R(a,b,e,c);return b.child}function fg(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.flags|=512,b.flags|=2097152}function cg(a,b,c,d,e){var f=C(c)?ic:A.current;f=jc(b,f);jd(b,e);c=Ke(a,b,c,d,f,e);d=Pe();if(null!==a&&!kd)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Zf(a,b,e);I&&d&&Rd(b);b.flags|=1;R(a,b,c,e);return b.child}\nfunction gg(a,b,c,d,e){if(C(c)){var f=!0;nc(b)}else f=!1;jd(b,e);if(null===b.stateNode)null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),Dd(b,c,d),Fd(b,c,d,e),d=!0;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,l=c.contextType;\"object\"===typeof l&&null!==l?l=ld(l):(l=C(c)?ic:A.current,l=jc(b,l));var m=c.getDerivedStateFromProps,v=\"function\"===typeof m||\"function\"===typeof g.getSnapshotBeforeUpdate;v||\"function\"!==typeof g.UNSAFE_componentWillReceiveProps&&\"function\"!==\ntypeof g.componentWillReceiveProps||(h!==d||k!==l)&&Ed(b,g,d,l);nd=!1;var r=b.memoizedState;g.state=r;ud(b,d,g,e);k=b.memoizedState;h!==d||r!==k||B.current||nd?(\"function\"===typeof m&&(yd(b,c,m,d),k=b.memoizedState),(h=nd||Cd(b,c,h,d,r,k,l))?(v||\"function\"!==typeof g.UNSAFE_componentWillMount&&\"function\"!==typeof g.componentWillMount||(\"function\"===typeof g.componentWillMount&&g.componentWillMount(),\"function\"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),\"function\"===typeof g.componentDidMount&&\n(b.flags|=4194308)):(\"function\"===typeof g.componentDidMount&&(b.flags|=4194308),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=l,d=h):(\"function\"===typeof g.componentDidMount&&(b.flags|=4194308),d=!1)}else{g=b.stateNode;pd(a,b);h=b.memoizedProps;l=b.type===b.elementType?h:ad(b.type,h);g.props=l;v=b.pendingProps;r=g.context;k=c.contextType;\"object\"===typeof k&&null!==k?k=ld(k):(k=C(c)?ic:A.current,k=jc(b,k));var z=c.getDerivedStateFromProps;(m=\"function\"===typeof z||\"function\"===\ntypeof g.getSnapshotBeforeUpdate)||\"function\"!==typeof g.UNSAFE_componentWillReceiveProps&&\"function\"!==typeof g.componentWillReceiveProps||(h!==v||r!==k)&&Ed(b,g,d,k);nd=!1;r=b.memoizedState;g.state=r;ud(b,d,g,e);var q=b.memoizedState;h!==v||r!==q||B.current||nd?(\"function\"===typeof z&&(yd(b,c,z,d),q=b.memoizedState),(l=nd||Cd(b,c,l,d,r,q,k)||!1)?(m||\"function\"!==typeof g.UNSAFE_componentWillUpdate&&\"function\"!==typeof g.componentWillUpdate||(\"function\"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,\nq,k),\"function\"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,q,k)),\"function\"===typeof g.componentDidUpdate&&(b.flags|=4),\"function\"===typeof g.getSnapshotBeforeUpdate&&(b.flags|=1024)):(\"function\"!==typeof g.componentDidUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=4),\"function\"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),b.memoizedProps=d,b.memoizedState=q),g.props=d,g.state=q,g.context=k,d=l):(\"function\"!==\ntypeof g.componentDidUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=4),\"function\"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),d=!1)}return hg(a,b,c,d,f,e)}\nfunction hg(a,b,c,d,e,f){fg(a,b);var g=0!==(b.flags&128);if(!d&&!g)return e&&oc(b,c,!1),Zf(a,b,f);d=b.stateNode;Xf.current=b;var h=g&&\"function\"!==typeof c.getDerivedStateFromError?null:d.render();b.flags|=1;null!==a&&g?(b.child=oe(b,a.child,null,f),b.child=oe(b,null,h,f)):R(a,b,h,f);b.memoizedState=d.state;e&&oc(b,c,!0);return b.child}function ig(a){var b=a.stateNode;b.pendingContext?lc(a,b.pendingContext,b.pendingContext!==b.context):b.context&&lc(a,b.context,!1);ve(a,b.containerInfo)}\nfunction jg(a,b,c,d,e){de();ee(e);b.flags|=256;R(a,b,c,d);return b.child}var kg={dehydrated:null,treeContext:null,retryLane:0};function lg(a){return{baseLanes:a,cachePool:null}}\nfunction mg(a,b,c){var d=b.pendingProps,e=J.current,f=!1,g=0!==(b.flags&128),h;(h=g)||(h=null!==a&&null===a.memoizedState?!1:0!==(e&2));if(h)f=!0,b.flags&=-129;else if(null===a||null!==a.memoizedState)e|=1;y(J,e&1);if(null===a){ae(b);a=b.memoizedState;if(null!==a&&(a=a.dehydrated,null!==a))return 0===(b.mode&1)?b.lanes=1:Jb(a)?b.lanes=8:b.lanes=1073741824,null;e=d.children;a=d.fallback;return f?(d=b.mode,f=b.child,e={mode:\"hidden\",children:e},0===(d&1)&&null!==f?(f.childLanes=0,f.pendingProps=e):\nf=ng(e,d,0,null),a=ne(a,d,c,null),f.return=b,a.return=b,f.sibling=a,b.child=f,b.child.memoizedState=lg(c),b.memoizedState=kg,a):og(b,e)}e=a.memoizedState;if(null!==e){h=e.dehydrated;if(null!==h){if(g){if(b.flags&256)return b.flags&=-257,pg(a,b,c,Error(n(422)));if(null!==b.memoizedState)return b.child=a.child,b.flags|=128,null;f=d.fallback;e=b.mode;d=ng({mode:\"visible\",children:d.children},e,0,null);f=ne(f,e,c,null);f.flags|=2;d.return=b;f.return=b;d.sibling=f;b.child=d;0!==(b.mode&1)&&oe(b,a.child,\nnull,c);b.child.memoizedState=lg(c);b.memoizedState=kg;return f}if(0===(b.mode&1))b=pg(a,b,c,null);else if(Jb(h))b=pg(a,b,c,Error(n(419)));else if(d=0!==(c&a.childLanes),kd||d){d=F;if(null!==d){switch(c&-c){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=\n268435456;break;default:f=0}d=0!==(f&(d.suspendedLanes|c))?0:f;0!==d&&d!==e.retryLane&&(e.retryLane=d,Ad(a,d,-1))}Tf();b=pg(a,b,c,Error(n(421)))}else Ib(h)?(b.flags|=128,b.child=a.child,b=qg.bind(null,a),Kb(h,b),b=null):(c=e.treeContext,p&&(Ud=Ob(h),Td=b,I=!0,Wd=null,Vd=!1,null!==c&&(Kd[Ld++]=Nd,Kd[Ld++]=Od,Kd[Ld++]=Md,Nd=c.id,Od=c.overflow,Md=b)),b=og(b,b.pendingProps.children),b.flags|=4096);return b}if(f)return d=rg(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=\nnull===e?lg(c):{baseLanes:e.baseLanes|c,cachePool:null},f.childLanes=a.childLanes&~c,b.memoizedState=kg,d;c=sg(a,b,d.children,c);b.memoizedState=null;return c}if(f)return d=rg(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=null===e?lg(c):{baseLanes:e.baseLanes|c,cachePool:null},f.childLanes=a.childLanes&~c,b.memoizedState=kg,d;c=sg(a,b,d.children,c);b.memoizedState=null;return c}\nfunction og(a,b){b=ng({mode:\"visible\",children:b},a.mode,0,null);b.return=a;return a.child=b}function sg(a,b,c,d){var e=a.child;a=e.sibling;c=je(e,{mode:\"visible\",children:c});0===(b.mode&1)&&(c.lanes=d);c.return=b;c.sibling=null;null!==a&&(d=b.deletions,null===d?(b.deletions=[a],b.flags|=16):d.push(a));return b.child=c}\nfunction rg(a,b,c,d,e){var f=b.mode;a=a.child;var g=a.sibling,h={mode:\"hidden\",children:c};0===(f&1)&&b.child!==a?(c=b.child,c.childLanes=0,c.pendingProps=h,b.deletions=null):(c=je(a,h),c.subtreeFlags=a.subtreeFlags&14680064);null!==g?d=je(g,d):(d=ne(d,f,e,null),d.flags|=2);d.return=b;c.return=b;c.sibling=d;b.child=c;return d}function pg(a,b,c,d){null!==d&&ee(d);oe(b,a.child,null,c);a=og(b,b.pendingProps.children);a.flags|=2;b.memoizedState=null;return a}\nfunction tg(a,b,c){a.lanes|=b;var d=a.alternate;null!==d&&(d.lanes|=b);id(a.return,b,c)}function ug(a,b,c,d,e){var f=a.memoizedState;null===f?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e}:(f.isBackwards=b,f.rendering=null,f.renderingStartTime=0,f.last=d,f.tail=c,f.tailMode=e)}\nfunction vg(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;R(a,b,d.children,c);d=J.current;if(0!==(d&2))d=d&1|2,b.flags|=128;else{if(null!==a&&0!==(a.flags&128))a:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&tg(a,c,b);else if(19===a.tag)tg(a,c,b);else if(null!==a.child){a.child.return=a;a=a.child;continue}if(a===b)break a;for(;null===a.sibling;){if(null===a.return||a.return===b)break a;a=a.return}a.sibling.return=a.return;a=a.sibling}d&=1}y(J,d);if(0===(b.mode&1))b.memoizedState=\nnull;else switch(e){case \"forwards\":c=b.child;for(e=null;null!==c;)a=c.alternate,null!==a&&null===ze(a)&&(e=c),c=c.sibling;c=e;null===c?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null);ug(b,!1,e,c,f);break;case \"backwards\":c=null;e=b.child;for(b.child=null;null!==e;){a=e.alternate;if(null!==a&&null===ze(a)){b.child=e;break}a=e.sibling;e.sibling=c;c=e;e=a}ug(b,!0,c,null,f);break;case \"together\":ug(b,!1,null,null,void 0);break;default:b.memoizedState=null}return b.child}\nfunction Zf(a,b,c){null!==a&&(b.dependencies=a.dependencies);vd|=b.lanes;if(0===(c&b.childLanes))return null;if(null!==a&&b.child!==a.child)throw Error(n(153));if(null!==b.child){a=b.child;c=je(a,a.pendingProps);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=je(a,a.pendingProps),c.return=b;c.sibling=null}return b.child}\nfunction wg(a,b,c){switch(b.tag){case 3:ig(b);de();break;case 5:xe(b);break;case 1:C(b.type)&&nc(b);break;case 4:ve(b,b.stateNode.containerInfo);break;case 10:gd(b,b.type._context,b.memoizedProps.value);break;case 13:var d=b.memoizedState;if(null!==d){if(null!==d.dehydrated)return y(J,J.current&1),b.flags|=128,null;if(0!==(c&b.child.childLanes))return mg(a,b,c);y(J,J.current&1);a=Zf(a,b,c);return null!==a?a.sibling:null}y(J,J.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&128)){if(d)return vg(a,\nb,c);b.flags|=128}var e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);y(J,J.current);if(d)break;else return null;case 22:case 23:return b.lanes=0,dg(a,b,c)}return Zf(a,b,c)}\nfunction xg(a,b){Sd(b);switch(b.tag){case 1:return C(b.type)&&kc(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return we(),x(B),x(A),Be(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return ye(b),null;case 13:x(J);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(n(340));de()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return x(J),null;case 4:return we(),null;case 10:return hd(b.type._context),null;case 22:case 23:return Vf(),\nnull;case 24:return null;default:return null}}var yg=!1,zg=!1,Ag=\"function\"===typeof WeakSet?WeakSet:Set,S=null;function Bg(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){T(a,b,d)}else c.current=null}function Cg(a,b,c){try{c()}catch(d){T(a,b,d)}}var Dg=!1;\nfunction Eg(a,b){Ia(a.containerInfo);for(S=b;null!==S;)if(a=S,b=a.child,0!==(a.subtreeFlags&1028)&&null!==b)b.return=a,S=b;else for(;null!==S;){a=S;try{var c=a.alternate;if(0!==(a.flags&1024))switch(a.tag){case 0:case 11:case 15:break;case 1:if(null!==c){var d=c.memoizedProps,e=c.memoizedState,f=a.stateNode,g=f.getSnapshotBeforeUpdate(a.elementType===a.type?d:ad(a.type,d),e);f.__reactInternalSnapshotBeforeUpdate=g}break;case 3:Ua&&xb(a.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;\ndefault:throw Error(n(163));}}catch(h){T(a,a.return,h)}b=a.sibling;if(null!==b){b.return=a.return;S=b;break}S=a.return}c=Dg;Dg=!1;return c}function Fg(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Cg(b,c,f)}e=e.next}while(e!==d)}}function Gg(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}\nfunction Hg(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=Fa(c);break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Ig(a,b,c){if(Oc&&\"function\"===typeof Oc.onCommitFiberUnmount)try{Oc.onCommitFiberUnmount(Nc,b)}catch(g){}switch(b.tag){case 0:case 11:case 14:case 15:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var d=a=a.next;do{var e=d,f=e.destroy;e=e.tag;void 0!==f&&(0!==(e&2)?Cg(b,c,f):0!==(e&4)&&Cg(b,c,f));d=d.next}while(d!==a)}break;case 1:Bg(b,c);a=b.stateNode;if(\"function\"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount()}catch(g){T(b,\nc,g)}break;case 5:Bg(b,c);break;case 4:Ua?Jg(a,b,c):Va&&Va&&(b=b.stateNode.containerInfo,c=zb(b),Cb(b,c))}}function Kg(a,b,c){for(var d=b;;)if(Ig(a,d,c),null===d.child||Ua&&4===d.tag){if(d===b)break;for(;null===d.sibling;){if(null===d.return||d.return===b)return;d=d.return}d.sibling.return=d.return;d=d.sibling}else d.child.return=d,d=d.child}\nfunction Lg(a){var b=a.alternate;null!==b&&(a.alternate=null,Lg(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&Za(b));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Mg(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Ng(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Mg(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Og(a){if(Ua){a:{for(var b=a.return;null!==b;){if(Mg(b))break a;b=b.return}throw Error(n(160));}var c=b;switch(c.tag){case 5:b=c.stateNode;c.flags&32&&(sb(b),c.flags&=-33);c=Ng(a);Pg(a,c,b);break;case 3:case 4:b=c.stateNode.containerInfo;c=Ng(a);Qg(a,c,b);break;default:throw Error(n(161));}}}function Qg(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?pb(c,a,b):kb(c,a);else if(4!==d&&(a=a.child,null!==a))for(Qg(a,b,c),a=a.sibling;null!==a;)Qg(a,b,c),a=a.sibling}\nfunction Pg(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?ob(c,a,b):jb(c,a);else if(4!==d&&(a=a.child,null!==a))for(Pg(a,b,c),a=a.sibling;null!==a;)Pg(a,b,c),a=a.sibling}\nfunction Jg(a,b,c){for(var d=b,e=!1,f,g;;){if(!e){e=d.return;a:for(;;){if(null===e)throw Error(n(160));f=e.stateNode;switch(e.tag){case 5:g=!1;break a;case 3:f=f.containerInfo;g=!0;break a;case 4:f=f.containerInfo;g=!0;break a}e=e.return}e=!0}if(5===d.tag||6===d.tag)Kg(a,d,c),g?rb(f,d.stateNode):qb(f,d.stateNode);else if(18===d.tag)g?Wb(f,d.stateNode):Vb(f,d.stateNode);else if(4===d.tag){if(null!==d.child){f=d.stateNode.containerInfo;g=!0;d.child.return=d;d=d.child;continue}}else if(Ig(a,d,c),null!==\nd.child){d.child.return=d;d=d.child;continue}if(d===b)break;for(;null===d.sibling;){if(null===d.return||d.return===b)return;d=d.return;4===d.tag&&(e=!1)}d.sibling.return=d.return;d=d.sibling}}\nfunction Rg(a,b){if(Ua){switch(b.tag){case 0:case 11:case 14:case 15:Fg(3,b,b.return);Gg(3,b);Fg(5,b,b.return);return;case 1:return;case 5:var c=b.stateNode;if(null!=c){var d=b.memoizedProps;a=null!==a?a.memoizedProps:d;var e=b.type,f=b.updateQueue;b.updateQueue=null;null!==f&&nb(c,f,e,a,d,b)}return;case 6:if(null===b.stateNode)throw Error(n(162));c=b.memoizedProps;lb(b.stateNode,null!==a?a.memoizedProps:c,c);return;case 3:p&&null!==a&&a.memoizedState.isDehydrated&&Tb(b.stateNode.containerInfo);return;\ncase 12:return;case 13:Sg(b);return;case 19:Sg(b);return;case 17:return}throw Error(n(163));}switch(b.tag){case 0:case 11:case 14:case 15:Fg(3,b,b.return);Gg(3,b);Fg(5,b,b.return);return;case 12:return;case 13:Sg(b);return;case 19:Sg(b);return;case 3:p&&null!==a&&a.memoizedState.isDehydrated&&Tb(b.stateNode.containerInfo);break;case 22:case 23:return}a:if(Va){switch(b.tag){case 1:case 5:case 6:break a;case 3:case 4:b=b.stateNode;Cb(b.containerInfo,b.pendingChildren);break a}throw Error(n(163));}}\nfunction Sg(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Ag);b.forEach(function(b){var d=Tg.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction Ug(a,b){for(S=b;null!==S;){b=S;var c=b.deletions;if(null!==c)for(var d=0;d\";case bh:return\":has(\"+(ih(a)||\"\")+\")\";case ch:return'[role=\"'+a.value+'\"]';case eh:return'\"'+a.value+'\"';case dh:return'[data-testname=\"'+a.value+'\"]';default:throw Error(n(365));}}\nfunction jh(a,b){var c=[];a=[a,0];for(var d=0;de&&(e=g);d&=~f}d=e;d=E()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lh(d/1960))-d;if(10a?16:a;if(null===uh)var d=!1;else{a=uh;uh=null;vh=0;if(0!==(G&6))throw Error(n(331));var e=G;G|=4;for(S=a.current;null!==S;){var f=S,g=f.child;if(0!==(S.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kE()-Vg?Ih(a,0):qh|=c);Z(a,b)}function Vh(a,b){0===b&&(0===(a.mode&1)?b=1:(b=uc,uc<<=1,0===(uc&130023424)&&(uc=4194304)));var c=H();a=Ah(a,b);null!==a&&(Bc(a,b,c),Z(a,c))}function qg(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Vh(a,c)}\nfunction Tg(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(n(314));}null!==d&&d.delete(b);Vh(a,c)}var Sh;\nSh=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||B.current)kd=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return kd=!1,wg(a,b,c);kd=0!==(a.flags&131072)?!0:!1}else kd=!1,I&&0!==(b.flags&1048576)&&Qd(b,Jd,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;var e=jc(b,A.current);jd(b,c);e=Ke(null,b,d,a,e,c);var f=Pe();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?\n(b.tag=1,b.memoizedState=null,b.updateQueue=null,C(d)?(f=!0,nc(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,od(b),e.updater=Bd,b.stateNode=e,e._reactInternals=b,Fd(b,d,a,c),b=hg(null,b,d,!0,f,c)):(b.tag=0,I&&f&&Rd(b),R(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Wh(d);a=ad(d,a);switch(e){case 0:b=cg(null,b,d,a,c);break a;case 1:b=gg(null,b,d,\na,c);break a;case 11:b=Yf(null,b,d,a,c);break a;case 14:b=$f(null,b,d,ad(d.type,a),c);break a}throw Error(n(306,d,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),cg(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),gg(a,b,d,e,c);case 3:a:{ig(b);if(null===a)throw Error(n(387));d=b.pendingProps;f=b.memoizedState;e=f.element;pd(a,b);ud(b,d,null,c);var g=b.memoizedState;d=g.element;if(p&&f.isDehydrated)if(f={element:d,isDehydrated:!1,\ncache:g.cache,transitions:g.transitions},b.updateQueue.baseState=f,b.memoizedState=f,b.flags&256){e=Error(n(423));b=jg(a,b,d,c,e);break a}else if(d!==e){e=Error(n(424));b=jg(a,b,d,c,e);break a}else for(p&&(Ud=Nb(b.stateNode.containerInfo),Td=b,I=!0,Wd=null,Vd=!1),c=pe(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{de();if(d===e){b=Zf(a,b,c);break a}R(a,b,d,c)}b=b.child}return b;case 5:return xe(b),null===a&&ae(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,\nOa(d,e)?g=null:null!==f&&Oa(d,f)&&(b.flags|=32),fg(a,b),R(a,b,g,c),b.child;case 6:return null===a&&ae(b),null;case 13:return mg(a,b,c);case 4:return ve(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=oe(b,null,d,c):R(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),Yf(a,b,d,e,c);case 7:return R(a,b,b.pendingProps,c),b.child;case 8:return R(a,b,b.pendingProps.children,c),b.child;case 12:return R(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=\nb.type._context;e=b.pendingProps;f=b.memoizedProps;g=e.value;gd(b,d,g);if(null!==f)if(Rc(f.value,g)){if(f.children===e.children&&!B.current){b=Zf(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=qd(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=\nc);id(f.return,c,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(n(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);id(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}R(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,jd(b,c),e=ld(e),d=d(e),b.flags|=\n1,R(a,b,d,c),b.child;case 14:return d=b.type,e=ad(d,b.pendingProps),e=ad(d.type,e),$f(a,b,d,e,c);case 15:return bg(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),b.tag=1,C(d)?(a=!0,nc(b)):a=!1,jd(b,c),Dd(b,d,e),Fd(b,d,e,c),hg(null,b,d,!0,a,c);case 19:return vg(a,b,c);case 22:return dg(a,b,c)}throw Error(n(156,b.tag));};function Dh(a,b){return Fc(a,b)}\nfunction Xh(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Yd(a,b,c,d){return new Xh(a,b,c,d)}function ag(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction Wh(a){if(\"function\"===typeof a)return ag(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===na)return 11;if(a===qa)return 14}return 2}\nfunction je(a,b){var c=a.alternate;null===c?(c=Yd(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction le(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)ag(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ia:return ne(c.children,e,f,b);case ja:g=8;e|=8;break;case ka:return a=Yd(12,c,b,e|2),a.elementType=ka,a.lanes=f,a;case oa:return a=Yd(13,c,b,e),a.elementType=oa,a.lanes=f,a;case pa:return a=Yd(19,c,b,e),a.elementType=pa,a.lanes=f,a;case sa:return ng(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case la:g=10;break a;case ma:g=9;break a;case na:g=11;\nbreak a;case qa:g=14;break a;case ra:g=16;d=null;break a}throw Error(n(130,null==a?a:typeof a,\"\"));}b=Yd(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function ne(a,b,c,d){a=Yd(7,a,d,b);a.lanes=c;return a}function ng(a,b,c,d){a=Yd(22,a,d,b);a.elementType=sa;a.lanes=c;a.stateNode={};return a}function ke(a,b,c){a=Yd(6,a,null,b);a.lanes=c;return a}\nfunction me(a,b,c){b=Yd(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction Yh(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=Sa;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=Ac(0);this.expirationTimes=Ac(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=Ac(0);this.identifierPrefix=d;this.onRecoverableError=e;p&&(this.mutableSourceEagerHydrationData=\nnull)}function Zh(a,b,c,d,e,f,g,h,k){a=new Yh(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Yd(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null};od(f);return a}\nfunction $h(a){if(!a)return hc;a=a._reactInternals;a:{if(ya(a)!==a||1!==a.tag)throw Error(n(170));var b=a;do{switch(b.tag){case 3:b=b.stateNode.context;break a;case 1:if(C(b.type)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}}b=b.return}while(null!==b);throw Error(n(171));}if(1===a.tag){var c=a.type;if(C(c))return mc(a,c,b)}return b}\nfunction ai(a){var b=a._reactInternals;if(void 0===b){if(\"function\"===typeof a.render)throw Error(n(188));a=Object.keys(a).join(\",\");throw Error(n(268,a));}a=Ba(b);return null===a?null:a.stateNode}function bi(a,b){a=a.memoizedState;if(null!==a&&null!==a.dehydrated){var c=a.retryLane;a.retryLane=0!==c&&c=l&&f>=v&&e<=m&&g<=r){a.splice(b,1);break}else if(!(d!==l||c.width!==k.width||rg)){v>f&&(k.height+=v-f,k.y=f);re)){l>d&&(k.width+=\nl-d,k.x=d);mc&&(c=g)),g \")+\"\\n\\nNo matching component was found for:\\n \")+a.join(\" > \")}return null};\nexports.getPublicRootInstance=function(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return Fa(a.child.stateNode);default:return a.child.stateNode}};\nexports.injectIntoDevTools=function(a){a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ea.ReactCurrentDispatcher,findHostInstanceByFiber:di,findFiberByHostInstance:a.findFiberByHostInstance||\nei,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:\"18.0.0-fc46dba67-20220329\"};if(\"undefined\"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)a=!1;else{var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)a=!0;else{try{Nc=b.inject(a),Oc=b}catch(c){}a=b.checkDCE?!0:!1}}return a};exports.isAlreadyRendering=function(){return!1};\nexports.observeVisibleRects=function(a,b,c,d){if(!bb)throw Error(n(363));a=kh(a,b);var e=ib(a,c,d).disconnect;return{disconnect:function(){e()}}};exports.registerMutableSourceForHydration=function(a,b){var c=b._getVersion;c=c(b._source);null==a.mutableSourceEagerHydrationData?a.mutableSourceEagerHydrationData=[b,c]:a.mutableSourceEagerHydrationData.push(b,c)};exports.runWithPriority=function(a,b){var c=D;try{return D=a,b()}finally{D=c}};exports.shouldError=function(){return null};\nexports.shouldSuspend=function(){return!1};exports.updateContainer=function(a,b,c,d){var e=b.current,f=H(),g=zd(e);c=$h(c);null===b.context?b.context=c:b.pendingContext=c;b=qd(f,g);b.payload={element:a};d=void 0===d?null:d;null!==d&&(b.callback=d);rd(e,b);a=Ad(e,g,f);null!==a&&sd(a,e,g);return g};\n\n return exports;\n};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-reconciler.production.min.js');\n} else {\n module.exports = require('./cjs/react-reconciler.development.js');\n}\n", "/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n", "/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n\n var debounced = function(){\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n \n debounced.flush = function() {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n \n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n};\n\n// Adds compatibility for ES modules\ndebounce.debounce = debounce;\n\nmodule.exports = debounce;\n", "import '/home/runner/work/visage/visage/.storybook/manager.js';", "import { addons } from '@storybook/addons';\nimport theme from './theme';\n\naddons.setConfig({\n theme,\n panelPosition: 'right',\n showPanel: true\n});\n", "export default __STORYBOOKADDONS__;\nconst { addons, types, mockChannel } = __STORYBOOKADDONS__;\nexport { addons, types, mockChannel };", "import { create } from '@storybook/theming';\nimport { getStoryAssetPath } from '../src/services';\n\nexport default create({\n base: 'light',\n brandImage: getStoryAssetPath('logo.png'),\n brandUrl: 'https://readyplayer.me'\n});\n", "export default __STORYBOOKTHEMING__;\nconst { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create, createCache, createGlobal, createReset, css, darken, ensure, ignoreSsrWarning, isPropValid, jsx, keyframes, lighten, styled, themes, typography, useTheme, withTheme } = __STORYBOOKTHEMING__;\nexport { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create, createCache, createGlobal, createReset, css, darken, ensure, ignoreSsrWarning, isPropValid, jsx, keyframes, lighten, styled, themes, typography, useTheme, withTheme };", "export * from './Models.service';\n", "import React, { useEffect, useCallback, useRef } from 'react';\nimport {\n LinearFilter,\n MeshStandardMaterial,\n Material,\n Vector2,\n Object3D,\n SkinnedMesh,\n Euler,\n Vector3,\n BufferGeometry,\n Skeleton,\n Group\n} from 'three';\nimport { useFrame } from '@react-three/fiber';\nimport type { ObjectMap, SkinnedMeshProps } from '@react-three/fiber';\nimport { GLTF, GLTFLoader, DRACOLoader } from 'three-stdlib';\nimport { suspend } from 'suspend-react';\nimport { Emotion } from 'src/components/Avatar/Avatar.component';\nimport { BloomConfiguration } from 'src/types';\nimport { MeshoptDecoder } from './meshopt_decoder';\n\nexport interface CustomNode extends Object3D {\n geometry: BufferGeometry;\n material: Material;\n skeleton: Skeleton;\n isMesh: boolean;\n morphTargetInfluences?: number[];\n}\n\nexport interface Nodes {\n [node: string]: Object3D;\n}\n\ntype Source = string | string[] | Blob | undefined | null;\n\nexport const getStoryAssetPath = (publicAsset: string) =>\n `${process.env.NODE_ENV === 'production' ? '/visage' : ''}/${publicAsset}`;\n\nconst validateSource = (source: Source): boolean => {\n if (Array.isArray(source)) {\n return source.length > 0 && source.every(validateSource);\n }\n\n if (typeof source === 'string') {\n const fileEndExpression = new RegExp(/(.glb|.fbx|.fbx[?].*|.glb[?].*)$/g);\n const uploadFileExpression = new RegExp(/^data:application\\/octet-stream;base64,/g);\n const gltfModelExpression = new RegExp(/^data:model\\/gltf-binary;base64,/g);\n return fileEndExpression.test(source) || uploadFileExpression.test(source) || gltfModelExpression.test(source);\n }\n\n if (source instanceof Blob) {\n return source.type === 'model/gltf-binary';\n }\n\n return false;\n};\n\nexport const isValidFormat = (source: Source): source is Blob | string => {\n const isValid = validateSource(source);\n\n if (source && !isValid) {\n console.warn(\n 'Provided GLB/FBX is invalid. Check docs for supported formats: https://github.com/readyplayerme/visage'\n );\n }\n\n return isValid;\n};\n\nexport const clamp = (value: number, max: number, min: number): number => Math.min(Math.max(min, value), max);\n\nexport const lerp = (start: number, end: number, time = 0.05): number => start * (1 - time) + end * time;\n\n/**\n * Avoid texture pixelation and add depth effect.\n */\nexport const normaliseMaterialsConfig = (materials: Record, bloomConfig?: BloomConfiguration) => {\n Object.values(materials).forEach((material) => {\n const mat = material as MeshStandardMaterial;\n if (mat.map) {\n mat.map.minFilter = LinearFilter;\n mat.depthWrite = true;\n }\n\n if (mat.name.toLowerCase().includes('hair')) {\n mat.roughness = 0.9;\n }\n\n if (mat.emissiveMap) {\n mat.emissiveIntensity = bloomConfig?.materialIntensity || 3.3;\n }\n });\n};\n\ninterface UseHeadMovement {\n nodes: Nodes;\n isHalfBody?: boolean;\n distance?: number;\n activeRotation?: number;\n rotationMargin?: Vector2;\n enabled?: boolean;\n}\n\n/**\n * Avatar head movement relative to cursor.\n * When the model isn't a standard Ready Player Me avatar, the head movement won't take effect.\n */\nexport const useHeadMovement = ({\n nodes,\n isHalfBody = false,\n distance = 2,\n activeRotation = 0.2,\n rotationMargin = new Vector2(5, 10),\n enabled = false\n}: UseHeadMovement) => {\n const rad = Math.PI / 180;\n const currentPos = new Vector2(0, 0);\n const targetPos = new Vector2(0, 0);\n const activeDistance = distance - (isHalfBody ? 1 : 0);\n const eyeRotationOffsetX = isHalfBody ? 90 * rad : 0;\n const neckBoneRotationOffsetX = (isHalfBody ? -5 : 10) * rad;\n const mapRange = (value: number, inMin: number, inMax: number, outMin: number, outMax: number) =>\n ((clamp(value, inMax, inMin) - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;\n\n useFrame((state) => {\n if (!enabled || !nodes.Neck || !nodes.Head || !nodes.RightEye || !nodes.LeftEye) {\n return;\n }\n\n const cameraToHeadDistance = state.camera.position.distanceTo(nodes.Head.position);\n const cameraRotation = Math.abs(state.camera.rotation.z);\n\n if (cameraToHeadDistance < activeDistance && cameraRotation < activeRotation) {\n targetPos.x = mapRange(state.mouse.y, -0.5, 1, rotationMargin.x * rad, -rotationMargin.x * rad);\n targetPos.y = mapRange(state.mouse.x, -0.5, 0.5, -rotationMargin.y * rad, rotationMargin.y * rad);\n } else {\n targetPos.set(0, 0);\n }\n\n currentPos.x = lerp(currentPos.x, targetPos.x);\n currentPos.y = lerp(currentPos.y, targetPos.y);\n /* eslint-disable no-param-reassign */\n nodes.Neck.rotation.x = currentPos.x + neckBoneRotationOffsetX;\n nodes.Neck.rotation.y = currentPos.y;\n\n nodes.Head.rotation.x = currentPos.x;\n nodes.Head.rotation.y = currentPos.y;\n\n nodes.RightEye.rotation.x = currentPos.x - eyeRotationOffsetX;\n nodes.LeftEye.rotation.x = currentPos.x - eyeRotationOffsetX;\n\n if (isHalfBody) {\n nodes.RightEye.rotation.z = currentPos.y * 2 + Math.PI;\n nodes.LeftEye.rotation.z = currentPos.y * 2 + Math.PI;\n } else {\n nodes.RightEye.rotation.y = currentPos.y * 2;\n nodes.LeftEye.rotation.y = currentPos.y * 2;\n }\n });\n};\n\n/**\n * Transfers Bone positions from source to target.\n * @param targetNodes {object} - object that will be mutated\n * @param sourceNodes {object} - object that will be used as reference\n */\nexport const mutatePose = (targetNodes?: ObjectMap['nodes'], sourceNodes?: ObjectMap['nodes']) => {\n if (targetNodes && sourceNodes) {\n Object.keys(targetNodes).forEach((key) => {\n if (targetNodes[key].type === 'Bone' && sourceNodes[key]) {\n /* eslint-disable no-param-reassign */\n const pos = sourceNodes[key].position;\n targetNodes[key].position.set(pos.x, pos.y, pos.z);\n\n const rot = sourceNodes[key].rotation;\n targetNodes[key].rotation.set(rot.x, rot.y, rot.z);\n }\n });\n }\n};\n\nexport const useEmotion = (nodes: ObjectMap['nodes'], emotion?: Emotion) => {\n // @ts-ignore\n const meshes = Object.values(nodes).filter((item: SkinnedMesh) => item?.morphTargetInfluences) as SkinnedMesh[];\n\n const resetEmotions = (resetMeshes: Array) => {\n resetMeshes.forEach((mesh) => {\n mesh?.morphTargetInfluences?.forEach((_, index) => {\n mesh!.morphTargetInfluences![index] = 0;\n });\n });\n };\n\n useFrame(() => {\n if (emotion) {\n resetEmotions(meshes);\n\n meshes.forEach((mesh) => {\n Object.entries(emotion).forEach(([shape, value]) => {\n const shapeId = mesh?.morphTargetDictionary?.[shape];\n\n if (shapeId) {\n mesh!.morphTargetInfluences![shapeId] = value;\n }\n });\n });\n } else {\n resetEmotions(meshes);\n }\n });\n};\n\nconst loader = new GLTFLoader();\nloader.setMeshoptDecoder(MeshoptDecoder);\n\nconst dracoLoader = new DRACOLoader();\ndracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.5/');\nloader.setDRACOLoader(dracoLoader);\n\nexport const useGltfLoader = (source: Blob | string): GLTF =>\n suspend(\n async () => {\n if (source instanceof Blob) {\n const buffer = await source.arrayBuffer();\n return (await loader.parseAsync(buffer, '')) as unknown as GLTF;\n }\n\n return loader.loadAsync(source);\n },\n [source],\n { lifespan: 100 }\n );\n\nexport const useGltfCachedLoader = (source: Blob | string): GLTF => {\n const cachedGltf = useRef>(new Map());\n\n return suspend(async (): Promise => {\n if (cachedGltf.current.has(source as string)) {\n return cachedGltf.current.get(source as string)!;\n }\n let result: GLTF;\n if (source instanceof Blob) {\n const buffer = await source.arrayBuffer();\n result = (await loader.parseAsync(buffer, '')) as GLTF;\n } else {\n result = await loader.loadAsync(source);\n }\n\n cachedGltf.current.set(source as string, result);\n return result;\n }, [source]);\n};\n\nexport function usePersistantRotation(scene: Group) {\n const refToPreviousScene = useRef(scene);\n\n useEffect(() => {\n if (refToPreviousScene.current !== scene) {\n // eslint-disable-next-line no-param-reassign\n scene.rotation.y = refToPreviousScene.current.rotation.y;\n refToPreviousScene.current = scene;\n }\n }, [scene]);\n}\n\nexport class Transform {\n constructor() {\n this.scale = new Vector3(1, 1, 1);\n this.rotation = new Euler(0, 0, 0);\n this.position = new Vector3(0, 0, 0);\n }\n\n scale: Vector3;\n\n rotation: Euler;\n\n position: Vector3;\n}\n\n/**\n * Builds a fallback model for given nodes.\n * Useful for displaying as the suspense fallback object.\n */\nfunction buildFallback(nodes: Nodes, transform: Transform = new Transform()): JSX.Element {\n return (\n \n {Object.keys(nodes).map((key) => {\n const node = nodes[key] as CustomNode;\n if (node.type === 'SkinnedMesh') {\n return (\n \n );\n }\n\n if (node.type === 'Mesh') {\n return (\n {\n parent.add(self);\n self.parent = node.parent;\n return () => parent.remove(self);\n }}\n castShadow\n receiveShadow\n key={node.name}\n scale={node.scale}\n position={node.position}\n rotation={node.rotation}\n geometry={node.geometry}\n material={node.material}\n morphTargetInfluences={node.morphTargetInfluences || []}\n />\n );\n }\n\n return null;\n })}\n \n );\n}\n\nexport const useFallback = (nodes: Nodes, setter?: (fallback: JSX.Element) => void) =>\n useEffect(() => {\n if (typeof setter === 'function') {\n setter(buildFallback(nodes));\n }\n }, [setter, nodes]);\n\nexport const triggerCallback = (callback?: () => void) => {\n if (typeof callback === 'function') {\n callback();\n }\n};\n\nexport const expressions = {\n blink: [\n {\n morphTarget: 'eyesClosed',\n morphTargetIndex: -1,\n offset: 0,\n duration: 0.2\n },\n {\n morphTarget: 'eyeSquintLeft',\n morphTargetIndex: -1,\n offset: 0,\n duration: 0.2\n },\n {\n morphTarget: 'eyeSquintRight',\n morphTargetIndex: -1,\n offset: 0,\n duration: 0.2\n }\n ]\n};\n\n/**\n * Animates avatars facial expressions when morphTargets=ARKit,Eyes Extra is provided with the avatar.\n */\nexport const useIdleExpression = (expression: keyof typeof expressions, nodes: Nodes) => {\n const headMesh = (nodes.Wolf3D_Head || nodes.Wolf3D_Avatar || nodes.head) as unknown as SkinnedMeshProps;\n const selectedExpression = expression in expressions ? expressions[expression] : undefined;\n const timeout = useRef();\n const duration = useRef(Number.POSITIVE_INFINITY);\n\n useEffect(() => {\n if (headMesh?.morphTargetDictionary && selectedExpression) {\n for (let i = 0; i < selectedExpression.length; i++) {\n selectedExpression[i].morphTargetIndex = headMesh.morphTargetDictionary[selectedExpression[i].morphTarget];\n }\n }\n }, [selectedExpression, headMesh?.morphTargetDictionary]);\n\n const animateExpression = useCallback(\n (delta: number) => {\n if (headMesh?.morphTargetInfluences && selectedExpression) {\n duration.current += delta;\n\n for (let i = 0; i < selectedExpression.length; i++) {\n const section = selectedExpression[i];\n\n if (duration.current < section.duration + section.offset) {\n if (duration.current > section.offset) {\n const pivot = ((duration.current - section.offset) / section.duration) * Math.PI;\n const morphInfluence = Math.sin(pivot);\n headMesh.morphTargetInfluences[section.morphTargetIndex] = morphInfluence;\n }\n } else {\n headMesh.morphTargetInfluences[section.morphTargetIndex] = 0;\n }\n }\n }\n },\n [headMesh?.morphTargetInfluences, selectedExpression, duration.current, timeout.current]\n );\n\n const setNextInterval = () => {\n duration.current = 0;\n const delay = Math.random() * 3000 + 3000;\n\n clearTimeout(timeout.current);\n timeout.current = setTimeout(setNextInterval, delay);\n };\n\n useEffect(() => {\n if (selectedExpression) {\n timeout.current = setTimeout(setNextInterval, 3000);\n }\n\n return () => {\n clearTimeout(timeout.current);\n };\n }, [selectedExpression]);\n\n useFrame((_, delta) => {\n if (headMesh && selectedExpression) {\n animateExpression(delta);\n }\n });\n};\n", "/**\n * @license\n * Copyright 2010-2024 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '166';\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 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 ConstantColorFactor = 211;\nconst OneMinusConstantColorFactor = 212;\nconst ConstantAlphaFactor = 213;\nconst OneMinusConstantAlphaFactor = 214;\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;\nconst AgXToneMapping = 6;\nconst NeutralToneMapping = 7;\nconst AttachedBindMode = 'attached';\nconst DetachedBindMode = 'detached';\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 UnsignedInt5999Type = 35902;\nconst AlphaFormat = 1021;\nconst RGBFormat = 1022;\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 RGBIntegerFormat = 1032;\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 RGB_BPTC_SIGNED_Format = 36494;\nconst RGB_BPTC_UNSIGNED_Format = 36495;\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;\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';\nconst LinearDisplayP3ColorSpace = 'display-p3-linear';\n\nconst LinearTransfer = 'linear';\nconst SRGBTransfer = 'srgb';\n\nconst Rec709Primaries = 'rec709';\nconst P3Primaries = '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 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 = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( 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\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\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 probeAsync( gl, sync, interval ) {\n\n\treturn new Promise( function ( resolve, reject ) {\n\n\t\tfunction probe() {\n\n\t\t\tswitch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {\n\n\t\t\t\tcase gl.WAIT_FAILED:\n\t\t\t\t\treject();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase gl.TIMEOUT_EXPIRED:\n\t\t\t\t\tsetTimeout( probe, interval );\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tresolve();\n\n\t\t\t}\n\n\t\t}\n\n\t\tsetTimeout( probe, interval );\n\n\t} );\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().set(\n\t0.8224621, 0.177538, 0.0,\n\t0.0331941, 0.9668058, 0.0,\n\t0.0170827, 0.0723974, 0.9105199,\n);\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\n\t1.2249401, - 0.2249404, 0.0,\n\t- 0.0420569, 1.0420571, 0.0,\n\t- 0.0196376, - 0.0786361, 1.0982735\n);\n\n/**\n * Defines supported color spaces by transfer function and primaries,\n * and provides conversions to/from the Linear-sRGB reference space.\n */\nconst COLOR_SPACES = {\n\t[ LinearSRGBColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color,\n\t\tfromReference: ( color ) => color,\n\t},\n\t[ SRGBColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\n\t},\n\t[ LinearDisplayP3ColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\n\t},\n\t[ DisplayP3ColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\n\t},\n};\n\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\t_workingColorSpace: LinearSRGBColorSpace,\n\n\tget workingColorSpace() {\n\n\t\treturn this._workingColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\n\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\n\n\t\t}\n\n\t\tthis._workingColorSpace = colorSpace;\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 sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\n\n\t\treturn targetFromReference( sourceToReference( 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\tgetPrimaries: function ( colorSpace ) {\n\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\n\n\t},\n\n\tgetTransfer: function ( colorSpace ) {\n\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\n\n\t},\n\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\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\t\tthis.dataReady = true;\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\tthis.colorSpace = colorSpace;\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.pmremVersion = 0; // 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\tset needsPMREMUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.pmremVersion ++;\n\n\t\t}\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\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\t\tthis.w = e[ 15 ];\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 = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( 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\toptions = Object.assign( {\n\t\t\tgenerateMipmaps: false,\n\t\t\tinternalFormat: null,\n\t\t\tminFilter: LinearFilter,\n\t\t\tdepthBuffer: true,\n\t\t\tstencilBuffer: false,\n\t\t\tresolveDepthBuffer: true,\n\t\t\tresolveStencilBuffer: true,\n\t\t\tdepthTexture: null,\n\t\t\tsamples: 0,\n\t\t\tcount: 1\n\t\t}, options );\n\n\t\tconst texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\ttexture.flipY = false;\n\t\ttexture.generateMipmaps = options.generateMipmaps;\n\t\ttexture.internalFormat = options.internalFormat;\n\n\t\tthis.textures = [];\n\n\t\tconst count = options.count;\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.textures[ i ] = texture.clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\tthis.depthBuffer = options.depthBuffer;\n\t\tthis.stencilBuffer = options.stencilBuffer;\n\n\t\tthis.resolveDepthBuffer = options.resolveDepthBuffer;\n\t\tthis.resolveStencilBuffer = options.resolveStencilBuffer;\n\n\t\tthis.depthTexture = options.depthTexture;\n\n\t\tthis.samples = options.samples;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures[ 0 ];\n\n\t}\n\n\tset texture( value ) {\n\n\t\tthis.textures[ 0 ] = value;\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.textures.length; i < il; i ++ ) {\n\n\t\t\t\tthis.textures[ i ].image.width = width;\n\t\t\t\tthis.textures[ i ].image.height = height;\n\t\t\t\tthis.textures[ 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\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.textures.length = 0;\n\n\t\tfor ( let i = 0, il = source.textures.length; i < il; i ++ ) {\n\n\t\t\tthis.textures[ i ] = source.textures[ i ].clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\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\tthis.resolveDepthBuffer = source.resolveDepthBuffer;\n\t\tthis.resolveStencilBuffer = source.resolveStencilBuffer;\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\tthis.layerUpdates = new Set();\n\n\t}\n\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\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, options = {} ) {\n\n\t\tsuper( width, height, options );\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 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 = true ) {\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 === true ) 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(); // normalize calls _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// sets this quaternion to a uniform random unit quaternnion\n\n\t\t// Ken Shoemake\n\t\t// Uniform random rotations\n\t\t// D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.\n\n\t\tconst theta1 = 2 * Math.PI * Math.random();\n\t\tconst theta2 = 2 * Math.PI * Math.random();\n\n\t\tconst x0 = Math.random();\n\t\tconst r1 = Math.sqrt( 1 - x0 );\n\t\tconst r2 = Math.sqrt( x0 );\n\n\t\treturn this.set(\n\t\t\tr1 * Math.sin( theta1 ),\n\t\t\tr1 * Math.cos( theta1 ),\n\t\t\tr2 * Math.sin( theta2 ),\n\t\t\tr2 * Math.cos( theta2 ),\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\tthis._onChangeCallback();\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\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\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 = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( 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$c.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$c );\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$c.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// https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst theta = Math.random() * Math.PI * 2;\n\t\tconst u = Math.random() * 2 - 1;\n\t\tconst c = Math.sqrt( 1 - u * u );\n\n\t\tthis.x = c * Math.cos( theta );\n\t\tthis.y = u;\n\t\tthis.z = c * Math.sin( theta );\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$c = /*@__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$b.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$b.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$b.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\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$b );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector$b.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector$b.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector$b );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\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$4.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box$4.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box$4 );\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$b );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$b.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$b ).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$b ).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$b = /*@__PURE__*/ new Vector3();\n\nconst _box$4 = /*@__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$3 = /*@__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.isSphere = true;\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$3.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$a = /*@__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$a ) );\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$a.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$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$a.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$a.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$a.dot( this.direction );\n\t\tconst d2 = _vector$a.dot( _vector$a ) - 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$a ) !== 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$4.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$4.elements[ 0 ] *= invSX;\n\t\t_m1$4.elements[ 1 ] *= invSX;\n\t\t_m1$4.elements[ 2 ] *= invSX;\n\n\t\t_m1$4.elements[ 4 ] *= invSY;\n\t\t_m1$4.elements[ 5 ] *= invSY;\n\t\t_m1$4.elements[ 6 ] *= invSY;\n\n\t\t_m1$4.elements[ 8 ] *= invSZ;\n\t\t_m1$4.elements[ 9 ] *= invSZ;\n\t\t_m1$4.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$4 );\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$4 = /*@__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$2 = /*@__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$2.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix$2, 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$3 = /*@__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\nconst _childaddedEvent = { type: 'childadded', child: null };\nconst _childremovedEvent = { type: 'childremoved', child: null };\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\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\t\tthis.matrixWorldNeedsUpdate = false;\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\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\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$3.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$3.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$3.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$3 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$3.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$3 );\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\tobject.removeFromParent();\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t\t_childaddedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t\t_childaddedEvent.child = null;\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\t_childremovedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childremovedEvent );\n\t\t\t_childremovedEvent.child = null;\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\treturn this.remove( ... this.children );\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$3.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$3.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$3 );\n\n\t\tobject.removeFromParent();\n\t\tobject.parent = this;\n\t\tthis.children.push( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t_childaddedEvent.child = object;\n\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t_childaddedEvent.child = null;\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, result = [] ) {\n\n\t\tif ( this[ name ] === value ) result.push( 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 ].getObjectsByProperty( name, value, result );\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.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\tif ( this.parent === null ) {\n\n\t\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t\t}\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// make sure descendants are updated if required\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\tchild.updateMatrixWorld( force );\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 ) {\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.matrixWorldAutoUpdate === true ) {\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}\n\n\t\t// make sure descendants are updated\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\tchild.updateWorldMatrix( false, true );\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\tif ( this.isBatchedMesh ) {\n\n\t\t\tobject.type = 'BatchedMesh';\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\t\tobject.sortObjects = this.sortObjects;\n\n\t\t\tobject.drawRanges = this._drawRanges;\n\t\t\tobject.reservedRanges = this._reservedRanges;\n\n\t\t\tobject.visibility = this._visibility;\n\t\t\tobject.active = this._active;\n\t\t\tobject.bounds = this._bounds.map( bound => ( {\n\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\tboxMin: bound.box.min.toArray(),\n\t\t\t\tboxMax: bound.box.max.toArray(),\n\n\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\tsphereRadius: bound.sphere.radius,\n\t\t\t\tsphereCenter: bound.sphere.center.toArray()\n\t\t\t} ) );\n\n\t\t\tobject.maxInstanceCount = this._maxInstanceCount;\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\n\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\n\t\t\tobject.geometryCount = this._geometryCount;\n\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\n\n\t\t\tif ( this._colorsTexture !== null ) object.colorsTexture = this._colorsTexture.toJSON( meta );\n\n\t\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\t\tobject.boundingSphere = {\n\t\t\t\t\tcenter: object.boundingSphere.center.toArray(),\n\t\t\t\t\tradius: object.boundingSphere.radius\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tif ( this.boundingBox !== null ) {\n\n\t\t\t\tobject.boundingBox = {\n\t\t\t\t\tmin: object.boundingBox.min.toArray(),\n\t\t\t\t\tmax: object.boundingBox.max.toArray()\n\t\t\t\t};\n\n\t\t\t}\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\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\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$2 = /*@__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\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\ttarget.set( 0, 0, 0 );\n\t\t\treturn null;\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\t// if the triangle is degenerate then we can't contain a point\n\t\tif ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {\n\n\t\t\ttarget.x = 0;\n\t\t\ttarget.y = 0;\n\t\t\tif ( 'z' in target ) target.z = 0;\n\t\t\tif ( 'w' in target ) target.w = 0;\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$2.x );\n\t\ttarget.addScaledVector( v2, _v3$2.y );\n\t\ttarget.addScaledVector( v3, _v3$2.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\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\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\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\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\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\t\tthis.blendColor = new Color( 0, 0, 0 );\n\t\tthis.blendAlpha = 0;\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\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 !== undefined && 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.dispersion !== undefined ) data.dispersion = this.dispersion;\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.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();\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 === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\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 = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\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 = true;\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\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\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\tonBuild( /* shaderobject, renderer */ ) {\n\n\t\tconsole.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166\n\n\t}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {\n\n\t\tconsole.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166\n\n\t}\n\n\n}\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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$9 = /*@__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.updateRanges = [];\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\tget updateRange() {\n\n\t\twarnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\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$9.fromBufferAttribute( this, i );\n\t\t\t\t_vector$9.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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\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\nlet _id$2 = 0;\n\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$8 = /*@__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$2 ++ } );\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$2.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\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.', 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$2.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.min, _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.max, _box$2.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.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.', 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$2.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$8.addVectors( _box$2.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.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$2.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$8.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\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$8.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$8.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\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 positionAttribute = attributes.position;\n\t\tconst normalAttribute = attributes.normal;\n\t\tconst uvAttribute = attributes.uv;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );\n\n\t\t}\n\n\t\tconst tangentAttribute = this.getAttribute( 'tangent' );\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < positionAttribute.count; 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.fromBufferAttribute( positionAttribute, a );\n\t\t\tvB.fromBufferAttribute( positionAttribute, b );\n\t\t\tvC.fromBufferAttribute( positionAttribute, c );\n\n\t\t\tuvA.fromBufferAttribute( uvAttribute, a );\n\t\t\tuvB.fromBufferAttribute( uvAttribute, b );\n\t\t\tuvC.fromBufferAttribute( uvAttribute, c );\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: index.count\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\tindex.getX( j + 0 ),\n\t\t\t\t\tindex.getX( j + 1 ),\n\t\t\t\t\tindex.getX( 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.fromBufferAttribute( normalAttribute, v );\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\ttangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, 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( index.getX( j + 0 ) );\n\t\t\t\thandleVertex( index.getX( j + 1 ) );\n\t\t\t\thandleVertex( index.getX( 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$8.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$8.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.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$6 = /*@__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 = Array.isArray( source.material ) ? source.material.slice() : 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$6.copy( geometry.boundingSphere );\n\t\t_sphere$6.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$6.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$6, _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$1( 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$1( 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\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\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\tif ( currentRenderTarget === 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\t// https://github.com/mrdoob/three.js/issues/27868\n\tif ( currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\treturn currentRenderTarget.texture.colorSpace;\n\n\t}\n\n\treturn ColorManagement.workingColorSpace;\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\tclipCullDistance: false, // set to use vertex shader clipping\n\t\t\tmultiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID\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\treturn super.getWorldDirection( target ).negate();\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\nconst _v3$1 = /*@__PURE__*/ new Vector3();\nconst _minTarget = /*@__PURE__*/ new Vector2();\nconst _maxTarget = /*@__PURE__*/ new Vector2();\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 * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.\n\t */\n\tgetViewBounds( distance, minTarget, maxTarget ) {\n\n\t\t_v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tminTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t\t_v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tmaxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t}\n\n\t/**\n\t * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Copies the result into the target Vector2, where x is width and y is height.\n\t */\n\tgetViewSize( distance, target ) {\n\n\t\tthis.getViewBounds( distance, _minTarget, _maxTarget );\n\n\t\treturn target.subVectors( _maxTarget, _minTarget );\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\t\tthis.activeMipmapLevel = 0;\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, activeMipmapLevel } = this;\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\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\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, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\t// mipmaps are generated during the last call of render()\n\t\t// at this point, all sides of the cube render target are defined\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\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\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$5 = /*@__PURE__*/ new Sphere();\nconst _vector$7 = /*@__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$5.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$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$5.center.set( 0, 0, 0 );\n\t\t_sphere$5.radius = 0.7071067811865476;\n\t\t_sphere$5.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$5 );\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$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$7 ) < 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 ) {\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\t\tconst size = array.byteLength;\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\ttype = gl.HALF_FLOAT;\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\tsize: size\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; // @deprecated, r159\n\t\tconst updateRanges = attribute.updateRanges;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 && updateRanges.length === 0 ) {\n\n\t\t\t// Not using update ranges\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t}\n\n\t\tif ( updateRanges.length !== 0 ) {\n\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\n\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, range.start, range.count );\n\n\t\t\t}\n\n\t\t\tattribute.clearUpdateRanges();\n\n\t\t}\n\n\t\t// @deprecated, r159\n\t\tif ( updateRange.count !== - 1 ) {\n\n\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\tarray, updateRange.offset, updateRange.count );\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\tif ( data.size !== attribute.array.byteLength ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );\n\n\t\t\t}\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\\t#ifdef ALPHA_TO_COVERAGE\\n\\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\\n\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n\\t#endif\\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_CLEARCOAT ) \\n\\t\\tclearcoatSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_SHEEN ) \\n\\t\\tsheenSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\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 batching_pars_vertex = \"#ifdef USE_BATCHING\\n\\t#if ! defined( GL_ANGLE_multi_draw )\\n\\t#define gl_DrawID _gl_DrawID\\n\\tuniform int _gl_DrawID;\\n\\t#endif\\n\\tuniform highp sampler2D batchingTexture;\\n\\tuniform highp usampler2D batchingIdTexture;\\n\\tmat4 getBatchingMatrix( const in float i ) {\\n\\t\\tint size = textureSize( batchingTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n\\tfloat getIndirectIndex( const in int i ) {\\n\\t\\tint size = textureSize( batchingIdTexture, 0 ).x;\\n\\t\\tint x = i % size;\\n\\t\\tint y = i / size;\\n\\t\\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\\n\\t}\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tuniform sampler2D batchingColorTexture;\\n\\tvec3 getBatchingColor( const in float i ) {\\n\\t\\tint size = textureSize( batchingColorTexture, 0 ).x;\\n\\t\\tint j = int( i );\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\\n\\t}\\n#endif\";\n\nvar batching_vertex = \"#ifdef USE_BATCHING\\n\\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\\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 = normalize( dFdx( surf_pos.xyz ) );\\n\\t\\tvec3 vSigmaY = normalize( 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#ifdef ALPHA_TO_COVERAGE\\n\\t\\tfloat distanceToPlane, distanceGradient;\\n\\t\\tfloat clipOpacity = 1.0;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\tif ( clipOpacity == 0.0 ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tfloat unionClipOpacity = 1.0;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\t\\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tclipOpacity *= 1.0 - unionClipOpacity;\\n\\t\\t#endif\\n\\t\\tdiffuseColor.a *= clipOpacity;\\n\\t\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tbool clipped = true;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tif ( clipped ) discard;\\n\\t\\t#endif\\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 ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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#ifdef USE_BATCHING_COLOR\\n\\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\\n\\tvColor.xyz *= batchingColor.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};\\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_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\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_TANGENT\\n\\tvec3 transformedTangent = objectTangent;\\n#endif\\n#ifdef USE_BATCHING\\n\\tmat3 bm = mat3( batchingMatrix );\\n\\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\\n\\ttransformedNormal = bm * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = bm * transformedTangent;\\n\\t#endif\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmat3 im = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\\n\\ttransformedNormal = im * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = im * transformedTangent;\\n\\t#endif\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 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 = \"\\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\\n\\tvec3( 0.8224621, 0.177538, 0.0 ),\\n\\tvec3( 0.0331941, 0.9668058, 0.0 ),\\n\\tvec3( 0.0170827, 0.0723974, 0.9105199 )\\n);\\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.2249401, - 0.2249404, 0.0 ),\\n\\tvec3( - 0.0420569, 1.0420571, 0.0 ),\\n\\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\\n);\\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\\n}\\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\\n}\\nvec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 sRGBTransferOETF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\\nvec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 LinearTosRGB( in vec4 value ) {\\n\\treturn sRGBTransferOETF( value );\\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, envMapRotation * 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\\tuniform mat3 envMapRotation;\\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_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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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;\\n#if defined( USE_LIGHT_PROBES )\\n\\tuniform vec3 lightProbe[ 9 ];\\n#endif\\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\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t}\\n\\treturn distanceFalloff;\\n}\\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, 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 vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometryPosition;\\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 vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometryPosition;\\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, envMapRotation * 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, envMapRotation * 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\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_DISPERSION\\n\\tmaterial.dispersion = dispersion;\\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\\tif( material.anisotropy == 0.0 ) {\\n\\t\\tanisotropyV = vec2( 1.0, 0.0 );\\n\\t} else {\\n\\t\\tanisotropyV /= material.anisotropy;\\n\\t\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\t}\\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\\tfloat dispersion;\\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 clearcoatSpecularDirect = vec3( 0.0 );\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\nvec3 sheenSpecularIndirect = 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometryNormal;\\n\\t\\tvec3 viewDir = geometryViewDir;\\n\\t\\tvec3 position = geometryPosition;\\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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, 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( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, 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 = \"\\nvec3 geometryPosition = - vViewPosition;\\nvec3 geometryNormal = normal;\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\n#ifdef USE_CLEARCOAT\\n\\tgeometryClearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\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, geometryPosition, 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.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, 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.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, 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.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\\t#if defined( USE_LIGHT_PROBES )\\n\\t\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\n\\t#endif\\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 ], geometryNormal );\\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( geometryNormal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvFragDepth = 1.0 + gl_Position.w;\\n\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\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 morphinstance_vertex = \"#ifdef USE_INSTANCING_MORPH\\n\\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\\n\\t}\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS )\\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\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\t#ifndef USE_INSTANCING_MORPH\\n\\t\\tuniform float morphTargetBaseInfluence;\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t#endif\\n\\tuniform sampler2DArray morphTargetsTexture;\\n\\tuniform ivec2 morphTargetsTextureSize;\\n\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t}\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\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 nonPerturbedNormal = 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 = nonPerturbedNormal;\\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_BATCHING\\n\\tmvPosition = batchingMatrix * mvPosition;\\n#endif\\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 shadowIntensity;\\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 shadowIntensity;\\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 shadowIntensity;\\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 shadowIntensity, 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 mix( 1.0, shadow, shadowIntensity );\\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\t\\n\\t\\tfloat lightToPositionLength = length( lightToPosition );\\n\\t\\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\\n\\t\\t\\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\t\\tdp += shadowBias;\\n\\t\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\t\\tshadow = (\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\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 shadowIntensity;\\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 shadowIntensity;\\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 shadowIntensity;\\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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tint size = textureSize( boneTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\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}\\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.6605, - 0.1246, - 0.0182 ),\\n\\tvec3( - 0.5876, 1.1329, - 0.1006 ),\\n\\tvec3( - 0.0728, - 0.0083, 1.1187 )\\n);\\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\\n\\tvec3( 0.6274, 0.0691, 0.0164 ),\\n\\tvec3( 0.3293, 0.9195, 0.0880 ),\\n\\tvec3( 0.0433, 0.0113, 0.8956 )\\n);\\nvec3 agxDefaultContrastApprox( vec3 x ) {\\n\\tvec3 x2 = x * x;\\n\\tvec3 x4 = x2 * x2;\\n\\treturn + 15.5 * x4 * x2\\n\\t\\t- 40.14 * x4 * x\\n\\t\\t+ 31.96 * x4\\n\\t\\t- 6.868 * x2 * x\\n\\t\\t+ 0.4298 * x2\\n\\t\\t+ 0.1191 * x\\n\\t\\t- 0.00232;\\n}\\nvec3 AgXToneMapping( vec3 color ) {\\n\\tconst mat3 AgXInsetMatrix = mat3(\\n\\t\\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\\n\\t\\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\\n\\t\\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\\n\\t);\\n\\tconst mat3 AgXOutsetMatrix = mat3(\\n\\t\\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\\n\\t\\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\\n\\t\\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\\n\\t);\\n\\tconst float AgxMinEv = - 12.47393;\\tconst float AgxMaxEv = 4.026069;\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\n\\tcolor = AgXInsetMatrix * color;\\n\\tcolor = max( color, 1e-10 );\\tcolor = log2( color );\\n\\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\tcolor = agxDefaultContrastApprox( color );\\n\\tcolor = AgXOutsetMatrix * color;\\n\\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\\n\\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\treturn color;\\n}\\nvec3 NeutralToneMapping( vec3 color ) {\\n\\tconst float StartCompression = 0.8 - 0.04;\\n\\tconst float Desaturation = 0.15;\\n\\tcolor *= toneMappingExposure;\\n\\tfloat x = min( color.r, min( color.g, color.b ) );\\n\\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\\n\\tcolor -= offset;\\n\\tfloat peak = max( color.r, max( color.g, color.b ) );\\n\\tif ( peak < StartCompression ) return color;\\n\\tfloat d = 1. - StartCompression;\\n\\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\\n\\tcolor *= newPeak / peak;\\n\\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\\n\\treturn mix( color, vec3( newPeak ), g );\\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.dispersion, 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 dispersion, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec4 transmittedLight;\\n\\t\\tvec3 transmittance;\\n\\t\\t#ifdef USE_DISPERSION\\n\\t\\t\\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\\n\\t\\t\\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\\n\\t\\t\\tfor ( int i = 0; i < 3; i ++ ) {\\n\\t\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\\n\\t\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\n\\t\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\n\\t\\t\\t\\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\\n\\t\\t\\t\\ttransmittedLight[ i ] = transmissionSample[ i ];\\n\\t\\t\\t\\ttransmittedLight.a += transmissionSample.a;\\n\\t\\t\\t\\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\\n\\t\\t\\t}\\n\\t\\t\\ttransmittedLight.a /= 3.0;\\n\\t\\t\\n\\t\\t#else\\n\\t\\t\\n\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\t\\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\t\\n\\t\\t#endif\\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_BATCHING\\n\\t\\tworldPosition = batchingMatrix * worldPosition;\\n\\t#endif\\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\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\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;\\nuniform mat3 backgroundRotation;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * 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 \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\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\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\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 \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\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\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\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 \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\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\\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\\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 \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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 \\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\\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\\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\\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 \\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#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\\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\\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 \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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 \\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\\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_DISPERSION\\n\\tuniform float dispersion;\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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 + sheenSpecularDirect + sheenSpecularIndirect;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * 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 \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\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 \\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}\";\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\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\tbatching_pars_vertex: batching_pars_vertex,\n\tbatching_vertex: batching_vertex,\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_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\tmorphinstance_vertex: morphinstance_vertex,\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\tenvMapRotation: { value: /*@__PURE__*/ new Matrix3() },\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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 }\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\tbackgroundRotation: { value: /*@__PURE__*/ new Matrix3() }\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\tdispersion: { value: 0 },\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 };\nconst _e1$1 = /*@__PURE__*/ new Euler();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\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 getBackground( scene ) {\n\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\treturn background;\n\n\t}\n\n\tfunction render( scene ) {\n\n\t\tlet forceClear = false;\n\t\tconst background = getBackground( scene );\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 environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\n\n\t\tif ( environmentBlendMode === 'additive' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\t// buffers might not be writable which is required to ensure a correct clear\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\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t}\n\n\tfunction addToRenderList( renderList, scene ) {\n\n\t\tconst background = getBackground( scene );\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\t_e1$1.copy( scene.backgroundRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;\n\n\t\t\tif ( background.isCubeTexture && background.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1$1.y *= - 1;\n\t\t\t\t_e1$1.z *= - 1;\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.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\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 = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\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\t\taddToRenderList: addToRenderList\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, attributes ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\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\tconst state = getBindingState( geometry, program, material );\n\n\t\tif ( currentState !== state ) {\n\n\t\t\tcurrentState = state;\n\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t}\n\n\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\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\treturn gl.createVertexArray();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\treturn gl.bindVertexArray( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\treturn gl.deleteVertexArray( 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\tgl.vertexAttribDivisor( 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\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\n\n\t\t\t\t\tconst integer = ( 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 ) {\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\tgl.drawArraysInstanced( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\t}\n\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\n\n\t\t\t\trenderInstances( starts[ i ], counts[ i ], primcount[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\n\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters, utils ) {\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 textureFormatReadable( textureFormat ) {\n\n\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfunction textureTypeReadable( textureType ) {\n\n\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );\n\n\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\ttextureType !== FloatType && ! halfFloatSupportedByExt ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\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\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 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\n\tconst maxSamples = gl.getParameter( gl.MAX_SAMPLES );\n\n\treturn {\n\n\t\tisWebGL2: true, // keeping this for backwards compatibility\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\ttextureFormatReadable: textureFormatReadable,\n\t\ttextureTypeReadable: textureTypeReadable,\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\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 ) {\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 );\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;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\nlet _oldXrEnabled = false;\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( - PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\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\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\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\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 * The smallest supported equirectangular image size is 64 x 32.\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 * The smallest supported cube size is 16 x 16.\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, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\tthis._renderer.xr.enabled = _oldXrEnabled;\n\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\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\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\t\tconst n = this._lodPlanes.length;\n\n\t\tfor ( let i = 1; i < n; 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[ ( n - 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\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\tconst currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {\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\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\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 ( renderTarget !== undefined ) {\n\n\t\t\t\t\t\treturn renderTarget.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\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\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 () {\n\n\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\t\t\tgetExtension( 'WEBGL_clip_cull_distance' );\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\t\t\tgetExtension( 'WEBGL_render_shared_exponent' );\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\twarnOnce( '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 ) {\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\tgl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\n\t}\n\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\n\n\t\t\t\trenderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\n\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\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 WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\t// the following encodes morph targets into an array of data textures. Each layer represents a single morph target.\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 entry = morphTextures.get( geometry );\n\n\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\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 vertexDataCount = 0;\n\n\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\tlet height = 1;\n\n\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t}\n\n\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\ttexture.type = FloatType;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\t// fill buffer\n\n\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tentry = {\n\t\t\t\tcount: morphTargetsCount,\n\t\t\t\ttexture: texture,\n\t\t\t\tsize: new Vector2( width, height )\n\t\t\t};\n\n\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\tfunction disposeTexture() {\n\n\t\t\t\ttexture.dispose();\n\n\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t}\n\n\t\t//\n\t\tif ( object.isInstancedMesh === true && object.morphTexture !== null ) {\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );\n\n\t\t} else {\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\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t}\n\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\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\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, 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\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();\n\nconst emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );\n\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\tlet emptyTexture2D;\n\n\tif ( this.type === gl.SAMPLER_2D_SHADOW ) {\n\n\t\temptyShadowTexture.compareFunction = LessEqualCompare; // #28670\n\t\temptyTexture2D = emptyShadowTexture;\n\n\t} else {\n\n\t\temptyTexture2D = emptyTexture;\n\n\t}\n\n\ttextures.setTexture2D( v || emptyTexture2D, 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.type = activeInfo.type;\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.type = activeInfo.type;\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\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\nconst COMPLETION_STATUS_KHR = 0x91B1;\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\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\tconst encodingPrimaries = ColorManagement.getPrimaries( colorSpace );\n\n\tlet gamutMapping;\n\n\tif ( workingPrimaries === encodingPrimaries ) {\n\n\t\tgamutMapping = '';\n\n\t} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {\n\n\t\tgamutMapping = 'LinearDisplayP3ToLinearSRGB';\n\n\t} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {\n\n\t\tgamutMapping = 'LinearSRGBToLinearDisplayP3';\n\n\t}\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\tcase LinearDisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t\tcase SRGBColorSpace:\n\t\tcase DisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'sRGBTransferOETF' ];\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\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 ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;\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 AgXToneMapping:\n\t\t\ttoneMappingName = 'AgX';\n\t\t\tbreak;\n\n\t\tcase NeutralToneMapping:\n\t\t\ttoneMappingName = 'Neutral';\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 generateVertexExtensions( parameters ) {\n\n\tconst chunks = [\n\t\tparameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',\n\t\tparameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',\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\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;\n\tprecision ${parameters.precision} int;\n\tprecision ${parameters.precision} sampler2D;\n\tprecision ${parameters.precision} samplerCube;\n\tprecision ${parameters.precision} sampler3D;\n\tprecision ${parameters.precision} sampler2DArray;\n\tprecision ${parameters.precision} sampler2DShadow;\n\tprecision ${parameters.precision} samplerCubeShadow;\n\tprecision ${parameters.precision} sampler2DArrayShadow;\n\tprecision ${parameters.precision} isampler2D;\n\tprecision ${parameters.precision} isampler3D;\n\tprecision ${parameters.precision} isamplerCube;\n\tprecision ${parameters.precision} isampler2DArray;\n\tprecision ${parameters.precision} usampler2D;\n\tprecision ${parameters.precision} usampler3D;\n\tprecision ${parameters.precision} usamplerCube;\n\tprecision ${parameters.precision} usampler2DArray;\n\t`;\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 customVertexExtensions = generateVertexExtensions( 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\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.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',\n\t\t\tparameters.batching ? '#define USE_BATCHING' : '',\n\t\t\tparameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\t\t\tparameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',\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.anisotropy ? '#define USE_ANISOTROPY' : '',\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 ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#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.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\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'#ifdef USE_INSTANCING_MORPH',\n\n\t\t\t'\tuniform sampler2D morphTexture;',\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'#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\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.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',\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.dispersion ? '#define USE_DISPERSION' : '',\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 || parameters.batchingColor ? '#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.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\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.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\tcustomVertexExtensions,\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\tfunction onFirstUse( self ) {\n\n\t\t// check for link errors\n\t\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\t\tlet runnable = true;\n\t\t\tlet haveDiagnostics = true;\n\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\t\trunnable = false;\n\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// default error reporting\n\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t\t'Material Name: ' + self.name + '\\n' +\n\t\t\t\t\t\t'Material Type: ' + self.type + '\\n\\n' +\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\t\tfragmentErrors\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t} else if ( programLog !== '' ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\t\thaveDiagnostics = false;\n\n\t\t\t}\n\n\t\t\tif ( haveDiagnostics ) {\n\n\t\t\t\tself.diagnostics = {\n\n\t\t\t\t\trunnable: runnable,\n\n\t\t\t\t\tprogramLog: programLog,\n\n\t\t\t\t\tvertexShader: {\n\n\t\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t\t},\n\n\t\t\t\t\tfragmentShader: {\n\n\t\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\t\tprefix: prefixFragment\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\t// Clean up\n\n\t\t// Crashes in iOS9 and iOS10. #18402\n\t\t// gl.detachShader( program, glVertexShader );\n\t\t// gl.detachShader( program, glFragmentShader );\n\n\t\tgl.deleteShader( glVertexShader );\n\t\tgl.deleteShader( glFragmentShader );\n\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t}\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\t// Populates cachedUniforms and cachedAttributes\n\t\t\tonFirstUse( this );\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\t// Populates cachedAttributes and cachedUniforms\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\n\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\n\n\tthis.isReady = function () {\n\n\t\tif ( programReady === false ) {\n\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\n\n\t\t}\n\n\t\treturn programReady;\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$1 = 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$1 ++;\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 _activeChannels = new Set();\n\tconst programs = [];\n\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\t_activeChannels.add( 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\t\tconst IS_BATCHEDMESH = object.isBatchedMesh === 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_DISPERSION = material.dispersion > 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\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\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\tbatching: IS_BATCHEDMESH,\n\t\t\tbatchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\t\t\tinstancingMorph: IS_INSTANCEDMESH && object.morphTexture !== 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\t\t\talphaToCoverage: !! material.alphaToCoverage,\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\tdispersion: HAS_DISPERSION,\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 && material.alphaToCoverage === false,\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\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\tnumLightProbes: lights.numLightProbes,\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\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\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\textensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),\n\t\t\textensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),\n\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\t// the usage of getChannel() determines the active texture channels for this shader\n\n\t\tparameters.vertexUv1s = _activeChannels.has( 1 );\n\t\tparameters.vertexUv2s = _activeChannels.has( 2 );\n\t\tparameters.vertexUv3s = _activeChannels.has( 3 );\n\n\t\t_activeChannels.clear();\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.numLightProbes );\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.supportsVertexTextures )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingMorph )\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\t\tif ( parameters.alphaHash )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.batching )\n\t\t\t_programLayers.enable( 19 );\n\t\tif ( parameters.dispersion )\n\t\t\t_programLayers.enable( 20 );\n\t\tif ( parameters.batchingColor )\n\t\t\t_programLayers.enable( 21 );\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.doubleSided )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.decodeVideoTexture )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.alphaToCoverage )\n\t\t\t_programLayers.enable( 19 );\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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 ) {\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\n\t\t\tnumLightProbes: - 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\t\tnumLightProbes: 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 ) {\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\tlet numLightProbes = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\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;\n\t\t\t\tg += color.g * intensity;\n\t\t\t\tb += color.b * intensity;\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\tnumLightProbes ++;\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 );\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.shadowIntensity = shadow.intensity;\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 );\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.shadowIntensity = shadow.intensity;\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 );\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.shadowIntensity = shadow.intensity;\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 );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity );\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 ( extensions.has( 'OES_texture_float_linear' ) === true ) {\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\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\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\t\t\thash.numLightProbes !== numLightProbes ) {\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\t\t\tstate.numLightProbes = numLightProbes;\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\thash.numLightProbes = numLightProbes;\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 ) {\n\n\tconst lights = new WebGLLights( extensions );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init( camera ) {\n\n\t\tstate.camera = camera;\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() {\n\n\t\tlights.setup( lightsArray );\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\tcamera: null,\n\n\t\tlights: lights,\n\n\t\ttransmissionRenderTarget: {}\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 ) {\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 );\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 );\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\trenderer.setRenderTarget( shadow.map );\n\t\t\trenderer.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\trenderer.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\trenderer.setRenderTarget( shadow.mapPass );\n\t\trenderer.clear();\n\t\trenderer.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\trenderer.setRenderTarget( shadow.map );\n\t\trenderer.clear();\n\t\trenderer.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\t\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\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\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, 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\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, 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\tfunction onMaterialDispose( event ) {\n\n\t\tconst material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t// make sure to remove the unique distance/depth materials used for shadow map rendering\n\n\t\tfor ( const id in _materialCache ) {\n\n\t\t\tconst cache = _materialCache[ id ];\n\n\t\t\tconst uuid = event.target.uuid;\n\n\t\t\tif ( uuid in cache ) {\n\n\t\t\t\tconst shadowMaterial = cache[ uuid ];\n\t\t\t\tshadowMaterial.dispose();\n\t\t\t\tdelete cache[ uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl ) {\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 currentBlendColor = new Color( 0, 0, 0 );\n\tlet currentBlendAlpha = 0;\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 ( 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\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\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\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\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\tconst textures = renderTarget.textures;\n\n\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t}\n\n\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\tneedsUpdate = true;\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\tgl.drawBuffers( drawBuffers );\n\n\t\t}\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\tequationToGL[ MinEquation ] = gl.MIN;\n\tequationToGL[ MaxEquation ] = gl.MAX;\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\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, 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\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\n\t\t\t\tcurrentBlendAlpha = 0;\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\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\n\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\n\n\t\t\tcurrentBlendColor.copy( blendColor );\n\t\t\tcurrentBlendAlpha = blendAlpha;\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.blendColor, material.blendAlpha, 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\t\tgl.blendColor( 0, 0, 0, 0 );\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\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\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\tcurrentBlendColor = new Color( 0, 0, 0 );\n\t\tcurrentBlendAlpha = 0;\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 contain( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t} else {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t}\n\n\treturn texture;\n\n}\n\nfunction cover( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t} else {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t}\n\n\treturn texture;\n\n}\n\nfunction fill( texture ) {\n\n\ttexture.repeat.x = 1;\n\ttexture.repeat.y = 1;\n\n\ttexture.offset.x = 0;\n\ttexture.offset.y = 0;\n\n\treturn texture;\n\n}\n\n\n\n/**\n * Given the width, height, format, and type of a texture. Determines how many\n * bytes must be used to represent the texture.\n */\nfunction getByteLength( width, height, format, type ) {\n\n\tconst typeByteLength = getTextureTypeByteLength( type );\n\n\tswitch ( format ) {\n\n\t\t// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml\n\t\tcase AlphaFormat:\n\t\t\treturn width * height;\n\t\tcase LuminanceFormat:\n\t\t\treturn width * height;\n\t\tcase LuminanceAlphaFormat:\n\t\t\treturn width * height * 2;\n\t\tcase RedFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RedIntegerFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGIntegerFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBFormat:\n\t\t\treturn ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAIntegerFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/\n\t\tcase RGB_S3TC_DXT1_Format:\n\t\tcase RGBA_S3TC_DXT1_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_S3TC_DXT3_Format:\n\t\tcase RGBA_S3TC_DXT5_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/\n\t\tcase RGB_PVRTC_2BPPV1_Format:\n\t\tcase RGBA_PVRTC_2BPPV1_Format:\n\t\t\treturn ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;\n\t\tcase RGB_PVRTC_4BPPV1_Format:\n\t\tcase RGBA_PVRTC_4BPPV1_Format:\n\t\t\treturn ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/\n\t\tcase RGB_ETC1_Format:\n\t\tcase RGB_ETC2_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_ETC2_EAC_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/\n\t\tcase RGBA_ASTC_4x4_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x4_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x5_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x5_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x6_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x5_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_8x6_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x8_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x5_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_10x6_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_10x8_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x10_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x10_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x12_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/\n\t\tcase RGBA_BPTC_Format:\n\t\tcase RGB_BPTC_SIGNED_Format:\n\t\tcase RGB_BPTC_UNSIGNED_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/\n\t\tcase RED_RGTC1_Format:\n\t\tcase SIGNED_RED_RGTC1_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;\n\t\tcase RED_GREEN_RGTC2_Format:\n\t\tcase SIGNED_RED_GREEN_RGTC2_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t}\n\n\tthrow new Error(\n\t\t`Unable to determine texture byte length for ${format} format.`,\n\t);\n\n}\n\nfunction getTextureTypeByteLength( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase UnsignedByteType:\n\t\tcase ByteType:\n\t\t\treturn { byteLength: 1, components: 1 };\n\t\tcase UnsignedShortType:\n\t\tcase ShortType:\n\t\tcase HalfFloatType:\n\t\t\treturn { byteLength: 2, components: 1 };\n\t\tcase UnsignedShort4444Type:\n\t\tcase UnsignedShort5551Type:\n\t\t\treturn { byteLength: 2, components: 4 };\n\t\tcase UnsignedIntType:\n\t\tcase IntType:\n\t\tcase FloatType:\n\t\t\treturn { byteLength: 4, components: 1 };\n\t\tcase UnsignedInt5999Type:\n\t\t\treturn { byteLength: 4, components: 3 };\n\n\t}\n\n\tthrow new Error( `Unknown texture type ${type}.` );\n\n}\n\nconst TextureUtils = {\n\tcontain,\n\tcover,\n\tfill,\n\tgetByteLength\n};\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\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 _imageDimensions = new Vector2();\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, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\tconst dimensions = getDimensions( image );\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( dimensions.width > maxSize || dimensions.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( dimensions.width, dimensions.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 ) {\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\t\t\t\t( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {\n\n\t\t\t\tconst width = Math.floor( scale * dimensions.width );\n\t\t\t\tconst height = Math.floor( scale * dimensions.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 (' + dimensions.width + 'x' + dimensions.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 (' + dimensions.width + 'x' + dimensions.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 textureNeedsGenerateMipmaps( texture ) {\n\n\t\treturn texture.generateMipmaps && texture.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 ( 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.RG_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RG32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGB ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\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 = ( transfer === SRGBTransfer ) ? _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 getInternalDepthFormat( useStencil, depthType ) {\n\n\t\tlet glInternalFormat;\n\t\tif ( useStencil ) {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH32F_STENCIL8;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\t\t\t\tconsole.warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn glInternalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture ) === 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//\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 renderTargetProperties = properties.get( renderTarget );\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\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\tinfo.memory.textures --;\n\n\t\t\t}\n\n\t\t\tproperties.remove( textures[ i ] );\n\n\t\t}\n\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 >= capabilities.maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.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 ) {\n\n\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&\n\t\t\t( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||\n\t\t\ttexture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\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\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\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\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\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\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, unpackConversion );\n\n\t\t\tlet image = resizeImage( texture.image, false, capabilities.maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tconst glType = utils.convert( texture.type );\n\t\t\tlet glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );\n\n\t\t\tsetTextureParameters( textureType, texture );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tconst levels = getMipLevels( texture, image );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\tglInternalFormat = getInternalDepthFormat( texture.format === DepthStencilFormat, texture.type );\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 ) {\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\tif ( dataReady ) {\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}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tconst layerData = mipmap.data.subarray(\n\t\t\t\t\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData, 0, 0 );\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\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\t\t}\n\n\t\t\t\t\t\t\t\t\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\tconst layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\tconst layerData = image.data.subarray(\n\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t} else {\n\n\t\t\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\t\t}\n\n\t\t\t\t\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tconst dimensions = getDimensions( mipmaps[ 0 ] );\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.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\tif ( dataReady ) {\n\n\t\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\t}\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\tconst dimensions = getDimensions( image );\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t\t}\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 ) ) {\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\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\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, unpackConversion );\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 ], true, capabilities.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\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 = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tlet levels = getMipLevels( texture, image );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tconst dimensions = getDimensions( cubeImage[ 0 ] );\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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 ) ) {\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\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 ) {\n\n\t\t\t// retrieve the depth attachment types\n\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\tconst depthType = depthTexture && depthTexture.isDepthTexture ? depthTexture.type : null;\n\t\t\tconst glInternalFormat = getInternalDepthFormat( renderTarget.stencilBuffer, depthType );\n\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t// set up the attachment\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\tconst isUseMultisampledRTT = useMultisampledRTT( renderTarget );\n\t\t\tif ( isUseMultisampledRTT ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( isMultisample ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\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, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.textures;\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\tconst textures = renderTarget.textures;\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\tif ( ! isMultipleRenderTargets ) {\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\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 ( 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 ( 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\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\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 );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( 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 ) ) {\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\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 );\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 ) ) {\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\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture );\n\n\t\t\tif ( 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 ) ) {\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 textures = renderTarget.textures;\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 ) ) {\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\tconst invalidationArrayRead = [];\n\tconst invalidationArrayDraw = [];\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( renderTarget.samples > 0 ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = renderTarget.textures;\n\t\t\t\tconst width = renderTarget.width;\n\t\t\t\tconst height = renderTarget.height;\n\t\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\t\t\t// If MRT we need to remove FBO attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\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\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTarget.resolveDepthBuffer ) {\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\n\t\t\t\t\t\t// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)\n\n\t\t\t\t\t\tif ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\t\tif ( supportsInvalidateFramebuffer === true ) {\n\n\t\t\t\t\t\tinvalidationArrayRead.length = 0;\n\t\t\t\t\t\tinvalidationArrayDraw.length = 0;\n\n\t\t\t\t\t\tinvalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false ) {\n\n\t\t\t\t\t\t\tinvalidationArrayRead.push( depthStyle );\n\t\t\t\t\t\t\tinvalidationArrayDraw.push( depthStyle );\n\n\t\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\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\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t} else {\n\n\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( capabilities.maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn 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.isVideoTexture === true ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\n\n\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\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\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\tfunction getDimensions( image ) {\n\n\t\tif ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {\n\n\t\t\t// if intrinsic data are not available, fallback to width/height\n\n\t\t\t_imageDimensions.width = image.naturalWidth || image.width;\n\t\t\t_imageDimensions.height = image.naturalHeight || image.height;\n\n\t\t} else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {\n\n\t\t\t_imageDimensions.width = image.displayWidth;\n\t\t\t_imageDimensions.height = image.displayHeight;\n\n\t\t} else {\n\n\t\t\t_imageDimensions.width = image.width;\n\t\t\t_imageDimensions.height = image.height;\n\n\t\t}\n\n\t\treturn _imageDimensions;\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 ) {\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\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\t\tif ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;\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\t\tif ( p === HalfFloatType ) return gl.HALF_FLOAT;\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBFormat ) return gl.RGB;\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// 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 ( transfer === SRGBTransfer ) {\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// ETC\n\n\t\tif ( p === RGB_ETC1_Format || 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_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? 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 ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? 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 || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_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 ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_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 ) return gl.UNSIGNED_INT_24_8;\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\nconst _occlusion_vertex = `\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}`;\n\nconst _occlusion_fragment = `\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}`;\n\nclass WebXRDepthSensing {\n\n\tconstructor() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t\tthis.depthNear = 0;\n\t\tthis.depthFar = 0;\n\n\t}\n\n\tinit( renderer, depthData, renderState ) {\n\n\t\tif ( this.texture === null ) {\n\n\t\t\tconst texture = new Texture();\n\n\t\t\tconst texProps = renderer.properties.get( texture );\n\t\t\ttexProps.__webglTexture = depthData.texture;\n\n\t\t\tif ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {\n\n\t\t\t\tthis.depthNear = depthData.depthNear;\n\t\t\t\tthis.depthFar = depthData.depthFar;\n\n\t\t\t}\n\n\t\t\tthis.texture = texture;\n\n\t\t}\n\n\t}\n\n\tgetMesh( cameraXR ) {\n\n\t\tif ( this.texture !== null ) {\n\n\t\t\tif ( this.mesh === null ) {\n\n\t\t\t\tconst viewport = cameraXR.cameras[ 0 ].viewport;\n\t\t\t\tconst material = new ShaderMaterial( {\n\t\t\t\t\tvertexShader: _occlusion_vertex,\n\t\t\t\t\tfragmentShader: _occlusion_fragment,\n\t\t\t\t\tuniforms: {\n\t\t\t\t\t\tdepthColor: { value: this.texture },\n\t\t\t\t\t\tdepthWidth: { value: viewport.z },\n\t\t\t\t\t\tdepthHeight: { value: viewport.w }\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tthis.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this.mesh;\n\n\t}\n\n\treset() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t}\n\n\tgetDepthTexture() {\n\n\t\treturn this.texture;\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\n\t\tconst depthSensing = new WebXRDepthSensing();\n\t\tconst attributes = gl.getContextAttributes();\n\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\tconst currentSize = new Vector2();\n\t\tlet currentPixelRatio = null;\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\tdepthSensing.reset();\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\trenderer.setPixelRatio( currentPixelRatio );\n\t\t\trenderer.setSize( currentSize.width, currentSize.height, 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\tcurrentPixelRatio = renderer.getPixelRatio();\n\t\t\t\trenderer.getSize( currentSize );\n\n\t\t\t\tif ( session.renderState.layers === undefined ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: attributes.antialias,\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\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );\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\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );\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\tresolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )\n\t\t\t\t\t\t} );\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\tthis.getDepthTexture = function () {\n\n\t\t\treturn depthSensing.getDepthTexture();\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\tif ( depthSensing.texture !== null ) {\n\n\t\t\t\tcamera.near = depthSensing.depthNear;\n\t\t\t\tcamera.far = depthSensing.depthFar;\n\n\t\t\t}\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\tcameraL.near = _currentDepthNear;\n\t\t\t\tcameraL.far = _currentDepthFar;\n\t\t\t\tcameraR.near = _currentDepthNear;\n\t\t\t\tcameraR.far = _currentDepthFar;\n\n\t\t\t\tcameraL.updateProjectionMatrix();\n\t\t\t\tcameraR.updateProjectionMatrix();\n\t\t\t\tcamera.updateProjectionMatrix();\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\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\tthis.hasDepthSensing = function () {\n\n\t\t\treturn depthSensing.texture !== null;\n\n\t\t};\n\n\t\tthis.getDepthSensingMesh = function () {\n\n\t\t\treturn depthSensing.getMesh( cameraXR );\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\t//\n\n\t\t\t\tconst enabledFeatures = session.enabledFeatures;\n\n\t\t\t\tif ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {\n\n\t\t\t\t\tconst depthData = glBinding.getDepthInformation( views[ 0 ] );\n\n\t\t\t\t\tif ( depthData && depthData.isValid && depthData.texture ) {\n\n\t\t\t\t\t\tdepthSensing.init( renderer, depthData, session.renderState );\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\nconst _e1 = /*@__PURE__*/ new Euler();\nconst _m1 = /*@__PURE__*/ new Matrix4();\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 materialProperties = properties.get( material );\n\n\t\tconst envMap = materialProperties.envMap;\n\t\tconst envMapRotation = materialProperties.envMapRotation;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\t_e1.copy( envMapRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;\n\n\t\t\tif ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1.y *= - 1;\n\t\t\t\t_e1.z *= - 1;\n\n\t\t\t}\n\n\t\t\tuniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );\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\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\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\tif ( material.envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\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.dispersion > 0 ) {\n\n\t\t\tuniforms.dispersion.value = material.dispersion;\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 = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // 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 uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tif ( hasUniformChanged( uniform, i, j, cache ) === true ) {\n\n\t\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\t\tfor ( let k = 0; k < values.length; k ++ ) {\n\n\t\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t\t// TODO add integer and struct support\n\t\t\t\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\t\tuniform.__data[ 3 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\t\tuniform.__data[ 7 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\t\tuniform.__data[ 11 ] = 0;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t\t}\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, indexArray, cache ) {\n\n\t\tconst value = uniform.value;\n\t\tconst indexString = index + '_' + indexArray;\n\n\t\tif ( cache[ indexString ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tcache[ indexString ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tcache[ indexString ] = value.clone();\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\tconst cachedObject = cache[ indexString ];\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tif ( cachedObject !== value ) {\n\n\t\t\t\t\tcache[ indexString ] = 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\tif ( cachedObject.equals( value ) === false ) {\n\n\t\t\t\t\tcachedObject.copy( value );\n\t\t\t\t\treturn true;\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\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tfor ( let k = 0, kl = values.length; k < kl; k ++ ) {\n\n\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t// Calculate the chunk offset\n\t\t\t\t\tconst chunkOffsetUniform = offset % chunkSize;\n\n\t\t\t\t\t// Check for chunk overflow\n\t\t\t\t\tif ( chunkOffsetUniform !== 0 && ( chunkSize - chunkOffsetUniform ) < info.boundary ) {\n\n\t\t\t\t\t\t// Add padding and adjust offset\n\t\t\t\t\t\toffset += ( chunkSize - chunkOffsetUniform );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following two properties will be used for partial buffer updates\n\n\t\t\t\t\tuniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\t\t\tuniform.__offset = offset;\n\n\n\t\t\t\t\t// Update the global offset\n\t\t\t\t\toffset += info.storage;\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tconst chunkOffset = 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' || typeof value === 'boolean' ) {\n\n\t\t\t// float/int/bool\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\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 = false,\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\tif ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );\n\n\t\t\t}\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// 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// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _vector4 = new Vector4();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tlet _renderBackground = false;\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( contextName, contextAttributes ) {\n\n\t\t\treturn canvas.getContext( contextName, contextAttributes );\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 contextName = 'webgl2';\n\n\t\t\t\t_gl = getContext( contextName, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextName ) ) {\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} 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\t\t\textensions.init();\n\n\t\t\tutils = new WebGLUtils( _gl, extensions );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );\n\n\t\t\tstate = new WebGLState( _gl );\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 );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, attributes );\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 );\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 );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );\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 ).round() );\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 ).round() );\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 ) {\n\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\n\n\t\t\t}\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\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.isBatchedMesh ) {\n\n\t\t\t\tif ( object._multiDrawInstances !== null ) {\n\n\t\t\t\t\trenderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( ! extensions.get( 'WEBGL_multi_draw' ) ) {\n\n\t\t\t\t\t\tconst starts = object._multiDrawStarts;\n\t\t\t\t\t\tconst counts = object._multiDrawCounts;\n\t\t\t\t\t\tconst drawCount = object._multiDrawCount;\n\t\t\t\t\t\tconst bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;\n\t\t\t\t\t\tconst uniforms = properties.get( material ).currentProgram.getUniforms();\n\t\t\t\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\t\t\t\tuniforms.setValue( _gl, '_gl_DrawID', i );\n\t\t\t\t\t\t\trenderer.render( starts[ i ] / bytesPerElement, counts[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\trenderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( 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\tfunction prepareMaterial( material, scene, object ) {\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\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\n\n\t\t\tif ( targetScene === null ) targetScene = scene;\n\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\n\t\t\tcurrentRenderState.init( camera );\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\n\n\t\t\ttargetScene.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\tif ( scene !== targetScene ) {\n\n\t\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\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\tcurrentRenderState.setupLights();\n\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\n\n\t\t\tconst materials = new Set();\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\tprepareMaterial( material2, targetScene, object );\n\t\t\t\t\t\t\tmaterials.add( material2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\n\t\t\t\t\t\tmaterials.add( material );\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\treturn materials;\n\n\t\t};\n\n\t\t// compileAsync\n\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\n\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\n\n\t\t\t// Wait for all the materials in the new object to indicate that they're\n\t\t\t// ready to be used before resolving the promise.\n\n\t\t\treturn new Promise( ( resolve ) => {\n\n\t\t\t\tfunction checkMaterialsReady() {\n\n\t\t\t\t\tmaterials.forEach( function ( material ) {\n\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\n\n\t\t\t\t\t\tif ( program.isReady() ) {\n\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\n\t\t\t\t\t\t\tmaterials.delete( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\n\n\t\t\t\t\tif ( materials.size === 0 ) {\n\n\t\t\t\t\t\tresolve( scene );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\n\n\t\t\t\t\t// If we can check the compilation status of the materials without\n\t\t\t\t\t// blocking then do so right away.\n\n\t\t\t\t\tcheckMaterialsReady();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\n\t\t\t\t\t// initialized a chance to finish.\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\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 ) {\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( camera );\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\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tconst depthSensingMesh = _this.xr.getDepthSensingMesh();\n\n\t\t\t\tif ( depthSensingMesh !== null ) {\n\n\t\t\t\t\tprojectObject( depthSensingMesh, camera, - Infinity, _this.sortObjects );\n\n\t\t\t\t}\n\n\t\t\t}\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_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;\n\t\t\tif ( _renderBackground ) {\n\n\t\t\t\tbackground.addToRenderList( currentRenderList, scene );\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\t\t\t// render scene\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\n\t\t\tcurrentRenderState.setupLights();\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tif ( transmissiveObjects.length > 0 ) {\n\n\t\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\t\trenderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( _renderBackground ) background.render( scene );\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\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\t\tif ( _renderBackground ) background.render( scene );\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\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );\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_vector4.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, _vector4.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_vector4.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_vector4.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector4\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, _vector4.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, _vector4.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 ( 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 overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tif ( overrideMaterial !== null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {\n\n\t\t\t\tcurrentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: 4,\n\t\t\t\t\tstencilBuffer: stencil,\n\t\t\t\t\tresolveDepthBuffer: false,\n\t\t\t\t\tresolveStencilBuffer: false,\n\t\t\t\t\tcolorSpace: ColorManagement.workingColorSpace,\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\tconst transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];\n\n\t\t\tconst activeViewport = camera.viewport || _currentViewport;\n\t\t\ttransmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );\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\tif ( _renderBackground ) {\n\n\t\t\t\tbackground.render( scene );\n\n\t\t\t} else {\n\n\t\t\t\t_this.clear();\n\n\t\t\t}\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\t// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).\n\t\t\t// Transmission render pass requires viewport to match the transmissionRenderTarget.\n\t\t\tconst currentCameraViewport = camera.viewport;\n\t\t\tif ( camera.viewport !== undefined ) camera.viewport = undefined;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\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\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === false ) { // see #28131\n\n\t\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\t\tconst object = renderItem.object;\n\t\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\t\tconst material = renderItem.material;\n\t\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\t\t}\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\tif ( currentCameraViewport !== undefined ) camera.viewport = currentCameraViewport;\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\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\t\t\tmaterialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;\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.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\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = null;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction getUniformList( materialProperties ) {\n\n\t\t\tif ( materialProperties.uniformsList === null ) {\n\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\n\n\t\t\t}\n\n\t\t\treturn materialProperties.uniformsList;\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.batching = parameters.batching;\n\t\t\tmaterialProperties.batchingColor = parameters.batchingColor;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.instancingMorph = parameters.instancingMorph;\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.isBatchedMesh && materialProperties.batching === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null ) {\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 ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== 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 ( 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\t// common camera uniforms\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\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\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\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 ( _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}\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 ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingIdTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingColorTexture' );\n\t\t\t\tif ( object._colorsTexture !== null ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'batchingColorTexture', object._colorsTexture, textures );\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 ) ) {\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 ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {\n\n\t\t\t\tm_uniforms.envMapIntensity.value = scene.environmentIntensity;\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, currentRenderState.state.transmissionRenderTarget[ camera.id ] );\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), 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, getUniformList( materialProperties ), 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\tconst group = groups[ i ];\n\n\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\tuniformsGroups.bind( group, program );\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\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\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\trenderTargetProperties.__useRenderToTexture = false;\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 ( ( 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 && 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 ( ! capabilities.textureFormatReadable( textureFormat ) ) {\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\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\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.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\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 ( ! capabilities.textureFormatReadable( textureFormat ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );\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\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\tconst glBuffer = _gl.createBuffer();\n\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t\t_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );\n\t\t\t\t\t\t_gl.flush();\n\n\t\t\t\t\t\t// check if the commands have finished every 8 ms\n\t\t\t\t\t\tconst sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );\n\t\t\t\t\t\tawait probeAsync( _gl, sync, 4 );\n\n\t\t\t\t\t\ttry {\n\n\t\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t\t\t_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );\n\n\t\t\t\t\t\t} finally {\n\n\t\t\t\t\t\t\t_gl.deleteBuffer( glBuffer );\n\t\t\t\t\t\t\t_gl.deleteSync( sync );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn 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 ( texture, position = null, level = 0 ) {\n\n\t\t\t// support previous signature with position first\n\t\t\tif ( texture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\tconsole.warn( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );\n\n\t\t\t\tposition = arguments[ 0 ] || null;\n\t\t\t\ttexture = arguments[ 1 ];\n\n\t\t\t}\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\tconst x = position !== null ? position.x : 0;\n\t\t\tconst y = position !== null ? position.y : 0;\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, x, y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\n\n\t\t\t// support previous signature with dstPosition first\n\t\t\tif ( srcTexture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\tconsole.warn( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );\n\n\t\t\t\tdstPosition = arguments[ 0 ] || null;\n\t\t\t\tsrcTexture = arguments[ 1 ];\n\t\t\t\tdstTexture = arguments[ 2 ];\n\t\t\t\tlevel = arguments[ 3 ] || 0;\n\t\t\t\tsrcRegion = null;\n\n\t\t\t}\n\n\t\t\tlet width, height, minX, minY;\n\t\t\tlet dstX, dstY;\n\t\t\tif ( srcRegion !== null ) {\n\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\n\t\t\t\tminX = srcRegion.min.x;\n\t\t\t\tminY = srcRegion.min.y;\n\n\t\t\t} else {\n\n\t\t\t\twidth = srcTexture.image.width;\n\t\t\t\theight = srcTexture.image.height;\n\t\t\t\tminX = 0;\n\t\t\t\tminY = 0;\n\n\t\t\t}\n\n\t\t\tif ( dstPosition !== null ) {\n\n\t\t\t\tdstX = dstPosition.x;\n\t\t\t\tdstY = dstPosition.y;\n\n\t\t\t} else {\n\n\t\t\t\tdstX = 0;\n\t\t\t\tdstY = 0;\n\n\t\t\t}\n\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\tconst currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : 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, minX );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, 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, dstX, dstY, image.width, image.height, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, 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, currentUnpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\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 ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\n\n\t\t\t// support previous signature with source box first\n\t\t\tif ( srcTexture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\tconsole.warn( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );\n\n\t\t\t\tsrcRegion = arguments[ 0 ] || null;\n\t\t\t\tdstPosition = arguments[ 1 ] || null;\n\t\t\t\tsrcTexture = arguments[ 2 ];\n\t\t\t\tdstTexture = arguments[ 3 ];\n\t\t\t\tlevel = arguments[ 4 ] || 0;\n\n\t\t\t}\n\n\t\t\tlet width, height, depth, minX, minY, minZ;\n\t\t\tlet dstX, dstY, dstZ;\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\n\t\t\tif ( srcRegion !== null ) {\n\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\n\t\t\t\tdepth = srcRegion.max.z - srcRegion.min.z;\n\t\t\t\tminX = srcRegion.min.x;\n\t\t\t\tminY = srcRegion.min.y;\n\t\t\t\tminZ = srcRegion.min.z;\n\n\t\t\t} else {\n\n\t\t\t\twidth = image.width;\n\t\t\t\theight = image.height;\n\t\t\t\tdepth = image.depth;\n\t\t\t\tminX = 0;\n\t\t\t\tminY = 0;\n\t\t\t\tminZ = 0;\n\n\t\t\t}\n\n\t\t\tif ( dstPosition !== null ) {\n\n\t\t\t\tdstX = dstPosition.x;\n\t\t\t\tdstY = dstPosition.y;\n\t\t\t\tdstZ = dstPosition.z;\n\n\t\t\t} else {\n\n\t\t\t\tdstX = 0;\n\t\t\t\tdstY = 0;\n\t\t\t\tdstZ = 0;\n\n\t\t\t}\n\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 || dstTexture.isCompressedArrayTexture ) {\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 currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\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, minX );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, 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, currentUnpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\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.initRenderTarget = function ( target ) {\n\n\t\t\tif ( properties.get( target ).__webglFramebuffer === undefined ) {\n\n\t\t\t\ttextures.setupRenderTarget( target );\n\n\t\t\t}\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 outputColorSpace() {\n\n\t\treturn this._outputColorSpace;\n\n\t}\n\n\tset outputColorSpace( colorSpace ) {\n\n\t\tthis._outputColorSpace = colorSpace;\n\n\t\tconst gl = this.getContext();\n\t\tgl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\t\tgl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\n\t}\n\n}\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\tname: this.name,\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\tname: this.name,\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\t\tthis.backgroundRotation = new Euler();\n\n\t\tthis.environmentIntensity = 1;\n\t\tthis.environmentRotation = new Euler();\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\t\tthis.backgroundRotation.copy( source.backgroundRotation );\n\n\t\tthis.environmentIntensity = source.environmentIntensity;\n\t\tthis.environmentRotation.copy( source.environmentRotation );\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\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\t\tdata.object.backgroundRotation = this.backgroundRotation.toArray();\n\n\t\tif ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;\n\t\tdata.object.environmentRotation = this.environmentRotation.toArray();\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\t\tthis.updateRanges = [];\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\tget updateRange() {\n\n\t\twarnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\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$6 = /*@__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$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.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$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.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$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.data.stride + this.offset + 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.data.array[ index * this.data.stride + this.offset + component ] = value;\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 = new SpriteMaterial() ) {\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;\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$4 = /*@__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 = AttachedBindMode;\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\tthis.getVertexPosition( 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\tthis.getVertexPosition( 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$4.copy( this.boundingSphere );\n\t\t_sphere$4.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$4 ) === 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 === AttachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\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}\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$1 = /*@__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\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$1;\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 = Math.ceil( size / 4 ) * 4;\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\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$1 = /*@__PURE__*/ new Mesh();\nconst _sphere$3 = /*@__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\t\tthis.morphTexture = 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$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$3 );\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.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();\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\tgetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tconst len = objectInfluences.length + 1; // All influences + the baseInfluenceSum\n\n\t\tconst dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tobjectInfluences[ i ] = array[ dataIndex + i ];\n\n\t\t}\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$1.geometry = this.geometry;\n\t\t_mesh$1.material = this.material;\n\n\t\tif ( _mesh$1.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$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// 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$1.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh$1.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\tsetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst len = objectInfluences.length + 1; // morphBaseInfluence + all influences\n\n\t\tif ( this.morphTexture === null ) {\n\n\t\t\tthis.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );\n\n\t\t}\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tlet morphInfluencesSum = 0;\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t}\n\n\t\tconst morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\tconst dataIndex = len * index;\n\n\t\tarray[ dataIndex ] = morphBaseInfluence;\n\n\t\tarray.set( objectInfluences, dataIndex + 1 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\tif ( this.morphTexture !== null ) {\n\n\t\t\tthis.morphTexture.dispose();\n\t\t\tthis.morphTexture = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction sortOpaque( a, b ) {\n\n\treturn a.z - b.z;\n\n}\n\nfunction sortTransparent( a, b ) {\n\n\treturn b.z - a.z;\n\n}\n\nclass MultiDrawRenderList {\n\n\tconstructor() {\n\n\t\tthis.index = 0;\n\t\tthis.pool = [];\n\t\tthis.list = [];\n\n\t}\n\n\tpush( drawRange, z, index ) {\n\n\t\tconst pool = this.pool;\n\t\tconst list = this.list;\n\t\tif ( this.index >= pool.length ) {\n\n\t\t\tpool.push( {\n\n\t\t\t\tstart: - 1,\n\t\t\t\tcount: - 1,\n\t\t\t\tz: - 1,\n\t\t\t\tindex: - 1,\n\n\t\t\t} );\n\n\t\t}\n\n\t\tconst item = pool[ this.index ];\n\t\tlist.push( item );\n\t\tthis.index ++;\n\n\t\titem.start = drawRange.start;\n\t\titem.count = drawRange.count;\n\t\titem.z = z;\n\t\titem.index = index;\n\n\t}\n\n\treset() {\n\n\t\tthis.list.length = 0;\n\t\tthis.index = 0;\n\n\t}\n\n}\n\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\nconst _invMatrixWorld = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\nconst _whiteColor = /*@__PURE__*/ new Color( 1, 1, 1 );\nconst _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _frustum = /*@__PURE__*/ new Frustum();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\nconst _vector$5 = /*@__PURE__*/ new Vector3();\nconst _forward = /*@__PURE__*/ new Vector3();\nconst _temp = /*@__PURE__*/ new Vector3();\nconst _renderList = /*@__PURE__*/ new MultiDrawRenderList();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _batchIntersects = [];\n\n// @TODO: SkinnedMesh support?\n// @TODO: geometry.groups support?\n// @TODO: geometry.drawRange support?\n// @TODO: geometry.morphAttributes support?\n// @TODO: Support uniform parameter per geometry\n// @TODO: Add an \"optimize\" function to pack geometry and remove data gaps\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData( src, target, targetOffset = 0 ) {\n\n\tconst itemSize = target.itemSize;\n\tif ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {\n\n\t\t// use the component getters and setters if the array data cannot\n\t\t// be copied directly\n\t\tconst vertexCount = src.count;\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\ttarget.setComponent( i + targetOffset, c, src.getComponent( i, c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// faster copy approach using typed array set function\n\t\ttarget.array.set( src.array, targetOffset * itemSize );\n\n\t}\n\n\ttarget.needsUpdate = true;\n\n}\n\nclass BatchedMesh extends Mesh {\n\n\tget maxInstanceCount() {\n\n\t\treturn this._maxInstanceCount;\n\n\t}\n\n\tconstructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {\n\n\t\tsuper( new BufferGeometry(), material );\n\n\t\tthis.isBatchedMesh = true;\n\t\tthis.perObjectFrustumCulled = true;\n\t\tthis.sortObjects = true;\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\t\tthis.customSort = null;\n\n\t\t// stores visible, active, and geometry id per object\n\t\tthis._drawInfo = [];\n\n\t\t// geometry information\n\t\tthis._drawRanges = [];\n\t\tthis._reservedRanges = [];\n\t\tthis._bounds = [];\n\n\t\tthis._maxInstanceCount = maxInstanceCount;\n\t\tthis._maxVertexCount = maxVertexCount;\n\t\tthis._maxIndexCount = maxIndexCount;\n\n\t\tthis._geometryInitialized = false;\n\t\tthis._geometryCount = 0;\n\t\tthis._multiDrawCounts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawStarts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawCount = 0;\n\t\tthis._multiDrawInstances = null;\n\t\tthis._visibilityChanged = true;\n\n\t\t// Local matrix per geometry by using data texture\n\t\tthis._matricesTexture = null;\n\t\tthis._indirectTexture = null;\n\t\tthis._colorsTexture = null;\n\n\t\tthis._initMatricesTexture();\n\t\tthis._initIndirectTexture();\n\n\t}\n\n\t_initMatricesTexture() {\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 matrices * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tconst matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );\n\n\t\tthis._matricesTexture = matricesTexture;\n\n\t}\n\n\t_initIndirectTexture() {\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\n\t\tsize = Math.ceil( size );\n\n\t\tconst indirectArray = new Uint32Array( size * size );\n\t\tconst indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );\n\n\t\tthis._indirectTexture = indirectTexture;\n\n\t}\n\n\t_initColorsTexture() {\n\n\t\tlet size = Math.sqrt( this._maxIndexCount );\n\t\tsize = Math.ceil( size );\n\n\t\t// 4 floats per RGBA pixel initialized to white\n\t\tconst colorsArray = new Float32Array( size * size * 4 ).fill( 1 );\n\t\tconst colorsTexture = new DataTexture( colorsArray, size, size, RGBAFormat, FloatType );\n\t\tcolorsTexture.colorSpace = ColorManagement.workingColorSpace;\n\n\t\tthis._colorsTexture = colorsTexture;\n\n\t}\n\n\t_initializeGeometry( reference ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst maxVertexCount = this._maxVertexCount;\n\t\tconst maxIndexCount = this._maxIndexCount;\n\t\tif ( this._geometryInitialized === false ) {\n\n\t\t\tfor ( const attributeName in reference.attributes ) {\n\n\t\t\t\tconst srcAttribute = reference.getAttribute( attributeName );\n\t\t\t\tconst { array, itemSize, normalized } = srcAttribute;\n\n\t\t\t\tconst dstArray = new array.constructor( maxVertexCount * itemSize );\n\t\t\t\tconst dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );\n\n\t\t\t\tgeometry.setAttribute( attributeName, dstAttribute );\n\n\t\t\t}\n\n\t\t\tif ( reference.getIndex() !== null ) {\n\n\t\t\t\t// Reserve last u16 index for primitive restart.\n\t\t\t\tconst indexArray = maxVertexCount > 65535\n\t\t\t\t\t? new Uint32Array( maxIndexCount )\n\t\t\t\t\t: new Uint16Array( maxIndexCount );\n\n\t\t\t\tgeometry.setIndex( new BufferAttribute( indexArray, 1 ) );\n\n\t\t\t}\n\n\t\t\tthis._geometryInitialized = true;\n\n\t\t}\n\n\t}\n\n\t// Make sure the geometry is compatible with the existing combined geometry attributes\n\t_validateGeometry( geometry ) {\n\n\t\t// check to ensure the geometries are using consistent attributes and indices\n\t\tconst batchGeometry = this.geometry;\n\t\tif ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: All geometries must consistently have \"index\".' );\n\n\t\t}\n\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( ! geometry.hasAttribute( attributeName ) ) {\n\n\t\t\t\tthrow new Error( `BatchedMesh: Added geometry missing \"${ attributeName }\". All geometries must have consistent attributes.` );\n\n\t\t\t}\n\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tif ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {\n\n\t\t\t\tthrow new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tsetCustomSort( func ) {\n\n\t\tthis.customSort = func;\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 geometryCount = this._geometryCount;\n\t\tconst boundingBox = this.boundingBox;\n\t\tconst drawInfo = this._drawInfo;\n\n\t\tboundingBox.makeEmpty();\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingBox.union( _box$1 );\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 boundingSphere = this.boundingSphere;\n\t\tconst drawInfo = this._drawInfo;\n\n\t\tboundingSphere.makeEmpty();\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\taddInstance( geometryId ) {\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\n\n\t\t}\n\n\t\tthis._drawInfo.push( {\n\n\t\t\tvisible: true,\n\t\t\tactive: true,\n\t\t\tgeometryIndex: geometryId,\n\n\t\t} );\n\n\t\t// initialize the matrix\n\t\tconst drawId = this._drawInfo.length - 1;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = matricesTexture.image.data;\n\t\t_identityMatrix.toArray( matricesArray, drawId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\tconst colorsTexture = this._colorsTexture;\n\t\tif ( colorsTexture ) {\n\n\t\t\t_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );\n\t\t\tcolorsTexture.needsUpdate = true;\n\n\t\t}\n\n\t\treturn drawId;\n\n\t}\n\n\taddGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {\n\n\t\tthis._initializeGeometry( geometry );\n\n\t\tthis._validateGeometry( geometry );\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\n\n\t\t}\n\n\t\t// get the necessary range fo the geometry\n\t\tconst reservedRange = {\n\t\t\tvertexStart: - 1,\n\t\t\tvertexCount: - 1,\n\t\t\tindexStart: - 1,\n\t\t\tindexCount: - 1,\n\t\t};\n\n\t\tlet lastRange = null;\n\t\tconst reservedRanges = this._reservedRanges;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst bounds = this._bounds;\n\t\tif ( this._geometryCount !== 0 ) {\n\n\t\t\tlastRange = reservedRanges[ reservedRanges.length - 1 ];\n\n\t\t}\n\n\t\tif ( vertexCount === - 1 ) {\n\n\t\t\treservedRange.vertexCount = geometry.getAttribute( 'position' ).count;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexCount = vertexCount;\n\n\t\t}\n\n\t\tif ( lastRange === null ) {\n\n\t\t\treservedRange.vertexStart = 0;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;\n\n\t\t}\n\n\t\tconst index = geometry.getIndex();\n\t\tconst hasIndex = index !== null;\n\t\tif ( hasIndex ) {\n\n\t\t\tif ( indexCount\t=== - 1 ) {\n\n\t\t\t\treservedRange.indexCount = index.count;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexCount = indexCount;\n\n\t\t\t}\n\n\t\t\tif ( lastRange === null ) {\n\n\t\t\t\treservedRange.indexStart = 0;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif (\n\t\t\treservedRange.indexStart !== - 1 &&\n\t\t\treservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||\n\t\t\treservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );\n\n\t\t}\n\n\t\t// update id\n\t\tconst geometryId = this._geometryCount;\n\t\tthis._geometryCount ++;\n\n\t\t// add the reserved range and draw range objects\n\t\treservedRanges.push( reservedRange );\n\t\tdrawRanges.push( {\n\t\t\tstart: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,\n\t\t\tcount: - 1\n\t\t} );\n\t\tbounds.push( {\n\t\t\tboxInitialized: false,\n\t\t\tbox: new Box3(),\n\n\t\t\tsphereInitialized: false,\n\t\t\tsphere: new Sphere()\n\t\t} );\n\n\t\t// update the geometry\n\t\tthis.setGeometryAt( geometryId, geometry );\n\n\t\treturn geometryId;\n\n\t}\n\n\tsetGeometryAt( geometryId, geometry ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\tthis._validateGeometry( geometry );\n\n\t\tconst batchGeometry = this.geometry;\n\t\tconst hasIndex = batchGeometry.getIndex() !== null;\n\t\tconst dstIndex = batchGeometry.getIndex();\n\t\tconst srcIndex = geometry.getIndex();\n\t\tconst reservedRange = this._reservedRanges[ geometryId ];\n\t\tif (\n\t\t\thasIndex &&\n\t\t\tsrcIndex.count > reservedRange.indexCount ||\n\t\t\tgeometry.attributes.position.count > reservedRange.vertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );\n\n\t\t}\n\n\t\t// copy geometry over\n\t\tconst vertexStart = reservedRange.vertexStart;\n\t\tconst vertexCount = reservedRange.vertexCount;\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\t// copy attribute data\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tcopyAttributeData( srcAttribute, dstAttribute, vertexStart );\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tconst itemSize = srcAttribute.itemSize;\n\t\t\tfor ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {\n\n\t\t\t\tconst index = vertexStart + i;\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\t\tdstAttribute.setComponent( index, c, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdstAttribute.needsUpdate = true;\n\t\t\tdstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );\n\n\t\t}\n\n\t\t// copy index\n\t\tif ( hasIndex ) {\n\n\t\t\tconst indexStart = reservedRange.indexStart;\n\n\t\t\t// copy index data over\n\t\t\tfor ( let i = 0; i < srcIndex.count; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );\n\n\t\t\t}\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tfor ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart );\n\n\t\t\t}\n\n\t\t\tdstIndex.needsUpdate = true;\n\t\t\tdstIndex.addUpdateRange( indexStart, reservedRange.indexCount );\n\n\t\t}\n\n\t\t// store the bounding boxes\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tbound.box.copy( geometry.boundingBox );\n\t\t\tbound.boxInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.boxInitialized = false;\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tbound.sphere.copy( geometry.boundingSphere );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.sphereInitialized = false;\n\n\t\t}\n\n\t\t// set drawRange count\n\t\tconst drawRange = this._drawRanges[ geometryId ];\n\t\tconst posAttr = geometry.getAttribute( 'position' );\n\t\tdrawRange.count = hasIndex ? srcIndex.count : posAttr.count;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn geometryId;\n\n\t}\n\n\t/*\n\tdeleteGeometry( geometryId ) {\n\n\t\t// TODO: delete geometry and associated instances\n\n\t}\n\t*/\n\n\t/*\n\tdeleteInstance( instanceId ) {\n\n\t\t// Note: User needs to call optimize() afterward to pack the data.\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tdrawInfo[ instanceId ].active = false;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\t*/\n\n\t// get bounding box and compute it if it doesn't exist\n\tgetBoundingBoxAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding box\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tconst box = bound.box;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.boxInitialized === false ) {\n\n\t\t\tbox.makeEmpty();\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\tbox.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );\n\n\t\t\t}\n\n\t\t\tbound.boxInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( box );\n\t\treturn target;\n\n\t}\n\n\t// get bounding sphere and compute it if it doesn't exist\n\tgetBoundingSphereAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding sphere\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tconst sphere = bound.sphere;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.sphereInitialized === false ) {\n\n\t\t\tsphere.makeEmpty();\n\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 );\n\t\t\t_box$1.getCenter( sphere.center );\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\n\n\t\t\tlet maxRadiusSq = 0;\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\t_vector$5.fromBufferAttribute( position, iv );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );\n\n\t\t\t}\n\n\t\t\tsphere.radius = Math.sqrt( maxRadiusSq );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( sphere );\n\t\treturn target;\n\n\t}\n\n\tsetMatrixAt( instanceId, matrix ) {\n\n\t\t// @TODO: Map geometryId to index of the arrays because\n\t\t// optimize() can make geometryId mismatch the index\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tmatrix.toArray( matricesArray, instanceId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetMatrixAt( instanceId, matrix ) {\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn matrix.fromArray( matricesArray, instanceId * 16 );\n\n\t}\n\n\tsetColorAt( instanceId, color ) {\n\n\t\tif ( this._colorsTexture === null ) {\n\n\t\t\tthis._initColorsTexture();\n\n\t\t}\n\n\t\t// @TODO: Map id to index of the arrays because\n\t\t// optimize() can make id mismatch the index\n\n\t\tconst colorsTexture = this._colorsTexture;\n\t\tconst colorsArray = this._colorsTexture.image.data;\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tcolor.toArray( colorsArray, instanceId * 4 );\n\t\tcolorsTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( instanceId, color ) {\n\n\t\tconst colorsArray = this._colorsTexture.image.data;\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn color.fromArray( colorsArray, instanceId * 4 );\n\n\t}\n\n\tsetVisibleAt( instanceId, value ) {\n\n\t\t// if the geometry is out of range, not active, or visibility state\n\t\t// does not change then return early\n\t\tconst drawInfo = this._drawInfo;\n\t\tif (\n\t\t\tinstanceId >= drawInfo.length ||\n\t\t\tdrawInfo[ instanceId ].active === false ||\n\t\t\tdrawInfo[ instanceId ].visible === value\n\t\t) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tdrawInfo[ instanceId ].visible = value;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetVisibleAt( instanceId ) {\n\n\t\t// return early if the geometry is out of range or not active\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn drawInfo[ instanceId ].visible;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst batchGeometry = this.geometry;\n\n\t\t// iterate over each geometry\n\t\t_mesh.material = this.material;\n\t\t_mesh.geometry.index = batchGeometry.index;\n\t\t_mesh.geometry.attributes = batchGeometry.attributes;\n\t\tif ( _mesh.geometry.boundingBox === null ) {\n\n\t\t\t_mesh.geometry.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( _mesh.geometry.boundingSphere === null ) {\n\n\t\t\t_mesh.geometry.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( ! drawInfo[ i ].visible || ! drawInfo[ i ].active ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tconst drawRange = drawRanges[ geometryId ];\n\t\t\t_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );\n\n\t\t\t// ge the intersects\n\t\t\tthis.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );\n\t\t\tthis.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );\n\t\t\tthis.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );\n\t\t\t_mesh.raycast( raycaster, _batchIntersects );\n\n\t\t\t// add batch id to the intersects\n\t\t\tfor ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {\n\n\t\t\t\tconst intersect = _batchIntersects[ j ];\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersect.batchId = i;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_batchIntersects.length = 0;\n\n\t\t}\n\n\t\t_mesh.material = null;\n\t\t_mesh.geometry.index = null;\n\t\t_mesh.geometry.attributes = {};\n\t\t_mesh.geometry.setDrawRange( 0, Infinity );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.geometry = source.geometry.clone();\n\t\tthis.perObjectFrustumCulled = source.perObjectFrustumCulled;\n\t\tthis.sortObjects = source.sortObjects;\n\t\tthis.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;\n\t\tthis.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;\n\n\t\tthis._drawRanges = source._drawRanges.map( range => ( { ...range } ) );\n\t\tthis._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );\n\n\t\tthis._drawInfo = source._drawInfo.map( inf => ( { ...inf } ) );\n\t\tthis._bounds = source._bounds.map( bound => ( {\n\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\tbox: bound.box.clone(),\n\n\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\tsphere: bound.sphere.clone()\n\t\t} ) );\n\n\t\tthis._maxInstanceCount = source._maxInstanceCount;\n\t\tthis._maxVertexCount = source._maxVertexCount;\n\t\tthis._maxIndexCount = source._maxIndexCount;\n\n\t\tthis._geometryInitialized = source._geometryInitialized;\n\t\tthis._geometryCount = source._geometryCount;\n\t\tthis._multiDrawCounts = source._multiDrawCounts.slice();\n\t\tthis._multiDrawStarts = source._multiDrawStarts.slice();\n\n\t\tthis._matricesTexture = source._matricesTexture.clone();\n\t\tthis._matricesTexture.image.data = this._matricesTexture.image.slice();\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture = source._colorsTexture.clone();\n\t\t\tthis._colorsTexture.image.data = this._colorsTexture.image.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\t// Assuming the geometry is not shared with other meshes\n\t\tthis.geometry.dispose();\n\n\t\tthis._matricesTexture.dispose();\n\t\tthis._matricesTexture = null;\n\n\t\tthis._indirectTexture.dispose();\n\t\tthis._indirectTexture = null;\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture.dispose();\n\t\t\tthis._colorsTexture = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tonBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {\n\n\t\t// if visibility has not changed and frustum culling and object sorting is not required\n\t\t// then skip iterating over all items\n\t\tif ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// the indexed version of the multi draw function requires specifying the start\n\t\t// offset in bytes.\n\t\tconst index = geometry.getIndex();\n\t\tconst bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst multiDrawStarts = this._multiDrawStarts;\n\t\tconst multiDrawCounts = this._multiDrawCounts;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\tconst indirectTexture = this._indirectTexture;\n\t\tconst indirectArray = indirectTexture.image.data;\n\n\t\t// prepare the frustum in the local frame\n\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t_projScreenMatrix$2\n\t\t\t\t.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )\n\t\t\t\t.multiply( this.matrixWorld );\n\t\t\t_frustum.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$2,\n\t\t\t\trenderer.coordinateSystem\n\t\t\t);\n\n\t\t}\n\n\t\tlet count = 0;\n\t\tif ( this.sortObjects ) {\n\n\t\t\t// get the camera position in the local frame\n\t\t\t_invMatrixWorld.copy( this.matrixWorld ).invert();\n\t\t\t_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );\n\t\t\t_forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );\n\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\t// get the distance from camera used for sorting\n\t\t\t\t\t\tconst z = _temp.subVectors( _sphere$2.center, _vector$5 ).dot( _forward );\n\t\t\t\t\t\t_renderList.push( drawRanges[ geometryId ], z, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Sort the draw ranges and prep for rendering\n\t\t\tconst list = _renderList.list;\n\t\t\tconst customSort = this.customSort;\n\t\t\tif ( customSort === null ) {\n\n\t\t\t\tlist.sort( material.transparent ? sortTransparent : sortOpaque );\n\n\t\t\t} else {\n\n\t\t\t\tcustomSort.call( this, list, camera );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = list.length; i < l; i ++ ) {\n\n\t\t\t\tconst item = list[ i ];\n\t\t\t\tmultiDrawStarts[ count ] = item.start * bytesPerElement;\n\t\t\t\tmultiDrawCounts[ count ] = item.count;\n\t\t\t\tindirectArray[ count ] = item.index;\n\t\t\t\tcount ++;\n\n\t\t\t}\n\n\t\t\t_renderList.reset();\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\tconst range = drawRanges[ geometryId ];\n\t\t\t\t\t\tmultiDrawStarts[ count ] = range.start * bytesPerElement;\n\t\t\t\t\t\tmultiDrawCounts[ count ] = range.count;\n\t\t\t\t\t\tindirectArray[ count ] = i;\n\t\t\t\t\t\tcount ++;\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\tindirectTexture.needsUpdate = true;\n\t\tthis._multiDrawCount = count;\n\t\tthis._visibilityChanged = false;\n\n\t}\n\n\tonBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {\n\n\t\tthis.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );\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 _vStart = /*@__PURE__*/ new Vector3();\nconst _vEnd = /*@__PURE__*/ new Vector3();\n\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nconst _intersectPointOnRay = /*@__PURE__*/ new Vector3();\nconst _intersectPointOnSegment = /*@__PURE__*/ new Vector3();\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 = Array.isArray( source.material ) ? source.material.slice() : 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_vStart.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_vEnd.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _vStart.distanceTo( _vEnd );\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 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\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst a = index.getX( end - 1 );\n\t\t\t\tconst b = index.getX( start );\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\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\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\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\nfunction checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {\n\n\tconst positionAttribute = object.geometry.attributes.position;\n\n\t_vStart.fromBufferAttribute( positionAttribute, a );\n\t_vEnd.fromBufferAttribute( positionAttribute, b );\n\n\tconst distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );\n\n\tif ( distSq > thresholdSq ) return;\n\n\t_intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\treturn {\n\n\t\tdistance: distance,\n\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t// point: raycaster.ray.at( distance ),\n\t\tpoint: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),\n\t\tindex: a,\n\t\tface: null,\n\t\tfaceIndex: null,\n\t\tobject: object\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 = Array.isArray( source.material ) ? source.material.slice() : 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\tthis.layerUpdates = new Set();\n\n\t}\n\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\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 = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\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\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\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\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 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\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\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// (\u00B11, \u00B11, \u00B11)\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, \u00B11/\u03C6, \u00B1\u03C6)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (\u00B11/\u03C6, \u00B1\u03C6, 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// (\u00B1\u03C6, 0, \u00B11/\u03C6)\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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._dispersion = 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 dispersion() {\n\n\t\treturn this._dispersion;\n\n\t}\n\n\tset dispersion( value ) {\n\n\t\tif ( this._dispersion > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._dispersion = 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.dispersion = source.dispersion;\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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// 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 = referenceTrack.values.slice( 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 = referenceTrack.values.slice( 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 = interpolant.resultBuffer.slice( 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\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 = times.slice( from, to );\n\t\t\tthis.values = this.values.slice( 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 = this.times.slice(),\n\t\t\tvalues = this.values.slice(),\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 = times.slice( 0, writeIndex );\n\t\t\tthis.values = values.slice( 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 = this.times.slice();\n\t\tconst values = this.values.slice();\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\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\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\n// DefaultInterpolation is inherited;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {\n\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\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( 'X-File-Size' ) || response.headers.get( 'Content-Length' );\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}, ( e ) => {\n\n\t\t\t\t\t\t\t\t\tcontroller.error( e );\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.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}\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\t\tif ( this.target !== undefined ) data.object.target = this.target.uuid;\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.intensity = 1;\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.intensity = source.intensity;\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.intensity !== 1 ) object.intensity = this.intensity;\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) = \u03C0 * 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 \u03C0 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 ); // \u03C0 * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * \u03C0 / 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 ); // ( \u03C0 / 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 ); // ( \u03C0 / 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 ) ); // ( \u03C0 / 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.dispersion !== undefined ) material.dispersion = json.dispersion;\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.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\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\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\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\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\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 !== undefined ) 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.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );\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 ) { // @deprecated, r165\n\n\t\tconsole.warn( 'THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.' );\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\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\t\tthis.bindLightTargets( object );\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\t\tthis.bindLightTargets( object );\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\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\tif ( data.fog.name !== '' ) {\n\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\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\t\t\t\tif ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );\n\n\t\t\t\tif ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;\n\t\t\t\tif ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );\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\t\t\t\tobject.target = data.target ||\u00A0'';\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\t\t\t\tobject.target = data.target ||\u00A0'';\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 'BatchedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );\n\t\t\t\tobject.geometry = geometry;\n\t\t\t\tobject.perObjectFrustumCulled = data.perObjectFrustumCulled;\n\t\t\t\tobject.sortObjects = data.sortObjects;\n\n\t\t\t\tobject._drawRanges = data.drawRanges;\n\t\t\t\tobject._reservedRanges = data.reservedRanges;\n\n\t\t\t\tobject._visibility = data.visibility;\n\t\t\t\tobject._active = data.active;\n\t\t\t\tobject._bounds = data.bounds.map( bound => {\n\n\t\t\t\t\tconst box = new Box3();\n\t\t\t\t\tbox.min.fromArray( bound.boxMin );\n\t\t\t\t\tbox.max.fromArray( bound.boxMax );\n\n\t\t\t\t\tconst sphere = new Sphere();\n\t\t\t\t\tsphere.radius = bound.sphereRadius;\n\t\t\t\t\tsphere.center.fromArray( bound.sphereCenter );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\t\t\tbox: box,\n\n\t\t\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\t\t\tsphere: sphere\n\t\t\t\t\t};\n\n\t\t\t\t} );\n\n\t\t\t\tobject._maxInstanceCount = data.maxInstanceCount;\n\t\t\t\tobject._maxVertexCount = data.maxVertexCount;\n\t\t\t\tobject._maxIndexCount = data.maxIndexCount;\n\n\t\t\t\tobject._geometryInitialized = data.geometryInitialized;\n\t\t\t\tobject._geometryCount = data.geometryCount;\n\n\t\t\t\tobject._matricesTexture = getTexture( data.matricesTexture.uuid );\n\t\t\t\tif ( data.colorsTexture !== undefined ) object._colorsTexture = getTexture( data.colorsTexture.uuid );\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.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;\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\tbindLightTargets( object ) {\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isDirectionalLight ||\u00A0child.isSpotLight ) {\n\n\t\t\t\tconst uuid = child.target;\n\n\t\t\t\tconst target = object.getObjectByProperty( 'uuid', uuid );\n\n\t\t\t\tif ( target !== undefined ) {\n\n\t\t\t\t\tchild.target = target;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.target = new Object3D();\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\t// If cached is a promise, wait for it to resolve\n\t\t\tif ( cached.then ) {\n\n\t\t\t\tcached.then( imageBitmap => {\n\n\t\t\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t} ).catch( e => {\n\n\t\t\t\t\tif ( onError ) onError( e );\n\n\t\t\t\t} );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t// If cached is not a promise (i.e., it's already an imageBitmap)\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\tconst promise = fetch( 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\treturn imageBitmap;\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tCache.remove( url );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tCache.add( url, promise );\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} ).catch( 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\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._connected === false ) {\n\n\t\t\treturn;\n\n\t\t}\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.isPlaying === true && this.source.detune !== undefined ) {\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\tconst uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];\n\n\t\t\tfor ( let j = 0; j < uniforms.length; j ++ ) {\n\n\t\t\t\tthis.uniforms.push( uniforms[ j ].clone() );\n\n\t\t\t}\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\nconst _matrix = /*@__PURE__*/ new Matrix4();\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\tsetFromXRController( controller ) {\n\n\t\t_matrix.identity().extractRotation( controller.matrixWorld );\n\n\t\tthis.ray.origin.setFromMatrixPosition( controller.matrixWorld );\n\t\tthis.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );\n\n\t\treturn this;\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersect( 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\tintersect( 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 intersect( object, raycaster, intersects, recursive ) {\n\n\tlet propagate = true;\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tconst result = object.raycast( raycaster, intersects );\n\n\t\tif ( result === false ) propagate = false;\n\n\t}\n\n\tif ( propagate === true && 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\tintersect( 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 * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.\n * theta (the azimuthal angle) is measured from the positive z-axis.\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.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\t// update the local matrix based on the parent and light target transforms\n\t\tif ( this.parent ) {\n\n\t\t\tthis.parent.updateWorldMatrix( true );\n\n\t\t\tthis.matrix\n\t\t\t\t.copy( this.parent.matrixWorld )\n\t\t\t\t.invert()\n\t\t\t\t.multiply( this.light.matrixWorld );\n\n\t\t} else {\n\n\t\t\tthis.matrix.copy( this.light.matrixWorld );\n\n\t\t}\n\n\t\tthis.matrixWorld.copy( this.light.matrixWorld );\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\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tconsole.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the \"count\" parameter to enable MRT.' );\n\n\t\tsuper( width, height, { ...options, count } );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures;\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, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, 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, ConstantAlphaFactor, ConstantColorFactor, 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, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, 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, LinearDisplayP3ColorSpace, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, 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, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, 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, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, 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, TextureUtils, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, createCanvasElement };\n", "import { c as createEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-99983b2d.esm.js';\nexport { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-99983b2d.esm.js';\nimport * as React from 'react';\nimport * as THREE from 'three';\nimport useMeasure from 'react-use-measure';\nimport { FiberProvider, useContextBridge } from 'its-fine';\nimport { jsx } from 'react/jsx-runtime';\nimport 'react-reconciler/constants';\nimport 'zustand';\nimport 'react-reconciler';\nimport 'scheduler';\nimport 'suspend-react';\n\nconst DOM_EVENTS = {\n onClick: ['click', false],\n onContextMenu: ['contextmenu', false],\n onDoubleClick: ['dblclick', false],\n onWheel: ['wheel', true],\n onPointerDown: ['pointerdown', true],\n onPointerUp: ['pointerup', true],\n onPointerLeave: ['pointerleave', true],\n onPointerMove: ['pointermove', true],\n onPointerCancel: ['pointercancel', true],\n onLostPointerCapture: ['lostpointercapture', true]\n};\n\n/** Default R3F event manager for web */\nfunction createPointerEvents(store) {\n const {\n handlePointer\n } = createEvents(store);\n return {\n priority: 1,\n enabled: true,\n compute(event, state, previous) {\n // https://github.com/pmndrs/react-three-fiber/pull/782\n // Events trigger outside of canvas when moved, use offsetX/Y by default and allow overrides\n state.pointer.set(event.offsetX / state.size.width * 2 - 1, -(event.offsetY / state.size.height) * 2 + 1);\n state.raycaster.setFromCamera(state.pointer, state.camera);\n },\n connected: undefined,\n handlers: Object.keys(DOM_EVENTS).reduce((acc, key) => ({\n ...acc,\n [key]: handlePointer(key)\n }), {}),\n update: () => {\n var _internal$lastEvent;\n const {\n events,\n internal\n } = store.getState();\n if ((_internal$lastEvent = internal.lastEvent) != null && _internal$lastEvent.current && events.handlers) events.handlers.onPointerMove(internal.lastEvent.current);\n },\n connect: target => {\n var _events$handlers;\n const {\n set,\n events\n } = store.getState();\n events.disconnect == null ? void 0 : events.disconnect();\n set(state => ({\n events: {\n ...state.events,\n connected: target\n }\n }));\n Object.entries((_events$handlers = events.handlers) != null ? _events$handlers : []).forEach(([name, event]) => {\n const [eventName, passive] = DOM_EVENTS[name];\n target.addEventListener(eventName, event, {\n passive\n });\n });\n },\n disconnect: () => {\n const {\n set,\n events\n } = store.getState();\n if (events.connected) {\n var _events$handlers2;\n Object.entries((_events$handlers2 = events.handlers) != null ? _events$handlers2 : []).forEach(([name, event]) => {\n if (events && events.connected instanceof HTMLElement) {\n const [eventName] = DOM_EVENTS[name];\n events.connected.removeEventListener(eventName, event);\n }\n });\n set(state => ({\n events: {\n ...state.events,\n connected: undefined\n }\n }));\n }\n }\n };\n}\n\nconst CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({\n children,\n fallback,\n resize,\n style,\n gl,\n events = createPointerEvents,\n eventSource,\n eventPrefix,\n shadows,\n linear,\n flat,\n legacy,\n orthographic,\n frameloop,\n dpr,\n performance,\n raycaster,\n camera,\n scene,\n onPointerMissed,\n onCreated,\n ...props\n}, forwardedRef) {\n // Create a known catalogue of Threejs-native elements\n // This will include the entire THREE namespace by default, users can extend\n // their own elements by using the createRoot API instead\n React.useMemo(() => extend(THREE), []);\n const Bridge = useContextBridge();\n const [containerRef, containerRect] = useMeasure({\n scroll: true,\n debounce: {\n scroll: 50,\n resize: 0\n },\n ...resize\n });\n const canvasRef = React.useRef(null);\n const divRef = React.useRef(null);\n React.useImperativeHandle(forwardedRef, () => canvasRef.current);\n const handlePointerMissed = useMutableCallback(onPointerMissed);\n const [block, setBlock] = React.useState(false);\n const [error, setError] = React.useState(false);\n\n // Suspend this component if block is a promise (2nd run)\n if (block) throw block;\n // Throw exception outwards if anything within canvas throws\n if (error) throw error;\n const root = React.useRef(null);\n useIsomorphicLayoutEffect(() => {\n const canvas = canvasRef.current;\n if (containerRect.width > 0 && containerRect.height > 0 && canvas) {\n if (!root.current) root.current = createRoot(canvas);\n root.current.configure({\n gl,\n events,\n shadows,\n linear,\n flat,\n legacy,\n orthographic,\n frameloop,\n dpr,\n performance,\n raycaster,\n camera,\n scene,\n size: containerRect,\n // Pass mutable reference to onPointerMissed so it's free to update\n onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),\n onCreated: state => {\n // Connect to event source\n state.events.connect == null ? void 0 : state.events.connect(eventSource ? isRef(eventSource) ? eventSource.current : eventSource : divRef.current);\n // Set up compute function\n if (eventPrefix) {\n state.setEvents({\n compute: (event, state) => {\n const x = event[eventPrefix + 'X'];\n const y = event[eventPrefix + 'Y'];\n state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);\n state.raycaster.setFromCamera(state.pointer, state.camera);\n }\n });\n }\n // Call onCreated callback\n onCreated == null ? void 0 : onCreated(state);\n }\n });\n root.current.render( /*#__PURE__*/jsx(Bridge, {\n children: /*#__PURE__*/jsx(ErrorBoundary, {\n set: setError,\n children: /*#__PURE__*/jsx(React.Suspense, {\n fallback: /*#__PURE__*/jsx(Block, {\n set: setBlock\n }),\n children: children\n })\n })\n }));\n }\n });\n React.useEffect(() => {\n const canvas = canvasRef.current;\n if (canvas) return () => unmountComponentAtNode(canvas);\n }, []);\n\n // When the event source is not this div, we need to set pointer-events to none\n // Or else the canvas will block events from reaching the event source\n const pointerEvents = eventSource ? 'none' : 'auto';\n return /*#__PURE__*/jsx(\"div\", {\n ref: divRef,\n style: {\n position: 'relative',\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n pointerEvents,\n ...style\n },\n ...props,\n children: /*#__PURE__*/jsx(\"div\", {\n ref: containerRef,\n style: {\n width: '100%',\n height: '100%'\n },\n children: /*#__PURE__*/jsx(\"canvas\", {\n ref: canvasRef,\n style: {\n display: 'block'\n },\n children: fallback\n })\n })\n });\n});\n\n/**\r\n * A DOM canvas which accepts threejs elements as children.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/canvas\r\n */\nconst Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {\n return /*#__PURE__*/jsx(FiberProvider, {\n children: /*#__PURE__*/jsx(CanvasImpl, {\n ...props,\n ref: ref\n })\n });\n});\n\nexport { Canvas, createPointerEvents as events };\n", "import * as THREE from 'three';\nimport * as React from 'react';\nimport { DefaultEventPriority, ContinuousEventPriority, DiscreteEventPriority, ConcurrentRoot } from 'react-reconciler/constants';\nimport create from 'zustand';\nimport Reconciler from 'react-reconciler';\nimport { unstable_scheduleCallback, unstable_IdlePriority } from 'scheduler';\nimport { suspend, preload, clear } from 'suspend-react';\nimport { jsx, Fragment } from 'react/jsx-runtime';\n\nvar threeTypes = /*#__PURE__*/Object.freeze({\n __proto__: null\n});\n\nconst catalogue = {};\nconst extend = objects => void Object.assign(catalogue, objects);\nfunction createRenderer(_roots, _getEventPriority) {\n function createInstance(type, {\n args = [],\n attach,\n ...props\n }, root) {\n let name = `${type[0].toUpperCase()}${type.slice(1)}`;\n let instance;\n if (type === 'primitive') {\n if (props.object === undefined) throw new Error(\"R3F: Primitives without 'object' are invalid!\");\n const object = props.object;\n instance = prepare(object, {\n type,\n root,\n attach,\n primitive: true\n });\n } else {\n const target = catalogue[name];\n if (!target) {\n throw new Error(`R3F: ${name} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);\n }\n\n // Throw if an object or literal was passed for args\n if (!Array.isArray(args)) throw new Error('R3F: The args prop must be an array!');\n\n // Instanciate new object, link it to the root\n // Append memoized props with args so it's not forgotten\n instance = prepare(new target(...args), {\n type,\n root,\n attach,\n // Save args in case we need to reconstruct later for HMR\n memoizedProps: {\n args\n }\n });\n }\n\n // Auto-attach geometries and materials\n if (instance.__r3f.attach === undefined) {\n if (instance instanceof THREE.BufferGeometry) instance.__r3f.attach = 'geometry';else if (instance instanceof THREE.Material) instance.__r3f.attach = 'material';\n }\n\n // It should NOT call onUpdate on object instanciation, because it hasn't been added to the\n // view yet. If the callback relies on references for instance, they won't be ready yet, this is\n // why it passes \"true\" here\n // There is no reason to apply props to injects\n if (name !== 'inject') applyProps$1(instance, props);\n return instance;\n }\n function appendChild(parentInstance, child) {\n let added = false;\n if (child) {\n var _child$__r3f, _parentInstance$__r3f;\n // The attach attribute implies that the object attaches itself on the parent\n if ((_child$__r3f = child.__r3f) != null && _child$__r3f.attach) {\n attach(parentInstance, child, child.__r3f.attach);\n } else if (child.isObject3D && parentInstance.isObject3D) {\n // add in the usual parent-child way\n parentInstance.add(child);\n added = true;\n }\n // This is for anything that used attach, and for non-Object3Ds that don't get attached to props;\n // that is, anything that's a child in React but not a child in the scenegraph.\n if (!added) (_parentInstance$__r3f = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f.objects.push(child);\n if (!child.__r3f) prepare(child, {});\n child.__r3f.parent = parentInstance;\n updateInstance(child);\n invalidateInstance(child);\n }\n }\n function insertBefore(parentInstance, child, beforeChild) {\n let added = false;\n if (child) {\n var _child$__r3f2, _parentInstance$__r3f2;\n if ((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) {\n attach(parentInstance, child, child.__r3f.attach);\n } else if (child.isObject3D && parentInstance.isObject3D) {\n child.parent = parentInstance;\n child.dispatchEvent({\n type: 'added'\n });\n parentInstance.dispatchEvent({\n type: 'childadded',\n child\n });\n const restSiblings = parentInstance.children.filter(sibling => sibling !== child);\n const index = restSiblings.indexOf(beforeChild);\n parentInstance.children = [...restSiblings.slice(0, index), child, ...restSiblings.slice(index)];\n added = true;\n }\n if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);\n if (!child.__r3f) prepare(child, {});\n child.__r3f.parent = parentInstance;\n updateInstance(child);\n invalidateInstance(child);\n }\n }\n function removeRecursive(array, parent, dispose = false) {\n if (array) [...array].forEach(child => removeChild(parent, child, dispose));\n }\n function removeChild(parentInstance, child, dispose) {\n if (child) {\n var _parentInstance$__r3f3, _child$__r3f3, _child$__r3f5;\n // Clear the parent reference\n if (child.__r3f) child.__r3f.parent = null;\n // Remove child from the parents objects\n if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child);\n // Remove attachment\n if ((_child$__r3f3 = child.__r3f) != null && _child$__r3f3.attach) {\n detach(parentInstance, child, child.__r3f.attach);\n } else if (child.isObject3D && parentInstance.isObject3D) {\n var _child$__r3f4;\n parentInstance.remove(child);\n // @ts-expect-error\n // Remove interactivity on the initial root\n if ((_child$__r3f4 = child.__r3f) != null && _child$__r3f4.root) {\n removeInteractivity(findInitialRoot(child), child);\n }\n }\n\n // Allow objects to bail out of recursive dispose altogether by passing dispose={null}\n // Never dispose of primitives because their state may be kept outside of React!\n // In order for an object to be able to dispose it has to have\n // - a dispose method,\n // - it cannot be a \n // - it cannot be a THREE.Scene, because three has broken it's own api\n //\n // Since disposal is recursive, we can check the optional dispose arg, which will be undefined\n // when the reconciler calls it, but then carry our own check recursively\n const isPrimitive = (_child$__r3f5 = child.__r3f) == null ? void 0 : _child$__r3f5.primitive;\n const shouldDispose = !isPrimitive && (dispose === undefined ? child.dispose !== null : dispose);\n\n // Remove nested child objects. Primitives should not have objects and children that are\n // attached to them declaratively ...\n if (!isPrimitive) {\n var _child$__r3f6;\n removeRecursive((_child$__r3f6 = child.__r3f) == null ? void 0 : _child$__r3f6.objects, child, shouldDispose);\n removeRecursive(child.children, child, shouldDispose);\n }\n\n // Remove references\n delete child.__r3f;\n\n // Dispose item whenever the reconciler feels like it\n if (shouldDispose && child.dispose && child.type !== 'Scene') {\n const callback = () => {\n try {\n child.dispose();\n } catch (e) {\n /* ... */\n }\n };\n\n // Schedule async at runtime, flush sync in testing\n if (typeof IS_REACT_ACT_ENVIRONMENT === 'undefined') {\n unstable_scheduleCallback(unstable_IdlePriority, callback);\n } else {\n callback();\n }\n }\n invalidateInstance(parentInstance);\n }\n }\n function switchInstance(instance, type, newProps, fiber) {\n var _instance$__r3f;\n const parent = (_instance$__r3f = instance.__r3f) == null ? void 0 : _instance$__r3f.parent;\n if (!parent) return;\n const newInstance = createInstance(type, newProps, instance.__r3f.root);\n\n // https://github.com/pmndrs/react-three-fiber/issues/1348\n // When args change the instance has to be re-constructed, which then\n // forces r3f to re-parent the children and non-scene objects\n if (instance.children) {\n for (const child of instance.children) {\n if (child.__r3f) appendChild(newInstance, child);\n }\n instance.children = instance.children.filter(child => !child.__r3f);\n }\n instance.__r3f.objects.forEach(child => appendChild(newInstance, child));\n instance.__r3f.objects = [];\n if (!instance.__r3f.autoRemovedBeforeAppend) {\n removeChild(parent, instance);\n }\n if (newInstance.parent) {\n newInstance.__r3f.autoRemovedBeforeAppend = true;\n }\n appendChild(parent, newInstance);\n\n // Re-bind event handlers on the initial root\n if (newInstance.raycast && newInstance.__r3f.eventCount) {\n const rootState = findInitialRoot(newInstance).getState();\n rootState.internal.interaction.push(newInstance);\n }\n [fiber, fiber.alternate].forEach(fiber => {\n if (fiber !== null) {\n fiber.stateNode = newInstance;\n if (fiber.ref) {\n if (typeof fiber.ref === 'function') fiber.ref(newInstance);else fiber.ref.current = newInstance;\n }\n }\n });\n }\n\n // Don't handle text instances, warn on undefined behavior\n const handleTextInstance = () => console.warn('Text is not allowed in the R3F tree! This could be stray whitespace or characters.');\n const reconciler = Reconciler({\n createInstance,\n removeChild,\n appendChild,\n appendInitialChild: appendChild,\n insertBefore,\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n noTimeout: -1,\n appendChildToContainer: (container, child) => {\n if (!child) return;\n\n // Don't append to unmounted container\n const scene = container.getState().scene;\n if (!scene.__r3f) return;\n\n // Link current root to the default scene\n scene.__r3f.root = container;\n appendChild(scene, child);\n },\n removeChildFromContainer: (container, child) => {\n if (!child) return;\n removeChild(container.getState().scene, child);\n },\n insertInContainerBefore: (container, child, beforeChild) => {\n if (!child || !beforeChild) return;\n\n // Don't append to unmounted container\n const scene = container.getState().scene;\n if (!scene.__r3f) return;\n insertBefore(scene, child, beforeChild);\n },\n getRootHostContext: () => null,\n getChildHostContext: parentHostContext => parentHostContext,\n finalizeInitialChildren(instance) {\n var _instance$__r3f2;\n const localState = (_instance$__r3f2 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f2 : {};\n // https://github.com/facebook/react/issues/20271\n // Returning true will trigger commitMount\n return Boolean(localState.handlers);\n },\n prepareUpdate(instance, _type, oldProps, newProps) {\n var _instance$__r3f3;\n const localState = (_instance$__r3f3 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f3 : {};\n\n // Create diff-sets\n if (localState.primitive && newProps.object && newProps.object !== instance) {\n return [true];\n } else {\n // This is a data object, let's extract critical information about it\n const {\n args: argsNew = [],\n children: cN,\n ...restNew\n } = newProps;\n const {\n args: argsOld = [],\n children: cO,\n ...restOld\n } = oldProps;\n\n // Throw if an object or literal was passed for args\n if (!Array.isArray(argsNew)) throw new Error('R3F: the args prop must be an array!');\n\n // If it has new props or arguments, then it needs to be re-instantiated\n if (argsNew.some((value, index) => value !== argsOld[index])) return [true];\n // Create a diff-set, flag if there are any changes\n const diff = diffProps(instance, restNew, restOld, true);\n if (diff.changes.length) return [false, diff];\n\n // Otherwise do not touch the instance\n return null;\n }\n },\n commitUpdate(instance, [reconstruct, diff], type, _oldProps, newProps, fiber) {\n // Reconstruct when args or instance,\n prepareForCommit: () => null,\n preparePortalMount: container => prepare(container.getState().scene),\n resetAfterCommit: () => {},\n shouldSetTextContent: () => false,\n clearContainer: () => false,\n hideInstance(instance) {\n var _instance$__r3f5;\n // Detach while the instance is hidden\n const {\n attach: type,\n parent\n } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};\n if (type && parent) detach(parent, instance, type);\n if (instance.isObject3D) instance.visible = false;\n invalidateInstance(instance);\n },\n unhideInstance(instance, props) {\n var _instance$__r3f6;\n // Re-attach when the instance is unhidden\n const {\n attach: type,\n parent\n } = (_instance$__r3f6 = instance.__r3f) != null ? _instance$__r3f6 : {};\n if (type && parent) attach(parent, instance, type);\n if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;\n invalidateInstance(instance);\n },\n createTextInstance: handleTextInstance,\n hideTextInstance: handleTextInstance,\n unhideTextInstance: handleTextInstance,\n // https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n // @ts-expect-error\n getCurrentEventPriority: () => _getEventPriority ? _getEventPriority() : DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n now: typeof performance !== 'undefined' && is.fun(performance.now) ? performance.now : is.fun(Date.now) ? Date.now : () => 0,\n // https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r920883503\n scheduleTimeout: is.fun(setTimeout) ? setTimeout : undefined,\n cancelTimeout: is.fun(clearTimeout) ? clearTimeout : undefined\n });\n return {\n reconciler,\n applyProps: applyProps$1\n };\n}\n\nvar _window$document, _window$navigator;\n/**\r\n * Returns `true` with correct TS type inference if an object has a configurable color space (since r152).\r\n */\nconst hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;\n/**\r\n * The current THREE.ColorManagement instance, if present.\r\n */\nconst getColorManagement = () => {\n var _ColorManagement;\n return (_ColorManagement = catalogue.ColorManagement) != null ? _ColorManagement : null;\n};\nconst isOrthographicCamera = def => def && def.isOrthographicCamera;\nconst isRef = obj => obj && obj.hasOwnProperty('current');\n\n/**\r\n * An SSR-friendly useLayoutEffect.\r\n *\r\n * React currently throws a warning when using useLayoutEffect on the server.\r\n * To get around it, we can conditionally useEffect on the server (no-op) and\r\n * useLayoutEffect elsewhere.\r\n *\r\n * @see https://github.com/facebook/react/issues/14927\r\n */\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' && ((_window$document = window.document) != null && _window$document.createElement || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === 'ReactNative') ? React.useLayoutEffect : React.useEffect;\nfunction useMutableCallback(fn) {\n const ref = React.useRef(fn);\n useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);\n return ref;\n}\nfunction Block({\n set\n}) {\n useIsomorphicLayoutEffect(() => {\n set(new Promise(() => null));\n return () => set(false);\n }, [set]);\n return null;\n}\nclass ErrorBoundary extends React.Component {\n constructor(...args) {\n super(...args);\n this.state = {\n error: false\n };\n }\n componentDidCatch(err) {\n this.props.set(err);\n }\n render() {\n return this.state.error ? null : this.props.children;\n }\n}\nErrorBoundary.getDerivedStateFromError = () => ({\n error: true\n});\nconst DEFAULT = '__default';\nconst DEFAULTS = new Map();\nconst isDiffSet = def => def && !!def.memoized && !!def.changes;\nfunction calculateDpr(dpr) {\n var _window$devicePixelRa;\n // Err on the side of progress by assuming 2x dpr if we can't detect it\n // This will happen in workers where window is defined but dpr isn't.\n const target = typeof window !== 'undefined' ? (_window$devicePixelRa = window.devicePixelRatio) != null ? _window$devicePixelRa : 2 : 1;\n return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;\n}\n\n/**\r\n * Returns instance root state\r\n */\nconst getRootState = obj => {\n var _r3f;\n return (_r3f = obj.__r3f) == null ? void 0 : _r3f.root.getState();\n};\n\n/**\r\n * Returns the instances initial (outmost) root\r\n */\nfunction findInitialRoot(child) {\n let root = child.__r3f.root;\n while (root.getState().previousRoot) root = root.getState().previousRoot;\n return root;\n}\n// A collection of compare functions\nconst is = {\n obj: a => a === Object(a) && !is.arr(a) && typeof a !== 'function',\n fun: a => typeof a === 'function',\n str: a => typeof a === 'string',\n num: a => typeof a === 'number',\n boo: a => typeof a === 'boolean',\n und: a => a === void 0,\n arr: a => Array.isArray(a),\n equ(a, b, {\n arrays = 'shallow',\n objects = 'reference',\n strict = true\n } = {}) {\n // Wrong type or one of the two undefined, doesn't match\n if (typeof a !== typeof b || !!a !== !!b) return false;\n // Atomic, just compare a against b\n if (is.str(a) || is.num(a) || is.boo(a)) return a === b;\n const isObj = is.obj(a);\n if (isObj && objects === 'reference') return a === b;\n const isArr = is.arr(a);\n if (isArr && arrays === 'reference') return a === b;\n // Array or Object, shallow compare first to see if it's a match\n if ((isArr || isObj) && a === b) return true;\n // Last resort, go through keys\n let i;\n // Check if a has all the keys of b\n for (i in a) if (!(i in b)) return false;\n // Check if values between keys match\n if (isObj && arrays === 'shallow' && objects === 'shallow') {\n for (i in strict ? b : a) if (!is.equ(a[i], b[i], {\n strict,\n objects: 'reference'\n })) return false;\n } else {\n for (i in strict ? b : a) if (a[i] !== b[i]) return false;\n }\n // If i is undefined\n if (is.und(i)) {\n // If both arrays are empty we consider them equal\n if (isArr && a.length === 0 && b.length === 0) return true;\n // If both objects are empty we consider them equal\n if (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;\n // Otherwise match them by value\n if (a !== b) return false;\n }\n return true;\n }\n};\n\n/**\r\n * Collects nodes and materials from a THREE.Object3D.\r\n */\nfunction buildGraph(object) {\n const data = {\n nodes: {},\n materials: {}\n };\n if (object) {\n object.traverse(obj => {\n if (obj.name) data.nodes[obj.name] = obj;\n if (obj.material && !data.materials[obj.material.name]) data.materials[obj.material.name] = obj.material;\n });\n }\n return data;\n}\n\n// Disposes an object and all its properties\nfunction dispose(obj) {\n if (obj.dispose && obj.type !== 'Scene') obj.dispose();\n for (const p in obj) {\n p.dispose == null ? void 0 : p.dispose();\n delete obj[p];\n }\n}\n\n// Each object in the scene carries a small LocalState descriptor\nfunction prepare(object, state) {\n const instance = object;\n instance.__r3f = {\n type: '',\n root: null,\n previousAttach: null,\n memoizedProps: {},\n eventCount: 0,\n handlers: {},\n objects: [],\n parent: null,\n ...state\n };\n return object;\n}\nfunction resolve(instance, key) {\n let target = instance;\n if (key.includes('-')) {\n const entries = key.split('-');\n const last = entries.pop();\n target = entries.reduce((acc, key) => acc[key], instance);\n return {\n target,\n key: last\n };\n } else return {\n target,\n key\n };\n}\n\n// Checks if a dash-cased string ends with an integer\nconst INDEX_REGEX = /-\\d+$/;\nfunction attach(parent, child, type) {\n if (is.str(type)) {\n // If attaching into an array (foo-0), create one\n if (INDEX_REGEX.test(type)) {\n const root = type.replace(INDEX_REGEX, '');\n const {\n target,\n key\n } = resolve(parent, root);\n if (!Array.isArray(target[key])) target[key] = [];\n }\n const {\n target,\n key\n } = resolve(parent, type);\n child.__r3f.previousAttach = target[key];\n target[key] = child;\n } else child.__r3f.previousAttach = type(parent, child);\n}\nfunction detach(parent, child, type) {\n var _child$__r3f, _child$__r3f2;\n if (is.str(type)) {\n const {\n target,\n key\n } = resolve(parent, type);\n const previous = child.__r3f.previousAttach;\n // When the previous value was undefined, it means the value was never set to begin with\n if (previous === undefined) delete target[key];\n // Otherwise set the previous value\n else target[key] = previous;\n } else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);\n (_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;\n}\n// This function prepares a set of changes to be applied to the instance\nfunction diffProps(instance, {\n children: cN,\n key: kN,\n ref: rN,\n ...props\n}, {\n children: cP,\n key: kP,\n ref: rP,\n ...previous\n} = {}, remove = false) {\n const localState = instance.__r3f;\n const entries = Object.entries(props);\n const changes = [];\n\n // Catch removed props, prepend them so they can be reset or removed\n if (remove) {\n const previousKeys = Object.keys(previous);\n for (let i = 0; i < previousKeys.length; i++) {\n if (!props.hasOwnProperty(previousKeys[i])) entries.unshift([previousKeys[i], DEFAULT + 'remove']);\n }\n }\n entries.forEach(([key, value]) => {\n var _instance$__r3f;\n // Bail out on primitive object\n if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;\n // When props match bail out\n if (is.equ(value, previous[key])) return;\n // Collect handlers and bail out\n if (/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(key)) return changes.push([key, value, true, []]);\n // Split dashed props\n let entries = [];\n if (key.includes('-')) entries = key.split('-');\n changes.push([key, value, false, entries]);\n\n // Reset pierced props\n for (const prop in props) {\n const value = props[prop];\n if (prop.startsWith(`${key}-`)) changes.push([prop, value, false, prop.split('-')]);\n }\n });\n const memoized = {\n ...props\n };\n if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;\n if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;\n return {\n memoized,\n changes\n };\n}\nconst __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'production';\n\n// This function applies a set of changes to the instance\nfunction applyProps$1(instance, data) {\n var _instance$__r3f2;\n // Filter equals, events and reserved props\n const localState = instance.__r3f;\n const root = localState == null ? void 0 : localState.root;\n const rootState = root == null ? void 0 : root.getState == null ? void 0 : root.getState();\n const {\n memoized,\n changes\n } = isDiffSet(data) ? data : diffProps(instance, data);\n const prevHandlers = localState == null ? void 0 : localState.eventCount;\n\n // Prepare memoized props\n if (instance.__r3f) instance.__r3f.memoizedProps = memoized;\n for (let i = 0; i < changes.length; i++) {\n let [key, value, isEvent, keys] = changes[i];\n\n // Alias (output)encoding => (output)colorSpace (since r152)\n // https://github.com/pmndrs/react-three-fiber/pull/2829\n if (hasColorSpace(instance)) {\n const sRGBEncoding = 3001;\n const SRGBColorSpace = 'srgb';\n const LinearSRGBColorSpace = 'srgb-linear';\n if (key === 'encoding') {\n key = 'colorSpace';\n value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n } else if (key === 'outputEncoding') {\n key = 'outputColorSpace';\n value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n }\n }\n let currentInstance = instance;\n let targetProp = currentInstance[key];\n\n // Revolve dashed props\n if (keys.length) {\n targetProp = keys.reduce((acc, key) => acc[key], instance);\n // If the target is atomic, it forces us to switch the root\n if (!(targetProp && targetProp.set)) {\n const [name, ...reverseEntries] = keys.reverse();\n currentInstance = reverseEntries.reverse().reduce((acc, key) => acc[key], instance);\n key = name;\n }\n }\n\n // https://github.com/mrdoob/three.js/issues/21209\n // HMR/fast-refresh relies on the ability to cancel out props, but threejs\n // has no means to do this. Hence we curate a small collection of value-classes\n // with their respective constructor/set arguments\n // For removed props, try to set default values, if possible\n if (value === DEFAULT + 'remove') {\n if (currentInstance.constructor) {\n // create a blank slate of the instance and copy the particular parameter.\n let ctor = DEFAULTS.get(currentInstance.constructor);\n if (!ctor) {\n // @ts-expect-error\n ctor = new currentInstance.constructor();\n DEFAULTS.set(currentInstance.constructor, ctor);\n }\n value = ctor[key];\n } else {\n // instance does not have constructor, just set it to 0\n value = 0;\n }\n }\n\n // Deal with pointer events ...\n if (isEvent && localState) {\n if (value) localState.handlers[key] = value;else delete localState.handlers[key];\n localState.eventCount = Object.keys(localState.handlers).length;\n }\n // Special treatment for objects with support for set/copy, and layers\n else if (targetProp && targetProp.set && (targetProp.copy || targetProp instanceof THREE.Layers)) {\n // If value is an array\n if (Array.isArray(value)) {\n if (targetProp.fromArray) targetProp.fromArray(value);else targetProp.set(...value);\n }\n // Test again target.copy(class) next ...\n else if (targetProp.copy && value && value.constructor && (\n // Some environments may break strict identity checks by duplicating versions of three.js.\n // Loosen to unminified names, ignoring descendents.\n // https://github.com/pmndrs/react-three-fiber/issues/2856\n // TODO: fix upstream and remove in v9\n __DEV__ ? targetProp.constructor.name === value.constructor.name : targetProp.constructor === value.constructor)) {\n targetProp.copy(value);\n }\n // If nothing else fits, just set the single value, ignore undefined\n // https://github.com/pmndrs/react-three-fiber/issues/274\n else if (value !== undefined) {\n const isColor = targetProp instanceof THREE.Color;\n // Allow setting array scalars\n if (!isColor && targetProp.setScalar) targetProp.setScalar(value);\n // Layers have no copy function, we must therefore copy the mask property\n else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers) targetProp.mask = value.mask;\n // Otherwise just set ...\n else targetProp.set(value);\n // For versions of three which don't support THREE.ColorManagement,\n // Auto-convert sRGB colors\n // https://github.com/pmndrs/react-three-fiber/issues/344\n if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();\n }\n // Else, just overwrite the value\n } else {\n currentInstance[key] = value;\n\n // Auto-convert sRGB textures, for now ...\n // https://github.com/pmndrs/react-three-fiber/issues/344\n if (currentInstance[key] instanceof THREE.Texture &&\n // sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129\n currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType && rootState) {\n const texture = currentInstance[key];\n if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;\n }\n }\n invalidateInstance(instance);\n }\n if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {\n // Get the initial root state's internals\n const internal = findInitialRoot(instance).getState().internal;\n // Pre-emptively remove the instance from the interaction manager\n const index = internal.interaction.indexOf(instance);\n if (index > -1) internal.interaction.splice(index, 1);\n // Add the instance to the interaction manager only when it has handlers\n if (localState.eventCount) internal.interaction.push(instance);\n }\n\n // Call the update lifecycle when it is being updated, but only when it is part of the scene.\n // Skip updates to the `onUpdate` prop itself\n const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';\n if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);\n return instance;\n}\nfunction invalidateInstance(instance) {\n var _instance$__r3f3, _instance$__r3f3$root;\n const state = (_instance$__r3f3 = instance.__r3f) == null ? void 0 : (_instance$__r3f3$root = _instance$__r3f3.root) == null ? void 0 : _instance$__r3f3$root.getState == null ? void 0 : _instance$__r3f3$root.getState();\n if (state && state.internal.frames === 0) state.invalidate();\n}\nfunction updateInstance(instance) {\n instance.onUpdate == null ? void 0 : instance.onUpdate(instance);\n}\nfunction updateCamera(camera, size) {\n // https://github.com/pmndrs/react-three-fiber/issues/92\n // Do not mess with the camera if it belongs to the user\n if (!camera.manual) {\n if (isOrthographicCamera(camera)) {\n camera.left = size.width / -2;\n camera.right = size.width / 2;\n camera.top = size.height / 2;\n camera.bottom = size.height / -2;\n } else {\n camera.aspect = size.width / size.height;\n }\n camera.updateProjectionMatrix();\n // https://github.com/pmndrs/react-three-fiber/issues/178\n // Update matrix world since the renderer is a frame late\n camera.updateMatrixWorld();\n }\n}\n\nfunction makeId(event) {\n return (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;\n}\n\n// https://github.com/facebook/react/tree/main/packages/react-reconciler#getcurrenteventpriority\n// Gives React a clue as to how import the current interaction is\nfunction getEventPriority() {\n var _globalScope$event;\n // Get a handle to the current global scope in window and worker contexts if able\n // https://github.com/pmndrs/react-three-fiber/pull/2493\n const globalScope = typeof self !== 'undefined' && self || typeof window !== 'undefined' && window;\n if (!globalScope) return DefaultEventPriority;\n const name = (_globalScope$event = globalScope.event) == null ? void 0 : _globalScope$event.type;\n switch (name) {\n case 'click':\n case 'contextmenu':\n case 'dblclick':\n case 'pointercancel':\n case 'pointerdown':\n case 'pointerup':\n return DiscreteEventPriority;\n case 'pointermove':\n case 'pointerout':\n case 'pointerover':\n case 'pointerenter':\n case 'pointerleave':\n case 'wheel':\n return ContinuousEventPriority;\n default:\n return DefaultEventPriority;\n }\n}\n\n/**\r\n * Release pointer captures.\r\n * This is called by releasePointerCapture in the API, and when an object is removed.\r\n */\nfunction releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {\n const captureData = captures.get(obj);\n if (captureData) {\n captures.delete(obj);\n // If this was the last capturing object for this pointer\n if (captures.size === 0) {\n capturedMap.delete(pointerId);\n captureData.target.releasePointerCapture(pointerId);\n }\n }\n}\nfunction removeInteractivity(store, object) {\n const {\n internal\n } = store.getState();\n // Removes every trace of an object from the data store\n internal.interaction = internal.interaction.filter(o => o !== object);\n internal.initialHits = internal.initialHits.filter(o => o !== object);\n internal.hovered.forEach((value, key) => {\n if (value.eventObject === object || value.object === object) {\n // Clear out intersects, they are outdated by now\n internal.hovered.delete(key);\n }\n });\n internal.capturedMap.forEach((captures, pointerId) => {\n releaseInternalPointerCapture(internal.capturedMap, object, captures, pointerId);\n });\n}\nfunction createEvents(store) {\n /** Calculates delta */\n function calculateDistance(event) {\n const {\n internal\n } = store.getState();\n const dx = event.offsetX - internal.initialClick[0];\n const dy = event.offsetY - internal.initialClick[1];\n return Math.round(Math.sqrt(dx * dx + dy * dy));\n }\n\n /** Returns true if an instance has a valid pointer-event registered, this excludes scroll, clicks etc */\n function filterPointerEvents(objects) {\n return objects.filter(obj => ['Move', 'Over', 'Enter', 'Out', 'Leave'].some(name => {\n var _r3f;\n return (_r3f = obj.__r3f) == null ? void 0 : _r3f.handlers['onPointer' + name];\n }));\n }\n function intersect(event, filter) {\n const state = store.getState();\n const duplicates = new Set();\n const intersections = [];\n // Allow callers to eliminate event objects\n const eventsObjects = filter ? filter(state.internal.interaction) : state.internal.interaction;\n // Reset all raycaster cameras to undefined\n for (let i = 0; i < eventsObjects.length; i++) {\n const state = getRootState(eventsObjects[i]);\n if (state) {\n state.raycaster.camera = undefined;\n }\n }\n if (!state.previousRoot) {\n // Make sure root-level pointer and ray are set up\n state.events.compute == null ? void 0 : state.events.compute(event, state);\n }\n function handleRaycast(obj) {\n const state = getRootState(obj);\n // Skip event handling when noEvents is set, or when the raycasters camera is null\n if (!state || !state.events.enabled || state.raycaster.camera === null) return [];\n\n // When the camera is undefined we have to call the event layers update function\n if (state.raycaster.camera === undefined) {\n var _state$previousRoot;\n state.events.compute == null ? void 0 : state.events.compute(event, state, (_state$previousRoot = state.previousRoot) == null ? void 0 : _state$previousRoot.getState());\n // If the camera is still undefined we have to skip this layer entirely\n if (state.raycaster.camera === undefined) state.raycaster.camera = null;\n }\n\n // Intersect object by object\n return state.raycaster.camera ? state.raycaster.intersectObject(obj, true) : [];\n }\n\n // Collect events\n let hits = eventsObjects\n // Intersect objects\n .flatMap(handleRaycast)\n // Sort by event priority and distance\n .sort((a, b) => {\n const aState = getRootState(a.object);\n const bState = getRootState(b.object);\n if (!aState || !bState) return a.distance - b.distance;\n return bState.events.priority - aState.events.priority || a.distance - b.distance;\n })\n // Filter out duplicates\n .filter(item => {\n const id = makeId(item);\n if (duplicates.has(id)) return false;\n duplicates.add(id);\n return true;\n });\n\n // https://github.com/mrdoob/three.js/issues/16031\n // Allow custom userland intersect sort order, this likely only makes sense on the root filter\n if (state.events.filter) hits = state.events.filter(hits, state);\n\n // Bubble up the events, find the event source (eventObject)\n for (const hit of hits) {\n let eventObject = hit.object;\n // Bubble event up\n while (eventObject) {\n var _r3f2;\n if ((_r3f2 = eventObject.__r3f) != null && _r3f2.eventCount) intersections.push({\n ...hit,\n eventObject\n });\n eventObject = eventObject.parent;\n }\n }\n\n // If the interaction is captured, make all capturing targets part of the intersect.\n if ('pointerId' in event && state.internal.capturedMap.has(event.pointerId)) {\n for (let captureData of state.internal.capturedMap.get(event.pointerId).values()) {\n if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);\n }\n }\n return intersections;\n }\n\n /** Handles intersections by forwarding them to handlers */\n function handleIntersects(intersections, event, delta, callback) {\n const rootState = store.getState();\n\n // If anything has been found, forward it to the event listeners\n if (intersections.length) {\n const localState = {\n stopped: false\n };\n for (const hit of intersections) {\n const state = getRootState(hit.object) || rootState;\n const {\n raycaster,\n pointer,\n camera,\n internal\n } = state;\n const unprojectedPoint = new THREE.Vector3(pointer.x, pointer.y, 0).unproject(camera);\n const hasPointerCapture = id => {\n var _internal$capturedMap, _internal$capturedMap2;\n return (_internal$capturedMap = (_internal$capturedMap2 = internal.capturedMap.get(id)) == null ? void 0 : _internal$capturedMap2.has(hit.eventObject)) != null ? _internal$capturedMap : false;\n };\n const setPointerCapture = id => {\n const captureData = {\n intersection: hit,\n target: event.target\n };\n if (internal.capturedMap.has(id)) {\n // if the pointerId was previously captured, we add the hit to the\n // event capturedMap.\n internal.capturedMap.get(id).set(hit.eventObject, captureData);\n } else {\n // if the pointerId was not previously captured, we create a map\n // containing the hitObject, and the hit. hitObject is used for\n // faster access.\n internal.capturedMap.set(id, new Map([[hit.eventObject, captureData]]));\n }\n event.target.setPointerCapture(id);\n };\n const releasePointerCapture = id => {\n const captures = internal.capturedMap.get(id);\n if (captures) {\n releaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);\n }\n };\n\n // Add native event props\n let extractEventProps = {};\n // This iterates over the event's properties including the inherited ones. Native PointerEvents have most of their props as getters which are inherited, but polyfilled PointerEvents have them all as their own properties (i.e. not inherited). We can't use Object.keys() or Object.entries() as they only return \"own\" properties; nor Object.getPrototypeOf(event) as that *doesn't* return \"own\" properties, only inherited ones.\n for (let prop in event) {\n let property = event[prop];\n // Only copy over atomics, leave functions alone as these should be\n // called as event.nativeEvent.fn()\n if (typeof property !== 'function') extractEventProps[prop] = property;\n }\n let raycastEvent = {\n ...hit,\n ...extractEventProps,\n pointer,\n intersections,\n stopped: localState.stopped,\n delta,\n unprojectedPoint,\n ray: raycaster.ray,\n camera: camera,\n // Hijack stopPropagation, which just sets a flag\n stopPropagation() {\n // https://github.com/pmndrs/react-three-fiber/issues/596\n // Events are not allowed to stop propagation if the pointer has been captured\n const capturesForPointer = 'pointerId' in event && internal.capturedMap.get(event.pointerId);\n\n // We only authorize stopPropagation...\n if (\n // ...if this pointer hasn't been captured\n !capturesForPointer ||\n // ... or if the hit object is capturing the pointer\n capturesForPointer.has(hit.eventObject)) {\n raycastEvent.stopped = localState.stopped = true;\n // Propagation is stopped, remove all other hover records\n // An event handler is only allowed to flush other handlers if it is hovered itself\n if (internal.hovered.size && Array.from(internal.hovered.values()).find(i => i.eventObject === hit.eventObject)) {\n // Objects cannot flush out higher up objects that have already caught the event\n const higher = intersections.slice(0, intersections.indexOf(hit));\n cancelPointer([...higher, hit]);\n }\n }\n },\n // there should be a distinction between target and currentTarget\n target: {\n hasPointerCapture,\n setPointerCapture,\n releasePointerCapture\n },\n currentTarget: {\n hasPointerCapture,\n setPointerCapture,\n releasePointerCapture\n },\n nativeEvent: event\n };\n\n // Call subscribers\n callback(raycastEvent);\n // Event bubbling may be interrupted by stopPropagation\n if (localState.stopped === true) break;\n }\n }\n return intersections;\n }\n function cancelPointer(intersections) {\n const {\n internal\n } = store.getState();\n for (const hoveredObj of internal.hovered.values()) {\n // When no objects were hit or the the hovered object wasn't found underneath the cursor\n // we call onPointerOut and delete the object from the hovered-elements map\n if (!intersections.length || !intersections.find(hit => hit.object === hoveredObj.object && hit.index === hoveredObj.index && hit.instanceId === hoveredObj.instanceId)) {\n const eventObject = hoveredObj.eventObject;\n const instance = eventObject.__r3f;\n const handlers = instance == null ? void 0 : instance.handlers;\n internal.hovered.delete(makeId(hoveredObj));\n if (instance != null && instance.eventCount) {\n // Clear out intersects, they are outdated by now\n const data = {\n ...hoveredObj,\n intersections\n };\n handlers.onPointerOut == null ? void 0 : handlers.onPointerOut(data);\n handlers.onPointerLeave == null ? void 0 : handlers.onPointerLeave(data);\n }\n }\n }\n }\n function pointerMissed(event, objects) {\n for (let i = 0; i < objects.length; i++) {\n const instance = objects[i].__r3f;\n instance == null ? void 0 : instance.handlers.onPointerMissed == null ? void 0 : instance.handlers.onPointerMissed(event);\n }\n }\n function handlePointer(name) {\n // Deal with cancelation\n switch (name) {\n case 'onPointerLeave':\n case 'onPointerCancel':\n return () => cancelPointer([]);\n case 'onLostPointerCapture':\n return event => {\n const {\n internal\n } = store.getState();\n if ('pointerId' in event && internal.capturedMap.has(event.pointerId)) {\n // If the object event interface had onLostPointerCapture, we'd call it here on every\n // object that's getting removed. We call it on the next frame because onLostPointerCapture\n // fires before onPointerUp. Otherwise pointerUp would never be called if the event didn't\n // happen in the object it originated from, leaving components in a in-between state.\n requestAnimationFrame(() => {\n // Only release if pointer-up didn't do it already\n if (internal.capturedMap.has(event.pointerId)) {\n internal.capturedMap.delete(event.pointerId);\n cancelPointer([]);\n }\n });\n }\n };\n }\n\n // Any other pointer goes here ...\n return function handleEvent(event) {\n const {\n onPointerMissed,\n internal\n } = store.getState();\n\n // prepareRay(event)\n internal.lastEvent.current = event;\n\n // Get fresh intersects\n const isPointerMove = name === 'onPointerMove';\n const isClickEvent = name === 'onClick' || name === 'onContextMenu' || name === 'onDoubleClick';\n const filter = isPointerMove ? filterPointerEvents : undefined;\n const hits = intersect(event, filter);\n const delta = isClickEvent ? calculateDistance(event) : 0;\n\n // Save initial coordinates on pointer-down\n if (name === 'onPointerDown') {\n internal.initialClick = [event.offsetX, event.offsetY];\n internal.initialHits = hits.map(hit => hit.eventObject);\n }\n\n // If a click yields no results, pass it back to the user as a miss\n // Missed events have to come first in order to establish user-land side-effect clean up\n if (isClickEvent && !hits.length) {\n if (delta <= 2) {\n pointerMissed(event, internal.interaction);\n if (onPointerMissed) onPointerMissed(event);\n }\n }\n // Take care of unhover\n if (isPointerMove) cancelPointer(hits);\n function onIntersect(data) {\n const eventObject = data.eventObject;\n const instance = eventObject.__r3f;\n const handlers = instance == null ? void 0 : instance.handlers;\n\n // Check presence of handlers\n if (!(instance != null && instance.eventCount)) return;\n\n /*\r\n MAYBE TODO, DELETE IF NOT: \r\n Check if the object is captured, captured events should not have intersects running in parallel\r\n But wouldn't it be better to just replace capturedMap with a single entry?\r\n Also, are we OK with straight up making picking up multiple objects impossible?\r\n \r\n const pointerId = (data as ThreeEvent).pointerId \r\n if (pointerId !== undefined) {\r\n const capturedMeshSet = internal.capturedMap.get(pointerId)\r\n if (capturedMeshSet) {\r\n const captured = capturedMeshSet.get(eventObject)\r\n if (captured && captured.localState.stopped) return\r\n }\r\n }*/\n\n if (isPointerMove) {\n // Move event ...\n if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {\n // When enter or out is present take care of hover-state\n const id = makeId(data);\n const hoveredItem = internal.hovered.get(id);\n if (!hoveredItem) {\n // If the object wasn't previously hovered, book it and call its handler\n internal.hovered.set(id, data);\n handlers.onPointerOver == null ? void 0 : handlers.onPointerOver(data);\n handlers.onPointerEnter == null ? void 0 : handlers.onPointerEnter(data);\n } else if (hoveredItem.stopped) {\n // If the object was previously hovered and stopped, we shouldn't allow other items to proceed\n data.stopPropagation();\n }\n }\n // Call mouse move\n handlers.onPointerMove == null ? void 0 : handlers.onPointerMove(data);\n } else {\n // All other events ...\n const handler = handlers[name];\n if (handler) {\n // Forward all events back to their respective handlers with the exception of click events,\n // which must use the initial target\n if (!isClickEvent || internal.initialHits.includes(eventObject)) {\n // Missed events have to come first\n pointerMissed(event, internal.interaction.filter(object => !internal.initialHits.includes(object)));\n // Now call the handler\n handler(data);\n }\n } else {\n // Trigger onPointerMissed on all elements that have pointer over/out handlers, but not click and weren't hit\n if (isClickEvent && internal.initialHits.includes(eventObject)) {\n pointerMissed(event, internal.interaction.filter(object => !internal.initialHits.includes(object)));\n }\n }\n }\n }\n handleIntersects(hits, event, delta, onIntersect);\n };\n }\n return {\n handlePointer\n };\n}\n\n// Keys that shouldn't be copied between R3F stores\nconst privateKeys = ['set', 'get', 'setSize', 'setFrameloop', 'setDpr', 'events', 'invalidate', 'advance', 'size', 'viewport'];\nconst isRenderer = def => !!(def != null && def.render);\nconst context = /*#__PURE__*/React.createContext(null);\nconst createStore = (invalidate, advance) => {\n const rootState = create((set, get) => {\n const position = new THREE.Vector3();\n const defaultTarget = new THREE.Vector3();\n const tempTarget = new THREE.Vector3();\n function getCurrentViewport(camera = get().camera, target = defaultTarget, size = get().size) {\n const {\n width,\n height,\n top,\n left\n } = size;\n const aspect = width / height;\n if (target instanceof THREE.Vector3) tempTarget.copy(target);else tempTarget.set(...target);\n const distance = camera.getWorldPosition(position).distanceTo(tempTarget);\n if (isOrthographicCamera(camera)) {\n return {\n width: width / camera.zoom,\n height: height / camera.zoom,\n top,\n left,\n factor: 1,\n distance,\n aspect\n };\n } else {\n const fov = camera.fov * Math.PI / 180; // convert vertical fov to radians\n const h = 2 * Math.tan(fov / 2) * distance; // visible height\n const w = h * (width / height);\n return {\n width: w,\n height: h,\n top,\n left,\n factor: width / w,\n distance,\n aspect\n };\n }\n }\n let performanceTimeout = undefined;\n const setPerformanceCurrent = current => set(state => ({\n performance: {\n ...state.performance,\n current\n }\n }));\n const pointer = new THREE.Vector2();\n const rootState = {\n set,\n get,\n // Mock objects that have to be configured\n gl: null,\n camera: null,\n raycaster: null,\n events: {\n priority: 1,\n enabled: true,\n connected: false\n },\n xr: null,\n scene: null,\n invalidate: (frames = 1) => invalidate(get(), frames),\n advance: (timestamp, runGlobalEffects) => advance(timestamp, runGlobalEffects, get()),\n legacy: false,\n linear: false,\n flat: false,\n controls: null,\n clock: new THREE.Clock(),\n pointer,\n mouse: pointer,\n frameloop: 'always',\n onPointerMissed: undefined,\n performance: {\n current: 1,\n min: 0.5,\n max: 1,\n debounce: 200,\n regress: () => {\n const state = get();\n // Clear timeout\n if (performanceTimeout) clearTimeout(performanceTimeout);\n // Set lower bound performance\n if (state.performance.current !== state.performance.min) setPerformanceCurrent(state.performance.min);\n // Go back to upper bound performance after a while unless something regresses meanwhile\n performanceTimeout = setTimeout(() => setPerformanceCurrent(get().performance.max), state.performance.debounce);\n }\n },\n size: {\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n updateStyle: false\n },\n viewport: {\n initialDpr: 0,\n dpr: 0,\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n aspect: 0,\n distance: 0,\n factor: 0,\n getCurrentViewport\n },\n setEvents: events => set(state => ({\n ...state,\n events: {\n ...state.events,\n ...events\n }\n })),\n setSize: (width, height, updateStyle, top, left) => {\n const camera = get().camera;\n const size = {\n width,\n height,\n top: top || 0,\n left: left || 0,\n updateStyle\n };\n set(state => ({\n size,\n viewport: {\n ...state.viewport,\n ...getCurrentViewport(camera, defaultTarget, size)\n }\n }));\n },\n setDpr: dpr => set(state => {\n const resolved = calculateDpr(dpr);\n return {\n viewport: {\n ...state.viewport,\n dpr: resolved,\n initialDpr: state.viewport.initialDpr || resolved\n }\n };\n }),\n setFrameloop: (frameloop = 'always') => {\n const clock = get().clock;\n\n // if frameloop === \"never\" clock.elapsedTime is updated using advance(timestamp)\n clock.stop();\n clock.elapsedTime = 0;\n if (frameloop !== 'never') {\n clock.start();\n clock.elapsedTime = 0;\n }\n set(() => ({\n frameloop\n }));\n },\n previousRoot: undefined,\n internal: {\n active: false,\n priority: 0,\n frames: 0,\n lastEvent: /*#__PURE__*/React.createRef(),\n interaction: [],\n hovered: new Map(),\n subscribers: [],\n initialClick: [0, 0],\n initialHits: [],\n capturedMap: new Map(),\n subscribe: (ref, priority, store) => {\n const internal = get().internal;\n // If this subscription was given a priority, it takes rendering into its own hands\n // For that reason we switch off automatic rendering and increase the manual flag\n // As long as this flag is positive there can be no internal rendering at all\n // because there could be multiple render subscriptions\n internal.priority = internal.priority + (priority > 0 ? 1 : 0);\n internal.subscribers.push({\n ref,\n priority,\n store\n });\n // Register subscriber and sort layers from lowest to highest, meaning,\n // highest priority renders last (on top of the other frames)\n internal.subscribers = internal.subscribers.sort((a, b) => a.priority - b.priority);\n return () => {\n const internal = get().internal;\n if (internal != null && internal.subscribers) {\n // Decrease manual flag if this subscription had a priority\n internal.priority = internal.priority - (priority > 0 ? 1 : 0);\n // Remove subscriber from list\n internal.subscribers = internal.subscribers.filter(s => s.ref !== ref);\n }\n };\n }\n }\n };\n return rootState;\n });\n const state = rootState.getState();\n let oldSize = state.size;\n let oldDpr = state.viewport.dpr;\n let oldCamera = state.camera;\n rootState.subscribe(() => {\n const {\n camera,\n size,\n viewport,\n gl,\n set\n } = rootState.getState();\n\n // Resize camera and renderer on changes to size and pixelratio\n if (size.width !== oldSize.width || size.height !== oldSize.height || viewport.dpr !== oldDpr) {\n var _size$updateStyle;\n oldSize = size;\n oldDpr = viewport.dpr;\n // Update camera & renderer\n updateCamera(camera, size);\n gl.setPixelRatio(viewport.dpr);\n const updateStyle = (_size$updateStyle = size.updateStyle) != null ? _size$updateStyle : typeof HTMLCanvasElement !== 'undefined' && gl.domElement instanceof HTMLCanvasElement;\n gl.setSize(size.width, size.height, updateStyle);\n }\n\n // Update viewport once the camera changes\n if (camera !== oldCamera) {\n oldCamera = camera;\n // Update viewport\n set(state => ({\n viewport: {\n ...state.viewport,\n ...state.viewport.getCurrentViewport(camera)\n }\n }));\n }\n });\n\n // Invalidate on any change\n rootState.subscribe(state => invalidate(state));\n\n // Return root state\n return rootState;\n};\n\nfunction createSubs(callback, subs) {\n const sub = {\n callback\n };\n subs.add(sub);\n return () => void subs.delete(sub);\n}\nlet i;\nlet globalEffects = new Set();\nlet globalAfterEffects = new Set();\nlet globalTailEffects = new Set();\n\n/**\r\n * Adds a global render callback which is called each frame.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect\r\n */\nconst addEffect = callback => createSubs(callback, globalEffects);\n\n/**\r\n * Adds a global after-render callback which is called each frame.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect\r\n */\nconst addAfterEffect = callback => createSubs(callback, globalAfterEffects);\n\n/**\r\n * Adds a global callback which is called when rendering stops.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail\r\n */\nconst addTail = callback => createSubs(callback, globalTailEffects);\nfunction run(effects, timestamp) {\n if (!effects.size) return;\n for (const {\n callback\n } of effects.values()) {\n callback(timestamp);\n }\n}\nfunction flushGlobalEffects(type, timestamp) {\n switch (type) {\n case 'before':\n return run(globalEffects, timestamp);\n case 'after':\n return run(globalAfterEffects, timestamp);\n case 'tail':\n return run(globalTailEffects, timestamp);\n }\n}\nlet subscribers;\nlet subscription;\nfunction render$1(timestamp, state, frame) {\n // Run local effects\n let delta = state.clock.getDelta();\n // In frameloop='never' mode, clock times are updated using the provided timestamp\n if (state.frameloop === 'never' && typeof timestamp === 'number') {\n delta = timestamp - state.clock.elapsedTime;\n state.clock.oldTime = state.clock.elapsedTime;\n state.clock.elapsedTime = timestamp;\n }\n // Call subscribers (useFrame)\n subscribers = state.internal.subscribers;\n for (i = 0; i < subscribers.length; i++) {\n subscription = subscribers[i];\n subscription.ref.current(subscription.store.getState(), delta, frame);\n }\n // Render content\n if (!state.internal.priority && state.gl.render) state.gl.render(state.scene, state.camera);\n // Decrease frame count\n state.internal.frames = Math.max(0, state.internal.frames - 1);\n return state.frameloop === 'always' ? 1 : state.internal.frames;\n}\nfunction createLoop(roots) {\n let running = false;\n let useFrameInProgress = false;\n let repeat;\n let frame;\n let state;\n function loop(timestamp) {\n frame = requestAnimationFrame(loop);\n running = true;\n repeat = 0;\n\n // Run effects\n flushGlobalEffects('before', timestamp);\n\n // Render all roots\n useFrameInProgress = true;\n for (const root of roots.values()) {\n var _state$gl$xr;\n state = root.store.getState();\n // If the frameloop is invalidated, do not run another frame\n if (state.internal.active && (state.frameloop === 'always' || state.internal.frames > 0) && !((_state$gl$xr = state.gl.xr) != null && _state$gl$xr.isPresenting)) {\n repeat += render$1(timestamp, state);\n }\n }\n useFrameInProgress = false;\n\n // Run after-effects\n flushGlobalEffects('after', timestamp);\n\n // Stop the loop if nothing invalidates it\n if (repeat === 0) {\n // Tail call effects, they are called when rendering stops\n flushGlobalEffects('tail', timestamp);\n\n // Flag end of operation\n running = false;\n return cancelAnimationFrame(frame);\n }\n }\n function invalidate(state, frames = 1) {\n var _state$gl$xr2;\n if (!state) return roots.forEach(root => invalidate(root.store.getState(), frames));\n if ((_state$gl$xr2 = state.gl.xr) != null && _state$gl$xr2.isPresenting || !state.internal.active || state.frameloop === 'never') return;\n if (frames > 1) {\n // legacy support for people using frames parameters\n // Increase frames, do not go higher than 60\n state.internal.frames = Math.min(60, state.internal.frames + frames);\n } else {\n if (useFrameInProgress) {\n //called from within a useFrame, it means the user wants an additional frame\n state.internal.frames = 2;\n } else {\n //the user need a new frame, no need to increment further than 1\n state.internal.frames = 1;\n }\n }\n\n // If the render-loop isn't active, start it\n if (!running) {\n running = true;\n requestAnimationFrame(loop);\n }\n }\n function advance(timestamp, runGlobalEffects = true, state, frame) {\n if (runGlobalEffects) flushGlobalEffects('before', timestamp);\n if (!state) for (const root of roots.values()) render$1(timestamp, root.store.getState());else render$1(timestamp, state, frame);\n if (runGlobalEffects) flushGlobalEffects('after', timestamp);\n }\n return {\n loop,\n invalidate,\n advance\n };\n}\n\n/**\r\n * Exposes an object's {@link LocalState}.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle\r\n *\r\n * **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.\r\n */\nfunction useInstanceHandle(ref) {\n const instance = React.useRef(null);\n useIsomorphicLayoutEffect(() => void (instance.current = ref.current.__r3f), [ref]);\n return instance;\n}\nfunction useStore() {\n const store = React.useContext(context);\n if (!store) throw new Error('R3F: Hooks can only be used within the Canvas component!');\n return store;\n}\n\n/**\r\n * Accesses R3F's internal state, containing renderer, canvas, scene, etc.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree\r\n */\nfunction useThree(selector = state => state, equalityFn) {\n return useStore()(selector, equalityFn);\n}\n\n/**\r\n * Executes a callback before render in a shared frame loop.\r\n * Can order effects with render priority or manually render with a positive priority.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe\r\n */\nfunction useFrame(callback, renderPriority = 0) {\n const store = useStore();\n const subscribe = store.getState().internal.subscribe;\n // Memoize ref\n const ref = useMutableCallback(callback);\n // Subscribe on mount, unsubscribe on unmount\n useIsomorphicLayoutEffect(() => subscribe(ref, renderPriority, store), [renderPriority, subscribe, store]);\n return null;\n}\n\n/**\r\n * Returns a node graph of an object with named nodes & materials.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph\r\n */\nfunction useGraph(object) {\n return React.useMemo(() => buildGraph(object), [object]);\n}\nconst memoizedLoaders = new WeakMap();\nfunction loadingFn(extensions, onProgress) {\n return function (Proto, ...input) {\n // Construct new loader and run extensions\n let loader = memoizedLoaders.get(Proto);\n if (!loader) {\n loader = new Proto();\n memoizedLoaders.set(Proto, loader);\n }\n if (extensions) extensions(loader);\n // Go through the urls and load them\n return Promise.all(input.map(input => new Promise((res, reject) => loader.load(input, data => {\n if (data.scene) Object.assign(data, buildGraph(data.scene));\n res(data);\n }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`))))));\n };\n}\n/**\r\n * Synchronously loads and caches assets with a three loader.\r\n *\r\n * Note: this hook's caller must be wrapped with `React.Suspense`\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader\r\n */\nfunction useLoader(Proto, input, extensions, onProgress) {\n // Use suspense to load async assets\n const keys = Array.isArray(input) ? input : [input];\n const results = suspend(loadingFn(extensions, onProgress), [Proto, ...keys], {\n equal: is.equ\n });\n // Return the object/s\n return Array.isArray(input) ? results : results[0];\n}\n\n/**\r\n * Preloads an asset into cache as a side-effect.\r\n */\nuseLoader.preload = function (Proto, input, extensions) {\n const keys = Array.isArray(input) ? input : [input];\n return preload(loadingFn(extensions), [Proto, ...keys]);\n};\n\n/**\r\n * Removes a loaded asset from cache.\r\n */\nuseLoader.clear = function (Proto, input) {\n const keys = Array.isArray(input) ? input : [input];\n return clear([Proto, ...keys]);\n};\n\nconst roots = new Map();\nconst {\n invalidate,\n advance\n} = createLoop(roots);\nconst {\n reconciler,\n applyProps\n} = createRenderer(roots, getEventPriority);\nconst shallowLoose = {\n objects: 'shallow',\n strict: false\n};\nconst createRendererInstance = (gl, canvas) => {\n const customRenderer = typeof gl === 'function' ? gl(canvas) : gl;\n if (isRenderer(customRenderer)) return customRenderer;else return new THREE.WebGLRenderer({\n powerPreference: 'high-performance',\n canvas: canvas,\n antialias: true,\n alpha: true,\n ...gl\n });\n};\nfunction computeInitialSize(canvas, defaultSize) {\n const defaultStyle = typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement;\n if (defaultSize) {\n const {\n width,\n height,\n top,\n left,\n updateStyle = defaultStyle\n } = defaultSize;\n return {\n width,\n height,\n top,\n left,\n updateStyle\n };\n } else if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement && canvas.parentElement) {\n const {\n width,\n height,\n top,\n left\n } = canvas.parentElement.getBoundingClientRect();\n return {\n width,\n height,\n top,\n left,\n updateStyle: defaultStyle\n };\n } else if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {\n return {\n width: canvas.width,\n height: canvas.height,\n top: 0,\n left: 0,\n updateStyle: defaultStyle\n };\n }\n return {\n width: 0,\n height: 0,\n top: 0,\n left: 0\n };\n}\nfunction createRoot(canvas) {\n // Check against mistaken use of createRoot\n const prevRoot = roots.get(canvas);\n const prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;\n const prevStore = prevRoot == null ? void 0 : prevRoot.store;\n if (prevRoot) console.warn('R3F.createRoot should only be called once!');\n\n // Report when an error was detected in a previous render\n // https://github.com/pmndrs/react-three-fiber/pull/2261\n const logRecoverableError = typeof reportError === 'function' ?\n // In modern browsers, reportError will dispatch an error event,\n // emulating an uncaught JavaScript error.\n reportError :\n // In older browsers and test environments, fallback to console.error.\n console.error;\n\n // Create store\n const store = prevStore || createStore(invalidate, advance);\n // Create renderer\n const fiber = prevFiber || reconciler.createContainer(store, ConcurrentRoot, null, false, null, '', logRecoverableError, null);\n // Map it\n if (!prevRoot) roots.set(canvas, {\n fiber,\n store\n });\n\n // Locals\n let onCreated;\n let configured = false;\n let lastCamera;\n return {\n configure(props = {}) {\n let {\n gl: glConfig,\n size: propsSize,\n scene: sceneOptions,\n events,\n onCreated: onCreatedCallback,\n shadows = false,\n linear = false,\n flat = false,\n legacy = false,\n orthographic = false,\n frameloop = 'always',\n dpr = [1, 2],\n performance,\n raycaster: raycastOptions,\n camera: cameraOptions,\n onPointerMissed\n } = props;\n let state = store.getState();\n\n // Set up renderer (one time only!)\n let gl = state.gl;\n if (!state.gl) state.set({\n gl: gl = createRendererInstance(glConfig, canvas)\n });\n\n // Set up raycaster (one time only!)\n let raycaster = state.raycaster;\n if (!raycaster) state.set({\n raycaster: raycaster = new THREE.Raycaster()\n });\n\n // Set raycaster options\n const {\n params,\n ...options\n } = raycastOptions || {};\n if (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, {\n ...options\n });\n if (!is.equ(params, raycaster.params, shallowLoose)) applyProps(raycaster, {\n params: {\n ...raycaster.params,\n ...params\n }\n });\n\n // Create default camera, don't overwrite any user-set state\n if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {\n lastCamera = cameraOptions;\n const isCamera = cameraOptions instanceof THREE.Camera;\n const camera = isCamera ? cameraOptions : orthographic ? new THREE.OrthographicCamera(0, 0, 0, 0, 0.1, 1000) : new THREE.PerspectiveCamera(75, 0, 0.1, 1000);\n if (!isCamera) {\n camera.position.z = 5;\n if (cameraOptions) {\n applyProps(camera, cameraOptions);\n // Preserve user-defined frustum if possible\n // https://github.com/pmndrs/react-three-fiber/issues/3160\n if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {\n camera.manual = true;\n camera.updateProjectionMatrix();\n }\n }\n // Always look at center by default\n if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);\n }\n state.set({\n camera\n });\n\n // Configure raycaster\n // https://github.com/pmndrs/react-xr/issues/300\n raycaster.camera = camera;\n }\n\n // Set up scene (one time only!)\n if (!state.scene) {\n let scene;\n if (sceneOptions instanceof THREE.Scene) {\n scene = sceneOptions;\n } else {\n scene = new THREE.Scene();\n if (sceneOptions) applyProps(scene, sceneOptions);\n }\n state.set({\n scene: prepare(scene)\n });\n }\n\n // Set up XR (one time only!)\n if (!state.xr) {\n var _gl$xr;\n // Handle frame behavior in WebXR\n const handleXRFrame = (timestamp, frame) => {\n const state = store.getState();\n if (state.frameloop === 'never') return;\n advance(timestamp, true, state, frame);\n };\n\n // Toggle render switching on session\n const handleSessionChange = () => {\n const state = store.getState();\n state.gl.xr.enabled = state.gl.xr.isPresenting;\n state.gl.xr.setAnimationLoop(state.gl.xr.isPresenting ? handleXRFrame : null);\n if (!state.gl.xr.isPresenting) invalidate(state);\n };\n\n // WebXR session manager\n const xr = {\n connect() {\n const gl = store.getState().gl;\n gl.xr.addEventListener('sessionstart', handleSessionChange);\n gl.xr.addEventListener('sessionend', handleSessionChange);\n },\n disconnect() {\n const gl = store.getState().gl;\n gl.xr.removeEventListener('sessionstart', handleSessionChange);\n gl.xr.removeEventListener('sessionend', handleSessionChange);\n }\n };\n\n // Subscribe to WebXR session events\n if (typeof ((_gl$xr = gl.xr) == null ? void 0 : _gl$xr.addEventListener) === 'function') xr.connect();\n state.set({\n xr\n });\n }\n\n // Set shadowmap\n if (gl.shadowMap) {\n const oldEnabled = gl.shadowMap.enabled;\n const oldType = gl.shadowMap.type;\n gl.shadowMap.enabled = !!shadows;\n if (is.boo(shadows)) {\n gl.shadowMap.type = THREE.PCFSoftShadowMap;\n } else if (is.str(shadows)) {\n var _types$shadows;\n const types = {\n basic: THREE.BasicShadowMap,\n percentage: THREE.PCFShadowMap,\n soft: THREE.PCFSoftShadowMap,\n variance: THREE.VSMShadowMap\n };\n gl.shadowMap.type = (_types$shadows = types[shadows]) != null ? _types$shadows : THREE.PCFSoftShadowMap;\n } else if (is.obj(shadows)) {\n Object.assign(gl.shadowMap, shadows);\n }\n if (oldEnabled !== gl.shadowMap.enabled || oldType !== gl.shadowMap.type) gl.shadowMap.needsUpdate = true;\n }\n\n // Safely set color management if available.\n // Avoid accessing THREE.ColorManagement to play nice with older versions\n const ColorManagement = getColorManagement();\n if (ColorManagement) {\n if ('enabled' in ColorManagement) ColorManagement.enabled = !legacy;else if ('legacyMode' in ColorManagement) ColorManagement.legacyMode = legacy;\n }\n if (!configured) {\n // Set color space and tonemapping preferences, once\n const LinearEncoding = 3000;\n const sRGBEncoding = 3001;\n applyProps(gl, {\n outputEncoding: linear ? LinearEncoding : sRGBEncoding,\n toneMapping: flat ? THREE.NoToneMapping : THREE.ACESFilmicToneMapping\n });\n }\n\n // Update color management state\n if (state.legacy !== legacy) state.set(() => ({\n legacy\n }));\n if (state.linear !== linear) state.set(() => ({\n linear\n }));\n if (state.flat !== flat) state.set(() => ({\n flat\n }));\n\n // Set gl props\n if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, gl, shallowLoose)) applyProps(gl, glConfig);\n // Store events internally\n if (events && !state.events.handlers) state.set({\n events: events(store)\n });\n // Check size, allow it to take on container bounds initially\n const size = computeInitialSize(canvas, propsSize);\n if (!is.equ(size, state.size, shallowLoose)) {\n state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);\n }\n // Check pixelratio\n if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr);\n // Check frameloop\n if (state.frameloop !== frameloop) state.setFrameloop(frameloop);\n // Check pointer missed\n if (!state.onPointerMissed) state.set({\n onPointerMissed\n });\n // Check performance\n if (performance && !is.equ(performance, state.performance, shallowLoose)) state.set(state => ({\n performance: {\n ...state.performance,\n ...performance\n }\n }));\n\n // Set locals\n onCreated = onCreatedCallback;\n configured = true;\n return this;\n },\n render(children) {\n // The root has to be configured before it can be rendered\n if (!configured) this.configure();\n reconciler.updateContainer( /*#__PURE__*/jsx(Provider, {\n store: store,\n children: children,\n onCreated: onCreated,\n rootElement: canvas\n }), fiber, null, () => undefined);\n return store;\n },\n unmount() {\n unmountComponentAtNode(canvas);\n }\n };\n}\nfunction render(children, canvas, config) {\n console.warn('R3F.render is no longer supported in React 18. Use createRoot instead!');\n const root = createRoot(canvas);\n root.configure(config);\n return root.render(children);\n}\nfunction Provider({\n store,\n children,\n onCreated,\n rootElement\n}) {\n useIsomorphicLayoutEffect(() => {\n const state = store.getState();\n // Flag the canvas active, rendering will now begin\n state.set(state => ({\n internal: {\n ...state.internal,\n active: true\n }\n }));\n // Notifiy that init is completed, the scene graph exists, but nothing has yet rendered\n if (onCreated) onCreated(state);\n // Connect events to the targets parent, this is done to ensure events are registered on\n // a shared target, and not on the canvas itself\n if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return /*#__PURE__*/jsx(context.Provider, {\n value: store,\n children: children\n });\n}\nfunction unmountComponentAtNode(canvas, callback) {\n const root = roots.get(canvas);\n const fiber = root == null ? void 0 : root.fiber;\n if (fiber) {\n const state = root == null ? void 0 : root.store.getState();\n if (state) state.internal.active = false;\n reconciler.updateContainer(null, fiber, null, () => {\n if (state) {\n setTimeout(() => {\n try {\n var _state$gl, _state$gl$renderLists, _state$gl2, _state$gl3;\n state.events.disconnect == null ? void 0 : state.events.disconnect();\n (_state$gl = state.gl) == null ? void 0 : (_state$gl$renderLists = _state$gl.renderLists) == null ? void 0 : _state$gl$renderLists.dispose == null ? void 0 : _state$gl$renderLists.dispose();\n (_state$gl2 = state.gl) == null ? void 0 : _state$gl2.forceContextLoss == null ? void 0 : _state$gl2.forceContextLoss();\n if ((_state$gl3 = state.gl) != null && _state$gl3.xr) state.xr.disconnect();\n dispose(state);\n roots.delete(canvas);\n if (callback) callback(canvas);\n } catch (e) {\n /* ... */\n }\n }, 500);\n }\n });\n }\n}\nfunction createPortal(children, container, state) {\n return /*#__PURE__*/jsx(Portal, {\n children: children,\n container: container,\n state: state\n }, container.uuid);\n}\nfunction Portal({\n state = {},\n children,\n container\n}) {\n /** This has to be a component because it would not be able to call useThree/useStore otherwise since\r\n * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger\r\n * the \"R3F hooks can only be used within the Canvas component!\" warning:\r\n * \r\n * {createPortal(...)} */\n const {\n events,\n size,\n ...rest\n } = state;\n const previousRoot = useStore();\n const [raycaster] = React.useState(() => new THREE.Raycaster());\n const [pointer] = React.useState(() => new THREE.Vector2());\n const inject = React.useCallback((rootState, injectState) => {\n const intersect = {\n ...rootState\n }; // all prev state props\n\n // Only the fields of \"rootState\" that do not differ from injectState\n // Some props should be off-limits\n // Otherwise filter out the props that are different and let the inject layer take precedence\n Object.keys(rootState).forEach(key => {\n if (\n // Some props should be off-limits\n privateKeys.includes(key) ||\n // Otherwise filter out the props that are different and let the inject layer take precedence\n // Unless the inject layer props is undefined, then we keep the root layer\n rootState[key] !== injectState[key] && injectState[key]) {\n delete intersect[key];\n }\n });\n let viewport = undefined;\n if (injectState && size) {\n const camera = injectState.camera;\n // Calculate the override viewport, if present\n viewport = rootState.viewport.getCurrentViewport(camera, new THREE.Vector3(), size);\n // Update the portal camera, if it differs from the previous layer\n if (camera !== rootState.camera) updateCamera(camera, size);\n }\n return {\n // The intersect consists of the previous root state\n ...intersect,\n // Portals have their own scene, which forms the root, a raycaster and a pointer\n scene: container,\n raycaster,\n pointer,\n mouse: pointer,\n // Their previous root is the layer before it\n previousRoot,\n // Events, size and viewport can be overridden by the inject layer\n events: {\n ...rootState.events,\n ...(injectState == null ? void 0 : injectState.events),\n ...events\n },\n size: {\n ...rootState.size,\n ...size\n },\n viewport: {\n ...rootState.viewport,\n ...viewport\n },\n ...rest\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [state]);\n const [usePortalStore] = React.useState(() => {\n // Create a mirrored store, based on the previous root with a few overrides ...\n const previousState = previousRoot.getState();\n const store = create((set, get) => ({\n ...previousState,\n scene: container,\n raycaster,\n pointer,\n mouse: pointer,\n previousRoot,\n events: {\n ...previousState.events,\n ...events\n },\n size: {\n ...previousState.size,\n ...size\n },\n ...rest,\n // Set and get refer to this root-state\n set,\n get,\n // Layers are allowed to override events\n setEvents: events => set(state => ({\n ...state,\n events: {\n ...state.events,\n ...events\n }\n }))\n }));\n return store;\n });\n React.useEffect(() => {\n // Subscribe to previous root-state and copy changes over to the mirrored portal-state\n const unsub = previousRoot.subscribe(prev => usePortalStore.setState(state => inject(prev, state)));\n return () => {\n unsub();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inject]);\n React.useEffect(() => {\n usePortalStore.setState(injectState => inject(previousRoot.getState(), injectState));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inject]);\n React.useEffect(() => {\n return () => {\n usePortalStore.destroy();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return /*#__PURE__*/jsx(Fragment, {\n children: reconciler.createPortal( /*#__PURE__*/jsx(context.Provider, {\n value: usePortalStore,\n children: children\n }), usePortalStore, null)\n });\n}\nreconciler.injectIntoDevTools({\n bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,\n rendererPackageName: '@react-three/fiber',\n version: React.version\n});\nconst act = React.unstable_act;\n\nexport { useThree as A, Block as B, useFrame as C, useGraph as D, ErrorBoundary as E, useLoader as F, useIsomorphicLayoutEffect as a, createRoot as b, createEvents as c, unmountComponentAtNode as d, extend as e, context as f, createPortal as g, reconciler as h, isRef as i, applyProps as j, dispose as k, invalidate as l, advance as m, addEffect as n, addAfterEffect as o, addTail as p, flushGlobalEffects as q, render as r, getRootState as s, threeTypes as t, useMutableCallback as u, act as v, buildGraph as w, roots as x, useInstanceHandle as y, useStore as z };\n", "import { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect } from 'react';\n\nfunction createStore(createState) {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (nextState !== state) {\n const previousState = state;\n state = replace ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const subscribeWithSelector = (listener, selector = getState, equalityFn = Object.is) => {\n console.warn(\"[DEPRECATED] Please use `subscribeWithSelector` middleware\");\n let currentSlice = selector(state);\n function listenerToAdd() {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n listener(currentSlice = nextSlice, previousSlice);\n }\n }\n listeners.add(listenerToAdd);\n return () => listeners.delete(listenerToAdd);\n };\n const subscribe = (listener, selector, equalityFn) => {\n if (selector || equalityFn) {\n return subscribeWithSelector(listener, selector, equalityFn);\n }\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => listeners.clear();\n const api = { setState, getState, subscribe, destroy };\n state = createState(setState, getState, api);\n return api;\n}\n\nconst isSSR = typeof window === \"undefined\" || !window.navigator || /ServerSideRendering|^Deno\\//.test(window.navigator.userAgent);\nconst useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;\nfunction create(createState) {\n const api = typeof createState === \"function\" ? createStore(createState) : createState;\n const useStore = (selector = api.getState, equalityFn = Object.is) => {\n const [, forceUpdate] = useReducer((c) => c + 1, 0);\n const state = api.getState();\n const stateRef = useRef(state);\n const selectorRef = useRef(selector);\n const equalityFnRef = useRef(equalityFn);\n const erroredRef = useRef(false);\n const currentSliceRef = useRef();\n if (currentSliceRef.current === void 0) {\n currentSliceRef.current = selector(state);\n }\n let newStateSlice;\n let hasNewStateSlice = false;\n if (stateRef.current !== state || selectorRef.current !== selector || equalityFnRef.current !== equalityFn || erroredRef.current) {\n newStateSlice = selector(state);\n hasNewStateSlice = !equalityFn(currentSliceRef.current, newStateSlice);\n }\n useIsomorphicLayoutEffect(() => {\n if (hasNewStateSlice) {\n currentSliceRef.current = newStateSlice;\n }\n stateRef.current = state;\n selectorRef.current = selector;\n equalityFnRef.current = equalityFn;\n erroredRef.current = false;\n });\n const stateBeforeSubscriptionRef = useRef(state);\n useIsomorphicLayoutEffect(() => {\n const listener = () => {\n try {\n const nextState = api.getState();\n const nextStateSlice = selectorRef.current(nextState);\n if (!equalityFnRef.current(currentSliceRef.current, nextStateSlice)) {\n stateRef.current = nextState;\n currentSliceRef.current = nextStateSlice;\n forceUpdate();\n }\n } catch (error) {\n erroredRef.current = true;\n forceUpdate();\n }\n };\n const unsubscribe = api.subscribe(listener);\n if (api.getState() !== stateBeforeSubscriptionRef.current) {\n listener();\n }\n return unsubscribe;\n }, []);\n const sliceToReturn = hasNewStateSlice ? newStateSlice : currentSliceRef.current;\n useDebugValue(sliceToReturn);\n return sliceToReturn;\n };\n Object.assign(useStore, api);\n useStore[Symbol.iterator] = function() {\n console.warn(\"[useStore, api] = create() is deprecated and will be removed in v4\");\n const items = [useStore, api];\n return {\n next() {\n const done = items.length <= 0;\n return { value: items.shift(), done };\n }\n };\n };\n return useStore;\n}\n\nexport { create as default };\n", "const isPromise = promise => typeof promise === 'object' && typeof promise.then === 'function';\n\nconst globalCache = [];\n\nfunction shallowEqualArrays(arrA, arrB, equal = (a, b) => a === b) {\n if (arrA === arrB) return true;\n if (!arrA || !arrB) return false;\n const len = arrA.length;\n if (arrB.length !== len) return false;\n\n for (let i = 0; i < len; i++) if (!equal(arrA[i], arrB[i])) return false;\n\n return true;\n}\n\nfunction query(fn, keys = null, preload = false, config = {}) {\n // If no keys were given, the function is the key\n if (keys === null) keys = [fn];\n\n for (const entry of globalCache) {\n // Find a match\n if (shallowEqualArrays(keys, entry.keys, entry.equal)) {\n // If we're pre-loading and the element is present, just return\n if (preload) return undefined; // If an error occurred, throw\n\n if (Object.prototype.hasOwnProperty.call(entry, 'error')) throw entry.error; // If a response was successful, return\n\n if (Object.prototype.hasOwnProperty.call(entry, 'response')) {\n if (config.lifespan && config.lifespan > 0) {\n if (entry.timeout) clearTimeout(entry.timeout);\n entry.timeout = setTimeout(entry.remove, config.lifespan);\n }\n\n return entry.response;\n } // If the promise is still unresolved, throw\n\n\n if (!preload) throw entry.promise;\n }\n } // The request is new or has changed.\n\n\n const entry = {\n keys,\n equal: config.equal,\n remove: () => {\n const index = globalCache.indexOf(entry);\n if (index !== -1) globalCache.splice(index, 1);\n },\n promise: // Execute the promise\n (isPromise(fn) ? fn : fn(...keys) // When it resolves, store its value\n ).then(response => {\n entry.response = response; // Remove the entry in time if a lifespan was given\n\n if (config.lifespan && config.lifespan > 0) {\n entry.timeout = setTimeout(entry.remove, config.lifespan);\n }\n }) // Store caught errors, they will be thrown in the render-phase to bubble into an error-bound\n .catch(error => entry.error = error)\n }; // Register the entry\n\n globalCache.push(entry); // And throw the promise, this yields control back to React\n\n if (!preload) throw entry.promise;\n return undefined;\n}\n\nconst suspend = (fn, keys, config) => query(fn, keys, false, config);\n\nconst preload = (fn, keys, config) => void query(fn, keys, true, config);\n\nconst peek = keys => {\n var _globalCache$find;\n\n return (_globalCache$find = globalCache.find(entry => shallowEqualArrays(keys, entry.keys, entry.equal))) == null ? void 0 : _globalCache$find.response;\n};\n\nconst clear = keys => {\n if (keys === undefined || keys.length === 0) globalCache.splice(0, globalCache.length);else {\n const entry = globalCache.find(entry => shallowEqualArrays(keys, entry.keys, entry.equal));\n if (entry) entry.remove();\n }\n};\n\nexport { clear, peek, preload, suspend };\n", "import { useState, useRef, useEffect, useMemo } from 'react';\nimport createDebounce from 'debounce';\n\nfunction useMeasure(_temp) {\n let {\n debounce,\n scroll,\n polyfill,\n offsetSize\n } = _temp === void 0 ? {\n debounce: 0,\n scroll: false,\n offsetSize: false\n } : _temp;\n const ResizeObserver = polyfill || (typeof window === 'undefined' ? class ResizeObserver {} : window.ResizeObserver);\n\n if (!ResizeObserver) {\n throw new Error('This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills');\n }\n\n const [bounds, set] = useState({\n left: 0,\n top: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n x: 0,\n y: 0\n }); // keep all state in a ref\n\n const state = useRef({\n element: null,\n scrollContainers: null,\n resizeObserver: null,\n lastBounds: bounds\n }); // set actual debounce values early, so effects know if they should react accordingly\n\n const scrollDebounce = debounce ? typeof debounce === 'number' ? debounce : debounce.scroll : null;\n const resizeDebounce = debounce ? typeof debounce === 'number' ? debounce : debounce.resize : null; // make sure to update state only as long as the component is truly mounted\n\n const mounted = useRef(false);\n useEffect(() => {\n mounted.current = true;\n return () => void (mounted.current = false);\n }); // memoize handlers, so event-listeners know when they should update\n\n const [forceRefresh, resizeChange, scrollChange] = useMemo(() => {\n const callback = () => {\n if (!state.current.element) return;\n const {\n left,\n top,\n width,\n height,\n bottom,\n right,\n x,\n y\n } = state.current.element.getBoundingClientRect();\n const size = {\n left,\n top,\n width,\n height,\n bottom,\n right,\n x,\n y\n };\n\n if (state.current.element instanceof HTMLElement && offsetSize) {\n size.height = state.current.element.offsetHeight;\n size.width = state.current.element.offsetWidth;\n }\n\n Object.freeze(size);\n if (mounted.current && !areBoundsEqual(state.current.lastBounds, size)) set(state.current.lastBounds = size);\n };\n\n return [callback, resizeDebounce ? createDebounce(callback, resizeDebounce) : callback, scrollDebounce ? createDebounce(callback, scrollDebounce) : callback];\n }, [set, offsetSize, scrollDebounce, resizeDebounce]); // cleanup current scroll-listeners / observers\n\n function removeListeners() {\n if (state.current.scrollContainers) {\n state.current.scrollContainers.forEach(element => element.removeEventListener('scroll', scrollChange, true));\n state.current.scrollContainers = null;\n }\n\n if (state.current.resizeObserver) {\n state.current.resizeObserver.disconnect();\n state.current.resizeObserver = null;\n }\n } // add scroll-listeners / observers\n\n\n function addListeners() {\n if (!state.current.element) return;\n state.current.resizeObserver = new ResizeObserver(scrollChange);\n state.current.resizeObserver.observe(state.current.element);\n\n if (scroll && state.current.scrollContainers) {\n state.current.scrollContainers.forEach(scrollContainer => scrollContainer.addEventListener('scroll', scrollChange, {\n capture: true,\n passive: true\n }));\n }\n } // the ref we expose to the user\n\n\n const ref = node => {\n if (!node || node === state.current.element) return;\n removeListeners();\n state.current.element = node;\n state.current.scrollContainers = findScrollContainers(node);\n addListeners();\n }; // add general event listeners\n\n\n useOnWindowScroll(scrollChange, Boolean(scroll));\n useOnWindowResize(resizeChange); // respond to changes that are relevant for the listeners\n\n useEffect(() => {\n removeListeners();\n addListeners();\n }, [scroll, scrollChange, resizeChange]); // remove all listeners when the components unmounts\n\n useEffect(() => removeListeners, []);\n return [ref, bounds, forceRefresh];\n} // Adds native resize listener to window\n\n\nfunction useOnWindowResize(onWindowResize) {\n useEffect(() => {\n const cb = onWindowResize;\n window.addEventListener('resize', cb);\n return () => void window.removeEventListener('resize', cb);\n }, [onWindowResize]);\n}\n\nfunction useOnWindowScroll(onScroll, enabled) {\n useEffect(() => {\n if (enabled) {\n const cb = onScroll;\n window.addEventListener('scroll', cb, {\n capture: true,\n passive: true\n });\n return () => void window.removeEventListener('scroll', cb, true);\n }\n }, [onScroll, enabled]);\n} // Returns a list of scroll offsets\n\n\nfunction findScrollContainers(element) {\n const result = [];\n if (!element || element === document.body) return result;\n const {\n overflow,\n overflowX,\n overflowY\n } = window.getComputedStyle(element);\n if ([overflow, overflowX, overflowY].some(prop => prop === 'auto' || prop === 'scroll')) result.push(element);\n return [...result, ...findScrollContainers(element.parentElement)];\n} // Checks if element boundaries are equal\n\n\nconst keys = ['x', 'y', 'top', 'bottom', 'left', 'right', 'width', 'height'];\n\nconst areBoundsEqual = (a, b) => keys.every(key => a[key] === b[key]);\n\nexport { useMeasure as default };\n", "import * as React from 'react'\nimport type ReactReconciler from 'react-reconciler'\n\n/**\n * Represents a react-internal Fiber node.\n */\nexport type Fiber = Omit & { stateNode: T }\n\n/**\n * Represents a {@link Fiber} node selector for traversal.\n */\nexport type FiberSelector = (\n /** The current {@link Fiber} node. */\n node: Fiber,\n) => boolean | void\n\n/**\n * Traverses up or down a {@link Fiber}, return `true` to stop and select a node.\n */\nexport function traverseFiber(\n /** Input {@link Fiber} to traverse. */\n fiber: Fiber | undefined,\n /** Whether to ascend and walk up the tree. Will walk down if `false`. */\n ascending: boolean,\n /** A {@link Fiber} node selector, returns the first match when `true` is passed. */\n selector: FiberSelector,\n): Fiber | undefined {\n if (!fiber) return\n if (selector(fiber) === true) return fiber\n\n let child = ascending ? fiber.return : fiber.child\n while (child) {\n const match = traverseFiber(child, ascending, selector)\n if (match) return match\n\n child = ascending ? null : child.sibling\n }\n}\n\n// In development, React will warn about using contexts between renderers.\n// Hide the warning because its-fine fixes this issue\n// https://github.com/facebook/react/pull/12779\nfunction wrapContext(context: React.Context): React.Context {\n try {\n return Object.defineProperties(context, {\n _currentRenderer: {\n get() {\n return null\n },\n set() {},\n },\n _currentRenderer2: {\n get() {\n return null\n },\n set() {},\n },\n })\n } catch (_) {\n return context\n }\n}\n\nconst FiberContext = wrapContext(React.createContext(null!))\n\n/**\n * A react-internal {@link Fiber} provider. This component binds React children to the React Fiber tree. Call its-fine hooks within this.\n */\nexport class FiberProvider extends React.Component<{ children?: React.ReactNode }> {\n private _reactInternals!: Fiber\n\n render() {\n return {this.props.children}\n }\n}\n\ninterface ReactInternal {\n __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {\n ReactCurrentOwner: React.RefObject\n ReactCurrentDispatcher: React.RefObject<{ readContext(context: React.Context): T }>\n }\n}\n\nconst { ReactCurrentOwner, ReactCurrentDispatcher } = (React as unknown as ReactInternal)\n .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n\n/**\n * Returns the current react-internal {@link Fiber}. This is an implementation detail of [react-reconciler](https://github.com/facebook/react/tree/main/packages/react-reconciler).\n */\nexport function useFiber(): Fiber | undefined {\n const root = React.useContext(FiberContext)\n if (root === null) throw new Error('its-fine: useFiber must be called within a !')\n\n // In development mode, React will expose the current component's Fiber as ReactCurrentOwner.\n // In production, we don't have this luxury and must traverse from FiberProvider via useId\n const id = React.useId()\n const fiber = React.useMemo(() => {\n for (const maybeFiber of [ReactCurrentOwner?.current, root, root?.alternate]) {\n if (!maybeFiber) continue\n const fiber = traverseFiber(maybeFiber, false, (node) => {\n let state = node.memoizedState\n while (state) {\n if (state.memoizedState === id) return true\n state = state.next\n }\n })\n if (fiber) return fiber\n }\n }, [root, id])\n\n return fiber\n}\n\n/**\n * Represents a react-reconciler container instance.\n */\nexport interface ContainerInstance {\n containerInfo: T\n}\n\n/**\n * Returns the current react-reconciler container info passed to {@link ReactReconciler.Reconciler.createContainer}.\n *\n * In react-dom, a container will point to the root DOM element; in react-three-fiber, it will point to the root Zustand store.\n */\nexport function useContainer(): T | undefined {\n const fiber = useFiber()\n const root = React.useMemo(\n () => traverseFiber>(fiber, true, (node) => node.stateNode?.containerInfo != null),\n [fiber],\n )\n\n return root?.stateNode.containerInfo\n}\n\n/**\n * Returns the nearest react-reconciler child instance or the node created from {@link ReactReconciler.HostConfig.createInstance}.\n *\n * In react-dom, this would be a DOM element; in react-three-fiber this would be an instance descriptor.\n */\nexport function useNearestChild(\n /** An optional element type to filter to. */\n type?: keyof JSX.IntrinsicElements,\n): React.MutableRefObject {\n const fiber = useFiber()\n const childRef = React.useRef()\n\n React.useLayoutEffect(() => {\n childRef.current = traverseFiber(\n fiber,\n false,\n (node) => typeof node.type === 'string' && (type === undefined || node.type === type),\n )?.stateNode\n }, [fiber])\n\n return childRef\n}\n\n/**\n * Returns the nearest react-reconciler parent instance or the node created from {@link ReactReconciler.HostConfig.createInstance}.\n *\n * In react-dom, this would be a DOM element; in react-three-fiber this would be an instance descriptor.\n */\nexport function useNearestParent(\n /** An optional element type to filter to. */\n type?: keyof JSX.IntrinsicElements,\n): React.MutableRefObject {\n const fiber = useFiber()\n const parentRef = React.useRef()\n\n React.useLayoutEffect(() => {\n parentRef.current = traverseFiber(\n fiber,\n true,\n (node) => typeof node.type === 'string' && (type === undefined || node.type === type),\n )?.stateNode\n }, [fiber])\n\n return parentRef\n}\n\nexport type ContextMap = Map, any> & {\n get(context: React.Context): T | undefined\n}\n\n/**\n * Returns a map of all contexts and their values.\n */\nexport function useContextMap(): ContextMap {\n const fiber = useFiber()\n const [contextMap] = React.useState(() => new Map, any>())\n\n // Collect live context\n contextMap.clear()\n let node = fiber\n while (node) {\n const context = node.type?._context\n if (context && context !== FiberContext && !contextMap.has(context)) {\n contextMap.set(context, ReactCurrentDispatcher?.current?.readContext(wrapContext(context)))\n }\n node = node.return!\n }\n\n return contextMap\n}\n\n/**\n * Represents a react-context bridge provider component.\n */\nexport type ContextBridge = React.FC>\n\n/**\n * React Context currently cannot be shared across [React renderers](https://reactjs.org/docs/codebase-overview.html#renderers) but explicitly forwarded between providers (see [react#17275](https://github.com/facebook/react/issues/17275)). This hook returns a {@link ContextBridge} of live context providers to pierce Context across renderers.\n *\n * Pass {@link ContextBridge} as a component to a secondary renderer to enable context-sharing within its children.\n */\nexport function useContextBridge(): ContextBridge {\n const contextMap = useContextMap()\n\n // Flatten context and their memoized values into a `ContextBridge` provider\n return React.useMemo(\n () =>\n Array.from(contextMap.keys()).reduce(\n (Prev, context) => (props) =>\n (\n \n \n \n ),\n (props) => ,\n ),\n [contextMap],\n )\n}\n", "import { MD2CharacterComplex } from \"./misc/MD2CharacterComplex.js\";\nimport { ConvexObjectBreaker } from \"./misc/ConvexObjectBreaker.js\";\nimport { MorphBlendMesh } from \"./misc/MorphBlendMesh.js\";\nimport { GPUComputationRenderer } from \"./misc/GPUComputationRenderer.js\";\nimport { Gyroscope } from \"./misc/Gyroscope.js\";\nimport { MorphAnimMesh } from \"./misc/MorphAnimMesh.js\";\nimport { RollerCoasterGeometry, RollerCoasterLiftersGeometry, RollerCoasterShadowGeometry, SkyGeometry, TreesGeometry } from \"./misc/RollerCoaster.js\";\nimport { Timer } from \"./misc/Timer.js\";\nimport { getErrorMessage, getWebGL2ErrorMessage, getWebGLErrorMessage, isWebGL2Available, isWebGLAvailable } from \"./misc/WebGL.js\";\nimport { MD2Character } from \"./misc/MD2Character.js\";\nimport { VolumeSlice } from \"./misc/VolumeSlice.js\";\nimport { TubePainter } from \"./misc/TubePainter.js\";\nimport { Volume } from \"./misc/Volume.js\";\nimport { ProgressiveLightMap } from \"./misc/ProgressiveLightmap.js\";\nimport { CSS2DObject, CSS2DRenderer } from \"./renderers/CSS2DRenderer.js\";\nimport { CSS3DObject, CSS3DRenderer, CSS3DSprite } from \"./renderers/CSS3DRenderer.js\";\nimport { Projector, RenderableFace, RenderableLine, RenderableObject, RenderableSprite, RenderableVertex } from \"./renderers/Projector.js\";\nimport { SVGObject, SVGRenderer } from \"./renderers/SVGRenderer.js\";\nimport { FlakesTexture } from \"./textures/FlakesTexture.js\";\nimport { Flow, InstancedFlow, getUniforms, initSplineTexture, modifyShader, updateSplineTexture } from \"./modifiers/CurveModifier.js\";\nimport { SimplifyModifier } from \"./modifiers/SimplifyModifier.js\";\nimport { EdgeSplitModifier } from \"./modifiers/EdgeSplitModifier.js\";\nimport { TessellateModifier } from \"./modifiers/TessellateModifier.js\";\nimport { GLTFExporter } from \"./exporters/GLTFExporter.js\";\nimport { USDZExporter } from \"./exporters/USDZExporter.js\";\nimport { PLYExporter } from \"./exporters/PLYExporter.js\";\nimport { DRACOExporter } from \"./exporters/DRACOExporter.js\";\nimport { ColladaExporter } from \"./exporters/ColladaExporter.js\";\nimport { MMDExporter } from \"./exporters/MMDExporter.js\";\nimport { STLExporter } from \"./exporters/STLExporter.js\";\nimport { OBJExporter } from \"./exporters/OBJExporter.js\";\nimport { RoomEnvironment } from \"./environments/RoomEnvironment.js\";\nimport { AnimationClipCreator } from \"./animation/AnimationClipCreator.js\";\nimport { CCDIKHelper, CCDIKSolver } from \"./animation/CCDIKSolver.js\";\nimport { MMDPhysics } from \"./animation/MMDPhysics.js\";\nimport { MMDAnimationHelper } from \"./animation/MMDAnimationHelper.js\";\nimport { BatchedMesh } from \"./objects/BatchedMesh.js\";\nimport { Reflector } from \"./objects/Reflector.js\";\nimport { Refractor } from \"./objects/Refractor.js\";\nimport { ShadowMesh } from \"./objects/ShadowMesh.js\";\nimport { Lensflare, LensflareElement } from \"./objects/Lensflare.js\";\nimport { Water } from \"./objects/Water.js\";\nimport { MarchingCubes, edgeTable, triTable } from \"./objects/MarchingCubes.js\";\nimport { LightningStorm } from \"./objects/LightningStorm.js\";\nimport { ReflectorRTT } from \"./objects/ReflectorRTT.js\";\nimport { ReflectorForSSRPass } from \"./objects/ReflectorForSSRPass.js\";\nimport { Sky } from \"./objects/Sky.js\";\nimport { Water2 } from \"./objects/Water2.js\";\nimport { GroundProjectedEnv } from \"./objects/GroundProjectedEnv.js\";\nimport { SceneUtils } from \"./utils/SceneUtils.js\";\nimport { UVsDebug } from \"./utils/UVsDebug.js\";\nimport { GeometryUtils } from \"./utils/GeometryUtils.js\";\nimport { RoughnessMipmapper } from \"./utils/RoughnessMipmapper.js\";\nimport { SkeletonUtils } from \"./utils/SkeletonUtils.js\";\nimport { ShadowMapViewer } from \"./utils/ShadowMapViewer.js\";\nimport { computeMorphedAttributes, estimateBytesUsed, interleaveAttributes, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, toCreasedNormals, toTrianglesDrawMode } from \"./utils/BufferGeometryUtils.js\";\nimport { GeometryCompressionUtils, PackedPhongMaterial } from \"./utils/GeometryCompressionUtils.js\";\nimport { CinematicCamera } from \"./cameras/CinematicCamera.js\";\nimport { ConvexHull, Face, HalfEdge, VertexList, VertexNode } from \"./math/ConvexHull.js\";\nimport { MeshSurfaceSampler } from \"./math/MeshSurfaceSampler.js\";\nimport { SimplexNoise } from \"./math/SimplexNoise.js\";\nimport { OBB } from \"./math/OBB.js\";\nimport { Capsule } from \"./math/Capsule.js\";\nimport { ColorConverter } from \"./math/ColorConverter.js\";\nimport { ImprovedNoise } from \"./math/ImprovedNoise.js\";\nimport { Octree } from \"./math/Octree.js\";\nimport { ColorMapKeywords, Lut } from \"./math/Lut.js\";\nimport { CameraControls, MapControlsExp, OrbitControlsExp, STATE, TrackballControlsExp } from \"./controls/experimental/CameraControls.js\";\nimport { FirstPersonControls } from \"./controls/FirstPersonControls.js\";\nimport { TransformControls, TransformControlsGizmo, TransformControlsPlane } from \"./controls/TransformControls.js\";\nimport { DragControls } from \"./controls/DragControls.js\";\nimport { PointerLockControls } from \"./controls/PointerLockControls.js\";\nimport { DeviceOrientationControls } from \"./controls/DeviceOrientationControls.js\";\nimport { TrackballControls } from \"./controls/TrackballControls.js\";\nimport { MapControls, OrbitControls } from \"./controls/OrbitControls.js\";\nimport { ArcballControls } from \"./controls/ArcballControls.js\";\nimport { FlyControls } from \"./controls/FlyControls.js\";\nimport { LUTPass } from \"./postprocessing/LUTPass.js\";\nimport { ClearPass } from \"./postprocessing/ClearPass.js\";\nimport { GlitchPass } from \"./postprocessing/GlitchPass.js\";\nimport { HalftonePass } from \"./postprocessing/HalftonePass.js\";\nimport { SMAAPass } from \"./postprocessing/SMAAPass.js\";\nimport { FilmPass } from \"./postprocessing/FilmPass.js\";\nimport { OutlinePass } from \"./postprocessing/OutlinePass.js\";\nimport { SSAOPass } from \"./postprocessing/SSAOPass.js\";\nimport { SavePass } from \"./postprocessing/SavePass.js\";\nimport { BokehPass } from \"./postprocessing/BokehPass.js\";\nimport { FullScreenQuad, Pass } from \"./postprocessing/Pass.js\";\nimport { TexturePass } from \"./postprocessing/TexturePass.js\";\nimport { AdaptiveToneMappingPass } from \"./postprocessing/AdaptiveToneMappingPass.js\";\nimport { UnrealBloomPass } from \"./postprocessing/UnrealBloomPass.js\";\nimport { CubeTexturePass } from \"./postprocessing/CubeTexturePass.js\";\nimport { SAOPass } from \"./postprocessing/SAOPass.js\";\nimport { AfterimagePass } from \"./postprocessing/AfterimagePass.js\";\nimport { ClearMaskPass, MaskPass } from \"./postprocessing/MaskPass.js\";\nimport { EffectComposer } from \"./postprocessing/EffectComposer.js\";\nimport { DotScreenPass } from \"./postprocessing/DotScreenPass.js\";\nimport { SSRPass } from \"./postprocessing/SSRPass.js\";\nimport { TAARenderPass } from \"./postprocessing/TAARenderPass.js\";\nimport { ShaderPass } from \"./postprocessing/ShaderPass.js\";\nimport { SSAARenderPass } from \"./postprocessing/SSAARenderPass.js\";\nimport { RenderPass } from \"./postprocessing/RenderPass.js\";\nimport { RenderPixelatedPass } from \"./postprocessing/RenderPixelatedPass.js\";\nimport { BloomPass } from \"./postprocessing/BloomPass.js\";\nimport { WaterPass } from \"./postprocessing/WaterPass.js\";\nimport { ARButton } from \"./webxr/ARButton.js\";\nimport { OculusHandModel } from \"./webxr/OculusHandModel.js\";\nimport { OculusHandPointerModel } from \"./webxr/OculusHandPointerModel.js\";\nimport { createText } from \"./webxr/Text2D.js\";\nimport { VRButton } from \"./webxr/VRButton.js\";\nimport { XRControllerModelFactory } from \"./webxr/XRControllerModelFactory.js\";\nimport { XREstimatedLight } from \"./webxr/XREstimatedLight.js\";\nimport { XRHandMeshModel } from \"./webxr/XRHandMeshModel.js\";\nimport { XRHandModelFactory } from \"./webxr/XRHandModelFactory.js\";\nimport { XRHandPrimitiveModel } from \"./webxr/XRHandPrimitiveModel.js\";\nimport { ParametricGeometries } from \"./geometries/ParametricGeometries.js\";\nimport { ParametricGeometry } from \"./geometries/ParametricGeometry.js\";\nimport { ConvexGeometry } from \"./geometries/ConvexGeometry.js\";\nimport { LightningStrike } from \"./geometries/LightningStrike.js\";\nimport { RoundedBoxGeometry } from \"./geometries/RoundedBoxGeometry.js\";\nimport { BoxLineGeometry } from \"./geometries/BoxLineGeometry.js\";\nimport { DecalGeometry, DecalVertex } from \"./geometries/DecalGeometry.js\";\nimport { TeapotGeometry } from \"./geometries/TeapotGeometry.js\";\nimport { TextGeometry, TextGeometry as TextGeometry2 } from \"./geometries/TextGeometry.js\";\nimport { CSM } from \"./csm/CSM.js\";\nimport { CSMFrustum } from \"./csm/CSMFrustum.js\";\nimport { CSMHelper } from \"./csm/CSMHelper.js\";\nimport { CSMShader } from \"./csm/CSMShader.js\";\nimport { ACESFilmicToneMappingShader } from \"./shaders/ACESFilmicToneMappingShader.js\";\nimport { AfterimageShader } from \"./shaders/AfterimageShader.js\";\nimport { BasicShader } from \"./shaders/BasicShader.js\";\nimport { BleachBypassShader } from \"./shaders/BleachBypassShader.js\";\nimport { BlendShader } from \"./shaders/BlendShader.js\";\nimport { BokehShader } from \"./shaders/BokehShader.js\";\nimport { BokehDepthShader, BokehShader2 } from \"./shaders/BokehShader2.js\";\nimport { BrightnessContrastShader } from \"./shaders/BrightnessContrastShader.js\";\nimport { ColorCorrectionShader } from \"./shaders/ColorCorrectionShader.js\";\nimport { ColorifyShader } from \"./shaders/ColorifyShader.js\";\nimport { ConvolutionShader } from \"./shaders/ConvolutionShader.js\";\nimport { CopyShader } from \"./shaders/CopyShader.js\";\nimport { DOFMipMapShader } from \"./shaders/DOFMipMapShader.js\";\nimport { BlurShaderUtils, DepthLimitedBlurShader } from \"./shaders/DepthLimitedBlurShader.js\";\nimport { DigitalGlitch } from \"./shaders/DigitalGlitch.js\";\nimport { DotScreenShader } from \"./shaders/DotScreenShader.js\";\nimport { FXAAShader } from \"./shaders/FXAAShader.js\";\nimport { FilmShader } from \"./shaders/FilmShader.js\";\nimport { FocusShader } from \"./shaders/FocusShader.js\";\nimport { FreiChenShader } from \"./shaders/FreiChenShader.js\";\nimport { FresnelShader } from \"./shaders/FresnelShader.js\";\nimport { GammaCorrectionShader } from \"./shaders/GammaCorrectionShader.js\";\nimport { GodRaysCombineShader, GodRaysDepthMaskShader, GodRaysFakeSunShader, GodRaysGenerateShader } from \"./shaders/GodRaysShader.js\";\nimport { HalftoneShader } from \"./shaders/HalftoneShader.js\";\nimport { HorizontalBlurShader } from \"./shaders/HorizontalBlurShader.js\";\nimport { HorizontalTiltShiftShader } from \"./shaders/HorizontalTiltShiftShader.js\";\nimport { HueSaturationShader } from \"./shaders/HueSaturationShader.js\";\nimport { KaleidoShader } from \"./shaders/KaleidoShader.js\";\nimport { LuminosityHighPassShader } from \"./shaders/LuminosityHighPassShader.js\";\nimport { LuminosityShader } from \"./shaders/LuminosityShader.js\";\nimport { MirrorShader } from \"./shaders/MirrorShader.js\";\nimport { NormalMapShader } from \"./shaders/NormalMapShader.js\";\nimport { ParallaxShader } from \"./shaders/ParallaxShader.js\";\nimport { PixelShader } from \"./shaders/PixelShader.js\";\nimport { RGBShiftShader } from \"./shaders/RGBShiftShader.js\";\nimport { SAOShader } from \"./shaders/SAOShader.js\";\nimport { SMAABlendShader, SMAAEdgesShader, SMAAWeightsShader } from \"./shaders/SMAAShader.js\";\nimport { SSAOBlurShader, SSAODepthShader, SSAOShader } from \"./shaders/SSAOShader.js\";\nimport { SSRBlurShader, SSRDepthShader, SSRShader } from \"./shaders/SSRShader.js\";\nimport { SepiaShader } from \"./shaders/SepiaShader.js\";\nimport { SobelOperatorShader } from \"./shaders/SobelOperatorShader.js\";\nimport { SubsurfaceScatteringShader } from \"./shaders/SubsurfaceScatteringShader.js\";\nimport { TechnicolorShader } from \"./shaders/TechnicolorShader.js\";\nimport { ToneMapShader } from \"./shaders/ToneMapShader.js\";\nimport { ToonShader1, ToonShader2, ToonShaderDotted, ToonShaderHatching } from \"./shaders/ToonShader.js\";\nimport { TriangleBlurShader } from \"./shaders/TriangleBlurShader.js\";\nimport { UnpackDepthRGBAShader } from \"./shaders/UnpackDepthRGBAShader.js\";\nimport { VerticalBlurShader } from \"./shaders/VerticalBlurShader.js\";\nimport { VerticalTiltShiftShader } from \"./shaders/VerticalTiltShiftShader.js\";\nimport { VignetteShader } from \"./shaders/VignetteShader.js\";\nimport { VolumeRenderShader1 } from \"./shaders/VolumeShader.js\";\nimport { WaterRefractionShader } from \"./shaders/WaterRefractionShader.js\";\nimport { HTMLMesh } from \"./interactive/HTMLMesh.js\";\nimport { InteractiveGroup } from \"./interactive/InteractiveGroup.js\";\nimport { SelectionHelper } from \"./interactive/SelectionHelper.js\";\nimport { SelectionBox } from \"./interactive/SelectionBox.js\";\nimport { AmmoPhysics } from \"./physics/AmmoPhysics.js\";\nimport { ParallaxBarrierEffect } from \"./effects/ParallaxBarrierEffect.js\";\nimport { PeppersGhostEffect } from \"./effects/PeppersGhostEffect.js\";\nimport { OutlineEffect } from \"./effects/OutlineEffect.js\";\nimport { AnaglyphEffect } from \"./effects/AnaglyphEffect.js\";\nimport { AsciiEffect } from \"./effects/AsciiEffect.js\";\nimport { StereoEffect } from \"./effects/StereoEffect.js\";\nimport { FBXLoader } from \"./loaders/FBXLoader.js\";\nimport { Font, FontLoader } from \"./loaders/FontLoader.js\";\nimport { TGALoader } from \"./loaders/TGALoader.js\";\nimport { LUTCubeLoader } from \"./loaders/LUTCubeLoader.js\";\nimport { NRRDLoader } from \"./loaders/NRRDLoader.js\";\nimport { STLLoader } from \"./loaders/STLLoader.js\";\nimport { MTLLoader } from \"./loaders/MTLLoader.js\";\nimport { XLoader } from \"./loaders/XLoader.js\";\nimport { BVHLoader } from \"./loaders/BVHLoader.js\";\nimport { KMZLoader } from \"./loaders/KMZLoader.js\";\nimport { VRMLoader } from \"./loaders/VRMLoader.js\";\nimport { VRMLLoader } from \"./loaders/VRMLLoader.js\";\nimport { KTX2Loader } from \"./loaders/KTX2Loader.js\";\nimport { LottieLoader } from \"./loaders/LottieLoader.js\";\nimport { TTFLoader } from \"./loaders/TTFLoader.js\";\nimport { RGBELoader } from \"./loaders/RGBELoader.js\";\nimport { AssimpLoader } from \"./loaders/AssimpLoader.js\";\nimport { ColladaLoader } from \"./loaders/ColladaLoader.js\";\nimport { MDDLoader } from \"./loaders/MDDLoader.js\";\nimport { EXRLoader } from \"./loaders/EXRLoader.js\";\nimport { ThreeMFLoader } from \"./loaders/3MFLoader.js\";\nimport { XYZLoader } from \"./loaders/XYZLoader.js\";\nimport { VTKLoader } from \"./loaders/VTKLoader.js\";\nimport { LUT3dlLoader } from \"./loaders/LUT3dlLoader.js\";\nimport { DDSLoader } from \"./loaders/DDSLoader.js\";\nimport { PVRLoader } from \"./loaders/PVRLoader.js\";\nimport { GCodeLoader } from \"./loaders/GCodeLoader.js\";\nimport { BasisTextureLoader } from \"./loaders/BasisTextureLoader.js\";\nimport { TDSLoader } from \"./loaders/TDSLoader.js\";\nimport { LDrawLoader } from \"./loaders/LDrawLoader.js\";\nimport { GLTFLoader } from \"./loaders/GLTFLoader.js\";\nimport { SVGLoader } from \"./loaders/SVGLoader.js\";\nimport { Rhino3dmLoader } from \"./loaders/3DMLoader.js\";\nimport { OBJLoader } from \"./loaders/OBJLoader.js\";\nimport { AMFLoader } from \"./loaders/AMFLoader.js\";\nimport { MMDLoader } from \"./loaders/MMDLoader.js\";\nimport { MD2Loader } from \"./loaders/MD2Loader.js\";\nimport { KTXLoader } from \"./loaders/KTXLoader.js\";\nimport { TiltLoader } from \"./loaders/TiltLoader.js\";\nimport { DRACOLoader } from \"./loaders/DRACOLoader.js\";\nimport { HDRCubeTextureLoader } from \"./loaders/HDRCubeTextureLoader.js\";\nimport { PDBLoader } from \"./loaders/PDBLoader.js\";\nimport { PRWMLoader } from \"./loaders/PRWMLoader.js\";\nimport { RGBMLoader } from \"./loaders/RGBMLoader.js\";\nimport { VOXData3DTexture, VOXLoader, VOXMesh } from \"./loaders/VOXLoader.js\";\nimport { PCDLoader } from \"./loaders/PCDLoader.js\";\nimport { LWOLoader } from \"./loaders/LWOLoader.js\";\nimport { PLYLoader } from \"./loaders/PLYLoader.js\";\nimport { LineSegmentsGeometry } from \"./lines/LineSegmentsGeometry.js\";\nimport { LineGeometry } from \"./lines/LineGeometry.js\";\nimport { Wireframe } from \"./lines/Wireframe.js\";\nimport { WireframeGeometry2 } from \"./lines/WireframeGeometry2.js\";\nimport { Line2 } from \"./lines/Line2.js\";\nimport { LineMaterial } from \"./lines/LineMaterial.js\";\nimport { LineSegments2 } from \"./lines/LineSegments2.js\";\nimport { LightProbeHelper } from \"./helpers/LightProbeHelper.js\";\nimport { VertexTangentsHelper } from \"./helpers/VertexTangentsHelper.js\";\nimport { PositionalAudioHelper } from \"./helpers/PositionalAudioHelper.js\";\nimport { VertexNormalsHelper } from \"./helpers/VertexNormalsHelper.js\";\nimport { RectAreaLightHelper } from \"./helpers/RectAreaLightHelper.js\";\nimport { RectAreaLightUniformsLib } from \"./lights/RectAreaLightUniformsLib.js\";\nimport { LightProbeGenerator } from \"./lights/LightProbeGenerator.js\";\nimport { calcBSplineDerivatives, calcBSplinePoint, calcBasisFunctionDerivatives, calcBasisFunctions, calcKoverI, calcNURBSDerivatives, calcRationalCurveDerivatives, calcSurfacePoint, findSpan } from \"./curves/NURBSUtils.js\";\nimport { NURBSCurve } from \"./curves/NURBSCurve.js\";\nimport { NURBSSurface } from \"./curves/NURBSSurface.js\";\nimport { CinquefoilKnot, DecoratedTorusKnot4a, DecoratedTorusKnot4b, DecoratedTorusKnot5a, DecoratedTorusKnot5c, FigureEightPolynomialKnot, GrannyKnot, HeartCurve, HelixCurve, KnotCurve, TorusKnot, TrefoilKnot, TrefoilPolynomialKnot, VivianiCurve } from \"./curves/CurveExtras.js\";\nimport { Face3, Geometry } from \"./deprecated/Geometry.js\";\nimport { MeshoptDecoder } from \"./libs/MeshoptDecoder.js\";\nimport { MotionController, MotionControllerConstants, fetchProfile, fetchProfilesList } from \"./libs/MotionControllers.js\";\nexport {\n ACESFilmicToneMappingShader,\n AMFLoader,\n ARButton,\n AdaptiveToneMappingPass,\n AfterimagePass,\n AfterimageShader,\n AmmoPhysics,\n AnaglyphEffect,\n AnimationClipCreator,\n ArcballControls,\n AsciiEffect,\n AssimpLoader,\n BVHLoader,\n BasicShader,\n BasisTextureLoader,\n BatchedMesh,\n BleachBypassShader,\n BlendShader,\n BloomPass,\n BlurShaderUtils,\n BokehDepthShader,\n BokehPass,\n BokehShader,\n BokehShader2,\n BoxLineGeometry,\n BrightnessContrastShader,\n CCDIKHelper,\n CCDIKSolver,\n CSM,\n CSMFrustum,\n CSMHelper,\n CSMShader,\n CSS2DObject,\n CSS2DRenderer,\n CSS3DObject,\n CSS3DRenderer,\n CSS3DSprite,\n CameraControls,\n Capsule,\n CinematicCamera,\n CinquefoilKnot,\n ClearMaskPass,\n ClearPass,\n ColladaExporter,\n ColladaLoader,\n ColorConverter,\n ColorCorrectionShader,\n ColorMapKeywords,\n ColorifyShader,\n ConvexGeometry,\n ConvexHull,\n ConvexObjectBreaker,\n ConvolutionShader,\n CopyShader,\n CubeTexturePass,\n DDSLoader,\n DOFMipMapShader,\n DRACOExporter,\n DRACOLoader,\n DecalGeometry,\n DecalVertex,\n DecoratedTorusKnot4a,\n DecoratedTorusKnot4b,\n DecoratedTorusKnot5a,\n DecoratedTorusKnot5c,\n DepthLimitedBlurShader,\n DeviceOrientationControls,\n DigitalGlitch,\n DotScreenPass,\n DotScreenShader,\n DragControls,\n EXRLoader,\n EdgeSplitModifier,\n EffectComposer,\n FBXLoader,\n FXAAShader,\n Face,\n Face3,\n FigureEightPolynomialKnot,\n FilmPass,\n FilmShader,\n FirstPersonControls,\n FlakesTexture,\n Flow,\n FlyControls,\n FocusShader,\n Font,\n FontLoader,\n FreiChenShader,\n FresnelShader,\n FullScreenQuad,\n GCodeLoader,\n GLTFExporter,\n GLTFLoader,\n GPUComputationRenderer,\n GammaCorrectionShader,\n Geometry,\n GeometryCompressionUtils,\n GeometryUtils,\n GlitchPass,\n GodRaysCombineShader,\n GodRaysDepthMaskShader,\n GodRaysFakeSunShader,\n GodRaysGenerateShader,\n GrannyKnot,\n GroundProjectedEnv,\n Gyroscope,\n HDRCubeTextureLoader,\n HTMLMesh,\n HalfEdge,\n HalftonePass,\n HalftoneShader,\n HeartCurve,\n HelixCurve,\n HorizontalBlurShader,\n HorizontalTiltShiftShader,\n HueSaturationShader,\n ImprovedNoise,\n InstancedFlow,\n InteractiveGroup,\n KMZLoader,\n KTX2Loader,\n KTXLoader,\n KaleidoShader,\n KnotCurve,\n LDrawLoader,\n LUT3dlLoader,\n LUTCubeLoader,\n LUTPass,\n LWOLoader,\n Lensflare,\n LensflareElement,\n LightProbeGenerator,\n LightProbeHelper,\n LightningStorm,\n LightningStrike,\n Line2,\n LineGeometry,\n LineMaterial,\n LineSegments2,\n LineSegmentsGeometry,\n LottieLoader,\n LuminosityHighPassShader,\n LuminosityShader,\n Lut,\n MD2Character,\n MD2CharacterComplex,\n MD2Loader,\n MDDLoader,\n MMDAnimationHelper,\n MMDExporter,\n MMDLoader,\n MMDPhysics,\n MTLLoader,\n MapControls,\n MapControlsExp,\n MarchingCubes,\n MaskPass,\n MeshSurfaceSampler,\n MeshoptDecoder,\n MirrorShader,\n MorphAnimMesh,\n MorphBlendMesh,\n MotionController,\n MotionControllerConstants,\n NRRDLoader,\n NURBSCurve,\n NURBSSurface,\n NormalMapShader,\n OBB,\n OBJExporter,\n OBJLoader,\n Octree,\n OculusHandModel,\n OculusHandPointerModel,\n OrbitControls,\n OrbitControlsExp,\n OutlineEffect,\n OutlinePass,\n PCDLoader,\n PDBLoader,\n PLYExporter,\n PLYLoader,\n PRWMLoader,\n PVRLoader,\n PackedPhongMaterial,\n ParallaxBarrierEffect,\n ParallaxShader,\n ParametricGeometries,\n ParametricGeometry,\n Pass,\n PeppersGhostEffect,\n PixelShader,\n PointerLockControls,\n PositionalAudioHelper,\n ProgressiveLightMap,\n Projector,\n RGBELoader,\n RGBMLoader,\n RGBShiftShader,\n RectAreaLightHelper,\n RectAreaLightUniformsLib,\n Reflector,\n ReflectorForSSRPass,\n ReflectorRTT,\n Refractor,\n RenderPass,\n RenderPixelatedPass,\n RenderableFace,\n RenderableLine,\n RenderableObject,\n RenderableSprite,\n RenderableVertex,\n Rhino3dmLoader,\n RollerCoasterGeometry,\n RollerCoasterLiftersGeometry,\n RollerCoasterShadowGeometry,\n RoomEnvironment,\n RoughnessMipmapper,\n RoundedBoxGeometry,\n SAOPass,\n SAOShader,\n SMAABlendShader,\n SMAAEdgesShader,\n SMAAPass,\n SMAAWeightsShader,\n SSAARenderPass,\n SSAOBlurShader,\n SSAODepthShader,\n SSAOPass,\n SSAOShader,\n SSRBlurShader,\n SSRDepthShader,\n SSRPass,\n SSRShader,\n STATE,\n STLExporter,\n STLLoader,\n SVGLoader,\n SVGObject,\n SVGRenderer,\n SavePass,\n SceneUtils,\n SelectionBox,\n SelectionHelper,\n SepiaShader,\n ShaderPass,\n ShadowMapViewer,\n ShadowMesh,\n SimplexNoise,\n SimplifyModifier,\n SkeletonUtils,\n Sky,\n SkyGeometry,\n SobelOperatorShader,\n StereoEffect,\n SubsurfaceScatteringShader,\n TAARenderPass,\n TDSLoader,\n TGALoader,\n TTFLoader,\n TeapotGeometry,\n TechnicolorShader,\n TessellateModifier,\n TextGeometry as TextBufferGeometry,\n TextGeometry2 as TextGeometry,\n TexturePass,\n ThreeMFLoader,\n TiltLoader,\n Timer,\n ToneMapShader,\n ToonShader1,\n ToonShader2,\n ToonShaderDotted,\n ToonShaderHatching,\n TorusKnot,\n TrackballControls,\n TrackballControlsExp,\n TransformControls,\n TransformControlsGizmo,\n TransformControlsPlane,\n TreesGeometry,\n TrefoilKnot,\n TrefoilPolynomialKnot,\n TriangleBlurShader,\n TubePainter,\n USDZExporter,\n UVsDebug,\n UnpackDepthRGBAShader,\n UnrealBloomPass,\n VOXData3DTexture,\n VOXLoader,\n VOXMesh,\n VRButton,\n VRMLLoader,\n VRMLoader,\n VTKLoader,\n VertexList,\n VertexNode,\n VertexNormalsHelper,\n VertexTangentsHelper,\n VerticalBlurShader,\n VerticalTiltShiftShader,\n VignetteShader,\n VivianiCurve,\n Volume,\n VolumeRenderShader1,\n VolumeSlice,\n Water,\n Water2,\n WaterPass,\n WaterRefractionShader,\n Wireframe,\n WireframeGeometry2,\n XLoader,\n XRControllerModelFactory,\n XREstimatedLight,\n XRHandMeshModel,\n XRHandModelFactory,\n XRHandPrimitiveModel,\n XYZLoader,\n calcBSplineDerivatives,\n calcBSplinePoint,\n calcBasisFunctionDerivatives,\n calcBasisFunctions,\n calcKoverI,\n calcNURBSDerivatives,\n calcRationalCurveDerivatives,\n calcSurfacePoint,\n computeMorphedAttributes,\n createText,\n edgeTable,\n estimateBytesUsed,\n fetchProfile,\n fetchProfilesList,\n findSpan,\n getErrorMessage,\n getUniforms,\n getWebGL2ErrorMessage,\n getWebGLErrorMessage,\n initSplineTexture,\n interleaveAttributes,\n isWebGL2Available,\n isWebGLAvailable,\n mergeBufferAttributes,\n mergeBufferGeometries,\n mergeVertices,\n modifyShader,\n toCreasedNormals,\n toTrianglesDrawMode,\n triTable,\n updateSplineTexture\n};\n//# sourceMappingURL=index.js.map\n", "import { Line3, Plane, Triangle, Vector3 } from 'three'\n\n/**\n * Ported from: https://github.com/maurizzzio/quickhull3d/ by Mauricio Poppe (https://github.com/maurizzzio)\n */\n\nconst Visible = 0\nconst Deleted = 1\n\nconst _v1 = new Vector3()\nconst _line3 = new Line3()\nconst _plane = new Plane()\nconst _closestPoint = new Vector3()\nconst _triangle = new Triangle()\n\nclass ConvexHull {\n constructor() {\n this.tolerance = -1\n\n this.faces = [] // the generated faces of the convex hull\n this.newFaces = [] // this array holds the faces that are generated within a single iteration\n\n // the vertex lists work as follows:\n //\n // let 'a' and 'b' be 'Face' instances\n // let 'v' be points wrapped as instance of 'Vertex'\n //\n // [v, v, ..., v, v, v, ...]\n // ^ ^\n // | |\n // a.outside b.outside\n //\n this.assigned = new VertexList()\n this.unassigned = new VertexList()\n\n this.vertices = [] // vertices of the hull (internal representation of given geometry data)\n }\n\n setFromPoints(points) {\n // The algorithm needs at least four points.\n\n if (points.length >= 4) {\n this.makeEmpty()\n\n for (let i = 0, l = points.length; i < l; i++) {\n this.vertices.push(new VertexNode(points[i]))\n }\n\n this.compute()\n }\n\n return this\n }\n\n setFromObject(object) {\n const points = []\n\n object.updateMatrixWorld(true)\n\n object.traverse(function (node) {\n const geometry = node.geometry\n\n if (geometry !== undefined) {\n const attribute = geometry.attributes.position\n\n if (attribute !== undefined) {\n for (let i = 0, l = attribute.count; i < l; i++) {\n const point = new Vector3()\n\n point.fromBufferAttribute(attribute, i).applyMatrix4(node.matrixWorld)\n\n points.push(point)\n }\n }\n }\n })\n\n return this.setFromPoints(points)\n }\n\n containsPoint(point) {\n const faces = this.faces\n\n for (let i = 0, l = faces.length; i < l; i++) {\n const face = faces[i]\n\n // compute signed distance and check on what half space the point lies\n\n if (face.distanceToPoint(point) > this.tolerance) return false\n }\n\n return true\n }\n\n intersectRay(ray, target) {\n // based on \"Fast Ray-Convex Polyhedron Intersection\" by Eric Haines, GRAPHICS GEMS II\n\n const faces = this.faces\n\n let tNear = -Infinity\n let tFar = Infinity\n\n for (let i = 0, l = faces.length; i < l; i++) {\n const face = faces[i]\n\n // interpret faces as planes for the further computation\n\n const vN = face.distanceToPoint(ray.origin)\n const vD = face.normal.dot(ray.direction)\n\n // if the origin is on the positive side of a plane (so the plane can \"see\" the origin) and\n // the ray is turned away or parallel to the plane, there is no intersection\n\n if (vN > 0 && vD >= 0) return null\n\n // compute the distance from the ray’s origin to the intersection with the plane\n\n const t = vD !== 0 ? -vN / vD : 0\n\n // only proceed if the distance is positive. a negative distance means the intersection point\n // lies \"behind\" the origin\n\n if (t <= 0) continue\n\n // now categorized plane as front-facing or back-facing\n\n if (vD > 0) {\n // plane faces away from the ray, so this plane is a back-face\n\n tFar = Math.min(t, tFar)\n } else {\n // front-face\n\n tNear = Math.max(t, tNear)\n }\n\n if (tNear > tFar) {\n // if tNear ever is greater than tFar, the ray must miss the convex hull\n\n return null\n }\n }\n\n // evaluate intersection point\n\n // always try tNear first since its the closer intersection point\n\n if (tNear !== -Infinity) {\n ray.at(tNear, target)\n } else {\n ray.at(tFar, target)\n }\n\n return target\n }\n\n intersectsRay(ray) {\n return this.intersectRay(ray, _v1) !== null\n }\n\n makeEmpty() {\n this.faces = []\n this.vertices = []\n\n return this\n }\n\n // Adds a vertex to the 'assigned' list of vertices and assigns it to the given face\n\n addVertexToFace(vertex, face) {\n vertex.face = face\n\n if (face.outside === null) {\n this.assigned.append(vertex)\n } else {\n this.assigned.insertBefore(face.outside, vertex)\n }\n\n face.outside = vertex\n\n return this\n }\n\n // Removes a vertex from the 'assigned' list of vertices and from the given face\n\n removeVertexFromFace(vertex, face) {\n if (vertex === face.outside) {\n // fix face.outside link\n\n if (vertex.next !== null && vertex.next.face === face) {\n // face has at least 2 outside vertices, move the 'outside' reference\n\n face.outside = vertex.next\n } else {\n // vertex was the only outside vertex that face had\n\n face.outside = null\n }\n }\n\n this.assigned.remove(vertex)\n\n return this\n }\n\n // Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertex list\n\n removeAllVerticesFromFace(face) {\n if (face.outside !== null) {\n // reference to the first and last vertex of this face\n\n const start = face.outside\n let end = face.outside\n\n while (end.next !== null && end.next.face === face) {\n end = end.next\n }\n\n this.assigned.removeSubList(start, end)\n\n // fix references\n\n start.prev = end.next = null\n face.outside = null\n\n return start\n }\n }\n\n // Removes all the visible vertices that 'face' is able to see\n\n deleteFaceVertices(face, absorbingFace) {\n const faceVertices = this.removeAllVerticesFromFace(face)\n\n if (faceVertices !== undefined) {\n if (absorbingFace === undefined) {\n // mark the vertices to be reassigned to some other face\n\n this.unassigned.appendChain(faceVertices)\n } else {\n // if there's an absorbing face try to assign as many vertices as possible to it\n\n let vertex = faceVertices\n\n do {\n // we need to buffer the subsequent vertex at this point because the 'vertex.next' reference\n // will be changed by upcoming method calls\n\n const nextVertex = vertex.next\n\n const distance = absorbingFace.distanceToPoint(vertex.point)\n\n // check if 'vertex' is able to see 'absorbingFace'\n\n if (distance > this.tolerance) {\n this.addVertexToFace(vertex, absorbingFace)\n } else {\n this.unassigned.append(vertex)\n }\n\n // now assign next vertex\n\n vertex = nextVertex\n } while (vertex !== null)\n }\n }\n\n return this\n }\n\n // Reassigns as many vertices as possible from the unassigned list to the new faces\n\n resolveUnassignedPoints(newFaces) {\n if (this.unassigned.isEmpty() === false) {\n let vertex = this.unassigned.first()\n\n do {\n // buffer 'next' reference, see .deleteFaceVertices()\n\n const nextVertex = vertex.next\n\n let maxDistance = this.tolerance\n\n let maxFace = null\n\n for (let i = 0; i < newFaces.length; i++) {\n const face = newFaces[i]\n\n if (face.mark === Visible) {\n const distance = face.distanceToPoint(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n maxFace = face\n }\n\n if (maxDistance > 1000 * this.tolerance) break\n }\n }\n\n // 'maxFace' can be null e.g. if there are identical vertices\n\n if (maxFace !== null) {\n this.addVertexToFace(vertex, maxFace)\n }\n\n vertex = nextVertex\n } while (vertex !== null)\n }\n\n return this\n }\n\n // Computes the extremes of a simplex which will be the initial hull\n\n computeExtremes() {\n const min = new Vector3()\n const max = new Vector3()\n\n const minVertices = []\n const maxVertices = []\n\n // initially assume that the first vertex is the min/max\n\n for (let i = 0; i < 3; i++) {\n minVertices[i] = maxVertices[i] = this.vertices[0]\n }\n\n min.copy(this.vertices[0].point)\n max.copy(this.vertices[0].point)\n\n // compute the min/max vertex on all six directions\n\n for (let i = 0, l = this.vertices.length; i < l; i++) {\n const vertex = this.vertices[i]\n const point = vertex.point\n\n // update the min coordinates\n\n for (let j = 0; j < 3; j++) {\n if (point.getComponent(j) < min.getComponent(j)) {\n min.setComponent(j, point.getComponent(j))\n minVertices[j] = vertex\n }\n }\n\n // update the max coordinates\n\n for (let j = 0; j < 3; j++) {\n if (point.getComponent(j) > max.getComponent(j)) {\n max.setComponent(j, point.getComponent(j))\n maxVertices[j] = vertex\n }\n }\n }\n\n // use min/max vectors to compute an optimal epsilon\n\n this.tolerance =\n 3 *\n Number.EPSILON *\n (Math.max(Math.abs(min.x), Math.abs(max.x)) +\n Math.max(Math.abs(min.y), Math.abs(max.y)) +\n Math.max(Math.abs(min.z), Math.abs(max.z)))\n\n return { min: minVertices, max: maxVertices }\n }\n\n // Computes the initial simplex assigning to its faces all the points\n // that are candidates to form part of the hull\n\n computeInitialHull() {\n const vertices = this.vertices\n const extremes = this.computeExtremes()\n const min = extremes.min\n const max = extremes.max\n\n // 1. Find the two vertices 'v0' and 'v1' with the greatest 1d separation\n // (max.x - min.x)\n // (max.y - min.y)\n // (max.z - min.z)\n\n let maxDistance = 0\n let index = 0\n\n for (let i = 0; i < 3; i++) {\n const distance = max[i].point.getComponent(i) - min[i].point.getComponent(i)\n\n if (distance > maxDistance) {\n maxDistance = distance\n index = i\n }\n }\n\n const v0 = min[index]\n const v1 = max[index]\n let v2\n let v3\n\n // 2. The next vertex 'v2' is the one farthest to the line formed by 'v0' and 'v1'\n\n maxDistance = 0\n _line3.set(v0.point, v1.point)\n\n for (let i = 0, l = this.vertices.length; i < l; i++) {\n const vertex = vertices[i]\n\n if (vertex !== v0 && vertex !== v1) {\n _line3.closestPointToPoint(vertex.point, true, _closestPoint)\n\n const distance = _closestPoint.distanceToSquared(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n v2 = vertex\n }\n }\n }\n\n // 3. The next vertex 'v3' is the one farthest to the plane 'v0', 'v1', 'v2'\n\n maxDistance = -1\n _plane.setFromCoplanarPoints(v0.point, v1.point, v2.point)\n\n for (let i = 0, l = this.vertices.length; i < l; i++) {\n const vertex = vertices[i]\n\n if (vertex !== v0 && vertex !== v1 && vertex !== v2) {\n const distance = Math.abs(_plane.distanceToPoint(vertex.point))\n\n if (distance > maxDistance) {\n maxDistance = distance\n v3 = vertex\n }\n }\n }\n\n const faces = []\n\n if (_plane.distanceToPoint(v3.point) < 0) {\n // the face is not able to see the point so 'plane.normal' is pointing outside the tetrahedron\n\n faces.push(Face.create(v0, v1, v2), Face.create(v3, v1, v0), Face.create(v3, v2, v1), Face.create(v3, v0, v2))\n\n // set the twin edge\n\n for (let i = 0; i < 3; i++) {\n const j = (i + 1) % 3\n\n // join face[ i ] i > 0, with the first face\n\n faces[i + 1].getEdge(2).setTwin(faces[0].getEdge(j))\n\n // join face[ i ] with face[ i + 1 ], 1 <= i <= 3\n\n faces[i + 1].getEdge(1).setTwin(faces[j + 1].getEdge(0))\n }\n } else {\n // the face is able to see the point so 'plane.normal' is pointing inside the tetrahedron\n\n faces.push(Face.create(v0, v2, v1), Face.create(v3, v0, v1), Face.create(v3, v1, v2), Face.create(v3, v2, v0))\n\n // set the twin edge\n\n for (let i = 0; i < 3; i++) {\n const j = (i + 1) % 3\n\n // join face[ i ] i > 0, with the first face\n\n faces[i + 1].getEdge(2).setTwin(faces[0].getEdge((3 - i) % 3))\n\n // join face[ i ] with face[ i + 1 ]\n\n faces[i + 1].getEdge(0).setTwin(faces[j + 1].getEdge(1))\n }\n }\n\n // the initial hull is the tetrahedron\n\n for (let i = 0; i < 4; i++) {\n this.faces.push(faces[i])\n }\n\n // initial assignment of vertices to the faces of the tetrahedron\n\n for (let i = 0, l = vertices.length; i < l; i++) {\n const vertex = vertices[i]\n\n if (vertex !== v0 && vertex !== v1 && vertex !== v2 && vertex !== v3) {\n maxDistance = this.tolerance\n let maxFace = null\n\n for (let j = 0; j < 4; j++) {\n const distance = this.faces[j].distanceToPoint(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n maxFace = this.faces[j]\n }\n }\n\n if (maxFace !== null) {\n this.addVertexToFace(vertex, maxFace)\n }\n }\n }\n\n return this\n }\n\n // Removes inactive faces\n\n reindexFaces() {\n const activeFaces = []\n\n for (let i = 0; i < this.faces.length; i++) {\n const face = this.faces[i]\n\n if (face.mark === Visible) {\n activeFaces.push(face)\n }\n }\n\n this.faces = activeFaces\n\n return this\n }\n\n // Finds the next vertex to create faces with the current hull\n\n nextVertexToAdd() {\n // if the 'assigned' list of vertices is empty, no vertices are left. return with 'undefined'\n\n if (this.assigned.isEmpty() === false) {\n let eyeVertex,\n maxDistance = 0\n\n // grap the first available face and start with the first visible vertex of that face\n\n const eyeFace = this.assigned.first().face\n let vertex = eyeFace.outside\n\n // now calculate the farthest vertex that face can see\n\n do {\n const distance = eyeFace.distanceToPoint(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n eyeVertex = vertex\n }\n\n vertex = vertex.next\n } while (vertex !== null && vertex.face === eyeFace)\n\n return eyeVertex\n }\n }\n\n // Computes a chain of half edges in CCW order called the 'horizon'.\n // For an edge to be part of the horizon it must join a face that can see\n // 'eyePoint' and a face that cannot see 'eyePoint'.\n\n computeHorizon(eyePoint, crossEdge, face, horizon) {\n // moves face's vertices to the 'unassigned' vertex list\n\n this.deleteFaceVertices(face)\n\n face.mark = Deleted\n\n let edge\n\n if (crossEdge === null) {\n edge = crossEdge = face.getEdge(0)\n } else {\n // start from the next edge since 'crossEdge' was already analyzed\n // (actually 'crossEdge.twin' was the edge who called this method recursively)\n\n edge = crossEdge.next\n }\n\n do {\n const twinEdge = edge.twin\n const oppositeFace = twinEdge.face\n\n if (oppositeFace.mark === Visible) {\n if (oppositeFace.distanceToPoint(eyePoint) > this.tolerance) {\n // the opposite face can see the vertex, so proceed with next edge\n\n this.computeHorizon(eyePoint, twinEdge, oppositeFace, horizon)\n } else {\n // the opposite face can't see the vertex, so this edge is part of the horizon\n\n horizon.push(edge)\n }\n }\n\n edge = edge.next\n } while (edge !== crossEdge)\n\n return this\n }\n\n // Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' in CCW order\n\n addAdjoiningFace(eyeVertex, horizonEdge) {\n // all the half edges are created in ccw order thus the face is always pointing outside the hull\n\n const face = Face.create(eyeVertex, horizonEdge.tail(), horizonEdge.head())\n\n this.faces.push(face)\n\n // join face.getEdge( - 1 ) with the horizon's opposite edge face.getEdge( - 1 ) = face.getEdge( 2 )\n\n face.getEdge(-1).setTwin(horizonEdge.twin)\n\n return face.getEdge(0) // the half edge whose vertex is the eyeVertex\n }\n\n // Adds 'horizon.length' faces to the hull, each face will be linked with the\n // horizon opposite face and the face on the left/right\n\n addNewFaces(eyeVertex, horizon) {\n this.newFaces = []\n\n let firstSideEdge = null\n let previousSideEdge = null\n\n for (let i = 0; i < horizon.length; i++) {\n const horizonEdge = horizon[i]\n\n // returns the right side edge\n\n const sideEdge = this.addAdjoiningFace(eyeVertex, horizonEdge)\n\n if (firstSideEdge === null) {\n firstSideEdge = sideEdge\n } else {\n // joins face.getEdge( 1 ) with previousFace.getEdge( 0 )\n\n sideEdge.next.setTwin(previousSideEdge)\n }\n\n this.newFaces.push(sideEdge.face)\n previousSideEdge = sideEdge\n }\n\n // perform final join of new faces\n\n firstSideEdge.next.setTwin(previousSideEdge)\n\n return this\n }\n\n // Adds a vertex to the hull\n\n addVertexToHull(eyeVertex) {\n const horizon = []\n\n this.unassigned.clear()\n\n // remove 'eyeVertex' from 'eyeVertex.face' so that it can't be added to the 'unassigned' vertex list\n\n this.removeVertexFromFace(eyeVertex, eyeVertex.face)\n\n this.computeHorizon(eyeVertex.point, null, eyeVertex.face, horizon)\n\n this.addNewFaces(eyeVertex, horizon)\n\n // reassign 'unassigned' vertices to the new faces\n\n this.resolveUnassignedPoints(this.newFaces)\n\n return this\n }\n\n cleanup() {\n this.assigned.clear()\n this.unassigned.clear()\n this.newFaces = []\n\n return this\n }\n\n compute() {\n let vertex\n\n this.computeInitialHull()\n\n // add all available vertices gradually to the hull\n\n while ((vertex = this.nextVertexToAdd()) !== undefined) {\n this.addVertexToHull(vertex)\n }\n\n this.reindexFaces()\n\n this.cleanup()\n\n return this\n }\n}\n\n//\n\nclass Face {\n constructor() {\n this.normal = new Vector3()\n this.midpoint = new Vector3()\n this.area = 0\n\n this.constant = 0 // signed distance from face to the origin\n this.outside = null // reference to a vertex in a vertex list this face can see\n this.mark = Visible\n this.edge = null\n }\n\n static create(a, b, c) {\n const face = new Face()\n\n const e0 = new HalfEdge(a, face)\n const e1 = new HalfEdge(b, face)\n const e2 = new HalfEdge(c, face)\n\n // join edges\n\n e0.next = e2.prev = e1\n e1.next = e0.prev = e2\n e2.next = e1.prev = e0\n\n // main half edge reference\n\n face.edge = e0\n\n return face.compute()\n }\n\n getEdge(i) {\n let edge = this.edge\n\n while (i > 0) {\n edge = edge.next\n i--\n }\n\n while (i < 0) {\n edge = edge.prev\n i++\n }\n\n return edge\n }\n\n compute() {\n const a = this.edge.tail()\n const b = this.edge.head()\n const c = this.edge.next.head()\n\n _triangle.set(a.point, b.point, c.point)\n\n _triangle.getNormal(this.normal)\n _triangle.getMidpoint(this.midpoint)\n this.area = _triangle.getArea()\n\n this.constant = this.normal.dot(this.midpoint)\n\n return this\n }\n\n distanceToPoint(point) {\n return this.normal.dot(point) - this.constant\n }\n}\n\n// Entity for a Doubly-Connected Edge List (DCEL).\n\nclass HalfEdge {\n constructor(vertex, face) {\n this.vertex = vertex\n this.prev = null\n this.next = null\n this.twin = null\n this.face = face\n }\n\n head() {\n return this.vertex\n }\n\n tail() {\n return this.prev ? this.prev.vertex : null\n }\n\n length() {\n const head = this.head()\n const tail = this.tail()\n\n if (tail !== null) {\n return tail.point.distanceTo(head.point)\n }\n\n return -1\n }\n\n lengthSquared() {\n const head = this.head()\n const tail = this.tail()\n\n if (tail !== null) {\n return tail.point.distanceToSquared(head.point)\n }\n\n return -1\n }\n\n setTwin(edge) {\n this.twin = edge\n edge.twin = this\n\n return this\n }\n}\n\n// A vertex as a double linked list node.\n\nclass VertexNode {\n constructor(point) {\n this.point = point\n this.prev = null\n this.next = null\n this.face = null // the face that is able to see this vertex\n }\n}\n\n// A double linked list that contains vertex nodes.\n\nclass VertexList {\n constructor() {\n this.head = null\n this.tail = null\n }\n\n first() {\n return this.head\n }\n\n last() {\n return this.tail\n }\n\n clear() {\n this.head = this.tail = null\n\n return this\n }\n\n // Inserts a vertex before the target vertex\n\n insertBefore(target, vertex) {\n vertex.prev = target.prev\n vertex.next = target\n\n if (vertex.prev === null) {\n this.head = vertex\n } else {\n vertex.prev.next = vertex\n }\n\n target.prev = vertex\n\n return this\n }\n\n // Inserts a vertex after the target vertex\n\n insertAfter(target, vertex) {\n vertex.prev = target\n vertex.next = target.next\n\n if (vertex.next === null) {\n this.tail = vertex\n } else {\n vertex.next.prev = vertex\n }\n\n target.next = vertex\n\n return this\n }\n\n // Appends a vertex to the end of the linked list\n\n append(vertex) {\n if (this.head === null) {\n this.head = vertex\n } else {\n this.tail.next = vertex\n }\n\n vertex.prev = this.tail\n vertex.next = null // the tail has no subsequent vertex\n\n this.tail = vertex\n\n return this\n }\n\n // Appends a chain of vertices where 'vertex' is the head.\n\n appendChain(vertex) {\n if (this.head === null) {\n this.head = vertex\n } else {\n this.tail.next = vertex\n }\n\n vertex.prev = this.tail\n\n // ensure that the 'tail' reference points to the last vertex of the chain\n\n while (vertex.next !== null) {\n vertex = vertex.next\n }\n\n this.tail = vertex\n\n return this\n }\n\n // Removes a vertex from the linked list\n\n remove(vertex) {\n if (vertex.prev === null) {\n this.head = vertex.next\n } else {\n vertex.prev.next = vertex.next\n }\n\n if (vertex.next === null) {\n this.tail = vertex.prev\n } else {\n vertex.next.prev = vertex.prev\n }\n\n return this\n }\n\n // Removes a list of vertices whose 'head' is 'a' and whose 'tail' is b\n\n removeSubList(a, b) {\n if (a.prev === null) {\n this.head = b.next\n } else {\n a.prev.next = b.next\n }\n\n if (b.next === null) {\n this.tail = a.prev\n } else {\n b.next.prev = a.prev\n }\n\n return this\n }\n\n isEmpty() {\n return this.head === null\n }\n}\n\nexport { ConvexHull, Face, HalfEdge, VertexNode, VertexList }\n", "import { Line3, Mesh, Plane, Vector3 } from 'three'\nimport { ConvexGeometry } from '../geometries/ConvexGeometry'\n\n/**\n * @fileoverview This class can be used to subdivide a convex Geometry object into pieces.\n *\n * Usage:\n *\n * Use the function prepareBreakableObject to prepare a Mesh object to be broken.\n *\n * Then, call the various functions to subdivide the object (subdivideByImpact, cutByPlane)\n *\n * Sub-objects that are product of subdivision don't need prepareBreakableObject to be called on them.\n *\n * Requisites for the object:\n *\n * - Mesh object must have a buffer geometry and a material\n *\n * - Vertex normals must be planar (not smoothed)\n *\n * - The geometry must be convex (this is not checked in the library). You can create convex\n * geometries with ConvexGeometry. The BoxGeometry, SphereGeometry and other convex primitives\n * can also be used.\n *\n * Note: This lib adds member variables to object's userData member (see prepareBreakableObject function)\n * Use with caution and read the code when using with other libs.\n *\n * @param {double} minSizeForBreak Min size a debris can have to break.\n * @param {double} smallDelta Max distance to consider that a point belongs to a plane.\n *\n */\n\nconst _v1 = new Vector3()\n\nclass ConvexObjectBreaker {\n constructor(minSizeForBreak = 1.4, smallDelta = 0.0001) {\n this.minSizeForBreak = minSizeForBreak\n this.smallDelta = smallDelta\n\n this.tempLine1 = new Line3()\n this.tempPlane1 = new Plane()\n this.tempPlane2 = new Plane()\n this.tempPlane_Cut = new Plane()\n this.tempCM1 = new Vector3()\n this.tempCM2 = new Vector3()\n this.tempVector3 = new Vector3()\n this.tempVector3_2 = new Vector3()\n this.tempVector3_3 = new Vector3()\n this.tempVector3_P0 = new Vector3()\n this.tempVector3_P1 = new Vector3()\n this.tempVector3_P2 = new Vector3()\n this.tempVector3_N0 = new Vector3()\n this.tempVector3_N1 = new Vector3()\n this.tempVector3_AB = new Vector3()\n this.tempVector3_CB = new Vector3()\n this.tempResultObjects = { object1: null, object2: null }\n\n this.segments = []\n const n = 30 * 30\n for (let i = 0; i < n; i++) this.segments[i] = false\n }\n\n prepareBreakableObject(object, mass, velocity, angularVelocity, breakable) {\n // object is a Object3d (normally a Mesh), must have a buffer geometry, and it must be convex.\n // Its material property is propagated to its children (sub-pieces)\n // mass must be > 0\n\n const userData = object.userData\n userData.mass = mass\n userData.velocity = velocity.clone()\n userData.angularVelocity = angularVelocity.clone()\n userData.breakable = breakable\n }\n\n /*\n * @param {int} maxRadialIterations Iterations for radial cuts.\n * @param {int} maxRandomIterations Max random iterations for not-radial cuts\n *\n * Returns the array of pieces\n */\n subdivideByImpact(object, pointOfImpact, normal, maxRadialIterations, maxRandomIterations) {\n const debris = []\n\n const tempPlane1 = this.tempPlane1\n const tempPlane2 = this.tempPlane2\n\n this.tempVector3.addVectors(pointOfImpact, normal)\n tempPlane1.setFromCoplanarPoints(pointOfImpact, object.position, this.tempVector3)\n\n const maxTotalIterations = maxRandomIterations + maxRadialIterations\n\n const scope = this\n\n function subdivideRadial(subObject, startAngle, endAngle, numIterations) {\n if (Math.random() < numIterations * 0.05 || numIterations > maxTotalIterations) {\n debris.push(subObject)\n\n return\n }\n\n let angle = Math.PI\n\n if (numIterations === 0) {\n tempPlane2.normal.copy(tempPlane1.normal)\n tempPlane2.constant = tempPlane1.constant\n } else {\n if (numIterations <= maxRadialIterations) {\n angle = (endAngle - startAngle) * (0.2 + 0.6 * Math.random()) + startAngle\n\n // Rotate tempPlane2 at impact point around normal axis and the angle\n scope.tempVector3_2.copy(object.position).sub(pointOfImpact).applyAxisAngle(normal, angle).add(pointOfImpact)\n tempPlane2.setFromCoplanarPoints(pointOfImpact, scope.tempVector3, scope.tempVector3_2)\n } else {\n angle = (0.5 * (numIterations & 1) + 0.2 * (2 - Math.random())) * Math.PI\n\n // Rotate tempPlane2 at object position around normal axis and the angle\n scope.tempVector3_2\n .copy(pointOfImpact)\n .sub(subObject.position)\n .applyAxisAngle(normal, angle)\n .add(subObject.position)\n scope.tempVector3_3.copy(normal).add(subObject.position)\n tempPlane2.setFromCoplanarPoints(subObject.position, scope.tempVector3_3, scope.tempVector3_2)\n }\n }\n\n // Perform the cut\n scope.cutByPlane(subObject, tempPlane2, scope.tempResultObjects)\n\n const obj1 = scope.tempResultObjects.object1\n const obj2 = scope.tempResultObjects.object2\n\n if (obj1) {\n subdivideRadial(obj1, startAngle, angle, numIterations + 1)\n }\n\n if (obj2) {\n subdivideRadial(obj2, angle, endAngle, numIterations + 1)\n }\n }\n\n subdivideRadial(object, 0, 2 * Math.PI, 0)\n\n return debris\n }\n\n cutByPlane(object, plane, output) {\n // Returns breakable objects in output.object1 and output.object2 members, the resulting 2 pieces of the cut.\n // object2 can be null if the plane doesn't cut the object.\n // object1 can be null only in case of internal error\n // Returned value is number of pieces, 0 for error.\n\n const geometry = object.geometry\n const coords = geometry.attributes.position.array\n const normals = geometry.attributes.normal.array\n\n const numPoints = coords.length / 3\n let numFaces = numPoints / 3\n\n let indices = geometry.getIndex()\n\n if (indices) {\n indices = indices.array\n numFaces = indices.length / 3\n }\n\n function getVertexIndex(faceIdx, vert) {\n // vert = 0, 1 or 2.\n\n const idx = faceIdx * 3 + vert\n\n return indices ? indices[idx] : idx\n }\n\n const points1 = []\n const points2 = []\n\n const delta = this.smallDelta\n\n // Reset segments mark\n const numPointPairs = numPoints * numPoints\n for (let i = 0; i < numPointPairs; i++) this.segments[i] = false\n\n const p0 = this.tempVector3_P0\n const p1 = this.tempVector3_P1\n const n0 = this.tempVector3_N0\n const n1 = this.tempVector3_N1\n\n // Iterate through the faces to mark edges shared by coplanar faces\n for (let i = 0; i < numFaces - 1; i++) {\n const a1 = getVertexIndex(i, 0)\n const b1 = getVertexIndex(i, 1)\n const c1 = getVertexIndex(i, 2)\n\n // Assuming all 3 vertices have the same normal\n n0.set(normals[a1], normals[a1] + 1, normals[a1] + 2)\n\n for (let j = i + 1; j < numFaces; j++) {\n const a2 = getVertexIndex(j, 0)\n const b2 = getVertexIndex(j, 1)\n const c2 = getVertexIndex(j, 2)\n\n // Assuming all 3 vertices have the same normal\n n1.set(normals[a2], normals[a2] + 1, normals[a2] + 2)\n\n const coplanar = 1 - n0.dot(n1) < delta\n\n if (coplanar) {\n if (a1 === a2 || a1 === b2 || a1 === c2) {\n if (b1 === a2 || b1 === b2 || b1 === c2) {\n this.segments[a1 * numPoints + b1] = true\n this.segments[b1 * numPoints + a1] = true\n } else {\n this.segments[c1 * numPoints + a1] = true\n this.segments[a1 * numPoints + c1] = true\n }\n } else if (b1 === a2 || b1 === b2 || b1 === c2) {\n this.segments[c1 * numPoints + b1] = true\n this.segments[b1 * numPoints + c1] = true\n }\n }\n }\n }\n\n // Transform the plane to object local space\n const localPlane = this.tempPlane_Cut\n object.updateMatrix()\n ConvexObjectBreaker.transformPlaneToLocalSpace(plane, object.matrix, localPlane)\n\n // Iterate through the faces adding points to both pieces\n for (let i = 0; i < numFaces; i++) {\n const va = getVertexIndex(i, 0)\n const vb = getVertexIndex(i, 1)\n const vc = getVertexIndex(i, 2)\n\n for (let segment = 0; segment < 3; segment++) {\n const i0 = segment === 0 ? va : segment === 1 ? vb : vc\n const i1 = segment === 0 ? vb : segment === 1 ? vc : va\n\n const segmentState = this.segments[i0 * numPoints + i1]\n\n if (segmentState) continue // The segment already has been processed in another face\n\n // Mark segment as processed (also inverted segment)\n this.segments[i0 * numPoints + i1] = true\n this.segments[i1 * numPoints + i0] = true\n\n p0.set(coords[3 * i0], coords[3 * i0 + 1], coords[3 * i0 + 2])\n p1.set(coords[3 * i1], coords[3 * i1 + 1], coords[3 * i1 + 2])\n\n // mark: 1 for negative side, 2 for positive side, 3 for coplanar point\n let mark0 = 0\n\n let d = localPlane.distanceToPoint(p0)\n\n if (d > delta) {\n mark0 = 2\n points2.push(p0.clone())\n } else if (d < -delta) {\n mark0 = 1\n points1.push(p0.clone())\n } else {\n mark0 = 3\n points1.push(p0.clone())\n points2.push(p0.clone())\n }\n\n // mark: 1 for negative side, 2 for positive side, 3 for coplanar point\n let mark1 = 0\n\n d = localPlane.distanceToPoint(p1)\n\n if (d > delta) {\n mark1 = 2\n points2.push(p1.clone())\n } else if (d < -delta) {\n mark1 = 1\n points1.push(p1.clone())\n } else {\n mark1 = 3\n points1.push(p1.clone())\n points2.push(p1.clone())\n }\n\n if ((mark0 === 1 && mark1 === 2) || (mark0 === 2 && mark1 === 1)) {\n // Intersection of segment with the plane\n\n this.tempLine1.start.copy(p0)\n this.tempLine1.end.copy(p1)\n\n let intersection = new Vector3()\n intersection = localPlane.intersectLine(this.tempLine1, intersection)\n\n if (intersection === null) {\n // Shouldn't happen\n console.error('Internal error: segment does not intersect plane.')\n output.segmentedObject1 = null\n output.segmentedObject2 = null\n return 0\n }\n\n points1.push(intersection)\n points2.push(intersection.clone())\n }\n }\n }\n\n // Calculate debris mass (very fast and imprecise):\n const newMass = object.userData.mass * 0.5\n\n // Calculate debris Center of Mass (again fast and imprecise)\n this.tempCM1.set(0, 0, 0)\n let radius1 = 0\n const numPoints1 = points1.length\n\n if (numPoints1 > 0) {\n for (let i = 0; i < numPoints1; i++) this.tempCM1.add(points1[i])\n\n this.tempCM1.divideScalar(numPoints1)\n for (let i = 0; i < numPoints1; i++) {\n const p = points1[i]\n p.sub(this.tempCM1)\n radius1 = Math.max(radius1, p.x, p.y, p.z)\n }\n\n this.tempCM1.add(object.position)\n }\n\n this.tempCM2.set(0, 0, 0)\n let radius2 = 0\n const numPoints2 = points2.length\n if (numPoints2 > 0) {\n for (let i = 0; i < numPoints2; i++) this.tempCM2.add(points2[i])\n\n this.tempCM2.divideScalar(numPoints2)\n for (let i = 0; i < numPoints2; i++) {\n const p = points2[i]\n p.sub(this.tempCM2)\n radius2 = Math.max(radius2, p.x, p.y, p.z)\n }\n\n this.tempCM2.add(object.position)\n }\n\n let object1 = null\n let object2 = null\n\n let numObjects = 0\n\n if (numPoints1 > 4) {\n object1 = new Mesh(new ConvexGeometry(points1), object.material)\n object1.position.copy(this.tempCM1)\n object1.quaternion.copy(object.quaternion)\n\n this.prepareBreakableObject(\n object1,\n newMass,\n object.userData.velocity,\n object.userData.angularVelocity,\n 2 * radius1 > this.minSizeForBreak,\n )\n\n numObjects++\n }\n\n if (numPoints2 > 4) {\n object2 = new Mesh(new ConvexGeometry(points2), object.material)\n object2.position.copy(this.tempCM2)\n object2.quaternion.copy(object.quaternion)\n\n this.prepareBreakableObject(\n object2,\n newMass,\n object.userData.velocity,\n object.userData.angularVelocity,\n 2 * radius2 > this.minSizeForBreak,\n )\n\n numObjects++\n }\n\n output.object1 = object1\n output.object2 = object2\n\n return numObjects\n }\n\n static transformFreeVector(v, m) {\n // input:\n // vector interpreted as a free vector\n // THREE.Matrix4 orthogonal matrix (matrix without scale)\n\n const x = v.x,\n y = v.y,\n z = v.z\n const e = m.elements\n\n v.x = e[0] * x + e[4] * y + e[8] * z\n v.y = e[1] * x + e[5] * y + e[9] * z\n v.z = e[2] * x + e[6] * y + e[10] * z\n\n return v\n }\n\n static transformFreeVectorInverse(v, m) {\n // input:\n // vector interpreted as a free vector\n // THREE.Matrix4 orthogonal matrix (matrix without scale)\n\n const x = v.x,\n y = v.y,\n z = v.z\n const e = m.elements\n\n v.x = e[0] * x + e[1] * y + e[2] * z\n v.y = e[4] * x + e[5] * y + e[6] * z\n v.z = e[8] * x + e[9] * y + e[10] * z\n\n return v\n }\n\n static transformTiedVectorInverse(v, m) {\n // input:\n // vector interpreted as a tied (ordinary) vector\n // THREE.Matrix4 orthogonal matrix (matrix without scale)\n\n const x = v.x,\n y = v.y,\n z = v.z\n const e = m.elements\n\n v.x = e[0] * x + e[1] * y + e[2] * z - e[12]\n v.y = e[4] * x + e[5] * y + e[6] * z - e[13]\n v.z = e[8] * x + e[9] * y + e[10] * z - e[14]\n\n return v\n }\n\n static transformPlaneToLocalSpace(plane, m, resultPlane) {\n resultPlane.normal.copy(plane.normal)\n resultPlane.constant = plane.constant\n\n const referencePoint = ConvexObjectBreaker.transformTiedVectorInverse(plane.coplanarPoint(_v1), m)\n\n ConvexObjectBreaker.transformFreeVectorInverse(resultPlane.normal, m)\n\n // recalculate constant (like in setFromNormalAndCoplanarPoint)\n resultPlane.constant = -referencePoint.dot(resultPlane.normal)\n }\n}\n\nexport { ConvexObjectBreaker }\n", "import { Object3D, Quaternion, Vector3 } from 'three'\n\nconst _translationObject = new Vector3()\nconst _quaternionObject = new Quaternion()\nconst _scaleObject = new Vector3()\n\nconst _translationWorld = new Vector3()\nconst _quaternionWorld = new Quaternion()\nconst _scaleWorld = new Vector3()\n\nclass Gyroscope extends Object3D {\n constructor() {\n super()\n }\n\n updateMatrixWorld(force) {\n this.matrixAutoUpdate && this.updateMatrix()\n\n // update matrixWorld\n\n if (this.matrixWorldNeedsUpdate || force) {\n if (this.parent !== null) {\n this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)\n\n this.matrixWorld.decompose(_translationWorld, _quaternionWorld, _scaleWorld)\n this.matrix.decompose(_translationObject, _quaternionObject, _scaleObject)\n\n this.matrixWorld.compose(_translationWorld, _quaternionObject, _scaleWorld)\n } else {\n this.matrixWorld.copy(this.matrix)\n }\n\n this.matrixWorldNeedsUpdate = false\n\n force = true\n }\n\n // update children\n\n for (let i = 0, l = this.children.length; i < l; i++) {\n this.children[i].updateMatrixWorld(force)\n }\n }\n}\n\nexport { Gyroscope }\n", "let webGLAvailable: boolean, webGL2Available: boolean\n\nexport function isWebGLAvailable(): boolean {\n if (webGLAvailable !== undefined) return webGLAvailable\n try {\n let gl\n const canvas = document.createElement('canvas')\n webGLAvailable = !!(window.WebGLRenderingContext && (gl = canvas.getContext('webgl')))\n if (gl) gl.getExtension('WEBGL_lose_context')?.loseContext()\n return webGLAvailable\n } catch (e) {\n return (webGLAvailable = false)\n }\n}\n\nexport function isWebGL2Available(): boolean {\n if (webGL2Available !== undefined) return webGL2Available\n try {\n let gl\n const canvas = document.createElement('canvas')\n webGL2Available = !!(window.WebGL2RenderingContext && (gl = canvas.getContext('webgl2')))\n if (gl) gl.getExtension('WEBGL_lose_context')?.loseContext()\n return webGL2Available\n } catch (e) {\n return (webGL2Available = false)\n }\n}\n\nexport function getWebGLErrorMessage(): HTMLDivElement {\n return getErrorMessage(1)\n}\n\nexport function getWebGL2ErrorMessage(): HTMLDivElement {\n return getErrorMessage(2)\n}\n\nexport function getErrorMessage(version: 1 | 2): HTMLDivElement {\n const names = {\n 1: 'WebGL',\n 2: 'WebGL 2',\n }\n\n const contexts = {\n 1: window.WebGLRenderingContext,\n 2: window.WebGL2RenderingContext,\n }\n\n const element = document.createElement('div')\n element.id = 'webglmessage'\n element.style.fontFamily = 'monospace'\n element.style.fontSize = '13px'\n element.style.fontWeight = 'normal'\n element.style.textAlign = 'center'\n element.style.background = '#fff'\n element.style.color = '#000'\n element.style.padding = '1.5em'\n element.style.width = '400px'\n element.style.margin = '5em auto 0'\n\n let message =\n 'Your $0 does not seem to support $1'\n\n if (contexts[version]) {\n message = message.replace('$0', 'graphics card')\n } else {\n message = message.replace('$0', 'browser')\n }\n\n message = message.replace('$1', names[version])\n element.innerHTML = message\n return element\n}\n", "\nexport default function potpack(boxes) {\n\n // calculate total box area and maximum box width\n let area = 0;\n let maxWidth = 0;\n\n for (const box of boxes) {\n area += box.w * box.h;\n maxWidth = Math.max(maxWidth, box.w);\n }\n\n // sort the boxes for insertion by height, descending\n boxes.sort((a, b) => b.h - a.h);\n\n // aim for a squarish resulting container,\n // slightly adjusted for sub-100% space utilization\n const startWidth = Math.max(Math.ceil(Math.sqrt(area / 0.95)), maxWidth);\n\n // start with a single empty space, unbounded at the bottom\n const spaces = [{x: 0, y: 0, w: startWidth, h: Infinity}];\n\n let width = 0;\n let height = 0;\n\n for (const box of boxes) {\n // look through spaces backwards so that we check smaller spaces first\n for (let i = spaces.length - 1; i >= 0; i--) {\n const space = spaces[i];\n\n // look for empty spaces that can accommodate the current box\n if (box.w > space.w || box.h > space.h) continue;\n\n // found the space; add the box to its top-left corner\n // |-------|-------|\n // | box | |\n // |_______| |\n // | space |\n // |_______________|\n box.x = space.x;\n box.y = space.y;\n\n height = Math.max(height, box.y + box.h);\n width = Math.max(width, box.x + box.w);\n\n if (box.w === space.w && box.h === space.h) {\n // space matches the box exactly; remove it\n const last = spaces.pop();\n if (i < spaces.length) spaces[i] = last;\n\n } else if (box.h === space.h) {\n // space matches the box height; update it accordingly\n // |-------|---------------|\n // | box | updated space |\n // |_______|_______________|\n space.x += box.w;\n space.w -= box.w;\n\n } else if (box.w === space.w) {\n // space matches the box width; update it accordingly\n // |---------------|\n // | box |\n // |_______________|\n // | updated space |\n // |_______________|\n space.y += box.h;\n space.h -= box.h;\n\n } else {\n // otherwise the box splits the space into two spaces\n // |-------|-----------|\n // | box | new space |\n // |_______|___________|\n // | updated space |\n // |___________________|\n spaces.push({\n x: space.x + box.w,\n y: space.y,\n w: space.w - box.w,\n h: box.h\n });\n space.y += box.h;\n space.h -= box.h;\n }\n break;\n }\n }\n\n return {\n w: width, // container width\n h: height, // container height\n fill: (area / (width * height)) || 0 // space utilization\n };\n}\n", "import { Matrix4, Object3D, Vector2, Vector3 } from 'three'\n\nclass CSS2DObject extends Object3D {\n constructor(element = document.createElement('div')) {\n super()\n\n this.isCSS2DObject = true\n\n this.element = element\n\n this.element.style.position = 'absolute'\n this.element.style.userSelect = 'none'\n\n this.element.setAttribute('draggable', false)\n\n this.center = new Vector2(0.5, 0.5) // ( 0, 0 ) is the lower left; ( 1, 1 ) is the top right\n\n this.addEventListener('removed', function () {\n this.traverse(function (object) {\n if (object.element instanceof Element && object.element.parentNode !== null) {\n object.element.parentNode.removeChild(object.element)\n }\n })\n })\n }\n\n copy(source, recursive) {\n super.copy(source, recursive)\n\n this.element = source.element.cloneNode(true)\n\n this.center = source.center\n\n return this\n }\n}\n\nconst _vector = new Vector3()\nconst _viewMatrix = new Matrix4()\nconst _viewProjectionMatrix = new Matrix4()\nconst _a = new Vector3()\nconst _b = new Vector3()\n\nclass CSS2DRenderer {\n constructor(parameters = {}) {\n const _this = this\n\n let _width, _height\n let _widthHalf, _heightHalf\n\n const cache = {\n objects: new WeakMap(),\n }\n\n const domElement = parameters.element !== undefined ? parameters.element : document.createElement('div')\n\n domElement.style.overflow = 'hidden'\n\n this.domElement = domElement\n\n this.getSize = function () {\n return {\n width: _width,\n height: _height,\n }\n }\n\n this.render = function (scene, camera) {\n if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld()\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld()\n\n _viewMatrix.copy(camera.matrixWorldInverse)\n _viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix)\n\n renderObject(scene, scene, camera)\n zOrder(scene)\n }\n\n this.setSize = function (width, height) {\n _width = width\n _height = height\n\n _widthHalf = _width / 2\n _heightHalf = _height / 2\n\n domElement.style.width = width + 'px'\n domElement.style.height = height + 'px'\n }\n\n function renderObject(object, scene, camera) {\n if (object.isCSS2DObject) {\n _vector.setFromMatrixPosition(object.matrixWorld)\n _vector.applyMatrix4(_viewProjectionMatrix)\n\n const visible =\n object.visible === true && _vector.z >= -1 && _vector.z <= 1 && object.layers.test(camera.layers) === true\n object.element.style.display = visible === true ? '' : 'none'\n\n if (visible === true) {\n object.onBeforeRender(_this, scene, camera)\n\n const element = object.element\n\n element.style.transform =\n 'translate(' +\n -100 * object.center.x +\n '%,' +\n -100 * object.center.y +\n '%)' +\n 'translate(' +\n (_vector.x * _widthHalf + _widthHalf) +\n 'px,' +\n (-_vector.y * _heightHalf + _heightHalf) +\n 'px)'\n\n if (element.parentNode !== domElement) {\n domElement.appendChild(element)\n }\n\n object.onAfterRender(_this, scene, camera)\n }\n\n const objectData = {\n distanceToCameraSquared: getDistanceToSquared(camera, object),\n }\n\n cache.objects.set(object, objectData)\n }\n\n for (let i = 0, l = object.children.length; i < l; i++) {\n renderObject(object.children[i], scene, camera)\n }\n }\n\n function getDistanceToSquared(object1, object2) {\n _a.setFromMatrixPosition(object1.matrixWorld)\n _b.setFromMatrixPosition(object2.matrixWorld)\n\n return _a.distanceToSquared(_b)\n }\n\n function filterAndFlatten(scene) {\n const result = []\n\n scene.traverse(function (object) {\n if (object.isCSS2DObject) result.push(object)\n })\n\n return result\n }\n\n function zOrder(scene) {\n const sorted = filterAndFlatten(scene).sort(function (a, b) {\n if (a.renderOrder !== b.renderOrder) {\n return b.renderOrder - a.renderOrder\n }\n\n const distanceA = cache.objects.get(a).distanceToCameraSquared\n const distanceB = cache.objects.get(b).distanceToCameraSquared\n\n return distanceA - distanceB\n })\n\n const zMax = sorted.length\n\n for (let i = 0, l = sorted.length; i < l; i++) {\n sorted[i].element.style.zIndex = zMax - i\n }\n }\n }\n}\n\nexport { CSS2DObject, CSS2DRenderer }\n", "import { Matrix4, Object3D, Quaternion, Vector3 } from 'three'\n\n/**\n * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n */\n\nconst _position = new Vector3()\nconst _quaternion = new Quaternion()\nconst _scale = new Vector3()\n\nclass CSS3DObject extends Object3D {\n constructor(element = document.createElement('div')) {\n super()\n\n this.isCSS3DObject = true\n\n this.element = element\n this.element.style.position = 'absolute'\n this.element.style.pointerEvents = 'auto'\n this.element.style.userSelect = 'none'\n\n this.element.setAttribute('draggable', false)\n\n this.addEventListener('removed', function () {\n this.traverse(function (object) {\n if (object.element instanceof Element && object.element.parentNode !== null) {\n object.element.parentNode.removeChild(object.element)\n }\n })\n })\n }\n\n copy(source, recursive) {\n super.copy(source, recursive)\n\n this.element = source.element.cloneNode(true)\n\n return this\n }\n}\n\nclass CSS3DSprite extends CSS3DObject {\n constructor(element) {\n super(element)\n\n this.isCSS3DSprite = true\n\n this.rotation2D = 0\n }\n\n copy(source, recursive) {\n super.copy(source, recursive)\n\n this.rotation2D = source.rotation2D\n\n return this\n }\n}\n\n//\n\nconst _matrix = new Matrix4()\nconst _matrix2 = new Matrix4()\n\nclass CSS3DRenderer {\n constructor(parameters = {}) {\n const _this = this\n\n let _width, _height\n let _widthHalf, _heightHalf\n\n const cache = {\n camera: { style: '' },\n objects: new WeakMap(),\n }\n\n const domElement = parameters.element !== undefined ? parameters.element : document.createElement('div')\n\n domElement.style.overflow = 'hidden'\n\n this.domElement = domElement\n\n const viewElement = document.createElement('div')\n viewElement.style.transformOrigin = '0 0'\n viewElement.style.pointerEvents = 'none'\n domElement.appendChild(viewElement)\n\n const cameraElement = document.createElement('div')\n\n cameraElement.style.transformStyle = 'preserve-3d'\n\n viewElement.appendChild(cameraElement)\n\n this.getSize = function () {\n return {\n width: _width,\n height: _height,\n }\n }\n\n this.render = function (scene, camera) {\n const fov = camera.projectionMatrix.elements[5] * _heightHalf\n\n if (camera.view && camera.view.enabled) {\n // view offset\n viewElement.style.transform = `translate( ${-camera.view.offsetX * (_width / camera.view.width)}px, ${\n -camera.view.offsetY * (_height / camera.view.height)\n }px )`\n\n // view fullWidth and fullHeight, view width and height\n viewElement.style.transform += `scale( ${camera.view.fullWidth / camera.view.width}, ${\n camera.view.fullHeight / camera.view.height\n } )`\n } else {\n viewElement.style.transform = ''\n }\n\n if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld()\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld()\n\n let tx, ty\n\n if (camera.isOrthographicCamera) {\n tx = -(camera.right + camera.left) / 2\n ty = (camera.top + camera.bottom) / 2\n }\n\n const scaleByViewOffset = camera.view && camera.view.enabled ? camera.view.height / camera.view.fullHeight : 1\n const cameraCSSMatrix = camera.isOrthographicCamera\n ? `scale( ${scaleByViewOffset} )` +\n 'scale(' +\n fov +\n ')' +\n 'translate(' +\n epsilon(tx) +\n 'px,' +\n epsilon(ty) +\n 'px)' +\n getCameraCSSMatrix(camera.matrixWorldInverse)\n : `scale( ${scaleByViewOffset} )` + 'translateZ(' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse)\n const perspective = camera.isPerspectiveCamera ? 'perspective(' + fov + 'px) ' : ''\n\n const style = perspective + cameraCSSMatrix + 'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)'\n\n if (cache.camera.style !== style) {\n cameraElement.style.transform = style\n\n cache.camera.style = style\n }\n\n renderObject(scene, scene, camera, cameraCSSMatrix)\n }\n\n this.setSize = function (width, height) {\n _width = width\n _height = height\n _widthHalf = _width / 2\n _heightHalf = _height / 2\n\n domElement.style.width = width + 'px'\n domElement.style.height = height + 'px'\n\n viewElement.style.width = width + 'px'\n viewElement.style.height = height + 'px'\n\n cameraElement.style.width = width + 'px'\n cameraElement.style.height = height + 'px'\n }\n\n function epsilon(value) {\n return Math.abs(value) < 1e-10 ? 0 : value\n }\n\n function getCameraCSSMatrix(matrix) {\n const elements = matrix.elements\n\n return (\n 'matrix3d(' +\n epsilon(elements[0]) +\n ',' +\n epsilon(-elements[1]) +\n ',' +\n epsilon(elements[2]) +\n ',' +\n epsilon(elements[3]) +\n ',' +\n epsilon(elements[4]) +\n ',' +\n epsilon(-elements[5]) +\n ',' +\n epsilon(elements[6]) +\n ',' +\n epsilon(elements[7]) +\n ',' +\n epsilon(elements[8]) +\n ',' +\n epsilon(-elements[9]) +\n ',' +\n epsilon(elements[10]) +\n ',' +\n epsilon(elements[11]) +\n ',' +\n epsilon(elements[12]) +\n ',' +\n epsilon(-elements[13]) +\n ',' +\n epsilon(elements[14]) +\n ',' +\n epsilon(elements[15]) +\n ')'\n )\n }\n\n function getObjectCSSMatrix(matrix) {\n const elements = matrix.elements\n const matrix3d =\n 'matrix3d(' +\n epsilon(elements[0]) +\n ',' +\n epsilon(elements[1]) +\n ',' +\n epsilon(elements[2]) +\n ',' +\n epsilon(elements[3]) +\n ',' +\n epsilon(-elements[4]) +\n ',' +\n epsilon(-elements[5]) +\n ',' +\n epsilon(-elements[6]) +\n ',' +\n epsilon(-elements[7]) +\n ',' +\n epsilon(elements[8]) +\n ',' +\n epsilon(elements[9]) +\n ',' +\n epsilon(elements[10]) +\n ',' +\n epsilon(elements[11]) +\n ',' +\n epsilon(elements[12]) +\n ',' +\n epsilon(elements[13]) +\n ',' +\n epsilon(elements[14]) +\n ',' +\n epsilon(elements[15]) +\n ')'\n\n return 'translate(-50%,-50%)' + matrix3d\n }\n\n function renderObject(object, scene, camera, cameraCSSMatrix) {\n if (object.isCSS3DObject) {\n const visible = object.visible === true && object.layers.test(camera.layers) === true\n object.element.style.display = visible === true ? '' : 'none'\n\n if (visible === true) {\n object.onBeforeRender(_this, scene, camera)\n\n let style\n\n if (object.isCSS3DSprite) {\n // http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\n _matrix.copy(camera.matrixWorldInverse)\n _matrix.transpose()\n\n if (object.rotation2D !== 0) _matrix.multiply(_matrix2.makeRotationZ(object.rotation2D))\n\n object.matrixWorld.decompose(_position, _quaternion, _scale)\n _matrix.setPosition(_position)\n _matrix.scale(_scale)\n\n _matrix.elements[3] = 0\n _matrix.elements[7] = 0\n _matrix.elements[11] = 0\n _matrix.elements[15] = 1\n\n style = getObjectCSSMatrix(_matrix)\n } else {\n style = getObjectCSSMatrix(object.matrixWorld)\n }\n\n const element = object.element\n const cachedObject = cache.objects.get(object)\n\n if (cachedObject === undefined || cachedObject.style !== style) {\n element.style.transform = style\n\n const objectData = { style: style }\n cache.objects.set(object, objectData)\n }\n\n if (element.parentNode !== cameraElement) {\n cameraElement.appendChild(element)\n }\n\n object.onAfterRender(_this, scene, camera)\n }\n }\n\n for (let i = 0, l = object.children.length; i < l; i++) {\n renderObject(object.children[i], scene, camera, cameraCSSMatrix)\n }\n }\n }\n}\n\nexport { CSS3DObject, CSS3DSprite, CSS3DRenderer }\n", "class FlakesTexture {\n constructor(width = 512, height = 512) {\n const canvas = document.createElement('canvas')\n canvas.width = width\n canvas.height = height\n\n const context = canvas.getContext('2d') as CanvasRenderingContext2D\n context.fillStyle = 'rgb(127,127,255)'\n context.fillRect(0, 0, width, height)\n\n for (let i = 0; i < 4000; i++) {\n const x = Math.random() * width\n const y = Math.random() * height\n const r = Math.random() * 3 + 3\n\n let nx = Math.random() * 2 - 1\n let ny = Math.random() * 2 - 1\n let nz = 1.5\n\n const l = Math.sqrt(nx * nx + ny * ny + nz * nz)\n\n nx /= l\n ny /= l\n nz /= l\n\n context.fillStyle = 'rgb(' + (nx * 127 + 127) + ',' + (ny * 127 + 127) + ',' + nz * 255 + ')'\n context.beginPath()\n context.arc(x, y, r, 0, Math.PI * 2)\n context.fill()\n }\n\n return canvas\n }\n}\n\nexport { FlakesTexture }\n", "// Original src: https://github.com/zz85/threejs-path-flow\nconst CHANNELS = 4\nconst TEXTURE_WIDTH = 1024\nconst TEXTURE_HEIGHT = 4\n\nimport {\n DataTexture,\n RGBAFormat,\n FloatType,\n RepeatWrapping,\n Mesh,\n InstancedMesh,\n NearestFilter,\n DynamicDrawUsage,\n Matrix4,\n Material,\n Curve,\n BufferGeometry,\n} from 'three'\n\nimport type { IUniform } from 'three'\n\n/**\n * Make a new DataTexture to store the descriptions of the curves.\n *\n * @param { number } numberOfCurves the number of curves needed to be described by this texture.\n */\nexport const initSplineTexture = (numberOfCurves = 1): DataTexture => {\n const dataArray = new Float32Array(TEXTURE_WIDTH * TEXTURE_HEIGHT * numberOfCurves * CHANNELS)\n const dataTexture = new DataTexture(dataArray, TEXTURE_WIDTH, TEXTURE_HEIGHT * numberOfCurves, RGBAFormat, FloatType)\n\n dataTexture.wrapS = RepeatWrapping\n dataTexture.wrapT = RepeatWrapping\n dataTexture.magFilter = NearestFilter\n dataTexture.needsUpdate = true\n\n return dataTexture\n}\n\n/**\n * Write the curve description to the data texture\n *\n * @param { DataTexture } texture The DataTexture to write to\n * @param { Curve } splineCurve The curve to describe\n * @param { number } offset Which curve slot to write to\n */\nexport const updateSplineTexture = >(\n texture: DataTexture,\n splineCurve: TCurve,\n offset = 0,\n): void => {\n const numberOfPoints = Math.floor(TEXTURE_WIDTH * (TEXTURE_HEIGHT / 4))\n splineCurve.arcLengthDivisions = numberOfPoints / 2\n splineCurve.updateArcLengths()\n const points = splineCurve.getSpacedPoints(numberOfPoints)\n const frenetFrames = splineCurve.computeFrenetFrames(numberOfPoints, true)\n\n for (let i = 0; i < numberOfPoints; i++) {\n const rowOffset = Math.floor(i / TEXTURE_WIDTH)\n const rowIndex = i % TEXTURE_WIDTH\n\n let pt = points[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 0 + rowOffset + TEXTURE_HEIGHT * offset)\n pt = frenetFrames.tangents[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 1 + rowOffset + TEXTURE_HEIGHT * offset)\n pt = frenetFrames.normals[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 2 + rowOffset + TEXTURE_HEIGHT * offset)\n pt = frenetFrames.binormals[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 3 + rowOffset + TEXTURE_HEIGHT * offset)\n }\n\n texture.needsUpdate = true\n}\n\nconst setTextureValue = (texture: DataTexture, index: number, x: number, y: number, z: number, o: number): void => {\n const image = texture.image\n const { data } = image\n const i = CHANNELS * TEXTURE_WIDTH * o // Row Offset\n data[index * CHANNELS + i + 0] = x\n data[index * CHANNELS + i + 1] = y\n data[index * CHANNELS + i + 2] = z\n data[index * CHANNELS + i + 3] = 1\n}\n\nexport interface INumericUniform extends IUniform {\n type: 'f' | 'i'\n value: number\n}\n\nexport type CurveModifierUniforms = {\n spineTexture: IUniform\n pathOffset: INumericUniform\n pathSegment: INumericUniform\n spineOffset: INumericUniform\n spineLength: INumericUniform\n flow: INumericUniform\n}\n\n/**\n * Create a new set of uniforms for describing the curve modifier\n *\n * @param { DataTexture } Texture which holds the curve description\n */\nexport const getUniforms = (splineTexture: DataTexture): CurveModifierUniforms => ({\n spineTexture: { value: splineTexture },\n pathOffset: { type: 'f', value: 0 }, // time of path curve\n pathSegment: { type: 'f', value: 1 }, // fractional length of path\n spineOffset: { type: 'f', value: 161 },\n spineLength: { type: 'f', value: 400 },\n flow: { type: 'i', value: 1 },\n})\n\nexport type ModifiedMaterial = TMaterial & {\n __ok: boolean\n}\n\nexport function modifyShader(\n material: ModifiedMaterial,\n uniforms: CurveModifierUniforms,\n numberOfCurves = 1,\n): void {\n if (material.__ok) return\n material.__ok = true\n\n material.onBeforeCompile = (shader: { vertexShader: string; uniforms: { [uniform: string]: IUniform } }): void => {\n if ((shader as any).__modified) return\n ;(shader as any).__modified = true\n\n Object.assign(shader.uniforms, uniforms)\n\n const vertexShader = /* glsl */ `\n\t\tuniform sampler2D spineTexture;\n\t\tuniform float pathOffset;\n\t\tuniform float pathSegment;\n\t\tuniform float spineOffset;\n\t\tuniform float spineLength;\n\t\tuniform int flow;\n\n\t\tfloat textureLayers = ${TEXTURE_HEIGHT * numberOfCurves}.;\n\t\tfloat textureStacks = ${TEXTURE_HEIGHT / 4}.;\n\n\t\t${shader.vertexShader}\n\t\t`\n // chunk import moved in front of modified shader below\n .replace('#include ', '')\n\n // vec3 transformedNormal declaration overriden below\n .replace('#include ', '')\n\n // vec3 transformed declaration overriden below\n .replace('#include ', '')\n\n // shader override\n .replace(\n /void\\s*main\\s*\\(\\)\\s*\\{/,\n /* glsl */ `\n void main() {\n #include \n\n vec4 worldPos = modelMatrix * vec4(position, 1.);\n\n bool bend = flow > 0;\n float xWeight = bend ? 0. : 1.;\n\n #ifdef USE_INSTANCING\n float pathOffsetFromInstanceMatrix = instanceMatrix[3][2];\n float spineLengthFromInstanceMatrix = instanceMatrix[3][0];\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLengthFromInstanceMatrix : 0.;\n float mt = (spinePortion * pathSegment + pathOffset + pathOffsetFromInstanceMatrix)*textureStacks;\n #else\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLength : 0.;\n float mt = (spinePortion * pathSegment + pathOffset)*textureStacks;\n #endif\n\n mt = mod(mt, textureStacks);\n float rowOffset = floor(mt);\n\n #ifdef USE_INSTANCING\n rowOffset += instanceMatrix[3][1] * ${TEXTURE_HEIGHT}.;\n #endif\n\n vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 a = texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 b = texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 c = texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;\n mat3 basis = mat3(a, b, c);\n\n vec3 transformed = basis\n * vec3(worldPos.x * xWeight, worldPos.y * 1., worldPos.z * 1.)\n + spinePos;\n\n vec3 transformedNormal = normalMatrix * (basis * objectNormal);\n\t\t\t`,\n )\n .replace(\n '#include ',\n /* glsl */ `vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;`,\n )\n\n shader.vertexShader = vertexShader\n }\n}\n\n/**\n * A helper class for making meshes bend aroudn curves\n */\nexport class Flow {\n public curveArray: Curve[]\n public curveLengthArray: number[]\n\n public object3D: TMesh\n public splineTexure: DataTexture\n public uniforms: CurveModifierUniforms\n\n /**\n * @param {Mesh} mesh The mesh to clone and modify to bend around the curve\n * @param {number} numberOfCurves The amount of space that should preallocated for additional curves\n */\n constructor(mesh: TMesh, numberOfCurves = 1) {\n const obj3D = mesh.clone() as TMesh\n const splineTexure = initSplineTexture(numberOfCurves)\n const uniforms = getUniforms(splineTexure)\n\n obj3D.traverse((child) => {\n if (child instanceof Mesh || child instanceof InstancedMesh) {\n child.material = child.material.clone()\n modifyShader(child.material, uniforms, numberOfCurves)\n }\n })\n\n this.curveArray = new Array(numberOfCurves)\n this.curveLengthArray = new Array(numberOfCurves)\n\n this.object3D = obj3D\n this.splineTexure = splineTexure\n this.uniforms = uniforms\n }\n\n public updateCurve>(index: number, curve: TCurve): void {\n if (index >= this.curveArray.length) throw Error('Index out of range for Flow')\n const curveLength = curve.getLength()\n this.uniforms.spineLength.value = curveLength\n this.curveLengthArray[index] = curveLength\n this.curveArray[index] = curve\n updateSplineTexture(this.splineTexure, curve, index)\n }\n\n public moveAlongCurve(amount: number): void {\n this.uniforms.pathOffset.value += amount\n }\n}\nconst matrix = new Matrix4()\n\n/**\n * A helper class for creating instanced versions of flow, where the instances are placed on the curve.\n */\nexport class InstancedFlow<\n TGeometry extends BufferGeometry = BufferGeometry,\n TMaterial extends Material = Material\n> extends Flow> {\n public offsets: number[]\n public whichCurve: number[]\n\n /**\n *\n * @param {number} count The number of instanced elements\n * @param {number} curveCount The number of curves to preallocate for\n * @param {Geometry} geometry The geometry to use for the instanced mesh\n * @param {Material} material The material to use for the instanced mesh\n */\n constructor(count: number, curveCount: number, geometry: TGeometry, material: TMaterial) {\n const mesh = new InstancedMesh(geometry, material, count)\n mesh.instanceMatrix.setUsage(DynamicDrawUsage)\n mesh.frustumCulled = false\n super(mesh, curveCount)\n\n this.offsets = new Array(count).fill(0)\n this.whichCurve = new Array(count).fill(0)\n }\n\n /**\n * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects\n * This writes that information to the matrix and marks it as needing update.\n *\n * @param {number} index of the instanced element to update\n */\n private writeChanges(index: number): void {\n matrix.makeTranslation(this.curveLengthArray[this.whichCurve[index]], this.whichCurve[index], this.offsets[index])\n this.object3D.setMatrixAt(index, matrix)\n this.object3D.instanceMatrix.needsUpdate = true\n }\n\n /**\n * Move an individual element along the curve by a specific amount\n *\n * @param {number} index Which element to update\n * @param {number} offset Move by how much\n */\n public moveIndividualAlongCurve(index: number, offset: number): void {\n this.offsets[index] += offset\n this.writeChanges(index)\n }\n\n /**\n * Select which curve to use for an element\n *\n * @param {number} index the index of the instanced element to update\n * @param {number} curveNo the index of the curve it should use\n */\n public setCurve(index: number, curveNo: number): void {\n if (isNaN(curveNo)) throw Error('curve index being set is Not a Number (NaN)')\n this.whichCurve[index] = curveNo\n this.writeChanges(index)\n }\n}\n", "export const getWithKey = (obj: T, key: K): T[K] => obj[key]\n", "import {\n BufferAttribute,\n BufferGeometry,\n Float32BufferAttribute,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n TriangleFanDrawMode,\n TriangleStripDrawMode,\n TrianglesDrawMode,\n Vector3,\n Mesh,\n Line,\n Points,\n Material,\n SkinnedMesh,\n} from 'three'\n\nimport { getWithKey } from '../types/helpers'\nimport type { TypedArrayConstructors, TypedArray } from '../types/shared'\n\n/**\n * @param {Array} geometries\n * @param {Boolean} useGroups\n * @return {BufferGeometry}\n */\nexport const mergeBufferGeometries = (geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry | null => {\n const isIndexed = geometries[0].index !== null\n\n const attributesUsed = new Set(Object.keys(geometries[0].attributes))\n const morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes))\n\n const attributes: { [key: string]: Array } = {}\n const morphAttributes: { [key: string]: Array[] } = {}\n\n const morphTargetsRelative = geometries[0].morphTargetsRelative\n\n const mergedGeometry = new BufferGeometry()\n\n let offset = 0\n\n geometries.forEach((geom, i) => {\n let attributesCount = 0\n\n // ensure that all geometries are indexed, or none\n\n if (isIndexed !== (geom.index !== null)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.',\n )\n return null\n }\n\n // gather attributes, exit early if they're different\n\n for (let name in geom.attributes) {\n if (!attributesUsed.has(name)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. All geometries must have compatible attributes; make sure \"' +\n name +\n '\" attribute exists among all geometries, or in none of them.',\n )\n return null\n }\n\n if (attributes[name] === undefined) {\n attributes[name] = []\n }\n\n attributes[name].push(geom.attributes[name])\n\n attributesCount++\n }\n\n // ensure geometries have the same number of attributes\n\n if (attributesCount !== attributesUsed.size) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. Make sure all geometries have the same number of attributes.',\n )\n return null\n }\n\n // gather morph attributes, exit early if they're different\n\n if (morphTargetsRelative !== geom.morphTargetsRelative) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. .morphTargetsRelative must be consistent throughout all geometries.',\n )\n return null\n }\n\n for (let name in geom.morphAttributes) {\n if (!morphAttributesUsed.has(name)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. .morphAttributes must be consistent throughout all geometries.',\n )\n return null\n }\n\n if (morphAttributes[name] === undefined) morphAttributes[name] = []\n\n morphAttributes[name].push(geom.morphAttributes[name])\n }\n\n // gather .userData\n\n mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || []\n mergedGeometry.userData.mergedUserData.push(geom.userData)\n\n if (useGroups) {\n let count\n\n if (geom.index) {\n count = geom.index.count\n } else if (geom.attributes.position !== undefined) {\n count = geom.attributes.position.count\n } else {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. The geometry must have either an index or a position attribute',\n )\n return null\n }\n\n mergedGeometry.addGroup(offset, count, i)\n\n offset += count\n }\n })\n\n // merge indices\n\n if (isIndexed) {\n let indexOffset = 0\n const mergedIndex: number[] = []\n\n geometries.forEach((geom) => {\n const index = geom.index as BufferAttribute\n\n for (let j = 0; j < index.count; ++j) {\n mergedIndex.push(index.getX(j) + indexOffset)\n }\n\n indexOffset += geom.attributes.position.count\n })\n\n mergedGeometry.setIndex(mergedIndex)\n }\n\n // merge attributes\n\n for (let name in attributes) {\n const mergedAttribute = mergeBufferAttributes(attributes[name] as BufferAttribute[])\n\n if (!mergedAttribute) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' attribute.',\n )\n return null\n }\n\n mergedGeometry.setAttribute(name, mergedAttribute)\n }\n\n // merge morph attributes\n\n for (let name in morphAttributes) {\n const numMorphTargets = morphAttributes[name][0].length\n\n if (numMorphTargets === 0) break\n\n mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {}\n mergedGeometry.morphAttributes[name] = []\n\n for (let i = 0; i < numMorphTargets; ++i) {\n const morphAttributesToMerge = []\n\n for (let j = 0; j < morphAttributes[name].length; ++j) {\n morphAttributesToMerge.push(morphAttributes[name][j][i])\n }\n\n const mergedMorphAttribute = mergeBufferAttributes(morphAttributesToMerge as BufferAttribute[])\n\n if (!mergedMorphAttribute) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' +\n name +\n ' morphAttribute.',\n )\n return null\n }\n\n mergedGeometry.morphAttributes[name].push(mergedMorphAttribute)\n }\n }\n\n return mergedGeometry\n}\n\n/**\n * @param {Array} attributes\n * @return {BufferAttribute}\n */\nexport const mergeBufferAttributes = (attributes: BufferAttribute[]): BufferAttribute | null | undefined => {\n let TypedArray: TypedArrayConstructors | undefined = undefined\n let itemSize: number | undefined = undefined\n let normalized: boolean | undefined = undefined\n let arrayLength = 0\n\n attributes.forEach((attr) => {\n if (TypedArray === undefined) {\n TypedArray = attr.array.constructor\n }\n if (TypedArray !== attr.array.constructor) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.',\n )\n return null\n }\n\n if (itemSize === undefined) itemSize = attr.itemSize\n if (itemSize !== attr.itemSize) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.',\n )\n return null\n }\n\n if (normalized === undefined) normalized = attr.normalized\n if (normalized !== attr.normalized) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.',\n )\n return null\n }\n\n arrayLength += attr.array.length\n })\n\n if (TypedArray && itemSize) {\n // @ts-ignore this works in JS and TS is complaining but it's such a tiny thing I can live with the guilt\n const array = new TypedArray(arrayLength)\n let offset = 0\n\n attributes.forEach((attr) => {\n array.set(attr.array, offset)\n offset += attr.array.length\n })\n\n return new BufferAttribute(array, itemSize, normalized)\n }\n}\n\n/**\n * @param {Array} attributes\n * @return {Array}\n */\nexport const interleaveAttributes = (attributes: BufferAttribute[]): InterleavedBufferAttribute[] | null => {\n // Interleaves the provided attributes into an InterleavedBuffer and returns\n // a set of InterleavedBufferAttributes for each attribute\n let TypedArray: TypedArrayConstructors | undefined = undefined\n let arrayLength = 0\n let stride = 0\n\n // calculate the the length and type of the interleavedBuffer\n for (let i = 0, l = attributes.length; i < l; ++i) {\n const attribute = attributes[i]\n\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\n arrayLength += attribute.array.length\n stride += attribute.itemSize\n }\n\n // Create the set of buffer attributes\n // @ts-ignore this works in JS and TS is complaining but it's such a tiny thing I can live with the guilt\n const interleavedBuffer = new InterleavedBuffer(new TypedArray(arrayLength), stride)\n let offset = 0\n const res = []\n const getters = ['getX', 'getY', 'getZ', 'getW']\n const setters = ['setX', 'setY', 'setZ', '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 InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized)\n res.push(iba)\n\n offset += itemSize\n\n // Move the data for each attribute into the new interleavedBuffer\n // at the appropriate offset\n for (let c = 0; c < count; c++) {\n for (let k = 0; k < itemSize; k++) {\n const set = getWithKey(iba, setters[k] as keyof InterleavedBufferAttribute) as InterleavedBufferAttribute[\n | 'setX'\n | 'setY'\n | 'setZ'\n | 'setW']\n const get = getWithKey(attribute, getters[k] as keyof BufferAttribute) as BufferAttribute[\n | 'getX'\n | 'getY'\n | 'getZ'\n | 'getW']\n set(c, get(c))\n }\n }\n }\n\n return res\n}\n\n/**\n * @param {Array} geometry\n * @return {number}\n */\nexport function estimateBytesUsed(geometry: BufferGeometry): number {\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 (let name in geometry.attributes) {\n const attr = geometry.getAttribute(name)\n mem += attr.count * attr.itemSize * (attr.array as TypedArray).BYTES_PER_ELEMENT\n }\n\n const indices = geometry.getIndex()\n mem += indices ? indices.count * indices.itemSize * (indices.array as TypedArray).BYTES_PER_ELEMENT : 0\n return mem\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} tolerance\n * @return {BufferGeometry>}\n */\nexport function mergeVertices(geometry: BufferGeometry, tolerance = 1e-4): BufferGeometry {\n tolerance = Math.max(tolerance, Number.EPSILON)\n\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 [key: string]: number\n } = {}\n const indices = geometry.getIndex()\n const positions = geometry.getAttribute('position')\n const vertexCount = indices ? indices.count : positions.count\n\n // next value for triangle indices\n let nextIndex = 0\n\n // attributes and new attribute arrays\n const attributeNames = Object.keys(geometry.attributes)\n const attrArrays: {\n [key: string]: []\n } = {}\n const morphAttrsArrays: {\n [key: string]: Array>\n } = {}\n const newIndices = []\n const getters = ['getX', 'getY', 'getZ', 'getW']\n\n // initialize the arrays\n for (let i = 0, l = attributeNames.length; i < l; i++) {\n const name = attributeNames[i]\n\n attrArrays[name] = []\n\n const morphAttr = geometry.morphAttributes[name]\n if (morphAttr) {\n morphAttrsArrays[name] = new Array(morphAttr.length).fill(0).map(() => [])\n }\n }\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\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\n for (let k = 0; k < itemSize; k++) {\n // double tilde truncates the decimal value\n // @ts-ignore no\n hash += `${~~(attribute[getters[k]](index) * shiftMultiplier)},`\n }\n }\n\n // Add another reference to the vertex if it's already\n // used by another index\n if (hash in hashToIndex) {\n newIndices.push(hashToIndex[hash])\n } else {\n // copy data to the new index in the attribute arrays\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 = attrArrays[name]\n const newMorphArrays = morphAttrsArrays[name]\n\n for (let k = 0; k < itemSize; k++) {\n const getterFunc = getters[k]\n // @ts-ignore\n newarray.push(attribute[getterFunc](index))\n\n if (morphAttr) {\n for (let m = 0, ml = morphAttr.length; m < ml; m++) {\n // @ts-ignore\n newMorphArrays[m].push(morphAttr[m][getterFunc](index))\n }\n }\n }\n }\n\n hashToIndex[hash] = nextIndex\n newIndices.push(nextIndex)\n nextIndex++\n }\n }\n\n // Generate typed arrays from new attribute arrays and update\n // the attributeBuffers\n const result = geometry.clone()\n for (let i = 0, l = attributeNames.length; i < l; i++) {\n const name = attributeNames[i]\n const oldAttribute = geometry.getAttribute(name)\n //@ts-expect-error something to do with functions and constructors and new\n const buffer = new (oldAttribute.array as TypedArray).constructor(attrArrays[name])\n const attribute = new BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized)\n\n result.setAttribute(name, attribute)\n\n // Update the attribute arrays\n if (name in morphAttrsArrays) {\n for (let j = 0; j < morphAttrsArrays[name].length; j++) {\n const oldMorphAttribute = geometry.morphAttributes[name][j]\n //@ts-expect-error something to do with functions and constructors and new\n const buffer = new (oldMorphAttribute.array as TypedArray).constructor(morphAttrsArrays[name][j])\n const morphAttribute = new BufferAttribute(buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized)\n result.morphAttributes[name][j] = morphAttribute\n }\n }\n }\n\n // indices\n\n result.setIndex(newIndices)\n\n return result\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} drawMode\n * @return {BufferGeometry}\n */\nexport function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: number): BufferGeometry {\n if (drawMode === TrianglesDrawMode) {\n console.warn('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.')\n return geometry\n }\n\n if (drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode) {\n let index = geometry.getIndex()\n\n // generate index if not present\n\n if (index === null) {\n const indices = []\n\n const position = geometry.getAttribute('position')\n\n if (position !== undefined) {\n for (let i = 0; i < position.count; i++) {\n indices.push(i)\n }\n\n geometry.setIndex(indices)\n index = geometry.getIndex()\n } else {\n console.error(\n 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.',\n )\n return geometry\n }\n }\n\n //\n\n const numberOfTriangles = (index as BufferAttribute).count - 2\n const newIndices = []\n\n if (index) {\n if (drawMode === TriangleFanDrawMode) {\n // gl.TRIANGLE_FAN\n\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\n for (let i = 0; i < numberOfTriangles; i++) {\n 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 }\n }\n\n if (newIndices.length / 3 !== numberOfTriangles) {\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.')\n }\n\n // build final geometry\n\n const newGeometry = geometry.clone()\n newGeometry.setIndex(newIndices)\n newGeometry.clearGroups()\n\n return newGeometry\n } else {\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode)\n return geometry\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 */\nexport type ComputedMorphedAttribute = {\n positionAttribute: BufferAttribute | InterleavedBufferAttribute\n normalAttribute: BufferAttribute | InterleavedBufferAttribute\n morphedPositionAttribute: Float32BufferAttribute\n morphedNormalAttribute: Float32BufferAttribute\n}\n\nexport function computeMorphedAttributes(object: Mesh | Line | Points): ComputedMorphedAttribute | null {\n if (object.geometry.isBufferGeometry !== true) {\n console.error('THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.')\n return null\n }\n\n const _vA = new Vector3()\n const _vB = new Vector3()\n const _vC = new Vector3()\n\n const _tempA = new Vector3()\n const _tempB = new Vector3()\n const _tempC = new Vector3()\n\n const _morphA = new Vector3()\n const _morphB = new Vector3()\n const _morphC = new Vector3()\n\n function _calculateMorphedAttributeData(\n object: Mesh | Line | Points,\n material: Material,\n attribute: BufferAttribute | InterleavedBufferAttribute,\n morphAttribute: (BufferAttribute | InterleavedBufferAttribute)[],\n morphTargetsRelative: boolean,\n a: number,\n b: number,\n c: number,\n modifiedAttributeArray: Float32Array,\n ): void {\n _vA.fromBufferAttribute(attribute, a)\n _vB.fromBufferAttribute(attribute, b)\n _vC.fromBufferAttribute(attribute, c)\n\n const morphInfluences = object.morphTargetInfluences\n\n if (\n // @ts-ignore\n material.morphTargets &&\n morphAttribute &&\n morphInfluences\n ) {\n _morphA.set(0, 0, 0)\n _morphB.set(0, 0, 0)\n _morphC.set(0, 0, 0)\n\n for (let i = 0, il = morphAttribute.length; i < il; i++) {\n const influence = morphInfluences[i]\n const morph = morphAttribute[i]\n\n if (influence === 0) continue\n\n _tempA.fromBufferAttribute(morph, a)\n _tempB.fromBufferAttribute(morph, b)\n _tempC.fromBufferAttribute(morph, c)\n\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\n _vA.add(_morphA)\n _vB.add(_morphB)\n _vC.add(_morphC)\n }\n\n if ((object as SkinnedMesh).isSkinnedMesh) {\n // @ts-ignore – https://github.com/three-types/three-ts-types/issues/37\n object.boneTransform(a, _vA)\n // @ts-ignore – https://github.com/three-types/three-ts-types/issues/37\n object.boneTransform(b, _vB)\n // @ts-ignore – https://github.com/three-types/three-ts-types/issues/37\n object.boneTransform(c, _vC)\n }\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\n const geometry = object.geometry\n const material = object.material\n\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\n const groups = geometry.groups\n const drawRange = geometry.drawRange\n let i, j, il, jl\n let group, groupMaterial\n let start, end\n\n const modifiedPosition = new Float32Array(positionAttribute.count * positionAttribute.itemSize)\n const modifiedNormal = new Float32Array(normalAttribute.count * normalAttribute.itemSize)\n\n if (index !== null) {\n // indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (i = 0, il = groups.length; i < il; i++) {\n group = groups[i]\n groupMaterial = material[group.materialIndex as number]\n\n start = Math.max(group.start, drawRange.start)\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count)\n\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\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n } else {\n start = Math.max(0, drawRange.start)\n end = Math.min(index.count, drawRange.start + drawRange.count)\n\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\n _calculateMorphedAttributeData(\n object,\n material,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n material,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n } else if (positionAttribute !== undefined) {\n // non-indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (i = 0, il = groups.length; i < il; i++) {\n group = groups[i]\n groupMaterial = material[group.materialIndex as number]\n\n start = Math.max(group.start, drawRange.start)\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count)\n\n for (j = start, jl = end; j < jl; j += 3) {\n a = j\n b = j + 1\n c = j + 2\n\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n } else {\n start = Math.max(0, drawRange.start)\n end = Math.min(positionAttribute.count, drawRange.start + drawRange.count)\n\n for (i = start, il = end; i < il; i += 3) {\n a = i\n b = i + 1\n c = i + 2\n\n _calculateMorphedAttributeData(\n object,\n material,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n material,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n }\n\n const morphedPositionAttribute = new Float32BufferAttribute(modifiedPosition, 3)\n const morphedNormalAttribute = new Float32BufferAttribute(modifiedNormal, 3)\n\n return {\n positionAttribute: positionAttribute,\n normalAttribute: normalAttribute,\n morphedPositionAttribute: morphedPositionAttribute,\n morphedNormalAttribute: morphedNormalAttribute,\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 * Backwards compatible with code such as @react-three/drei's ``\n * which uses this method to operate on the original geometry.\n *\n * As of this writing, BufferGeometry.toNonIndexed() warns if the geometry is\n * non-indexed and returns `this`, i.e. the same geometry on which it was called:\n * `BufferGeometry is already non-indexed.`\n *\n * @param geometry\n * @param creaseAngle\n */\nexport function toCreasedNormals(geometry: BufferGeometry, creaseAngle = Math.PI / 3 /* 60 degrees */): BufferGeometry {\n const creaseDot = Math.cos(creaseAngle)\n const hashMultiplier = (1 + 1e-10) * 1e2\n\n // reusable vectors\n const verts = [new Vector3(), new Vector3(), new Vector3()]\n const tempVec1 = new Vector3()\n const tempVec2 = new Vector3()\n const tempNorm = new Vector3()\n const tempNorm2 = new Vector3()\n\n // hashes a vector\n function hashVertex(v: Vector3): string {\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\n const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry\n const posAttr = resultGeometry.attributes.position\n const vertexMap: { [key: string]: Vector3[] } = {}\n\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\n tempVec1.subVectors(c, b)\n tempVec2.subVectors(a, b)\n\n // add the normal to the map for all vertices\n const normal = new 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)) {\n vertexMap[hash] = []\n }\n\n vertexMap[hash].push(normal)\n }\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 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\n tempVec1.subVectors(c, b)\n tempVec2.subVectors(a, b)\n\n tempNorm.crossVectors(tempVec1, tempVec2).normalize()\n\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\n for (let k = 0, lk = otherNormals.length; k < lk; k++) {\n const otherNorm = otherNormals[k]\n if (tempNorm.dot(otherNorm) > creaseDot) {\n tempNorm2.add(otherNorm)\n }\n }\n\n tempNorm2.normalize()\n normAttr.setXYZ(i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z)\n }\n }\n\n resultGeometry.setAttribute('normal', normAttr)\n return resultGeometry\n}\n", "import { BufferGeometry, Float32BufferAttribute, Vector3 } from 'three'\nimport * as BufferGeometryUtils from '../utils/BufferGeometryUtils'\n\nconst cb = new Vector3()\nconst ab = new Vector3()\n\nfunction pushIfUnique(array: TItem[], object: TItem): void {\n if (array.indexOf(object) === -1) array.push(object)\n}\n\nfunction removeFromArray(array: TItem[], object: TItem): void {\n const k = array.indexOf(object)\n if (k > -1) array.splice(k, 1)\n}\n\nclass Vertex {\n public position: Vector3\n private id: number\n\n public faces: Triangle[]\n public neighbors: Vertex[]\n\n public collapseCost: number\n public collapseNeighbor: null | Vertex\n\n public minCost: number = 0\n public totalCost: number = 0\n public costCount: number = 0\n\n constructor(v: Vector3, id: number) {\n this.position = v\n this.id = id // old index id\n\n this.faces = [] // faces vertex is connected\n this.neighbors = [] // neighbouring vertices aka \"adjacentVertices\"\n\n // these will be computed in computeEdgeCostAtVertex()\n this.collapseCost = 0 // cost of collapsing this vertex, the less the better. aka objdist\n this.collapseNeighbor = null // best candinate for collapsing\n }\n\n public addUniqueNeighbor(vertex: Vertex): void {\n pushIfUnique(this.neighbors, vertex)\n }\n\n public removeIfNonNeighbor(n: Vertex): void {\n const neighbors = this.neighbors\n const faces = this.faces\n\n const offset = neighbors.indexOf(n)\n if (offset === -1) return\n for (let i = 0; i < faces.length; i++) {\n if (faces[i].hasVertex(n)) return\n }\n\n neighbors.splice(offset, 1)\n }\n}\n\n// we use a triangle class to represent structure of face slightly differently\nclass Triangle {\n private a: number\n private b: number\n private c: Number\n\n public v1: Vertex\n public v2: Vertex\n public v3: Vertex\n\n public normal = new Vector3()\n\n constructor(v1: Vertex, v2: Vertex, v3: Vertex, a: number, b: number, c: number) {\n this.a = a\n this.b = b\n this.c = c\n\n this.v1 = v1\n this.v2 = v2\n this.v3 = v3\n\n this.computeNormal()\n\n v1.faces.push(this)\n v1.addUniqueNeighbor(v2)\n v1.addUniqueNeighbor(v3)\n\n v2.faces.push(this)\n v2.addUniqueNeighbor(v1)\n v2.addUniqueNeighbor(v3)\n\n v3.faces.push(this)\n v3.addUniqueNeighbor(v1)\n v3.addUniqueNeighbor(v2)\n }\n\n private computeNormal(): void {\n const vA = this.v1.position\n const vB = this.v2.position\n const vC = this.v3.position\n\n cb.subVectors(vC, vB)\n ab.subVectors(vA, vB)\n cb.cross(ab).normalize()\n\n this.normal.copy(cb)\n }\n\n public hasVertex(v: Vertex): boolean {\n return v === this.v1 || v === this.v2 || v === this.v3\n }\n\n public replaceVertex(oldv: Vertex, newv: Vertex): void {\n if (oldv === this.v1) this.v1 = newv\n else if (oldv === this.v2) this.v2 = newv\n else if (oldv === this.v3) this.v3 = newv\n\n removeFromArray(oldv.faces, this)\n newv.faces.push(this)\n\n oldv.removeIfNonNeighbor(this.v1)\n this.v1.removeIfNonNeighbor(oldv)\n\n oldv.removeIfNonNeighbor(this.v2)\n this.v2.removeIfNonNeighbor(oldv)\n\n oldv.removeIfNonNeighbor(this.v3)\n this.v3.removeIfNonNeighbor(oldv)\n\n this.v1.addUniqueNeighbor(this.v2)\n this.v1.addUniqueNeighbor(this.v3)\n\n this.v2.addUniqueNeighbor(this.v1)\n this.v2.addUniqueNeighbor(this.v3)\n\n this.v3.addUniqueNeighbor(this.v1)\n this.v3.addUniqueNeighbor(this.v2)\n\n this.computeNormal()\n }\n}\n\n/**\n *\tSimplification Geometry Modifier\n * - based on code and technique\n *\t - by Stan Melax in 1998\n *\t - Progressive Mesh type Polygon Reduction Algorithm\n * - http://www.melax.com/polychop/\n */\n\nclass SimplifyModifier {\n constructor() {}\n\n private computeEdgeCollapseCost = (u: Vertex, v: Vertex): number => {\n // if we collapse edge uv by moving u to v then how\n // much different will the model change, i.e. the \"error\".\n\n const edgelength = v.position.distanceTo(u.position)\n let curvature = 0\n\n const sideFaces = []\n let i,\n il = u.faces.length,\n face,\n sideFace\n\n // find the \"sides\" triangles that are on the edge uv\n for (i = 0; i < il; i++) {\n face = u.faces[i]\n\n if (face.hasVertex(v)) {\n sideFaces.push(face)\n }\n }\n\n // use the triangle facing most away from the sides\n // to determine our curvature term\n for (i = 0; i < il; i++) {\n let minCurvature = 1\n face = u.faces[i]\n\n for (let j = 0; j < sideFaces.length; j++) {\n sideFace = sideFaces[j]\n // use dot product of face normals.\n const dotProd = face.normal.dot(sideFace.normal)\n minCurvature = Math.min(minCurvature, (1.001 - dotProd) / 2)\n }\n\n curvature = Math.max(curvature, minCurvature)\n }\n\n // crude approach in attempt to preserve borders\n // though it seems not to be totally correct\n const borders = 0\n if (sideFaces.length < 2) {\n // we add some arbitrary cost for borders,\n // borders += 10;\n curvature = 1\n }\n\n const amt = edgelength * curvature + borders\n\n return amt\n }\n\n private removeVertex(v: Vertex, vertices: Vertex[]): void {\n console.assert(v.faces.length === 0)\n\n while (v.neighbors.length) {\n const n = v.neighbors.pop() as Vertex\n removeFromArray(n.neighbors, v)\n }\n\n removeFromArray(vertices, v)\n }\n\n private computeEdgeCostAtVertex = (v: Vertex): void => {\n // compute the edge collapse cost for all edges that start\n // from vertex v. Since we are only interested in reducing\n // the object by selecting the min cost edge at each step, we\n // only cache the cost of the least cost edge at this vertex\n // (in member variable collapse) as well as the value of the\n // cost (in member variable collapseCost).\n\n if (v.neighbors.length === 0) {\n // collapse if no neighbors.\n v.collapseNeighbor = null\n v.collapseCost = -0.01\n\n return\n }\n\n v.collapseCost = 100000\n v.collapseNeighbor = null\n\n // search all neighboring edges for \"least cost\" edge\n for (let i = 0; i < v.neighbors.length; i++) {\n const collapseCost = this.computeEdgeCollapseCost(v, v.neighbors[i])\n\n if (!v.collapseNeighbor) {\n v.collapseNeighbor = v.neighbors[i]\n v.collapseCost = collapseCost\n v.minCost = collapseCost\n v.totalCost = 0\n v.costCount = 0\n }\n\n v.costCount++\n v.totalCost += collapseCost\n\n if (collapseCost < v.minCost) {\n v.collapseNeighbor = v.neighbors[i]\n v.minCost = collapseCost\n }\n }\n\n // we average the cost of collapsing at this vertex\n v.collapseCost = v.totalCost / v.costCount\n // v.collapseCost = v.minCost;\n }\n\n private removeFace = (f: Triangle, faces: Triangle[]): void => {\n removeFromArray(faces, f)\n\n if (f.v1) removeFromArray(f.v1.faces, f)\n if (f.v2) removeFromArray(f.v2.faces, f)\n if (f.v3) removeFromArray(f.v3.faces, f)\n\n // TODO optimize this!\n const vs = [f.v1, f.v2, f.v3]\n let v1, v2\n\n for (let i = 0; i < 3; i++) {\n v1 = vs[i]\n v2 = vs[(i + 1) % 3]\n\n if (!v1 || !v2) continue\n\n v1.removeIfNonNeighbor(v2)\n v2.removeIfNonNeighbor(v1)\n }\n }\n\n private collapse = (vertices: Vertex[], faces: Triangle[], u: Vertex, v: Vertex): void => {\n // u and v are pointers to vertices of an edge\n\n // Collapse the edge uv by moving vertex u onto v\n\n if (!v) {\n // u is a vertex all by itself so just delete it..\n this.removeVertex(u, vertices)\n return\n }\n\n let i\n const tmpVertices = []\n\n for (i = 0; i < u.neighbors.length; i++) {\n tmpVertices.push(u.neighbors[i])\n }\n\n // delete triangles on edge uv:\n for (i = u.faces.length - 1; i >= 0; i--) {\n if (u.faces[i].hasVertex(v)) {\n this.removeFace(u.faces[i], faces)\n }\n }\n\n // update remaining triangles to have v instead of u\n for (i = u.faces.length - 1; i >= 0; i--) {\n u.faces[i].replaceVertex(u, v)\n }\n\n this.removeVertex(u, vertices)\n\n // recompute the edge collapse costs in neighborhood\n for (i = 0; i < tmpVertices.length; i++) {\n this.computeEdgeCostAtVertex(tmpVertices[i])\n }\n }\n\n private minimumCostEdge = (vertices: Vertex[]): Vertex => {\n // O(n * n) approach. TODO optimize this\n\n let least = vertices[0]\n\n for (let i = 0; i < vertices.length; i++) {\n if (vertices[i].collapseCost < least.collapseCost) {\n least = vertices[i]\n }\n }\n\n return least\n }\n\n public modify = (geometry: BufferGeometry, count: number): BufferGeometry => {\n geometry = geometry.clone()\n const attributes = geometry.attributes\n\n // this modifier can only process indexed and non-indexed geomtries with a position attribute\n\n for (let name in attributes) {\n if (name !== 'position') geometry.deleteAttribute(name)\n }\n\n geometry = BufferGeometryUtils.mergeVertices(geometry)\n\n //\n // put data of original geometry in different data structures\n //\n\n const vertices = []\n const faces = []\n\n // add vertices\n\n const positionAttribute = geometry.getAttribute('position')\n\n for (let i = 0; i < positionAttribute.count; i++) {\n const v = new Vector3().fromBufferAttribute(positionAttribute, i)\n\n const vertex = new Vertex(v, i)\n vertices.push(vertex)\n }\n\n // add faces\n\n const geomIndex = geometry.getIndex()\n\n if (geomIndex !== null) {\n for (let i = 0; i < geomIndex.count; i += 3) {\n const a = geomIndex.getX(i)\n const b = geomIndex.getX(i + 1)\n const c = geomIndex.getX(i + 2)\n\n const triangle = new Triangle(vertices[a], vertices[b], vertices[c], a, b, c)\n faces.push(triangle)\n }\n } else {\n for (let i = 0; i < positionAttribute.count; i += 3) {\n const a = i\n const b = i + 1\n const c = i + 2\n\n const triangle = new Triangle(vertices[a], vertices[b], vertices[c], a, b, c)\n faces.push(triangle)\n }\n }\n\n // compute all edge collapse costs\n\n for (let i = 0, il = vertices.length; i < il; i++) {\n this.computeEdgeCostAtVertex(vertices[i])\n }\n\n let nextVertex\n\n let z = count\n\n while (z--) {\n nextVertex = this.minimumCostEdge(vertices)\n\n if (!nextVertex) {\n console.log('THREE.SimplifyModifier: No next vertex')\n break\n } else {\n this.collapse(vertices, faces, nextVertex, nextVertex.collapseNeighbor as Vertex)\n }\n }\n\n //\n\n const simplifiedGeometry = new BufferGeometry()\n const position = []\n let index = []\n\n //\n\n for (let i = 0; i < vertices.length; i++) {\n const vertex = vertices[i].position\n position.push(vertex.x, vertex.y, vertex.z)\n }\n\n //\n\n for (let i = 0; i < faces.length; i++) {\n const face = faces[i]\n\n const a = vertices.indexOf(face.v1)\n const b = vertices.indexOf(face.v2)\n const c = vertices.indexOf(face.v3)\n\n index.push(a, b, c)\n }\n\n //\n\n simplifiedGeometry.setAttribute('position', new Float32BufferAttribute(position, 3))\n simplifiedGeometry.setIndex(index)\n\n return simplifiedGeometry\n }\n}\n\nexport { SimplifyModifier }\n", "import { REVISION } from 'three'\n\nexport const version = parseInt(REVISION.replace(/\\D+/g, ''))\n", "import {\n REVISION,\n BufferAttribute,\n ClampToEdgeWrapping,\n Color,\n DoubleSide,\n InterpolateDiscrete,\n InterpolateLinear,\n LinearFilter,\n LinearMipmapLinearFilter,\n LinearMipmapNearestFilter,\n MathUtils,\n Matrix4,\n MirroredRepeatWrapping,\n NearestFilter,\n NearestMipmapLinearFilter,\n NearestMipmapNearestFilter,\n PropertyBinding,\n RGBAFormat,\n RepeatWrapping,\n Scene,\n Texture,\n CompressedTexture,\n Vector3,\n PlaneGeometry,\n ShaderMaterial,\n Uniform,\n Mesh,\n PerspectiveCamera,\n WebGLRenderer,\n} from 'three'\nimport { version } from '../_polyfill/constants'\n\nasync function readAsDataURL(blob) {\n const buffer = await blob.arrayBuffer()\n const data = btoa(String.fromCharCode(...new Uint8Array(buffer)))\n return `data:${blob.type || ''};base64,${data}`\n}\n\nlet _renderer\nlet fullscreenQuadGeometry\nlet fullscreenQuadMaterial\nlet fullscreenQuad\n\nfunction decompress(texture, maxTextureSize = Infinity, renderer = null) {\n if (!fullscreenQuadGeometry) fullscreenQuadGeometry = new PlaneGeometry(2, 2, 1, 1)\n if (!fullscreenQuadMaterial)\n fullscreenQuadMaterial = new ShaderMaterial({\n uniforms: { blitTexture: new Uniform(texture) },\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = vec4(position.xy * 1.0,0.,.999999);\n }\n `,\n fragmentShader: /* glsl */ `\n uniform sampler2D blitTexture; \n varying vec2 vUv;\n\n void main(){ \n gl_FragColor = vec4(vUv.xy, 0, 1);\n \n #ifdef IS_SRGB\n gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n #else\n gl_FragColor = texture2D( blitTexture, vUv);\n #endif\n }\n `,\n })\n\n fullscreenQuadMaterial.uniforms.blitTexture.value = texture\n fullscreenQuadMaterial.defines.IS_SRGB =\n 'colorSpace' in texture ? texture.colorSpace === 'srgb' : texture.encoding === 3001\n fullscreenQuadMaterial.needsUpdate = true\n\n if (!fullscreenQuad) {\n fullscreenQuad = new Mesh(fullscreenQuadGeometry, fullscreenQuadMaterial)\n fullscreenQuad.frustrumCulled = false\n }\n\n const _camera = new PerspectiveCamera()\n const _scene = new Scene()\n _scene.add(fullscreenQuad)\n\n if (!renderer) {\n renderer = _renderer = new WebGLRenderer({ antialias: false })\n }\n\n renderer.setSize(Math.min(texture.image.width, maxTextureSize), Math.min(texture.image.height, maxTextureSize))\n renderer.clear()\n renderer.render(_scene, _camera)\n\n const readableTexture = new Texture(renderer.domElement)\n\n readableTexture.minFilter = texture.minFilter\n readableTexture.magFilter = texture.magFilter\n readableTexture.wrapS = texture.wrapS\n readableTexture.wrapT = texture.wrapT\n readableTexture.name = texture.name\n\n if (_renderer) {\n _renderer.dispose()\n _renderer = null\n }\n\n return readableTexture\n}\n\n/**\n * The KHR_mesh_quantization extension allows these extra attribute component types\n *\n * @see https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md#extending-mesh-attributes\n */\nconst KHR_mesh_quantization_ExtraAttrTypes = {\n POSITION: [\n 'byte',\n 'byte normalized',\n 'unsigned byte',\n 'unsigned byte normalized',\n 'short',\n 'short normalized',\n 'unsigned short',\n 'unsigned short normalized',\n ],\n NORMAL: ['byte normalized', 'short normalized'],\n TANGENT: ['byte normalized', 'short normalized'],\n TEXCOORD: ['byte', 'byte normalized', 'unsigned byte', 'short', 'short normalized', 'unsigned short'],\n}\n\nclass GLTFExporter {\n /**\n * Static utility functions\n */\n static Utils = {\n insertKeyframe: function (track, time) {\n const tolerance = 0.001 // 1ms\n const valueSize = track.getValueSize()\n\n const times = new track.TimeBufferType(track.times.length + 1)\n const values = new track.ValueBufferType(track.values.length + valueSize)\n const interpolant = track.createInterpolant(new track.ValueBufferType(valueSize))\n\n let index\n\n if (track.times.length === 0) {\n times[0] = time\n\n for (let i = 0; i < valueSize; i++) {\n values[i] = 0\n }\n\n index = 0\n } else if (time < track.times[0]) {\n if (Math.abs(track.times[0] - time) < tolerance) return 0\n\n times[0] = time\n times.set(track.times, 1)\n\n values.set(interpolant.evaluate(time), 0)\n values.set(track.values, valueSize)\n\n index = 0\n } else if (time > track.times[track.times.length - 1]) {\n if (Math.abs(track.times[track.times.length - 1] - time) < tolerance) {\n return track.times.length - 1\n }\n\n times[times.length - 1] = time\n times.set(track.times, 0)\n\n values.set(track.values, 0)\n values.set(interpolant.evaluate(time), track.values.length)\n\n index = times.length - 1\n } else {\n for (let i = 0; i < track.times.length; i++) {\n if (Math.abs(track.times[i] - time) < tolerance) return i\n\n if (track.times[i] < time && track.times[i + 1] > time) {\n times.set(track.times.slice(0, i + 1), 0)\n times[i + 1] = time\n times.set(track.times.slice(i + 1), i + 2)\n\n values.set(track.values.slice(0, (i + 1) * valueSize), 0)\n values.set(interpolant.evaluate(time), (i + 1) * valueSize)\n values.set(track.values.slice((i + 1) * valueSize), (i + 2) * valueSize)\n\n index = i + 1\n\n break\n }\n }\n }\n\n track.times = times\n track.values = values\n\n return index\n },\n\n mergeMorphTargetTracks: function (clip, root) {\n const tracks = []\n const mergedTracks = {}\n const sourceTracks = clip.tracks\n\n for (let i = 0; i < sourceTracks.length; ++i) {\n let sourceTrack = sourceTracks[i]\n const sourceTrackBinding = PropertyBinding.parseTrackName(sourceTrack.name)\n const sourceTrackNode = PropertyBinding.findNode(root, sourceTrackBinding.nodeName)\n\n if (\n sourceTrackBinding.propertyName !== 'morphTargetInfluences' ||\n sourceTrackBinding.propertyIndex === undefined\n ) {\n // Tracks that don't affect morph targets, or that affect all morph targets together, can be left as-is.\n tracks.push(sourceTrack)\n continue\n }\n\n if (\n sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodDiscrete &&\n sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodLinear\n ) {\n if (sourceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {\n // This should never happen, because glTF morph target animations\n // affect all targets already.\n throw new Error('THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.')\n }\n\n console.warn('THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.')\n\n sourceTrack = sourceTrack.clone()\n sourceTrack.setInterpolation(InterpolateLinear)\n }\n\n const targetCount = sourceTrackNode.morphTargetInfluences.length\n const targetIndex = sourceTrackNode.morphTargetDictionary[sourceTrackBinding.propertyIndex]\n\n if (targetIndex === undefined) {\n throw new Error('THREE.GLTFExporter: Morph target name not found: ' + sourceTrackBinding.propertyIndex)\n }\n\n let mergedTrack\n\n // If this is the first time we've seen this object, create a new\n // track to store merged keyframe data for each morph target.\n if (mergedTracks[sourceTrackNode.uuid] === undefined) {\n mergedTrack = sourceTrack.clone()\n\n const values = new mergedTrack.ValueBufferType(targetCount * mergedTrack.times.length)\n\n for (let j = 0; j < mergedTrack.times.length; j++) {\n values[j * targetCount + targetIndex] = mergedTrack.values[j]\n }\n\n // We need to take into consideration the intended target node\n // of our original un-merged morphTarget animation.\n mergedTrack.name = (sourceTrackBinding.nodeName || '') + '.morphTargetInfluences'\n mergedTrack.values = values\n\n mergedTracks[sourceTrackNode.uuid] = mergedTrack\n tracks.push(mergedTrack)\n\n continue\n }\n\n const sourceInterpolant = sourceTrack.createInterpolant(new sourceTrack.ValueBufferType(1))\n\n mergedTrack = mergedTracks[sourceTrackNode.uuid]\n\n // For every existing keyframe of the merged track, write a (possibly\n // interpolated) value from the source track.\n for (let j = 0; j < mergedTrack.times.length; j++) {\n mergedTrack.values[j * targetCount + targetIndex] = sourceInterpolant.evaluate(mergedTrack.times[j])\n }\n\n // For every existing keyframe of the source track, write a (possibly\n // new) keyframe to the merged track. Values from the previous loop may\n // be written again, but keyframes are de-duplicated.\n for (let j = 0; j < sourceTrack.times.length; j++) {\n const keyframeIndex = this.insertKeyframe(mergedTrack, sourceTrack.times[j])\n mergedTrack.values[keyframeIndex * targetCount + targetIndex] = sourceTrack.values[j]\n }\n }\n\n clip.tracks = tracks\n\n return clip\n },\n }\n\n constructor() {\n this.pluginCallbacks = []\n\n this.register(function (writer) {\n return new GLTFLightExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsUnlitExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsTransmissionExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsVolumeExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsIorExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsSpecularExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsClearcoatExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsIridescenceExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsSheenExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsAnisotropyExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsEmissiveStrengthExtension(writer)\n })\n }\n\n register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) {\n this.pluginCallbacks.push(callback)\n }\n\n return this\n }\n\n unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) {\n this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1)\n }\n\n return this\n }\n\n /**\n * Parse scenes and generate GLTF output\n * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes\n * @param {Function} onDone Callback on completed\n * @param {Function} onError Callback on errors\n * @param {Object} options options\n */\n parse(input, onDone, onError, options) {\n const writer = new GLTFWriter()\n const plugins = []\n\n for (let i = 0, il = this.pluginCallbacks.length; i < il; i++) {\n plugins.push(this.pluginCallbacks[i](writer))\n }\n\n writer.setPlugins(plugins)\n writer.write(input, onDone, options).catch(onError)\n }\n\n parseAsync(input, options) {\n const scope = this\n\n return new Promise(function (resolve, reject) {\n scope.parse(input, resolve, reject, options)\n })\n }\n}\n\n//------------------------------------------------------------------------------\n// Constants\n//------------------------------------------------------------------------------\n\nconst WEBGL_CONSTANTS = {\n POINTS: 0x0000,\n LINES: 0x0001,\n LINE_LOOP: 0x0002,\n LINE_STRIP: 0x0003,\n TRIANGLES: 0x0004,\n TRIANGLE_STRIP: 0x0005,\n TRIANGLE_FAN: 0x0006,\n\n BYTE: 0x1400,\n UNSIGNED_BYTE: 0x1401,\n SHORT: 0x1402,\n UNSIGNED_SHORT: 0x1403,\n INT: 0x1404,\n UNSIGNED_INT: 0x1405,\n FLOAT: 0x1406,\n\n ARRAY_BUFFER: 0x8892,\n ELEMENT_ARRAY_BUFFER: 0x8893,\n\n NEAREST: 0x2600,\n LINEAR: 0x2601,\n NEAREST_MIPMAP_NEAREST: 0x2700,\n LINEAR_MIPMAP_NEAREST: 0x2701,\n NEAREST_MIPMAP_LINEAR: 0x2702,\n LINEAR_MIPMAP_LINEAR: 0x2703,\n\n CLAMP_TO_EDGE: 33071,\n MIRRORED_REPEAT: 33648,\n REPEAT: 10497,\n}\n\nconst KHR_MESH_QUANTIZATION = 'KHR_mesh_quantization'\n\nconst THREE_TO_WEBGL = {}\n\nTHREE_TO_WEBGL[NearestFilter] = WEBGL_CONSTANTS.NEAREST\nTHREE_TO_WEBGL[NearestMipmapNearestFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST\nTHREE_TO_WEBGL[NearestMipmapLinearFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR\nTHREE_TO_WEBGL[LinearFilter] = WEBGL_CONSTANTS.LINEAR\nTHREE_TO_WEBGL[LinearMipmapNearestFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST\nTHREE_TO_WEBGL[LinearMipmapLinearFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR\n\nTHREE_TO_WEBGL[ClampToEdgeWrapping] = WEBGL_CONSTANTS.CLAMP_TO_EDGE\nTHREE_TO_WEBGL[RepeatWrapping] = WEBGL_CONSTANTS.REPEAT\nTHREE_TO_WEBGL[MirroredRepeatWrapping] = WEBGL_CONSTANTS.MIRRORED_REPEAT\n\nconst PATH_PROPERTIES = {\n scale: 'scale',\n position: 'translation',\n quaternion: 'rotation',\n morphTargetInfluences: 'weights',\n}\n\nconst DEFAULT_SPECULAR_COLOR = new Color()\n\n// GLB constants\n// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification\n\nconst GLB_HEADER_BYTES = 12\nconst GLB_HEADER_MAGIC = 0x46546c67\nconst GLB_VERSION = 2\n\nconst GLB_CHUNK_PREFIX_BYTES = 8\nconst GLB_CHUNK_TYPE_JSON = 0x4e4f534a\nconst GLB_CHUNK_TYPE_BIN = 0x004e4942\n\n//------------------------------------------------------------------------------\n// Utility functions\n//------------------------------------------------------------------------------\n\n/**\n * Compare two arrays\n * @param {Array} array1 Array 1 to compare\n * @param {Array} array2 Array 2 to compare\n * @return {Boolean} Returns true if both arrays are equal\n */\nfunction equalArray(array1, array2) {\n return (\n array1.length === array2.length &&\n array1.every(function (element, index) {\n return element === array2[index]\n })\n )\n}\n\n/**\n * Converts a string to an ArrayBuffer.\n * @param {string} text\n * @return {ArrayBuffer}\n */\nfunction stringToArrayBuffer(text) {\n return new TextEncoder().encode(text).buffer\n}\n\n/**\n * Is identity matrix\n *\n * @param {Matrix4} matrix\n * @returns {Boolean} Returns true, if parameter is identity matrix\n */\nfunction isIdentityMatrix(matrix) {\n return equalArray(matrix.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])\n}\n\n/**\n * Get the min and max vectors from the given attribute\n * @param {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count\n * @param {Integer} start\n * @param {Integer} count\n * @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components)\n */\nfunction getMinMax(attribute, start, count) {\n const output = {\n min: new Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),\n max: new Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY),\n }\n\n for (let i = start; i < start + count; i++) {\n for (let a = 0; a < attribute.itemSize; a++) {\n let value\n\n if (attribute.itemSize > 4) {\n // no support for interleaved data for itemSize > 4\n\n value = attribute.array[i * attribute.itemSize + a]\n } else {\n if (a === 0) value = attribute.getX(i)\n else if (a === 1) value = attribute.getY(i)\n else if (a === 2) value = attribute.getZ(i)\n else if (a === 3) value = attribute.getW(i)\n\n if (attribute.normalized === true) {\n value = MathUtils.normalize(value, attribute.array)\n }\n }\n\n output.min[a] = Math.min(output.min[a], value)\n output.max[a] = Math.max(output.max[a], value)\n }\n }\n\n return output\n}\n\n/**\n * Get the required size + padding for a buffer, rounded to the next 4-byte boundary.\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#data-alignment\n *\n * @param {Integer} bufferSize The size the original buffer.\n * @returns {Integer} new buffer size with required padding.\n *\n */\nfunction getPaddedBufferSize(bufferSize) {\n return Math.ceil(bufferSize / 4) * 4\n}\n\n/**\n * Returns a buffer aligned to 4-byte boundary.\n *\n * @param {ArrayBuffer} arrayBuffer Buffer to pad\n * @param {Integer} paddingByte (Optional)\n * @returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer\n */\nfunction getPaddedArrayBuffer(arrayBuffer, paddingByte = 0) {\n const paddedLength = getPaddedBufferSize(arrayBuffer.byteLength)\n\n if (paddedLength !== arrayBuffer.byteLength) {\n const array = new Uint8Array(paddedLength)\n array.set(new Uint8Array(arrayBuffer))\n\n if (paddingByte !== 0) {\n for (let i = arrayBuffer.byteLength; i < paddedLength; i++) {\n array[i] = paddingByte\n }\n }\n\n return array.buffer\n }\n\n return arrayBuffer\n}\n\nfunction getCanvas() {\n if (typeof document === 'undefined' && typeof OffscreenCanvas !== 'undefined') {\n return new OffscreenCanvas(1, 1)\n }\n\n return document.createElement('canvas')\n}\n\nfunction getToBlobPromise(canvas, mimeType) {\n if (canvas.toBlob !== undefined) {\n return new Promise((resolve) => canvas.toBlob(resolve, mimeType))\n }\n\n let quality\n\n // Blink's implementation of convertToBlob seems to default to a quality level of 100%\n // Use the Blink default quality levels of toBlob instead so that file sizes are comparable.\n if (mimeType === 'image/jpeg') {\n quality = 0.92\n } else if (mimeType === 'image/webp') {\n quality = 0.8\n }\n\n return canvas.convertToBlob({\n type: mimeType,\n quality: quality,\n })\n}\n\n/**\n * Writer\n */\nclass GLTFWriter {\n constructor() {\n this.plugins = []\n\n this.options = {}\n this.pending = []\n this.buffers = []\n\n this.byteOffset = 0\n this.buffers = []\n this.nodeMap = new Map()\n this.skins = []\n\n this.extensionsUsed = {}\n this.extensionsRequired = {}\n\n this.uids = new Map()\n this.uid = 0\n\n this.json = {\n asset: {\n version: '2.0',\n generator: 'THREE.GLTFExporter',\n },\n }\n\n this.cache = {\n meshes: new Map(),\n attributes: new Map(),\n attributesNormalized: new Map(),\n materials: new Map(),\n textures: new Map(),\n images: new Map(),\n }\n }\n\n setPlugins(plugins) {\n this.plugins = plugins\n }\n\n /**\n * Parse scenes and generate GLTF output\n * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes\n * @param {Function} onDone Callback on completed\n * @param {Object} options options\n */\n async write(input, onDone, options = {}) {\n this.options = Object.assign(\n {\n // default options\n binary: false,\n trs: false,\n onlyVisible: true,\n maxTextureSize: Infinity,\n animations: [],\n includeCustomExtensions: false,\n },\n options,\n )\n\n if (this.options.animations.length > 0) {\n // Only TRS properties, and not matrices, may be targeted by animation.\n this.options.trs = true\n }\n\n this.processInput(input)\n\n await Promise.all(this.pending)\n\n const writer = this\n const buffers = writer.buffers\n const json = writer.json\n options = writer.options\n\n const extensionsUsed = writer.extensionsUsed\n const extensionsRequired = writer.extensionsRequired\n\n // Merge buffers.\n const blob = new Blob(buffers, { type: 'application/octet-stream' })\n\n // Declare extensions.\n const extensionsUsedList = Object.keys(extensionsUsed)\n const extensionsRequiredList = Object.keys(extensionsRequired)\n\n if (extensionsUsedList.length > 0) json.extensionsUsed = extensionsUsedList\n if (extensionsRequiredList.length > 0) json.extensionsRequired = extensionsRequiredList\n\n // Update bytelength of the single buffer.\n if (json.buffers && json.buffers.length > 0) json.buffers[0].byteLength = blob.size\n\n if (options.binary === true) {\n // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification\n\n blob.arrayBuffer().then((result) => {\n // Binary chunk.\n const binaryChunk = getPaddedArrayBuffer(result)\n const binaryChunkPrefix = new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES))\n binaryChunkPrefix.setUint32(0, binaryChunk.byteLength, true)\n binaryChunkPrefix.setUint32(4, GLB_CHUNK_TYPE_BIN, true)\n\n // JSON chunk.\n const jsonChunk = getPaddedArrayBuffer(stringToArrayBuffer(JSON.stringify(json)), 0x20)\n const jsonChunkPrefix = new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES))\n jsonChunkPrefix.setUint32(0, jsonChunk.byteLength, true)\n jsonChunkPrefix.setUint32(4, GLB_CHUNK_TYPE_JSON, true)\n\n // GLB header.\n const header = new ArrayBuffer(GLB_HEADER_BYTES)\n const headerView = new DataView(header)\n headerView.setUint32(0, GLB_HEADER_MAGIC, true)\n headerView.setUint32(4, GLB_VERSION, true)\n const totalByteLength =\n GLB_HEADER_BYTES +\n jsonChunkPrefix.byteLength +\n jsonChunk.byteLength +\n binaryChunkPrefix.byteLength +\n binaryChunk.byteLength\n headerView.setUint32(8, totalByteLength, true)\n\n const glbBlob = new Blob([header, jsonChunkPrefix, jsonChunk, binaryChunkPrefix, binaryChunk], {\n type: 'application/octet-stream',\n })\n\n glbBlob.arrayBuffer().then(onDone)\n })\n } else {\n if (json.buffers && json.buffers.length > 0) {\n readAsDataURL(blob).then((uri) => {\n json.buffers[0].uri = uri\n onDone(json)\n })\n } else {\n onDone(json)\n }\n }\n }\n\n /**\n * Serializes a userData.\n *\n * @param {THREE.Object3D|THREE.Material} object\n * @param {Object} objectDef\n */\n serializeUserData(object, objectDef) {\n if (Object.keys(object.userData).length === 0) return\n\n const options = this.options\n const extensionsUsed = this.extensionsUsed\n\n try {\n const json = JSON.parse(JSON.stringify(object.userData))\n\n if (options.includeCustomExtensions && json.gltfExtensions) {\n if (objectDef.extensions === undefined) objectDef.extensions = {}\n\n for (const extensionName in json.gltfExtensions) {\n objectDef.extensions[extensionName] = json.gltfExtensions[extensionName]\n extensionsUsed[extensionName] = true\n }\n\n delete json.gltfExtensions\n }\n\n if (Object.keys(json).length > 0) objectDef.extras = json\n } catch (error) {\n console.warn(\n \"THREE.GLTFExporter: userData of '\" +\n object.name +\n \"' \" +\n \"won't be serialized because of JSON.stringify error - \" +\n error.message,\n )\n }\n }\n\n /**\n * Returns ids for buffer attributes.\n * @param {Object} object\n * @return {Integer}\n */\n getUID(attribute, isRelativeCopy = false) {\n if (this.uids.has(attribute) === false) {\n const uids = new Map()\n\n uids.set(true, this.uid++)\n uids.set(false, this.uid++)\n\n this.uids.set(attribute, uids)\n }\n\n const uids = this.uids.get(attribute)\n\n return uids.get(isRelativeCopy)\n }\n\n /**\n * Checks if normal attribute values are normalized.\n *\n * @param {BufferAttribute} normal\n * @returns {Boolean}\n */\n isNormalizedNormalAttribute(normal) {\n const cache = this.cache\n\n if (cache.attributesNormalized.has(normal)) return false\n\n const v = new Vector3()\n\n for (let i = 0, il = normal.count; i < il; i++) {\n // 0.0005 is from glTF-validator\n if (Math.abs(v.fromBufferAttribute(normal, i).length() - 1.0) > 0.0005) return false\n }\n\n return true\n }\n\n /**\n * Creates normalized normal buffer attribute.\n *\n * @param {BufferAttribute} normal\n * @returns {BufferAttribute}\n *\n */\n createNormalizedNormalAttribute(normal) {\n const cache = this.cache\n\n if (cache.attributesNormalized.has(normal)) return cache.attributesNormalized.get(normal)\n\n const attribute = normal.clone()\n const v = new Vector3()\n\n for (let i = 0, il = attribute.count; i < il; i++) {\n v.fromBufferAttribute(attribute, i)\n\n if (v.x === 0 && v.y === 0 && v.z === 0) {\n // if values can't be normalized set (1, 0, 0)\n v.setX(1.0)\n } else {\n v.normalize()\n }\n\n attribute.setXYZ(i, v.x, v.y, v.z)\n }\n\n cache.attributesNormalized.set(normal, attribute)\n\n return attribute\n }\n\n /**\n * Applies a texture transform, if present, to the map definition. Requires\n * the KHR_texture_transform extension.\n *\n * @param {Object} mapDef\n * @param {THREE.Texture} texture\n */\n applyTextureTransform(mapDef, texture) {\n let didTransform = false\n const transformDef = {}\n\n if (texture.offset.x !== 0 || texture.offset.y !== 0) {\n transformDef.offset = texture.offset.toArray()\n didTransform = true\n }\n\n if (texture.rotation !== 0) {\n transformDef.rotation = texture.rotation\n didTransform = true\n }\n\n if (texture.repeat.x !== 1 || texture.repeat.y !== 1) {\n transformDef.scale = texture.repeat.toArray()\n didTransform = true\n }\n\n if (didTransform) {\n mapDef.extensions = mapDef.extensions || {}\n mapDef.extensions['KHR_texture_transform'] = transformDef\n this.extensionsUsed['KHR_texture_transform'] = true\n }\n }\n\n buildMetalRoughTexture(metalnessMap, roughnessMap) {\n if (metalnessMap === roughnessMap) return metalnessMap\n\n function getEncodingConversion(map) {\n if ('colorSpace' in map ? map.colorSpace === 'srgb' : map.encoding === 3001) {\n return function SRGBToLinear(c) {\n return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4)\n }\n }\n\n return function LinearToLinear(c) {\n return c\n }\n }\n\n console.warn('THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.')\n\n if (metalnessMap instanceof CompressedTexture) {\n metalnessMap = decompress(metalnessMap)\n }\n\n if (roughnessMap instanceof CompressedTexture) {\n roughnessMap = decompress(roughnessMap)\n }\n\n const metalness = metalnessMap ? metalnessMap.image : null\n const roughness = roughnessMap ? roughnessMap.image : null\n\n const width = Math.max(metalness ? metalness.width : 0, roughness ? roughness.width : 0)\n const height = Math.max(metalness ? metalness.height : 0, roughness ? roughness.height : 0)\n\n const canvas = getCanvas()\n canvas.width = width\n canvas.height = height\n\n const context = canvas.getContext('2d')\n context.fillStyle = '#00ffff'\n context.fillRect(0, 0, width, height)\n\n const composite = context.getImageData(0, 0, width, height)\n\n if (metalness) {\n context.drawImage(metalness, 0, 0, width, height)\n\n const convert = getEncodingConversion(metalnessMap)\n const data = context.getImageData(0, 0, width, height).data\n\n for (let i = 2; i < data.length; i += 4) {\n composite.data[i] = convert(data[i] / 256) * 256\n }\n }\n\n if (roughness) {\n context.drawImage(roughness, 0, 0, width, height)\n\n const convert = getEncodingConversion(roughnessMap)\n const data = context.getImageData(0, 0, width, height).data\n\n for (let i = 1; i < data.length; i += 4) {\n composite.data[i] = convert(data[i] / 256) * 256\n }\n }\n\n context.putImageData(composite, 0, 0)\n\n //\n\n const reference = metalnessMap || roughnessMap\n\n const texture = reference.clone()\n\n // TODO Use new Source() instead?\n texture.source = new Texture(canvas).source\n if ('colorSpace' in texture) texture.colorSpace = ''\n else texture.encoding = 3000\n texture.channel = (metalnessMap || roughnessMap).channel\n\n if (metalnessMap && roughnessMap && metalnessMap.channel !== roughnessMap.channel) {\n console.warn('THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match.')\n }\n\n return texture\n }\n\n /**\n * Process a buffer to append to the default one.\n * @param {ArrayBuffer} buffer\n * @return {Integer}\n */\n processBuffer(buffer) {\n const json = this.json\n const buffers = this.buffers\n\n if (!json.buffers) json.buffers = [{ byteLength: 0 }]\n\n // All buffers are merged before export.\n buffers.push(buffer)\n\n return 0\n }\n\n /**\n * Process and generate a BufferView\n * @param {BufferAttribute} attribute\n * @param {number} componentType\n * @param {number} start\n * @param {number} count\n * @param {number} target (Optional) Target usage of the BufferView\n * @return {Object}\n */\n processBufferView(attribute, componentType, start, count, target) {\n const json = this.json\n\n if (!json.bufferViews) json.bufferViews = []\n\n // Create a new dataview and dump the attribute's array into it\n\n let componentSize\n\n switch (componentType) {\n case WEBGL_CONSTANTS.BYTE:\n case WEBGL_CONSTANTS.UNSIGNED_BYTE:\n componentSize = 1\n\n break\n\n case WEBGL_CONSTANTS.SHORT:\n case WEBGL_CONSTANTS.UNSIGNED_SHORT:\n componentSize = 2\n\n break\n\n default:\n componentSize = 4\n }\n\n const byteLength = getPaddedBufferSize(count * attribute.itemSize * componentSize)\n const dataView = new DataView(new ArrayBuffer(byteLength))\n let offset = 0\n\n for (let i = start; i < start + count; i++) {\n for (let a = 0; a < attribute.itemSize; a++) {\n let value\n\n if (attribute.itemSize > 4) {\n // no support for interleaved data for itemSize > 4\n\n value = attribute.array[i * attribute.itemSize + a]\n } else {\n if (a === 0) value = attribute.getX(i)\n else if (a === 1) value = attribute.getY(i)\n else if (a === 2) value = attribute.getZ(i)\n else if (a === 3) value = attribute.getW(i)\n\n if (attribute.normalized === true) {\n value = MathUtils.normalize(value, attribute.array)\n }\n }\n\n if (componentType === WEBGL_CONSTANTS.FLOAT) {\n dataView.setFloat32(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.INT) {\n dataView.setInt32(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.UNSIGNED_INT) {\n dataView.setUint32(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.SHORT) {\n dataView.setInt16(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.UNSIGNED_SHORT) {\n dataView.setUint16(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.BYTE) {\n dataView.setInt8(offset, value)\n } else if (componentType === WEBGL_CONSTANTS.UNSIGNED_BYTE) {\n dataView.setUint8(offset, value)\n }\n\n offset += componentSize\n }\n }\n\n const bufferViewDef = {\n buffer: this.processBuffer(dataView.buffer),\n byteOffset: this.byteOffset,\n byteLength: byteLength,\n }\n\n if (target !== undefined) bufferViewDef.target = target\n\n if (target === WEBGL_CONSTANTS.ARRAY_BUFFER) {\n // Only define byteStride for vertex attributes.\n bufferViewDef.byteStride = attribute.itemSize * componentSize\n }\n\n this.byteOffset += byteLength\n\n json.bufferViews.push(bufferViewDef)\n\n // @TODO Merge bufferViews where possible.\n const output = {\n id: json.bufferViews.length - 1,\n byteLength: 0,\n }\n\n return output\n }\n\n /**\n * Process and generate a BufferView from an image Blob.\n * @param {Blob} blob\n * @return {Promise}\n */\n processBufferViewImage(blob) {\n const writer = this\n const json = writer.json\n\n if (!json.bufferViews) json.bufferViews = []\n\n return blob.arrayBuffer().then((result) => {\n const buffer = getPaddedArrayBuffer(result)\n\n const bufferViewDef = {\n buffer: writer.processBuffer(buffer),\n byteOffset: writer.byteOffset,\n byteLength: buffer.byteLength,\n }\n\n writer.byteOffset += buffer.byteLength\n return json.bufferViews.push(bufferViewDef) - 1\n })\n }\n\n /**\n * Process attribute to generate an accessor\n * @param {BufferAttribute} attribute Attribute to process\n * @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range\n * @param {Integer} start (Optional)\n * @param {Integer} count (Optional)\n * @return {Integer|null} Index of the processed accessor on the \"accessors\" array\n */\n processAccessor(attribute, geometry, start, count) {\n const json = this.json\n\n const types = {\n 1: 'SCALAR',\n 2: 'VEC2',\n 3: 'VEC3',\n 4: 'VEC4',\n 9: 'MAT3',\n 16: 'MAT4',\n }\n\n let componentType\n\n // Detect the component type of the attribute array\n if (attribute.array.constructor === Float32Array) {\n componentType = WEBGL_CONSTANTS.FLOAT\n } else if (attribute.array.constructor === Int32Array) {\n componentType = WEBGL_CONSTANTS.INT\n } else if (attribute.array.constructor === Uint32Array) {\n componentType = WEBGL_CONSTANTS.UNSIGNED_INT\n } else if (attribute.array.constructor === Int16Array) {\n componentType = WEBGL_CONSTANTS.SHORT\n } else if (attribute.array.constructor === Uint16Array) {\n componentType = WEBGL_CONSTANTS.UNSIGNED_SHORT\n } else if (attribute.array.constructor === Int8Array) {\n componentType = WEBGL_CONSTANTS.BYTE\n } else if (attribute.array.constructor === Uint8Array) {\n componentType = WEBGL_CONSTANTS.UNSIGNED_BYTE\n } else {\n throw new Error(\n 'THREE.GLTFExporter: Unsupported bufferAttribute component type: ' + attribute.array.constructor.name,\n )\n }\n\n if (start === undefined) start = 0\n if (count === undefined) count = attribute.count\n\n // Skip creating an accessor if the attribute doesn't have data to export\n if (count === 0) return null\n\n const minMax = getMinMax(attribute, start, count)\n let bufferViewTarget\n\n // If geometry isn't provided, don't infer the target usage of the bufferView. For\n // animation samplers, target must not be set.\n if (geometry !== undefined) {\n bufferViewTarget =\n attribute === geometry.index ? WEBGL_CONSTANTS.ELEMENT_ARRAY_BUFFER : WEBGL_CONSTANTS.ARRAY_BUFFER\n }\n\n const bufferView = this.processBufferView(attribute, componentType, start, count, bufferViewTarget)\n\n const accessorDef = {\n bufferView: bufferView.id,\n byteOffset: bufferView.byteOffset,\n componentType: componentType,\n count: count,\n max: minMax.max,\n min: minMax.min,\n type: types[attribute.itemSize],\n }\n\n if (attribute.normalized === true) accessorDef.normalized = true\n if (!json.accessors) json.accessors = []\n\n return json.accessors.push(accessorDef) - 1\n }\n\n /**\n * Process image\n * @param {Image} image to process\n * @param {Integer} format of the image (RGBAFormat)\n * @param {Boolean} flipY before writing out the image\n * @param {String} mimeType export format\n * @return {Integer} Index of the processed texture in the \"images\" array\n */\n processImage(image, format, flipY, mimeType = 'image/png') {\n if (image !== null) {\n const writer = this\n const cache = writer.cache\n const json = writer.json\n const options = writer.options\n const pending = writer.pending\n\n if (!cache.images.has(image)) cache.images.set(image, {})\n\n const cachedImages = cache.images.get(image)\n\n const key = mimeType + ':flipY/' + flipY.toString()\n\n if (cachedImages[key] !== undefined) return cachedImages[key]\n\n if (!json.images) json.images = []\n\n const imageDef = { mimeType: mimeType }\n\n const canvas = getCanvas()\n\n canvas.width = Math.min(image.width, options.maxTextureSize)\n canvas.height = Math.min(image.height, options.maxTextureSize)\n\n const ctx = canvas.getContext('2d')\n\n if (flipY === true) {\n ctx.translate(0, canvas.height)\n ctx.scale(1, -1)\n }\n\n if (image.data !== undefined) {\n // THREE.DataTexture\n\n if (format !== RGBAFormat) {\n console.error('GLTFExporter: Only RGBAFormat is supported.', format)\n }\n\n if (image.width > options.maxTextureSize || image.height > options.maxTextureSize) {\n console.warn('GLTFExporter: Image size is bigger than maxTextureSize', image)\n }\n\n const data = new Uint8ClampedArray(image.height * image.width * 4)\n\n for (let i = 0; i < data.length; i += 4) {\n data[i + 0] = image.data[i + 0]\n data[i + 1] = image.data[i + 1]\n data[i + 2] = image.data[i + 2]\n data[i + 3] = image.data[i + 3]\n }\n\n ctx.putImageData(new ImageData(data, image.width, image.height), 0, 0)\n } else {\n ctx.drawImage(image, 0, 0, canvas.width, canvas.height)\n }\n\n if (options.binary === true) {\n pending.push(\n getToBlobPromise(canvas, mimeType)\n .then((blob) => writer.processBufferViewImage(blob))\n .then((bufferViewIndex) => {\n imageDef.bufferView = bufferViewIndex\n }),\n )\n } else {\n if (canvas.toDataURL !== undefined) {\n imageDef.uri = canvas.toDataURL(mimeType)\n } else {\n pending.push(\n getToBlobPromise(canvas, mimeType)\n .then(readAsDataURL)\n .then((uri) => {\n imageDef.uri = uri\n }),\n )\n }\n }\n\n const index = json.images.push(imageDef) - 1\n cachedImages[key] = index\n return index\n } else {\n throw new Error('THREE.GLTFExporter: No valid image data found. Unable to process texture.')\n }\n }\n\n /**\n * Process sampler\n * @param {Texture} map Texture to process\n * @return {Integer} Index of the processed texture in the \"samplers\" array\n */\n processSampler(map) {\n const json = this.json\n\n if (!json.samplers) json.samplers = []\n\n const samplerDef = {\n magFilter: THREE_TO_WEBGL[map.magFilter],\n minFilter: THREE_TO_WEBGL[map.minFilter],\n wrapS: THREE_TO_WEBGL[map.wrapS],\n wrapT: THREE_TO_WEBGL[map.wrapT],\n }\n\n return json.samplers.push(samplerDef) - 1\n }\n\n /**\n * Process texture\n * @param {Texture} map Map to process\n * @return {Integer} Index of the processed texture in the \"textures\" array\n */\n processTexture(map) {\n const writer = this\n const options = writer.options\n const cache = this.cache\n const json = this.json\n\n if (cache.textures.has(map)) return cache.textures.get(map)\n\n if (!json.textures) json.textures = []\n\n // make non-readable textures (e.g. CompressedTexture) readable by blitting them into a new texture\n if (map instanceof CompressedTexture) {\n map = decompress(map, options.maxTextureSize)\n }\n\n let mimeType = map.userData.mimeType\n\n if (mimeType === 'image/webp') mimeType = 'image/png'\n\n const textureDef = {\n sampler: this.processSampler(map),\n source: this.processImage(map.image, map.format, map.flipY, mimeType),\n }\n\n if (map.name) textureDef.name = map.name\n\n this._invokeAll(function (ext) {\n ext.writeTexture && ext.writeTexture(map, textureDef)\n })\n\n const index = json.textures.push(textureDef) - 1\n cache.textures.set(map, index)\n return index\n }\n\n /**\n * Process material\n * @param {THREE.Material} material Material to process\n * @return {Integer|null} Index of the processed material in the \"materials\" array\n */\n processMaterial(material) {\n const cache = this.cache\n const json = this.json\n\n if (cache.materials.has(material)) return cache.materials.get(material)\n\n if (material.isShaderMaterial) {\n console.warn('GLTFExporter: THREE.ShaderMaterial not supported.')\n return null\n }\n\n if (!json.materials) json.materials = []\n\n // @QUESTION Should we avoid including any attribute that has the default value?\n const materialDef = { pbrMetallicRoughness: {} }\n\n if (material.isMeshStandardMaterial !== true && material.isMeshBasicMaterial !== true) {\n console.warn('GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.')\n }\n\n // pbrMetallicRoughness.baseColorFactor\n const color = material.color.toArray().concat([material.opacity])\n\n if (!equalArray(color, [1, 1, 1, 1])) {\n materialDef.pbrMetallicRoughness.baseColorFactor = color\n }\n\n if (material.isMeshStandardMaterial) {\n materialDef.pbrMetallicRoughness.metallicFactor = material.metalness\n materialDef.pbrMetallicRoughness.roughnessFactor = material.roughness\n } else {\n materialDef.pbrMetallicRoughness.metallicFactor = 0.5\n materialDef.pbrMetallicRoughness.roughnessFactor = 0.5\n }\n\n // pbrMetallicRoughness.metallicRoughnessTexture\n if (material.metalnessMap || material.roughnessMap) {\n const metalRoughTexture = this.buildMetalRoughTexture(material.metalnessMap, material.roughnessMap)\n\n const metalRoughMapDef = {\n index: this.processTexture(metalRoughTexture),\n channel: metalRoughTexture.channel,\n }\n this.applyTextureTransform(metalRoughMapDef, metalRoughTexture)\n materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef\n }\n\n // pbrMetallicRoughness.baseColorTexture\n if (material.map) {\n const baseColorMapDef = {\n index: this.processTexture(material.map),\n texCoord: material.map.channel,\n }\n this.applyTextureTransform(baseColorMapDef, material.map)\n materialDef.pbrMetallicRoughness.baseColorTexture = baseColorMapDef\n }\n\n if (material.emissive) {\n const emissive = material.emissive\n const maxEmissiveComponent = Math.max(emissive.r, emissive.g, emissive.b)\n\n if (maxEmissiveComponent > 0) {\n materialDef.emissiveFactor = material.emissive.toArray()\n }\n\n // emissiveTexture\n if (material.emissiveMap) {\n const emissiveMapDef = {\n index: this.processTexture(material.emissiveMap),\n texCoord: material.emissiveMap.channel,\n }\n this.applyTextureTransform(emissiveMapDef, material.emissiveMap)\n materialDef.emissiveTexture = emissiveMapDef\n }\n }\n\n // normalTexture\n if (material.normalMap) {\n const normalMapDef = {\n index: this.processTexture(material.normalMap),\n texCoord: material.normalMap.channel,\n }\n\n if (material.normalScale && material.normalScale.x !== 1) {\n // glTF normal scale is univariate. Ignore `y`, which may be flipped.\n // Context: https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995\n normalMapDef.scale = material.normalScale.x\n }\n\n this.applyTextureTransform(normalMapDef, material.normalMap)\n materialDef.normalTexture = normalMapDef\n }\n\n // occlusionTexture\n if (material.aoMap) {\n const occlusionMapDef = {\n index: this.processTexture(material.aoMap),\n texCoord: material.aoMap.channel,\n }\n\n if (material.aoMapIntensity !== 1.0) {\n occlusionMapDef.strength = material.aoMapIntensity\n }\n\n this.applyTextureTransform(occlusionMapDef, material.aoMap)\n materialDef.occlusionTexture = occlusionMapDef\n }\n\n // alphaMode\n if (material.transparent) {\n materialDef.alphaMode = 'BLEND'\n } else {\n if (material.alphaTest > 0.0) {\n materialDef.alphaMode = 'MASK'\n materialDef.alphaCutoff = material.alphaTest\n }\n }\n\n // doubleSided\n if (material.side === DoubleSide) materialDef.doubleSided = true\n if (material.name !== '') materialDef.name = material.name\n\n this.serializeUserData(material, materialDef)\n\n this._invokeAll(function (ext) {\n ext.writeMaterial && ext.writeMaterial(material, materialDef)\n })\n\n const index = json.materials.push(materialDef) - 1\n cache.materials.set(material, index)\n return index\n }\n\n /**\n * Process mesh\n * @param {THREE.Mesh} mesh Mesh to process\n * @return {Integer|null} Index of the processed mesh in the \"meshes\" array\n */\n processMesh(mesh) {\n const cache = this.cache\n const json = this.json\n\n const meshCacheKeyParts = [mesh.geometry.uuid]\n\n if (Array.isArray(mesh.material)) {\n for (let i = 0, l = mesh.material.length; i < l; i++) {\n meshCacheKeyParts.push(mesh.material[i].uuid)\n }\n } else {\n meshCacheKeyParts.push(mesh.material.uuid)\n }\n\n const meshCacheKey = meshCacheKeyParts.join(':')\n\n if (cache.meshes.has(meshCacheKey)) return cache.meshes.get(meshCacheKey)\n\n const geometry = mesh.geometry\n\n let mode\n\n // Use the correct mode\n if (mesh.isLineSegments) {\n mode = WEBGL_CONSTANTS.LINES\n } else if (mesh.isLineLoop) {\n mode = WEBGL_CONSTANTS.LINE_LOOP\n } else if (mesh.isLine) {\n mode = WEBGL_CONSTANTS.LINE_STRIP\n } else if (mesh.isPoints) {\n mode = WEBGL_CONSTANTS.POINTS\n } else {\n mode = mesh.material.wireframe ? WEBGL_CONSTANTS.LINES : WEBGL_CONSTANTS.TRIANGLES\n }\n\n const meshDef = {}\n const attributes = {}\n const primitives = []\n const targets = []\n\n // Conversion between attributes names in threejs and gltf spec\n const nameConversion = {\n ...(version >= 152\n ? {\n uv: 'TEXCOORD_0',\n uv1: 'TEXCOORD_1',\n uv2: 'TEXCOORD_2',\n uv3: 'TEXCOORD_3',\n }\n : {\n uv: 'TEXCOORD_0',\n uv2: 'TEXCOORD_1',\n }),\n color: 'COLOR_0',\n skinWeight: 'WEIGHTS_0',\n skinIndex: 'JOINTS_0',\n }\n\n const originalNormal = geometry.getAttribute('normal')\n\n if (originalNormal !== undefined && !this.isNormalizedNormalAttribute(originalNormal)) {\n console.warn('THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.')\n\n geometry.setAttribute('normal', this.createNormalizedNormalAttribute(originalNormal))\n }\n\n // @QUESTION Detect if .vertexColors = true?\n // For every attribute create an accessor\n let modifiedAttribute = null\n\n for (let attributeName in geometry.attributes) {\n // Ignore morph target attributes, which are exported later.\n if (attributeName.slice(0, 5) === 'morph') continue\n\n const attribute = geometry.attributes[attributeName]\n attributeName = nameConversion[attributeName] || attributeName.toUpperCase()\n\n // Prefix all geometry attributes except the ones specifically\n // listed in the spec; non-spec attributes are considered custom.\n const validVertexAttributes = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\\d+|COLOR_\\d+|JOINTS_\\d+|WEIGHTS_\\d+)$/\n\n if (!validVertexAttributes.test(attributeName)) attributeName = '_' + attributeName\n\n if (cache.attributes.has(this.getUID(attribute))) {\n attributes[attributeName] = cache.attributes.get(this.getUID(attribute))\n continue\n }\n\n // JOINTS_0 must be UNSIGNED_BYTE or UNSIGNED_SHORT.\n modifiedAttribute = null\n const array = attribute.array\n\n if (attributeName === 'JOINTS_0' && !(array instanceof Uint16Array) && !(array instanceof Uint8Array)) {\n console.warn('GLTFExporter: Attribute \"skinIndex\" converted to type UNSIGNED_SHORT.')\n modifiedAttribute = new BufferAttribute(new Uint16Array(array), attribute.itemSize, attribute.normalized)\n }\n\n const accessor = this.processAccessor(modifiedAttribute || attribute, geometry)\n\n if (accessor !== null) {\n if (!attributeName.startsWith('_')) {\n this.detectMeshQuantization(attributeName, attribute)\n }\n\n attributes[attributeName] = accessor\n cache.attributes.set(this.getUID(attribute), accessor)\n }\n }\n\n if (originalNormal !== undefined) geometry.setAttribute('normal', originalNormal)\n\n // Skip if no exportable attributes found\n if (Object.keys(attributes).length === 0) return null\n\n // Morph targets\n if (mesh.morphTargetInfluences !== undefined && mesh.morphTargetInfluences.length > 0) {\n const weights = []\n const targetNames = []\n const reverseDictionary = {}\n\n if (mesh.morphTargetDictionary !== undefined) {\n for (const key in mesh.morphTargetDictionary) {\n reverseDictionary[mesh.morphTargetDictionary[key]] = key\n }\n }\n\n for (let i = 0; i < mesh.morphTargetInfluences.length; ++i) {\n const target = {}\n let warned = false\n\n for (const attributeName in geometry.morphAttributes) {\n // glTF 2.0 morph supports only POSITION/NORMAL/TANGENT.\n // Three.js doesn't support TANGENT yet.\n\n if (attributeName !== 'position' && attributeName !== 'normal') {\n if (!warned) {\n console.warn('GLTFExporter: Only POSITION and NORMAL morph are supported.')\n warned = true\n }\n\n continue\n }\n\n const attribute = geometry.morphAttributes[attributeName][i]\n const gltfAttributeName = attributeName.toUpperCase()\n\n // Three.js morph attribute has absolute values while the one of glTF has relative values.\n //\n // glTF 2.0 Specification:\n // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#morph-targets\n\n const baseAttribute = geometry.attributes[attributeName]\n\n if (cache.attributes.has(this.getUID(attribute, true))) {\n target[gltfAttributeName] = cache.attributes.get(this.getUID(attribute, true))\n continue\n }\n\n // Clones attribute not to override\n const relativeAttribute = attribute.clone()\n\n if (!geometry.morphTargetsRelative) {\n for (let j = 0, jl = attribute.count; j < jl; j++) {\n for (let a = 0; a < attribute.itemSize; a++) {\n if (a === 0) relativeAttribute.setX(j, attribute.getX(j) - baseAttribute.getX(j))\n if (a === 1) relativeAttribute.setY(j, attribute.getY(j) - baseAttribute.getY(j))\n if (a === 2) relativeAttribute.setZ(j, attribute.getZ(j) - baseAttribute.getZ(j))\n if (a === 3) relativeAttribute.setW(j, attribute.getW(j) - baseAttribute.getW(j))\n }\n }\n }\n\n target[gltfAttributeName] = this.processAccessor(relativeAttribute, geometry)\n cache.attributes.set(this.getUID(baseAttribute, true), target[gltfAttributeName])\n }\n\n targets.push(target)\n\n weights.push(mesh.morphTargetInfluences[i])\n\n if (mesh.morphTargetDictionary !== undefined) targetNames.push(reverseDictionary[i])\n }\n\n meshDef.weights = weights\n\n if (targetNames.length > 0) {\n meshDef.extras = {}\n meshDef.extras.targetNames = targetNames\n }\n }\n\n const isMultiMaterial = Array.isArray(mesh.material)\n\n if (isMultiMaterial && geometry.groups.length === 0) return null\n\n const materials = isMultiMaterial ? mesh.material : [mesh.material]\n const groups = isMultiMaterial ? geometry.groups : [{ materialIndex: 0, start: undefined, count: undefined }]\n\n for (let i = 0, il = groups.length; i < il; i++) {\n const primitive = {\n mode: mode,\n attributes: attributes,\n }\n\n this.serializeUserData(geometry, primitive)\n\n if (targets.length > 0) primitive.targets = targets\n\n if (geometry.index !== null) {\n let cacheKey = this.getUID(geometry.index)\n\n if (groups[i].start !== undefined || groups[i].count !== undefined) {\n cacheKey += ':' + groups[i].start + ':' + groups[i].count\n }\n\n if (cache.attributes.has(cacheKey)) {\n primitive.indices = cache.attributes.get(cacheKey)\n } else {\n primitive.indices = this.processAccessor(geometry.index, geometry, groups[i].start, groups[i].count)\n cache.attributes.set(cacheKey, primitive.indices)\n }\n\n if (primitive.indices === null) delete primitive.indices\n }\n\n const material = this.processMaterial(materials[groups[i].materialIndex])\n\n if (material !== null) primitive.material = material\n\n primitives.push(primitive)\n }\n\n meshDef.primitives = primitives\n\n if (!json.meshes) json.meshes = []\n\n this._invokeAll(function (ext) {\n ext.writeMesh && ext.writeMesh(mesh, meshDef)\n })\n\n const index = json.meshes.push(meshDef) - 1\n cache.meshes.set(meshCacheKey, index)\n return index\n }\n\n /**\n * If a vertex attribute with a\n * [non-standard data type](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview)\n * is used, it is checked whether it is a valid data type according to the\n * [KHR_mesh_quantization](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md)\n * extension.\n * In this case the extension is automatically added to the list of used extensions.\n *\n * @param {string} attributeName\n * @param {THREE.BufferAttribute} attribute\n */\n detectMeshQuantization(attributeName, attribute) {\n if (this.extensionsUsed[KHR_MESH_QUANTIZATION]) return\n\n let attrType = undefined\n\n switch (attribute.array.constructor) {\n case Int8Array:\n attrType = 'byte'\n\n break\n\n case Uint8Array:\n attrType = 'unsigned byte'\n\n break\n\n case Int16Array:\n attrType = 'short'\n\n break\n\n case Uint16Array:\n attrType = 'unsigned short'\n\n break\n\n default:\n return\n }\n\n if (attribute.normalized) attrType += ' normalized'\n\n const attrNamePrefix = attributeName.split('_', 1)[0]\n\n if (\n KHR_mesh_quantization_ExtraAttrTypes[attrNamePrefix] &&\n KHR_mesh_quantization_ExtraAttrTypes[attrNamePrefix].includes(attrType)\n ) {\n this.extensionsUsed[KHR_MESH_QUANTIZATION] = true\n this.extensionsRequired[KHR_MESH_QUANTIZATION] = true\n }\n }\n\n /**\n * Process camera\n * @param {THREE.Camera} camera Camera to process\n * @return {Integer} Index of the processed mesh in the \"camera\" array\n */\n processCamera(camera) {\n const json = this.json\n\n if (!json.cameras) json.cameras = []\n\n const isOrtho = camera.isOrthographicCamera\n\n const cameraDef = {\n type: isOrtho ? 'orthographic' : 'perspective',\n }\n\n if (isOrtho) {\n cameraDef.orthographic = {\n xmag: camera.right * 2,\n ymag: camera.top * 2,\n zfar: camera.far <= 0 ? 0.001 : camera.far,\n znear: camera.near < 0 ? 0 : camera.near,\n }\n } else {\n cameraDef.perspective = {\n aspectRatio: camera.aspect,\n yfov: MathUtils.degToRad(camera.fov),\n zfar: camera.far <= 0 ? 0.001 : camera.far,\n znear: camera.near < 0 ? 0 : camera.near,\n }\n }\n\n // Question: Is saving \"type\" as name intentional?\n if (camera.name !== '') cameraDef.name = camera.type\n\n return json.cameras.push(cameraDef) - 1\n }\n\n /**\n * Creates glTF animation entry from AnimationClip object.\n *\n * Status:\n * - Only properties listed in PATH_PROPERTIES may be animated.\n *\n * @param {THREE.AnimationClip} clip\n * @param {THREE.Object3D} root\n * @return {number|null}\n */\n processAnimation(clip, root) {\n const json = this.json\n const nodeMap = this.nodeMap\n\n if (!json.animations) json.animations = []\n\n clip = GLTFExporter.Utils.mergeMorphTargetTracks(clip.clone(), root)\n\n const tracks = clip.tracks\n const channels = []\n const samplers = []\n\n for (let i = 0; i < tracks.length; ++i) {\n const track = tracks[i]\n const trackBinding = PropertyBinding.parseTrackName(track.name)\n let trackNode = PropertyBinding.findNode(root, trackBinding.nodeName)\n const trackProperty = PATH_PROPERTIES[trackBinding.propertyName]\n\n if (trackBinding.objectName === 'bones') {\n if (trackNode.isSkinnedMesh === true) {\n trackNode = trackNode.skeleton.getBoneByName(trackBinding.objectIndex)\n } else {\n trackNode = undefined\n }\n }\n\n if (!trackNode || !trackProperty) {\n console.warn('THREE.GLTFExporter: Could not export animation track \"%s\".', track.name)\n return null\n }\n\n const inputItemSize = 1\n let outputItemSize = track.values.length / track.times.length\n\n if (trackProperty === PATH_PROPERTIES.morphTargetInfluences) {\n outputItemSize /= trackNode.morphTargetInfluences.length\n }\n\n let interpolation\n\n // @TODO export CubicInterpolant(InterpolateSmooth) as CUBICSPLINE\n\n // Detecting glTF cubic spline interpolant by checking factory method's special property\n // GLTFCubicSplineInterpolant is a custom interpolant and track doesn't return\n // valid value from .getInterpolation().\n if (track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === true) {\n interpolation = 'CUBICSPLINE'\n\n // itemSize of CUBICSPLINE keyframe is 9\n // (VEC3 * 3: inTangent, splineVertex, and outTangent)\n // but needs to be stored as VEC3 so dividing by 3 here.\n outputItemSize /= 3\n } else if (track.getInterpolation() === InterpolateDiscrete) {\n interpolation = 'STEP'\n } else {\n interpolation = 'LINEAR'\n }\n\n samplers.push({\n input: this.processAccessor(new BufferAttribute(track.times, inputItemSize)),\n output: this.processAccessor(new BufferAttribute(track.values, outputItemSize)),\n interpolation: interpolation,\n })\n\n channels.push({\n sampler: samplers.length - 1,\n target: {\n node: nodeMap.get(trackNode),\n path: trackProperty,\n },\n })\n }\n\n json.animations.push({\n name: clip.name || 'clip_' + json.animations.length,\n samplers: samplers,\n channels: channels,\n })\n\n return json.animations.length - 1\n }\n\n /**\n * @param {THREE.Object3D} object\n * @return {number|null}\n */\n processSkin(object) {\n const json = this.json\n const nodeMap = this.nodeMap\n\n const node = json.nodes[nodeMap.get(object)]\n\n const skeleton = object.skeleton\n\n if (skeleton === undefined) return null\n\n const rootJoint = object.skeleton.bones[0]\n\n if (rootJoint === undefined) return null\n\n const joints = []\n const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16)\n const temporaryBoneInverse = new Matrix4()\n\n for (let i = 0; i < skeleton.bones.length; ++i) {\n joints.push(nodeMap.get(skeleton.bones[i]))\n temporaryBoneInverse.copy(skeleton.boneInverses[i])\n temporaryBoneInverse.multiply(object.bindMatrix).toArray(inverseBindMatrices, i * 16)\n }\n\n if (json.skins === undefined) json.skins = []\n\n json.skins.push({\n inverseBindMatrices: this.processAccessor(new BufferAttribute(inverseBindMatrices, 16)),\n joints: joints,\n skeleton: nodeMap.get(rootJoint),\n })\n\n const skinIndex = (node.skin = json.skins.length - 1)\n\n return skinIndex\n }\n\n /**\n * Process Object3D node\n * @param {THREE.Object3D} node Object3D to processNode\n * @return {Integer} Index of the node in the nodes list\n */\n processNode(object) {\n const json = this.json\n const options = this.options\n const nodeMap = this.nodeMap\n\n if (!json.nodes) json.nodes = []\n\n const nodeDef = {}\n\n if (options.trs) {\n const rotation = object.quaternion.toArray()\n const position = object.position.toArray()\n const scale = object.scale.toArray()\n\n if (!equalArray(rotation, [0, 0, 0, 1])) {\n nodeDef.rotation = rotation\n }\n\n if (!equalArray(position, [0, 0, 0])) {\n nodeDef.translation = position\n }\n\n if (!equalArray(scale, [1, 1, 1])) {\n nodeDef.scale = scale\n }\n } else {\n if (object.matrixAutoUpdate) {\n object.updateMatrix()\n }\n\n if (isIdentityMatrix(object.matrix) === false) {\n nodeDef.matrix = object.matrix.elements\n }\n }\n\n // We don't export empty strings name because it represents no-name in Three.js.\n if (object.name !== '') nodeDef.name = String(object.name)\n\n this.serializeUserData(object, nodeDef)\n\n if (object.isMesh || object.isLine || object.isPoints) {\n const meshIndex = this.processMesh(object)\n\n if (meshIndex !== null) nodeDef.mesh = meshIndex\n } else if (object.isCamera) {\n nodeDef.camera = this.processCamera(object)\n }\n\n if (object.isSkinnedMesh) this.skins.push(object)\n\n if (object.children.length > 0) {\n const children = []\n\n for (let i = 0, l = object.children.length; i < l; i++) {\n const child = object.children[i]\n\n if (child.visible || options.onlyVisible === false) {\n const nodeIndex = this.processNode(child)\n\n if (nodeIndex !== null) children.push(nodeIndex)\n }\n }\n\n if (children.length > 0) nodeDef.children = children\n }\n\n this._invokeAll(function (ext) {\n ext.writeNode && ext.writeNode(object, nodeDef)\n })\n\n const nodeIndex = json.nodes.push(nodeDef) - 1\n nodeMap.set(object, nodeIndex)\n return nodeIndex\n }\n\n /**\n * Process Scene\n * @param {Scene} node Scene to process\n */\n processScene(scene) {\n const json = this.json\n const options = this.options\n\n if (!json.scenes) {\n json.scenes = []\n json.scene = 0\n }\n\n const sceneDef = {}\n\n if (scene.name !== '') sceneDef.name = scene.name\n\n json.scenes.push(sceneDef)\n\n const nodes = []\n\n for (let i = 0, l = scene.children.length; i < l; i++) {\n const child = scene.children[i]\n\n if (child.visible || options.onlyVisible === false) {\n const nodeIndex = this.processNode(child)\n\n if (nodeIndex !== null) nodes.push(nodeIndex)\n }\n }\n\n if (nodes.length > 0) sceneDef.nodes = nodes\n\n this.serializeUserData(scene, sceneDef)\n }\n\n /**\n * Creates a Scene to hold a list of objects and parse it\n * @param {Array} objects List of objects to process\n */\n processObjects(objects) {\n const scene = new Scene()\n scene.name = 'AuxScene'\n\n for (let i = 0; i < objects.length; i++) {\n // We push directly to children instead of calling `add` to prevent\n // modify the .parent and break its original scene and hierarchy\n scene.children.push(objects[i])\n }\n\n this.processScene(scene)\n }\n\n /**\n * @param {THREE.Object3D|Array} input\n */\n processInput(input) {\n const options = this.options\n\n input = input instanceof Array ? input : [input]\n\n this._invokeAll(function (ext) {\n ext.beforeParse && ext.beforeParse(input)\n })\n\n const objectsWithoutScene = []\n\n for (let i = 0; i < input.length; i++) {\n if (input[i] instanceof Scene) {\n this.processScene(input[i])\n } else {\n objectsWithoutScene.push(input[i])\n }\n }\n\n if (objectsWithoutScene.length > 0) this.processObjects(objectsWithoutScene)\n\n for (let i = 0; i < this.skins.length; ++i) {\n this.processSkin(this.skins[i])\n }\n\n for (let i = 0; i < options.animations.length; ++i) {\n this.processAnimation(options.animations[i], input[0])\n }\n\n this._invokeAll(function (ext) {\n ext.afterParse && ext.afterParse(input)\n })\n }\n\n _invokeAll(func) {\n for (let i = 0, il = this.plugins.length; i < il; i++) {\n func(this.plugins[i])\n }\n }\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 GLTFLightExtension {\n constructor(writer) {\n this.writer = writer\n this.name = 'KHR_lights_punctual'\n }\n\n writeNode(light, nodeDef) {\n if (!light.isLight) return\n\n if (!light.isDirectionalLight && !light.isPointLight && !light.isSpotLight) {\n console.warn('THREE.GLTFExporter: Only directional, point, and spot lights are supported.', light)\n return\n }\n\n const writer = this.writer\n const json = writer.json\n const extensionsUsed = writer.extensionsUsed\n\n const lightDef = {}\n\n if (light.name) lightDef.name = light.name\n\n lightDef.color = light.color.toArray()\n\n lightDef.intensity = light.intensity\n\n if (light.isDirectionalLight) {\n lightDef.type = 'directional'\n } else if (light.isPointLight) {\n lightDef.type = 'point'\n\n if (light.distance > 0) lightDef.range = light.distance\n } else if (light.isSpotLight) {\n lightDef.type = 'spot'\n\n if (light.distance > 0) lightDef.range = light.distance\n\n lightDef.spot = {}\n lightDef.spot.innerConeAngle = (light.penumbra - 1.0) * light.angle * -1.0\n lightDef.spot.outerConeAngle = light.angle\n }\n\n if (light.decay !== undefined && light.decay !== 2) {\n console.warn(\n 'THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, ' + 'and expects light.decay=2.',\n )\n }\n\n if (\n light.target &&\n (light.target.parent !== light ||\n light.target.position.x !== 0 ||\n light.target.position.y !== 0 ||\n light.target.position.z !== -1)\n ) {\n console.warn(\n 'THREE.GLTFExporter: Light direction may be lost. For best results, ' +\n 'make light.target a child of the light with position 0,0,-1.',\n )\n }\n\n if (!extensionsUsed[this.name]) {\n json.extensions = json.extensions || {}\n json.extensions[this.name] = { lights: [] }\n extensionsUsed[this.name] = true\n }\n\n const lights = json.extensions[this.name].lights\n lights.push(lightDef)\n\n nodeDef.extensions = nodeDef.extensions || {}\n nodeDef.extensions[this.name] = { light: lights.length - 1 }\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_unlit'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshBasicMaterial) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = {}\n\n extensionsUsed[this.name] = true\n\n materialDef.pbrMetallicRoughness.metallicFactor = 0.0\n materialDef.pbrMetallicRoughness.roughnessFactor = 0.9\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_clearcoat'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.clearcoat === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.clearcoatFactor = material.clearcoat\n\n if (material.clearcoatMap) {\n const clearcoatMapDef = {\n index: writer.processTexture(material.clearcoatMap),\n texCoord: material.clearcoatMap.channel,\n }\n writer.applyTextureTransform(clearcoatMapDef, material.clearcoatMap)\n extensionDef.clearcoatTexture = clearcoatMapDef\n }\n\n extensionDef.clearcoatRoughnessFactor = material.clearcoatRoughness\n\n if (material.clearcoatRoughnessMap) {\n const clearcoatRoughnessMapDef = {\n index: writer.processTexture(material.clearcoatRoughnessMap),\n texCoord: material.clearcoatRoughnessMap.channel,\n }\n writer.applyTextureTransform(clearcoatRoughnessMapDef, material.clearcoatRoughnessMap)\n extensionDef.clearcoatRoughnessTexture = clearcoatRoughnessMapDef\n }\n\n if (material.clearcoatNormalMap) {\n const clearcoatNormalMapDef = {\n index: writer.processTexture(material.clearcoatNormalMap),\n texCoord: material.clearcoatNormalMap.channel,\n }\n writer.applyTextureTransform(clearcoatNormalMapDef, material.clearcoatNormalMap)\n extensionDef.clearcoatNormalTexture = clearcoatNormalMapDef\n }\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_iridescence'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.iridescence === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.iridescenceFactor = material.iridescence\n\n if (material.iridescenceMap) {\n const iridescenceMapDef = {\n index: writer.processTexture(material.iridescenceMap),\n texCoord: material.iridescenceMap.channel,\n }\n writer.applyTextureTransform(iridescenceMapDef, material.iridescenceMap)\n extensionDef.iridescenceTexture = iridescenceMapDef\n }\n\n extensionDef.iridescenceIor = material.iridescenceIOR\n extensionDef.iridescenceThicknessMinimum = material.iridescenceThicknessRange[0]\n extensionDef.iridescenceThicknessMaximum = material.iridescenceThicknessRange[1]\n\n if (material.iridescenceThicknessMap) {\n const iridescenceThicknessMapDef = {\n index: writer.processTexture(material.iridescenceThicknessMap),\n texCoord: material.iridescenceThicknessMap.channel,\n }\n writer.applyTextureTransform(iridescenceThicknessMapDef, material.iridescenceThicknessMap)\n extensionDef.iridescenceThicknessTexture = iridescenceThicknessMapDef\n }\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 */\nclass GLTFMaterialsTransmissionExtension {\n constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_transmission'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.transmission === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.transmissionFactor = material.transmission\n\n if (material.transmissionMap) {\n const transmissionMapDef = {\n index: writer.processTexture(material.transmissionMap),\n texCoord: material.transmissionMap.channel,\n }\n writer.applyTextureTransform(transmissionMapDef, material.transmissionMap)\n extensionDef.transmissionTexture = transmissionMapDef\n }\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_volume'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.transmission === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.thicknessFactor = material.thickness\n\n if (material.thicknessMap) {\n const thicknessMapDef = {\n index: writer.processTexture(material.thicknessMap),\n texCoord: material.thicknessMap.channel,\n }\n writer.applyTextureTransform(thicknessMapDef, material.thicknessMap)\n extensionDef.thicknessTexture = thicknessMapDef\n }\n\n extensionDef.attenuationDistance = material.attenuationDistance\n extensionDef.attenuationColor = material.attenuationColor.toArray()\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_ior'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.ior === 1.5) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.ior = material.ior\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_specular'\n }\n\n writeMaterial(material, materialDef) {\n if (\n !material.isMeshPhysicalMaterial ||\n (material.specularIntensity === 1.0 &&\n material.specularColor.equals(DEFAULT_SPECULAR_COLOR) &&\n !material.specularIntensityMap &&\n !material.specularColorTexture)\n )\n return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n if (material.specularIntensityMap) {\n const specularIntensityMapDef = {\n index: writer.processTexture(material.specularIntensityMap),\n texCoord: material.specularIntensityMap.channel,\n }\n writer.applyTextureTransform(specularIntensityMapDef, material.specularIntensityMap)\n extensionDef.specularTexture = specularIntensityMapDef\n }\n\n if (material.specularColorMap) {\n const specularColorMapDef = {\n index: writer.processTexture(material.specularColorMap),\n texCoord: material.specularColorMap.channel,\n }\n writer.applyTextureTransform(specularColorMapDef, material.specularColorMap)\n extensionDef.specularColorTexture = specularColorMapDef\n }\n\n extensionDef.specularFactor = material.specularIntensity\n extensionDef.specularColorFactor = material.specularColor.toArray()\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_sheen'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.sheen == 0.0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n if (material.sheenRoughnessMap) {\n const sheenRoughnessMapDef = {\n index: writer.processTexture(material.sheenRoughnessMap),\n texCoord: material.sheenRoughnessMap.channel,\n }\n writer.applyTextureTransform(sheenRoughnessMapDef, material.sheenRoughnessMap)\n extensionDef.sheenRoughnessTexture = sheenRoughnessMapDef\n }\n\n if (material.sheenColorMap) {\n const sheenColorMapDef = {\n index: writer.processTexture(material.sheenColorMap),\n texCoord: material.sheenColorMap.channel,\n }\n writer.applyTextureTransform(sheenColorMapDef, material.sheenColorMap)\n extensionDef.sheenColorTexture = sheenColorMapDef\n }\n\n extensionDef.sheenRoughnessFactor = material.sheenRoughness\n extensionDef.sheenColorFactor = material.sheenColor.toArray()\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\n }\n}\n\n/**\n * Anisotropy Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_anisotropy\n */\nclass GLTFMaterialsAnisotropyExtension {\n constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_anisotropy'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.anisotropy == 0.0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n if (material.anisotropyMap) {\n const anisotropyMapDef = { index: writer.processTexture(material.anisotropyMap) }\n writer.applyTextureTransform(anisotropyMapDef, material.anisotropyMap)\n extensionDef.anisotropyTexture = anisotropyMapDef\n }\n\n extensionDef.anisotropyStrength = material.anisotropy\n extensionDef.anisotropyRotation = material.anisotropyRotation\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_emissive_strength'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshStandardMaterial || material.emissiveIntensity === 1.0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.emissiveStrength = material.emissiveIntensity\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\n }\n}\n\nexport { GLTFExporter }\n", "// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([c], { type: 'text/javascript' }))));\n w.onerror = function (e) { return cb(e.error, null); };\n w.onmessage = function (e) { return cb(null, e.data); };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\n// see fleb note\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new u32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return [b, r];\n};\nvar _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b[0], revfd = _b[1];\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i)\n ++l[cd[i] - 1];\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 0; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >>> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p / 8) | 0) + (p & 7 && 1); };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n var n = new (v instanceof u16 ? u16 : v instanceof u32 ? u32 : u8)(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, buf, st) {\n // source length\n var sl = dat.length;\n if (!sl || (st && !st.l && sl < 5))\n return buf || new u8(0);\n // have to estimate size\n var noBuf = !buf || st;\n // no state\n var noSt = !st || st.i;\n if (!st)\n st = {};\n // Assumes roughly 33% compression ratio average\n if (!buf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n st.f = final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n // ensure size\n if (noBuf)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >>> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n throw 'invalid block type';\n if (pos > tbts) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17;\n if (noBuf)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n if (!c)\n throw 'invalid length/literal';\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;\n if (!d)\n throw 'invalid distance';\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n if (noBuf)\n cbuf(bt + 131072);\n var end = bt + add;\n for (; bt < end; bt += 4) {\n buf[bt] = buf[bt - dt];\n buf[bt + 1] = buf[bt + 1 - dt];\n buf[bt + 2] = buf[bt + 2 - dt];\n buf[bt + 3] = buf[bt + 3 - dt];\n }\n bt = end;\n }\n }\n st.l = lm, st.p = lpos, st.b = bt;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n return bt == buf.length ? buf : slc(buf, 0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n d[o + 2] |= v >>> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return [et, 0];\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return [v, 1];\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return [new u8(tr), mbt];\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return [cl.subarray(0, cli), s];\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >>> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a[0], mlb = _a[1];\n var _b = hTree(df, 15), ddt = _b[0], mdb = _b[1];\n var _c = lc(dlt), lclt = _c[0], nlc = _c[1];\n var _d = lc(ddt), lcdt = _d[0], ndc = _d[1];\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n lcfreq[lclt[i] & 31]++;\n for (var i = 0; i < lcdt.length; ++i)\n lcfreq[lcdt[i] & 31]++;\n var _e = hTree(lcfreq, 7), lct = _e[0], mlcb = _e[1];\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + (2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]);\n if (flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >>> 5) & 127), p += clct[i] >>> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n if (syms[i] > 255) {\n var len = (syms[i] >>> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (syms[i] >>> 23) & 31), p += fleb[len];\n var dst = syms[i] & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (syms[i] >>> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[syms[i]]), p += ll[syms[i]];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new u32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, lst) {\n var s = dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var pos = 0;\n if (!lvl || s < 8) {\n for (var i = 0; i <= s; i += 65535) {\n // end\n var e = i + 65535;\n if (e < s) {\n // write full block\n pos = wfblk(w, pos, dat.subarray(i, e));\n }\n else {\n // write final block\n w[i] = lst;\n pos = wfblk(w, pos, dat.subarray(i, s));\n }\n }\n }\n else {\n var opt = deo[lvl - 1];\n var n = opt >>> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = new u16(32768), head = new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new u32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx bitpos\n var lc_1 = 0, eb = 0, i = 0, li = 0, wi = 0, bs = 0;\n for (; i < s; ++i) {\n // hash value\n // deopt when i > s - 3 - at end, deopt acceptable\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && rem > 423) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = (imod - pimod) & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = (i - dif + j + 32768) & 32767;\n var pti = prev[ti];\n var cd = (ti - pti + 32768) & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += (imod - pimod + 32768) & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one Uint32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n // this is the easiest way to avoid needing to maintain state\n if (!lst && pos & 7)\n pos = wfblk(w, pos + 1, et);\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Alder32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a >>> 8) << 16 | (b & 255) << 8 | (b >>> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, !st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/ /g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return [fnStr, td];\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k] instanceof u8 || v[k] instanceof u16 || v[k] instanceof u32)\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n var _a;\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n _a = wcln(fns[i], fnStr, td_1), fnStr = _a[0], td_1 = _a[1];\n ch[id] = wcln(fns[m], fnStr, td_1);\n }\n var td = mrg({}, ch[id][1]);\n return wk(ch[id][0] + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, hMap, max, bits, bits16, shft, slc, inflt, inflateSync, pbf, gu8]; };\nvar bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zlv]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get u8\nvar gu8 = function (o) { return o && o.size && new u8(o.size); };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) { return strm.push(ev.data[0], ev.data[1]); };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.push = function (d, f) {\n if (t)\n throw 'stream finished';\n if (!strm.ondata)\n throw 'no stream handler';\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n throw 'invalid gzip data';\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += d[10] | (d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return ((d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16) | (d[l - 1] << 24)) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + ((o.filename && (o.filename.length + 1)) || 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (fl ? (32 - 2 * fl) : 1);\n};\n// zlib valid\nvar zlv = function (d) {\n if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n throw 'invalid zlib data';\n if (d[1] & 32)\n throw 'invalid zlib data: preset dictionaries not supported';\n};\nfunction AsyncCmpStrm(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n// zlib footer: -4 to -0 is Adler32\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, !f), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (this.d)\n throw 'stream finished';\n if (!this.ondata)\n throw 'no stream handler';\n this.d = final;\n this.p(chunk, final || false);\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n /**\n * Creates an inflation stream\n * @param cb The callback to call whenever data is inflated\n */\n function Inflate(cb) {\n this.s = {};\n this.p = new u8(0);\n this.ondata = cb;\n }\n Inflate.prototype.e = function (c) {\n if (this.d)\n throw 'stream finished';\n if (!this.ondata)\n throw 'no stream handler';\n var l = this.p.length;\n var n = new u8(l + c.length);\n n.set(this.p), n.set(c, l), this.p = n;\n };\n Inflate.prototype.c = function (final) {\n this.d = this.s.i = final || false;\n var bts = this.s.b;\n var dt = inflt(this.p, this.o, this.s);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous inflation stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncInflate(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, 0, function () {\n var strm = new Inflate();\n onmessage = astrm(strm);\n }, 7);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gu8(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, out) {\n return inflt(data, out);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n this.c.p(c);\n this.l += c.length;\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, !f);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n /**\n * Creates a GUNZIP stream\n * @param cb The callback to call whenever data is inflated\n */\n function Gunzip(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n var s = this.p.length > 3 ? gzs(this.p) : 4;\n if (s >= this.p.length && !final)\n return;\n this.p = this.p.subarray(s), this.v = 0;\n }\n if (final) {\n if (this.p.length < 8)\n throw 'invalid gzip stream';\n this.p = this.p.subarray(0, -8);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous GUNZIP stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncGunzip(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, 0, function () {\n var strm = new Gunzip();\n onmessage = astrm(strm);\n }, 9);\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, out) {\n return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n this.c.p(c);\n var raw = dopt(c, this.o, this.v && 2, f && 4, !f);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n /**\n * Creates a Zlib decompression stream\n * @param cb The callback to call whenever data is inflated\n */\n function Unzlib(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 2 && !final)\n return;\n this.p = this.p.subarray(2), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n throw 'invalid zlib stream';\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous Zlib decompression stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncUnzlib(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, 0, function () {\n var strm = new Unzlib();\n onmessage = astrm(strm);\n }, 11);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gu8(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, out) {\n return inflt((zlv(data), data.subarray(2, -4)), out);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function Decompress(cb) {\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no stream handler';\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n var _this_1 = this;\n var cb = function () { _this_1.ondata.apply(_this_1, arguments); };\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(cb)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(cb)\n : new this.Z(cb);\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function AsyncDecompress(cb) {\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, out) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, out)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, out)\n : unzlibSync(data, out);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k;\n if (val instanceof u8)\n t[n] = [val, o];\n else if (Array.isArray(val))\n t[n] = [val[0], mrg(o, val[1])];\n else\n fltn(val, n + '/', t, o);\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return [r, slc(d, i - 1)];\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no callback';\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n throw 'invalid utf-8 data';\n this.t = null;\n }\n return;\n }\n if (!this.p)\n throw 'stream finished';\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), ch = _a[0], np = _a[1];\n if (final) {\n if (np.length)\n throw 'invalid utf-8 data';\n this.p = null;\n }\n else\n this.p = np;\n this.ondata(ch, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no callback';\n if (this.d)\n throw 'stream finished';\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td)\n return td.decode(dat);\n else {\n var _a = dutf8(dat), out = _a[0], ext = _a[1];\n if (ext.length)\n throw 'invalid utf-8 data';\n return out;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n throw 'extra field too long';\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c == null && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n throw 'date not in range 1980-2099';\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >>> 1)), b += 4;\n if (c != null) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no callback - add to ZIP archive before pushing';\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this_1 = this;\n if (this.d & 2)\n throw 'stream finished';\n var f = strToU8(file.filename), fl = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl != file.filename.length || (o && (com.length != o.length));\n var hl = fl + exfl(file.extra) + 30;\n if (fl > 65535)\n throw 'filename too long';\n var header = new u8(hl);\n wzh(header, 0, file, f, u);\n var chks = [header];\n var pAll = function () {\n for (var _i = 0, chks_1 = chks; _i < chks_1.length; _i++) {\n var chk = chks_1[_i];\n _this_1.ondata(null, chk, false);\n }\n chks = [];\n };\n var tr = this.d;\n this.d = 0;\n var ind = this.u.length;\n var uf = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll();\n if (tr) {\n var nxt = _this_1.u[ind + 1];\n if (nxt)\n nxt.r();\n else\n _this_1.d = 1;\n }\n tr = 1;\n }\n });\n var cl = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this_1.ondata(err, dat, final);\n _this_1.terminate();\n }\n else {\n cl += dat.length;\n chks.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl);\n wbytes(dd, 12, file.size);\n chks.push(dd);\n uf.c = cl, uf.b = hl + cl + 16, uf.crc = file.crc, uf.size = file.size;\n if (tr)\n uf.r();\n tr = 1;\n }\n else if (tr)\n pAll();\n }\n };\n this.u.push(uf);\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this_1 = this;\n if (this.d & 2) {\n if (this.d & 1)\n throw 'stream finishing';\n throw 'stream finished';\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this_1.d & 1))\n return;\n _this_1.u.splice(-1, 1);\n _this_1.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, f.c, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cb(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cb(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cb(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl('filename too long', null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n throw 'filename too long';\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this_1 = this;\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, data, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this_1 = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this_1 = this;\n if (!this.onfile)\n throw 'no callback';\n if (!this.p)\n throw 'stream finished';\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_2 = [];\n this_1.k.unshift(chks_2);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n throw 'no callback';\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this_1.o[cmp_1];\n if (!ctr)\n throw 'unknown compression type ' + cmp_1;\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_3 = chks_2; _i < chks_3.length; _i++) {\n var dat = chks_3[_i];\n d_1.push(dat, false);\n }\n if (_this_1.k[0] == chks_2 && _this_1.c)\n _this_1.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n throw 'invalid zip file';\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\n/**\n * Asynchronously decompresses a ZIP archive\n * @param data The raw compressed ZIP file\n * @param cb The callback to call with the decompressed files\n * @returns A function that can be used to immediately terminate the unzipping\n */\nexport function unzip(data, cb) {\n if (typeof cb != 'function')\n throw 'no callback';\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cb('invalid zip file', null);\n return;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (!lft)\n cb(null, {});\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50) {\n cb('invalid zip file', null);\n return;\n }\n c = lft = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cb(e, null);\n }\n else {\n files[fn] = d;\n if (!--lft)\n cb(null, files);\n }\n };\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n if (sc < 320000) {\n try {\n cbl(null, inflateSync(infl, new u8(su)));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl('unknown compression type ' + c_1, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @returns The decompressed files\n */\nexport function unzipSync(data) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n throw 'invalid zip file';\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50)\n throw 'invalid zip file';\n c = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), new u8(su));\n else\n throw 'unknown compression type ' + c_2;\n }\n return files;\n}\n", "import type { EncoderModule } from 'draco3d'\nimport { BufferGeometry, Mesh, Points } from 'three'\n\n/**\n * Export draco compressed files from threejs geometry objects.\n *\n * Draco files are compressed and usually are smaller than conventional 3D file formats.\n *\n * The exporter receives a options object containing\n * - decodeSpeed, indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality)\n * - encodeSpeed, indicates how to tune the encoder parameters (0 gives better speed but worst quality)\n * - encoderMethod\n * - quantization, indicates the presision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC)\n * - exportUvs\n * - exportNormals\n */\n\ndeclare const DracoEncoderModule: () => EncoderModule\n\nclass DRACOExporter {\n // Encoder methods\n\n public static MESH_EDGEBREAKER_ENCODING = 1\n public static MESH_SEQUENTIAL_ENCODING = 0\n\n // Geometry type\n\n public static POINT_CLOUD = 0\n public static TRIANGULAR_MESH = 1\n\n // Attribute type\n public static INVALID = -1\n public static POSITION = 0\n public static NORMAL = 1\n public static COLOR = 2\n public static TEX_COORD = 3\n public static GENERIC = 4\n\n public parse(\n object: Mesh | Points,\n options = {\n decodeSpeed: 5,\n encodeSpeed: 5,\n encoderMethod: DRACOExporter.MESH_EDGEBREAKER_ENCODING,\n quantization: [16, 8, 8, 8, 8],\n exportUvs: true,\n exportNormals: true,\n exportColor: false,\n },\n ): Int8Array {\n if (object instanceof BufferGeometry && object.isBufferGeometry) {\n throw new Error('DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.')\n }\n\n if (DracoEncoderModule === undefined) {\n throw new Error('THREE.DRACOExporter: required the draco_encoder to work.')\n }\n\n const geometry = object.geometry\n\n const dracoEncoder = DracoEncoderModule()\n const encoder = new dracoEncoder.Encoder()\n let builder\n let dracoObject\n\n if (!geometry.isBufferGeometry) {\n throw new Error('THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.')\n }\n\n if (object instanceof Mesh && object.isMesh) {\n builder = new dracoEncoder.MeshBuilder()\n dracoObject = new dracoEncoder.Mesh()\n\n const vertices = geometry.getAttribute('position')\n // @ts-ignore\n builder.AddFloatAttributeToMesh(\n dracoObject,\n dracoEncoder.POSITION,\n vertices.count,\n vertices.itemSize,\n vertices.array,\n )\n\n const faces = geometry.getIndex()\n\n if (faces !== null) {\n builder.AddFacesToMesh(dracoObject, faces.count / 3, faces.array as Uint16Array | Uint32Array)\n } else {\n const faces = new (vertices.count > 65535 ? Uint32Array : Uint16Array)(vertices.count)\n\n for (let i = 0; i < faces.length; i++) {\n faces[i] = i\n }\n\n builder.AddFacesToMesh(dracoObject, vertices.count, faces)\n }\n\n if (options.exportNormals) {\n const normals = geometry.getAttribute('normal')\n\n if (normals !== undefined) {\n // @ts-ignore\n builder.AddFloatAttributeToMesh(\n dracoObject,\n dracoEncoder.NORMAL,\n normals.count,\n normals.itemSize,\n normals.array,\n )\n }\n }\n\n if (options.exportUvs) {\n const uvs = geometry.getAttribute('uv')\n\n if (uvs !== undefined) {\n // @ts-ignore\n builder.AddFloatAttributeToMesh(dracoObject, dracoEncoder.TEX_COORD, uvs.count, uvs.itemSize, uvs.array)\n }\n }\n\n if (options.exportColor) {\n const colors = geometry.getAttribute('color')\n\n if (colors !== undefined) {\n // @ts-ignore\n builder.AddFloatAttributeToMesh(dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, colors.array)\n }\n }\n } else if (object instanceof Points && object.isPoints) {\n // @ts-ignore\n builder = new dracoEncoder.PointCloudBuilder()\n // @ts-ignore\n dracoObject = new dracoEncoder.PointCloud()\n\n const vertices = geometry.getAttribute('position')\n builder.AddFloatAttribute(dracoObject, dracoEncoder.POSITION, vertices.count, vertices.itemSize, vertices.array)\n\n if (options.exportColor) {\n const colors = geometry.getAttribute('color')\n\n if (colors !== undefined) {\n builder.AddFloatAttribute(dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, colors.array)\n }\n }\n } else {\n throw new Error('DRACOExporter: Unsupported object type.')\n }\n\n //Compress using draco encoder\n\n const encodedData = new dracoEncoder.DracoInt8Array()\n\n //Sets the desired encoding and decoding speed for the given options from 0 (slowest speed, but the best compression) to 10 (fastest, but the worst compression).\n\n const encodeSpeed = options.encodeSpeed !== undefined ? options.encodeSpeed : 5\n const decodeSpeed = options.decodeSpeed !== undefined ? options.decodeSpeed : 5\n\n encoder.SetSpeedOptions(encodeSpeed, decodeSpeed)\n\n // Sets the desired encoding method for a given geometry.\n\n if (options.encoderMethod !== undefined) {\n encoder.SetEncodingMethod(options.encoderMethod)\n }\n\n // Sets the quantization (number of bits used to represent) compression options for a named attribute.\n // The attribute values will be quantized in a box defined by the maximum extent of the attribute values.\n if (options.quantization !== undefined) {\n for (let i = 0; i < 5; i++) {\n if (options.quantization[i] !== undefined) {\n encoder.SetAttributeQuantization(i, options.quantization[i])\n }\n }\n }\n\n let length\n\n if (object instanceof Mesh && object.isMesh) {\n length = encoder.EncodeMeshToDracoBuffer(dracoObject, encodedData)\n } else {\n // @ts-ignore\n length = encoder.EncodePointCloudToDracoBuffer(dracoObject, true, encodedData)\n }\n\n dracoEncoder.destroy(dracoObject)\n\n if (length === 0) {\n throw new Error('THREE.DRACOExporter: Draco encoding failed.')\n }\n\n //Copy encoded data to buffer.\n const outputData = new Int8Array(new ArrayBuffer(length))\n\n for (let i = 0; i < length; i++) {\n outputData[i] = encodedData.GetValue(i)\n }\n\n dracoEncoder.destroy(encodedData)\n dracoEncoder.destroy(encoder)\n dracoEncoder.destroy(builder)\n\n return outputData\n }\n}\n\nexport { DRACOExporter }\n", "/**\n * @author Takahiro / https://github.com/takahirox\n *\n * Simple CharsetEncoder.\n */\n\nclass CharsetEncoder {\n constructor() {\n this.s2uTable = {\n 0: 0,\n 1: 1,\n 2: 2,\n 3: 3,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 7,\n 8: 8,\n 9: 9,\n 10: 10,\n 11: 11,\n 12: 12,\n 13: 13,\n 14: 14,\n 15: 15,\n 16: 16,\n 17: 17,\n 18: 18,\n 19: 19,\n 20: 20,\n 21: 21,\n 22: 22,\n 23: 23,\n 24: 24,\n 25: 25,\n 26: 26,\n 27: 27,\n 28: 28,\n 29: 29,\n 30: 30,\n 31: 31,\n 32: 32,\n 33: 33,\n 34: 34,\n 35: 35,\n 36: 36,\n 37: 37,\n 38: 38,\n 39: 39,\n 40: 40,\n 41: 41,\n 42: 42,\n 43: 43,\n 44: 44,\n 45: 45,\n 46: 46,\n 47: 47,\n 48: 48,\n 49: 49,\n 50: 50,\n 51: 51,\n 52: 52,\n 53: 53,\n 54: 54,\n 55: 55,\n 56: 56,\n 57: 57,\n 58: 58,\n 59: 59,\n 60: 60,\n 61: 61,\n 62: 62,\n 63: 63,\n 64: 64,\n 65: 65,\n 66: 66,\n 67: 67,\n 68: 68,\n 69: 69,\n 70: 70,\n 71: 71,\n 72: 72,\n 73: 73,\n 74: 74,\n 75: 75,\n 76: 76,\n 77: 77,\n 78: 78,\n 79: 79,\n 80: 80,\n 81: 81,\n 82: 82,\n 83: 83,\n 84: 84,\n 85: 85,\n 86: 86,\n 87: 87,\n 88: 88,\n 89: 89,\n 90: 90,\n 91: 91,\n 92: 92,\n 93: 93,\n 94: 94,\n 95: 95,\n 96: 96,\n 97: 97,\n 98: 98,\n 99: 99,\n 100: 100,\n 101: 101,\n 102: 102,\n 103: 103,\n 104: 104,\n 105: 105,\n 106: 106,\n 107: 107,\n 108: 108,\n 109: 109,\n 110: 110,\n 111: 111,\n 112: 112,\n 113: 113,\n 114: 114,\n 115: 115,\n 116: 116,\n 117: 117,\n 118: 118,\n 119: 119,\n 120: 120,\n 121: 121,\n 122: 122,\n 123: 123,\n 124: 124,\n 125: 125,\n 126: 126,\n 161: 65377,\n 162: 65378,\n 163: 65379,\n 164: 65380,\n 165: 65381,\n 166: 65382,\n 167: 65383,\n 168: 65384,\n 169: 65385,\n 170: 65386,\n 171: 65387,\n 172: 65388,\n 173: 65389,\n 174: 65390,\n 175: 65391,\n 176: 65392,\n 177: 65393,\n 178: 65394,\n 179: 65395,\n 180: 65396,\n 181: 65397,\n 182: 65398,\n 183: 65399,\n 184: 65400,\n 185: 65401,\n 186: 65402,\n 187: 65403,\n 188: 65404,\n 189: 65405,\n 190: 65406,\n 191: 65407,\n 192: 65408,\n 193: 65409,\n 194: 65410,\n 195: 65411,\n 196: 65412,\n 197: 65413,\n 198: 65414,\n 199: 65415,\n 200: 65416,\n 201: 65417,\n 202: 65418,\n 203: 65419,\n 204: 65420,\n 205: 65421,\n 206: 65422,\n 207: 65423,\n 208: 65424,\n 209: 65425,\n 210: 65426,\n 211: 65427,\n 212: 65428,\n 213: 65429,\n 214: 65430,\n 215: 65431,\n 216: 65432,\n 217: 65433,\n 218: 65434,\n 219: 65435,\n 220: 65436,\n 221: 65437,\n 222: 65438,\n 223: 65439,\n 33088: 12288,\n 33089: 12289,\n 33090: 12290,\n 33091: 65292,\n 33092: 65294,\n 33093: 12539,\n 33094: 65306,\n 33095: 65307,\n 33096: 65311,\n 33097: 65281,\n 33098: 12443,\n 33099: 12444,\n 33100: 180,\n 33101: 65344,\n 33102: 168,\n 33103: 65342,\n 33104: 65507,\n 33105: 65343,\n 33106: 12541,\n 33107: 12542,\n 33108: 12445,\n 33109: 12446,\n 33110: 12291,\n 33111: 20189,\n 33112: 12293,\n 33113: 12294,\n 33114: 12295,\n 33115: 12540,\n 33116: 8213,\n 33117: 8208,\n 33118: 65295,\n 33119: 65340,\n 33120: 65374,\n 33121: 8741,\n 33122: 65372,\n 33123: 8230,\n 33124: 8229,\n 33125: 8216,\n 33126: 8217,\n 33127: 8220,\n 33128: 8221,\n 33129: 65288,\n 33130: 65289,\n 33131: 12308,\n 33132: 12309,\n 33133: 65339,\n 33134: 65341,\n 33135: 65371,\n 33136: 65373,\n 33137: 12296,\n 33138: 12297,\n 33139: 12298,\n 33140: 12299,\n 33141: 12300,\n 33142: 12301,\n 33143: 12302,\n 33144: 12303,\n 33145: 12304,\n 33146: 12305,\n 33147: 65291,\n 33148: 65293,\n 33149: 177,\n 33150: 215,\n 33152: 247,\n 33153: 65309,\n 33154: 8800,\n 33155: 65308,\n 33156: 65310,\n 33157: 8806,\n 33158: 8807,\n 33159: 8734,\n 33160: 8756,\n 33161: 9794,\n 33162: 9792,\n 33163: 176,\n 33164: 8242,\n 33165: 8243,\n 33166: 8451,\n 33167: 65509,\n 33168: 65284,\n 33169: 65504,\n 33170: 65505,\n 33171: 65285,\n 33172: 65283,\n 33173: 65286,\n 33174: 65290,\n 33175: 65312,\n 33176: 167,\n 33177: 9734,\n 33178: 9733,\n 33179: 9675,\n 33180: 9679,\n 33181: 9678,\n 33182: 9671,\n 33183: 9670,\n 33184: 9633,\n 33185: 9632,\n 33186: 9651,\n 33187: 9650,\n 33188: 9661,\n 33189: 9660,\n 33190: 8251,\n 33191: 12306,\n 33192: 8594,\n 33193: 8592,\n 33194: 8593,\n 33195: 8595,\n 33196: 12307,\n 33208: 8712,\n 33209: 8715,\n 33210: 8838,\n 33211: 8839,\n 33212: 8834,\n 33213: 8835,\n 33214: 8746,\n 33215: 8745,\n 33224: 8743,\n 33225: 8744,\n 33226: 65506,\n 33227: 8658,\n 33228: 8660,\n 33229: 8704,\n 33230: 8707,\n 33242: 8736,\n 33243: 8869,\n 33244: 8978,\n 33245: 8706,\n 33246: 8711,\n 33247: 8801,\n 33248: 8786,\n 33249: 8810,\n 33250: 8811,\n 33251: 8730,\n 33252: 8765,\n 33253: 8733,\n 33254: 8757,\n 33255: 8747,\n 33256: 8748,\n 33264: 8491,\n 33265: 8240,\n 33266: 9839,\n 33267: 9837,\n 33268: 9834,\n 33269: 8224,\n 33270: 8225,\n 33271: 182,\n 33276: 9711,\n 33359: 65296,\n 33360: 65297,\n 33361: 65298,\n 33362: 65299,\n 33363: 65300,\n 33364: 65301,\n 33365: 65302,\n 33366: 65303,\n 33367: 65304,\n 33368: 65305,\n 33376: 65313,\n 33377: 65314,\n 33378: 65315,\n 33379: 65316,\n 33380: 65317,\n 33381: 65318,\n 33382: 65319,\n 33383: 65320,\n 33384: 65321,\n 33385: 65322,\n 33386: 65323,\n 33387: 65324,\n 33388: 65325,\n 33389: 65326,\n 33390: 65327,\n 33391: 65328,\n 33392: 65329,\n 33393: 65330,\n 33394: 65331,\n 33395: 65332,\n 33396: 65333,\n 33397: 65334,\n 33398: 65335,\n 33399: 65336,\n 33400: 65337,\n 33401: 65338,\n 33409: 65345,\n 33410: 65346,\n 33411: 65347,\n 33412: 65348,\n 33413: 65349,\n 33414: 65350,\n 33415: 65351,\n 33416: 65352,\n 33417: 65353,\n 33418: 65354,\n 33419: 65355,\n 33420: 65356,\n 33421: 65357,\n 33422: 65358,\n 33423: 65359,\n 33424: 65360,\n 33425: 65361,\n 33426: 65362,\n 33427: 65363,\n 33428: 65364,\n 33429: 65365,\n 33430: 65366,\n 33431: 65367,\n 33432: 65368,\n 33433: 65369,\n 33434: 65370,\n 33439: 12353,\n 33440: 12354,\n 33441: 12355,\n 33442: 12356,\n 33443: 12357,\n 33444: 12358,\n 33445: 12359,\n 33446: 12360,\n 33447: 12361,\n 33448: 12362,\n 33449: 12363,\n 33450: 12364,\n 33451: 12365,\n 33452: 12366,\n 33453: 12367,\n 33454: 12368,\n 33455: 12369,\n 33456: 12370,\n 33457: 12371,\n 33458: 12372,\n 33459: 12373,\n 33460: 12374,\n 33461: 12375,\n 33462: 12376,\n 33463: 12377,\n 33464: 12378,\n 33465: 12379,\n 33466: 12380,\n 33467: 12381,\n 33468: 12382,\n 33469: 12383,\n 33470: 12384,\n 33471: 12385,\n 33472: 12386,\n 33473: 12387,\n 33474: 12388,\n 33475: 12389,\n 33476: 12390,\n 33477: 12391,\n 33478: 12392,\n 33479: 12393,\n 33480: 12394,\n 33481: 12395,\n 33482: 12396,\n 33483: 12397,\n 33484: 12398,\n 33485: 12399,\n 33486: 12400,\n 33487: 12401,\n 33488: 12402,\n 33489: 12403,\n 33490: 12404,\n 33491: 12405,\n 33492: 12406,\n 33493: 12407,\n 33494: 12408,\n 33495: 12409,\n 33496: 12410,\n 33497: 12411,\n 33498: 12412,\n 33499: 12413,\n 33500: 12414,\n 33501: 12415,\n 33502: 12416,\n 33503: 12417,\n 33504: 12418,\n 33505: 12419,\n 33506: 12420,\n 33507: 12421,\n 33508: 12422,\n 33509: 12423,\n 33510: 12424,\n 33511: 12425,\n 33512: 12426,\n 33513: 12427,\n 33514: 12428,\n 33515: 12429,\n 33516: 12430,\n 33517: 12431,\n 33518: 12432,\n 33519: 12433,\n 33520: 12434,\n 33521: 12435,\n 33600: 12449,\n 33601: 12450,\n 33602: 12451,\n 33603: 12452,\n 33604: 12453,\n 33605: 12454,\n 33606: 12455,\n 33607: 12456,\n 33608: 12457,\n 33609: 12458,\n 33610: 12459,\n 33611: 12460,\n 33612: 12461,\n 33613: 12462,\n 33614: 12463,\n 33615: 12464,\n 33616: 12465,\n 33617: 12466,\n 33618: 12467,\n 33619: 12468,\n 33620: 12469,\n 33621: 12470,\n 33622: 12471,\n 33623: 12472,\n 33624: 12473,\n 33625: 12474,\n 33626: 12475,\n 33627: 12476,\n 33628: 12477,\n 33629: 12478,\n 33630: 12479,\n 33631: 12480,\n 33632: 12481,\n 33633: 12482,\n 33634: 12483,\n 33635: 12484,\n 33636: 12485,\n 33637: 12486,\n 33638: 12487,\n 33639: 12488,\n 33640: 12489,\n 33641: 12490,\n 33642: 12491,\n 33643: 12492,\n 33644: 12493,\n 33645: 12494,\n 33646: 12495,\n 33647: 12496,\n 33648: 12497,\n 33649: 12498,\n 33650: 12499,\n 33651: 12500,\n 33652: 12501,\n 33653: 12502,\n 33654: 12503,\n 33655: 12504,\n 33656: 12505,\n 33657: 12506,\n 33658: 12507,\n 33659: 12508,\n 33660: 12509,\n 33661: 12510,\n 33662: 12511,\n 33664: 12512,\n 33665: 12513,\n 33666: 12514,\n 33667: 12515,\n 33668: 12516,\n 33669: 12517,\n 33670: 12518,\n 33671: 12519,\n 33672: 12520,\n 33673: 12521,\n 33674: 12522,\n 33675: 12523,\n 33676: 12524,\n 33677: 12525,\n 33678: 12526,\n 33679: 12527,\n 33680: 12528,\n 33681: 12529,\n 33682: 12530,\n 33683: 12531,\n 33684: 12532,\n 33685: 12533,\n 33686: 12534,\n 33695: 913,\n 33696: 914,\n 33697: 915,\n 33698: 916,\n 33699: 917,\n 33700: 918,\n 33701: 919,\n 33702: 920,\n 33703: 921,\n 33704: 922,\n 33705: 923,\n 33706: 924,\n 33707: 925,\n 33708: 926,\n 33709: 927,\n 33710: 928,\n 33711: 929,\n 33712: 931,\n 33713: 932,\n 33714: 933,\n 33715: 934,\n 33716: 935,\n 33717: 936,\n 33718: 937,\n 33727: 945,\n 33728: 946,\n 33729: 947,\n 33730: 948,\n 33731: 949,\n 33732: 950,\n 33733: 951,\n 33734: 952,\n 33735: 953,\n 33736: 954,\n 33737: 955,\n 33738: 956,\n 33739: 957,\n 33740: 958,\n 33741: 959,\n 33742: 960,\n 33743: 961,\n 33744: 963,\n 33745: 964,\n 33746: 965,\n 33747: 966,\n 33748: 967,\n 33749: 968,\n 33750: 969,\n 33856: 1040,\n 33857: 1041,\n 33858: 1042,\n 33859: 1043,\n 33860: 1044,\n 33861: 1045,\n 33862: 1025,\n 33863: 1046,\n 33864: 1047,\n 33865: 1048,\n 33866: 1049,\n 33867: 1050,\n 33868: 1051,\n 33869: 1052,\n 33870: 1053,\n 33871: 1054,\n 33872: 1055,\n 33873: 1056,\n 33874: 1057,\n 33875: 1058,\n 33876: 1059,\n 33877: 1060,\n 33878: 1061,\n 33879: 1062,\n 33880: 1063,\n 33881: 1064,\n 33882: 1065,\n 33883: 1066,\n 33884: 1067,\n 33885: 1068,\n 33886: 1069,\n 33887: 1070,\n 33888: 1071,\n 33904: 1072,\n 33905: 1073,\n 33906: 1074,\n 33907: 1075,\n 33908: 1076,\n 33909: 1077,\n 33910: 1105,\n 33911: 1078,\n 33912: 1079,\n 33913: 1080,\n 33914: 1081,\n 33915: 1082,\n 33916: 1083,\n 33917: 1084,\n 33918: 1085,\n 33920: 1086,\n 33921: 1087,\n 33922: 1088,\n 33923: 1089,\n 33924: 1090,\n 33925: 1091,\n 33926: 1092,\n 33927: 1093,\n 33928: 1094,\n 33929: 1095,\n 33930: 1096,\n 33931: 1097,\n 33932: 1098,\n 33933: 1099,\n 33934: 1100,\n 33935: 1101,\n 33936: 1102,\n 33937: 1103,\n 33951: 9472,\n 33952: 9474,\n 33953: 9484,\n 33954: 9488,\n 33955: 9496,\n 33956: 9492,\n 33957: 9500,\n 33958: 9516,\n 33959: 9508,\n 33960: 9524,\n 33961: 9532,\n 33962: 9473,\n 33963: 9475,\n 33964: 9487,\n 33965: 9491,\n 33966: 9499,\n 33967: 9495,\n 33968: 9507,\n 33969: 9523,\n 33970: 9515,\n 33971: 9531,\n 33972: 9547,\n 33973: 9504,\n 33974: 9519,\n 33975: 9512,\n 33976: 9527,\n 33977: 9535,\n 33978: 9501,\n 33979: 9520,\n 33980: 9509,\n 33981: 9528,\n 33982: 9538,\n 34624: 9312,\n 34625: 9313,\n 34626: 9314,\n 34627: 9315,\n 34628: 9316,\n 34629: 9317,\n 34630: 9318,\n 34631: 9319,\n 34632: 9320,\n 34633: 9321,\n 34634: 9322,\n 34635: 9323,\n 34636: 9324,\n 34637: 9325,\n 34638: 9326,\n 34639: 9327,\n 34640: 9328,\n 34641: 9329,\n 34642: 9330,\n 34643: 9331,\n 34644: 8544,\n 34645: 8545,\n 34646: 8546,\n 34647: 8547,\n 34648: 8548,\n 34649: 8549,\n 34650: 8550,\n 34651: 8551,\n 34652: 8552,\n 34653: 8553,\n 34655: 13129,\n 34656: 13076,\n 34657: 13090,\n 34658: 13133,\n 34659: 13080,\n 34660: 13095,\n 34661: 13059,\n 34662: 13110,\n 34663: 13137,\n 34664: 13143,\n 34665: 13069,\n 34666: 13094,\n 34667: 13091,\n 34668: 13099,\n 34669: 13130,\n 34670: 13115,\n 34671: 13212,\n 34672: 13213,\n 34673: 13214,\n 34674: 13198,\n 34675: 13199,\n 34676: 13252,\n 34677: 13217,\n 34686: 13179,\n 34688: 12317,\n 34689: 12319,\n 34690: 8470,\n 34691: 13261,\n 34692: 8481,\n 34693: 12964,\n 34694: 12965,\n 34695: 12966,\n 34696: 12967,\n 34697: 12968,\n 34698: 12849,\n 34699: 12850,\n 34700: 12857,\n 34701: 13182,\n 34702: 13181,\n 34703: 13180,\n 34704: 8786,\n 34705: 8801,\n 34706: 8747,\n 34707: 8750,\n 34708: 8721,\n 34709: 8730,\n 34710: 8869,\n 34711: 8736,\n 34712: 8735,\n 34713: 8895,\n 34714: 8757,\n 34715: 8745,\n 34716: 8746,\n 34975: 20124,\n 34976: 21782,\n 34977: 23043,\n 34978: 38463,\n 34979: 21696,\n 34980: 24859,\n 34981: 25384,\n 34982: 23030,\n 34983: 36898,\n 34984: 33909,\n 34985: 33564,\n 34986: 31312,\n 34987: 24746,\n 34988: 25569,\n 34989: 28197,\n 34990: 26093,\n 34991: 33894,\n 34992: 33446,\n 34993: 39925,\n 34994: 26771,\n 34995: 22311,\n 34996: 26017,\n 34997: 25201,\n 34998: 23451,\n 34999: 22992,\n 35000: 34427,\n 35001: 39156,\n 35002: 32098,\n 35003: 32190,\n 35004: 39822,\n 35005: 25110,\n 35006: 31903,\n 35007: 34999,\n 35008: 23433,\n 35009: 24245,\n 35010: 25353,\n 35011: 26263,\n 35012: 26696,\n 35013: 38343,\n 35014: 38797,\n 35015: 26447,\n 35016: 20197,\n 35017: 20234,\n 35018: 20301,\n 35019: 20381,\n 35020: 20553,\n 35021: 22258,\n 35022: 22839,\n 35023: 22996,\n 35024: 23041,\n 35025: 23561,\n 35026: 24799,\n 35027: 24847,\n 35028: 24944,\n 35029: 26131,\n 35030: 26885,\n 35031: 28858,\n 35032: 30031,\n 35033: 30064,\n 35034: 31227,\n 35035: 32173,\n 35036: 32239,\n 35037: 32963,\n 35038: 33806,\n 35039: 34915,\n 35040: 35586,\n 35041: 36949,\n 35042: 36986,\n 35043: 21307,\n 35044: 20117,\n 35045: 20133,\n 35046: 22495,\n 35047: 32946,\n 35048: 37057,\n 35049: 30959,\n 35050: 19968,\n 35051: 22769,\n 35052: 28322,\n 35053: 36920,\n 35054: 31282,\n 35055: 33576,\n 35056: 33419,\n 35057: 39983,\n 35058: 20801,\n 35059: 21360,\n 35060: 21693,\n 35061: 21729,\n 35062: 22240,\n 35063: 23035,\n 35064: 24341,\n 35065: 39154,\n 35066: 28139,\n 35067: 32996,\n 35068: 34093,\n 35136: 38498,\n 35137: 38512,\n 35138: 38560,\n 35139: 38907,\n 35140: 21515,\n 35141: 21491,\n 35142: 23431,\n 35143: 28879,\n 35144: 32701,\n 35145: 36802,\n 35146: 38632,\n 35147: 21359,\n 35148: 40284,\n 35149: 31418,\n 35150: 19985,\n 35151: 30867,\n 35152: 33276,\n 35153: 28198,\n 35154: 22040,\n 35155: 21764,\n 35156: 27421,\n 35157: 34074,\n 35158: 39995,\n 35159: 23013,\n 35160: 21417,\n 35161: 28006,\n 35162: 29916,\n 35163: 38287,\n 35164: 22082,\n 35165: 20113,\n 35166: 36939,\n 35167: 38642,\n 35168: 33615,\n 35169: 39180,\n 35170: 21473,\n 35171: 21942,\n 35172: 23344,\n 35173: 24433,\n 35174: 26144,\n 35175: 26355,\n 35176: 26628,\n 35177: 27704,\n 35178: 27891,\n 35179: 27945,\n 35180: 29787,\n 35181: 30408,\n 35182: 31310,\n 35183: 38964,\n 35184: 33521,\n 35185: 34907,\n 35186: 35424,\n 35187: 37613,\n 35188: 28082,\n 35189: 30123,\n 35190: 30410,\n 35191: 39365,\n 35192: 24742,\n 35193: 35585,\n 35194: 36234,\n 35195: 38322,\n 35196: 27022,\n 35197: 21421,\n 35198: 20870,\n 35200: 22290,\n 35201: 22576,\n 35202: 22852,\n 35203: 23476,\n 35204: 24310,\n 35205: 24616,\n 35206: 25513,\n 35207: 25588,\n 35208: 27839,\n 35209: 28436,\n 35210: 28814,\n 35211: 28948,\n 35212: 29017,\n 35213: 29141,\n 35214: 29503,\n 35215: 32257,\n 35216: 33398,\n 35217: 33489,\n 35218: 34199,\n 35219: 36960,\n 35220: 37467,\n 35221: 40219,\n 35222: 22633,\n 35223: 26044,\n 35224: 27738,\n 35225: 29989,\n 35226: 20985,\n 35227: 22830,\n 35228: 22885,\n 35229: 24448,\n 35230: 24540,\n 35231: 25276,\n 35232: 26106,\n 35233: 27178,\n 35234: 27431,\n 35235: 27572,\n 35236: 29579,\n 35237: 32705,\n 35238: 35158,\n 35239: 40236,\n 35240: 40206,\n 35241: 40644,\n 35242: 23713,\n 35243: 27798,\n 35244: 33659,\n 35245: 20740,\n 35246: 23627,\n 35247: 25014,\n 35248: 33222,\n 35249: 26742,\n 35250: 29281,\n 35251: 20057,\n 35252: 20474,\n 35253: 21368,\n 35254: 24681,\n 35255: 28201,\n 35256: 31311,\n 35257: 38899,\n 35258: 19979,\n 35259: 21270,\n 35260: 20206,\n 35261: 20309,\n 35262: 20285,\n 35263: 20385,\n 35264: 20339,\n 35265: 21152,\n 35266: 21487,\n 35267: 22025,\n 35268: 22799,\n 35269: 23233,\n 35270: 23478,\n 35271: 23521,\n 35272: 31185,\n 35273: 26247,\n 35274: 26524,\n 35275: 26550,\n 35276: 27468,\n 35277: 27827,\n 35278: 28779,\n 35279: 29634,\n 35280: 31117,\n 35281: 31166,\n 35282: 31292,\n 35283: 31623,\n 35284: 33457,\n 35285: 33499,\n 35286: 33540,\n 35287: 33655,\n 35288: 33775,\n 35289: 33747,\n 35290: 34662,\n 35291: 35506,\n 35292: 22057,\n 35293: 36008,\n 35294: 36838,\n 35295: 36942,\n 35296: 38686,\n 35297: 34442,\n 35298: 20420,\n 35299: 23784,\n 35300: 25105,\n 35301: 29273,\n 35302: 30011,\n 35303: 33253,\n 35304: 33469,\n 35305: 34558,\n 35306: 36032,\n 35307: 38597,\n 35308: 39187,\n 35309: 39381,\n 35310: 20171,\n 35311: 20250,\n 35312: 35299,\n 35313: 22238,\n 35314: 22602,\n 35315: 22730,\n 35316: 24315,\n 35317: 24555,\n 35318: 24618,\n 35319: 24724,\n 35320: 24674,\n 35321: 25040,\n 35322: 25106,\n 35323: 25296,\n 35324: 25913,\n 35392: 39745,\n 35393: 26214,\n 35394: 26800,\n 35395: 28023,\n 35396: 28784,\n 35397: 30028,\n 35398: 30342,\n 35399: 32117,\n 35400: 33445,\n 35401: 34809,\n 35402: 38283,\n 35403: 38542,\n 35404: 35997,\n 35405: 20977,\n 35406: 21182,\n 35407: 22806,\n 35408: 21683,\n 35409: 23475,\n 35410: 23830,\n 35411: 24936,\n 35412: 27010,\n 35413: 28079,\n 35414: 30861,\n 35415: 33995,\n 35416: 34903,\n 35417: 35442,\n 35418: 37799,\n 35419: 39608,\n 35420: 28012,\n 35421: 39336,\n 35422: 34521,\n 35423: 22435,\n 35424: 26623,\n 35425: 34510,\n 35426: 37390,\n 35427: 21123,\n 35428: 22151,\n 35429: 21508,\n 35430: 24275,\n 35431: 25313,\n 35432: 25785,\n 35433: 26684,\n 35434: 26680,\n 35435: 27579,\n 35436: 29554,\n 35437: 30906,\n 35438: 31339,\n 35439: 35226,\n 35440: 35282,\n 35441: 36203,\n 35442: 36611,\n 35443: 37101,\n 35444: 38307,\n 35445: 38548,\n 35446: 38761,\n 35447: 23398,\n 35448: 23731,\n 35449: 27005,\n 35450: 38989,\n 35451: 38990,\n 35452: 25499,\n 35453: 31520,\n 35454: 27179,\n 35456: 27263,\n 35457: 26806,\n 35458: 39949,\n 35459: 28511,\n 35460: 21106,\n 35461: 21917,\n 35462: 24688,\n 35463: 25324,\n 35464: 27963,\n 35465: 28167,\n 35466: 28369,\n 35467: 33883,\n 35468: 35088,\n 35469: 36676,\n 35470: 19988,\n 35471: 39993,\n 35472: 21494,\n 35473: 26907,\n 35474: 27194,\n 35475: 38788,\n 35476: 26666,\n 35477: 20828,\n 35478: 31427,\n 35479: 33970,\n 35480: 37340,\n 35481: 37772,\n 35482: 22107,\n 35483: 40232,\n 35484: 26658,\n 35485: 33541,\n 35486: 33841,\n 35487: 31909,\n 35488: 21000,\n 35489: 33477,\n 35490: 29926,\n 35491: 20094,\n 35492: 20355,\n 35493: 20896,\n 35494: 23506,\n 35495: 21002,\n 35496: 21208,\n 35497: 21223,\n 35498: 24059,\n 35499: 21914,\n 35500: 22570,\n 35501: 23014,\n 35502: 23436,\n 35503: 23448,\n 35504: 23515,\n 35505: 24178,\n 35506: 24185,\n 35507: 24739,\n 35508: 24863,\n 35509: 24931,\n 35510: 25022,\n 35511: 25563,\n 35512: 25954,\n 35513: 26577,\n 35514: 26707,\n 35515: 26874,\n 35516: 27454,\n 35517: 27475,\n 35518: 27735,\n 35519: 28450,\n 35520: 28567,\n 35521: 28485,\n 35522: 29872,\n 35523: 29976,\n 35524: 30435,\n 35525: 30475,\n 35526: 31487,\n 35527: 31649,\n 35528: 31777,\n 35529: 32233,\n 35530: 32566,\n 35531: 32752,\n 35532: 32925,\n 35533: 33382,\n 35534: 33694,\n 35535: 35251,\n 35536: 35532,\n 35537: 36011,\n 35538: 36996,\n 35539: 37969,\n 35540: 38291,\n 35541: 38289,\n 35542: 38306,\n 35543: 38501,\n 35544: 38867,\n 35545: 39208,\n 35546: 33304,\n 35547: 20024,\n 35548: 21547,\n 35549: 23736,\n 35550: 24012,\n 35551: 29609,\n 35552: 30284,\n 35553: 30524,\n 35554: 23721,\n 35555: 32747,\n 35556: 36107,\n 35557: 38593,\n 35558: 38929,\n 35559: 38996,\n 35560: 39000,\n 35561: 20225,\n 35562: 20238,\n 35563: 21361,\n 35564: 21916,\n 35565: 22120,\n 35566: 22522,\n 35567: 22855,\n 35568: 23305,\n 35569: 23492,\n 35570: 23696,\n 35571: 24076,\n 35572: 24190,\n 35573: 24524,\n 35574: 25582,\n 35575: 26426,\n 35576: 26071,\n 35577: 26082,\n 35578: 26399,\n 35579: 26827,\n 35580: 26820,\n 35648: 27231,\n 35649: 24112,\n 35650: 27589,\n 35651: 27671,\n 35652: 27773,\n 35653: 30079,\n 35654: 31048,\n 35655: 23395,\n 35656: 31232,\n 35657: 32000,\n 35658: 24509,\n 35659: 35215,\n 35660: 35352,\n 35661: 36020,\n 35662: 36215,\n 35663: 36556,\n 35664: 36637,\n 35665: 39138,\n 35666: 39438,\n 35667: 39740,\n 35668: 20096,\n 35669: 20605,\n 35670: 20736,\n 35671: 22931,\n 35672: 23452,\n 35673: 25135,\n 35674: 25216,\n 35675: 25836,\n 35676: 27450,\n 35677: 29344,\n 35678: 30097,\n 35679: 31047,\n 35680: 32681,\n 35681: 34811,\n 35682: 35516,\n 35683: 35696,\n 35684: 25516,\n 35685: 33738,\n 35686: 38816,\n 35687: 21513,\n 35688: 21507,\n 35689: 21931,\n 35690: 26708,\n 35691: 27224,\n 35692: 35440,\n 35693: 30759,\n 35694: 26485,\n 35695: 40653,\n 35696: 21364,\n 35697: 23458,\n 35698: 33050,\n 35699: 34384,\n 35700: 36870,\n 35701: 19992,\n 35702: 20037,\n 35703: 20167,\n 35704: 20241,\n 35705: 21450,\n 35706: 21560,\n 35707: 23470,\n 35708: 24339,\n 35709: 24613,\n 35710: 25937,\n 35712: 26429,\n 35713: 27714,\n 35714: 27762,\n 35715: 27875,\n 35716: 28792,\n 35717: 29699,\n 35718: 31350,\n 35719: 31406,\n 35720: 31496,\n 35721: 32026,\n 35722: 31998,\n 35723: 32102,\n 35724: 26087,\n 35725: 29275,\n 35726: 21435,\n 35727: 23621,\n 35728: 24040,\n 35729: 25298,\n 35730: 25312,\n 35731: 25369,\n 35732: 28192,\n 35733: 34394,\n 35734: 35377,\n 35735: 36317,\n 35736: 37624,\n 35737: 28417,\n 35738: 31142,\n 35739: 39770,\n 35740: 20136,\n 35741: 20139,\n 35742: 20140,\n 35743: 20379,\n 35744: 20384,\n 35745: 20689,\n 35746: 20807,\n 35747: 31478,\n 35748: 20849,\n 35749: 20982,\n 35750: 21332,\n 35751: 21281,\n 35752: 21375,\n 35753: 21483,\n 35754: 21932,\n 35755: 22659,\n 35756: 23777,\n 35757: 24375,\n 35758: 24394,\n 35759: 24623,\n 35760: 24656,\n 35761: 24685,\n 35762: 25375,\n 35763: 25945,\n 35764: 27211,\n 35765: 27841,\n 35766: 29378,\n 35767: 29421,\n 35768: 30703,\n 35769: 33016,\n 35770: 33029,\n 35771: 33288,\n 35772: 34126,\n 35773: 37111,\n 35774: 37857,\n 35775: 38911,\n 35776: 39255,\n 35777: 39514,\n 35778: 20208,\n 35779: 20957,\n 35780: 23597,\n 35781: 26241,\n 35782: 26989,\n 35783: 23616,\n 35784: 26354,\n 35785: 26997,\n 35786: 29577,\n 35787: 26704,\n 35788: 31873,\n 35789: 20677,\n 35790: 21220,\n 35791: 22343,\n 35792: 24062,\n 35793: 37670,\n 35794: 26020,\n 35795: 27427,\n 35796: 27453,\n 35797: 29748,\n 35798: 31105,\n 35799: 31165,\n 35800: 31563,\n 35801: 32202,\n 35802: 33465,\n 35803: 33740,\n 35804: 34943,\n 35805: 35167,\n 35806: 35641,\n 35807: 36817,\n 35808: 37329,\n 35809: 21535,\n 35810: 37504,\n 35811: 20061,\n 35812: 20534,\n 35813: 21477,\n 35814: 21306,\n 35815: 29399,\n 35816: 29590,\n 35817: 30697,\n 35818: 33510,\n 35819: 36527,\n 35820: 39366,\n 35821: 39368,\n 35822: 39378,\n 35823: 20855,\n 35824: 24858,\n 35825: 34398,\n 35826: 21936,\n 35827: 31354,\n 35828: 20598,\n 35829: 23507,\n 35830: 36935,\n 35831: 38533,\n 35832: 20018,\n 35833: 27355,\n 35834: 37351,\n 35835: 23633,\n 35836: 23624,\n 35904: 25496,\n 35905: 31391,\n 35906: 27795,\n 35907: 38772,\n 35908: 36705,\n 35909: 31402,\n 35910: 29066,\n 35911: 38536,\n 35912: 31874,\n 35913: 26647,\n 35914: 32368,\n 35915: 26705,\n 35916: 37740,\n 35917: 21234,\n 35918: 21531,\n 35919: 34219,\n 35920: 35347,\n 35921: 32676,\n 35922: 36557,\n 35923: 37089,\n 35924: 21350,\n 35925: 34952,\n 35926: 31041,\n 35927: 20418,\n 35928: 20670,\n 35929: 21009,\n 35930: 20804,\n 35931: 21843,\n 35932: 22317,\n 35933: 29674,\n 35934: 22411,\n 35935: 22865,\n 35936: 24418,\n 35937: 24452,\n 35938: 24693,\n 35939: 24950,\n 35940: 24935,\n 35941: 25001,\n 35942: 25522,\n 35943: 25658,\n 35944: 25964,\n 35945: 26223,\n 35946: 26690,\n 35947: 28179,\n 35948: 30054,\n 35949: 31293,\n 35950: 31995,\n 35951: 32076,\n 35952: 32153,\n 35953: 32331,\n 35954: 32619,\n 35955: 33550,\n 35956: 33610,\n 35957: 34509,\n 35958: 35336,\n 35959: 35427,\n 35960: 35686,\n 35961: 36605,\n 35962: 38938,\n 35963: 40335,\n 35964: 33464,\n 35965: 36814,\n 35966: 39912,\n 35968: 21127,\n 35969: 25119,\n 35970: 25731,\n 35971: 28608,\n 35972: 38553,\n 35973: 26689,\n 35974: 20625,\n 35975: 27424,\n 35976: 27770,\n 35977: 28500,\n 35978: 31348,\n 35979: 32080,\n 35980: 34880,\n 35981: 35363,\n 35982: 26376,\n 35983: 20214,\n 35984: 20537,\n 35985: 20518,\n 35986: 20581,\n 35987: 20860,\n 35988: 21048,\n 35989: 21091,\n 35990: 21927,\n 35991: 22287,\n 35992: 22533,\n 35993: 23244,\n 35994: 24314,\n 35995: 25010,\n 35996: 25080,\n 35997: 25331,\n 35998: 25458,\n 35999: 26908,\n 36000: 27177,\n 36001: 29309,\n 36002: 29356,\n 36003: 29486,\n 36004: 30740,\n 36005: 30831,\n 36006: 32121,\n 36007: 30476,\n 36008: 32937,\n 36009: 35211,\n 36010: 35609,\n 36011: 36066,\n 36012: 36562,\n 36013: 36963,\n 36014: 37749,\n 36015: 38522,\n 36016: 38997,\n 36017: 39443,\n 36018: 40568,\n 36019: 20803,\n 36020: 21407,\n 36021: 21427,\n 36022: 24187,\n 36023: 24358,\n 36024: 28187,\n 36025: 28304,\n 36026: 29572,\n 36027: 29694,\n 36028: 32067,\n 36029: 33335,\n 36030: 35328,\n 36031: 35578,\n 36032: 38480,\n 36033: 20046,\n 36034: 20491,\n 36035: 21476,\n 36036: 21628,\n 36037: 22266,\n 36038: 22993,\n 36039: 23396,\n 36040: 24049,\n 36041: 24235,\n 36042: 24359,\n 36043: 25144,\n 36044: 25925,\n 36045: 26543,\n 36046: 28246,\n 36047: 29392,\n 36048: 31946,\n 36049: 34996,\n 36050: 32929,\n 36051: 32993,\n 36052: 33776,\n 36053: 34382,\n 36054: 35463,\n 36055: 36328,\n 36056: 37431,\n 36057: 38599,\n 36058: 39015,\n 36059: 40723,\n 36060: 20116,\n 36061: 20114,\n 36062: 20237,\n 36063: 21320,\n 36064: 21577,\n 36065: 21566,\n 36066: 23087,\n 36067: 24460,\n 36068: 24481,\n 36069: 24735,\n 36070: 26791,\n 36071: 27278,\n 36072: 29786,\n 36073: 30849,\n 36074: 35486,\n 36075: 35492,\n 36076: 35703,\n 36077: 37264,\n 36078: 20062,\n 36079: 39881,\n 36080: 20132,\n 36081: 20348,\n 36082: 20399,\n 36083: 20505,\n 36084: 20502,\n 36085: 20809,\n 36086: 20844,\n 36087: 21151,\n 36088: 21177,\n 36089: 21246,\n 36090: 21402,\n 36091: 21475,\n 36092: 21521,\n 36160: 21518,\n 36161: 21897,\n 36162: 22353,\n 36163: 22434,\n 36164: 22909,\n 36165: 23380,\n 36166: 23389,\n 36167: 23439,\n 36168: 24037,\n 36169: 24039,\n 36170: 24055,\n 36171: 24184,\n 36172: 24195,\n 36173: 24218,\n 36174: 24247,\n 36175: 24344,\n 36176: 24658,\n 36177: 24908,\n 36178: 25239,\n 36179: 25304,\n 36180: 25511,\n 36181: 25915,\n 36182: 26114,\n 36183: 26179,\n 36184: 26356,\n 36185: 26477,\n 36186: 26657,\n 36187: 26775,\n 36188: 27083,\n 36189: 27743,\n 36190: 27946,\n 36191: 28009,\n 36192: 28207,\n 36193: 28317,\n 36194: 30002,\n 36195: 30343,\n 36196: 30828,\n 36197: 31295,\n 36198: 31968,\n 36199: 32005,\n 36200: 32024,\n 36201: 32094,\n 36202: 32177,\n 36203: 32789,\n 36204: 32771,\n 36205: 32943,\n 36206: 32945,\n 36207: 33108,\n 36208: 33167,\n 36209: 33322,\n 36210: 33618,\n 36211: 34892,\n 36212: 34913,\n 36213: 35611,\n 36214: 36002,\n 36215: 36092,\n 36216: 37066,\n 36217: 37237,\n 36218: 37489,\n 36219: 30783,\n 36220: 37628,\n 36221: 38308,\n 36222: 38477,\n 36224: 38917,\n 36225: 39321,\n 36226: 39640,\n 36227: 40251,\n 36228: 21083,\n 36229: 21163,\n 36230: 21495,\n 36231: 21512,\n 36232: 22741,\n 36233: 25335,\n 36234: 28640,\n 36235: 35946,\n 36236: 36703,\n 36237: 40633,\n 36238: 20811,\n 36239: 21051,\n 36240: 21578,\n 36241: 22269,\n 36242: 31296,\n 36243: 37239,\n 36244: 40288,\n 36245: 40658,\n 36246: 29508,\n 36247: 28425,\n 36248: 33136,\n 36249: 29969,\n 36250: 24573,\n 36251: 24794,\n 36252: 39592,\n 36253: 29403,\n 36254: 36796,\n 36255: 27492,\n 36256: 38915,\n 36257: 20170,\n 36258: 22256,\n 36259: 22372,\n 36260: 22718,\n 36261: 23130,\n 36262: 24680,\n 36263: 25031,\n 36264: 26127,\n 36265: 26118,\n 36266: 26681,\n 36267: 26801,\n 36268: 28151,\n 36269: 30165,\n 36270: 32058,\n 36271: 33390,\n 36272: 39746,\n 36273: 20123,\n 36274: 20304,\n 36275: 21449,\n 36276: 21766,\n 36277: 23919,\n 36278: 24038,\n 36279: 24046,\n 36280: 26619,\n 36281: 27801,\n 36282: 29811,\n 36283: 30722,\n 36284: 35408,\n 36285: 37782,\n 36286: 35039,\n 36287: 22352,\n 36288: 24231,\n 36289: 25387,\n 36290: 20661,\n 36291: 20652,\n 36292: 20877,\n 36293: 26368,\n 36294: 21705,\n 36295: 22622,\n 36296: 22971,\n 36297: 23472,\n 36298: 24425,\n 36299: 25165,\n 36300: 25505,\n 36301: 26685,\n 36302: 27507,\n 36303: 28168,\n 36304: 28797,\n 36305: 37319,\n 36306: 29312,\n 36307: 30741,\n 36308: 30758,\n 36309: 31085,\n 36310: 25998,\n 36311: 32048,\n 36312: 33756,\n 36313: 35009,\n 36314: 36617,\n 36315: 38555,\n 36316: 21092,\n 36317: 22312,\n 36318: 26448,\n 36319: 32618,\n 36320: 36001,\n 36321: 20916,\n 36322: 22338,\n 36323: 38442,\n 36324: 22586,\n 36325: 27018,\n 36326: 32948,\n 36327: 21682,\n 36328: 23822,\n 36329: 22524,\n 36330: 30869,\n 36331: 40442,\n 36332: 20316,\n 36333: 21066,\n 36334: 21643,\n 36335: 25662,\n 36336: 26152,\n 36337: 26388,\n 36338: 26613,\n 36339: 31364,\n 36340: 31574,\n 36341: 32034,\n 36342: 37679,\n 36343: 26716,\n 36344: 39853,\n 36345: 31545,\n 36346: 21273,\n 36347: 20874,\n 36348: 21047,\n 36416: 23519,\n 36417: 25334,\n 36418: 25774,\n 36419: 25830,\n 36420: 26413,\n 36421: 27578,\n 36422: 34217,\n 36423: 38609,\n 36424: 30352,\n 36425: 39894,\n 36426: 25420,\n 36427: 37638,\n 36428: 39851,\n 36429: 30399,\n 36430: 26194,\n 36431: 19977,\n 36432: 20632,\n 36433: 21442,\n 36434: 23665,\n 36435: 24808,\n 36436: 25746,\n 36437: 25955,\n 36438: 26719,\n 36439: 29158,\n 36440: 29642,\n 36441: 29987,\n 36442: 31639,\n 36443: 32386,\n 36444: 34453,\n 36445: 35715,\n 36446: 36059,\n 36447: 37240,\n 36448: 39184,\n 36449: 26028,\n 36450: 26283,\n 36451: 27531,\n 36452: 20181,\n 36453: 20180,\n 36454: 20282,\n 36455: 20351,\n 36456: 21050,\n 36457: 21496,\n 36458: 21490,\n 36459: 21987,\n 36460: 22235,\n 36461: 22763,\n 36462: 22987,\n 36463: 22985,\n 36464: 23039,\n 36465: 23376,\n 36466: 23629,\n 36467: 24066,\n 36468: 24107,\n 36469: 24535,\n 36470: 24605,\n 36471: 25351,\n 36472: 25903,\n 36473: 23388,\n 36474: 26031,\n 36475: 26045,\n 36476: 26088,\n 36477: 26525,\n 36478: 27490,\n 36480: 27515,\n 36481: 27663,\n 36482: 29509,\n 36483: 31049,\n 36484: 31169,\n 36485: 31992,\n 36486: 32025,\n 36487: 32043,\n 36488: 32930,\n 36489: 33026,\n 36490: 33267,\n 36491: 35222,\n 36492: 35422,\n 36493: 35433,\n 36494: 35430,\n 36495: 35468,\n 36496: 35566,\n 36497: 36039,\n 36498: 36060,\n 36499: 38604,\n 36500: 39164,\n 36501: 27503,\n 36502: 20107,\n 36503: 20284,\n 36504: 20365,\n 36505: 20816,\n 36506: 23383,\n 36507: 23546,\n 36508: 24904,\n 36509: 25345,\n 36510: 26178,\n 36511: 27425,\n 36512: 28363,\n 36513: 27835,\n 36514: 29246,\n 36515: 29885,\n 36516: 30164,\n 36517: 30913,\n 36518: 31034,\n 36519: 32780,\n 36520: 32819,\n 36521: 33258,\n 36522: 33940,\n 36523: 36766,\n 36524: 27728,\n 36525: 40575,\n 36526: 24335,\n 36527: 35672,\n 36528: 40235,\n 36529: 31482,\n 36530: 36600,\n 36531: 23437,\n 36532: 38635,\n 36533: 19971,\n 36534: 21489,\n 36535: 22519,\n 36536: 22833,\n 36537: 23241,\n 36538: 23460,\n 36539: 24713,\n 36540: 28287,\n 36541: 28422,\n 36542: 30142,\n 36543: 36074,\n 36544: 23455,\n 36545: 34048,\n 36546: 31712,\n 36547: 20594,\n 36548: 26612,\n 36549: 33437,\n 36550: 23649,\n 36551: 34122,\n 36552: 32286,\n 36553: 33294,\n 36554: 20889,\n 36555: 23556,\n 36556: 25448,\n 36557: 36198,\n 36558: 26012,\n 36559: 29038,\n 36560: 31038,\n 36561: 32023,\n 36562: 32773,\n 36563: 35613,\n 36564: 36554,\n 36565: 36974,\n 36566: 34503,\n 36567: 37034,\n 36568: 20511,\n 36569: 21242,\n 36570: 23610,\n 36571: 26451,\n 36572: 28796,\n 36573: 29237,\n 36574: 37196,\n 36575: 37320,\n 36576: 37675,\n 36577: 33509,\n 36578: 23490,\n 36579: 24369,\n 36580: 24825,\n 36581: 20027,\n 36582: 21462,\n 36583: 23432,\n 36584: 25163,\n 36585: 26417,\n 36586: 27530,\n 36587: 29417,\n 36588: 29664,\n 36589: 31278,\n 36590: 33131,\n 36591: 36259,\n 36592: 37202,\n 36593: 39318,\n 36594: 20754,\n 36595: 21463,\n 36596: 21610,\n 36597: 23551,\n 36598: 25480,\n 36599: 27193,\n 36600: 32172,\n 36601: 38656,\n 36602: 22234,\n 36603: 21454,\n 36604: 21608,\n 36672: 23447,\n 36673: 23601,\n 36674: 24030,\n 36675: 20462,\n 36676: 24833,\n 36677: 25342,\n 36678: 27954,\n 36679: 31168,\n 36680: 31179,\n 36681: 32066,\n 36682: 32333,\n 36683: 32722,\n 36684: 33261,\n 36685: 33311,\n 36686: 33936,\n 36687: 34886,\n 36688: 35186,\n 36689: 35728,\n 36690: 36468,\n 36691: 36655,\n 36692: 36913,\n 36693: 37195,\n 36694: 37228,\n 36695: 38598,\n 36696: 37276,\n 36697: 20160,\n 36698: 20303,\n 36699: 20805,\n 36700: 21313,\n 36701: 24467,\n 36702: 25102,\n 36703: 26580,\n 36704: 27713,\n 36705: 28171,\n 36706: 29539,\n 36707: 32294,\n 36708: 37325,\n 36709: 37507,\n 36710: 21460,\n 36711: 22809,\n 36712: 23487,\n 36713: 28113,\n 36714: 31069,\n 36715: 32302,\n 36716: 31899,\n 36717: 22654,\n 36718: 29087,\n 36719: 20986,\n 36720: 34899,\n 36721: 36848,\n 36722: 20426,\n 36723: 23803,\n 36724: 26149,\n 36725: 30636,\n 36726: 31459,\n 36727: 33308,\n 36728: 39423,\n 36729: 20934,\n 36730: 24490,\n 36731: 26092,\n 36732: 26991,\n 36733: 27529,\n 36734: 28147,\n 36736: 28310,\n 36737: 28516,\n 36738: 30462,\n 36739: 32020,\n 36740: 24033,\n 36741: 36981,\n 36742: 37255,\n 36743: 38918,\n 36744: 20966,\n 36745: 21021,\n 36746: 25152,\n 36747: 26257,\n 36748: 26329,\n 36749: 28186,\n 36750: 24246,\n 36751: 32210,\n 36752: 32626,\n 36753: 26360,\n 36754: 34223,\n 36755: 34295,\n 36756: 35576,\n 36757: 21161,\n 36758: 21465,\n 36759: 22899,\n 36760: 24207,\n 36761: 24464,\n 36762: 24661,\n 36763: 37604,\n 36764: 38500,\n 36765: 20663,\n 36766: 20767,\n 36767: 21213,\n 36768: 21280,\n 36769: 21319,\n 36770: 21484,\n 36771: 21736,\n 36772: 21830,\n 36773: 21809,\n 36774: 22039,\n 36775: 22888,\n 36776: 22974,\n 36777: 23100,\n 36778: 23477,\n 36779: 23558,\n 36780: 23567,\n 36781: 23569,\n 36782: 23578,\n 36783: 24196,\n 36784: 24202,\n 36785: 24288,\n 36786: 24432,\n 36787: 25215,\n 36788: 25220,\n 36789: 25307,\n 36790: 25484,\n 36791: 25463,\n 36792: 26119,\n 36793: 26124,\n 36794: 26157,\n 36795: 26230,\n 36796: 26494,\n 36797: 26786,\n 36798: 27167,\n 36799: 27189,\n 36800: 27836,\n 36801: 28040,\n 36802: 28169,\n 36803: 28248,\n 36804: 28988,\n 36805: 28966,\n 36806: 29031,\n 36807: 30151,\n 36808: 30465,\n 36809: 30813,\n 36810: 30977,\n 36811: 31077,\n 36812: 31216,\n 36813: 31456,\n 36814: 31505,\n 36815: 31911,\n 36816: 32057,\n 36817: 32918,\n 36818: 33750,\n 36819: 33931,\n 36820: 34121,\n 36821: 34909,\n 36822: 35059,\n 36823: 35359,\n 36824: 35388,\n 36825: 35412,\n 36826: 35443,\n 36827: 35937,\n 36828: 36062,\n 36829: 37284,\n 36830: 37478,\n 36831: 37758,\n 36832: 37912,\n 36833: 38556,\n 36834: 38808,\n 36835: 19978,\n 36836: 19976,\n 36837: 19998,\n 36838: 20055,\n 36839: 20887,\n 36840: 21104,\n 36841: 22478,\n 36842: 22580,\n 36843: 22732,\n 36844: 23330,\n 36845: 24120,\n 36846: 24773,\n 36847: 25854,\n 36848: 26465,\n 36849: 26454,\n 36850: 27972,\n 36851: 29366,\n 36852: 30067,\n 36853: 31331,\n 36854: 33976,\n 36855: 35698,\n 36856: 37304,\n 36857: 37664,\n 36858: 22065,\n 36859: 22516,\n 36860: 39166,\n 36928: 25325,\n 36929: 26893,\n 36930: 27542,\n 36931: 29165,\n 36932: 32340,\n 36933: 32887,\n 36934: 33394,\n 36935: 35302,\n 36936: 39135,\n 36937: 34645,\n 36938: 36785,\n 36939: 23611,\n 36940: 20280,\n 36941: 20449,\n 36942: 20405,\n 36943: 21767,\n 36944: 23072,\n 36945: 23517,\n 36946: 23529,\n 36947: 24515,\n 36948: 24910,\n 36949: 25391,\n 36950: 26032,\n 36951: 26187,\n 36952: 26862,\n 36953: 27035,\n 36954: 28024,\n 36955: 28145,\n 36956: 30003,\n 36957: 30137,\n 36958: 30495,\n 36959: 31070,\n 36960: 31206,\n 36961: 32051,\n 36962: 33251,\n 36963: 33455,\n 36964: 34218,\n 36965: 35242,\n 36966: 35386,\n 36967: 36523,\n 36968: 36763,\n 36969: 36914,\n 36970: 37341,\n 36971: 38663,\n 36972: 20154,\n 36973: 20161,\n 36974: 20995,\n 36975: 22645,\n 36976: 22764,\n 36977: 23563,\n 36978: 29978,\n 36979: 23613,\n 36980: 33102,\n 36981: 35338,\n 36982: 36805,\n 36983: 38499,\n 36984: 38765,\n 36985: 31525,\n 36986: 35535,\n 36987: 38920,\n 36988: 37218,\n 36989: 22259,\n 36990: 21416,\n 36992: 36887,\n 36993: 21561,\n 36994: 22402,\n 36995: 24101,\n 36996: 25512,\n 36997: 27700,\n 36998: 28810,\n 36999: 30561,\n 37000: 31883,\n 37001: 32736,\n 37002: 34928,\n 37003: 36930,\n 37004: 37204,\n 37005: 37648,\n 37006: 37656,\n 37007: 38543,\n 37008: 29790,\n 37009: 39620,\n 37010: 23815,\n 37011: 23913,\n 37012: 25968,\n 37013: 26530,\n 37014: 36264,\n 37015: 38619,\n 37016: 25454,\n 37017: 26441,\n 37018: 26905,\n 37019: 33733,\n 37020: 38935,\n 37021: 38592,\n 37022: 35070,\n 37023: 28548,\n 37024: 25722,\n 37025: 23544,\n 37026: 19990,\n 37027: 28716,\n 37028: 30045,\n 37029: 26159,\n 37030: 20932,\n 37031: 21046,\n 37032: 21218,\n 37033: 22995,\n 37034: 24449,\n 37035: 24615,\n 37036: 25104,\n 37037: 25919,\n 37038: 25972,\n 37039: 26143,\n 37040: 26228,\n 37041: 26866,\n 37042: 26646,\n 37043: 27491,\n 37044: 28165,\n 37045: 29298,\n 37046: 29983,\n 37047: 30427,\n 37048: 31934,\n 37049: 32854,\n 37050: 22768,\n 37051: 35069,\n 37052: 35199,\n 37053: 35488,\n 37054: 35475,\n 37055: 35531,\n 37056: 36893,\n 37057: 37266,\n 37058: 38738,\n 37059: 38745,\n 37060: 25993,\n 37061: 31246,\n 37062: 33030,\n 37063: 38587,\n 37064: 24109,\n 37065: 24796,\n 37066: 25114,\n 37067: 26021,\n 37068: 26132,\n 37069: 26512,\n 37070: 30707,\n 37071: 31309,\n 37072: 31821,\n 37073: 32318,\n 37074: 33034,\n 37075: 36012,\n 37076: 36196,\n 37077: 36321,\n 37078: 36447,\n 37079: 30889,\n 37080: 20999,\n 37081: 25305,\n 37082: 25509,\n 37083: 25666,\n 37084: 25240,\n 37085: 35373,\n 37086: 31363,\n 37087: 31680,\n 37088: 35500,\n 37089: 38634,\n 37090: 32118,\n 37091: 33292,\n 37092: 34633,\n 37093: 20185,\n 37094: 20808,\n 37095: 21315,\n 37096: 21344,\n 37097: 23459,\n 37098: 23554,\n 37099: 23574,\n 37100: 24029,\n 37101: 25126,\n 37102: 25159,\n 37103: 25776,\n 37104: 26643,\n 37105: 26676,\n 37106: 27849,\n 37107: 27973,\n 37108: 27927,\n 37109: 26579,\n 37110: 28508,\n 37111: 29006,\n 37112: 29053,\n 37113: 26059,\n 37114: 31359,\n 37115: 31661,\n 37116: 32218,\n 37184: 32330,\n 37185: 32680,\n 37186: 33146,\n 37187: 33307,\n 37188: 33337,\n 37189: 34214,\n 37190: 35438,\n 37191: 36046,\n 37192: 36341,\n 37193: 36984,\n 37194: 36983,\n 37195: 37549,\n 37196: 37521,\n 37197: 38275,\n 37198: 39854,\n 37199: 21069,\n 37200: 21892,\n 37201: 28472,\n 37202: 28982,\n 37203: 20840,\n 37204: 31109,\n 37205: 32341,\n 37206: 33203,\n 37207: 31950,\n 37208: 22092,\n 37209: 22609,\n 37210: 23720,\n 37211: 25514,\n 37212: 26366,\n 37213: 26365,\n 37214: 26970,\n 37215: 29401,\n 37216: 30095,\n 37217: 30094,\n 37218: 30990,\n 37219: 31062,\n 37220: 31199,\n 37221: 31895,\n 37222: 32032,\n 37223: 32068,\n 37224: 34311,\n 37225: 35380,\n 37226: 38459,\n 37227: 36961,\n 37228: 40736,\n 37229: 20711,\n 37230: 21109,\n 37231: 21452,\n 37232: 21474,\n 37233: 20489,\n 37234: 21930,\n 37235: 22766,\n 37236: 22863,\n 37237: 29245,\n 37238: 23435,\n 37239: 23652,\n 37240: 21277,\n 37241: 24803,\n 37242: 24819,\n 37243: 25436,\n 37244: 25475,\n 37245: 25407,\n 37246: 25531,\n 37248: 25805,\n 37249: 26089,\n 37250: 26361,\n 37251: 24035,\n 37252: 27085,\n 37253: 27133,\n 37254: 28437,\n 37255: 29157,\n 37256: 20105,\n 37257: 30185,\n 37258: 30456,\n 37259: 31379,\n 37260: 31967,\n 37261: 32207,\n 37262: 32156,\n 37263: 32865,\n 37264: 33609,\n 37265: 33624,\n 37266: 33900,\n 37267: 33980,\n 37268: 34299,\n 37269: 35013,\n 37270: 36208,\n 37271: 36865,\n 37272: 36973,\n 37273: 37783,\n 37274: 38684,\n 37275: 39442,\n 37276: 20687,\n 37277: 22679,\n 37278: 24974,\n 37279: 33235,\n 37280: 34101,\n 37281: 36104,\n 37282: 36896,\n 37283: 20419,\n 37284: 20596,\n 37285: 21063,\n 37286: 21363,\n 37287: 24687,\n 37288: 25417,\n 37289: 26463,\n 37290: 28204,\n 37291: 36275,\n 37292: 36895,\n 37293: 20439,\n 37294: 23646,\n 37295: 36042,\n 37296: 26063,\n 37297: 32154,\n 37298: 21330,\n 37299: 34966,\n 37300: 20854,\n 37301: 25539,\n 37302: 23384,\n 37303: 23403,\n 37304: 23562,\n 37305: 25613,\n 37306: 26449,\n 37307: 36956,\n 37308: 20182,\n 37309: 22810,\n 37310: 22826,\n 37311: 27760,\n 37312: 35409,\n 37313: 21822,\n 37314: 22549,\n 37315: 22949,\n 37316: 24816,\n 37317: 25171,\n 37318: 26561,\n 37319: 33333,\n 37320: 26965,\n 37321: 38464,\n 37322: 39364,\n 37323: 39464,\n 37324: 20307,\n 37325: 22534,\n 37326: 23550,\n 37327: 32784,\n 37328: 23729,\n 37329: 24111,\n 37330: 24453,\n 37331: 24608,\n 37332: 24907,\n 37333: 25140,\n 37334: 26367,\n 37335: 27888,\n 37336: 28382,\n 37337: 32974,\n 37338: 33151,\n 37339: 33492,\n 37340: 34955,\n 37341: 36024,\n 37342: 36864,\n 37343: 36910,\n 37344: 38538,\n 37345: 40667,\n 37346: 39899,\n 37347: 20195,\n 37348: 21488,\n 37349: 22823,\n 37350: 31532,\n 37351: 37261,\n 37352: 38988,\n 37353: 40441,\n 37354: 28381,\n 37355: 28711,\n 37356: 21331,\n 37357: 21828,\n 37358: 23429,\n 37359: 25176,\n 37360: 25246,\n 37361: 25299,\n 37362: 27810,\n 37363: 28655,\n 37364: 29730,\n 37365: 35351,\n 37366: 37944,\n 37367: 28609,\n 37368: 35582,\n 37369: 33592,\n 37370: 20967,\n 37371: 34552,\n 37372: 21482,\n 37440: 21481,\n 37441: 20294,\n 37442: 36948,\n 37443: 36784,\n 37444: 22890,\n 37445: 33073,\n 37446: 24061,\n 37447: 31466,\n 37448: 36799,\n 37449: 26842,\n 37450: 35895,\n 37451: 29432,\n 37452: 40008,\n 37453: 27197,\n 37454: 35504,\n 37455: 20025,\n 37456: 21336,\n 37457: 22022,\n 37458: 22374,\n 37459: 25285,\n 37460: 25506,\n 37461: 26086,\n 37462: 27470,\n 37463: 28129,\n 37464: 28251,\n 37465: 28845,\n 37466: 30701,\n 37467: 31471,\n 37468: 31658,\n 37469: 32187,\n 37470: 32829,\n 37471: 32966,\n 37472: 34507,\n 37473: 35477,\n 37474: 37723,\n 37475: 22243,\n 37476: 22727,\n 37477: 24382,\n 37478: 26029,\n 37479: 26262,\n 37480: 27264,\n 37481: 27573,\n 37482: 30007,\n 37483: 35527,\n 37484: 20516,\n 37485: 30693,\n 37486: 22320,\n 37487: 24347,\n 37488: 24677,\n 37489: 26234,\n 37490: 27744,\n 37491: 30196,\n 37492: 31258,\n 37493: 32622,\n 37494: 33268,\n 37495: 34584,\n 37496: 36933,\n 37497: 39347,\n 37498: 31689,\n 37499: 30044,\n 37500: 31481,\n 37501: 31569,\n 37502: 33988,\n 37504: 36880,\n 37505: 31209,\n 37506: 31378,\n 37507: 33590,\n 37508: 23265,\n 37509: 30528,\n 37510: 20013,\n 37511: 20210,\n 37512: 23449,\n 37513: 24544,\n 37514: 25277,\n 37515: 26172,\n 37516: 26609,\n 37517: 27880,\n 37518: 34411,\n 37519: 34935,\n 37520: 35387,\n 37521: 37198,\n 37522: 37619,\n 37523: 39376,\n 37524: 27159,\n 37525: 28710,\n 37526: 29482,\n 37527: 33511,\n 37528: 33879,\n 37529: 36015,\n 37530: 19969,\n 37531: 20806,\n 37532: 20939,\n 37533: 21899,\n 37534: 23541,\n 37535: 24086,\n 37536: 24115,\n 37537: 24193,\n 37538: 24340,\n 37539: 24373,\n 37540: 24427,\n 37541: 24500,\n 37542: 25074,\n 37543: 25361,\n 37544: 26274,\n 37545: 26397,\n 37546: 28526,\n 37547: 29266,\n 37548: 30010,\n 37549: 30522,\n 37550: 32884,\n 37551: 33081,\n 37552: 33144,\n 37553: 34678,\n 37554: 35519,\n 37555: 35548,\n 37556: 36229,\n 37557: 36339,\n 37558: 37530,\n 37559: 38263,\n 37560: 38914,\n 37561: 40165,\n 37562: 21189,\n 37563: 25431,\n 37564: 30452,\n 37565: 26389,\n 37566: 27784,\n 37567: 29645,\n 37568: 36035,\n 37569: 37806,\n 37570: 38515,\n 37571: 27941,\n 37572: 22684,\n 37573: 26894,\n 37574: 27084,\n 37575: 36861,\n 37576: 37786,\n 37577: 30171,\n 37578: 36890,\n 37579: 22618,\n 37580: 26626,\n 37581: 25524,\n 37582: 27131,\n 37583: 20291,\n 37584: 28460,\n 37585: 26584,\n 37586: 36795,\n 37587: 34086,\n 37588: 32180,\n 37589: 37716,\n 37590: 26943,\n 37591: 28528,\n 37592: 22378,\n 37593: 22775,\n 37594: 23340,\n 37595: 32044,\n 37596: 29226,\n 37597: 21514,\n 37598: 37347,\n 37599: 40372,\n 37600: 20141,\n 37601: 20302,\n 37602: 20572,\n 37603: 20597,\n 37604: 21059,\n 37605: 35998,\n 37606: 21576,\n 37607: 22564,\n 37608: 23450,\n 37609: 24093,\n 37610: 24213,\n 37611: 24237,\n 37612: 24311,\n 37613: 24351,\n 37614: 24716,\n 37615: 25269,\n 37616: 25402,\n 37617: 25552,\n 37618: 26799,\n 37619: 27712,\n 37620: 30855,\n 37621: 31118,\n 37622: 31243,\n 37623: 32224,\n 37624: 33351,\n 37625: 35330,\n 37626: 35558,\n 37627: 36420,\n 37628: 36883,\n 37696: 37048,\n 37697: 37165,\n 37698: 37336,\n 37699: 40718,\n 37700: 27877,\n 37701: 25688,\n 37702: 25826,\n 37703: 25973,\n 37704: 28404,\n 37705: 30340,\n 37706: 31515,\n 37707: 36969,\n 37708: 37841,\n 37709: 28346,\n 37710: 21746,\n 37711: 24505,\n 37712: 25764,\n 37713: 36685,\n 37714: 36845,\n 37715: 37444,\n 37716: 20856,\n 37717: 22635,\n 37718: 22825,\n 37719: 23637,\n 37720: 24215,\n 37721: 28155,\n 37722: 32399,\n 37723: 29980,\n 37724: 36028,\n 37725: 36578,\n 37726: 39003,\n 37727: 28857,\n 37728: 20253,\n 37729: 27583,\n 37730: 28593,\n 37731: 30000,\n 37732: 38651,\n 37733: 20814,\n 37734: 21520,\n 37735: 22581,\n 37736: 22615,\n 37737: 22956,\n 37738: 23648,\n 37739: 24466,\n 37740: 26007,\n 37741: 26460,\n 37742: 28193,\n 37743: 30331,\n 37744: 33759,\n 37745: 36077,\n 37746: 36884,\n 37747: 37117,\n 37748: 37709,\n 37749: 30757,\n 37750: 30778,\n 37751: 21162,\n 37752: 24230,\n 37753: 22303,\n 37754: 22900,\n 37755: 24594,\n 37756: 20498,\n 37757: 20826,\n 37758: 20908,\n 37760: 20941,\n 37761: 20992,\n 37762: 21776,\n 37763: 22612,\n 37764: 22616,\n 37765: 22871,\n 37766: 23445,\n 37767: 23798,\n 37768: 23947,\n 37769: 24764,\n 37770: 25237,\n 37771: 25645,\n 37772: 26481,\n 37773: 26691,\n 37774: 26812,\n 37775: 26847,\n 37776: 30423,\n 37777: 28120,\n 37778: 28271,\n 37779: 28059,\n 37780: 28783,\n 37781: 29128,\n 37782: 24403,\n 37783: 30168,\n 37784: 31095,\n 37785: 31561,\n 37786: 31572,\n 37787: 31570,\n 37788: 31958,\n 37789: 32113,\n 37790: 21040,\n 37791: 33891,\n 37792: 34153,\n 37793: 34276,\n 37794: 35342,\n 37795: 35588,\n 37796: 35910,\n 37797: 36367,\n 37798: 36867,\n 37799: 36879,\n 37800: 37913,\n 37801: 38518,\n 37802: 38957,\n 37803: 39472,\n 37804: 38360,\n 37805: 20685,\n 37806: 21205,\n 37807: 21516,\n 37808: 22530,\n 37809: 23566,\n 37810: 24999,\n 37811: 25758,\n 37812: 27934,\n 37813: 30643,\n 37814: 31461,\n 37815: 33012,\n 37816: 33796,\n 37817: 36947,\n 37818: 37509,\n 37819: 23776,\n 37820: 40199,\n 37821: 21311,\n 37822: 24471,\n 37823: 24499,\n 37824: 28060,\n 37825: 29305,\n 37826: 30563,\n 37827: 31167,\n 37828: 31716,\n 37829: 27602,\n 37830: 29420,\n 37831: 35501,\n 37832: 26627,\n 37833: 27233,\n 37834: 20984,\n 37835: 31361,\n 37836: 26932,\n 37837: 23626,\n 37838: 40182,\n 37839: 33515,\n 37840: 23493,\n 37841: 37193,\n 37842: 28702,\n 37843: 22136,\n 37844: 23663,\n 37845: 24775,\n 37846: 25958,\n 37847: 27788,\n 37848: 35930,\n 37849: 36929,\n 37850: 38931,\n 37851: 21585,\n 37852: 26311,\n 37853: 37389,\n 37854: 22856,\n 37855: 37027,\n 37856: 20869,\n 37857: 20045,\n 37858: 20970,\n 37859: 34201,\n 37860: 35598,\n 37861: 28760,\n 37862: 25466,\n 37863: 37707,\n 37864: 26978,\n 37865: 39348,\n 37866: 32260,\n 37867: 30071,\n 37868: 21335,\n 37869: 26976,\n 37870: 36575,\n 37871: 38627,\n 37872: 27741,\n 37873: 20108,\n 37874: 23612,\n 37875: 24336,\n 37876: 36841,\n 37877: 21250,\n 37878: 36049,\n 37879: 32905,\n 37880: 34425,\n 37881: 24319,\n 37882: 26085,\n 37883: 20083,\n 37884: 20837,\n 37952: 22914,\n 37953: 23615,\n 37954: 38894,\n 37955: 20219,\n 37956: 22922,\n 37957: 24525,\n 37958: 35469,\n 37959: 28641,\n 37960: 31152,\n 37961: 31074,\n 37962: 23527,\n 37963: 33905,\n 37964: 29483,\n 37965: 29105,\n 37966: 24180,\n 37967: 24565,\n 37968: 25467,\n 37969: 25754,\n 37970: 29123,\n 37971: 31896,\n 37972: 20035,\n 37973: 24316,\n 37974: 20043,\n 37975: 22492,\n 37976: 22178,\n 37977: 24745,\n 37978: 28611,\n 37979: 32013,\n 37980: 33021,\n 37981: 33075,\n 37982: 33215,\n 37983: 36786,\n 37984: 35223,\n 37985: 34468,\n 37986: 24052,\n 37987: 25226,\n 37988: 25773,\n 37989: 35207,\n 37990: 26487,\n 37991: 27874,\n 37992: 27966,\n 37993: 29750,\n 37994: 30772,\n 37995: 23110,\n 37996: 32629,\n 37997: 33453,\n 37998: 39340,\n 37999: 20467,\n 38000: 24259,\n 38001: 25309,\n 38002: 25490,\n 38003: 25943,\n 38004: 26479,\n 38005: 30403,\n 38006: 29260,\n 38007: 32972,\n 38008: 32954,\n 38009: 36649,\n 38010: 37197,\n 38011: 20493,\n 38012: 22521,\n 38013: 23186,\n 38014: 26757,\n 38016: 26995,\n 38017: 29028,\n 38018: 29437,\n 38019: 36023,\n 38020: 22770,\n 38021: 36064,\n 38022: 38506,\n 38023: 36889,\n 38024: 34687,\n 38025: 31204,\n 38026: 30695,\n 38027: 33833,\n 38028: 20271,\n 38029: 21093,\n 38030: 21338,\n 38031: 25293,\n 38032: 26575,\n 38033: 27850,\n 38034: 30333,\n 38035: 31636,\n 38036: 31893,\n 38037: 33334,\n 38038: 34180,\n 38039: 36843,\n 38040: 26333,\n 38041: 28448,\n 38042: 29190,\n 38043: 32283,\n 38044: 33707,\n 38045: 39361,\n 38046: 40614,\n 38047: 20989,\n 38048: 31665,\n 38049: 30834,\n 38050: 31672,\n 38051: 32903,\n 38052: 31560,\n 38053: 27368,\n 38054: 24161,\n 38055: 32908,\n 38056: 30033,\n 38057: 30048,\n 38058: 20843,\n 38059: 37474,\n 38060: 28300,\n 38061: 30330,\n 38062: 37271,\n 38063: 39658,\n 38064: 20240,\n 38065: 32624,\n 38066: 25244,\n 38067: 31567,\n 38068: 38309,\n 38069: 40169,\n 38070: 22138,\n 38071: 22617,\n 38072: 34532,\n 38073: 38588,\n 38074: 20276,\n 38075: 21028,\n 38076: 21322,\n 38077: 21453,\n 38078: 21467,\n 38079: 24070,\n 38080: 25644,\n 38081: 26001,\n 38082: 26495,\n 38083: 27710,\n 38084: 27726,\n 38085: 29256,\n 38086: 29359,\n 38087: 29677,\n 38088: 30036,\n 38089: 32321,\n 38090: 33324,\n 38091: 34281,\n 38092: 36009,\n 38093: 31684,\n 38094: 37318,\n 38095: 29033,\n 38096: 38930,\n 38097: 39151,\n 38098: 25405,\n 38099: 26217,\n 38100: 30058,\n 38101: 30436,\n 38102: 30928,\n 38103: 34115,\n 38104: 34542,\n 38105: 21290,\n 38106: 21329,\n 38107: 21542,\n 38108: 22915,\n 38109: 24199,\n 38110: 24444,\n 38111: 24754,\n 38112: 25161,\n 38113: 25209,\n 38114: 25259,\n 38115: 26000,\n 38116: 27604,\n 38117: 27852,\n 38118: 30130,\n 38119: 30382,\n 38120: 30865,\n 38121: 31192,\n 38122: 32203,\n 38123: 32631,\n 38124: 32933,\n 38125: 34987,\n 38126: 35513,\n 38127: 36027,\n 38128: 36991,\n 38129: 38750,\n 38130: 39131,\n 38131: 27147,\n 38132: 31800,\n 38133: 20633,\n 38134: 23614,\n 38135: 24494,\n 38136: 26503,\n 38137: 27608,\n 38138: 29749,\n 38139: 30473,\n 38140: 32654,\n 38208: 40763,\n 38209: 26570,\n 38210: 31255,\n 38211: 21305,\n 38212: 30091,\n 38213: 39661,\n 38214: 24422,\n 38215: 33181,\n 38216: 33777,\n 38217: 32920,\n 38218: 24380,\n 38219: 24517,\n 38220: 30050,\n 38221: 31558,\n 38222: 36924,\n 38223: 26727,\n 38224: 23019,\n 38225: 23195,\n 38226: 32016,\n 38227: 30334,\n 38228: 35628,\n 38229: 20469,\n 38230: 24426,\n 38231: 27161,\n 38232: 27703,\n 38233: 28418,\n 38234: 29922,\n 38235: 31080,\n 38236: 34920,\n 38237: 35413,\n 38238: 35961,\n 38239: 24287,\n 38240: 25551,\n 38241: 30149,\n 38242: 31186,\n 38243: 33495,\n 38244: 37672,\n 38245: 37618,\n 38246: 33948,\n 38247: 34541,\n 38248: 39981,\n 38249: 21697,\n 38250: 24428,\n 38251: 25996,\n 38252: 27996,\n 38253: 28693,\n 38254: 36007,\n 38255: 36051,\n 38256: 38971,\n 38257: 25935,\n 38258: 29942,\n 38259: 19981,\n 38260: 20184,\n 38261: 22496,\n 38262: 22827,\n 38263: 23142,\n 38264: 23500,\n 38265: 20904,\n 38266: 24067,\n 38267: 24220,\n 38268: 24598,\n 38269: 25206,\n 38270: 25975,\n 38272: 26023,\n 38273: 26222,\n 38274: 28014,\n 38275: 29238,\n 38276: 31526,\n 38277: 33104,\n 38278: 33178,\n 38279: 33433,\n 38280: 35676,\n 38281: 36000,\n 38282: 36070,\n 38283: 36212,\n 38284: 38428,\n 38285: 38468,\n 38286: 20398,\n 38287: 25771,\n 38288: 27494,\n 38289: 33310,\n 38290: 33889,\n 38291: 34154,\n 38292: 37096,\n 38293: 23553,\n 38294: 26963,\n 38295: 39080,\n 38296: 33914,\n 38297: 34135,\n 38298: 20239,\n 38299: 21103,\n 38300: 24489,\n 38301: 24133,\n 38302: 26381,\n 38303: 31119,\n 38304: 33145,\n 38305: 35079,\n 38306: 35206,\n 38307: 28149,\n 38308: 24343,\n 38309: 25173,\n 38310: 27832,\n 38311: 20175,\n 38312: 29289,\n 38313: 39826,\n 38314: 20998,\n 38315: 21563,\n 38316: 22132,\n 38317: 22707,\n 38318: 24996,\n 38319: 25198,\n 38320: 28954,\n 38321: 22894,\n 38322: 31881,\n 38323: 31966,\n 38324: 32027,\n 38325: 38640,\n 38326: 25991,\n 38327: 32862,\n 38328: 19993,\n 38329: 20341,\n 38330: 20853,\n 38331: 22592,\n 38332: 24163,\n 38333: 24179,\n 38334: 24330,\n 38335: 26564,\n 38336: 20006,\n 38337: 34109,\n 38338: 38281,\n 38339: 38491,\n 38340: 31859,\n 38341: 38913,\n 38342: 20731,\n 38343: 22721,\n 38344: 30294,\n 38345: 30887,\n 38346: 21029,\n 38347: 30629,\n 38348: 34065,\n 38349: 31622,\n 38350: 20559,\n 38351: 22793,\n 38352: 29255,\n 38353: 31687,\n 38354: 32232,\n 38355: 36794,\n 38356: 36820,\n 38357: 36941,\n 38358: 20415,\n 38359: 21193,\n 38360: 23081,\n 38361: 24321,\n 38362: 38829,\n 38363: 20445,\n 38364: 33303,\n 38365: 37610,\n 38366: 22275,\n 38367: 25429,\n 38368: 27497,\n 38369: 29995,\n 38370: 35036,\n 38371: 36628,\n 38372: 31298,\n 38373: 21215,\n 38374: 22675,\n 38375: 24917,\n 38376: 25098,\n 38377: 26286,\n 38378: 27597,\n 38379: 31807,\n 38380: 33769,\n 38381: 20515,\n 38382: 20472,\n 38383: 21253,\n 38384: 21574,\n 38385: 22577,\n 38386: 22857,\n 38387: 23453,\n 38388: 23792,\n 38389: 23791,\n 38390: 23849,\n 38391: 24214,\n 38392: 25265,\n 38393: 25447,\n 38394: 25918,\n 38395: 26041,\n 38396: 26379,\n 38464: 27861,\n 38465: 27873,\n 38466: 28921,\n 38467: 30770,\n 38468: 32299,\n 38469: 32990,\n 38470: 33459,\n 38471: 33804,\n 38472: 34028,\n 38473: 34562,\n 38474: 35090,\n 38475: 35370,\n 38476: 35914,\n 38477: 37030,\n 38478: 37586,\n 38479: 39165,\n 38480: 40179,\n 38481: 40300,\n 38482: 20047,\n 38483: 20129,\n 38484: 20621,\n 38485: 21078,\n 38486: 22346,\n 38487: 22952,\n 38488: 24125,\n 38489: 24536,\n 38490: 24537,\n 38491: 25151,\n 38492: 26292,\n 38493: 26395,\n 38494: 26576,\n 38495: 26834,\n 38496: 20882,\n 38497: 32033,\n 38498: 32938,\n 38499: 33192,\n 38500: 35584,\n 38501: 35980,\n 38502: 36031,\n 38503: 37502,\n 38504: 38450,\n 38505: 21536,\n 38506: 38956,\n 38507: 21271,\n 38508: 20693,\n 38509: 21340,\n 38510: 22696,\n 38511: 25778,\n 38512: 26420,\n 38513: 29287,\n 38514: 30566,\n 38515: 31302,\n 38516: 37350,\n 38517: 21187,\n 38518: 27809,\n 38519: 27526,\n 38520: 22528,\n 38521: 24140,\n 38522: 22868,\n 38523: 26412,\n 38524: 32763,\n 38525: 20961,\n 38526: 30406,\n 38528: 25705,\n 38529: 30952,\n 38530: 39764,\n 38531: 40635,\n 38532: 22475,\n 38533: 22969,\n 38534: 26151,\n 38535: 26522,\n 38536: 27598,\n 38537: 21737,\n 38538: 27097,\n 38539: 24149,\n 38540: 33180,\n 38541: 26517,\n 38542: 39850,\n 38543: 26622,\n 38544: 40018,\n 38545: 26717,\n 38546: 20134,\n 38547: 20451,\n 38548: 21448,\n 38549: 25273,\n 38550: 26411,\n 38551: 27819,\n 38552: 36804,\n 38553: 20397,\n 38554: 32365,\n 38555: 40639,\n 38556: 19975,\n 38557: 24930,\n 38558: 28288,\n 38559: 28459,\n 38560: 34067,\n 38561: 21619,\n 38562: 26410,\n 38563: 39749,\n 38564: 24051,\n 38565: 31637,\n 38566: 23724,\n 38567: 23494,\n 38568: 34588,\n 38569: 28234,\n 38570: 34001,\n 38571: 31252,\n 38572: 33032,\n 38573: 22937,\n 38574: 31885,\n 38575: 27665,\n 38576: 30496,\n 38577: 21209,\n 38578: 22818,\n 38579: 28961,\n 38580: 29279,\n 38581: 30683,\n 38582: 38695,\n 38583: 40289,\n 38584: 26891,\n 38585: 23167,\n 38586: 23064,\n 38587: 20901,\n 38588: 21517,\n 38589: 21629,\n 38590: 26126,\n 38591: 30431,\n 38592: 36855,\n 38593: 37528,\n 38594: 40180,\n 38595: 23018,\n 38596: 29277,\n 38597: 28357,\n 38598: 20813,\n 38599: 26825,\n 38600: 32191,\n 38601: 32236,\n 38602: 38754,\n 38603: 40634,\n 38604: 25720,\n 38605: 27169,\n 38606: 33538,\n 38607: 22916,\n 38608: 23391,\n 38609: 27611,\n 38610: 29467,\n 38611: 30450,\n 38612: 32178,\n 38613: 32791,\n 38614: 33945,\n 38615: 20786,\n 38616: 26408,\n 38617: 40665,\n 38618: 30446,\n 38619: 26466,\n 38620: 21247,\n 38621: 39173,\n 38622: 23588,\n 38623: 25147,\n 38624: 31870,\n 38625: 36016,\n 38626: 21839,\n 38627: 24758,\n 38628: 32011,\n 38629: 38272,\n 38630: 21249,\n 38631: 20063,\n 38632: 20918,\n 38633: 22812,\n 38634: 29242,\n 38635: 32822,\n 38636: 37326,\n 38637: 24357,\n 38638: 30690,\n 38639: 21380,\n 38640: 24441,\n 38641: 32004,\n 38642: 34220,\n 38643: 35379,\n 38644: 36493,\n 38645: 38742,\n 38646: 26611,\n 38647: 34222,\n 38648: 37971,\n 38649: 24841,\n 38650: 24840,\n 38651: 27833,\n 38652: 30290,\n 38720: 35565,\n 38721: 36664,\n 38722: 21807,\n 38723: 20305,\n 38724: 20778,\n 38725: 21191,\n 38726: 21451,\n 38727: 23461,\n 38728: 24189,\n 38729: 24736,\n 38730: 24962,\n 38731: 25558,\n 38732: 26377,\n 38733: 26586,\n 38734: 28263,\n 38735: 28044,\n 38736: 29494,\n 38737: 29495,\n 38738: 30001,\n 38739: 31056,\n 38740: 35029,\n 38741: 35480,\n 38742: 36938,\n 38743: 37009,\n 38744: 37109,\n 38745: 38596,\n 38746: 34701,\n 38747: 22805,\n 38748: 20104,\n 38749: 20313,\n 38750: 19982,\n 38751: 35465,\n 38752: 36671,\n 38753: 38928,\n 38754: 20653,\n 38755: 24188,\n 38756: 22934,\n 38757: 23481,\n 38758: 24248,\n 38759: 25562,\n 38760: 25594,\n 38761: 25793,\n 38762: 26332,\n 38763: 26954,\n 38764: 27096,\n 38765: 27915,\n 38766: 28342,\n 38767: 29076,\n 38768: 29992,\n 38769: 31407,\n 38770: 32650,\n 38771: 32768,\n 38772: 33865,\n 38773: 33993,\n 38774: 35201,\n 38775: 35617,\n 38776: 36362,\n 38777: 36965,\n 38778: 38525,\n 38779: 39178,\n 38780: 24958,\n 38781: 25233,\n 38782: 27442,\n 38784: 27779,\n 38785: 28020,\n 38786: 32716,\n 38787: 32764,\n 38788: 28096,\n 38789: 32645,\n 38790: 34746,\n 38791: 35064,\n 38792: 26469,\n 38793: 33713,\n 38794: 38972,\n 38795: 38647,\n 38796: 27931,\n 38797: 32097,\n 38798: 33853,\n 38799: 37226,\n 38800: 20081,\n 38801: 21365,\n 38802: 23888,\n 38803: 27396,\n 38804: 28651,\n 38805: 34253,\n 38806: 34349,\n 38807: 35239,\n 38808: 21033,\n 38809: 21519,\n 38810: 23653,\n 38811: 26446,\n 38812: 26792,\n 38813: 29702,\n 38814: 29827,\n 38815: 30178,\n 38816: 35023,\n 38817: 35041,\n 38818: 37324,\n 38819: 38626,\n 38820: 38520,\n 38821: 24459,\n 38822: 29575,\n 38823: 31435,\n 38824: 33870,\n 38825: 25504,\n 38826: 30053,\n 38827: 21129,\n 38828: 27969,\n 38829: 28316,\n 38830: 29705,\n 38831: 30041,\n 38832: 30827,\n 38833: 31890,\n 38834: 38534,\n 38835: 31452,\n 38836: 40845,\n 38837: 20406,\n 38838: 24942,\n 38839: 26053,\n 38840: 34396,\n 38841: 20102,\n 38842: 20142,\n 38843: 20698,\n 38844: 20001,\n 38845: 20940,\n 38846: 23534,\n 38847: 26009,\n 38848: 26753,\n 38849: 28092,\n 38850: 29471,\n 38851: 30274,\n 38852: 30637,\n 38853: 31260,\n 38854: 31975,\n 38855: 33391,\n 38856: 35538,\n 38857: 36988,\n 38858: 37327,\n 38859: 38517,\n 38860: 38936,\n 38861: 21147,\n 38862: 32209,\n 38863: 20523,\n 38864: 21400,\n 38865: 26519,\n 38866: 28107,\n 38867: 29136,\n 38868: 29747,\n 38869: 33256,\n 38870: 36650,\n 38871: 38563,\n 38872: 40023,\n 38873: 40607,\n 38874: 29792,\n 38875: 22593,\n 38876: 28057,\n 38877: 32047,\n 38878: 39006,\n 38879: 20196,\n 38880: 20278,\n 38881: 20363,\n 38882: 20919,\n 38883: 21169,\n 38884: 23994,\n 38885: 24604,\n 38886: 29618,\n 38887: 31036,\n 38888: 33491,\n 38889: 37428,\n 38890: 38583,\n 38891: 38646,\n 38892: 38666,\n 38893: 40599,\n 38894: 40802,\n 38895: 26278,\n 38896: 27508,\n 38897: 21015,\n 38898: 21155,\n 38899: 28872,\n 38900: 35010,\n 38901: 24265,\n 38902: 24651,\n 38903: 24976,\n 38904: 28451,\n 38905: 29001,\n 38906: 31806,\n 38907: 32244,\n 38908: 32879,\n 38976: 34030,\n 38977: 36899,\n 38978: 37676,\n 38979: 21570,\n 38980: 39791,\n 38981: 27347,\n 38982: 28809,\n 38983: 36034,\n 38984: 36335,\n 38985: 38706,\n 38986: 21172,\n 38987: 23105,\n 38988: 24266,\n 38989: 24324,\n 38990: 26391,\n 38991: 27004,\n 38992: 27028,\n 38993: 28010,\n 38994: 28431,\n 38995: 29282,\n 38996: 29436,\n 38997: 31725,\n 38998: 32769,\n 38999: 32894,\n 39000: 34635,\n 39001: 37070,\n 39002: 20845,\n 39003: 40595,\n 39004: 31108,\n 39005: 32907,\n 39006: 37682,\n 39007: 35542,\n 39008: 20525,\n 39009: 21644,\n 39010: 35441,\n 39011: 27498,\n 39012: 36036,\n 39013: 33031,\n 39014: 24785,\n 39015: 26528,\n 39016: 40434,\n 39017: 20121,\n 39018: 20120,\n 39019: 39952,\n 39020: 35435,\n 39021: 34241,\n 39022: 34152,\n 39023: 26880,\n 39024: 28286,\n 39025: 30871,\n 39026: 33109,\n 39071: 24332,\n 39072: 19984,\n 39073: 19989,\n 39074: 20010,\n 39075: 20017,\n 39076: 20022,\n 39077: 20028,\n 39078: 20031,\n 39079: 20034,\n 39080: 20054,\n 39081: 20056,\n 39082: 20098,\n 39083: 20101,\n 39084: 35947,\n 39085: 20106,\n 39086: 33298,\n 39087: 24333,\n 39088: 20110,\n 39089: 20126,\n 39090: 20127,\n 39091: 20128,\n 39092: 20130,\n 39093: 20144,\n 39094: 20147,\n 39095: 20150,\n 39096: 20174,\n 39097: 20173,\n 39098: 20164,\n 39099: 20166,\n 39100: 20162,\n 39101: 20183,\n 39102: 20190,\n 39103: 20205,\n 39104: 20191,\n 39105: 20215,\n 39106: 20233,\n 39107: 20314,\n 39108: 20272,\n 39109: 20315,\n 39110: 20317,\n 39111: 20311,\n 39112: 20295,\n 39113: 20342,\n 39114: 20360,\n 39115: 20367,\n 39116: 20376,\n 39117: 20347,\n 39118: 20329,\n 39119: 20336,\n 39120: 20369,\n 39121: 20335,\n 39122: 20358,\n 39123: 20374,\n 39124: 20760,\n 39125: 20436,\n 39126: 20447,\n 39127: 20430,\n 39128: 20440,\n 39129: 20443,\n 39130: 20433,\n 39131: 20442,\n 39132: 20432,\n 39133: 20452,\n 39134: 20453,\n 39135: 20506,\n 39136: 20520,\n 39137: 20500,\n 39138: 20522,\n 39139: 20517,\n 39140: 20485,\n 39141: 20252,\n 39142: 20470,\n 39143: 20513,\n 39144: 20521,\n 39145: 20524,\n 39146: 20478,\n 39147: 20463,\n 39148: 20497,\n 39149: 20486,\n 39150: 20547,\n 39151: 20551,\n 39152: 26371,\n 39153: 20565,\n 39154: 20560,\n 39155: 20552,\n 39156: 20570,\n 39157: 20566,\n 39158: 20588,\n 39159: 20600,\n 39160: 20608,\n 39161: 20634,\n 39162: 20613,\n 39163: 20660,\n 39164: 20658,\n 39232: 20681,\n 39233: 20682,\n 39234: 20659,\n 39235: 20674,\n 39236: 20694,\n 39237: 20702,\n 39238: 20709,\n 39239: 20717,\n 39240: 20707,\n 39241: 20718,\n 39242: 20729,\n 39243: 20725,\n 39244: 20745,\n 39245: 20737,\n 39246: 20738,\n 39247: 20758,\n 39248: 20757,\n 39249: 20756,\n 39250: 20762,\n 39251: 20769,\n 39252: 20794,\n 39253: 20791,\n 39254: 20796,\n 39255: 20795,\n 39256: 20799,\n 39257: 20800,\n 39258: 20818,\n 39259: 20812,\n 39260: 20820,\n 39261: 20834,\n 39262: 31480,\n 39263: 20841,\n 39264: 20842,\n 39265: 20846,\n 39266: 20864,\n 39267: 20866,\n 39268: 22232,\n 39269: 20876,\n 39270: 20873,\n 39271: 20879,\n 39272: 20881,\n 39273: 20883,\n 39274: 20885,\n 39275: 20886,\n 39276: 20900,\n 39277: 20902,\n 39278: 20898,\n 39279: 20905,\n 39280: 20906,\n 39281: 20907,\n 39282: 20915,\n 39283: 20913,\n 39284: 20914,\n 39285: 20912,\n 39286: 20917,\n 39287: 20925,\n 39288: 20933,\n 39289: 20937,\n 39290: 20955,\n 39291: 20960,\n 39292: 34389,\n 39293: 20969,\n 39294: 20973,\n 39296: 20976,\n 39297: 20981,\n 39298: 20990,\n 39299: 20996,\n 39300: 21003,\n 39301: 21012,\n 39302: 21006,\n 39303: 21031,\n 39304: 21034,\n 39305: 21038,\n 39306: 21043,\n 39307: 21049,\n 39308: 21071,\n 39309: 21060,\n 39310: 21067,\n 39311: 21068,\n 39312: 21086,\n 39313: 21076,\n 39314: 21098,\n 39315: 21108,\n 39316: 21097,\n 39317: 21107,\n 39318: 21119,\n 39319: 21117,\n 39320: 21133,\n 39321: 21140,\n 39322: 21138,\n 39323: 21105,\n 39324: 21128,\n 39325: 21137,\n 39326: 36776,\n 39327: 36775,\n 39328: 21164,\n 39329: 21165,\n 39330: 21180,\n 39331: 21173,\n 39332: 21185,\n 39333: 21197,\n 39334: 21207,\n 39335: 21214,\n 39336: 21219,\n 39337: 21222,\n 39338: 39149,\n 39339: 21216,\n 39340: 21235,\n 39341: 21237,\n 39342: 21240,\n 39343: 21241,\n 39344: 21254,\n 39345: 21256,\n 39346: 30008,\n 39347: 21261,\n 39348: 21264,\n 39349: 21263,\n 39350: 21269,\n 39351: 21274,\n 39352: 21283,\n 39353: 21295,\n 39354: 21297,\n 39355: 21299,\n 39356: 21304,\n 39357: 21312,\n 39358: 21318,\n 39359: 21317,\n 39360: 19991,\n 39361: 21321,\n 39362: 21325,\n 39363: 20950,\n 39364: 21342,\n 39365: 21353,\n 39366: 21358,\n 39367: 22808,\n 39368: 21371,\n 39369: 21367,\n 39370: 21378,\n 39371: 21398,\n 39372: 21408,\n 39373: 21414,\n 39374: 21413,\n 39375: 21422,\n 39376: 21424,\n 39377: 21430,\n 39378: 21443,\n 39379: 31762,\n 39380: 38617,\n 39381: 21471,\n 39382: 26364,\n 39383: 29166,\n 39384: 21486,\n 39385: 21480,\n 39386: 21485,\n 39387: 21498,\n 39388: 21505,\n 39389: 21565,\n 39390: 21568,\n 39391: 21548,\n 39392: 21549,\n 39393: 21564,\n 39394: 21550,\n 39395: 21558,\n 39396: 21545,\n 39397: 21533,\n 39398: 21582,\n 39399: 21647,\n 39400: 21621,\n 39401: 21646,\n 39402: 21599,\n 39403: 21617,\n 39404: 21623,\n 39405: 21616,\n 39406: 21650,\n 39407: 21627,\n 39408: 21632,\n 39409: 21622,\n 39410: 21636,\n 39411: 21648,\n 39412: 21638,\n 39413: 21703,\n 39414: 21666,\n 39415: 21688,\n 39416: 21669,\n 39417: 21676,\n 39418: 21700,\n 39419: 21704,\n 39420: 21672,\n 39488: 21675,\n 39489: 21698,\n 39490: 21668,\n 39491: 21694,\n 39492: 21692,\n 39493: 21720,\n 39494: 21733,\n 39495: 21734,\n 39496: 21775,\n 39497: 21780,\n 39498: 21757,\n 39499: 21742,\n 39500: 21741,\n 39501: 21754,\n 39502: 21730,\n 39503: 21817,\n 39504: 21824,\n 39505: 21859,\n 39506: 21836,\n 39507: 21806,\n 39508: 21852,\n 39509: 21829,\n 39510: 21846,\n 39511: 21847,\n 39512: 21816,\n 39513: 21811,\n 39514: 21853,\n 39515: 21913,\n 39516: 21888,\n 39517: 21679,\n 39518: 21898,\n 39519: 21919,\n 39520: 21883,\n 39521: 21886,\n 39522: 21912,\n 39523: 21918,\n 39524: 21934,\n 39525: 21884,\n 39526: 21891,\n 39527: 21929,\n 39528: 21895,\n 39529: 21928,\n 39530: 21978,\n 39531: 21957,\n 39532: 21983,\n 39533: 21956,\n 39534: 21980,\n 39535: 21988,\n 39536: 21972,\n 39537: 22036,\n 39538: 22007,\n 39539: 22038,\n 39540: 22014,\n 39541: 22013,\n 39542: 22043,\n 39543: 22009,\n 39544: 22094,\n 39545: 22096,\n 39546: 29151,\n 39547: 22068,\n 39548: 22070,\n 39549: 22066,\n 39550: 22072,\n 39552: 22123,\n 39553: 22116,\n 39554: 22063,\n 39555: 22124,\n 39556: 22122,\n 39557: 22150,\n 39558: 22144,\n 39559: 22154,\n 39560: 22176,\n 39561: 22164,\n 39562: 22159,\n 39563: 22181,\n 39564: 22190,\n 39565: 22198,\n 39566: 22196,\n 39567: 22210,\n 39568: 22204,\n 39569: 22209,\n 39570: 22211,\n 39571: 22208,\n 39572: 22216,\n 39573: 22222,\n 39574: 22225,\n 39575: 22227,\n 39576: 22231,\n 39577: 22254,\n 39578: 22265,\n 39579: 22272,\n 39580: 22271,\n 39581: 22276,\n 39582: 22281,\n 39583: 22280,\n 39584: 22283,\n 39585: 22285,\n 39586: 22291,\n 39587: 22296,\n 39588: 22294,\n 39589: 21959,\n 39590: 22300,\n 39591: 22310,\n 39592: 22327,\n 39593: 22328,\n 39594: 22350,\n 39595: 22331,\n 39596: 22336,\n 39597: 22351,\n 39598: 22377,\n 39599: 22464,\n 39600: 22408,\n 39601: 22369,\n 39602: 22399,\n 39603: 22409,\n 39604: 22419,\n 39605: 22432,\n 39606: 22451,\n 39607: 22436,\n 39608: 22442,\n 39609: 22448,\n 39610: 22467,\n 39611: 22470,\n 39612: 22484,\n 39613: 22482,\n 39614: 22483,\n 39615: 22538,\n 39616: 22486,\n 39617: 22499,\n 39618: 22539,\n 39619: 22553,\n 39620: 22557,\n 39621: 22642,\n 39622: 22561,\n 39623: 22626,\n 39624: 22603,\n 39625: 22640,\n 39626: 27584,\n 39627: 22610,\n 39628: 22589,\n 39629: 22649,\n 39630: 22661,\n 39631: 22713,\n 39632: 22687,\n 39633: 22699,\n 39634: 22714,\n 39635: 22750,\n 39636: 22715,\n 39637: 22712,\n 39638: 22702,\n 39639: 22725,\n 39640: 22739,\n 39641: 22737,\n 39642: 22743,\n 39643: 22745,\n 39644: 22744,\n 39645: 22757,\n 39646: 22748,\n 39647: 22756,\n 39648: 22751,\n 39649: 22767,\n 39650: 22778,\n 39651: 22777,\n 39652: 22779,\n 39653: 22780,\n 39654: 22781,\n 39655: 22786,\n 39656: 22794,\n 39657: 22800,\n 39658: 22811,\n 39659: 26790,\n 39660: 22821,\n 39661: 22828,\n 39662: 22829,\n 39663: 22834,\n 39664: 22840,\n 39665: 22846,\n 39666: 31442,\n 39667: 22869,\n 39668: 22864,\n 39669: 22862,\n 39670: 22874,\n 39671: 22872,\n 39672: 22882,\n 39673: 22880,\n 39674: 22887,\n 39675: 22892,\n 39676: 22889,\n 39744: 22904,\n 39745: 22913,\n 39746: 22941,\n 39747: 20318,\n 39748: 20395,\n 39749: 22947,\n 39750: 22962,\n 39751: 22982,\n 39752: 23016,\n 39753: 23004,\n 39754: 22925,\n 39755: 23001,\n 39756: 23002,\n 39757: 23077,\n 39758: 23071,\n 39759: 23057,\n 39760: 23068,\n 39761: 23049,\n 39762: 23066,\n 39763: 23104,\n 39764: 23148,\n 39765: 23113,\n 39766: 23093,\n 39767: 23094,\n 39768: 23138,\n 39769: 23146,\n 39770: 23194,\n 39771: 23228,\n 39772: 23230,\n 39773: 23243,\n 39774: 23234,\n 39775: 23229,\n 39776: 23267,\n 39777: 23255,\n 39778: 23270,\n 39779: 23273,\n 39780: 23254,\n 39781: 23290,\n 39782: 23291,\n 39783: 23308,\n 39784: 23307,\n 39785: 23318,\n 39786: 23346,\n 39787: 23248,\n 39788: 23338,\n 39789: 23350,\n 39790: 23358,\n 39791: 23363,\n 39792: 23365,\n 39793: 23360,\n 39794: 23377,\n 39795: 23381,\n 39796: 23386,\n 39797: 23387,\n 39798: 23397,\n 39799: 23401,\n 39800: 23408,\n 39801: 23411,\n 39802: 23413,\n 39803: 23416,\n 39804: 25992,\n 39805: 23418,\n 39806: 23424,\n 39808: 23427,\n 39809: 23462,\n 39810: 23480,\n 39811: 23491,\n 39812: 23495,\n 39813: 23497,\n 39814: 23508,\n 39815: 23504,\n 39816: 23524,\n 39817: 23526,\n 39818: 23522,\n 39819: 23518,\n 39820: 23525,\n 39821: 23531,\n 39822: 23536,\n 39823: 23542,\n 39824: 23539,\n 39825: 23557,\n 39826: 23559,\n 39827: 23560,\n 39828: 23565,\n 39829: 23571,\n 39830: 23584,\n 39831: 23586,\n 39832: 23592,\n 39833: 23608,\n 39834: 23609,\n 39835: 23617,\n 39836: 23622,\n 39837: 23630,\n 39838: 23635,\n 39839: 23632,\n 39840: 23631,\n 39841: 23409,\n 39842: 23660,\n 39843: 23662,\n 39844: 20066,\n 39845: 23670,\n 39846: 23673,\n 39847: 23692,\n 39848: 23697,\n 39849: 23700,\n 39850: 22939,\n 39851: 23723,\n 39852: 23739,\n 39853: 23734,\n 39854: 23740,\n 39855: 23735,\n 39856: 23749,\n 39857: 23742,\n 39858: 23751,\n 39859: 23769,\n 39860: 23785,\n 39861: 23805,\n 39862: 23802,\n 39863: 23789,\n 39864: 23948,\n 39865: 23786,\n 39866: 23819,\n 39867: 23829,\n 39868: 23831,\n 39869: 23900,\n 39870: 23839,\n 39871: 23835,\n 39872: 23825,\n 39873: 23828,\n 39874: 23842,\n 39875: 23834,\n 39876: 23833,\n 39877: 23832,\n 39878: 23884,\n 39879: 23890,\n 39880: 23886,\n 39881: 23883,\n 39882: 23916,\n 39883: 23923,\n 39884: 23926,\n 39885: 23943,\n 39886: 23940,\n 39887: 23938,\n 39888: 23970,\n 39889: 23965,\n 39890: 23980,\n 39891: 23982,\n 39892: 23997,\n 39893: 23952,\n 39894: 23991,\n 39895: 23996,\n 39896: 24009,\n 39897: 24013,\n 39898: 24019,\n 39899: 24018,\n 39900: 24022,\n 39901: 24027,\n 39902: 24043,\n 39903: 24050,\n 39904: 24053,\n 39905: 24075,\n 39906: 24090,\n 39907: 24089,\n 39908: 24081,\n 39909: 24091,\n 39910: 24118,\n 39911: 24119,\n 39912: 24132,\n 39913: 24131,\n 39914: 24128,\n 39915: 24142,\n 39916: 24151,\n 39917: 24148,\n 39918: 24159,\n 39919: 24162,\n 39920: 24164,\n 39921: 24135,\n 39922: 24181,\n 39923: 24182,\n 39924: 24186,\n 39925: 40636,\n 39926: 24191,\n 39927: 24224,\n 39928: 24257,\n 39929: 24258,\n 39930: 24264,\n 39931: 24272,\n 39932: 24271,\n 40000: 24278,\n 40001: 24291,\n 40002: 24285,\n 40003: 24282,\n 40004: 24283,\n 40005: 24290,\n 40006: 24289,\n 40007: 24296,\n 40008: 24297,\n 40009: 24300,\n 40010: 24305,\n 40011: 24307,\n 40012: 24304,\n 40013: 24308,\n 40014: 24312,\n 40015: 24318,\n 40016: 24323,\n 40017: 24329,\n 40018: 24413,\n 40019: 24412,\n 40020: 24331,\n 40021: 24337,\n 40022: 24342,\n 40023: 24361,\n 40024: 24365,\n 40025: 24376,\n 40026: 24385,\n 40027: 24392,\n 40028: 24396,\n 40029: 24398,\n 40030: 24367,\n 40031: 24401,\n 40032: 24406,\n 40033: 24407,\n 40034: 24409,\n 40035: 24417,\n 40036: 24429,\n 40037: 24435,\n 40038: 24439,\n 40039: 24451,\n 40040: 24450,\n 40041: 24447,\n 40042: 24458,\n 40043: 24456,\n 40044: 24465,\n 40045: 24455,\n 40046: 24478,\n 40047: 24473,\n 40048: 24472,\n 40049: 24480,\n 40050: 24488,\n 40051: 24493,\n 40052: 24508,\n 40053: 24534,\n 40054: 24571,\n 40055: 24548,\n 40056: 24568,\n 40057: 24561,\n 40058: 24541,\n 40059: 24755,\n 40060: 24575,\n 40061: 24609,\n 40062: 24672,\n 40064: 24601,\n 40065: 24592,\n 40066: 24617,\n 40067: 24590,\n 40068: 24625,\n 40069: 24603,\n 40070: 24597,\n 40071: 24619,\n 40072: 24614,\n 40073: 24591,\n 40074: 24634,\n 40075: 24666,\n 40076: 24641,\n 40077: 24682,\n 40078: 24695,\n 40079: 24671,\n 40080: 24650,\n 40081: 24646,\n 40082: 24653,\n 40083: 24675,\n 40084: 24643,\n 40085: 24676,\n 40086: 24642,\n 40087: 24684,\n 40088: 24683,\n 40089: 24665,\n 40090: 24705,\n 40091: 24717,\n 40092: 24807,\n 40093: 24707,\n 40094: 24730,\n 40095: 24708,\n 40096: 24731,\n 40097: 24726,\n 40098: 24727,\n 40099: 24722,\n 40100: 24743,\n 40101: 24715,\n 40102: 24801,\n 40103: 24760,\n 40104: 24800,\n 40105: 24787,\n 40106: 24756,\n 40107: 24560,\n 40108: 24765,\n 40109: 24774,\n 40110: 24757,\n 40111: 24792,\n 40112: 24909,\n 40113: 24853,\n 40114: 24838,\n 40115: 24822,\n 40116: 24823,\n 40117: 24832,\n 40118: 24820,\n 40119: 24826,\n 40120: 24835,\n 40121: 24865,\n 40122: 24827,\n 40123: 24817,\n 40124: 24845,\n 40125: 24846,\n 40126: 24903,\n 40127: 24894,\n 40128: 24872,\n 40129: 24871,\n 40130: 24906,\n 40131: 24895,\n 40132: 24892,\n 40133: 24876,\n 40134: 24884,\n 40135: 24893,\n 40136: 24898,\n 40137: 24900,\n 40138: 24947,\n 40139: 24951,\n 40140: 24920,\n 40141: 24921,\n 40142: 24922,\n 40143: 24939,\n 40144: 24948,\n 40145: 24943,\n 40146: 24933,\n 40147: 24945,\n 40148: 24927,\n 40149: 24925,\n 40150: 24915,\n 40151: 24949,\n 40152: 24985,\n 40153: 24982,\n 40154: 24967,\n 40155: 25004,\n 40156: 24980,\n 40157: 24986,\n 40158: 24970,\n 40159: 24977,\n 40160: 25003,\n 40161: 25006,\n 40162: 25036,\n 40163: 25034,\n 40164: 25033,\n 40165: 25079,\n 40166: 25032,\n 40167: 25027,\n 40168: 25030,\n 40169: 25018,\n 40170: 25035,\n 40171: 32633,\n 40172: 25037,\n 40173: 25062,\n 40174: 25059,\n 40175: 25078,\n 40176: 25082,\n 40177: 25076,\n 40178: 25087,\n 40179: 25085,\n 40180: 25084,\n 40181: 25086,\n 40182: 25088,\n 40183: 25096,\n 40184: 25097,\n 40185: 25101,\n 40186: 25100,\n 40187: 25108,\n 40188: 25115,\n 40256: 25118,\n 40257: 25121,\n 40258: 25130,\n 40259: 25134,\n 40260: 25136,\n 40261: 25138,\n 40262: 25139,\n 40263: 25153,\n 40264: 25166,\n 40265: 25182,\n 40266: 25187,\n 40267: 25179,\n 40268: 25184,\n 40269: 25192,\n 40270: 25212,\n 40271: 25218,\n 40272: 25225,\n 40273: 25214,\n 40274: 25234,\n 40275: 25235,\n 40276: 25238,\n 40277: 25300,\n 40278: 25219,\n 40279: 25236,\n 40280: 25303,\n 40281: 25297,\n 40282: 25275,\n 40283: 25295,\n 40284: 25343,\n 40285: 25286,\n 40286: 25812,\n 40287: 25288,\n 40288: 25308,\n 40289: 25292,\n 40290: 25290,\n 40291: 25282,\n 40292: 25287,\n 40293: 25243,\n 40294: 25289,\n 40295: 25356,\n 40296: 25326,\n 40297: 25329,\n 40298: 25383,\n 40299: 25346,\n 40300: 25352,\n 40301: 25327,\n 40302: 25333,\n 40303: 25424,\n 40304: 25406,\n 40305: 25421,\n 40306: 25628,\n 40307: 25423,\n 40308: 25494,\n 40309: 25486,\n 40310: 25472,\n 40311: 25515,\n 40312: 25462,\n 40313: 25507,\n 40314: 25487,\n 40315: 25481,\n 40316: 25503,\n 40317: 25525,\n 40318: 25451,\n 40320: 25449,\n 40321: 25534,\n 40322: 25577,\n 40323: 25536,\n 40324: 25542,\n 40325: 25571,\n 40326: 25545,\n 40327: 25554,\n 40328: 25590,\n 40329: 25540,\n 40330: 25622,\n 40331: 25652,\n 40332: 25606,\n 40333: 25619,\n 40334: 25638,\n 40335: 25654,\n 40336: 25885,\n 40337: 25623,\n 40338: 25640,\n 40339: 25615,\n 40340: 25703,\n 40341: 25711,\n 40342: 25718,\n 40343: 25678,\n 40344: 25898,\n 40345: 25749,\n 40346: 25747,\n 40347: 25765,\n 40348: 25769,\n 40349: 25736,\n 40350: 25788,\n 40351: 25818,\n 40352: 25810,\n 40353: 25797,\n 40354: 25799,\n 40355: 25787,\n 40356: 25816,\n 40357: 25794,\n 40358: 25841,\n 40359: 25831,\n 40360: 33289,\n 40361: 25824,\n 40362: 25825,\n 40363: 25260,\n 40364: 25827,\n 40365: 25839,\n 40366: 25900,\n 40367: 25846,\n 40368: 25844,\n 40369: 25842,\n 40370: 25850,\n 40371: 25856,\n 40372: 25853,\n 40373: 25880,\n 40374: 25884,\n 40375: 25861,\n 40376: 25892,\n 40377: 25891,\n 40378: 25899,\n 40379: 25908,\n 40380: 25909,\n 40381: 25911,\n 40382: 25910,\n 40383: 25912,\n 40384: 30027,\n 40385: 25928,\n 40386: 25942,\n 40387: 25941,\n 40388: 25933,\n 40389: 25944,\n 40390: 25950,\n 40391: 25949,\n 40392: 25970,\n 40393: 25976,\n 40394: 25986,\n 40395: 25987,\n 40396: 35722,\n 40397: 26011,\n 40398: 26015,\n 40399: 26027,\n 40400: 26039,\n 40401: 26051,\n 40402: 26054,\n 40403: 26049,\n 40404: 26052,\n 40405: 26060,\n 40406: 26066,\n 40407: 26075,\n 40408: 26073,\n 40409: 26080,\n 40410: 26081,\n 40411: 26097,\n 40412: 26482,\n 40413: 26122,\n 40414: 26115,\n 40415: 26107,\n 40416: 26483,\n 40417: 26165,\n 40418: 26166,\n 40419: 26164,\n 40420: 26140,\n 40421: 26191,\n 40422: 26180,\n 40423: 26185,\n 40424: 26177,\n 40425: 26206,\n 40426: 26205,\n 40427: 26212,\n 40428: 26215,\n 40429: 26216,\n 40430: 26207,\n 40431: 26210,\n 40432: 26224,\n 40433: 26243,\n 40434: 26248,\n 40435: 26254,\n 40436: 26249,\n 40437: 26244,\n 40438: 26264,\n 40439: 26269,\n 40440: 26305,\n 40441: 26297,\n 40442: 26313,\n 40443: 26302,\n 40444: 26300,\n 40512: 26308,\n 40513: 26296,\n 40514: 26326,\n 40515: 26330,\n 40516: 26336,\n 40517: 26175,\n 40518: 26342,\n 40519: 26345,\n 40520: 26352,\n 40521: 26357,\n 40522: 26359,\n 40523: 26383,\n 40524: 26390,\n 40525: 26398,\n 40526: 26406,\n 40527: 26407,\n 40528: 38712,\n 40529: 26414,\n 40530: 26431,\n 40531: 26422,\n 40532: 26433,\n 40533: 26424,\n 40534: 26423,\n 40535: 26438,\n 40536: 26462,\n 40537: 26464,\n 40538: 26457,\n 40539: 26467,\n 40540: 26468,\n 40541: 26505,\n 40542: 26480,\n 40543: 26537,\n 40544: 26492,\n 40545: 26474,\n 40546: 26508,\n 40547: 26507,\n 40548: 26534,\n 40549: 26529,\n 40550: 26501,\n 40551: 26551,\n 40552: 26607,\n 40553: 26548,\n 40554: 26604,\n 40555: 26547,\n 40556: 26601,\n 40557: 26552,\n 40558: 26596,\n 40559: 26590,\n 40560: 26589,\n 40561: 26594,\n 40562: 26606,\n 40563: 26553,\n 40564: 26574,\n 40565: 26566,\n 40566: 26599,\n 40567: 27292,\n 40568: 26654,\n 40569: 26694,\n 40570: 26665,\n 40571: 26688,\n 40572: 26701,\n 40573: 26674,\n 40574: 26702,\n 40576: 26803,\n 40577: 26667,\n 40578: 26713,\n 40579: 26723,\n 40580: 26743,\n 40581: 26751,\n 40582: 26783,\n 40583: 26767,\n 40584: 26797,\n 40585: 26772,\n 40586: 26781,\n 40587: 26779,\n 40588: 26755,\n 40589: 27310,\n 40590: 26809,\n 40591: 26740,\n 40592: 26805,\n 40593: 26784,\n 40594: 26810,\n 40595: 26895,\n 40596: 26765,\n 40597: 26750,\n 40598: 26881,\n 40599: 26826,\n 40600: 26888,\n 40601: 26840,\n 40602: 26914,\n 40603: 26918,\n 40604: 26849,\n 40605: 26892,\n 40606: 26829,\n 40607: 26836,\n 40608: 26855,\n 40609: 26837,\n 40610: 26934,\n 40611: 26898,\n 40612: 26884,\n 40613: 26839,\n 40614: 26851,\n 40615: 26917,\n 40616: 26873,\n 40617: 26848,\n 40618: 26863,\n 40619: 26920,\n 40620: 26922,\n 40621: 26906,\n 40622: 26915,\n 40623: 26913,\n 40624: 26822,\n 40625: 27001,\n 40626: 26999,\n 40627: 26972,\n 40628: 27000,\n 40629: 26987,\n 40630: 26964,\n 40631: 27006,\n 40632: 26990,\n 40633: 26937,\n 40634: 26996,\n 40635: 26941,\n 40636: 26969,\n 40637: 26928,\n 40638: 26977,\n 40639: 26974,\n 40640: 26973,\n 40641: 27009,\n 40642: 26986,\n 40643: 27058,\n 40644: 27054,\n 40645: 27088,\n 40646: 27071,\n 40647: 27073,\n 40648: 27091,\n 40649: 27070,\n 40650: 27086,\n 40651: 23528,\n 40652: 27082,\n 40653: 27101,\n 40654: 27067,\n 40655: 27075,\n 40656: 27047,\n 40657: 27182,\n 40658: 27025,\n 40659: 27040,\n 40660: 27036,\n 40661: 27029,\n 40662: 27060,\n 40663: 27102,\n 40664: 27112,\n 40665: 27138,\n 40666: 27163,\n 40667: 27135,\n 40668: 27402,\n 40669: 27129,\n 40670: 27122,\n 40671: 27111,\n 40672: 27141,\n 40673: 27057,\n 40674: 27166,\n 40675: 27117,\n 40676: 27156,\n 40677: 27115,\n 40678: 27146,\n 40679: 27154,\n 40680: 27329,\n 40681: 27171,\n 40682: 27155,\n 40683: 27204,\n 40684: 27148,\n 40685: 27250,\n 40686: 27190,\n 40687: 27256,\n 40688: 27207,\n 40689: 27234,\n 40690: 27225,\n 40691: 27238,\n 40692: 27208,\n 40693: 27192,\n 40694: 27170,\n 40695: 27280,\n 40696: 27277,\n 40697: 27296,\n 40698: 27268,\n 40699: 27298,\n 40700: 27299,\n 40768: 27287,\n 40769: 34327,\n 40770: 27323,\n 40771: 27331,\n 40772: 27330,\n 40773: 27320,\n 40774: 27315,\n 40775: 27308,\n 40776: 27358,\n 40777: 27345,\n 40778: 27359,\n 40779: 27306,\n 40780: 27354,\n 40781: 27370,\n 40782: 27387,\n 40783: 27397,\n 40784: 34326,\n 40785: 27386,\n 40786: 27410,\n 40787: 27414,\n 40788: 39729,\n 40789: 27423,\n 40790: 27448,\n 40791: 27447,\n 40792: 30428,\n 40793: 27449,\n 40794: 39150,\n 40795: 27463,\n 40796: 27459,\n 40797: 27465,\n 40798: 27472,\n 40799: 27481,\n 40800: 27476,\n 40801: 27483,\n 40802: 27487,\n 40803: 27489,\n 40804: 27512,\n 40805: 27513,\n 40806: 27519,\n 40807: 27520,\n 40808: 27524,\n 40809: 27523,\n 40810: 27533,\n 40811: 27544,\n 40812: 27541,\n 40813: 27550,\n 40814: 27556,\n 40815: 27562,\n 40816: 27563,\n 40817: 27567,\n 40818: 27570,\n 40819: 27569,\n 40820: 27571,\n 40821: 27575,\n 40822: 27580,\n 40823: 27590,\n 40824: 27595,\n 40825: 27603,\n 40826: 27615,\n 40827: 27628,\n 40828: 27627,\n 40829: 27635,\n 40830: 27631,\n 40832: 40638,\n 40833: 27656,\n 40834: 27667,\n 40835: 27668,\n 40836: 27675,\n 40837: 27684,\n 40838: 27683,\n 40839: 27742,\n 40840: 27733,\n 40841: 27746,\n 40842: 27754,\n 40843: 27778,\n 40844: 27789,\n 40845: 27802,\n 40846: 27777,\n 40847: 27803,\n 40848: 27774,\n 40849: 27752,\n 40850: 27763,\n 40851: 27794,\n 40852: 27792,\n 40853: 27844,\n 40854: 27889,\n 40855: 27859,\n 40856: 27837,\n 40857: 27863,\n 40858: 27845,\n 40859: 27869,\n 40860: 27822,\n 40861: 27825,\n 40862: 27838,\n 40863: 27834,\n 40864: 27867,\n 40865: 27887,\n 40866: 27865,\n 40867: 27882,\n 40868: 27935,\n 40869: 34893,\n 40870: 27958,\n 40871: 27947,\n 40872: 27965,\n 40873: 27960,\n 40874: 27929,\n 40875: 27957,\n 40876: 27955,\n 40877: 27922,\n 40878: 27916,\n 40879: 28003,\n 40880: 28051,\n 40881: 28004,\n 40882: 27994,\n 40883: 28025,\n 40884: 27993,\n 40885: 28046,\n 40886: 28053,\n 40887: 28644,\n 40888: 28037,\n 40889: 28153,\n 40890: 28181,\n 40891: 28170,\n 40892: 28085,\n 40893: 28103,\n 40894: 28134,\n 40895: 28088,\n 40896: 28102,\n 40897: 28140,\n 40898: 28126,\n 40899: 28108,\n 40900: 28136,\n 40901: 28114,\n 40902: 28101,\n 40903: 28154,\n 40904: 28121,\n 40905: 28132,\n 40906: 28117,\n 40907: 28138,\n 40908: 28142,\n 40909: 28205,\n 40910: 28270,\n 40911: 28206,\n 40912: 28185,\n 40913: 28274,\n 40914: 28255,\n 40915: 28222,\n 40916: 28195,\n 40917: 28267,\n 40918: 28203,\n 40919: 28278,\n 40920: 28237,\n 40921: 28191,\n 40922: 28227,\n 40923: 28218,\n 40924: 28238,\n 40925: 28196,\n 40926: 28415,\n 40927: 28189,\n 40928: 28216,\n 40929: 28290,\n 40930: 28330,\n 40931: 28312,\n 40932: 28361,\n 40933: 28343,\n 40934: 28371,\n 40935: 28349,\n 40936: 28335,\n 40937: 28356,\n 40938: 28338,\n 40939: 28372,\n 40940: 28373,\n 40941: 28303,\n 40942: 28325,\n 40943: 28354,\n 40944: 28319,\n 40945: 28481,\n 40946: 28433,\n 40947: 28748,\n 40948: 28396,\n 40949: 28408,\n 40950: 28414,\n 40951: 28479,\n 40952: 28402,\n 40953: 28465,\n 40954: 28399,\n 40955: 28466,\n 40956: 28364,\n 57408: 28478,\n 57409: 28435,\n 57410: 28407,\n 57411: 28550,\n 57412: 28538,\n 57413: 28536,\n 57414: 28545,\n 57415: 28544,\n 57416: 28527,\n 57417: 28507,\n 57418: 28659,\n 57419: 28525,\n 57420: 28546,\n 57421: 28540,\n 57422: 28504,\n 57423: 28558,\n 57424: 28561,\n 57425: 28610,\n 57426: 28518,\n 57427: 28595,\n 57428: 28579,\n 57429: 28577,\n 57430: 28580,\n 57431: 28601,\n 57432: 28614,\n 57433: 28586,\n 57434: 28639,\n 57435: 28629,\n 57436: 28652,\n 57437: 28628,\n 57438: 28632,\n 57439: 28657,\n 57440: 28654,\n 57441: 28635,\n 57442: 28681,\n 57443: 28683,\n 57444: 28666,\n 57445: 28689,\n 57446: 28673,\n 57447: 28687,\n 57448: 28670,\n 57449: 28699,\n 57450: 28698,\n 57451: 28532,\n 57452: 28701,\n 57453: 28696,\n 57454: 28703,\n 57455: 28720,\n 57456: 28734,\n 57457: 28722,\n 57458: 28753,\n 57459: 28771,\n 57460: 28825,\n 57461: 28818,\n 57462: 28847,\n 57463: 28913,\n 57464: 28844,\n 57465: 28856,\n 57466: 28851,\n 57467: 28846,\n 57468: 28895,\n 57469: 28875,\n 57470: 28893,\n 57472: 28889,\n 57473: 28937,\n 57474: 28925,\n 57475: 28956,\n 57476: 28953,\n 57477: 29029,\n 57478: 29013,\n 57479: 29064,\n 57480: 29030,\n 57481: 29026,\n 57482: 29004,\n 57483: 29014,\n 57484: 29036,\n 57485: 29071,\n 57486: 29179,\n 57487: 29060,\n 57488: 29077,\n 57489: 29096,\n 57490: 29100,\n 57491: 29143,\n 57492: 29113,\n 57493: 29118,\n 57494: 29138,\n 57495: 29129,\n 57496: 29140,\n 57497: 29134,\n 57498: 29152,\n 57499: 29164,\n 57500: 29159,\n 57501: 29173,\n 57502: 29180,\n 57503: 29177,\n 57504: 29183,\n 57505: 29197,\n 57506: 29200,\n 57507: 29211,\n 57508: 29224,\n 57509: 29229,\n 57510: 29228,\n 57511: 29232,\n 57512: 29234,\n 57513: 29243,\n 57514: 29244,\n 57515: 29247,\n 57516: 29248,\n 57517: 29254,\n 57518: 29259,\n 57519: 29272,\n 57520: 29300,\n 57521: 29310,\n 57522: 29314,\n 57523: 29313,\n 57524: 29319,\n 57525: 29330,\n 57526: 29334,\n 57527: 29346,\n 57528: 29351,\n 57529: 29369,\n 57530: 29362,\n 57531: 29379,\n 57532: 29382,\n 57533: 29380,\n 57534: 29390,\n 57535: 29394,\n 57536: 29410,\n 57537: 29408,\n 57538: 29409,\n 57539: 29433,\n 57540: 29431,\n 57541: 20495,\n 57542: 29463,\n 57543: 29450,\n 57544: 29468,\n 57545: 29462,\n 57546: 29469,\n 57547: 29492,\n 57548: 29487,\n 57549: 29481,\n 57550: 29477,\n 57551: 29502,\n 57552: 29518,\n 57553: 29519,\n 57554: 40664,\n 57555: 29527,\n 57556: 29546,\n 57557: 29544,\n 57558: 29552,\n 57559: 29560,\n 57560: 29557,\n 57561: 29563,\n 57562: 29562,\n 57563: 29640,\n 57564: 29619,\n 57565: 29646,\n 57566: 29627,\n 57567: 29632,\n 57568: 29669,\n 57569: 29678,\n 57570: 29662,\n 57571: 29858,\n 57572: 29701,\n 57573: 29807,\n 57574: 29733,\n 57575: 29688,\n 57576: 29746,\n 57577: 29754,\n 57578: 29781,\n 57579: 29759,\n 57580: 29791,\n 57581: 29785,\n 57582: 29761,\n 57583: 29788,\n 57584: 29801,\n 57585: 29808,\n 57586: 29795,\n 57587: 29802,\n 57588: 29814,\n 57589: 29822,\n 57590: 29835,\n 57591: 29854,\n 57592: 29863,\n 57593: 29898,\n 57594: 29903,\n 57595: 29908,\n 57596: 29681,\n 57664: 29920,\n 57665: 29923,\n 57666: 29927,\n 57667: 29929,\n 57668: 29934,\n 57669: 29938,\n 57670: 29936,\n 57671: 29937,\n 57672: 29944,\n 57673: 29943,\n 57674: 29956,\n 57675: 29955,\n 57676: 29957,\n 57677: 29964,\n 57678: 29966,\n 57679: 29965,\n 57680: 29973,\n 57681: 29971,\n 57682: 29982,\n 57683: 29990,\n 57684: 29996,\n 57685: 30012,\n 57686: 30020,\n 57687: 30029,\n 57688: 30026,\n 57689: 30025,\n 57690: 30043,\n 57691: 30022,\n 57692: 30042,\n 57693: 30057,\n 57694: 30052,\n 57695: 30055,\n 57696: 30059,\n 57697: 30061,\n 57698: 30072,\n 57699: 30070,\n 57700: 30086,\n 57701: 30087,\n 57702: 30068,\n 57703: 30090,\n 57704: 30089,\n 57705: 30082,\n 57706: 30100,\n 57707: 30106,\n 57708: 30109,\n 57709: 30117,\n 57710: 30115,\n 57711: 30146,\n 57712: 30131,\n 57713: 30147,\n 57714: 30133,\n 57715: 30141,\n 57716: 30136,\n 57717: 30140,\n 57718: 30129,\n 57719: 30157,\n 57720: 30154,\n 57721: 30162,\n 57722: 30169,\n 57723: 30179,\n 57724: 30174,\n 57725: 30206,\n 57726: 30207,\n 57728: 30204,\n 57729: 30209,\n 57730: 30192,\n 57731: 30202,\n 57732: 30194,\n 57733: 30195,\n 57734: 30219,\n 57735: 30221,\n 57736: 30217,\n 57737: 30239,\n 57738: 30247,\n 57739: 30240,\n 57740: 30241,\n 57741: 30242,\n 57742: 30244,\n 57743: 30260,\n 57744: 30256,\n 57745: 30267,\n 57746: 30279,\n 57747: 30280,\n 57748: 30278,\n 57749: 30300,\n 57750: 30296,\n 57751: 30305,\n 57752: 30306,\n 57753: 30312,\n 57754: 30313,\n 57755: 30314,\n 57756: 30311,\n 57757: 30316,\n 57758: 30320,\n 57759: 30322,\n 57760: 30326,\n 57761: 30328,\n 57762: 30332,\n 57763: 30336,\n 57764: 30339,\n 57765: 30344,\n 57766: 30347,\n 57767: 30350,\n 57768: 30358,\n 57769: 30355,\n 57770: 30361,\n 57771: 30362,\n 57772: 30384,\n 57773: 30388,\n 57774: 30392,\n 57775: 30393,\n 57776: 30394,\n 57777: 30402,\n 57778: 30413,\n 57779: 30422,\n 57780: 30418,\n 57781: 30430,\n 57782: 30433,\n 57783: 30437,\n 57784: 30439,\n 57785: 30442,\n 57786: 34351,\n 57787: 30459,\n 57788: 30472,\n 57789: 30471,\n 57790: 30468,\n 57791: 30505,\n 57792: 30500,\n 57793: 30494,\n 57794: 30501,\n 57795: 30502,\n 57796: 30491,\n 57797: 30519,\n 57798: 30520,\n 57799: 30535,\n 57800: 30554,\n 57801: 30568,\n 57802: 30571,\n 57803: 30555,\n 57804: 30565,\n 57805: 30591,\n 57806: 30590,\n 57807: 30585,\n 57808: 30606,\n 57809: 30603,\n 57810: 30609,\n 57811: 30624,\n 57812: 30622,\n 57813: 30640,\n 57814: 30646,\n 57815: 30649,\n 57816: 30655,\n 57817: 30652,\n 57818: 30653,\n 57819: 30651,\n 57820: 30663,\n 57821: 30669,\n 57822: 30679,\n 57823: 30682,\n 57824: 30684,\n 57825: 30691,\n 57826: 30702,\n 57827: 30716,\n 57828: 30732,\n 57829: 30738,\n 57830: 31014,\n 57831: 30752,\n 57832: 31018,\n 57833: 30789,\n 57834: 30862,\n 57835: 30836,\n 57836: 30854,\n 57837: 30844,\n 57838: 30874,\n 57839: 30860,\n 57840: 30883,\n 57841: 30901,\n 57842: 30890,\n 57843: 30895,\n 57844: 30929,\n 57845: 30918,\n 57846: 30923,\n 57847: 30932,\n 57848: 30910,\n 57849: 30908,\n 57850: 30917,\n 57851: 30922,\n 57852: 30956,\n 57920: 30951,\n 57921: 30938,\n 57922: 30973,\n 57923: 30964,\n 57924: 30983,\n 57925: 30994,\n 57926: 30993,\n 57927: 31001,\n 57928: 31020,\n 57929: 31019,\n 57930: 31040,\n 57931: 31072,\n 57932: 31063,\n 57933: 31071,\n 57934: 31066,\n 57935: 31061,\n 57936: 31059,\n 57937: 31098,\n 57938: 31103,\n 57939: 31114,\n 57940: 31133,\n 57941: 31143,\n 57942: 40779,\n 57943: 31146,\n 57944: 31150,\n 57945: 31155,\n 57946: 31161,\n 57947: 31162,\n 57948: 31177,\n 57949: 31189,\n 57950: 31207,\n 57951: 31212,\n 57952: 31201,\n 57953: 31203,\n 57954: 31240,\n 57955: 31245,\n 57956: 31256,\n 57957: 31257,\n 57958: 31264,\n 57959: 31263,\n 57960: 31104,\n 57961: 31281,\n 57962: 31291,\n 57963: 31294,\n 57964: 31287,\n 57965: 31299,\n 57966: 31319,\n 57967: 31305,\n 57968: 31329,\n 57969: 31330,\n 57970: 31337,\n 57971: 40861,\n 57972: 31344,\n 57973: 31353,\n 57974: 31357,\n 57975: 31368,\n 57976: 31383,\n 57977: 31381,\n 57978: 31384,\n 57979: 31382,\n 57980: 31401,\n 57981: 31432,\n 57982: 31408,\n 57984: 31414,\n 57985: 31429,\n 57986: 31428,\n 57987: 31423,\n 57988: 36995,\n 57989: 31431,\n 57990: 31434,\n 57991: 31437,\n 57992: 31439,\n 57993: 31445,\n 57994: 31443,\n 57995: 31449,\n 57996: 31450,\n 57997: 31453,\n 57998: 31457,\n 57999: 31458,\n 58000: 31462,\n 58001: 31469,\n 58002: 31472,\n 58003: 31490,\n 58004: 31503,\n 58005: 31498,\n 58006: 31494,\n 58007: 31539,\n 58008: 31512,\n 58009: 31513,\n 58010: 31518,\n 58011: 31541,\n 58012: 31528,\n 58013: 31542,\n 58014: 31568,\n 58015: 31610,\n 58016: 31492,\n 58017: 31565,\n 58018: 31499,\n 58019: 31564,\n 58020: 31557,\n 58021: 31605,\n 58022: 31589,\n 58023: 31604,\n 58024: 31591,\n 58025: 31600,\n 58026: 31601,\n 58027: 31596,\n 58028: 31598,\n 58029: 31645,\n 58030: 31640,\n 58031: 31647,\n 58032: 31629,\n 58033: 31644,\n 58034: 31642,\n 58035: 31627,\n 58036: 31634,\n 58037: 31631,\n 58038: 31581,\n 58039: 31641,\n 58040: 31691,\n 58041: 31681,\n 58042: 31692,\n 58043: 31695,\n 58044: 31668,\n 58045: 31686,\n 58046: 31709,\n 58047: 31721,\n 58048: 31761,\n 58049: 31764,\n 58050: 31718,\n 58051: 31717,\n 58052: 31840,\n 58053: 31744,\n 58054: 31751,\n 58055: 31763,\n 58056: 31731,\n 58057: 31735,\n 58058: 31767,\n 58059: 31757,\n 58060: 31734,\n 58061: 31779,\n 58062: 31783,\n 58063: 31786,\n 58064: 31775,\n 58065: 31799,\n 58066: 31787,\n 58067: 31805,\n 58068: 31820,\n 58069: 31811,\n 58070: 31828,\n 58071: 31823,\n 58072: 31808,\n 58073: 31824,\n 58074: 31832,\n 58075: 31839,\n 58076: 31844,\n 58077: 31830,\n 58078: 31845,\n 58079: 31852,\n 58080: 31861,\n 58081: 31875,\n 58082: 31888,\n 58083: 31908,\n 58084: 31917,\n 58085: 31906,\n 58086: 31915,\n 58087: 31905,\n 58088: 31912,\n 58089: 31923,\n 58090: 31922,\n 58091: 31921,\n 58092: 31918,\n 58093: 31929,\n 58094: 31933,\n 58095: 31936,\n 58096: 31941,\n 58097: 31938,\n 58098: 31960,\n 58099: 31954,\n 58100: 31964,\n 58101: 31970,\n 58102: 39739,\n 58103: 31983,\n 58104: 31986,\n 58105: 31988,\n 58106: 31990,\n 58107: 31994,\n 58108: 32006,\n 58176: 32002,\n 58177: 32028,\n 58178: 32021,\n 58179: 32010,\n 58180: 32069,\n 58181: 32075,\n 58182: 32046,\n 58183: 32050,\n 58184: 32063,\n 58185: 32053,\n 58186: 32070,\n 58187: 32115,\n 58188: 32086,\n 58189: 32078,\n 58190: 32114,\n 58191: 32104,\n 58192: 32110,\n 58193: 32079,\n 58194: 32099,\n 58195: 32147,\n 58196: 32137,\n 58197: 32091,\n 58198: 32143,\n 58199: 32125,\n 58200: 32155,\n 58201: 32186,\n 58202: 32174,\n 58203: 32163,\n 58204: 32181,\n 58205: 32199,\n 58206: 32189,\n 58207: 32171,\n 58208: 32317,\n 58209: 32162,\n 58210: 32175,\n 58211: 32220,\n 58212: 32184,\n 58213: 32159,\n 58214: 32176,\n 58215: 32216,\n 58216: 32221,\n 58217: 32228,\n 58218: 32222,\n 58219: 32251,\n 58220: 32242,\n 58221: 32225,\n 58222: 32261,\n 58223: 32266,\n 58224: 32291,\n 58225: 32289,\n 58226: 32274,\n 58227: 32305,\n 58228: 32287,\n 58229: 32265,\n 58230: 32267,\n 58231: 32290,\n 58232: 32326,\n 58233: 32358,\n 58234: 32315,\n 58235: 32309,\n 58236: 32313,\n 58237: 32323,\n 58238: 32311,\n 58240: 32306,\n 58241: 32314,\n 58242: 32359,\n 58243: 32349,\n 58244: 32342,\n 58245: 32350,\n 58246: 32345,\n 58247: 32346,\n 58248: 32377,\n 58249: 32362,\n 58250: 32361,\n 58251: 32380,\n 58252: 32379,\n 58253: 32387,\n 58254: 32213,\n 58255: 32381,\n 58256: 36782,\n 58257: 32383,\n 58258: 32392,\n 58259: 32393,\n 58260: 32396,\n 58261: 32402,\n 58262: 32400,\n 58263: 32403,\n 58264: 32404,\n 58265: 32406,\n 58266: 32398,\n 58267: 32411,\n 58268: 32412,\n 58269: 32568,\n 58270: 32570,\n 58271: 32581,\n 58272: 32588,\n 58273: 32589,\n 58274: 32590,\n 58275: 32592,\n 58276: 32593,\n 58277: 32597,\n 58278: 32596,\n 58279: 32600,\n 58280: 32607,\n 58281: 32608,\n 58282: 32616,\n 58283: 32617,\n 58284: 32615,\n 58285: 32632,\n 58286: 32642,\n 58287: 32646,\n 58288: 32643,\n 58289: 32648,\n 58290: 32647,\n 58291: 32652,\n 58292: 32660,\n 58293: 32670,\n 58294: 32669,\n 58295: 32666,\n 58296: 32675,\n 58297: 32687,\n 58298: 32690,\n 58299: 32697,\n 58300: 32686,\n 58301: 32694,\n 58302: 32696,\n 58303: 35697,\n 58304: 32709,\n 58305: 32710,\n 58306: 32714,\n 58307: 32725,\n 58308: 32724,\n 58309: 32737,\n 58310: 32742,\n 58311: 32745,\n 58312: 32755,\n 58313: 32761,\n 58314: 39132,\n 58315: 32774,\n 58316: 32772,\n 58317: 32779,\n 58318: 32786,\n 58319: 32792,\n 58320: 32793,\n 58321: 32796,\n 58322: 32801,\n 58323: 32808,\n 58324: 32831,\n 58325: 32827,\n 58326: 32842,\n 58327: 32838,\n 58328: 32850,\n 58329: 32856,\n 58330: 32858,\n 58331: 32863,\n 58332: 32866,\n 58333: 32872,\n 58334: 32883,\n 58335: 32882,\n 58336: 32880,\n 58337: 32886,\n 58338: 32889,\n 58339: 32893,\n 58340: 32895,\n 58341: 32900,\n 58342: 32902,\n 58343: 32901,\n 58344: 32923,\n 58345: 32915,\n 58346: 32922,\n 58347: 32941,\n 58348: 20880,\n 58349: 32940,\n 58350: 32987,\n 58351: 32997,\n 58352: 32985,\n 58353: 32989,\n 58354: 32964,\n 58355: 32986,\n 58356: 32982,\n 58357: 33033,\n 58358: 33007,\n 58359: 33009,\n 58360: 33051,\n 58361: 33065,\n 58362: 33059,\n 58363: 33071,\n 58364: 33099,\n 58432: 38539,\n 58433: 33094,\n 58434: 33086,\n 58435: 33107,\n 58436: 33105,\n 58437: 33020,\n 58438: 33137,\n 58439: 33134,\n 58440: 33125,\n 58441: 33126,\n 58442: 33140,\n 58443: 33155,\n 58444: 33160,\n 58445: 33162,\n 58446: 33152,\n 58447: 33154,\n 58448: 33184,\n 58449: 33173,\n 58450: 33188,\n 58451: 33187,\n 58452: 33119,\n 58453: 33171,\n 58454: 33193,\n 58455: 33200,\n 58456: 33205,\n 58457: 33214,\n 58458: 33208,\n 58459: 33213,\n 58460: 33216,\n 58461: 33218,\n 58462: 33210,\n 58463: 33225,\n 58464: 33229,\n 58465: 33233,\n 58466: 33241,\n 58467: 33240,\n 58468: 33224,\n 58469: 33242,\n 58470: 33247,\n 58471: 33248,\n 58472: 33255,\n 58473: 33274,\n 58474: 33275,\n 58475: 33278,\n 58476: 33281,\n 58477: 33282,\n 58478: 33285,\n 58479: 33287,\n 58480: 33290,\n 58481: 33293,\n 58482: 33296,\n 58483: 33302,\n 58484: 33321,\n 58485: 33323,\n 58486: 33336,\n 58487: 33331,\n 58488: 33344,\n 58489: 33369,\n 58490: 33368,\n 58491: 33373,\n 58492: 33370,\n 58493: 33375,\n 58494: 33380,\n 58496: 33378,\n 58497: 33384,\n 58498: 33386,\n 58499: 33387,\n 58500: 33326,\n 58501: 33393,\n 58502: 33399,\n 58503: 33400,\n 58504: 33406,\n 58505: 33421,\n 58506: 33426,\n 58507: 33451,\n 58508: 33439,\n 58509: 33467,\n 58510: 33452,\n 58511: 33505,\n 58512: 33507,\n 58513: 33503,\n 58514: 33490,\n 58515: 33524,\n 58516: 33523,\n 58517: 33530,\n 58518: 33683,\n 58519: 33539,\n 58520: 33531,\n 58521: 33529,\n 58522: 33502,\n 58523: 33542,\n 58524: 33500,\n 58525: 33545,\n 58526: 33497,\n 58527: 33589,\n 58528: 33588,\n 58529: 33558,\n 58530: 33586,\n 58531: 33585,\n 58532: 33600,\n 58533: 33593,\n 58534: 33616,\n 58535: 33605,\n 58536: 33583,\n 58537: 33579,\n 58538: 33559,\n 58539: 33560,\n 58540: 33669,\n 58541: 33690,\n 58542: 33706,\n 58543: 33695,\n 58544: 33698,\n 58545: 33686,\n 58546: 33571,\n 58547: 33678,\n 58548: 33671,\n 58549: 33674,\n 58550: 33660,\n 58551: 33717,\n 58552: 33651,\n 58553: 33653,\n 58554: 33696,\n 58555: 33673,\n 58556: 33704,\n 58557: 33780,\n 58558: 33811,\n 58559: 33771,\n 58560: 33742,\n 58561: 33789,\n 58562: 33795,\n 58563: 33752,\n 58564: 33803,\n 58565: 33729,\n 58566: 33783,\n 58567: 33799,\n 58568: 33760,\n 58569: 33778,\n 58570: 33805,\n 58571: 33826,\n 58572: 33824,\n 58573: 33725,\n 58574: 33848,\n 58575: 34054,\n 58576: 33787,\n 58577: 33901,\n 58578: 33834,\n 58579: 33852,\n 58580: 34138,\n 58581: 33924,\n 58582: 33911,\n 58583: 33899,\n 58584: 33965,\n 58585: 33902,\n 58586: 33922,\n 58587: 33897,\n 58588: 33862,\n 58589: 33836,\n 58590: 33903,\n 58591: 33913,\n 58592: 33845,\n 58593: 33994,\n 58594: 33890,\n 58595: 33977,\n 58596: 33983,\n 58597: 33951,\n 58598: 34009,\n 58599: 33997,\n 58600: 33979,\n 58601: 34010,\n 58602: 34000,\n 58603: 33985,\n 58604: 33990,\n 58605: 34006,\n 58606: 33953,\n 58607: 34081,\n 58608: 34047,\n 58609: 34036,\n 58610: 34071,\n 58611: 34072,\n 58612: 34092,\n 58613: 34079,\n 58614: 34069,\n 58615: 34068,\n 58616: 34044,\n 58617: 34112,\n 58618: 34147,\n 58619: 34136,\n 58620: 34120,\n 58688: 34113,\n 58689: 34306,\n 58690: 34123,\n 58691: 34133,\n 58692: 34176,\n 58693: 34212,\n 58694: 34184,\n 58695: 34193,\n 58696: 34186,\n 58697: 34216,\n 58698: 34157,\n 58699: 34196,\n 58700: 34203,\n 58701: 34282,\n 58702: 34183,\n 58703: 34204,\n 58704: 34167,\n 58705: 34174,\n 58706: 34192,\n 58707: 34249,\n 58708: 34234,\n 58709: 34255,\n 58710: 34233,\n 58711: 34256,\n 58712: 34261,\n 58713: 34269,\n 58714: 34277,\n 58715: 34268,\n 58716: 34297,\n 58717: 34314,\n 58718: 34323,\n 58719: 34315,\n 58720: 34302,\n 58721: 34298,\n 58722: 34310,\n 58723: 34338,\n 58724: 34330,\n 58725: 34352,\n 58726: 34367,\n 58727: 34381,\n 58728: 20053,\n 58729: 34388,\n 58730: 34399,\n 58731: 34407,\n 58732: 34417,\n 58733: 34451,\n 58734: 34467,\n 58735: 34473,\n 58736: 34474,\n 58737: 34443,\n 58738: 34444,\n 58739: 34486,\n 58740: 34479,\n 58741: 34500,\n 58742: 34502,\n 58743: 34480,\n 58744: 34505,\n 58745: 34851,\n 58746: 34475,\n 58747: 34516,\n 58748: 34526,\n 58749: 34537,\n 58750: 34540,\n 58752: 34527,\n 58753: 34523,\n 58754: 34543,\n 58755: 34578,\n 58756: 34566,\n 58757: 34568,\n 58758: 34560,\n 58759: 34563,\n 58760: 34555,\n 58761: 34577,\n 58762: 34569,\n 58763: 34573,\n 58764: 34553,\n 58765: 34570,\n 58766: 34612,\n 58767: 34623,\n 58768: 34615,\n 58769: 34619,\n 58770: 34597,\n 58771: 34601,\n 58772: 34586,\n 58773: 34656,\n 58774: 34655,\n 58775: 34680,\n 58776: 34636,\n 58777: 34638,\n 58778: 34676,\n 58779: 34647,\n 58780: 34664,\n 58781: 34670,\n 58782: 34649,\n 58783: 34643,\n 58784: 34659,\n 58785: 34666,\n 58786: 34821,\n 58787: 34722,\n 58788: 34719,\n 58789: 34690,\n 58790: 34735,\n 58791: 34763,\n 58792: 34749,\n 58793: 34752,\n 58794: 34768,\n 58795: 38614,\n 58796: 34731,\n 58797: 34756,\n 58798: 34739,\n 58799: 34759,\n 58800: 34758,\n 58801: 34747,\n 58802: 34799,\n 58803: 34802,\n 58804: 34784,\n 58805: 34831,\n 58806: 34829,\n 58807: 34814,\n 58808: 34806,\n 58809: 34807,\n 58810: 34830,\n 58811: 34770,\n 58812: 34833,\n 58813: 34838,\n 58814: 34837,\n 58815: 34850,\n 58816: 34849,\n 58817: 34865,\n 58818: 34870,\n 58819: 34873,\n 58820: 34855,\n 58821: 34875,\n 58822: 34884,\n 58823: 34882,\n 58824: 34898,\n 58825: 34905,\n 58826: 34910,\n 58827: 34914,\n 58828: 34923,\n 58829: 34945,\n 58830: 34942,\n 58831: 34974,\n 58832: 34933,\n 58833: 34941,\n 58834: 34997,\n 58835: 34930,\n 58836: 34946,\n 58837: 34967,\n 58838: 34962,\n 58839: 34990,\n 58840: 34969,\n 58841: 34978,\n 58842: 34957,\n 58843: 34980,\n 58844: 34992,\n 58845: 35007,\n 58846: 34993,\n 58847: 35011,\n 58848: 35012,\n 58849: 35028,\n 58850: 35032,\n 58851: 35033,\n 58852: 35037,\n 58853: 35065,\n 58854: 35074,\n 58855: 35068,\n 58856: 35060,\n 58857: 35048,\n 58858: 35058,\n 58859: 35076,\n 58860: 35084,\n 58861: 35082,\n 58862: 35091,\n 58863: 35139,\n 58864: 35102,\n 58865: 35109,\n 58866: 35114,\n 58867: 35115,\n 58868: 35137,\n 58869: 35140,\n 58870: 35131,\n 58871: 35126,\n 58872: 35128,\n 58873: 35148,\n 58874: 35101,\n 58875: 35168,\n 58876: 35166,\n 58944: 35174,\n 58945: 35172,\n 58946: 35181,\n 58947: 35178,\n 58948: 35183,\n 58949: 35188,\n 58950: 35191,\n 58951: 35198,\n 58952: 35203,\n 58953: 35208,\n 58954: 35210,\n 58955: 35219,\n 58956: 35224,\n 58957: 35233,\n 58958: 35241,\n 58959: 35238,\n 58960: 35244,\n 58961: 35247,\n 58962: 35250,\n 58963: 35258,\n 58964: 35261,\n 58965: 35263,\n 58966: 35264,\n 58967: 35290,\n 58968: 35292,\n 58969: 35293,\n 58970: 35303,\n 58971: 35316,\n 58972: 35320,\n 58973: 35331,\n 58974: 35350,\n 58975: 35344,\n 58976: 35340,\n 58977: 35355,\n 58978: 35357,\n 58979: 35365,\n 58980: 35382,\n 58981: 35393,\n 58982: 35419,\n 58983: 35410,\n 58984: 35398,\n 58985: 35400,\n 58986: 35452,\n 58987: 35437,\n 58988: 35436,\n 58989: 35426,\n 58990: 35461,\n 58991: 35458,\n 58992: 35460,\n 58993: 35496,\n 58994: 35489,\n 58995: 35473,\n 58996: 35493,\n 58997: 35494,\n 58998: 35482,\n 58999: 35491,\n 59000: 35524,\n 59001: 35533,\n 59002: 35522,\n 59003: 35546,\n 59004: 35563,\n 59005: 35571,\n 59006: 35559,\n 59008: 35556,\n 59009: 35569,\n 59010: 35604,\n 59011: 35552,\n 59012: 35554,\n 59013: 35575,\n 59014: 35550,\n 59015: 35547,\n 59016: 35596,\n 59017: 35591,\n 59018: 35610,\n 59019: 35553,\n 59020: 35606,\n 59021: 35600,\n 59022: 35607,\n 59023: 35616,\n 59024: 35635,\n 59025: 38827,\n 59026: 35622,\n 59027: 35627,\n 59028: 35646,\n 59029: 35624,\n 59030: 35649,\n 59031: 35660,\n 59032: 35663,\n 59033: 35662,\n 59034: 35657,\n 59035: 35670,\n 59036: 35675,\n 59037: 35674,\n 59038: 35691,\n 59039: 35679,\n 59040: 35692,\n 59041: 35695,\n 59042: 35700,\n 59043: 35709,\n 59044: 35712,\n 59045: 35724,\n 59046: 35726,\n 59047: 35730,\n 59048: 35731,\n 59049: 35734,\n 59050: 35737,\n 59051: 35738,\n 59052: 35898,\n 59053: 35905,\n 59054: 35903,\n 59055: 35912,\n 59056: 35916,\n 59057: 35918,\n 59058: 35920,\n 59059: 35925,\n 59060: 35938,\n 59061: 35948,\n 59062: 35960,\n 59063: 35962,\n 59064: 35970,\n 59065: 35977,\n 59066: 35973,\n 59067: 35978,\n 59068: 35981,\n 59069: 35982,\n 59070: 35988,\n 59071: 35964,\n 59072: 35992,\n 59073: 25117,\n 59074: 36013,\n 59075: 36010,\n 59076: 36029,\n 59077: 36018,\n 59078: 36019,\n 59079: 36014,\n 59080: 36022,\n 59081: 36040,\n 59082: 36033,\n 59083: 36068,\n 59084: 36067,\n 59085: 36058,\n 59086: 36093,\n 59087: 36090,\n 59088: 36091,\n 59089: 36100,\n 59090: 36101,\n 59091: 36106,\n 59092: 36103,\n 59093: 36111,\n 59094: 36109,\n 59095: 36112,\n 59096: 40782,\n 59097: 36115,\n 59098: 36045,\n 59099: 36116,\n 59100: 36118,\n 59101: 36199,\n 59102: 36205,\n 59103: 36209,\n 59104: 36211,\n 59105: 36225,\n 59106: 36249,\n 59107: 36290,\n 59108: 36286,\n 59109: 36282,\n 59110: 36303,\n 59111: 36314,\n 59112: 36310,\n 59113: 36300,\n 59114: 36315,\n 59115: 36299,\n 59116: 36330,\n 59117: 36331,\n 59118: 36319,\n 59119: 36323,\n 59120: 36348,\n 59121: 36360,\n 59122: 36361,\n 59123: 36351,\n 59124: 36381,\n 59125: 36382,\n 59126: 36368,\n 59127: 36383,\n 59128: 36418,\n 59129: 36405,\n 59130: 36400,\n 59131: 36404,\n 59132: 36426,\n 59200: 36423,\n 59201: 36425,\n 59202: 36428,\n 59203: 36432,\n 59204: 36424,\n 59205: 36441,\n 59206: 36452,\n 59207: 36448,\n 59208: 36394,\n 59209: 36451,\n 59210: 36437,\n 59211: 36470,\n 59212: 36466,\n 59213: 36476,\n 59214: 36481,\n 59215: 36487,\n 59216: 36485,\n 59217: 36484,\n 59218: 36491,\n 59219: 36490,\n 59220: 36499,\n 59221: 36497,\n 59222: 36500,\n 59223: 36505,\n 59224: 36522,\n 59225: 36513,\n 59226: 36524,\n 59227: 36528,\n 59228: 36550,\n 59229: 36529,\n 59230: 36542,\n 59231: 36549,\n 59232: 36552,\n 59233: 36555,\n 59234: 36571,\n 59235: 36579,\n 59236: 36604,\n 59237: 36603,\n 59238: 36587,\n 59239: 36606,\n 59240: 36618,\n 59241: 36613,\n 59242: 36629,\n 59243: 36626,\n 59244: 36633,\n 59245: 36627,\n 59246: 36636,\n 59247: 36639,\n 59248: 36635,\n 59249: 36620,\n 59250: 36646,\n 59251: 36659,\n 59252: 36667,\n 59253: 36665,\n 59254: 36677,\n 59255: 36674,\n 59256: 36670,\n 59257: 36684,\n 59258: 36681,\n 59259: 36678,\n 59260: 36686,\n 59261: 36695,\n 59262: 36700,\n 59264: 36706,\n 59265: 36707,\n 59266: 36708,\n 59267: 36764,\n 59268: 36767,\n 59269: 36771,\n 59270: 36781,\n 59271: 36783,\n 59272: 36791,\n 59273: 36826,\n 59274: 36837,\n 59275: 36834,\n 59276: 36842,\n 59277: 36847,\n 59278: 36999,\n 59279: 36852,\n 59280: 36869,\n 59281: 36857,\n 59282: 36858,\n 59283: 36881,\n 59284: 36885,\n 59285: 36897,\n 59286: 36877,\n 59287: 36894,\n 59288: 36886,\n 59289: 36875,\n 59290: 36903,\n 59291: 36918,\n 59292: 36917,\n 59293: 36921,\n 59294: 36856,\n 59295: 36943,\n 59296: 36944,\n 59297: 36945,\n 59298: 36946,\n 59299: 36878,\n 59300: 36937,\n 59301: 36926,\n 59302: 36950,\n 59303: 36952,\n 59304: 36958,\n 59305: 36968,\n 59306: 36975,\n 59307: 36982,\n 59308: 38568,\n 59309: 36978,\n 59310: 36994,\n 59311: 36989,\n 59312: 36993,\n 59313: 36992,\n 59314: 37002,\n 59315: 37001,\n 59316: 37007,\n 59317: 37032,\n 59318: 37039,\n 59319: 37041,\n 59320: 37045,\n 59321: 37090,\n 59322: 37092,\n 59323: 25160,\n 59324: 37083,\n 59325: 37122,\n 59326: 37138,\n 59327: 37145,\n 59328: 37170,\n 59329: 37168,\n 59330: 37194,\n 59331: 37206,\n 59332: 37208,\n 59333: 37219,\n 59334: 37221,\n 59335: 37225,\n 59336: 37235,\n 59337: 37234,\n 59338: 37259,\n 59339: 37257,\n 59340: 37250,\n 59341: 37282,\n 59342: 37291,\n 59343: 37295,\n 59344: 37290,\n 59345: 37301,\n 59346: 37300,\n 59347: 37306,\n 59348: 37312,\n 59349: 37313,\n 59350: 37321,\n 59351: 37323,\n 59352: 37328,\n 59353: 37334,\n 59354: 37343,\n 59355: 37345,\n 59356: 37339,\n 59357: 37372,\n 59358: 37365,\n 59359: 37366,\n 59360: 37406,\n 59361: 37375,\n 59362: 37396,\n 59363: 37420,\n 59364: 37397,\n 59365: 37393,\n 59366: 37470,\n 59367: 37463,\n 59368: 37445,\n 59369: 37449,\n 59370: 37476,\n 59371: 37448,\n 59372: 37525,\n 59373: 37439,\n 59374: 37451,\n 59375: 37456,\n 59376: 37532,\n 59377: 37526,\n 59378: 37523,\n 59379: 37531,\n 59380: 37466,\n 59381: 37583,\n 59382: 37561,\n 59383: 37559,\n 59384: 37609,\n 59385: 37647,\n 59386: 37626,\n 59387: 37700,\n 59388: 37678,\n 59456: 37657,\n 59457: 37666,\n 59458: 37658,\n 59459: 37667,\n 59460: 37690,\n 59461: 37685,\n 59462: 37691,\n 59463: 37724,\n 59464: 37728,\n 59465: 37756,\n 59466: 37742,\n 59467: 37718,\n 59468: 37808,\n 59469: 37804,\n 59470: 37805,\n 59471: 37780,\n 59472: 37817,\n 59473: 37846,\n 59474: 37847,\n 59475: 37864,\n 59476: 37861,\n 59477: 37848,\n 59478: 37827,\n 59479: 37853,\n 59480: 37840,\n 59481: 37832,\n 59482: 37860,\n 59483: 37914,\n 59484: 37908,\n 59485: 37907,\n 59486: 37891,\n 59487: 37895,\n 59488: 37904,\n 59489: 37942,\n 59490: 37931,\n 59491: 37941,\n 59492: 37921,\n 59493: 37946,\n 59494: 37953,\n 59495: 37970,\n 59496: 37956,\n 59497: 37979,\n 59498: 37984,\n 59499: 37986,\n 59500: 37982,\n 59501: 37994,\n 59502: 37417,\n 59503: 38000,\n 59504: 38005,\n 59505: 38007,\n 59506: 38013,\n 59507: 37978,\n 59508: 38012,\n 59509: 38014,\n 59510: 38017,\n 59511: 38015,\n 59512: 38274,\n 59513: 38279,\n 59514: 38282,\n 59515: 38292,\n 59516: 38294,\n 59517: 38296,\n 59518: 38297,\n 59520: 38304,\n 59521: 38312,\n 59522: 38311,\n 59523: 38317,\n 59524: 38332,\n 59525: 38331,\n 59526: 38329,\n 59527: 38334,\n 59528: 38346,\n 59529: 28662,\n 59530: 38339,\n 59531: 38349,\n 59532: 38348,\n 59533: 38357,\n 59534: 38356,\n 59535: 38358,\n 59536: 38364,\n 59537: 38369,\n 59538: 38373,\n 59539: 38370,\n 59540: 38433,\n 59541: 38440,\n 59542: 38446,\n 59543: 38447,\n 59544: 38466,\n 59545: 38476,\n 59546: 38479,\n 59547: 38475,\n 59548: 38519,\n 59549: 38492,\n 59550: 38494,\n 59551: 38493,\n 59552: 38495,\n 59553: 38502,\n 59554: 38514,\n 59555: 38508,\n 59556: 38541,\n 59557: 38552,\n 59558: 38549,\n 59559: 38551,\n 59560: 38570,\n 59561: 38567,\n 59562: 38577,\n 59563: 38578,\n 59564: 38576,\n 59565: 38580,\n 59566: 38582,\n 59567: 38584,\n 59568: 38585,\n 59569: 38606,\n 59570: 38603,\n 59571: 38601,\n 59572: 38605,\n 59573: 35149,\n 59574: 38620,\n 59575: 38669,\n 59576: 38613,\n 59577: 38649,\n 59578: 38660,\n 59579: 38662,\n 59580: 38664,\n 59581: 38675,\n 59582: 38670,\n 59583: 38673,\n 59584: 38671,\n 59585: 38678,\n 59586: 38681,\n 59587: 38692,\n 59588: 38698,\n 59589: 38704,\n 59590: 38713,\n 59591: 38717,\n 59592: 38718,\n 59593: 38724,\n 59594: 38726,\n 59595: 38728,\n 59596: 38722,\n 59597: 38729,\n 59598: 38748,\n 59599: 38752,\n 59600: 38756,\n 59601: 38758,\n 59602: 38760,\n 59603: 21202,\n 59604: 38763,\n 59605: 38769,\n 59606: 38777,\n 59607: 38789,\n 59608: 38780,\n 59609: 38785,\n 59610: 38778,\n 59611: 38790,\n 59612: 38795,\n 59613: 38799,\n 59614: 38800,\n 59615: 38812,\n 59616: 38824,\n 59617: 38822,\n 59618: 38819,\n 59619: 38835,\n 59620: 38836,\n 59621: 38851,\n 59622: 38854,\n 59623: 38856,\n 59624: 38859,\n 59625: 38876,\n 59626: 38893,\n 59627: 40783,\n 59628: 38898,\n 59629: 31455,\n 59630: 38902,\n 59631: 38901,\n 59632: 38927,\n 59633: 38924,\n 59634: 38968,\n 59635: 38948,\n 59636: 38945,\n 59637: 38967,\n 59638: 38973,\n 59639: 38982,\n 59640: 38991,\n 59641: 38987,\n 59642: 39019,\n 59643: 39023,\n 59644: 39024,\n 59712: 39025,\n 59713: 39028,\n 59714: 39027,\n 59715: 39082,\n 59716: 39087,\n 59717: 39089,\n 59718: 39094,\n 59719: 39108,\n 59720: 39107,\n 59721: 39110,\n 59722: 39145,\n 59723: 39147,\n 59724: 39171,\n 59725: 39177,\n 59726: 39186,\n 59727: 39188,\n 59728: 39192,\n 59729: 39201,\n 59730: 39197,\n 59731: 39198,\n 59732: 39204,\n 59733: 39200,\n 59734: 39212,\n 59735: 39214,\n 59736: 39229,\n 59737: 39230,\n 59738: 39234,\n 59739: 39241,\n 59740: 39237,\n 59741: 39248,\n 59742: 39243,\n 59743: 39249,\n 59744: 39250,\n 59745: 39244,\n 59746: 39253,\n 59747: 39319,\n 59748: 39320,\n 59749: 39333,\n 59750: 39341,\n 59751: 39342,\n 59752: 39356,\n 59753: 39391,\n 59754: 39387,\n 59755: 39389,\n 59756: 39384,\n 59757: 39377,\n 59758: 39405,\n 59759: 39406,\n 59760: 39409,\n 59761: 39410,\n 59762: 39419,\n 59763: 39416,\n 59764: 39425,\n 59765: 39439,\n 59766: 39429,\n 59767: 39394,\n 59768: 39449,\n 59769: 39467,\n 59770: 39479,\n 59771: 39493,\n 59772: 39490,\n 59773: 39488,\n 59774: 39491,\n 59776: 39486,\n 59777: 39509,\n 59778: 39501,\n 59779: 39515,\n 59780: 39511,\n 59781: 39519,\n 59782: 39522,\n 59783: 39525,\n 59784: 39524,\n 59785: 39529,\n 59786: 39531,\n 59787: 39530,\n 59788: 39597,\n 59789: 39600,\n 59790: 39612,\n 59791: 39616,\n 59792: 39631,\n 59793: 39633,\n 59794: 39635,\n 59795: 39636,\n 59796: 39646,\n 59797: 39647,\n 59798: 39650,\n 59799: 39651,\n 59800: 39654,\n 59801: 39663,\n 59802: 39659,\n 59803: 39662,\n 59804: 39668,\n 59805: 39665,\n 59806: 39671,\n 59807: 39675,\n 59808: 39686,\n 59809: 39704,\n 59810: 39706,\n 59811: 39711,\n 59812: 39714,\n 59813: 39715,\n 59814: 39717,\n 59815: 39719,\n 59816: 39720,\n 59817: 39721,\n 59818: 39722,\n 59819: 39726,\n 59820: 39727,\n 59821: 39730,\n 59822: 39748,\n 59823: 39747,\n 59824: 39759,\n 59825: 39757,\n 59826: 39758,\n 59827: 39761,\n 59828: 39768,\n 59829: 39796,\n 59830: 39827,\n 59831: 39811,\n 59832: 39825,\n 59833: 39830,\n 59834: 39831,\n 59835: 39839,\n 59836: 39840,\n 59837: 39848,\n 59838: 39860,\n 59839: 39872,\n 59840: 39882,\n 59841: 39865,\n 59842: 39878,\n 59843: 39887,\n 59844: 39889,\n 59845: 39890,\n 59846: 39907,\n 59847: 39906,\n 59848: 39908,\n 59849: 39892,\n 59850: 39905,\n 59851: 39994,\n 59852: 39922,\n 59853: 39921,\n 59854: 39920,\n 59855: 39957,\n 59856: 39956,\n 59857: 39945,\n 59858: 39955,\n 59859: 39948,\n 59860: 39942,\n 59861: 39944,\n 59862: 39954,\n 59863: 39946,\n 59864: 39940,\n 59865: 39982,\n 59866: 39963,\n 59867: 39973,\n 59868: 39972,\n 59869: 39969,\n 59870: 39984,\n 59871: 40007,\n 59872: 39986,\n 59873: 40006,\n 59874: 39998,\n 59875: 40026,\n 59876: 40032,\n 59877: 40039,\n 59878: 40054,\n 59879: 40056,\n 59880: 40167,\n 59881: 40172,\n 59882: 40176,\n 59883: 40201,\n 59884: 40200,\n 59885: 40171,\n 59886: 40195,\n 59887: 40198,\n 59888: 40234,\n 59889: 40230,\n 59890: 40367,\n 59891: 40227,\n 59892: 40223,\n 59893: 40260,\n 59894: 40213,\n 59895: 40210,\n 59896: 40257,\n 59897: 40255,\n 59898: 40254,\n 59899: 40262,\n 59900: 40264,\n 59968: 40285,\n 59969: 40286,\n 59970: 40292,\n 59971: 40273,\n 59972: 40272,\n 59973: 40281,\n 59974: 40306,\n 59975: 40329,\n 59976: 40327,\n 59977: 40363,\n 59978: 40303,\n 59979: 40314,\n 59980: 40346,\n 59981: 40356,\n 59982: 40361,\n 59983: 40370,\n 59984: 40388,\n 59985: 40385,\n 59986: 40379,\n 59987: 40376,\n 59988: 40378,\n 59989: 40390,\n 59990: 40399,\n 59991: 40386,\n 59992: 40409,\n 59993: 40403,\n 59994: 40440,\n 59995: 40422,\n 59996: 40429,\n 59997: 40431,\n 59998: 40445,\n 59999: 40474,\n 60000: 40475,\n 60001: 40478,\n 60002: 40565,\n 60003: 40569,\n 60004: 40573,\n 60005: 40577,\n 60006: 40584,\n 60007: 40587,\n 60008: 40588,\n 60009: 40594,\n 60010: 40597,\n 60011: 40593,\n 60012: 40605,\n 60013: 40613,\n 60014: 40617,\n 60015: 40632,\n 60016: 40618,\n 60017: 40621,\n 60018: 38753,\n 60019: 40652,\n 60020: 40654,\n 60021: 40655,\n 60022: 40656,\n 60023: 40660,\n 60024: 40668,\n 60025: 40670,\n 60026: 40669,\n 60027: 40672,\n 60028: 40677,\n 60029: 40680,\n 60030: 40687,\n 60032: 40692,\n 60033: 40694,\n 60034: 40695,\n 60035: 40697,\n 60036: 40699,\n 60037: 40700,\n 60038: 40701,\n 60039: 40711,\n 60040: 40712,\n 60041: 30391,\n 60042: 40725,\n 60043: 40737,\n 60044: 40748,\n 60045: 40766,\n 60046: 40778,\n 60047: 40786,\n 60048: 40788,\n 60049: 40803,\n 60050: 40799,\n 60051: 40800,\n 60052: 40801,\n 60053: 40806,\n 60054: 40807,\n 60055: 40812,\n 60056: 40810,\n 60057: 40823,\n 60058: 40818,\n 60059: 40822,\n 60060: 40853,\n 60061: 40860,\n 60062: 40864,\n 60063: 22575,\n 60064: 27079,\n 60065: 36953,\n 60066: 29796,\n 60067: 20956,\n 60068: 29081,\n 60736: 32394,\n 60737: 35100,\n 60738: 37704,\n 60739: 37512,\n 60740: 34012,\n 60741: 20425,\n 60742: 28859,\n 60743: 26161,\n 60744: 26824,\n 60745: 37625,\n 60746: 26363,\n 60747: 24389,\n 60748: 20008,\n 60749: 20193,\n 60750: 20220,\n 60751: 20224,\n 60752: 20227,\n 60753: 20281,\n 60754: 20310,\n 60755: 20370,\n 60756: 20362,\n 60757: 20378,\n 60758: 20372,\n 60759: 20429,\n 60760: 20544,\n 60761: 20514,\n 60762: 20479,\n 60763: 20510,\n 60764: 20550,\n 60765: 20592,\n 60766: 20546,\n 60767: 20628,\n 60768: 20724,\n 60769: 20696,\n 60770: 20810,\n 60771: 20836,\n 60772: 20893,\n 60773: 20926,\n 60774: 20972,\n 60775: 21013,\n 60776: 21148,\n 60777: 21158,\n 60778: 21184,\n 60779: 21211,\n 60780: 21248,\n 60781: 21255,\n 60782: 21284,\n 60783: 21362,\n 60784: 21395,\n 60785: 21426,\n 60786: 21469,\n 60787: 64014,\n 60788: 21660,\n 60789: 21642,\n 60790: 21673,\n 60791: 21759,\n 60792: 21894,\n 60793: 22361,\n 60794: 22373,\n 60795: 22444,\n 60796: 22472,\n 60797: 22471,\n 60798: 64015,\n 60800: 64016,\n 60801: 22686,\n 60802: 22706,\n 60803: 22795,\n 60804: 22867,\n 60805: 22875,\n 60806: 22877,\n 60807: 22883,\n 60808: 22948,\n 60809: 22970,\n 60810: 23382,\n 60811: 23488,\n 60812: 29999,\n 60813: 23512,\n 60814: 23532,\n 60815: 23582,\n 60816: 23718,\n 60817: 23738,\n 60818: 23797,\n 60819: 23847,\n 60820: 23891,\n 60821: 64017,\n 60822: 23874,\n 60823: 23917,\n 60824: 23992,\n 60825: 23993,\n 60826: 24016,\n 60827: 24353,\n 60828: 24372,\n 60829: 24423,\n 60830: 24503,\n 60831: 24542,\n 60832: 24669,\n 60833: 24709,\n 60834: 24714,\n 60835: 24798,\n 60836: 24789,\n 60837: 24864,\n 60838: 24818,\n 60839: 24849,\n 60840: 24887,\n 60841: 24880,\n 60842: 24984,\n 60843: 25107,\n 60844: 25254,\n 60845: 25589,\n 60846: 25696,\n 60847: 25757,\n 60848: 25806,\n 60849: 25934,\n 60850: 26112,\n 60851: 26133,\n 60852: 26171,\n 60853: 26121,\n 60854: 26158,\n 60855: 26142,\n 60856: 26148,\n 60857: 26213,\n 60858: 26199,\n 60859: 26201,\n 60860: 64018,\n 60861: 26227,\n 60862: 26265,\n 60863: 26272,\n 60864: 26290,\n 60865: 26303,\n 60866: 26362,\n 60867: 26382,\n 60868: 63785,\n 60869: 26470,\n 60870: 26555,\n 60871: 26706,\n 60872: 26560,\n 60873: 26625,\n 60874: 26692,\n 60875: 26831,\n 60876: 64019,\n 60877: 26984,\n 60878: 64020,\n 60879: 27032,\n 60880: 27106,\n 60881: 27184,\n 60882: 27243,\n 60883: 27206,\n 60884: 27251,\n 60885: 27262,\n 60886: 27362,\n 60887: 27364,\n 60888: 27606,\n 60889: 27711,\n 60890: 27740,\n 60891: 27782,\n 60892: 27759,\n 60893: 27866,\n 60894: 27908,\n 60895: 28039,\n 60896: 28015,\n 60897: 28054,\n 60898: 28076,\n 60899: 28111,\n 60900: 28152,\n 60901: 28146,\n 60902: 28156,\n 60903: 28217,\n 60904: 28252,\n 60905: 28199,\n 60906: 28220,\n 60907: 28351,\n 60908: 28552,\n 60909: 28597,\n 60910: 28661,\n 60911: 28677,\n 60912: 28679,\n 60913: 28712,\n 60914: 28805,\n 60915: 28843,\n 60916: 28943,\n 60917: 28932,\n 60918: 29020,\n 60919: 28998,\n 60920: 28999,\n 60921: 64021,\n 60922: 29121,\n 60923: 29182,\n 60924: 29361,\n 60992: 29374,\n 60993: 29476,\n 60994: 64022,\n 60995: 29559,\n 60996: 29629,\n 60997: 29641,\n 60998: 29654,\n 60999: 29667,\n 61000: 29650,\n 61001: 29703,\n 61002: 29685,\n 61003: 29734,\n 61004: 29738,\n 61005: 29737,\n 61006: 29742,\n 61007: 29794,\n 61008: 29833,\n 61009: 29855,\n 61010: 29953,\n 61011: 30063,\n 61012: 30338,\n 61013: 30364,\n 61014: 30366,\n 61015: 30363,\n 61016: 30374,\n 61017: 64023,\n 61018: 30534,\n 61019: 21167,\n 61020: 30753,\n 61021: 30798,\n 61022: 30820,\n 61023: 30842,\n 61024: 31024,\n 61025: 64024,\n 61026: 64025,\n 61027: 64026,\n 61028: 31124,\n 61029: 64027,\n 61030: 31131,\n 61031: 31441,\n 61032: 31463,\n 61033: 64028,\n 61034: 31467,\n 61035: 31646,\n 61036: 64029,\n 61037: 32072,\n 61038: 32092,\n 61039: 32183,\n 61040: 32160,\n 61041: 32214,\n 61042: 32338,\n 61043: 32583,\n 61044: 32673,\n 61045: 64030,\n 61046: 33537,\n 61047: 33634,\n 61048: 33663,\n 61049: 33735,\n 61050: 33782,\n 61051: 33864,\n 61052: 33972,\n 61053: 34131,\n 61054: 34137,\n 61056: 34155,\n 61057: 64031,\n 61058: 34224,\n 61059: 64032,\n 61060: 64033,\n 61061: 34823,\n 61062: 35061,\n 61063: 35346,\n 61064: 35383,\n 61065: 35449,\n 61066: 35495,\n 61067: 35518,\n 61068: 35551,\n 61069: 64034,\n 61070: 35574,\n 61071: 35667,\n 61072: 35711,\n 61073: 36080,\n 61074: 36084,\n 61075: 36114,\n 61076: 36214,\n 61077: 64035,\n 61078: 36559,\n 61079: 64036,\n 61080: 64037,\n 61081: 36967,\n 61082: 37086,\n 61083: 64038,\n 61084: 37141,\n 61085: 37159,\n 61086: 37338,\n 61087: 37335,\n 61088: 37342,\n 61089: 37357,\n 61090: 37358,\n 61091: 37348,\n 61092: 37349,\n 61093: 37382,\n 61094: 37392,\n 61095: 37386,\n 61096: 37434,\n 61097: 37440,\n 61098: 37436,\n 61099: 37454,\n 61100: 37465,\n 61101: 37457,\n 61102: 37433,\n 61103: 37479,\n 61104: 37543,\n 61105: 37495,\n 61106: 37496,\n 61107: 37607,\n 61108: 37591,\n 61109: 37593,\n 61110: 37584,\n 61111: 64039,\n 61112: 37589,\n 61113: 37600,\n 61114: 37587,\n 61115: 37669,\n 61116: 37665,\n 61117: 37627,\n 61118: 64040,\n 61119: 37662,\n 61120: 37631,\n 61121: 37661,\n 61122: 37634,\n 61123: 37744,\n 61124: 37719,\n 61125: 37796,\n 61126: 37830,\n 61127: 37854,\n 61128: 37880,\n 61129: 37937,\n 61130: 37957,\n 61131: 37960,\n 61132: 38290,\n 61133: 63964,\n 61134: 64041,\n 61135: 38557,\n 61136: 38575,\n 61137: 38707,\n 61138: 38715,\n 61139: 38723,\n 61140: 38733,\n 61141: 38735,\n 61142: 38737,\n 61143: 38741,\n 61144: 38999,\n 61145: 39013,\n 61146: 64042,\n 61147: 64043,\n 61148: 39207,\n 61149: 64044,\n 61150: 39326,\n 61151: 39502,\n 61152: 39641,\n 61153: 39644,\n 61154: 39797,\n 61155: 39794,\n 61156: 39823,\n 61157: 39857,\n 61158: 39867,\n 61159: 39936,\n 61160: 40304,\n 61161: 40299,\n 61162: 64045,\n 61163: 40473,\n 61164: 40657,\n 61167: 8560,\n 61168: 8561,\n 61169: 8562,\n 61170: 8563,\n 61171: 8564,\n 61172: 8565,\n 61173: 8566,\n 61174: 8567,\n 61175: 8568,\n 61176: 8569,\n 61177: 65506,\n 61178: 65508,\n 61179: 65287,\n 61180: 65282,\n 61504: 57344,\n 61505: 57345,\n 61506: 57346,\n 61507: 57347,\n 61508: 57348,\n 61509: 57349,\n 61510: 57350,\n 61511: 57351,\n 61512: 57352,\n 61513: 57353,\n 61514: 57354,\n 61515: 57355,\n 61516: 57356,\n 61517: 57357,\n 61518: 57358,\n 61519: 57359,\n 61520: 57360,\n 61521: 57361,\n 61522: 57362,\n 61523: 57363,\n 61524: 57364,\n 61525: 57365,\n 61526: 57366,\n 61527: 57367,\n 61528: 57368,\n 61529: 57369,\n 61530: 57370,\n 61531: 57371,\n 61532: 57372,\n 61533: 57373,\n 61534: 57374,\n 61535: 57375,\n 61536: 57376,\n 61537: 57377,\n 61538: 57378,\n 61539: 57379,\n 61540: 57380,\n 61541: 57381,\n 61542: 57382,\n 61543: 57383,\n 61544: 57384,\n 61545: 57385,\n 61546: 57386,\n 61547: 57387,\n 61548: 57388,\n 61549: 57389,\n 61550: 57390,\n 61551: 57391,\n 61552: 57392,\n 61553: 57393,\n 61554: 57394,\n 61555: 57395,\n 61556: 57396,\n 61557: 57397,\n 61558: 57398,\n 61559: 57399,\n 61560: 57400,\n 61561: 57401,\n 61562: 57402,\n 61563: 57403,\n 61564: 57404,\n 61565: 57405,\n 61566: 57406,\n 61568: 57407,\n 61569: 57408,\n 61570: 57409,\n 61571: 57410,\n 61572: 57411,\n 61573: 57412,\n 61574: 57413,\n 61575: 57414,\n 61576: 57415,\n 61577: 57416,\n 61578: 57417,\n 61579: 57418,\n 61580: 57419,\n 61581: 57420,\n 61582: 57421,\n 61583: 57422,\n 61584: 57423,\n 61585: 57424,\n 61586: 57425,\n 61587: 57426,\n 61588: 57427,\n 61589: 57428,\n 61590: 57429,\n 61591: 57430,\n 61592: 57431,\n 61593: 57432,\n 61594: 57433,\n 61595: 57434,\n 61596: 57435,\n 61597: 57436,\n 61598: 57437,\n 61599: 57438,\n 61600: 57439,\n 61601: 57440,\n 61602: 57441,\n 61603: 57442,\n 61604: 57443,\n 61605: 57444,\n 61606: 57445,\n 61607: 57446,\n 61608: 57447,\n 61609: 57448,\n 61610: 57449,\n 61611: 57450,\n 61612: 57451,\n 61613: 57452,\n 61614: 57453,\n 61615: 57454,\n 61616: 57455,\n 61617: 57456,\n 61618: 57457,\n 61619: 57458,\n 61620: 57459,\n 61621: 57460,\n 61622: 57461,\n 61623: 57462,\n 61624: 57463,\n 61625: 57464,\n 61626: 57465,\n 61627: 57466,\n 61628: 57467,\n 61629: 57468,\n 61630: 57469,\n 61631: 57470,\n 61632: 57471,\n 61633: 57472,\n 61634: 57473,\n 61635: 57474,\n 61636: 57475,\n 61637: 57476,\n 61638: 57477,\n 61639: 57478,\n 61640: 57479,\n 61641: 57480,\n 61642: 57481,\n 61643: 57482,\n 61644: 57483,\n 61645: 57484,\n 61646: 57485,\n 61647: 57486,\n 61648: 57487,\n 61649: 57488,\n 61650: 57489,\n 61651: 57490,\n 61652: 57491,\n 61653: 57492,\n 61654: 57493,\n 61655: 57494,\n 61656: 57495,\n 61657: 57496,\n 61658: 57497,\n 61659: 57498,\n 61660: 57499,\n 61661: 57500,\n 61662: 57501,\n 61663: 57502,\n 61664: 57503,\n 61665: 57504,\n 61666: 57505,\n 61667: 57506,\n 61668: 57507,\n 61669: 57508,\n 61670: 57509,\n 61671: 57510,\n 61672: 57511,\n 61673: 57512,\n 61674: 57513,\n 61675: 57514,\n 61676: 57515,\n 61677: 57516,\n 61678: 57517,\n 61679: 57518,\n 61680: 57519,\n 61681: 57520,\n 61682: 57521,\n 61683: 57522,\n 61684: 57523,\n 61685: 57524,\n 61686: 57525,\n 61687: 57526,\n 61688: 57527,\n 61689: 57528,\n 61690: 57529,\n 61691: 57530,\n 61692: 57531,\n 61760: 57532,\n 61761: 57533,\n 61762: 57534,\n 61763: 57535,\n 61764: 57536,\n 61765: 57537,\n 61766: 57538,\n 61767: 57539,\n 61768: 57540,\n 61769: 57541,\n 61770: 57542,\n 61771: 57543,\n 61772: 57544,\n 61773: 57545,\n 61774: 57546,\n 61775: 57547,\n 61776: 57548,\n 61777: 57549,\n 61778: 57550,\n 61779: 57551,\n 61780: 57552,\n 61781: 57553,\n 61782: 57554,\n 61783: 57555,\n 61784: 57556,\n 61785: 57557,\n 61786: 57558,\n 61787: 57559,\n 61788: 57560,\n 61789: 57561,\n 61790: 57562,\n 61791: 57563,\n 61792: 57564,\n 61793: 57565,\n 61794: 57566,\n 61795: 57567,\n 61796: 57568,\n 61797: 57569,\n 61798: 57570,\n 61799: 57571,\n 61800: 57572,\n 61801: 57573,\n 61802: 57574,\n 61803: 57575,\n 61804: 57576,\n 61805: 57577,\n 61806: 57578,\n 61807: 57579,\n 61808: 57580,\n 61809: 57581,\n 61810: 57582,\n 61811: 57583,\n 61812: 57584,\n 61813: 57585,\n 61814: 57586,\n 61815: 57587,\n 61816: 57588,\n 61817: 57589,\n 61818: 57590,\n 61819: 57591,\n 61820: 57592,\n 61821: 57593,\n 61822: 57594,\n 61824: 57595,\n 61825: 57596,\n 61826: 57597,\n 61827: 57598,\n 61828: 57599,\n 61829: 57600,\n 61830: 57601,\n 61831: 57602,\n 61832: 57603,\n 61833: 57604,\n 61834: 57605,\n 61835: 57606,\n 61836: 57607,\n 61837: 57608,\n 61838: 57609,\n 61839: 57610,\n 61840: 57611,\n 61841: 57612,\n 61842: 57613,\n 61843: 57614,\n 61844: 57615,\n 61845: 57616,\n 61846: 57617,\n 61847: 57618,\n 61848: 57619,\n 61849: 57620,\n 61850: 57621,\n 61851: 57622,\n 61852: 57623,\n 61853: 57624,\n 61854: 57625,\n 61855: 57626,\n 61856: 57627,\n 61857: 57628,\n 61858: 57629,\n 61859: 57630,\n 61860: 57631,\n 61861: 57632,\n 61862: 57633,\n 61863: 57634,\n 61864: 57635,\n 61865: 57636,\n 61866: 57637,\n 61867: 57638,\n 61868: 57639,\n 61869: 57640,\n 61870: 57641,\n 61871: 57642,\n 61872: 57643,\n 61873: 57644,\n 61874: 57645,\n 61875: 57646,\n 61876: 57647,\n 61877: 57648,\n 61878: 57649,\n 61879: 57650,\n 61880: 57651,\n 61881: 57652,\n 61882: 57653,\n 61883: 57654,\n 61884: 57655,\n 61885: 57656,\n 61886: 57657,\n 61887: 57658,\n 61888: 57659,\n 61889: 57660,\n 61890: 57661,\n 61891: 57662,\n 61892: 57663,\n 61893: 57664,\n 61894: 57665,\n 61895: 57666,\n 61896: 57667,\n 61897: 57668,\n 61898: 57669,\n 61899: 57670,\n 61900: 57671,\n 61901: 57672,\n 61902: 57673,\n 61903: 57674,\n 61904: 57675,\n 61905: 57676,\n 61906: 57677,\n 61907: 57678,\n 61908: 57679,\n 61909: 57680,\n 61910: 57681,\n 61911: 57682,\n 61912: 57683,\n 61913: 57684,\n 61914: 57685,\n 61915: 57686,\n 61916: 57687,\n 61917: 57688,\n 61918: 57689,\n 61919: 57690,\n 61920: 57691,\n 61921: 57692,\n 61922: 57693,\n 61923: 57694,\n 61924: 57695,\n 61925: 57696,\n 61926: 57697,\n 61927: 57698,\n 61928: 57699,\n 61929: 57700,\n 61930: 57701,\n 61931: 57702,\n 61932: 57703,\n 61933: 57704,\n 61934: 57705,\n 61935: 57706,\n 61936: 57707,\n 61937: 57708,\n 61938: 57709,\n 61939: 57710,\n 61940: 57711,\n 61941: 57712,\n 61942: 57713,\n 61943: 57714,\n 61944: 57715,\n 61945: 57716,\n 61946: 57717,\n 61947: 57718,\n 61948: 57719,\n 62016: 57720,\n 62017: 57721,\n 62018: 57722,\n 62019: 57723,\n 62020: 57724,\n 62021: 57725,\n 62022: 57726,\n 62023: 57727,\n 62024: 57728,\n 62025: 57729,\n 62026: 57730,\n 62027: 57731,\n 62028: 57732,\n 62029: 57733,\n 62030: 57734,\n 62031: 57735,\n 62032: 57736,\n 62033: 57737,\n 62034: 57738,\n 62035: 57739,\n 62036: 57740,\n 62037: 57741,\n 62038: 57742,\n 62039: 57743,\n 62040: 57744,\n 62041: 57745,\n 62042: 57746,\n 62043: 57747,\n 62044: 57748,\n 62045: 57749,\n 62046: 57750,\n 62047: 57751,\n 62048: 57752,\n 62049: 57753,\n 62050: 57754,\n 62051: 57755,\n 62052: 57756,\n 62053: 57757,\n 62054: 57758,\n 62055: 57759,\n 62056: 57760,\n 62057: 57761,\n 62058: 57762,\n 62059: 57763,\n 62060: 57764,\n 62061: 57765,\n 62062: 57766,\n 62063: 57767,\n 62064: 57768,\n 62065: 57769,\n 62066: 57770,\n 62067: 57771,\n 62068: 57772,\n 62069: 57773,\n 62070: 57774,\n 62071: 57775,\n 62072: 57776,\n 62073: 57777,\n 62074: 57778,\n 62075: 57779,\n 62076: 57780,\n 62077: 57781,\n 62078: 57782,\n 62080: 57783,\n 62081: 57784,\n 62082: 57785,\n 62083: 57786,\n 62084: 57787,\n 62085: 57788,\n 62086: 57789,\n 62087: 57790,\n 62088: 57791,\n 62089: 57792,\n 62090: 57793,\n 62091: 57794,\n 62092: 57795,\n 62093: 57796,\n 62094: 57797,\n 62095: 57798,\n 62096: 57799,\n 62097: 57800,\n 62098: 57801,\n 62099: 57802,\n 62100: 57803,\n 62101: 57804,\n 62102: 57805,\n 62103: 57806,\n 62104: 57807,\n 62105: 57808,\n 62106: 57809,\n 62107: 57810,\n 62108: 57811,\n 62109: 57812,\n 62110: 57813,\n 62111: 57814,\n 62112: 57815,\n 62113: 57816,\n 62114: 57817,\n 62115: 57818,\n 62116: 57819,\n 62117: 57820,\n 62118: 57821,\n 62119: 57822,\n 62120: 57823,\n 62121: 57824,\n 62122: 57825,\n 62123: 57826,\n 62124: 57827,\n 62125: 57828,\n 62126: 57829,\n 62127: 57830,\n 62128: 57831,\n 62129: 57832,\n 62130: 57833,\n 62131: 57834,\n 62132: 57835,\n 62133: 57836,\n 62134: 57837,\n 62135: 57838,\n 62136: 57839,\n 62137: 57840,\n 62138: 57841,\n 62139: 57842,\n 62140: 57843,\n 62141: 57844,\n 62142: 57845,\n 62143: 57846,\n 62144: 57847,\n 62145: 57848,\n 62146: 57849,\n 62147: 57850,\n 62148: 57851,\n 62149: 57852,\n 62150: 57853,\n 62151: 57854,\n 62152: 57855,\n 62153: 57856,\n 62154: 57857,\n 62155: 57858,\n 62156: 57859,\n 62157: 57860,\n 62158: 57861,\n 62159: 57862,\n 62160: 57863,\n 62161: 57864,\n 62162: 57865,\n 62163: 57866,\n 62164: 57867,\n 62165: 57868,\n 62166: 57869,\n 62167: 57870,\n 62168: 57871,\n 62169: 57872,\n 62170: 57873,\n 62171: 57874,\n 62172: 57875,\n 62173: 57876,\n 62174: 57877,\n 62175: 57878,\n 62176: 57879,\n 62177: 57880,\n 62178: 57881,\n 62179: 57882,\n 62180: 57883,\n 62181: 57884,\n 62182: 57885,\n 62183: 57886,\n 62184: 57887,\n 62185: 57888,\n 62186: 57889,\n 62187: 57890,\n 62188: 57891,\n 62189: 57892,\n 62190: 57893,\n 62191: 57894,\n 62192: 57895,\n 62193: 57896,\n 62194: 57897,\n 62195: 57898,\n 62196: 57899,\n 62197: 57900,\n 62198: 57901,\n 62199: 57902,\n 62200: 57903,\n 62201: 57904,\n 62202: 57905,\n 62203: 57906,\n 62204: 57907,\n 62272: 57908,\n 62273: 57909,\n 62274: 57910,\n 62275: 57911,\n 62276: 57912,\n 62277: 57913,\n 62278: 57914,\n 62279: 57915,\n 62280: 57916,\n 62281: 57917,\n 62282: 57918,\n 62283: 57919,\n 62284: 57920,\n 62285: 57921,\n 62286: 57922,\n 62287: 57923,\n 62288: 57924,\n 62289: 57925,\n 62290: 57926,\n 62291: 57927,\n 62292: 57928,\n 62293: 57929,\n 62294: 57930,\n 62295: 57931,\n 62296: 57932,\n 62297: 57933,\n 62298: 57934,\n 62299: 57935,\n 62300: 57936,\n 62301: 57937,\n 62302: 57938,\n 62303: 57939,\n 62304: 57940,\n 62305: 57941,\n 62306: 57942,\n 62307: 57943,\n 62308: 57944,\n 62309: 57945,\n 62310: 57946,\n 62311: 57947,\n 62312: 57948,\n 62313: 57949,\n 62314: 57950,\n 62315: 57951,\n 62316: 57952,\n 62317: 57953,\n 62318: 57954,\n 62319: 57955,\n 62320: 57956,\n 62321: 57957,\n 62322: 57958,\n 62323: 57959,\n 62324: 57960,\n 62325: 57961,\n 62326: 57962,\n 62327: 57963,\n 62328: 57964,\n 62329: 57965,\n 62330: 57966,\n 62331: 57967,\n 62332: 57968,\n 62333: 57969,\n 62334: 57970,\n 62336: 57971,\n 62337: 57972,\n 62338: 57973,\n 62339: 57974,\n 62340: 57975,\n 62341: 57976,\n 62342: 57977,\n 62343: 57978,\n 62344: 57979,\n 62345: 57980,\n 62346: 57981,\n 62347: 57982,\n 62348: 57983,\n 62349: 57984,\n 62350: 57985,\n 62351: 57986,\n 62352: 57987,\n 62353: 57988,\n 62354: 57989,\n 62355: 57990,\n 62356: 57991,\n 62357: 57992,\n 62358: 57993,\n 62359: 57994,\n 62360: 57995,\n 62361: 57996,\n 62362: 57997,\n 62363: 57998,\n 62364: 57999,\n 62365: 58000,\n 62366: 58001,\n 62367: 58002,\n 62368: 58003,\n 62369: 58004,\n 62370: 58005,\n 62371: 58006,\n 62372: 58007,\n 62373: 58008,\n 62374: 58009,\n 62375: 58010,\n 62376: 58011,\n 62377: 58012,\n 62378: 58013,\n 62379: 58014,\n 62380: 58015,\n 62381: 58016,\n 62382: 58017,\n 62383: 58018,\n 62384: 58019,\n 62385: 58020,\n 62386: 58021,\n 62387: 58022,\n 62388: 58023,\n 62389: 58024,\n 62390: 58025,\n 62391: 58026,\n 62392: 58027,\n 62393: 58028,\n 62394: 58029,\n 62395: 58030,\n 62396: 58031,\n 62397: 58032,\n 62398: 58033,\n 62399: 58034,\n 62400: 58035,\n 62401: 58036,\n 62402: 58037,\n 62403: 58038,\n 62404: 58039,\n 62405: 58040,\n 62406: 58041,\n 62407: 58042,\n 62408: 58043,\n 62409: 58044,\n 62410: 58045,\n 62411: 58046,\n 62412: 58047,\n 62413: 58048,\n 62414: 58049,\n 62415: 58050,\n 62416: 58051,\n 62417: 58052,\n 62418: 58053,\n 62419: 58054,\n 62420: 58055,\n 62421: 58056,\n 62422: 58057,\n 62423: 58058,\n 62424: 58059,\n 62425: 58060,\n 62426: 58061,\n 62427: 58062,\n 62428: 58063,\n 62429: 58064,\n 62430: 58065,\n 62431: 58066,\n 62432: 58067,\n 62433: 58068,\n 62434: 58069,\n 62435: 58070,\n 62436: 58071,\n 62437: 58072,\n 62438: 58073,\n 62439: 58074,\n 62440: 58075,\n 62441: 58076,\n 62442: 58077,\n 62443: 58078,\n 62444: 58079,\n 62445: 58080,\n 62446: 58081,\n 62447: 58082,\n 62448: 58083,\n 62449: 58084,\n 62450: 58085,\n 62451: 58086,\n 62452: 58087,\n 62453: 58088,\n 62454: 58089,\n 62455: 58090,\n 62456: 58091,\n 62457: 58092,\n 62458: 58093,\n 62459: 58094,\n 62460: 58095,\n 62528: 58096,\n 62529: 58097,\n 62530: 58098,\n 62531: 58099,\n 62532: 58100,\n 62533: 58101,\n 62534: 58102,\n 62535: 58103,\n 62536: 58104,\n 62537: 58105,\n 62538: 58106,\n 62539: 58107,\n 62540: 58108,\n 62541: 58109,\n 62542: 58110,\n 62543: 58111,\n 62544: 58112,\n 62545: 58113,\n 62546: 58114,\n 62547: 58115,\n 62548: 58116,\n 62549: 58117,\n 62550: 58118,\n 62551: 58119,\n 62552: 58120,\n 62553: 58121,\n 62554: 58122,\n 62555: 58123,\n 62556: 58124,\n 62557: 58125,\n 62558: 58126,\n 62559: 58127,\n 62560: 58128,\n 62561: 58129,\n 62562: 58130,\n 62563: 58131,\n 62564: 58132,\n 62565: 58133,\n 62566: 58134,\n 62567: 58135,\n 62568: 58136,\n 62569: 58137,\n 62570: 58138,\n 62571: 58139,\n 62572: 58140,\n 62573: 58141,\n 62574: 58142,\n 62575: 58143,\n 62576: 58144,\n 62577: 58145,\n 62578: 58146,\n 62579: 58147,\n 62580: 58148,\n 62581: 58149,\n 62582: 58150,\n 62583: 58151,\n 62584: 58152,\n 62585: 58153,\n 62586: 58154,\n 62587: 58155,\n 62588: 58156,\n 62589: 58157,\n 62590: 58158,\n 62592: 58159,\n 62593: 58160,\n 62594: 58161,\n 62595: 58162,\n 62596: 58163,\n 62597: 58164,\n 62598: 58165,\n 62599: 58166,\n 62600: 58167,\n 62601: 58168,\n 62602: 58169,\n 62603: 58170,\n 62604: 58171,\n 62605: 58172,\n 62606: 58173,\n 62607: 58174,\n 62608: 58175,\n 62609: 58176,\n 62610: 58177,\n 62611: 58178,\n 62612: 58179,\n 62613: 58180,\n 62614: 58181,\n 62615: 58182,\n 62616: 58183,\n 62617: 58184,\n 62618: 58185,\n 62619: 58186,\n 62620: 58187,\n 62621: 58188,\n 62622: 58189,\n 62623: 58190,\n 62624: 58191,\n 62625: 58192,\n 62626: 58193,\n 62627: 58194,\n 62628: 58195,\n 62629: 58196,\n 62630: 58197,\n 62631: 58198,\n 62632: 58199,\n 62633: 58200,\n 62634: 58201,\n 62635: 58202,\n 62636: 58203,\n 62637: 58204,\n 62638: 58205,\n 62639: 58206,\n 62640: 58207,\n 62641: 58208,\n 62642: 58209,\n 62643: 58210,\n 62644: 58211,\n 62645: 58212,\n 62646: 58213,\n 62647: 58214,\n 62648: 58215,\n 62649: 58216,\n 62650: 58217,\n 62651: 58218,\n 62652: 58219,\n 62653: 58220,\n 62654: 58221,\n 62655: 58222,\n 62656: 58223,\n 62657: 58224,\n 62658: 58225,\n 62659: 58226,\n 62660: 58227,\n 62661: 58228,\n 62662: 58229,\n 62663: 58230,\n 62664: 58231,\n 62665: 58232,\n 62666: 58233,\n 62667: 58234,\n 62668: 58235,\n 62669: 58236,\n 62670: 58237,\n 62671: 58238,\n 62672: 58239,\n 62673: 58240,\n 62674: 58241,\n 62675: 58242,\n 62676: 58243,\n 62677: 58244,\n 62678: 58245,\n 62679: 58246,\n 62680: 58247,\n 62681: 58248,\n 62682: 58249,\n 62683: 58250,\n 62684: 58251,\n 62685: 58252,\n 62686: 58253,\n 62687: 58254,\n 62688: 58255,\n 62689: 58256,\n 62690: 58257,\n 62691: 58258,\n 62692: 58259,\n 62693: 58260,\n 62694: 58261,\n 62695: 58262,\n 62696: 58263,\n 62697: 58264,\n 62698: 58265,\n 62699: 58266,\n 62700: 58267,\n 62701: 58268,\n 62702: 58269,\n 62703: 58270,\n 62704: 58271,\n 62705: 58272,\n 62706: 58273,\n 62707: 58274,\n 62708: 58275,\n 62709: 58276,\n 62710: 58277,\n 62711: 58278,\n 62712: 58279,\n 62713: 58280,\n 62714: 58281,\n 62715: 58282,\n 62716: 58283,\n 62784: 58284,\n 62785: 58285,\n 62786: 58286,\n 62787: 58287,\n 62788: 58288,\n 62789: 58289,\n 62790: 58290,\n 62791: 58291,\n 62792: 58292,\n 62793: 58293,\n 62794: 58294,\n 62795: 58295,\n 62796: 58296,\n 62797: 58297,\n 62798: 58298,\n 62799: 58299,\n 62800: 58300,\n 62801: 58301,\n 62802: 58302,\n 62803: 58303,\n 62804: 58304,\n 62805: 58305,\n 62806: 58306,\n 62807: 58307,\n 62808: 58308,\n 62809: 58309,\n 62810: 58310,\n 62811: 58311,\n 62812: 58312,\n 62813: 58313,\n 62814: 58314,\n 62815: 58315,\n 62816: 58316,\n 62817: 58317,\n 62818: 58318,\n 62819: 58319,\n 62820: 58320,\n 62821: 58321,\n 62822: 58322,\n 62823: 58323,\n 62824: 58324,\n 62825: 58325,\n 62826: 58326,\n 62827: 58327,\n 62828: 58328,\n 62829: 58329,\n 62830: 58330,\n 62831: 58331,\n 62832: 58332,\n 62833: 58333,\n 62834: 58334,\n 62835: 58335,\n 62836: 58336,\n 62837: 58337,\n 62838: 58338,\n 62839: 58339,\n 62840: 58340,\n 62841: 58341,\n 62842: 58342,\n 62843: 58343,\n 62844: 58344,\n 62845: 58345,\n 62846: 58346,\n 62848: 58347,\n 62849: 58348,\n 62850: 58349,\n 62851: 58350,\n 62852: 58351,\n 62853: 58352,\n 62854: 58353,\n 62855: 58354,\n 62856: 58355,\n 62857: 58356,\n 62858: 58357,\n 62859: 58358,\n 62860: 58359,\n 62861: 58360,\n 62862: 58361,\n 62863: 58362,\n 62864: 58363,\n 62865: 58364,\n 62866: 58365,\n 62867: 58366,\n 62868: 58367,\n 62869: 58368,\n 62870: 58369,\n 62871: 58370,\n 62872: 58371,\n 62873: 58372,\n 62874: 58373,\n 62875: 58374,\n 62876: 58375,\n 62877: 58376,\n 62878: 58377,\n 62879: 58378,\n 62880: 58379,\n 62881: 58380,\n 62882: 58381,\n 62883: 58382,\n 62884: 58383,\n 62885: 58384,\n 62886: 58385,\n 62887: 58386,\n 62888: 58387,\n 62889: 58388,\n 62890: 58389,\n 62891: 58390,\n 62892: 58391,\n 62893: 58392,\n 62894: 58393,\n 62895: 58394,\n 62896: 58395,\n 62897: 58396,\n 62898: 58397,\n 62899: 58398,\n 62900: 58399,\n 62901: 58400,\n 62902: 58401,\n 62903: 58402,\n 62904: 58403,\n 62905: 58404,\n 62906: 58405,\n 62907: 58406,\n 62908: 58407,\n 62909: 58408,\n 62910: 58409,\n 62911: 58410,\n 62912: 58411,\n 62913: 58412,\n 62914: 58413,\n 62915: 58414,\n 62916: 58415,\n 62917: 58416,\n 62918: 58417,\n 62919: 58418,\n 62920: 58419,\n 62921: 58420,\n 62922: 58421,\n 62923: 58422,\n 62924: 58423,\n 62925: 58424,\n 62926: 58425,\n 62927: 58426,\n 62928: 58427,\n 62929: 58428,\n 62930: 58429,\n 62931: 58430,\n 62932: 58431,\n 62933: 58432,\n 62934: 58433,\n 62935: 58434,\n 62936: 58435,\n 62937: 58436,\n 62938: 58437,\n 62939: 58438,\n 62940: 58439,\n 62941: 58440,\n 62942: 58441,\n 62943: 58442,\n 62944: 58443,\n 62945: 58444,\n 62946: 58445,\n 62947: 58446,\n 62948: 58447,\n 62949: 58448,\n 62950: 58449,\n 62951: 58450,\n 62952: 58451,\n 62953: 58452,\n 62954: 58453,\n 62955: 58454,\n 62956: 58455,\n 62957: 58456,\n 62958: 58457,\n 62959: 58458,\n 62960: 58459,\n 62961: 58460,\n 62962: 58461,\n 62963: 58462,\n 62964: 58463,\n 62965: 58464,\n 62966: 58465,\n 62967: 58466,\n 62968: 58467,\n 62969: 58468,\n 62970: 58469,\n 62971: 58470,\n 62972: 58471,\n 63040: 58472,\n 63041: 58473,\n 63042: 58474,\n 63043: 58475,\n 63044: 58476,\n 63045: 58477,\n 63046: 58478,\n 63047: 58479,\n 63048: 58480,\n 63049: 58481,\n 63050: 58482,\n 63051: 58483,\n 63052: 58484,\n 63053: 58485,\n 63054: 58486,\n 63055: 58487,\n 63056: 58488,\n 63057: 58489,\n 63058: 58490,\n 63059: 58491,\n 63060: 58492,\n 63061: 58493,\n 63062: 58494,\n 63063: 58495,\n 63064: 58496,\n 63065: 58497,\n 63066: 58498,\n 63067: 58499,\n 63068: 58500,\n 63069: 58501,\n 63070: 58502,\n 63071: 58503,\n 63072: 58504,\n 63073: 58505,\n 63074: 58506,\n 63075: 58507,\n 63076: 58508,\n 63077: 58509,\n 63078: 58510,\n 63079: 58511,\n 63080: 58512,\n 63081: 58513,\n 63082: 58514,\n 63083: 58515,\n 63084: 58516,\n 63085: 58517,\n 63086: 58518,\n 63087: 58519,\n 63088: 58520,\n 63089: 58521,\n 63090: 58522,\n 63091: 58523,\n 63092: 58524,\n 63093: 58525,\n 63094: 58526,\n 63095: 58527,\n 63096: 58528,\n 63097: 58529,\n 63098: 58530,\n 63099: 58531,\n 63100: 58532,\n 63101: 58533,\n 63102: 58534,\n 63104: 58535,\n 63105: 58536,\n 63106: 58537,\n 63107: 58538,\n 63108: 58539,\n 63109: 58540,\n 63110: 58541,\n 63111: 58542,\n 63112: 58543,\n 63113: 58544,\n 63114: 58545,\n 63115: 58546,\n 63116: 58547,\n 63117: 58548,\n 63118: 58549,\n 63119: 58550,\n 63120: 58551,\n 63121: 58552,\n 63122: 58553,\n 63123: 58554,\n 63124: 58555,\n 63125: 58556,\n 63126: 58557,\n 63127: 58558,\n 63128: 58559,\n 63129: 58560,\n 63130: 58561,\n 63131: 58562,\n 63132: 58563,\n 63133: 58564,\n 63134: 58565,\n 63135: 58566,\n 63136: 58567,\n 63137: 58568,\n 63138: 58569,\n 63139: 58570,\n 63140: 58571,\n 63141: 58572,\n 63142: 58573,\n 63143: 58574,\n 63144: 58575,\n 63145: 58576,\n 63146: 58577,\n 63147: 58578,\n 63148: 58579,\n 63149: 58580,\n 63150: 58581,\n 63151: 58582,\n 63152: 58583,\n 63153: 58584,\n 63154: 58585,\n 63155: 58586,\n 63156: 58587,\n 63157: 58588,\n 63158: 58589,\n 63159: 58590,\n 63160: 58591,\n 63161: 58592,\n 63162: 58593,\n 63163: 58594,\n 63164: 58595,\n 63165: 58596,\n 63166: 58597,\n 63167: 58598,\n 63168: 58599,\n 63169: 58600,\n 63170: 58601,\n 63171: 58602,\n 63172: 58603,\n 63173: 58604,\n 63174: 58605,\n 63175: 58606,\n 63176: 58607,\n 63177: 58608,\n 63178: 58609,\n 63179: 58610,\n 63180: 58611,\n 63181: 58612,\n 63182: 58613,\n 63183: 58614,\n 63184: 58615,\n 63185: 58616,\n 63186: 58617,\n 63187: 58618,\n 63188: 58619,\n 63189: 58620,\n 63190: 58621,\n 63191: 58622,\n 63192: 58623,\n 63193: 58624,\n 63194: 58625,\n 63195: 58626,\n 63196: 58627,\n 63197: 58628,\n 63198: 58629,\n 63199: 58630,\n 63200: 58631,\n 63201: 58632,\n 63202: 58633,\n 63203: 58634,\n 63204: 58635,\n 63205: 58636,\n 63206: 58637,\n 63207: 58638,\n 63208: 58639,\n 63209: 58640,\n 63210: 58641,\n 63211: 58642,\n 63212: 58643,\n 63213: 58644,\n 63214: 58645,\n 63215: 58646,\n 63216: 58647,\n 63217: 58648,\n 63218: 58649,\n 63219: 58650,\n 63220: 58651,\n 63221: 58652,\n 63222: 58653,\n 63223: 58654,\n 63224: 58655,\n 63225: 58656,\n 63226: 58657,\n 63227: 58658,\n 63228: 58659,\n 63296: 58660,\n 63297: 58661,\n 63298: 58662,\n 63299: 58663,\n 63300: 58664,\n 63301: 58665,\n 63302: 58666,\n 63303: 58667,\n 63304: 58668,\n 63305: 58669,\n 63306: 58670,\n 63307: 58671,\n 63308: 58672,\n 63309: 58673,\n 63310: 58674,\n 63311: 58675,\n 63312: 58676,\n 63313: 58677,\n 63314: 58678,\n 63315: 58679,\n 63316: 58680,\n 63317: 58681,\n 63318: 58682,\n 63319: 58683,\n 63320: 58684,\n 63321: 58685,\n 63322: 58686,\n 63323: 58687,\n 63324: 58688,\n 63325: 58689,\n 63326: 58690,\n 63327: 58691,\n 63328: 58692,\n 63329: 58693,\n 63330: 58694,\n 63331: 58695,\n 63332: 58696,\n 63333: 58697,\n 63334: 58698,\n 63335: 58699,\n 63336: 58700,\n 63337: 58701,\n 63338: 58702,\n 63339: 58703,\n 63340: 58704,\n 63341: 58705,\n 63342: 58706,\n 63343: 58707,\n 63344: 58708,\n 63345: 58709,\n 63346: 58710,\n 63347: 58711,\n 63348: 58712,\n 63349: 58713,\n 63350: 58714,\n 63351: 58715,\n 63352: 58716,\n 63353: 58717,\n 63354: 58718,\n 63355: 58719,\n 63356: 58720,\n 63357: 58721,\n 63358: 58722,\n 63360: 58723,\n 63361: 58724,\n 63362: 58725,\n 63363: 58726,\n 63364: 58727,\n 63365: 58728,\n 63366: 58729,\n 63367: 58730,\n 63368: 58731,\n 63369: 58732,\n 63370: 58733,\n 63371: 58734,\n 63372: 58735,\n 63373: 58736,\n 63374: 58737,\n 63375: 58738,\n 63376: 58739,\n 63377: 58740,\n 63378: 58741,\n 63379: 58742,\n 63380: 58743,\n 63381: 58744,\n 63382: 58745,\n 63383: 58746,\n 63384: 58747,\n 63385: 58748,\n 63386: 58749,\n 63387: 58750,\n 63388: 58751,\n 63389: 58752,\n 63390: 58753,\n 63391: 58754,\n 63392: 58755,\n 63393: 58756,\n 63394: 58757,\n 63395: 58758,\n 63396: 58759,\n 63397: 58760,\n 63398: 58761,\n 63399: 58762,\n 63400: 58763,\n 63401: 58764,\n 63402: 58765,\n 63403: 58766,\n 63404: 58767,\n 63405: 58768,\n 63406: 58769,\n 63407: 58770,\n 63408: 58771,\n 63409: 58772,\n 63410: 58773,\n 63411: 58774,\n 63412: 58775,\n 63413: 58776,\n 63414: 58777,\n 63415: 58778,\n 63416: 58779,\n 63417: 58780,\n 63418: 58781,\n 63419: 58782,\n 63420: 58783,\n 63421: 58784,\n 63422: 58785,\n 63423: 58786,\n 63424: 58787,\n 63425: 58788,\n 63426: 58789,\n 63427: 58790,\n 63428: 58791,\n 63429: 58792,\n 63430: 58793,\n 63431: 58794,\n 63432: 58795,\n 63433: 58796,\n 63434: 58797,\n 63435: 58798,\n 63436: 58799,\n 63437: 58800,\n 63438: 58801,\n 63439: 58802,\n 63440: 58803,\n 63441: 58804,\n 63442: 58805,\n 63443: 58806,\n 63444: 58807,\n 63445: 58808,\n 63446: 58809,\n 63447: 58810,\n 63448: 58811,\n 63449: 58812,\n 63450: 58813,\n 63451: 58814,\n 63452: 58815,\n 63453: 58816,\n 63454: 58817,\n 63455: 58818,\n 63456: 58819,\n 63457: 58820,\n 63458: 58821,\n 63459: 58822,\n 63460: 58823,\n 63461: 58824,\n 63462: 58825,\n 63463: 58826,\n 63464: 58827,\n 63465: 58828,\n 63466: 58829,\n 63467: 58830,\n 63468: 58831,\n 63469: 58832,\n 63470: 58833,\n 63471: 58834,\n 63472: 58835,\n 63473: 58836,\n 63474: 58837,\n 63475: 58838,\n 63476: 58839,\n 63477: 58840,\n 63478: 58841,\n 63479: 58842,\n 63480: 58843,\n 63481: 58844,\n 63482: 58845,\n 63483: 58846,\n 63484: 58847,\n 63552: 58848,\n 63553: 58849,\n 63554: 58850,\n 63555: 58851,\n 63556: 58852,\n 63557: 58853,\n 63558: 58854,\n 63559: 58855,\n 63560: 58856,\n 63561: 58857,\n 63562: 58858,\n 63563: 58859,\n 63564: 58860,\n 63565: 58861,\n 63566: 58862,\n 63567: 58863,\n 63568: 58864,\n 63569: 58865,\n 63570: 58866,\n 63571: 58867,\n 63572: 58868,\n 63573: 58869,\n 63574: 58870,\n 63575: 58871,\n 63576: 58872,\n 63577: 58873,\n 63578: 58874,\n 63579: 58875,\n 63580: 58876,\n 63581: 58877,\n 63582: 58878,\n 63583: 58879,\n 63584: 58880,\n 63585: 58881,\n 63586: 58882,\n 63587: 58883,\n 63588: 58884,\n 63589: 58885,\n 63590: 58886,\n 63591: 58887,\n 63592: 58888,\n 63593: 58889,\n 63594: 58890,\n 63595: 58891,\n 63596: 58892,\n 63597: 58893,\n 63598: 58894,\n 63599: 58895,\n 63600: 58896,\n 63601: 58897,\n 63602: 58898,\n 63603: 58899,\n 63604: 58900,\n 63605: 58901,\n 63606: 58902,\n 63607: 58903,\n 63608: 58904,\n 63609: 58905,\n 63610: 58906,\n 63611: 58907,\n 63612: 58908,\n 63613: 58909,\n 63614: 58910,\n 63616: 58911,\n 63617: 58912,\n 63618: 58913,\n 63619: 58914,\n 63620: 58915,\n 63621: 58916,\n 63622: 58917,\n 63623: 58918,\n 63624: 58919,\n 63625: 58920,\n 63626: 58921,\n 63627: 58922,\n 63628: 58923,\n 63629: 58924,\n 63630: 58925,\n 63631: 58926,\n 63632: 58927,\n 63633: 58928,\n 63634: 58929,\n 63635: 58930,\n 63636: 58931,\n 63637: 58932,\n 63638: 58933,\n 63639: 58934,\n 63640: 58935,\n 63641: 58936,\n 63642: 58937,\n 63643: 58938,\n 63644: 58939,\n 63645: 58940,\n 63646: 58941,\n 63647: 58942,\n 63648: 58943,\n 63649: 58944,\n 63650: 58945,\n 63651: 58946,\n 63652: 58947,\n 63653: 58948,\n 63654: 58949,\n 63655: 58950,\n 63656: 58951,\n 63657: 58952,\n 63658: 58953,\n 63659: 58954,\n 63660: 58955,\n 63661: 58956,\n 63662: 58957,\n 63663: 58958,\n 63664: 58959,\n 63665: 58960,\n 63666: 58961,\n 63667: 58962,\n 63668: 58963,\n 63669: 58964,\n 63670: 58965,\n 63671: 58966,\n 63672: 58967,\n 63673: 58968,\n 63674: 58969,\n 63675: 58970,\n 63676: 58971,\n 63677: 58972,\n 63678: 58973,\n 63679: 58974,\n 63680: 58975,\n 63681: 58976,\n 63682: 58977,\n 63683: 58978,\n 63684: 58979,\n 63685: 58980,\n 63686: 58981,\n 63687: 58982,\n 63688: 58983,\n 63689: 58984,\n 63690: 58985,\n 63691: 58986,\n 63692: 58987,\n 63693: 58988,\n 63694: 58989,\n 63695: 58990,\n 63696: 58991,\n 63697: 58992,\n 63698: 58993,\n 63699: 58994,\n 63700: 58995,\n 63701: 58996,\n 63702: 58997,\n 63703: 58998,\n 63704: 58999,\n 63705: 59000,\n 63706: 59001,\n 63707: 59002,\n 63708: 59003,\n 63709: 59004,\n 63710: 59005,\n 63711: 59006,\n 63712: 59007,\n 63713: 59008,\n 63714: 59009,\n 63715: 59010,\n 63716: 59011,\n 63717: 59012,\n 63718: 59013,\n 63719: 59014,\n 63720: 59015,\n 63721: 59016,\n 63722: 59017,\n 63723: 59018,\n 63724: 59019,\n 63725: 59020,\n 63726: 59021,\n 63727: 59022,\n 63728: 59023,\n 63729: 59024,\n 63730: 59025,\n 63731: 59026,\n 63732: 59027,\n 63733: 59028,\n 63734: 59029,\n 63735: 59030,\n 63736: 59031,\n 63737: 59032,\n 63738: 59033,\n 63739: 59034,\n 63740: 59035,\n 64064: 8560,\n 64065: 8561,\n 64066: 8562,\n 64067: 8563,\n 64068: 8564,\n 64069: 8565,\n 64070: 8566,\n 64071: 8567,\n 64072: 8568,\n 64073: 8569,\n 64074: 8544,\n 64075: 8545,\n 64076: 8546,\n 64077: 8547,\n 64078: 8548,\n 64079: 8549,\n 64080: 8550,\n 64081: 8551,\n 64082: 8552,\n 64083: 8553,\n 64084: 65506,\n 64085: 65508,\n 64086: 65287,\n 64087: 65282,\n 64088: 12849,\n 64089: 8470,\n 64090: 8481,\n 64091: 8757,\n 64092: 32394,\n 64093: 35100,\n 64094: 37704,\n 64095: 37512,\n 64096: 34012,\n 64097: 20425,\n 64098: 28859,\n 64099: 26161,\n 64100: 26824,\n 64101: 37625,\n 64102: 26363,\n 64103: 24389,\n 64104: 20008,\n 64105: 20193,\n 64106: 20220,\n 64107: 20224,\n 64108: 20227,\n 64109: 20281,\n 64110: 20310,\n 64111: 20370,\n 64112: 20362,\n 64113: 20378,\n 64114: 20372,\n 64115: 20429,\n 64116: 20544,\n 64117: 20514,\n 64118: 20479,\n 64119: 20510,\n 64120: 20550,\n 64121: 20592,\n 64122: 20546,\n 64123: 20628,\n 64124: 20724,\n 64125: 20696,\n 64126: 20810,\n 64128: 20836,\n 64129: 20893,\n 64130: 20926,\n 64131: 20972,\n 64132: 21013,\n 64133: 21148,\n 64134: 21158,\n 64135: 21184,\n 64136: 21211,\n 64137: 21248,\n 64138: 21255,\n 64139: 21284,\n 64140: 21362,\n 64141: 21395,\n 64142: 21426,\n 64143: 21469,\n 64144: 64014,\n 64145: 21660,\n 64146: 21642,\n 64147: 21673,\n 64148: 21759,\n 64149: 21894,\n 64150: 22361,\n 64151: 22373,\n 64152: 22444,\n 64153: 22472,\n 64154: 22471,\n 64155: 64015,\n 64156: 64016,\n 64157: 22686,\n 64158: 22706,\n 64159: 22795,\n 64160: 22867,\n 64161: 22875,\n 64162: 22877,\n 64163: 22883,\n 64164: 22948,\n 64165: 22970,\n 64166: 23382,\n 64167: 23488,\n 64168: 29999,\n 64169: 23512,\n 64170: 23532,\n 64171: 23582,\n 64172: 23718,\n 64173: 23738,\n 64174: 23797,\n 64175: 23847,\n 64176: 23891,\n 64177: 64017,\n 64178: 23874,\n 64179: 23917,\n 64180: 23992,\n 64181: 23993,\n 64182: 24016,\n 64183: 24353,\n 64184: 24372,\n 64185: 24423,\n 64186: 24503,\n 64187: 24542,\n 64188: 24669,\n 64189: 24709,\n 64190: 24714,\n 64191: 24798,\n 64192: 24789,\n 64193: 24864,\n 64194: 24818,\n 64195: 24849,\n 64196: 24887,\n 64197: 24880,\n 64198: 24984,\n 64199: 25107,\n 64200: 25254,\n 64201: 25589,\n 64202: 25696,\n 64203: 25757,\n 64204: 25806,\n 64205: 25934,\n 64206: 26112,\n 64207: 26133,\n 64208: 26171,\n 64209: 26121,\n 64210: 26158,\n 64211: 26142,\n 64212: 26148,\n 64213: 26213,\n 64214: 26199,\n 64215: 26201,\n 64216: 64018,\n 64217: 26227,\n 64218: 26265,\n 64219: 26272,\n 64220: 26290,\n 64221: 26303,\n 64222: 26362,\n 64223: 26382,\n 64224: 63785,\n 64225: 26470,\n 64226: 26555,\n 64227: 26706,\n 64228: 26560,\n 64229: 26625,\n 64230: 26692,\n 64231: 26831,\n 64232: 64019,\n 64233: 26984,\n 64234: 64020,\n 64235: 27032,\n 64236: 27106,\n 64237: 27184,\n 64238: 27243,\n 64239: 27206,\n 64240: 27251,\n 64241: 27262,\n 64242: 27362,\n 64243: 27364,\n 64244: 27606,\n 64245: 27711,\n 64246: 27740,\n 64247: 27782,\n 64248: 27759,\n 64249: 27866,\n 64250: 27908,\n 64251: 28039,\n 64252: 28015,\n 64320: 28054,\n 64321: 28076,\n 64322: 28111,\n 64323: 28152,\n 64324: 28146,\n 64325: 28156,\n 64326: 28217,\n 64327: 28252,\n 64328: 28199,\n 64329: 28220,\n 64330: 28351,\n 64331: 28552,\n 64332: 28597,\n 64333: 28661,\n 64334: 28677,\n 64335: 28679,\n 64336: 28712,\n 64337: 28805,\n 64338: 28843,\n 64339: 28943,\n 64340: 28932,\n 64341: 29020,\n 64342: 28998,\n 64343: 28999,\n 64344: 64021,\n 64345: 29121,\n 64346: 29182,\n 64347: 29361,\n 64348: 29374,\n 64349: 29476,\n 64350: 64022,\n 64351: 29559,\n 64352: 29629,\n 64353: 29641,\n 64354: 29654,\n 64355: 29667,\n 64356: 29650,\n 64357: 29703,\n 64358: 29685,\n 64359: 29734,\n 64360: 29738,\n 64361: 29737,\n 64362: 29742,\n 64363: 29794,\n 64364: 29833,\n 64365: 29855,\n 64366: 29953,\n 64367: 30063,\n 64368: 30338,\n 64369: 30364,\n 64370: 30366,\n 64371: 30363,\n 64372: 30374,\n 64373: 64023,\n 64374: 30534,\n 64375: 21167,\n 64376: 30753,\n 64377: 30798,\n 64378: 30820,\n 64379: 30842,\n 64380: 31024,\n 64381: 64024,\n 64382: 64025,\n 64384: 64026,\n 64385: 31124,\n 64386: 64027,\n 64387: 31131,\n 64388: 31441,\n 64389: 31463,\n 64390: 64028,\n 64391: 31467,\n 64392: 31646,\n 64393: 64029,\n 64394: 32072,\n 64395: 32092,\n 64396: 32183,\n 64397: 32160,\n 64398: 32214,\n 64399: 32338,\n 64400: 32583,\n 64401: 32673,\n 64402: 64030,\n 64403: 33537,\n 64404: 33634,\n 64405: 33663,\n 64406: 33735,\n 64407: 33782,\n 64408: 33864,\n 64409: 33972,\n 64410: 34131,\n 64411: 34137,\n 64412: 34155,\n 64413: 64031,\n 64414: 34224,\n 64415: 64032,\n 64416: 64033,\n 64417: 34823,\n 64418: 35061,\n 64419: 35346,\n 64420: 35383,\n 64421: 35449,\n 64422: 35495,\n 64423: 35518,\n 64424: 35551,\n 64425: 64034,\n 64426: 35574,\n 64427: 35667,\n 64428: 35711,\n 64429: 36080,\n 64430: 36084,\n 64431: 36114,\n 64432: 36214,\n 64433: 64035,\n 64434: 36559,\n 64435: 64036,\n 64436: 64037,\n 64437: 36967,\n 64438: 37086,\n 64439: 64038,\n 64440: 37141,\n 64441: 37159,\n 64442: 37338,\n 64443: 37335,\n 64444: 37342,\n 64445: 37357,\n 64446: 37358,\n 64447: 37348,\n 64448: 37349,\n 64449: 37382,\n 64450: 37392,\n 64451: 37386,\n 64452: 37434,\n 64453: 37440,\n 64454: 37436,\n 64455: 37454,\n 64456: 37465,\n 64457: 37457,\n 64458: 37433,\n 64459: 37479,\n 64460: 37543,\n 64461: 37495,\n 64462: 37496,\n 64463: 37607,\n 64464: 37591,\n 64465: 37593,\n 64466: 37584,\n 64467: 64039,\n 64468: 37589,\n 64469: 37600,\n 64470: 37587,\n 64471: 37669,\n 64472: 37665,\n 64473: 37627,\n 64474: 64040,\n 64475: 37662,\n 64476: 37631,\n 64477: 37661,\n 64478: 37634,\n 64479: 37744,\n 64480: 37719,\n 64481: 37796,\n 64482: 37830,\n 64483: 37854,\n 64484: 37880,\n 64485: 37937,\n 64486: 37957,\n 64487: 37960,\n 64488: 38290,\n 64489: 63964,\n 64490: 64041,\n 64491: 38557,\n 64492: 38575,\n 64493: 38707,\n 64494: 38715,\n 64495: 38723,\n 64496: 38733,\n 64497: 38735,\n 64498: 38737,\n 64499: 38741,\n 64500: 38999,\n 64501: 39013,\n 64502: 64042,\n 64503: 64043,\n 64504: 39207,\n 64505: 64044,\n 64506: 39326,\n 64507: 39502,\n 64508: 39641,\n 64576: 39644,\n 64577: 39797,\n 64578: 39794,\n 64579: 39823,\n 64580: 39857,\n 64581: 39867,\n 64582: 39936,\n 64583: 40304,\n 64584: 40299,\n 64585: 64045,\n 64586: 40473,\n 64587: 40657,\n }\n }\n\n /*\n * Converts from Shift_JIS Uint8Array data to Unicode strings.\n */\n s2u(uint8Array) {\n var t = this.s2uTable\n var str = ''\n var p = 0\n\n while (p < uint8Array.length) {\n var key = uint8Array[p++]\n\n if (!((key >= 0x00 && key <= 0x7e) || (key >= 0xa1 && key <= 0xdf)) && p < uint8Array.length) {\n key = (key << 8) | uint8Array[p++]\n }\n\n if (t[key] === undefined) {\n console.error('unknown char code ' + key + '.')\n return str\n }\n\n str += String.fromCharCode(t[key])\n }\n\n return str\n }\n}\n\n/**\n * @author takahiro / https://github.com/takahirox\n */\n\nclass DataViewEx {\n constructor(buffer, littleEndian) {\n this.dv = new DataView(buffer)\n this.offset = 0\n this.littleEndian = littleEndian !== undefined ? littleEndian : true\n this.encoder = new CharsetEncoder()\n }\n getInt8() {\n var value = this.dv.getInt8(this.offset)\n this.offset += 1\n return value\n }\n getInt8Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getInt8())\n }\n\n return a\n }\n getUint8() {\n var value = this.dv.getUint8(this.offset)\n this.offset += 1\n return value\n }\n getUint8Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getUint8())\n }\n\n return a\n }\n getInt16() {\n var value = this.dv.getInt16(this.offset, this.littleEndian)\n this.offset += 2\n return value\n }\n getInt16Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getInt16())\n }\n\n return a\n }\n getUint16() {\n var value = this.dv.getUint16(this.offset, this.littleEndian)\n this.offset += 2\n return value\n }\n getUint16Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getUint16())\n }\n\n return a\n }\n getInt32() {\n var value = this.dv.getInt32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n getInt32Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getInt32())\n }\n\n return a\n }\n getUint32() {\n var value = this.dv.getUint32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n getUint32Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getUint32())\n }\n\n return a\n }\n getFloat32() {\n var value = this.dv.getFloat32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n getFloat32Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getFloat32())\n }\n\n return a\n }\n getFloat64() {\n var value = this.dv.getFloat64(this.offset, this.littleEndian)\n this.offset += 8\n return value\n }\n getFloat64Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getFloat64())\n }\n\n return a\n }\n getIndex(type, isUnsigned) {\n switch (type) {\n case 1:\n return isUnsigned === true ? this.getUint8() : this.getInt8()\n\n case 2:\n return isUnsigned === true ? this.getUint16() : this.getInt16()\n\n case 4:\n return this.getInt32() // No Uint32\n\n default:\n throw 'unknown number type ' + type + ' exception.'\n }\n }\n getIndexArray(type, size, isUnsigned) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getIndex(type, isUnsigned))\n }\n\n return a\n }\n getChars(size) {\n var str = ''\n\n while (size > 0) {\n var value = this.getUint8()\n size--\n\n if (value === 0) {\n break\n }\n\n str += String.fromCharCode(value)\n }\n\n while (size > 0) {\n this.getUint8()\n size--\n }\n\n return str\n }\n getSjisStringsAsUnicode(size) {\n var a = []\n\n while (size > 0) {\n var value = this.getUint8()\n size--\n\n if (value === 0) {\n break\n }\n\n a.push(value)\n }\n\n while (size > 0) {\n this.getUint8()\n size--\n }\n\n return this.encoder.s2u(new Uint8Array(a))\n }\n getUnicodeStrings(size) {\n var str = ''\n\n while (size > 0) {\n var value = this.getUint16()\n size -= 2\n\n if (value === 0) {\n break\n }\n\n str += String.fromCharCode(value)\n }\n\n while (size > 0) {\n this.getUint8()\n size--\n }\n\n return str\n }\n getTextBuffer() {\n var size = this.getUint32()\n return this.getUnicodeStrings(size)\n }\n}\n\n\n/**\n * @author takahiro / https://github.com/takahirox\n */\n\nclass DataCreationHelper {\n leftToRightVector3(v) {\n v[2] = -v[2]\n }\n\n leftToRightQuaternion(q) {\n q[0] = -q[0]\n q[1] = -q[1]\n }\n\n leftToRightEuler(r) {\n r[0] = -r[0]\n r[1] = -r[1]\n }\n\n leftToRightIndexOrder(p) {\n var tmp = p[2]\n p[2] = p[0]\n p[0] = tmp\n }\n\n leftToRightVector3Range(v1, v2) {\n var tmp = -v2[2]\n v2[2] = -v1[2]\n v1[2] = tmp\n }\n\n leftToRightEulerRange(r1, r2) {\n var tmp1 = -r2[0]\n var tmp2 = -r2[1]\n r2[0] = -r1[0]\n r2[1] = -r1[1]\n r1[0] = tmp1\n r1[1] = tmp2\n }\n}\n\n/**\n * @author takahiro / https://github.com/takahirox\n */\n\nclass Parser {\n constructor() { }\n parsePmd(buffer, leftToRight) {\n var pmd = {}\n var dv = new DataViewEx(buffer)\n\n pmd.metadata = {}\n pmd.metadata.format = 'pmd'\n pmd.metadata.coordinateSystem = 'left'\n\n var parseHeader = function () {\n var metadata = pmd.metadata\n metadata.magic = dv.getChars(3)\n\n if (metadata.magic !== 'Pmd') {\n throw 'PMD file magic is not Pmd, but ' + metadata.magic\n }\n\n metadata.version = dv.getFloat32()\n metadata.modelName = dv.getSjisStringsAsUnicode(20)\n metadata.comment = dv.getSjisStringsAsUnicode(256)\n }\n\n var parseVertices = function () {\n var parseVertex = function () {\n var p = {}\n p.position = dv.getFloat32Array(3)\n p.normal = dv.getFloat32Array(3)\n p.uv = dv.getFloat32Array(2)\n p.skinIndices = dv.getUint16Array(2)\n p.skinWeights = [dv.getUint8() / 100]\n p.skinWeights.push(1.0 - p.skinWeights[0])\n p.edgeFlag = dv.getUint8()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.vertexCount = dv.getUint32()\n\n pmd.vertices = []\n\n for (var i = 0; i < metadata.vertexCount; i++) {\n pmd.vertices.push(parseVertex())\n }\n }\n\n var parseFaces = function () {\n var parseFace = function () {\n var p = {}\n p.indices = dv.getUint16Array(3)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.faceCount = dv.getUint32() / 3\n\n pmd.faces = []\n\n for (var i = 0; i < metadata.faceCount; i++) {\n pmd.faces.push(parseFace())\n }\n }\n\n var parseMaterials = function () {\n var parseMaterial = function () {\n var p = {}\n p.diffuse = dv.getFloat32Array(4)\n p.shininess = dv.getFloat32()\n p.specular = dv.getFloat32Array(3)\n p.ambient = dv.getFloat32Array(3)\n p.toonIndex = dv.getInt8()\n p.edgeFlag = dv.getUint8()\n p.faceCount = dv.getUint32() / 3\n p.fileName = dv.getSjisStringsAsUnicode(20)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.materialCount = dv.getUint32()\n\n pmd.materials = []\n\n for (var i = 0; i < metadata.materialCount; i++) {\n pmd.materials.push(parseMaterial())\n }\n }\n\n var parseBones = function () {\n var parseBone = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.parentIndex = dv.getInt16()\n p.tailIndex = dv.getInt16()\n p.type = dv.getUint8()\n p.ikIndex = dv.getInt16()\n p.position = dv.getFloat32Array(3)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.boneCount = dv.getUint16()\n\n pmd.bones = []\n\n for (var i = 0; i < metadata.boneCount; i++) {\n pmd.bones.push(parseBone())\n }\n }\n\n var parseIks = function () {\n var parseIk = function () {\n var p = {}\n p.target = dv.getUint16()\n p.effector = dv.getUint16()\n p.linkCount = dv.getUint8()\n p.iteration = dv.getUint16()\n p.maxAngle = dv.getFloat32()\n\n p.links = []\n for (var i = 0; i < p.linkCount; i++) {\n var link = {}\n link.index = dv.getUint16()\n p.links.push(link)\n }\n\n return p\n }\n\n var metadata = pmd.metadata\n metadata.ikCount = dv.getUint16()\n\n pmd.iks = []\n\n for (var i = 0; i < metadata.ikCount; i++) {\n pmd.iks.push(parseIk())\n }\n }\n\n var parseMorphs = function () {\n var parseMorph = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.elementCount = dv.getUint32()\n p.type = dv.getUint8()\n\n p.elements = []\n for (var i = 0; i < p.elementCount; i++) {\n p.elements.push({\n index: dv.getUint32(),\n position: dv.getFloat32Array(3),\n })\n }\n\n return p\n }\n\n var metadata = pmd.metadata\n metadata.morphCount = dv.getUint16()\n\n pmd.morphs = []\n\n for (var i = 0; i < metadata.morphCount; i++) {\n pmd.morphs.push(parseMorph())\n }\n }\n\n var parseMorphFrames = function () {\n var parseMorphFrame = function () {\n var p = {}\n p.index = dv.getUint16()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.morphFrameCount = dv.getUint8()\n\n pmd.morphFrames = []\n\n for (var i = 0; i < metadata.morphFrameCount; i++) {\n pmd.morphFrames.push(parseMorphFrame())\n }\n }\n\n var parseBoneFrameNames = function () {\n var parseBoneFrameName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(50)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.boneFrameNameCount = dv.getUint8()\n\n pmd.boneFrameNames = []\n\n for (var i = 0; i < metadata.boneFrameNameCount; i++) {\n pmd.boneFrameNames.push(parseBoneFrameName())\n }\n }\n\n var parseBoneFrames = function () {\n var parseBoneFrame = function () {\n var p = {}\n p.boneIndex = dv.getInt16()\n p.frameIndex = dv.getUint8()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.boneFrameCount = dv.getUint32()\n\n pmd.boneFrames = []\n\n for (var i = 0; i < metadata.boneFrameCount; i++) {\n pmd.boneFrames.push(parseBoneFrame())\n }\n }\n\n var parseEnglishHeader = function () {\n var metadata = pmd.metadata\n metadata.englishCompatibility = dv.getUint8()\n\n if (metadata.englishCompatibility > 0) {\n metadata.englishModelName = dv.getSjisStringsAsUnicode(20)\n metadata.englishComment = dv.getSjisStringsAsUnicode(256)\n }\n }\n\n var parseEnglishBoneNames = function () {\n var parseEnglishBoneName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n return p\n }\n\n var metadata = pmd.metadata\n\n if (metadata.englishCompatibility === 0) {\n return\n }\n\n pmd.englishBoneNames = []\n\n for (var i = 0; i < metadata.boneCount; i++) {\n pmd.englishBoneNames.push(parseEnglishBoneName())\n }\n }\n\n var parseEnglishMorphNames = function () {\n var parseEnglishMorphName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n return p\n }\n\n var metadata = pmd.metadata\n\n if (metadata.englishCompatibility === 0) {\n return\n }\n\n pmd.englishMorphNames = []\n\n for (var i = 0; i < metadata.morphCount - 1; i++) {\n pmd.englishMorphNames.push(parseEnglishMorphName())\n }\n }\n\n var parseEnglishBoneFrameNames = function () {\n var parseEnglishBoneFrameName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(50)\n return p\n }\n\n var metadata = pmd.metadata\n\n if (metadata.englishCompatibility === 0) {\n return\n }\n\n pmd.englishBoneFrameNames = []\n\n for (var i = 0; i < metadata.boneFrameNameCount; i++) {\n pmd.englishBoneFrameNames.push(parseEnglishBoneFrameName())\n }\n }\n\n var parseToonTextures = function () {\n var parseToonTexture = function () {\n var p = {}\n p.fileName = dv.getSjisStringsAsUnicode(100)\n return p\n }\n\n pmd.toonTextures = []\n\n for (var i = 0; i < 10; i++) {\n pmd.toonTextures.push(parseToonTexture())\n }\n }\n\n var parseRigidBodies = function () {\n var parseRigidBody = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.boneIndex = dv.getInt16()\n p.groupIndex = dv.getUint8()\n p.groupTarget = dv.getUint16()\n p.shapeType = dv.getUint8()\n p.width = dv.getFloat32()\n p.height = dv.getFloat32()\n p.depth = dv.getFloat32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.weight = dv.getFloat32()\n p.positionDamping = dv.getFloat32()\n p.rotationDamping = dv.getFloat32()\n p.restitution = dv.getFloat32()\n p.friction = dv.getFloat32()\n p.type = dv.getUint8()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.rigidBodyCount = dv.getUint32()\n\n pmd.rigidBodies = []\n\n for (var i = 0; i < metadata.rigidBodyCount; i++) {\n pmd.rigidBodies.push(parseRigidBody())\n }\n }\n\n var parseConstraints = function () {\n var parseConstraint = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.rigidBodyIndex1 = dv.getUint32()\n p.rigidBodyIndex2 = dv.getUint32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.translationLimitation1 = dv.getFloat32Array(3)\n p.translationLimitation2 = dv.getFloat32Array(3)\n p.rotationLimitation1 = dv.getFloat32Array(3)\n p.rotationLimitation2 = dv.getFloat32Array(3)\n p.springPosition = dv.getFloat32Array(3)\n p.springRotation = dv.getFloat32Array(3)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.constraintCount = dv.getUint32()\n\n pmd.constraints = []\n\n for (var i = 0; i < metadata.constraintCount; i++) {\n pmd.constraints.push(parseConstraint())\n }\n }\n\n parseHeader()\n parseVertices()\n parseFaces()\n parseMaterials()\n parseBones()\n parseIks()\n parseMorphs()\n parseMorphFrames()\n parseBoneFrameNames()\n parseBoneFrames()\n parseEnglishHeader()\n parseEnglishBoneNames()\n parseEnglishMorphNames()\n parseEnglishBoneFrameNames()\n parseToonTextures()\n parseRigidBodies()\n parseConstraints()\n\n if (leftToRight === true) this.leftToRightModel(pmd)\n\n // console.log( pmd ); // for console debug\n return pmd\n }\n parsePmx(buffer, leftToRight) {\n var pmx = {}\n var dv = new DataViewEx(buffer)\n\n pmx.metadata = {}\n pmx.metadata.format = 'pmx'\n pmx.metadata.coordinateSystem = 'left'\n\n var parseHeader = function () {\n var metadata = pmx.metadata\n metadata.magic = dv.getChars(4)\n\n // Note: don't remove the last blank space.\n if (metadata.magic !== 'PMX ') {\n throw 'PMX file magic is not PMX , but ' + metadata.magic\n }\n\n metadata.version = dv.getFloat32()\n\n if (metadata.version !== 2.0 && metadata.version !== 2.1) {\n throw 'PMX version ' + metadata.version + ' is not supported.'\n }\n\n metadata.headerSize = dv.getUint8()\n metadata.encoding = dv.getUint8()\n metadata.additionalUvNum = dv.getUint8()\n metadata.vertexIndexSize = dv.getUint8()\n metadata.textureIndexSize = dv.getUint8()\n metadata.materialIndexSize = dv.getUint8()\n metadata.boneIndexSize = dv.getUint8()\n metadata.morphIndexSize = dv.getUint8()\n metadata.rigidBodyIndexSize = dv.getUint8()\n metadata.modelName = dv.getTextBuffer()\n metadata.englishModelName = dv.getTextBuffer()\n metadata.comment = dv.getTextBuffer()\n metadata.englishComment = dv.getTextBuffer()\n }\n\n var parseVertices = function () {\n var parseVertex = function () {\n var p = {}\n p.position = dv.getFloat32Array(3)\n p.normal = dv.getFloat32Array(3)\n p.uv = dv.getFloat32Array(2)\n\n p.auvs = []\n\n for (var i = 0; i < pmx.metadata.additionalUvNum; i++) {\n p.auvs.push(dv.getFloat32Array(4))\n }\n\n p.type = dv.getUint8()\n\n var indexSize = metadata.boneIndexSize\n\n if (p.type === 0) {\n // BDEF1\n p.skinIndices = dv.getIndexArray(indexSize, 1)\n p.skinWeights = [1.0]\n } else if (p.type === 1) {\n // BDEF2\n p.skinIndices = dv.getIndexArray(indexSize, 2)\n p.skinWeights = dv.getFloat32Array(1)\n p.skinWeights.push(1.0 - p.skinWeights[0])\n } else if (p.type === 2) {\n // BDEF4\n p.skinIndices = dv.getIndexArray(indexSize, 4)\n p.skinWeights = dv.getFloat32Array(4)\n } else if (p.type === 3) {\n // SDEF\n p.skinIndices = dv.getIndexArray(indexSize, 2)\n p.skinWeights = dv.getFloat32Array(1)\n p.skinWeights.push(1.0 - p.skinWeights[0])\n\n p.skinC = dv.getFloat32Array(3)\n p.skinR0 = dv.getFloat32Array(3)\n p.skinR1 = dv.getFloat32Array(3)\n\n // SDEF is not supported yet and is handled as BDEF2 so far.\n // TODO: SDEF support\n p.type = 1\n } else {\n throw 'unsupport bone type ' + p.type + ' exception.'\n }\n\n p.edgeRatio = dv.getFloat32()\n return p\n }\n\n var metadata = pmx.metadata\n metadata.vertexCount = dv.getUint32()\n\n pmx.vertices = []\n\n for (var i = 0; i < metadata.vertexCount; i++) {\n pmx.vertices.push(parseVertex())\n }\n }\n\n var parseFaces = function () {\n var parseFace = function () {\n var p = {}\n p.indices = dv.getIndexArray(metadata.vertexIndexSize, 3, true)\n return p\n }\n\n var metadata = pmx.metadata\n metadata.faceCount = dv.getUint32() / 3\n\n pmx.faces = []\n\n for (var i = 0; i < metadata.faceCount; i++) {\n pmx.faces.push(parseFace())\n }\n }\n\n var parseTextures = function () {\n var parseTexture = function () {\n return dv.getTextBuffer()\n }\n\n var metadata = pmx.metadata\n metadata.textureCount = dv.getUint32()\n\n pmx.textures = []\n\n for (var i = 0; i < metadata.textureCount; i++) {\n pmx.textures.push(parseTexture())\n }\n }\n\n var parseMaterials = function () {\n var parseMaterial = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.diffuse = dv.getFloat32Array(4)\n p.specular = dv.getFloat32Array(3)\n p.shininess = dv.getFloat32()\n p.ambient = dv.getFloat32Array(3)\n p.flag = dv.getUint8()\n p.edgeColor = dv.getFloat32Array(4)\n p.edgeSize = dv.getFloat32()\n p.textureIndex = dv.getIndex(pmx.metadata.textureIndexSize)\n p.envTextureIndex = dv.getIndex(pmx.metadata.textureIndexSize)\n p.envFlag = dv.getUint8()\n p.toonFlag = dv.getUint8()\n\n if (p.toonFlag === 0) {\n p.toonIndex = dv.getIndex(pmx.metadata.textureIndexSize)\n } else if (p.toonFlag === 1) {\n p.toonIndex = dv.getInt8()\n } else {\n throw 'unknown toon flag ' + p.toonFlag + ' exception.'\n }\n\n p.comment = dv.getTextBuffer()\n p.faceCount = dv.getUint32() / 3\n return p\n }\n\n var metadata = pmx.metadata\n metadata.materialCount = dv.getUint32()\n\n pmx.materials = []\n\n for (var i = 0; i < metadata.materialCount; i++) {\n pmx.materials.push(parseMaterial())\n }\n }\n\n var parseBones = function () {\n var parseBone = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.position = dv.getFloat32Array(3)\n p.parentIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n p.transformationClass = dv.getUint32()\n p.flag = dv.getUint16()\n\n if (p.flag & 0x1) {\n p.connectIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n } else {\n p.offsetPosition = dv.getFloat32Array(3)\n }\n\n if (p.flag & 0x100 || p.flag & 0x200) {\n // Note: I don't think Grant is an appropriate name\n // but I found that some English translated MMD tools use this term\n // so I've named it Grant so far.\n // I'd rename to more appropriate name from Grant later.\n var grant = {}\n\n grant.isLocal = (p.flag & 0x80) !== 0 ? true : false\n grant.affectRotation = (p.flag & 0x100) !== 0 ? true : false\n grant.affectPosition = (p.flag & 0x200) !== 0 ? true : false\n grant.parentIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n grant.ratio = dv.getFloat32()\n\n p.grant = grant\n }\n\n if (p.flag & 0x400) {\n p.fixAxis = dv.getFloat32Array(3)\n }\n\n if (p.flag & 0x800) {\n p.localXVector = dv.getFloat32Array(3)\n p.localZVector = dv.getFloat32Array(3)\n }\n\n if (p.flag & 0x2000) {\n p.key = dv.getUint32()\n }\n\n if (p.flag & 0x20) {\n var ik = {}\n\n ik.effector = dv.getIndex(pmx.metadata.boneIndexSize)\n ik.target = null\n ik.iteration = dv.getUint32()\n ik.maxAngle = dv.getFloat32()\n ik.linkCount = dv.getUint32()\n ik.links = []\n\n for (var i = 0; i < ik.linkCount; i++) {\n var link = {}\n link.index = dv.getIndex(pmx.metadata.boneIndexSize)\n link.angleLimitation = dv.getUint8()\n\n if (link.angleLimitation === 1) {\n link.lowerLimitationAngle = dv.getFloat32Array(3)\n link.upperLimitationAngle = dv.getFloat32Array(3)\n }\n\n ik.links.push(link)\n }\n\n p.ik = ik\n }\n\n return p\n }\n\n var metadata = pmx.metadata\n metadata.boneCount = dv.getUint32()\n\n pmx.bones = []\n\n for (var i = 0; i < metadata.boneCount; i++) {\n pmx.bones.push(parseBone())\n }\n }\n\n var parseMorphs = function () {\n var parseMorph = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.panel = dv.getUint8()\n p.type = dv.getUint8()\n p.elementCount = dv.getUint32()\n p.elements = []\n\n for (var i = 0; i < p.elementCount; i++) {\n if (p.type === 0) {\n // group morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.morphIndexSize)\n m.ratio = dv.getFloat32()\n p.elements.push(m)\n } else if (p.type === 1) {\n // vertex morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.vertexIndexSize, true)\n m.position = dv.getFloat32Array(3)\n p.elements.push(m)\n } else if (p.type === 2) {\n // bone morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.boneIndexSize)\n m.position = dv.getFloat32Array(3)\n m.rotation = dv.getFloat32Array(4)\n p.elements.push(m)\n } else if (p.type === 3) {\n // uv morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.vertexIndexSize, true)\n m.uv = dv.getFloat32Array(4)\n p.elements.push(m)\n } else if (p.type === 4) {\n // additional uv1\n // TODO: implement\n } else if (p.type === 5) {\n // additional uv2\n // TODO: implement\n } else if (p.type === 6) {\n // additional uv3\n // TODO: implement\n } else if (p.type === 7) {\n // additional uv4\n // TODO: implement\n } else if (p.type === 8) {\n // material morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.materialIndexSize)\n m.type = dv.getUint8()\n m.diffuse = dv.getFloat32Array(4)\n m.specular = dv.getFloat32Array(3)\n m.shininess = dv.getFloat32()\n m.ambient = dv.getFloat32Array(3)\n m.edgeColor = dv.getFloat32Array(4)\n m.edgeSize = dv.getFloat32()\n m.textureColor = dv.getFloat32Array(4)\n m.sphereTextureColor = dv.getFloat32Array(4)\n m.toonColor = dv.getFloat32Array(4)\n p.elements.push(m)\n }\n }\n\n return p\n }\n\n var metadata = pmx.metadata\n metadata.morphCount = dv.getUint32()\n\n pmx.morphs = []\n\n for (var i = 0; i < metadata.morphCount; i++) {\n pmx.morphs.push(parseMorph())\n }\n }\n\n var parseFrames = function () {\n var parseFrame = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.type = dv.getUint8()\n p.elementCount = dv.getUint32()\n p.elements = []\n\n for (var i = 0; i < p.elementCount; i++) {\n var e = {}\n e.target = dv.getUint8()\n e.index = e.target === 0 ? dv.getIndex(pmx.metadata.boneIndexSize) : dv.getIndex(pmx.metadata.morphIndexSize)\n p.elements.push(e)\n }\n\n return p\n }\n\n var metadata = pmx.metadata\n metadata.frameCount = dv.getUint32()\n\n pmx.frames = []\n\n for (var i = 0; i < metadata.frameCount; i++) {\n pmx.frames.push(parseFrame())\n }\n }\n\n var parseRigidBodies = function () {\n var parseRigidBody = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.boneIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n p.groupIndex = dv.getUint8()\n p.groupTarget = dv.getUint16()\n p.shapeType = dv.getUint8()\n p.width = dv.getFloat32()\n p.height = dv.getFloat32()\n p.depth = dv.getFloat32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.weight = dv.getFloat32()\n p.positionDamping = dv.getFloat32()\n p.rotationDamping = dv.getFloat32()\n p.restitution = dv.getFloat32()\n p.friction = dv.getFloat32()\n p.type = dv.getUint8()\n return p\n }\n\n var metadata = pmx.metadata\n metadata.rigidBodyCount = dv.getUint32()\n\n pmx.rigidBodies = []\n\n for (var i = 0; i < metadata.rigidBodyCount; i++) {\n pmx.rigidBodies.push(parseRigidBody())\n }\n }\n\n var parseConstraints = function () {\n var parseConstraint = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.type = dv.getUint8()\n p.rigidBodyIndex1 = dv.getIndex(pmx.metadata.rigidBodyIndexSize)\n p.rigidBodyIndex2 = dv.getIndex(pmx.metadata.rigidBodyIndexSize)\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.translationLimitation1 = dv.getFloat32Array(3)\n p.translationLimitation2 = dv.getFloat32Array(3)\n p.rotationLimitation1 = dv.getFloat32Array(3)\n p.rotationLimitation2 = dv.getFloat32Array(3)\n p.springPosition = dv.getFloat32Array(3)\n p.springRotation = dv.getFloat32Array(3)\n return p\n }\n\n var metadata = pmx.metadata\n metadata.constraintCount = dv.getUint32()\n\n pmx.constraints = []\n\n for (var i = 0; i < metadata.constraintCount; i++) {\n pmx.constraints.push(parseConstraint())\n }\n }\n\n parseHeader()\n parseVertices()\n parseFaces()\n parseTextures()\n parseMaterials()\n parseBones()\n parseMorphs()\n parseFrames()\n parseRigidBodies()\n parseConstraints()\n\n if (leftToRight === true) this.leftToRightModel(pmx)\n\n // console.log( pmx ); // for console debug\n return pmx\n }\n parseVmd(buffer, leftToRight) {\n var vmd = {}\n var dv = new DataViewEx(buffer)\n\n vmd.metadata = {}\n vmd.metadata.coordinateSystem = 'left'\n\n var parseHeader = function () {\n var metadata = vmd.metadata\n metadata.magic = dv.getChars(30)\n\n if (metadata.magic !== 'Vocaloid Motion Data 0002') {\n throw 'VMD file magic is not Vocaloid Motion Data 0002, but ' + metadata.magic\n }\n\n metadata.name = dv.getSjisStringsAsUnicode(20)\n }\n\n var parseMotions = function () {\n var parseMotion = function () {\n var p = {}\n p.boneName = dv.getSjisStringsAsUnicode(15)\n p.frameNum = dv.getUint32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(4)\n p.interpolation = dv.getUint8Array(64)\n return p\n }\n\n var metadata = vmd.metadata\n metadata.motionCount = dv.getUint32()\n\n vmd.motions = []\n for (var i = 0; i < metadata.motionCount; i++) {\n vmd.motions.push(parseMotion())\n }\n }\n\n var parseMorphs = function () {\n var parseMorph = function () {\n var p = {}\n p.morphName = dv.getSjisStringsAsUnicode(15)\n p.frameNum = dv.getUint32()\n p.weight = dv.getFloat32()\n return p\n }\n\n var metadata = vmd.metadata\n metadata.morphCount = dv.getUint32()\n\n vmd.morphs = []\n for (var i = 0; i < metadata.morphCount; i++) {\n vmd.morphs.push(parseMorph())\n }\n }\n\n var parseCameras = function () {\n var parseCamera = function () {\n var p = {}\n p.frameNum = dv.getUint32()\n p.distance = dv.getFloat32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.interpolation = dv.getUint8Array(24)\n p.fov = dv.getUint32()\n p.perspective = dv.getUint8()\n return p\n }\n\n var metadata = vmd.metadata\n metadata.cameraCount = dv.getUint32()\n\n vmd.cameras = []\n for (var i = 0; i < metadata.cameraCount; i++) {\n vmd.cameras.push(parseCamera())\n }\n }\n\n parseHeader()\n parseMotions()\n parseMorphs()\n parseCameras()\n\n if (leftToRight === true) this.leftToRightVmd(vmd)\n\n // console.log( vmd ); // for console debug\n return vmd\n }\n parseVpd(text, leftToRight) {\n var vpd = {}\n\n vpd.metadata = {}\n vpd.metadata.coordinateSystem = 'left'\n\n vpd.bones = []\n\n var commentPatternG = /\\/\\/\\w*(\\r|\\n|\\r\\n)/g\n var newlinePattern = /\\r|\\n|\\r\\n/\n\n var lines = text.replace(commentPatternG, '').split(newlinePattern)\n\n function throwError() {\n throw 'the file seems not vpd file.'\n }\n\n function checkMagic() {\n if (lines[0] !== 'Vocaloid Pose Data file') {\n throwError()\n }\n }\n\n function parseHeader() {\n if (lines.length < 4) {\n throwError()\n }\n\n vpd.metadata.parentFile = lines[2]\n vpd.metadata.boneCount = parseInt(lines[3])\n }\n\n function parseBones() {\n var boneHeaderPattern = /^\\s*(Bone[0-9]+)\\s*\\{\\s*(.*)$/\n var boneVectorPattern = /^\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*;/\n var boneQuaternionPattern = /^\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*;/\n var boneFooterPattern = /^\\s*}/\n\n var bones = vpd.bones\n var n = null\n var v = null\n var q = null\n\n for (var i = 4; i < lines.length; i++) {\n var line = lines[i]\n\n var result\n\n result = line.match(boneHeaderPattern)\n\n if (result !== null) {\n if (n !== null) {\n throwError()\n }\n\n n = result[2]\n }\n\n result = line.match(boneVectorPattern)\n\n if (result !== null) {\n if (v !== null) {\n throwError()\n }\n\n v = [parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])]\n }\n\n result = line.match(boneQuaternionPattern)\n\n if (result !== null) {\n if (q !== null) {\n throwError()\n }\n\n q = [parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]), parseFloat(result[4])]\n }\n\n result = line.match(boneFooterPattern)\n\n if (result !== null) {\n if (n === null || v === null || q === null) {\n throwError()\n }\n\n bones.push({\n name: n,\n translation: v,\n quaternion: q,\n })\n\n n = null\n v = null\n q = null\n }\n }\n\n if (n !== null || v !== null || q !== null) {\n throwError()\n }\n }\n\n checkMagic()\n parseHeader()\n parseBones()\n\n if (leftToRight === true) this.leftToRightVpd(vpd)\n\n // console.log( vpd ); // for console debug\n return vpd\n }\n mergeVmds(vmds) {\n var v = {}\n v.metadata = {}\n v.metadata.name = vmds[0].metadata.name\n v.metadata.coordinateSystem = vmds[0].metadata.coordinateSystem\n v.metadata.motionCount = 0\n v.metadata.morphCount = 0\n v.metadata.cameraCount = 0\n v.motions = []\n v.morphs = []\n v.cameras = []\n\n for (var i = 0; i < vmds.length; i++) {\n var v2 = vmds[i]\n\n v.metadata.motionCount += v2.metadata.motionCount\n v.metadata.morphCount += v2.metadata.morphCount\n v.metadata.cameraCount += v2.metadata.cameraCount\n\n for (var j = 0; j < v2.metadata.motionCount; j++) {\n v.motions.push(v2.motions[j])\n }\n\n for (var j = 0; j < v2.metadata.morphCount; j++) {\n v.morphs.push(v2.morphs[j])\n }\n\n for (var j = 0; j < v2.metadata.cameraCount; j++) {\n v.cameras.push(v2.cameras[j])\n }\n }\n\n return v\n }\n leftToRightModel(model) {\n if (model.metadata.coordinateSystem === 'right') {\n return\n }\n\n model.metadata.coordinateSystem = 'right'\n\n var helper = new DataCreationHelper()\n\n for (var i = 0; i < model.metadata.vertexCount; i++) {\n helper.leftToRightVector3(model.vertices[i].position)\n helper.leftToRightVector3(model.vertices[i].normal)\n }\n\n for (var i = 0; i < model.metadata.faceCount; i++) {\n helper.leftToRightIndexOrder(model.faces[i].indices)\n }\n\n for (var i = 0; i < model.metadata.boneCount; i++) {\n helper.leftToRightVector3(model.bones[i].position)\n }\n\n // TODO: support other morph for PMX\n for (var i = 0; i < model.metadata.morphCount; i++) {\n var m = model.morphs[i]\n\n if (model.metadata.format === 'pmx' && m.type !== 1) {\n // TODO: implement\n continue\n }\n\n for (var j = 0; j < m.elements.length; j++) {\n helper.leftToRightVector3(m.elements[j].position)\n }\n }\n\n for (var i = 0; i < model.metadata.rigidBodyCount; i++) {\n helper.leftToRightVector3(model.rigidBodies[i].position)\n helper.leftToRightEuler(model.rigidBodies[i].rotation)\n }\n\n for (var i = 0; i < model.metadata.constraintCount; i++) {\n helper.leftToRightVector3(model.constraints[i].position)\n helper.leftToRightEuler(model.constraints[i].rotation)\n helper.leftToRightVector3Range(\n model.constraints[i].translationLimitation1,\n model.constraints[i].translationLimitation2\n )\n helper.leftToRightEulerRange(model.constraints[i].rotationLimitation1, model.constraints[i].rotationLimitation2)\n }\n }\n leftToRightVmd(vmd) {\n if (vmd.metadata.coordinateSystem === 'right') {\n return\n }\n\n vmd.metadata.coordinateSystem = 'right'\n\n var helper = new DataCreationHelper()\n\n for (var i = 0; i < vmd.metadata.motionCount; i++) {\n helper.leftToRightVector3(vmd.motions[i].position)\n helper.leftToRightQuaternion(vmd.motions[i].rotation)\n }\n\n for (var i = 0; i < vmd.metadata.cameraCount; i++) {\n helper.leftToRightVector3(vmd.cameras[i].position)\n helper.leftToRightEuler(vmd.cameras[i].rotation)\n }\n }\n leftToRightVpd(vpd) {\n if (vpd.metadata.coordinateSystem === 'right') {\n return\n }\n\n vpd.metadata.coordinateSystem = 'right'\n\n var helper = new DataCreationHelper()\n\n for (var i = 0; i < vpd.bones.length; i++) {\n helper.leftToRightVector3(vpd.bones[i].translation)\n helper.leftToRightQuaternion(vpd.bones[i].quaternion)\n }\n }\n}\n\nexport { CharsetEncoder, Parser }\n", "import {\n BufferAttribute,\n BufferGeometry,\n Color,\n Line,\n LineBasicMaterial,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Quaternion,\n SphereGeometry,\n Vector3,\n} from 'three'\n\nconst _q = new Quaternion()\nconst _targetPos = new Vector3()\nconst _targetVec = new Vector3()\nconst _effectorPos = new Vector3()\nconst _effectorVec = new Vector3()\nconst _linkPos = new Vector3()\nconst _invLinkQ = new Quaternion()\nconst _linkScale = new Vector3()\nconst _axis = new Vector3()\nconst _vector = new Vector3()\nconst _matrix = new Matrix4()\n\n/**\n * CCD Algorithm\n * - https://sites.google.com/site/auraliusproject/ccd-algorithm\n *\n * // ik parameter example\n * //\n * // target, effector, index in links are bone index in skeleton.bones.\n * // the bones relation should be\n * // <-- parent child -->\n * // links[ n ], links[ n - 1 ], ..., links[ 0 ], effector\n * iks = [ {\n *\ttarget: 1,\n *\teffector: 2,\n *\tlinks: [ { index: 5, limitation: new Vector3( 1, 0, 0 ) }, { index: 4, enabled: false }, { index : 3 } ],\n *\titeration: 10,\n *\tminAngle: 0.0,\n *\tmaxAngle: 1.0,\n * } ];\n */\n\nclass CCDIKSolver {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} iks\n */\n constructor(mesh, iks = []) {\n this.mesh = mesh\n this.iks = iks\n\n this._valid()\n }\n\n /**\n * Update all IK bones.\n *\n * @return {CCDIKSolver}\n */\n update() {\n const iks = this.iks\n\n for (let i = 0, il = iks.length; i < il; i++) {\n this.updateOne(iks[i])\n }\n\n return this\n }\n\n /**\n * Update one IK bone\n *\n * @param {Object} ik parameter\n * @return {CCDIKSolver}\n */\n updateOne(ik) {\n const bones = this.mesh.skeleton.bones\n\n // for reference overhead reduction in loop\n const math = Math\n\n const effector = bones[ik.effector]\n const target = bones[ik.target]\n\n // don't use getWorldPosition() here for the performance\n // because it calls updateMatrixWorld( true ) inside.\n _targetPos.setFromMatrixPosition(target.matrixWorld)\n\n const links = ik.links\n const iteration = ik.iteration !== undefined ? ik.iteration : 1\n\n for (let i = 0; i < iteration; i++) {\n let rotated = false\n\n for (let j = 0, jl = links.length; j < jl; j++) {\n const link = bones[links[j].index]\n\n // skip this link and following links.\n // this skip is used for MMD performance optimization.\n if (links[j].enabled === false) break\n\n const limitation = links[j].limitation\n const rotationMin = links[j].rotationMin\n const rotationMax = links[j].rotationMax\n\n // don't use getWorldPosition/Quaternion() here for the performance\n // because they call updateMatrixWorld( true ) inside.\n link.matrixWorld.decompose(_linkPos, _invLinkQ, _linkScale)\n _invLinkQ.invert()\n _effectorPos.setFromMatrixPosition(effector.matrixWorld)\n\n // work in link world\n _effectorVec.subVectors(_effectorPos, _linkPos)\n _effectorVec.applyQuaternion(_invLinkQ)\n _effectorVec.normalize()\n\n _targetVec.subVectors(_targetPos, _linkPos)\n _targetVec.applyQuaternion(_invLinkQ)\n _targetVec.normalize()\n\n let angle = _targetVec.dot(_effectorVec)\n\n if (angle > 1.0) {\n angle = 1.0\n } else if (angle < -1.0) {\n angle = -1.0\n }\n\n angle = math.acos(angle)\n\n // skip if changing angle is too small to prevent vibration of bone\n if (angle < 1e-5) continue\n\n if (ik.minAngle !== undefined && angle < ik.minAngle) {\n angle = ik.minAngle\n }\n\n if (ik.maxAngle !== undefined && angle > ik.maxAngle) {\n angle = ik.maxAngle\n }\n\n _axis.crossVectors(_effectorVec, _targetVec)\n _axis.normalize()\n\n _q.setFromAxisAngle(_axis, angle)\n link.quaternion.multiply(_q)\n\n // TODO: re-consider the limitation specification\n if (limitation !== undefined) {\n let c = link.quaternion.w\n\n if (c > 1.0) c = 1.0\n\n const c2 = math.sqrt(1 - c * c)\n link.quaternion.set(limitation.x * c2, limitation.y * c2, limitation.z * c2, c)\n }\n\n if (rotationMin !== undefined) {\n link.rotation.setFromVector3(_vector.setFromEuler(link.rotation).max(rotationMin))\n }\n\n if (rotationMax !== undefined) {\n link.rotation.setFromVector3(_vector.setFromEuler(link.rotation).min(rotationMax))\n }\n\n link.updateMatrixWorld(true)\n\n rotated = true\n }\n\n if (!rotated) break\n }\n\n return this\n }\n\n /**\n * Creates Helper\n *\n * @return {CCDIKHelper}\n */\n createHelper() {\n return new CCDIKHelper(this.mesh, this.iks)\n }\n\n // private methods\n\n _valid() {\n const iks = this.iks\n const bones = this.mesh.skeleton.bones\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n const effector = bones[ik.effector]\n const links = ik.links\n let link0, link1\n\n link0 = effector\n\n for (let j = 0, jl = links.length; j < jl; j++) {\n link1 = bones[links[j].index]\n\n if (link0.parent !== link1) {\n console.warn('THREE.CCDIKSolver: bone ' + link0.name + ' is not the child of bone ' + link1.name)\n }\n\n link0 = link1\n }\n }\n }\n}\n\nfunction getPosition(bone, matrixWorldInv) {\n return _vector.setFromMatrixPosition(bone.matrixWorld).applyMatrix4(matrixWorldInv)\n}\n\nfunction setPositionOfBoneToAttributeArray(array, index, bone, matrixWorldInv) {\n const v = getPosition(bone, matrixWorldInv)\n\n array[index * 3 + 0] = v.x\n array[index * 3 + 1] = v.y\n array[index * 3 + 2] = v.z\n}\n\n/**\n * Visualize IK bones\n *\n * @param {SkinnedMesh} mesh\n * @param {Array} iks\n */\nclass CCDIKHelper extends Object3D {\n constructor(mesh, iks = [], sphereSize = 0.25) {\n super()\n\n this.root = mesh\n this.iks = iks\n\n this.matrix.copy(mesh.matrixWorld)\n this.matrixAutoUpdate = false\n\n this.sphereGeometry = new SphereGeometry(sphereSize, 16, 8)\n\n this.targetSphereMaterial = new MeshBasicMaterial({\n color: new Color(0xff8888),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.effectorSphereMaterial = new MeshBasicMaterial({\n color: new Color(0x88ff88),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.linkSphereMaterial = new MeshBasicMaterial({\n color: new Color(0x8888ff),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.lineMaterial = new LineBasicMaterial({\n color: new Color(0xff0000),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this._init()\n }\n\n /**\n * Updates IK bones visualization.\n */\n updateMatrixWorld(force) {\n const mesh = this.root\n\n if (this.visible) {\n let offset = 0\n\n const iks = this.iks\n const bones = mesh.skeleton.bones\n\n _matrix.copy(mesh.matrixWorld).invert()\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n\n const targetBone = bones[ik.target]\n const effectorBone = bones[ik.effector]\n\n const targetMesh = this.children[offset++]\n const effectorMesh = this.children[offset++]\n\n targetMesh.position.copy(getPosition(targetBone, _matrix))\n effectorMesh.position.copy(getPosition(effectorBone, _matrix))\n\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n const link = ik.links[j]\n const linkBone = bones[link.index]\n\n const linkMesh = this.children[offset++]\n\n linkMesh.position.copy(getPosition(linkBone, _matrix))\n }\n\n const line = this.children[offset++]\n const array = line.geometry.attributes.position.array\n\n setPositionOfBoneToAttributeArray(array, 0, targetBone, _matrix)\n setPositionOfBoneToAttributeArray(array, 1, effectorBone, _matrix)\n\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n const link = ik.links[j]\n const linkBone = bones[link.index]\n setPositionOfBoneToAttributeArray(array, j + 2, linkBone, _matrix)\n }\n\n line.geometry.attributes.position.needsUpdate = true\n }\n }\n\n this.matrix.copy(mesh.matrixWorld)\n\n super.updateMatrixWorld(force)\n }\n\n /**\n * Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.\n */\n dispose() {\n this.sphereGeometry.dispose()\n\n this.targetSphereMaterial.dispose()\n this.effectorSphereMaterial.dispose()\n this.linkSphereMaterial.dispose()\n this.lineMaterial.dispose()\n\n const children = this.children\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n\n if (child.isLine) child.geometry.dispose()\n }\n }\n\n // private method\n\n _init() {\n const scope = this\n const iks = this.iks\n\n function createLineGeometry(ik) {\n const geometry = new BufferGeometry()\n const vertices = new Float32Array((2 + ik.links.length) * 3)\n geometry.setAttribute('position', new BufferAttribute(vertices, 3))\n\n return geometry\n }\n\n function createTargetMesh() {\n return new Mesh(scope.sphereGeometry, scope.targetSphereMaterial)\n }\n\n function createEffectorMesh() {\n return new Mesh(scope.sphereGeometry, scope.effectorSphereMaterial)\n }\n\n function createLinkMesh() {\n return new Mesh(scope.sphereGeometry, scope.linkSphereMaterial)\n }\n\n function createLine(ik) {\n return new Line(createLineGeometry(ik), scope.lineMaterial)\n }\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n\n this.add(createTargetMesh())\n this.add(createEffectorMesh())\n\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n this.add(createLinkMesh())\n }\n\n this.add(createLine(ik))\n }\n }\n}\n\nexport { CCDIKSolver, CCDIKHelper }\n", "import {\n Bone,\n BoxGeometry,\n Color,\n Euler,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Quaternion,\n SphereGeometry,\n Vector3,\n} from 'three'\nimport { CapsuleGeometry } from '../_polyfill/CapsuleGeometry'\n\n/**\n * Dependencies\n * - Ammo.js https://github.com/kripken/ammo.js\n *\n * MMDPhysics calculates physics with Ammo(Bullet based JavaScript Physics engine)\n * for MMD model loaded by MMDLoader.\n *\n * TODO\n * - Physics in Worker\n */\n\n/* global Ammo */\n\nclass MMDPhysics {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} rigidBodyParams\n * @param {Array} (optional) constraintParams\n * @param {Object} params - (optional)\n * @param {Number} params.unitStep - Default is 1 / 65.\n * @param {Integer} params.maxStepNum - Default is 3.\n * @param {Vector3} params.gravity - Default is ( 0, - 9.8 * 10, 0 )\n */\n constructor(mesh, rigidBodyParams, constraintParams = [], params = {}) {\n if (typeof Ammo === 'undefined') {\n throw new Error('THREE.MMDPhysics: Import ammo.js https://github.com/kripken/ammo.js')\n }\n\n this.manager = new ResourceManager()\n\n this.mesh = mesh\n\n /*\n * I don't know why but 1/60 unitStep easily breaks models\n * so I set it 1/65 so far.\n * Don't set too small unitStep because\n * the smaller unitStep can make the performance worse.\n */\n this.unitStep = params.unitStep !== undefined ? params.unitStep : 1 / 65\n this.maxStepNum = params.maxStepNum !== undefined ? params.maxStepNum : 3\n this.gravity = new Vector3(0, -9.8 * 10, 0)\n\n if (params.gravity !== undefined) this.gravity.copy(params.gravity)\n\n this.world = params.world !== undefined ? params.world : null // experimental\n\n this.bodies = []\n this.constraints = []\n\n this._init(mesh, rigidBodyParams, constraintParams)\n }\n\n /**\n * Advances Physics calculation and updates bones.\n *\n * @param {Number} delta - time in second\n * @return {MMDPhysics}\n */\n update(delta) {\n const manager = this.manager\n const mesh = this.mesh\n\n // rigid bodies and constrains are for\n // mesh's world scale (1, 1, 1).\n // Convert to (1, 1, 1) if it isn't.\n\n let isNonDefaultScale = false\n\n const position = manager.allocThreeVector3()\n const quaternion = manager.allocThreeQuaternion()\n const scale = manager.allocThreeVector3()\n\n mesh.matrixWorld.decompose(position, quaternion, scale)\n\n if (scale.x !== 1 || scale.y !== 1 || scale.z !== 1) {\n isNonDefaultScale = true\n }\n\n let parent\n\n if (isNonDefaultScale) {\n parent = mesh.parent\n\n if (parent !== null) mesh.parent = null\n\n scale.copy(this.mesh.scale)\n\n mesh.scale.set(1, 1, 1)\n mesh.updateMatrixWorld(true)\n }\n\n // calculate physics and update bones\n\n this._updateRigidBodies()\n this._stepSimulation(delta)\n this._updateBones()\n\n // restore mesh if converted above\n\n if (isNonDefaultScale) {\n if (parent !== null) mesh.parent = parent\n\n mesh.scale.copy(scale)\n }\n\n manager.freeThreeVector3(scale)\n manager.freeThreeQuaternion(quaternion)\n manager.freeThreeVector3(position)\n\n return this\n }\n\n /**\n * Resets rigid bodies transorm to current bone's.\n *\n * @return {MMDPhysics}\n */\n reset() {\n for (let i = 0, il = this.bodies.length; i < il; i++) {\n this.bodies[i].reset()\n }\n\n return this\n }\n\n /**\n * Warm ups Rigid bodies. Calculates cycles steps.\n *\n * @param {Integer} cycles\n * @return {MMDPhysics}\n */\n warmup(cycles) {\n for (let i = 0; i < cycles; i++) {\n this.update(1 / 60)\n }\n\n return this\n }\n\n /**\n * Sets gravity.\n *\n * @param {Vector3} gravity\n * @return {MMDPhysicsHelper}\n */\n setGravity(gravity) {\n this.world.setGravity(new Ammo.btVector3(gravity.x, gravity.y, gravity.z))\n this.gravity.copy(gravity)\n\n return this\n }\n\n /**\n * Creates MMDPhysicsHelper\n *\n * @return {MMDPhysicsHelper}\n */\n createHelper() {\n return new MMDPhysicsHelper(this.mesh, this)\n }\n\n // private methods\n\n _init(mesh, rigidBodyParams, constraintParams) {\n const manager = this.manager\n\n // rigid body/constraint parameters are for\n // mesh's default world transform as position(0, 0, 0),\n // quaternion(0, 0, 0, 1) and scale(0, 0, 0)\n\n const parent = mesh.parent\n\n if (parent !== null) mesh.parent = null\n\n const currentPosition = manager.allocThreeVector3()\n const currentQuaternion = manager.allocThreeQuaternion()\n const currentScale = manager.allocThreeVector3()\n\n currentPosition.copy(mesh.position)\n currentQuaternion.copy(mesh.quaternion)\n currentScale.copy(mesh.scale)\n\n mesh.position.set(0, 0, 0)\n mesh.quaternion.set(0, 0, 0, 1)\n mesh.scale.set(1, 1, 1)\n\n mesh.updateMatrixWorld(true)\n\n if (this.world === null) {\n this.world = this._createWorld()\n this.setGravity(this.gravity)\n }\n\n this._initRigidBodies(rigidBodyParams)\n this._initConstraints(constraintParams)\n\n if (parent !== null) mesh.parent = parent\n\n mesh.position.copy(currentPosition)\n mesh.quaternion.copy(currentQuaternion)\n mesh.scale.copy(currentScale)\n\n mesh.updateMatrixWorld(true)\n\n this.reset()\n\n manager.freeThreeVector3(currentPosition)\n manager.freeThreeQuaternion(currentQuaternion)\n manager.freeThreeVector3(currentScale)\n }\n\n _createWorld() {\n const config = new Ammo.btDefaultCollisionConfiguration()\n const dispatcher = new Ammo.btCollisionDispatcher(config)\n const cache = new Ammo.btDbvtBroadphase()\n const solver = new Ammo.btSequentialImpulseConstraintSolver()\n const world = new Ammo.btDiscreteDynamicsWorld(dispatcher, cache, solver, config)\n return world\n }\n\n _initRigidBodies(rigidBodies) {\n for (let i = 0, il = rigidBodies.length; i < il; i++) {\n this.bodies.push(new RigidBody(this.mesh, this.world, rigidBodies[i], this.manager))\n }\n }\n\n _initConstraints(constraints) {\n for (let i = 0, il = constraints.length; i < il; i++) {\n const params = constraints[i]\n const bodyA = this.bodies[params.rigidBodyIndex1]\n const bodyB = this.bodies[params.rigidBodyIndex2]\n this.constraints.push(new Constraint(this.mesh, this.world, bodyA, bodyB, params, this.manager))\n }\n }\n\n _stepSimulation(delta) {\n const unitStep = this.unitStep\n let stepTime = delta\n let maxStepNum = ((delta / unitStep) | 0) + 1\n\n if (stepTime < unitStep) {\n stepTime = unitStep\n maxStepNum = 1\n }\n\n if (maxStepNum > this.maxStepNum) {\n maxStepNum = this.maxStepNum\n }\n\n this.world.stepSimulation(stepTime, maxStepNum, unitStep)\n }\n\n _updateRigidBodies() {\n for (let i = 0, il = this.bodies.length; i < il; i++) {\n this.bodies[i].updateFromBone()\n }\n }\n\n _updateBones() {\n for (let i = 0, il = this.bodies.length; i < il; i++) {\n this.bodies[i].updateBone()\n }\n }\n}\n\n/**\n * This manager's responsibilies are\n *\n * 1. manage Ammo.js and Three.js object resources and\n * improve the performance and the memory consumption by\n * reusing objects.\n *\n * 2. provide simple Ammo object operations.\n */\nclass ResourceManager {\n constructor() {\n // for Three.js\n this.threeVector3s = []\n this.threeMatrix4s = []\n this.threeQuaternions = []\n this.threeEulers = []\n\n // for Ammo.js\n this.transforms = []\n this.quaternions = []\n this.vector3s = []\n }\n\n allocThreeVector3() {\n return this.threeVector3s.length > 0 ? this.threeVector3s.pop() : new Vector3()\n }\n\n freeThreeVector3(v) {\n this.threeVector3s.push(v)\n }\n\n allocThreeMatrix4() {\n return this.threeMatrix4s.length > 0 ? this.threeMatrix4s.pop() : new Matrix4()\n }\n\n freeThreeMatrix4(m) {\n this.threeMatrix4s.push(m)\n }\n\n allocThreeQuaternion() {\n return this.threeQuaternions.length > 0 ? this.threeQuaternions.pop() : new Quaternion()\n }\n\n freeThreeQuaternion(q) {\n this.threeQuaternions.push(q)\n }\n\n allocThreeEuler() {\n return this.threeEulers.length > 0 ? this.threeEulers.pop() : new Euler()\n }\n\n freeThreeEuler(e) {\n this.threeEulers.push(e)\n }\n\n allocTransform() {\n return this.transforms.length > 0 ? this.transforms.pop() : new Ammo.btTransform()\n }\n\n freeTransform(t) {\n this.transforms.push(t)\n }\n\n allocQuaternion() {\n return this.quaternions.length > 0 ? this.quaternions.pop() : new Ammo.btQuaternion()\n }\n\n freeQuaternion(q) {\n this.quaternions.push(q)\n }\n\n allocVector3() {\n return this.vector3s.length > 0 ? this.vector3s.pop() : new Ammo.btVector3()\n }\n\n freeVector3(v) {\n this.vector3s.push(v)\n }\n\n setIdentity(t) {\n t.setIdentity()\n }\n\n getBasis(t) {\n var q = this.allocQuaternion()\n t.getBasis().getRotation(q)\n return q\n }\n\n getBasisAsMatrix3(t) {\n var q = this.getBasis(t)\n var m = this.quaternionToMatrix3(q)\n this.freeQuaternion(q)\n return m\n }\n\n getOrigin(t) {\n return t.getOrigin()\n }\n\n setOrigin(t, v) {\n t.getOrigin().setValue(v.x(), v.y(), v.z())\n }\n\n copyOrigin(t1, t2) {\n var o = t2.getOrigin()\n this.setOrigin(t1, o)\n }\n\n setBasis(t, q) {\n t.setRotation(q)\n }\n\n setBasisFromMatrix3(t, m) {\n var q = this.matrix3ToQuaternion(m)\n this.setBasis(t, q)\n this.freeQuaternion(q)\n }\n\n setOriginFromArray3(t, a) {\n t.getOrigin().setValue(a[0], a[1], a[2])\n }\n\n setOriginFromThreeVector3(t, v) {\n t.getOrigin().setValue(v.x, v.y, v.z)\n }\n\n setBasisFromArray3(t, a) {\n var thQ = this.allocThreeQuaternion()\n var thE = this.allocThreeEuler()\n thE.set(a[0], a[1], a[2])\n this.setBasisFromThreeQuaternion(t, thQ.setFromEuler(thE))\n\n this.freeThreeEuler(thE)\n this.freeThreeQuaternion(thQ)\n }\n\n setBasisFromThreeQuaternion(t, a) {\n var q = this.allocQuaternion()\n\n q.setX(a.x)\n q.setY(a.y)\n q.setZ(a.z)\n q.setW(a.w)\n this.setBasis(t, q)\n\n this.freeQuaternion(q)\n }\n\n multiplyTransforms(t1, t2) {\n var t = this.allocTransform()\n this.setIdentity(t)\n\n var m1 = this.getBasisAsMatrix3(t1)\n var m2 = this.getBasisAsMatrix3(t2)\n\n var o1 = this.getOrigin(t1)\n var o2 = this.getOrigin(t2)\n\n var v1 = this.multiplyMatrix3ByVector3(m1, o2)\n var v2 = this.addVector3(v1, o1)\n this.setOrigin(t, v2)\n\n var m3 = this.multiplyMatrices3(m1, m2)\n this.setBasisFromMatrix3(t, m3)\n\n this.freeVector3(v1)\n this.freeVector3(v2)\n\n return t\n }\n\n inverseTransform(t) {\n var t2 = this.allocTransform()\n\n var m1 = this.getBasisAsMatrix3(t)\n var o = this.getOrigin(t)\n\n var m2 = this.transposeMatrix3(m1)\n var v1 = this.negativeVector3(o)\n var v2 = this.multiplyMatrix3ByVector3(m2, v1)\n\n this.setOrigin(t2, v2)\n this.setBasisFromMatrix3(t2, m2)\n\n this.freeVector3(v1)\n this.freeVector3(v2)\n\n return t2\n }\n\n multiplyMatrices3(m1, m2) {\n var m3 = []\n\n var v10 = this.rowOfMatrix3(m1, 0)\n var v11 = this.rowOfMatrix3(m1, 1)\n var v12 = this.rowOfMatrix3(m1, 2)\n\n var v20 = this.columnOfMatrix3(m2, 0)\n var v21 = this.columnOfMatrix3(m2, 1)\n var v22 = this.columnOfMatrix3(m2, 2)\n\n m3[0] = this.dotVectors3(v10, v20)\n m3[1] = this.dotVectors3(v10, v21)\n m3[2] = this.dotVectors3(v10, v22)\n m3[3] = this.dotVectors3(v11, v20)\n m3[4] = this.dotVectors3(v11, v21)\n m3[5] = this.dotVectors3(v11, v22)\n m3[6] = this.dotVectors3(v12, v20)\n m3[7] = this.dotVectors3(v12, v21)\n m3[8] = this.dotVectors3(v12, v22)\n\n this.freeVector3(v10)\n this.freeVector3(v11)\n this.freeVector3(v12)\n this.freeVector3(v20)\n this.freeVector3(v21)\n this.freeVector3(v22)\n\n return m3\n }\n\n addVector3(v1, v2) {\n var v = this.allocVector3()\n v.setValue(v1.x() + v2.x(), v1.y() + v2.y(), v1.z() + v2.z())\n return v\n }\n\n dotVectors3(v1, v2) {\n return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z()\n }\n\n rowOfMatrix3(m, i) {\n var v = this.allocVector3()\n v.setValue(m[i * 3 + 0], m[i * 3 + 1], m[i * 3 + 2])\n return v\n }\n\n columnOfMatrix3(m, i) {\n var v = this.allocVector3()\n v.setValue(m[i + 0], m[i + 3], m[i + 6])\n return v\n }\n\n negativeVector3(v) {\n var v2 = this.allocVector3()\n v2.setValue(-v.x(), -v.y(), -v.z())\n return v2\n }\n\n multiplyMatrix3ByVector3(m, v) {\n var v4 = this.allocVector3()\n\n var v0 = this.rowOfMatrix3(m, 0)\n var v1 = this.rowOfMatrix3(m, 1)\n var v2 = this.rowOfMatrix3(m, 2)\n var x = this.dotVectors3(v0, v)\n var y = this.dotVectors3(v1, v)\n var z = this.dotVectors3(v2, v)\n\n v4.setValue(x, y, z)\n\n this.freeVector3(v0)\n this.freeVector3(v1)\n this.freeVector3(v2)\n\n return v4\n }\n\n transposeMatrix3(m) {\n var m2 = []\n m2[0] = m[0]\n m2[1] = m[3]\n m2[2] = m[6]\n m2[3] = m[1]\n m2[4] = m[4]\n m2[5] = m[7]\n m2[6] = m[2]\n m2[7] = m[5]\n m2[8] = m[8]\n return m2\n }\n\n quaternionToMatrix3(q) {\n var m = []\n\n var x = q.x()\n var y = q.y()\n var z = q.z()\n var w = q.w()\n\n var xx = x * x\n var yy = y * y\n var zz = z * z\n\n var xy = x * y\n var yz = y * z\n var zx = z * x\n\n var xw = x * w\n var yw = y * w\n var zw = z * w\n\n m[0] = 1 - 2 * (yy + zz)\n m[1] = 2 * (xy - zw)\n m[2] = 2 * (zx + yw)\n m[3] = 2 * (xy + zw)\n m[4] = 1 - 2 * (zz + xx)\n m[5] = 2 * (yz - xw)\n m[6] = 2 * (zx - yw)\n m[7] = 2 * (yz + xw)\n m[8] = 1 - 2 * (xx + yy)\n\n return m\n }\n\n matrix3ToQuaternion(m) {\n var t = m[0] + m[4] + m[8]\n var s, x, y, z, w\n\n if (t > 0) {\n s = Math.sqrt(t + 1.0) * 2\n w = 0.25 * s\n x = (m[7] - m[5]) / s\n y = (m[2] - m[6]) / s\n z = (m[3] - m[1]) / s\n } else if (m[0] > m[4] && m[0] > m[8]) {\n s = Math.sqrt(1.0 + m[0] - m[4] - m[8]) * 2\n w = (m[7] - m[5]) / s\n x = 0.25 * s\n y = (m[1] + m[3]) / s\n z = (m[2] + m[6]) / s\n } else if (m[4] > m[8]) {\n s = Math.sqrt(1.0 + m[4] - m[0] - m[8]) * 2\n w = (m[2] - m[6]) / s\n x = (m[1] + m[3]) / s\n y = 0.25 * s\n z = (m[5] + m[7]) / s\n } else {\n s = Math.sqrt(1.0 + m[8] - m[0] - m[4]) * 2\n w = (m[3] - m[1]) / s\n x = (m[2] + m[6]) / s\n y = (m[5] + m[7]) / s\n z = 0.25 * s\n }\n\n var q = this.allocQuaternion()\n q.setX(x)\n q.setY(y)\n q.setZ(z)\n q.setW(w)\n return q\n }\n}\n\n/**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Ammo.btDiscreteDynamicsWorld} world\n * @param {Object} params\n * @param {ResourceManager} manager\n */\nclass RigidBody {\n constructor(mesh, world, params, manager) {\n this.mesh = mesh\n this.world = world\n this.params = params\n this.manager = manager\n\n this.body = null\n this.bone = null\n this.boneOffsetForm = null\n this.boneOffsetFormInverse = null\n\n this._init()\n }\n\n /**\n * Resets rigid body transform to the current bone's.\n *\n * @return {RigidBody}\n */\n reset() {\n this._setTransformFromBone()\n return this\n }\n\n /**\n * Updates rigid body's transform from the current bone.\n *\n * @return {RidigBody}\n */\n updateFromBone() {\n if (this.params.boneIndex !== -1 && this.params.type === 0) {\n this._setTransformFromBone()\n }\n\n return this\n }\n\n /**\n * Updates bone from the current ridid body's transform.\n *\n * @return {RidigBody}\n */\n updateBone() {\n if (this.params.type === 0 || this.params.boneIndex === -1) {\n return this\n }\n\n this._updateBoneRotation()\n\n if (this.params.type === 1) {\n this._updateBonePosition()\n }\n\n this.bone.updateMatrixWorld(true)\n\n if (this.params.type === 2) {\n this._setPositionFromBone()\n }\n\n return this\n }\n\n // private methods\n\n _init() {\n function generateShape(p) {\n switch (p.shapeType) {\n case 0:\n return new Ammo.btSphereShape(p.width)\n\n case 1:\n return new Ammo.btBoxShape(new Ammo.btVector3(p.width, p.height, p.depth))\n\n case 2:\n return new Ammo.btCapsuleShape(p.width, p.height)\n\n default:\n throw new Error('unknown shape type ' + p.shapeType)\n }\n }\n\n const manager = this.manager\n const params = this.params\n const bones = this.mesh.skeleton.bones\n const bone = params.boneIndex === -1 ? new Bone() : bones[params.boneIndex]\n\n const shape = generateShape(params)\n const weight = params.type === 0 ? 0 : params.weight\n const localInertia = manager.allocVector3()\n localInertia.setValue(0, 0, 0)\n\n if (weight !== 0) {\n shape.calculateLocalInertia(weight, localInertia)\n }\n\n const boneOffsetForm = manager.allocTransform()\n manager.setIdentity(boneOffsetForm)\n manager.setOriginFromArray3(boneOffsetForm, params.position)\n manager.setBasisFromArray3(boneOffsetForm, params.rotation)\n\n const vector = manager.allocThreeVector3()\n const boneForm = manager.allocTransform()\n manager.setIdentity(boneForm)\n manager.setOriginFromThreeVector3(boneForm, bone.getWorldPosition(vector))\n\n const form = manager.multiplyTransforms(boneForm, boneOffsetForm)\n const state = new Ammo.btDefaultMotionState(form)\n\n const info = new Ammo.btRigidBodyConstructionInfo(weight, state, shape, localInertia)\n info.set_m_friction(params.friction)\n info.set_m_restitution(params.restitution)\n\n const body = new Ammo.btRigidBody(info)\n\n if (params.type === 0) {\n body.setCollisionFlags(body.getCollisionFlags() | 2)\n\n /*\n * It'd be better to comment out this line though in general I should call this method\n * because I'm not sure why but physics will be more like MMD's\n * if I comment out.\n */\n body.setActivationState(4)\n }\n\n body.setDamping(params.positionDamping, params.rotationDamping)\n body.setSleepingThresholds(0, 0)\n\n this.world.addRigidBody(body, 1 << params.groupIndex, params.groupTarget)\n\n this.body = body\n this.bone = bone\n this.boneOffsetForm = boneOffsetForm\n this.boneOffsetFormInverse = manager.inverseTransform(boneOffsetForm)\n\n manager.freeVector3(localInertia)\n manager.freeTransform(form)\n manager.freeTransform(boneForm)\n manager.freeThreeVector3(vector)\n }\n\n _getBoneTransform() {\n const manager = this.manager\n const p = manager.allocThreeVector3()\n const q = manager.allocThreeQuaternion()\n const s = manager.allocThreeVector3()\n\n this.bone.matrixWorld.decompose(p, q, s)\n\n const tr = manager.allocTransform()\n manager.setOriginFromThreeVector3(tr, p)\n manager.setBasisFromThreeQuaternion(tr, q)\n\n const form = manager.multiplyTransforms(tr, this.boneOffsetForm)\n\n manager.freeTransform(tr)\n manager.freeThreeVector3(s)\n manager.freeThreeQuaternion(q)\n manager.freeThreeVector3(p)\n\n return form\n }\n\n _getWorldTransformForBone() {\n const manager = this.manager\n const tr = this.body.getCenterOfMassTransform()\n return manager.multiplyTransforms(tr, this.boneOffsetFormInverse)\n }\n\n _setTransformFromBone() {\n const manager = this.manager\n const form = this._getBoneTransform()\n\n // TODO: check the most appropriate way to set\n //this.body.setWorldTransform( form );\n this.body.setCenterOfMassTransform(form)\n this.body.getMotionState().setWorldTransform(form)\n\n manager.freeTransform(form)\n }\n\n _setPositionFromBone() {\n const manager = this.manager\n const form = this._getBoneTransform()\n\n const tr = manager.allocTransform()\n this.body.getMotionState().getWorldTransform(tr)\n manager.copyOrigin(tr, form)\n\n // TODO: check the most appropriate way to set\n //this.body.setWorldTransform( tr );\n this.body.setCenterOfMassTransform(tr)\n this.body.getMotionState().setWorldTransform(tr)\n\n manager.freeTransform(tr)\n manager.freeTransform(form)\n }\n\n _updateBoneRotation() {\n const manager = this.manager\n\n const tr = this._getWorldTransformForBone()\n const q = manager.getBasis(tr)\n\n const thQ = manager.allocThreeQuaternion()\n const thQ2 = manager.allocThreeQuaternion()\n const thQ3 = manager.allocThreeQuaternion()\n\n thQ.set(q.x(), q.y(), q.z(), q.w())\n thQ2.setFromRotationMatrix(this.bone.matrixWorld)\n thQ2.conjugate()\n thQ2.multiply(thQ)\n\n //this.bone.quaternion.multiply( thQ2 );\n\n thQ3.setFromRotationMatrix(this.bone.matrix)\n\n // Renormalizing quaternion here because repeatedly transforming\n // quaternion continuously accumulates floating point error and\n // can end up being overflow. See #15335\n this.bone.quaternion.copy(thQ2.multiply(thQ3).normalize())\n\n manager.freeThreeQuaternion(thQ)\n manager.freeThreeQuaternion(thQ2)\n manager.freeThreeQuaternion(thQ3)\n\n manager.freeQuaternion(q)\n manager.freeTransform(tr)\n }\n\n _updateBonePosition() {\n const manager = this.manager\n\n const tr = this._getWorldTransformForBone()\n\n const thV = manager.allocThreeVector3()\n\n const o = manager.getOrigin(tr)\n thV.set(o.x(), o.y(), o.z())\n\n if (this.bone.parent) {\n this.bone.parent.worldToLocal(thV)\n }\n\n this.bone.position.copy(thV)\n\n manager.freeThreeVector3(thV)\n\n manager.freeTransform(tr)\n }\n}\n\n//\n\nclass Constraint {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Ammo.btDiscreteDynamicsWorld} world\n * @param {RigidBody} bodyA\n * @param {RigidBody} bodyB\n * @param {Object} params\n * @param {ResourceManager} manager\n */\n constructor(mesh, world, bodyA, bodyB, params, manager) {\n this.mesh = mesh\n this.world = world\n this.bodyA = bodyA\n this.bodyB = bodyB\n this.params = params\n this.manager = manager\n\n this.constraint = null\n\n this._init()\n }\n\n // private method\n\n _init() {\n const manager = this.manager\n const params = this.params\n const bodyA = this.bodyA\n const bodyB = this.bodyB\n\n const form = manager.allocTransform()\n manager.setIdentity(form)\n manager.setOriginFromArray3(form, params.position)\n manager.setBasisFromArray3(form, params.rotation)\n\n const formA = manager.allocTransform()\n const formB = manager.allocTransform()\n\n bodyA.body.getMotionState().getWorldTransform(formA)\n bodyB.body.getMotionState().getWorldTransform(formB)\n\n const formInverseA = manager.inverseTransform(formA)\n const formInverseB = manager.inverseTransform(formB)\n\n const formA2 = manager.multiplyTransforms(formInverseA, form)\n const formB2 = manager.multiplyTransforms(formInverseB, form)\n\n const constraint = new Ammo.btGeneric6DofSpringConstraint(bodyA.body, bodyB.body, formA2, formB2, true)\n\n const lll = manager.allocVector3()\n const lul = manager.allocVector3()\n const all = manager.allocVector3()\n const aul = manager.allocVector3()\n\n lll.setValue(params.translationLimitation1[0], params.translationLimitation1[1], params.translationLimitation1[2])\n lul.setValue(params.translationLimitation2[0], params.translationLimitation2[1], params.translationLimitation2[2])\n all.setValue(params.rotationLimitation1[0], params.rotationLimitation1[1], params.rotationLimitation1[2])\n aul.setValue(params.rotationLimitation2[0], params.rotationLimitation2[1], params.rotationLimitation2[2])\n\n constraint.setLinearLowerLimit(lll)\n constraint.setLinearUpperLimit(lul)\n constraint.setAngularLowerLimit(all)\n constraint.setAngularUpperLimit(aul)\n\n for (let i = 0; i < 3; i++) {\n if (params.springPosition[i] !== 0) {\n constraint.enableSpring(i, true)\n constraint.setStiffness(i, params.springPosition[i])\n }\n }\n\n for (let i = 0; i < 3; i++) {\n if (params.springRotation[i] !== 0) {\n constraint.enableSpring(i + 3, true)\n constraint.setStiffness(i + 3, params.springRotation[i])\n }\n }\n\n /*\n * Currently(10/31/2016) official ammo.js doesn't support\n * btGeneric6DofSpringConstraint.setParam method.\n * You need custom ammo.js (add the method into idl) if you wanna use.\n * By setting this parameter, physics will be more like MMD's\n */\n if (constraint.setParam !== undefined) {\n for (let i = 0; i < 6; i++) {\n constraint.setParam(2, 0.475, i)\n }\n }\n\n this.world.addConstraint(constraint, true)\n this.constraint = constraint\n\n manager.freeTransform(form)\n manager.freeTransform(formA)\n manager.freeTransform(formB)\n manager.freeTransform(formInverseA)\n manager.freeTransform(formInverseB)\n manager.freeTransform(formA2)\n manager.freeTransform(formB2)\n manager.freeVector3(lll)\n manager.freeVector3(lul)\n manager.freeVector3(all)\n manager.freeVector3(aul)\n }\n}\n\nconst _position = new Vector3()\nconst _quaternion = new Quaternion()\nconst _scale = new Vector3()\nconst _matrixWorldInv = new Matrix4()\n\nclass MMDPhysicsHelper extends Object3D {\n /**\n * Visualize Rigid bodies\n *\n * @param {THREE.SkinnedMesh} mesh\n * @param {Physics} physics\n */\n constructor(mesh, physics) {\n super()\n\n this.root = mesh\n this.physics = physics\n\n this.matrix.copy(mesh.matrixWorld)\n this.matrixAutoUpdate = false\n\n this.materials = []\n\n this.materials.push(\n new MeshBasicMaterial({\n color: new Color(0xff8888),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true,\n }),\n )\n\n this.materials.push(\n new MeshBasicMaterial({\n color: new Color(0x88ff88),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true,\n }),\n )\n\n this.materials.push(\n new MeshBasicMaterial({\n color: new Color(0x8888ff),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true,\n }),\n )\n\n this._init()\n }\n\n /**\n * Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.\n */\n dispose() {\n const materials = this.materials\n const children = this.children\n\n for (let i = 0; i < materials.length; i++) {\n materials[i].dispose()\n }\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n\n if (child.isMesh) child.geometry.dispose()\n }\n }\n\n /**\n * Updates Rigid Bodies visualization.\n */\n updateMatrixWorld(force) {\n var mesh = this.root\n\n if (this.visible) {\n var bodies = this.physics.bodies\n\n _matrixWorldInv\n .copy(mesh.matrixWorld)\n .decompose(_position, _quaternion, _scale)\n .compose(_position, _quaternion, _scale.set(1, 1, 1))\n .invert()\n\n for (var i = 0, il = bodies.length; i < il; i++) {\n var body = bodies[i].body\n var child = this.children[i]\n\n var tr = body.getCenterOfMassTransform()\n var origin = tr.getOrigin()\n var rotation = tr.getRotation()\n\n child.position.set(origin.x(), origin.y(), origin.z()).applyMatrix4(_matrixWorldInv)\n\n child.quaternion\n .setFromRotationMatrix(_matrixWorldInv)\n .multiply(_quaternion.set(rotation.x(), rotation.y(), rotation.z(), rotation.w()))\n }\n }\n\n this.matrix\n .copy(mesh.matrixWorld)\n .decompose(_position, _quaternion, _scale)\n .compose(_position, _quaternion, _scale.set(1, 1, 1))\n\n super.updateMatrixWorld(force)\n }\n\n // private method\n\n _init() {\n var bodies = this.physics.bodies\n\n function createGeometry(param) {\n switch (param.shapeType) {\n case 0:\n return new SphereGeometry(param.width, 16, 8)\n\n case 1:\n return new BoxGeometry(param.width * 2, param.height * 2, param.depth * 2, 8, 8, 8)\n\n case 2:\n return new CapsuleGeometry(param.width, param.height, 8, 16)\n\n default:\n return null\n }\n }\n\n for (var i = 0, il = bodies.length; i < il; i++) {\n var param = bodies[i].params\n this.add(new Mesh(createGeometry(param), this.materials[param.type]))\n }\n }\n}\n\nexport { MMDPhysics }\n", "import { AnimationMixer, Object3D, Quaternion, Vector3 } from 'three'\nimport { CCDIKSolver } from '../animation/CCDIKSolver'\nimport { MMDPhysics } from '../animation/MMDPhysics'\n\n/**\n * MMDAnimationHelper handles animation of MMD assets loaded by MMDLoader\n * with MMD special features as IK, Grant, and Physics.\n *\n * Dependencies\n * - ammo.js https://github.com/kripken/ammo.js\n * - MMDPhysics\n * - CCDIKSolver\n *\n * TODO\n * - more precise grant skinning support.\n */\nclass MMDAnimationHelper {\n /**\n * @param {Object} params - (optional)\n * @param {boolean} params.sync - Whether animation durations of added objects are synched. Default is true.\n * @param {Number} params.afterglow - Default is 0.0.\n * @param {boolean} params.resetPhysicsOnLoop - Default is true.\n */\n constructor(params = {}) {\n this.meshes = []\n\n this.camera = null\n this.cameraTarget = new Object3D()\n this.cameraTarget.name = 'target'\n\n this.audio = null\n this.audioManager = null\n\n this.objects = new WeakMap()\n\n this.configuration = {\n sync: params.sync !== undefined ? params.sync : true,\n afterglow: params.afterglow !== undefined ? params.afterglow : 0.0,\n resetPhysicsOnLoop: params.resetPhysicsOnLoop !== undefined ? params.resetPhysicsOnLoop : true,\n pmxAnimation: params.pmxAnimation !== undefined ? params.pmxAnimation : false,\n }\n\n this.enabled = {\n animation: true,\n ik: true,\n grant: true,\n physics: true,\n cameraAnimation: true,\n }\n\n this.onBeforePhysics = function (/* mesh */) {}\n\n // experimental\n this.sharedPhysics = false\n this.masterPhysics = null\n }\n\n /**\n * Adds an Three.js Object to helper and setups animation.\n * The anmation durations of added objects are synched\n * if this.configuration.sync is true.\n *\n * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object\n * @param {Object} params - (optional)\n * @param {THREE.AnimationClip|Array} params.animation - Only for THREE.SkinnedMesh and THREE.Camera. Default is undefined.\n * @param {boolean} params.physics - Only for THREE.SkinnedMesh. Default is true.\n * @param {Integer} params.warmup - Only for THREE.SkinnedMesh and physics is true. Default is 60.\n * @param {Number} params.unitStep - Only for THREE.SkinnedMesh and physics is true. Default is 1 / 65.\n * @param {Integer} params.maxStepNum - Only for THREE.SkinnedMesh and physics is true. Default is 3.\n * @param {Vector3} params.gravity - Only for THREE.SkinnedMesh and physics is true. Default ( 0, - 9.8 * 10, 0 ).\n * @param {Number} params.delayTime - Only for THREE.Audio. Default is 0.0.\n * @return {MMDAnimationHelper}\n */\n add(object, params = {}) {\n if (object.isSkinnedMesh) {\n this._addMesh(object, params)\n } else if (object.isCamera) {\n this._setupCamera(object, params)\n } else if (object.type === 'Audio') {\n this._setupAudio(object, params)\n } else {\n throw new Error(\n 'THREE.MMDAnimationHelper.add: ' +\n 'accepts only ' +\n 'THREE.SkinnedMesh or ' +\n 'THREE.Camera or ' +\n 'THREE.Audio instance.',\n )\n }\n\n if (this.configuration.sync) this._syncDuration()\n\n return this\n }\n\n /**\n * Removes an Three.js Object from helper.\n *\n * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object\n * @return {MMDAnimationHelper}\n */\n remove(object) {\n if (object.isSkinnedMesh) {\n this._removeMesh(object)\n } else if (object.isCamera) {\n this._clearCamera(object)\n } else if (object.type === 'Audio') {\n this._clearAudio(object)\n } else {\n throw new Error(\n 'THREE.MMDAnimationHelper.remove: ' +\n 'accepts only ' +\n 'THREE.SkinnedMesh or ' +\n 'THREE.Camera or ' +\n 'THREE.Audio instance.',\n )\n }\n\n if (this.configuration.sync) this._syncDuration()\n\n return this\n }\n\n /**\n * Updates the animation.\n *\n * @param {Number} delta\n * @return {MMDAnimationHelper}\n */\n update(delta) {\n if (this.audioManager !== null) this.audioManager.control(delta)\n\n for (let i = 0; i < this.meshes.length; i++) {\n this._animateMesh(this.meshes[i], delta)\n }\n\n if (this.sharedPhysics) this._updateSharedPhysics(delta)\n\n if (this.camera !== null) this._animateCamera(this.camera, delta)\n\n return this\n }\n\n /**\n * Changes the pose of SkinnedMesh as VPD specifies.\n *\n * @param {THREE.SkinnedMesh} mesh\n * @param {Object} vpd - VPD content parsed MMDParser\n * @param {Object} params - (optional)\n * @param {boolean} params.resetPose - Default is true.\n * @param {boolean} params.ik - Default is true.\n * @param {boolean} params.grant - Default is true.\n * @return {MMDAnimationHelper}\n */\n pose(mesh, vpd, params = {}) {\n if (params.resetPose !== false) mesh.pose()\n\n const bones = mesh.skeleton.bones\n const boneParams = vpd.bones\n\n const boneNameDictionary = {}\n\n for (let i = 0, il = bones.length; i < il; i++) {\n boneNameDictionary[bones[i].name] = i\n }\n\n const vector = new Vector3()\n const quaternion = new Quaternion()\n\n for (let i = 0, il = boneParams.length; i < il; i++) {\n const boneParam = boneParams[i]\n const boneIndex = boneNameDictionary[boneParam.name]\n\n if (boneIndex === undefined) continue\n\n const bone = bones[boneIndex]\n bone.position.add(vector.fromArray(boneParam.translation))\n bone.quaternion.multiply(quaternion.fromArray(boneParam.quaternion))\n }\n\n mesh.updateMatrixWorld(true)\n\n // PMX animation system special path\n if (this.configuration.pmxAnimation && mesh.geometry.userData.MMD && mesh.geometry.userData.MMD.format === 'pmx') {\n const sortedBonesData = this._sortBoneDataArray(mesh.geometry.userData.MMD.bones.slice())\n const ikSolver = params.ik !== false ? this._createCCDIKSolver(mesh) : null\n const grantSolver = params.grant !== false ? this.createGrantSolver(mesh) : null\n this._animatePMXMesh(mesh, sortedBonesData, ikSolver, grantSolver)\n } else {\n if (params.ik !== false) {\n this._createCCDIKSolver(mesh).update()\n }\n\n if (params.grant !== false) {\n this.createGrantSolver(mesh).update()\n }\n }\n\n return this\n }\n\n /**\n * Enabes/Disables an animation feature.\n *\n * @param {string} key\n * @param {boolean} enabled\n * @return {MMDAnimationHelper}\n */\n enable(key, enabled) {\n if (this.enabled[key] === undefined) {\n throw new Error('THREE.MMDAnimationHelper.enable: ' + 'unknown key ' + key)\n }\n\n this.enabled[key] = enabled\n\n if (key === 'physics') {\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n this._optimizeIK(this.meshes[i], enabled)\n }\n }\n\n return this\n }\n\n /**\n * Creates an GrantSolver instance.\n *\n * @param {THREE.SkinnedMesh} mesh\n * @return {GrantSolver}\n */\n createGrantSolver(mesh) {\n return new GrantSolver(mesh, mesh.geometry.userData.MMD.grants)\n }\n\n // private methods\n\n _addMesh(mesh, params) {\n if (this.meshes.indexOf(mesh) >= 0) {\n throw new Error('THREE.MMDAnimationHelper._addMesh: ' + \"SkinnedMesh '\" + mesh.name + \"' has already been added.\")\n }\n\n this.meshes.push(mesh)\n this.objects.set(mesh, { looped: false })\n\n this._setupMeshAnimation(mesh, params.animation)\n\n if (params.physics !== false) {\n this._setupMeshPhysics(mesh, params)\n }\n\n return this\n }\n\n _setupCamera(camera, params) {\n if (this.camera === camera) {\n throw new Error('THREE.MMDAnimationHelper._setupCamera: ' + \"Camera '\" + camera.name + \"' has already been set.\")\n }\n\n if (this.camera) this.clearCamera(this.camera)\n\n this.camera = camera\n\n camera.add(this.cameraTarget)\n\n this.objects.set(camera, {})\n\n if (params.animation !== undefined) {\n this._setupCameraAnimation(camera, params.animation)\n }\n\n return this\n }\n\n _setupAudio(audio, params) {\n if (this.audio === audio) {\n throw new Error('THREE.MMDAnimationHelper._setupAudio: ' + \"Audio '\" + audio.name + \"' has already been set.\")\n }\n\n if (this.audio) this.clearAudio(this.audio)\n\n this.audio = audio\n this.audioManager = new AudioManager(audio, params)\n\n this.objects.set(this.audioManager, {\n duration: this.audioManager.duration,\n })\n\n return this\n }\n\n _removeMesh(mesh) {\n let found = false\n let writeIndex = 0\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n if (this.meshes[i] === mesh) {\n this.objects.delete(mesh)\n found = true\n\n continue\n }\n\n this.meshes[writeIndex++] = this.meshes[i]\n }\n\n if (!found) {\n throw new Error(\n 'THREE.MMDAnimationHelper._removeMesh: ' + \"SkinnedMesh '\" + mesh.name + \"' has not been added yet.\",\n )\n }\n\n this.meshes.length = writeIndex\n\n return this\n }\n\n _clearCamera(camera) {\n if (camera !== this.camera) {\n throw new Error('THREE.MMDAnimationHelper._clearCamera: ' + \"Camera '\" + camera.name + \"' has not been set yet.\")\n }\n\n this.camera.remove(this.cameraTarget)\n\n this.objects.delete(this.camera)\n this.camera = null\n\n return this\n }\n\n _clearAudio(audio) {\n if (audio !== this.audio) {\n throw new Error('THREE.MMDAnimationHelper._clearAudio: ' + \"Audio '\" + audio.name + \"' has not been set yet.\")\n }\n\n this.objects.delete(this.audioManager)\n\n this.audio = null\n this.audioManager = null\n\n return this\n }\n\n _setupMeshAnimation(mesh, animation) {\n const objects = this.objects.get(mesh)\n\n if (animation !== undefined) {\n const animations = Array.isArray(animation) ? animation : [animation]\n\n objects.mixer = new AnimationMixer(mesh)\n\n for (let i = 0, il = animations.length; i < il; i++) {\n objects.mixer.clipAction(animations[i]).play()\n }\n\n // TODO: find a workaround not to access ._clip looking like a private property\n objects.mixer.addEventListener('loop', function (event) {\n const tracks = event.action._clip.tracks\n\n if (tracks.length > 0 && tracks[0].name.slice(0, 6) !== '.bones') return\n\n objects.looped = true\n })\n }\n\n objects.ikSolver = this._createCCDIKSolver(mesh)\n objects.grantSolver = this.createGrantSolver(mesh)\n\n return this\n }\n\n _setupCameraAnimation(camera, animation) {\n const animations = Array.isArray(animation) ? animation : [animation]\n\n const objects = this.objects.get(camera)\n\n objects.mixer = new AnimationMixer(camera)\n\n for (let i = 0, il = animations.length; i < il; i++) {\n objects.mixer.clipAction(animations[i]).play()\n }\n }\n\n _setupMeshPhysics(mesh, params) {\n const objects = this.objects.get(mesh)\n\n // shared physics is experimental\n\n if (params.world === undefined && this.sharedPhysics) {\n const masterPhysics = this._getMasterPhysics()\n\n if (masterPhysics !== null) world = masterPhysics.world // eslint-disable-line no-undef\n }\n\n objects.physics = this._createMMDPhysics(mesh, params)\n\n if (objects.mixer && params.animationWarmup !== false) {\n this._animateMesh(mesh, 0)\n objects.physics.reset()\n }\n\n objects.physics.warmup(params.warmup !== undefined ? params.warmup : 60)\n\n this._optimizeIK(mesh, true)\n }\n\n _animateMesh(mesh, delta) {\n const objects = this.objects.get(mesh)\n\n const mixer = objects.mixer\n const ikSolver = objects.ikSolver\n const grantSolver = objects.grantSolver\n const physics = objects.physics\n const looped = objects.looped\n\n if (mixer && this.enabled.animation) {\n // alternate solution to save/restore bones but less performant?\n //mesh.pose();\n //this._updatePropertyMixersBuffer( mesh );\n\n this._restoreBones(mesh)\n\n mixer.update(delta)\n\n this._saveBones(mesh)\n\n // PMX animation system special path\n if (\n this.configuration.pmxAnimation &&\n mesh.geometry.userData.MMD &&\n mesh.geometry.userData.MMD.format === 'pmx'\n ) {\n if (!objects.sortedBonesData)\n objects.sortedBonesData = this._sortBoneDataArray(mesh.geometry.userData.MMD.bones.slice())\n\n this._animatePMXMesh(\n mesh,\n objects.sortedBonesData,\n ikSolver && this.enabled.ik ? ikSolver : null,\n grantSolver && this.enabled.grant ? grantSolver : null,\n )\n } else {\n if (ikSolver && this.enabled.ik) {\n mesh.updateMatrixWorld(true)\n ikSolver.update()\n }\n\n if (grantSolver && this.enabled.grant) {\n grantSolver.update()\n }\n }\n }\n\n if (looped === true && this.enabled.physics) {\n if (physics && this.configuration.resetPhysicsOnLoop) physics.reset()\n\n objects.looped = false\n }\n\n if (physics && this.enabled.physics && !this.sharedPhysics) {\n this.onBeforePhysics(mesh)\n physics.update(delta)\n }\n }\n\n // Sort bones in order by 1. transformationClass and 2. bone index.\n // In PMX animation system, bone transformations should be processed\n // in this order.\n _sortBoneDataArray(boneDataArray) {\n return boneDataArray.sort(function (a, b) {\n if (a.transformationClass !== b.transformationClass) {\n return a.transformationClass - b.transformationClass\n } else {\n return a.index - b.index\n }\n })\n }\n\n // PMX Animation system is a bit too complex and doesn't great match to\n // Three.js Animation system. This method attempts to simulate it as much as\n // possible but doesn't perfectly simulate.\n // This method is more costly than the regular one so\n // you are recommended to set constructor parameter \"pmxAnimation: true\"\n // only if your PMX model animation doesn't work well.\n // If you need better method you would be required to write your own.\n _animatePMXMesh(mesh, sortedBonesData, ikSolver, grantSolver) {\n _quaternionIndex = 0\n _grantResultMap.clear()\n\n for (let i = 0, il = sortedBonesData.length; i < il; i++) {\n updateOne(mesh, sortedBonesData[i].index, ikSolver, grantSolver)\n }\n\n mesh.updateMatrixWorld(true)\n return this\n }\n\n _animateCamera(camera, delta) {\n const mixer = this.objects.get(camera).mixer\n\n if (mixer && this.enabled.cameraAnimation) {\n mixer.update(delta)\n\n camera.updateProjectionMatrix()\n\n camera.up.set(0, 1, 0)\n camera.up.applyQuaternion(camera.quaternion)\n camera.lookAt(this.cameraTarget.position)\n }\n }\n\n _optimizeIK(mesh, physicsEnabled) {\n const iks = mesh.geometry.userData.MMD.iks\n const bones = mesh.geometry.userData.MMD.bones\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n const links = ik.links\n\n for (let j = 0, jl = links.length; j < jl; j++) {\n const link = links[j]\n\n if (physicsEnabled === true) {\n // disable IK of the bone the corresponding rigidBody type of which is 1 or 2\n // because its rotation will be overriden by physics\n link.enabled = bones[link.index].rigidBodyType > 0 ? false : true\n } else {\n link.enabled = true\n }\n }\n }\n }\n\n _createCCDIKSolver(mesh) {\n if (CCDIKSolver === undefined) {\n throw new Error('THREE.MMDAnimationHelper: Import CCDIKSolver.')\n }\n\n return new CCDIKSolver(mesh, mesh.geometry.userData.MMD.iks)\n }\n\n _createMMDPhysics(mesh, params) {\n if (MMDPhysics === undefined) {\n throw new Error('THREE.MMDPhysics: Import MMDPhysics.')\n }\n\n return new MMDPhysics(mesh, mesh.geometry.userData.MMD.rigidBodies, mesh.geometry.userData.MMD.constraints, params)\n }\n\n /*\n * Detects the longest duration and then sets it to them to sync.\n * TODO: Not to access private properties ( ._actions and ._clip )\n */\n _syncDuration() {\n let max = 0.0\n\n const objects = this.objects\n const meshes = this.meshes\n const camera = this.camera\n const audioManager = this.audioManager\n\n // get the longest duration\n\n for (let i = 0, il = meshes.length; i < il; i++) {\n const mixer = this.objects.get(meshes[i]).mixer\n\n if (mixer === undefined) continue\n\n for (let j = 0; j < mixer._actions.length; j++) {\n const clip = mixer._actions[j]._clip\n\n if (!objects.has(clip)) {\n objects.set(clip, {\n duration: clip.duration,\n })\n }\n\n max = Math.max(max, objects.get(clip).duration)\n }\n }\n\n if (camera !== null) {\n const mixer = this.objects.get(camera).mixer\n\n if (mixer !== undefined) {\n for (let i = 0, il = mixer._actions.length; i < il; i++) {\n const clip = mixer._actions[i]._clip\n\n if (!objects.has(clip)) {\n objects.set(clip, {\n duration: clip.duration,\n })\n }\n\n max = Math.max(max, objects.get(clip).duration)\n }\n }\n }\n\n if (audioManager !== null) {\n max = Math.max(max, objects.get(audioManager).duration)\n }\n\n max += this.configuration.afterglow\n\n // update the duration\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const mixer = this.objects.get(this.meshes[i]).mixer\n\n if (mixer === undefined) continue\n\n for (let j = 0, jl = mixer._actions.length; j < jl; j++) {\n mixer._actions[j]._clip.duration = max\n }\n }\n\n if (camera !== null) {\n const mixer = this.objects.get(camera).mixer\n\n if (mixer !== undefined) {\n for (let i = 0, il = mixer._actions.length; i < il; i++) {\n mixer._actions[i]._clip.duration = max\n }\n }\n }\n\n if (audioManager !== null) {\n audioManager.duration = max\n }\n }\n\n // workaround\n\n _updatePropertyMixersBuffer(mesh) {\n const mixer = this.objects.get(mesh).mixer\n\n const propertyMixers = mixer._bindings\n const accuIndex = mixer._accuIndex\n\n for (let i = 0, il = propertyMixers.length; i < il; i++) {\n const propertyMixer = propertyMixers[i]\n const buffer = propertyMixer.buffer\n const stride = propertyMixer.valueSize\n const offset = (accuIndex + 1) * stride\n\n propertyMixer.binding.getValue(buffer, offset)\n }\n }\n\n /*\n * Avoiding these two issues by restore/save bones before/after mixer animation.\n *\n * 1. PropertyMixer used by AnimationMixer holds cache value in .buffer.\n * Calculating IK, Grant, and Physics after mixer animation can break\n * the cache coherency.\n *\n * 2. Applying Grant two or more times without reset the posing breaks model.\n */\n _saveBones(mesh) {\n const objects = this.objects.get(mesh)\n\n const bones = mesh.skeleton.bones\n\n let backupBones = objects.backupBones\n\n if (backupBones === undefined) {\n backupBones = new Float32Array(bones.length * 7)\n objects.backupBones = backupBones\n }\n\n for (let i = 0, il = bones.length; i < il; i++) {\n const bone = bones[i]\n bone.position.toArray(backupBones, i * 7)\n bone.quaternion.toArray(backupBones, i * 7 + 3)\n }\n }\n\n _restoreBones(mesh) {\n const objects = this.objects.get(mesh)\n\n const backupBones = objects.backupBones\n\n if (backupBones === undefined) return\n\n const bones = mesh.skeleton.bones\n\n for (let i = 0, il = bones.length; i < il; i++) {\n const bone = bones[i]\n bone.position.fromArray(backupBones, i * 7)\n bone.quaternion.fromArray(backupBones, i * 7 + 3)\n }\n }\n\n // experimental\n\n _getMasterPhysics() {\n if (this.masterPhysics !== null) return this.masterPhysics\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const physics = this.meshes[i].physics\n\n if (physics !== undefined && physics !== null) {\n this.masterPhysics = physics\n return this.masterPhysics\n }\n }\n\n return null\n }\n\n _updateSharedPhysics(delta) {\n if (this.meshes.length === 0 || !this.enabled.physics || !this.sharedPhysics) return\n\n const physics = this._getMasterPhysics()\n\n if (physics === null) return\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const p = this.meshes[i].physics\n\n if (p !== null && p !== undefined) {\n p.updateRigidBodies()\n }\n }\n\n physics.stepSimulation(delta)\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const p = this.meshes[i].physics\n\n if (p !== null && p !== undefined) {\n p.updateBones()\n }\n }\n }\n}\n\n// Keep working quaternions for less GC\nconst _quaternions = []\nlet _quaternionIndex = 0\n\nfunction getQuaternion() {\n if (_quaternionIndex >= _quaternions.length) {\n _quaternions.push(new Quaternion())\n }\n\n return _quaternions[_quaternionIndex++]\n}\n\n// Save rotation whose grant and IK are already applied\n// used by grant children\nconst _grantResultMap = new Map()\n\nfunction updateOne(mesh, boneIndex, ikSolver, grantSolver) {\n const bones = mesh.skeleton.bones\n const bonesData = mesh.geometry.userData.MMD.bones\n const boneData = bonesData[boneIndex]\n const bone = bones[boneIndex]\n\n // Return if already updated by being referred as a grant parent.\n if (_grantResultMap.has(boneIndex)) return\n\n const quaternion = getQuaternion()\n\n // Initialize grant result here to prevent infinite loop.\n // If it's referred before updating with actual result later\n // result without applyting IK or grant is gotten\n // but better than composing of infinite loop.\n _grantResultMap.set(boneIndex, quaternion.copy(bone.quaternion))\n\n // @TODO: Support global grant and grant position\n if (grantSolver && boneData.grant && !boneData.grant.isLocal && boneData.grant.affectRotation) {\n const parentIndex = boneData.grant.parentIndex\n const ratio = boneData.grant.ratio\n\n if (!_grantResultMap.has(parentIndex)) {\n updateOne(mesh, parentIndex, ikSolver, grantSolver)\n }\n\n grantSolver.addGrantRotation(bone, _grantResultMap.get(parentIndex), ratio)\n }\n\n if (ikSolver && boneData.ik) {\n // @TODO: Updating world matrices every time solving an IK bone is\n // costly. Optimize if possible.\n mesh.updateMatrixWorld(true)\n ikSolver.updateOne(boneData.ik)\n\n // No confident, but it seems the grant results with ik links should be updated?\n const links = boneData.ik.links\n\n for (let i = 0, il = links.length; i < il; i++) {\n const link = links[i]\n\n if (link.enabled === false) continue\n\n const linkIndex = link.index\n\n if (_grantResultMap.has(linkIndex)) {\n _grantResultMap.set(linkIndex, _grantResultMap.get(linkIndex).copy(bones[linkIndex].quaternion))\n }\n }\n }\n\n // Update with the actual result here\n quaternion.copy(bone.quaternion)\n}\n\n//\n\nclass AudioManager {\n /**\n * @param {THREE.Audio} audio\n * @param {Object} params - (optional)\n * @param {Nuumber} params.delayTime\n */\n constructor(audio, params = {}) {\n this.audio = audio\n\n this.elapsedTime = 0.0\n this.currentTime = 0.0\n this.delayTime = params.delayTime !== undefined ? params.delayTime : 0.0\n\n this.audioDuration = this.audio.buffer.duration\n this.duration = this.audioDuration + this.delayTime\n }\n\n /**\n * @param {Number} delta\n * @return {AudioManager}\n */\n control(delta) {\n this.elapsed += delta\n this.currentTime += delta\n\n if (this._shouldStopAudio()) this.audio.stop()\n if (this._shouldStartAudio()) this.audio.play()\n\n return this\n }\n\n // private methods\n\n _shouldStartAudio() {\n if (this.audio.isPlaying) return false\n\n while (this.currentTime >= this.duration) {\n this.currentTime -= this.duration\n }\n\n if (this.currentTime < this.delayTime) return false\n\n // 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration\n if (this.currentTime - this.delayTime > this.audioDuration) return false\n\n return true\n }\n\n _shouldStopAudio() {\n return this.audio.isPlaying && this.currentTime >= this.duration\n }\n}\n\nconst _q = new Quaternion()\n\n/**\n * Solver for Grant (Fuyo in Japanese. I just google translated because\n * Fuyo may be MMD specific term and may not be common word in 3D CG terms.)\n * Grant propagates a bone's transform to other bones transforms even if\n * they are not children.\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} grants\n */\nclass GrantSolver {\n constructor(mesh, grants = []) {\n this.mesh = mesh\n this.grants = grants\n }\n\n /**\n * Solve all the grant bones\n * @return {GrantSolver}\n */\n update() {\n const grants = this.grants\n\n for (let i = 0, il = grants.length; i < il; i++) {\n this.updateOne(grants[i])\n }\n\n return this\n }\n\n /**\n * Solve a grant bone\n * @param {Object} grant - grant parameter\n * @return {GrantSolver}\n */\n updateOne(grant) {\n const bones = this.mesh.skeleton.bones\n const bone = bones[grant.index]\n const parentBone = bones[grant.parentIndex]\n\n if (grant.isLocal) {\n // TODO: implement\n if (grant.affectPosition) {\n }\n\n // TODO: implement\n if (grant.affectRotation) {\n }\n } else {\n // TODO: implement\n if (grant.affectPosition) {\n }\n\n if (grant.affectRotation) {\n this.addGrantRotation(bone, parentBone.quaternion, grant.ratio)\n }\n }\n\n return this\n }\n\n addGrantRotation(bone, q, ratio) {\n _q.set(0, 0, 0, 1)\n _q.slerp(q, ratio)\n bone.quaternion.multiply(_q)\n\n return this\n }\n}\n\nexport { MMDAnimationHelper }\n", "import {\n Matrix4,\n BufferAttribute,\n InterleavedBufferAttribute,\n Mesh,\n BufferGeometry,\n Material,\n DataTexture,\n IUniform,\n MathUtils,\n RGBAFormat,\n FloatType,\n} from 'three'\n\nconst ID_ATTR_NAME = '_batch_id_'\nconst _identityMatrix = new Matrix4()\nconst _zeroScaleMatrix = new Matrix4().set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)\n\n// Custom shaders\nconst batchingParsVertex = /* glsl */ `\n#ifdef BATCHING\n\tattribute float ${ID_ATTR_NAME};\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\n\t}\n#endif\n`\n\nconst batchingbaseVertex = /* glsl */ `\n#ifdef BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( ${ID_ATTR_NAME} );\n#endif\n`\n\nconst batchingnormalVertex = /* glsl */ `\n#ifdef BATCHING\n\tobjectNormal = vec4( batchingMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( batchingMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif\n`\n\nconst batchingVertex = /* glsl */ `\n#ifdef BATCHING\n\ttransformed = ( batchingMatrix * vec4( transformed, 1.0 ) ).xyz;\n#endif\n`\n\n// @TODO: SkinnedMesh support?\n// @TODO: Future work if needed. Move into the core. Can be optimized more with WEBGL_multi_draw.\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData(\n src: BufferAttribute | InterleavedBufferAttribute,\n target: BufferAttribute | InterleavedBufferAttribute,\n targetOffset = 0,\n): void {\n const itemSize = target.itemSize\n if (\n (src as InterleavedBufferAttribute).isInterleavedBufferAttribute ||\n src.array.constructor !== target.array.constructor\n ) {\n // use the component getters and setters if the array data cannot\n // be copied directly\n const vertexCount = src.count\n for (let i = 0; i < vertexCount; i++) {\n for (let c = 0; c < itemSize; c++) {\n // @ts-ignore\n target.setComponent(i + targetOffset, c, src.getComponent(i, c))\n }\n }\n } else {\n // faster copy approach using typed array set function\n // @ts-ignore\n target.array.set(src.array, targetOffset * itemSize)\n }\n\n target.needsUpdate = true\n}\n\nclass BatchedMesh extends Mesh {\n _vertexStarts: number[]\n _vertexCounts: number[]\n _indexStarts: number[]\n _indexCounts: number[]\n _reservedRanges: { vertexStart: number; vertexCount: number; indexStart: number; indexCount: number }[]\n _visible: boolean[]\n _active: boolean[]\n _maxGeometryCount: number\n _maxVertexCount: number\n _maxIndexCount: number\n _geometryInitialized: boolean\n _geometryCount: number\n _matrices: Matrix4[]\n _matricesTexture: DataTexture | null\n _customUniforms: Record\n\n constructor(\n maxGeometryCount: number,\n maxVertexCount: number,\n maxIndexCount = maxVertexCount * 2,\n material?: Material,\n ) {\n super(new BufferGeometry(), material)\n\n this._vertexStarts = []\n this._vertexCounts = []\n this._indexStarts = []\n this._indexCounts = []\n this._reservedRanges = []\n\n this._visible = []\n this._active = []\n\n this._maxGeometryCount = maxGeometryCount\n this._maxVertexCount = maxVertexCount\n this._maxIndexCount = maxIndexCount\n\n this._geometryInitialized = false\n this._geometryCount = 0\n\n // Local matrix per geometry by using data texture\n // @TODO: Support uniform parameter per geometry\n\n this._matrices = []\n this._matricesTexture = null!\n\n // @TODO: Calculate the entire binding box and make frustumCulled true\n this.frustumCulled = false\n\n this._customUniforms = {\n batchingTexture: { value: null },\n }\n\n this._initMatricesTexture()\n this._initShader()\n\n this.onBeforeRender = function () {\n if (this.material.defines) {\n this.material.defines.BATCHING = true\n }\n\n // @TODO: Implement frustum culling for each geometry\n }\n\n this.onAfterRender = function () {\n if (this.material.defines) {\n this.material.defines.BATCHING = false\n }\n }\n }\n\n _initMatricesTexture(): void {\n // layout (1 matrix = 4 pixels)\n // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n // with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)\n // 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n // 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n // 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n let size = Math.sqrt(this._maxGeometryCount * 4) // 4 pixels needed for 1 matrix\n size = MathUtils.ceilPowerOfTwo(size)\n size = Math.max(size, 4)\n\n const matricesArray = new Float32Array(size * size * 4) // 4 floats per RGBA pixel\n const matricesTexture = new DataTexture(matricesArray, size, size, RGBAFormat, FloatType)\n\n this._matricesTexture = matricesTexture\n this._customUniforms.batchingTexture.value = this._matricesTexture\n }\n\n _initShader(): void {\n const material = this.material\n const currentOnBeforeCompile = material.onBeforeCompile\n const customUniforms = this._customUniforms\n\n material.onBeforeCompile = function onBeforeCompile(parameters, renderer) {\n // Is this replacement stable across any materials?\n parameters.vertexShader = parameters.vertexShader\n .replace('#include ', '#include \\n' + batchingParsVertex)\n .replace('#include ', '#include \\n' + batchingbaseVertex)\n .replace('#include ', '#include \\n' + batchingnormalVertex)\n .replace('#include ', '#include \\n' + batchingVertex)\n\n for (const uniformName in customUniforms) {\n parameters.uniforms[uniformName] = customUniforms[uniformName]\n }\n\n currentOnBeforeCompile.call(this, parameters, renderer)\n }\n\n material.defines = material.defines || {}\n material.defines.BATCHING = false\n }\n\n _initializeGeometry(reference: BufferGeometry): void {\n // @TODO: geometry.groups support?\n // @TODO: geometry.drawRange support?\n // @TODO: geometry.morphAttributes support?\n\n const geometry = this.geometry\n const maxVertexCount = this._maxVertexCount\n const maxGeometryCount = this._maxGeometryCount\n const maxIndexCount = this._maxIndexCount\n if (this._geometryInitialized === false) {\n for (const attributeName in reference.attributes) {\n const srcAttribute = reference.getAttribute(attributeName)\n const { array, itemSize, normalized } = srcAttribute\n\n const dstArray = new (array.constructor as Float32ArrayConstructor)(maxVertexCount * itemSize)\n const dstAttribute = new (srcAttribute.constructor as any)(dstArray, itemSize, normalized)\n\n // TODO: add usage in @types/three\n // @ts-ignore\n dstAttribute.setUsage(srcAttribute.usage)\n\n geometry.setAttribute(attributeName, dstAttribute)\n }\n\n if (reference.getIndex() !== null) {\n const indexArray = maxVertexCount > 65536 ? new Uint32Array(maxIndexCount) : new Uint16Array(maxIndexCount)\n\n geometry.setIndex(new BufferAttribute(indexArray, 1))\n }\n\n const idArray = maxGeometryCount > 65536 ? new Uint32Array(maxVertexCount) : new Uint16Array(maxVertexCount)\n geometry.setAttribute(ID_ATTR_NAME, new BufferAttribute(idArray, 1))\n\n this._geometryInitialized = true\n }\n }\n\n // Make sure the geometry is compatible with the existing combined geometry atributes\n _validateGeometry(geometry: BufferGeometry): void {\n // check that the geometry doesn't have a version of our reserved id attribute\n if (geometry.getAttribute(ID_ATTR_NAME)) {\n throw new Error(`BatchedMesh: Geometry cannot use attribute \"${ID_ATTR_NAME}\"`)\n }\n\n // check to ensure the geometries are using consistent attributes and indices\n const batchGeometry = this.geometry\n if (Boolean(geometry.getIndex()) !== Boolean(batchGeometry.getIndex())) {\n throw new Error('BatchedMesh: All geometries must consistently have \"index\".')\n }\n\n for (const attributeName in batchGeometry.attributes) {\n if (attributeName === ID_ATTR_NAME) {\n continue\n }\n\n if (!geometry.hasAttribute(attributeName)) {\n throw new Error(\n `BatchedMesh: Added geometry missing \"${attributeName}\". All geometries must have consistent attributes.`,\n )\n }\n\n const srcAttribute = geometry.getAttribute(attributeName)\n const dstAttribute = batchGeometry.getAttribute(attributeName)\n if (srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized) {\n throw new Error('BatchedMesh: All attributes must have a consistent itemSize and normalized value.')\n }\n }\n }\n\n getGeometryCount(): number {\n return this._geometryCount\n }\n\n getVertexCount(): number {\n const reservedRanges = this._reservedRanges\n if (reservedRanges.length === 0) {\n return 0\n } else {\n const finalRange = reservedRanges[reservedRanges.length - 1]\n return finalRange.vertexStart + finalRange.vertexCount\n }\n }\n\n getIndexCount(): number {\n const reservedRanges = this._reservedRanges\n const geometry = this.geometry\n if (geometry.getIndex() === null || reservedRanges.length === 0) {\n return 0\n } else {\n const finalRange = reservedRanges[reservedRanges.length - 1]\n return finalRange.indexStart + finalRange.indexCount\n }\n }\n\n addGeometry(geometry: BufferGeometry, vertexCount = -1, indexCount = -1): number {\n this._initializeGeometry(geometry)\n\n this._validateGeometry(geometry)\n\n // ensure we're not over geometry\n if (this._geometryCount >= this._maxGeometryCount) {\n throw new Error('BatchedMesh: Maximum geometry count reached.')\n }\n\n // get the necessary range fo the geometry\n const range = {\n vertexStart: -1,\n vertexCount: -1,\n indexStart: -1,\n indexCount: -1,\n }\n\n let lastRange = null\n const reservedRanges = this._reservedRanges\n if (this._geometryCount !== 0) {\n lastRange = reservedRanges[reservedRanges.length - 1]\n }\n\n if (vertexCount === -1) {\n range.vertexCount = geometry.getAttribute('position').count\n } else {\n range.vertexCount = vertexCount\n }\n\n if (lastRange === null) {\n range.vertexStart = 0\n } else {\n range.vertexStart = lastRange.vertexStart + lastRange.vertexCount\n }\n\n if (geometry.getIndex() !== null) {\n if (indexCount === -1) {\n range.indexCount = geometry.getIndex()!.count\n } else {\n range.indexCount = indexCount\n }\n\n if (lastRange === null) {\n range.indexStart = 0\n } else {\n range.indexStart = lastRange.indexStart + lastRange.indexCount\n }\n }\n\n if (\n (range.indexStart !== -1 && range.indexStart + range.indexCount > this._maxIndexCount) ||\n range.vertexStart + range.vertexCount > this._maxVertexCount\n ) {\n throw new Error('BatchedMesh: Reserved space request exceeds the maximum buffer size.')\n }\n\n const indexCounts = this._indexCounts\n const indexStarts = this._indexStarts\n const vertexCounts = this._vertexCounts\n const vertexStarts = this._vertexStarts\n\n const visible = this._visible\n const active = this._active\n const matricesTexture = this._matricesTexture\n const matrices = this._matrices\n const matricesArray = this._matricesTexture!.image.data\n\n // push new visibility states\n visible.push(true)\n active.push(true)\n\n // update id\n const geometryId = this._geometryCount\n this._geometryCount++\n\n // initialize matrix information\n matrices.push(new Matrix4())\n _identityMatrix.toArray(matricesArray, geometryId * 16)\n matricesTexture!.needsUpdate = true\n\n // add the reserved range\n reservedRanges.push(range)\n\n // push new geometry data range\n vertexStarts.push(range.vertexStart)\n vertexCounts.push(range.vertexCount)\n\n if (geometry.getIndex() !== null) {\n // push new index range\n indexStarts.push(range.indexCount)\n indexCounts.push(range.indexCount)\n }\n\n // set the id for the geometry\n const idAttribute = this.geometry.getAttribute(ID_ATTR_NAME)\n for (let i = 0; i < range.vertexCount; i++) {\n idAttribute.setX(range.vertexStart + i, geometryId)\n }\n\n idAttribute.needsUpdate = true\n\n // update the geometry\n this.setGeometryAt(geometryId, geometry)\n\n return geometryId\n }\n\n /**\n * @deprecated use `addGeometry` instead.\n */\n applyGeometry(geometry: BufferGeometry): number {\n return this.addGeometry(geometry)\n }\n\n setGeometryAt(id: number, geometry: BufferGeometry): number {\n if (id >= this._geometryCount) {\n throw new Error('BatchedMesh: Maximum geometry count reached.')\n }\n\n this._validateGeometry(geometry)\n\n const range = this._reservedRanges[id]\n if (\n (geometry.getIndex() !== null && geometry.getIndex()!.count > range.indexCount) ||\n geometry.attributes.position.count > range.vertexCount\n ) {\n throw new Error('BatchedMesh: Reserved space not large enough for provided geometry.')\n }\n\n // copy geometry over\n const batchGeometry = this.geometry\n const srcPositionAttribute = geometry.getAttribute('position')\n const hasIndex = batchGeometry.getIndex() !== null\n const dstIndex = batchGeometry.getIndex()!\n const srcIndex = geometry.getIndex()!\n\n // copy attribute data over\n const vertexStart = range.vertexStart\n const vertexCount = range.vertexCount\n for (const attributeName in batchGeometry.attributes) {\n if (attributeName === ID_ATTR_NAME) {\n continue\n }\n\n const srcAttribute = geometry.getAttribute(attributeName)\n const dstAttribute = batchGeometry.getAttribute(attributeName)\n copyAttributeData(srcAttribute, dstAttribute, vertexStart)\n\n // fill the rest in with zeroes\n const itemSize = srcAttribute.itemSize\n for (let i = srcAttribute.count, l = vertexCount; i < l; i++) {\n const index = vertexStart + i\n for (let c = 0; c < itemSize; c++) {\n // @ts-ignore\n dstAttribute.setComponent(index, c, 0)\n }\n }\n\n dstAttribute.needsUpdate = true\n }\n\n this._vertexCounts[id] = srcPositionAttribute.count\n\n if (hasIndex) {\n // fill the rest in with zeroes\n const indexStart = range.indexStart\n\n // copy index data over\n for (let i = 0; i < srcIndex.count; i++) {\n dstIndex.setX(indexStart + i, vertexStart + srcIndex.getX(i))\n }\n\n // fill the rest in with zeroes\n for (let i = srcIndex.count, l = range.indexCount; i < l; i++) {\n dstIndex.setX(indexStart + i, vertexStart)\n }\n\n dstIndex.needsUpdate = true\n this._indexCounts[id] = srcIndex.count\n }\n\n return id\n }\n\n deleteGeometry(geometryId: number): this {\n // Note: User needs to call optimize() afterward to pack the data.\n\n const active = this._active\n const matricesTexture = this._matricesTexture!\n const matricesArray = matricesTexture.image.data\n if (geometryId >= active.length || active[geometryId] === false) {\n return this\n }\n\n active[geometryId] = false\n _zeroScaleMatrix.toArray(matricesArray, geometryId * 16)\n matricesTexture!.needsUpdate = true\n\n return this\n }\n\n optimize(): never {\n throw new Error('BatchedMesh: Optimize function not implemented.')\n }\n\n setMatrixAt(geometryId: number, matrix: Matrix4): this {\n // @TODO: Map geometryId to index of the arrays because\n // optimize() can make geometryId mismatch the index\n\n const visible = this._visible\n const active = this._active\n const matricesTexture = this._matricesTexture!\n const matrices = this._matrices\n const matricesArray = matricesTexture.image.data\n if (geometryId >= matrices.length || active[geometryId] === false) {\n return this\n }\n\n if (visible[geometryId] === true) {\n matrix.toArray(matricesArray, geometryId * 16)\n matricesTexture.needsUpdate = true\n }\n\n matrices[geometryId].copy(matrix)\n\n return this\n }\n\n getMatrixAt(geometryId: number, matrix: Matrix4): Matrix4 {\n const matrices = this._matrices\n const active = this._active\n if (geometryId >= matrices.length || active[geometryId] === false) {\n return matrix\n }\n\n return matrix.copy(matrices[geometryId])\n }\n\n setVisibleAt(geometryId: number, value: boolean): this {\n const visible = this._visible\n const active = this._active\n const matricesTexture = this._matricesTexture!\n const matrices = this._matrices\n const matricesArray = matricesTexture.image.data\n\n // if the geometry is out of range, not active, or visibility state\n // does not change then return early\n if (geometryId >= visible.length || active[geometryId] === false || visible[geometryId] === value) {\n return this\n }\n\n // scale the matrix to zero if it's hidden\n if (value === true) {\n matrices[geometryId].toArray(matricesArray, geometryId * 16)\n } else {\n _zeroScaleMatrix.toArray(matricesArray, geometryId * 16)\n }\n\n matricesTexture.needsUpdate = true\n visible[geometryId] = value\n\n return this\n }\n\n getVisibleAt(geometryId: number): boolean {\n const visible = this._visible\n const active = this._active\n\n // return early if the geometry is out of range or not active\n if (geometryId >= visible.length || active[geometryId] === false) {\n return false\n }\n\n return visible[geometryId]\n }\n\n raycast(): void {\n console.warn('BatchedMesh: Raycast function not implemented.')\n }\n\n copy(): never {\n // super.copy( source );\n\n throw new Error('BatchedMesh: Copy function not implemented.')\n }\n\n toJSON(): never {\n throw new Error('BatchedMesh: toJSON function not implemented.')\n }\n\n dispose(): this {\n // Assuming the geometry is not shared with other meshes\n this.geometry.dispose()\n\n this._matricesTexture!.dispose()\n this._matricesTexture = null!\n\n return this\n }\n}\n\nexport { BatchedMesh }\n", "import {\n Color,\n Matrix4,\n Mesh,\n PerspectiveCamera,\n Plane,\n ShaderMaterial,\n UniformsUtils,\n Vector3,\n Vector4,\n WebGLRenderTarget,\n HalfFloatType,\n NoToneMapping,\n} from 'three'\nimport { version } from '../_polyfill/constants'\n\nclass Reflector extends Mesh {\n static ReflectorShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n tDiffuse: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n },\n\n vertexShader: /* glsl */ `\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\t\t#include \n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t#include \n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\n\t\t}`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isReflector = true\n\n this.type = 'Reflector'\n this.camera = new PerspectiveCamera()\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0x7f7f7f)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const shader = options.shader || Reflector.ReflectorShader\n const multisample = options.multisample !== undefined ? options.multisample : 4\n\n //\n\n const reflectorPlane = new Plane()\n const normal = new Vector3()\n const reflectorWorldPosition = new Vector3()\n const cameraWorldPosition = new Vector3()\n const rotationMatrix = new Matrix4()\n const lookAtPosition = new Vector3(0, 0, -1)\n const clipPlane = new Vector4()\n\n const view = new Vector3()\n const target = new Vector3()\n const q = new Vector4()\n\n const textureMatrix = new Matrix4()\n const virtualCamera = this.camera\n\n const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight, {\n samples: multisample,\n type: HalfFloatType,\n })\n\n const material = new ShaderMaterial({\n uniforms: UniformsUtils.clone(shader.uniforms),\n fragmentShader: shader.fragmentShader,\n vertexShader: shader.vertexShader,\n })\n\n material.uniforms['tDiffuse'].value = renderTarget.texture\n material.uniforms['color'].value = color\n material.uniforms['textureMatrix'].value = textureMatrix\n\n this.material = material\n\n this.onBeforeRender = function (renderer, scene, camera) {\n reflectorWorldPosition.setFromMatrixPosition(scope.matrixWorld)\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld)\n\n rotationMatrix.extractRotation(scope.matrixWorld)\n\n normal.set(0, 0, 1)\n normal.applyMatrix4(rotationMatrix)\n\n view.subVectors(reflectorWorldPosition, cameraWorldPosition)\n\n // Avoid rendering when reflector is facing away\n\n if (view.dot(normal) > 0) return\n\n view.reflect(normal).negate()\n view.add(reflectorWorldPosition)\n\n rotationMatrix.extractRotation(camera.matrixWorld)\n\n lookAtPosition.set(0, 0, -1)\n lookAtPosition.applyMatrix4(rotationMatrix)\n lookAtPosition.add(cameraWorldPosition)\n\n target.subVectors(reflectorWorldPosition, lookAtPosition)\n target.reflect(normal).negate()\n target.add(reflectorWorldPosition)\n\n virtualCamera.position.copy(view)\n virtualCamera.up.set(0, 1, 0)\n virtualCamera.up.applyMatrix4(rotationMatrix)\n virtualCamera.up.reflect(normal)\n virtualCamera.lookAt(target)\n\n virtualCamera.far = camera.far // Used in WebGLBackground\n\n virtualCamera.updateMatrixWorld()\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix)\n\n // Update the texture matrix\n textureMatrix.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 textureMatrix.multiply(virtualCamera.projectionMatrix)\n textureMatrix.multiply(virtualCamera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n\n // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html\n // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf\n reflectorPlane.setFromNormalAndCoplanarPoint(normal, reflectorWorldPosition)\n reflectorPlane.applyMatrix4(virtualCamera.matrixWorldInverse)\n\n clipPlane.set(reflectorPlane.normal.x, reflectorPlane.normal.y, reflectorPlane.normal.z, reflectorPlane.constant)\n\n const projectionMatrix = virtualCamera.projectionMatrix\n\n q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0]\n q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5]\n q.z = -1.0\n q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14]\n\n // Calculate the scaled plane vector\n clipPlane.multiplyScalar(2.0 / clipPlane.dot(q))\n\n // Replacing the third row of the projection matrix\n projectionMatrix.elements[2] = clipPlane.x\n projectionMatrix.elements[6] = clipPlane.y\n projectionMatrix.elements[10] = clipPlane.z + 1.0 - clipBias\n projectionMatrix.elements[14] = clipPlane.w\n\n // Render\n scope.visible = false\n\n const currentRenderTarget = renderer.getRenderTarget()\n\n const currentXrEnabled = renderer.xr.enabled\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate\n const currentToneMapping = renderer.toneMapping\n\n let isSRGB = false\n if ('outputColorSpace' in renderer) isSRGB = renderer.outputColorSpace === 'srgb'\n else isSRGB = renderer.outputEncoding === 3001 // sRGBEncoding\n\n renderer.xr.enabled = false // Avoid camera modification\n renderer.shadowMap.autoUpdate = false // Avoid re-computing shadows\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'srgb-linear'\n else renderer.outputEncoding = 3000 // LinearEncoding\n renderer.toneMapping = NoToneMapping\n\n renderer.setRenderTarget(renderTarget)\n\n renderer.state.buffers.depth.setMask(true) // make sure the depth buffer is writable so it can be properly cleared, see #18897\n\n if (renderer.autoClear === false) renderer.clear()\n renderer.render(scene, virtualCamera)\n\n renderer.xr.enabled = currentXrEnabled\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate\n renderer.toneMapping = currentToneMapping\n\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = isSRGB ? 'srgb' : 'srgb-linear'\n else renderer.outputEncoding = isSRGB ? 3001 : 3000\n\n renderer.setRenderTarget(currentRenderTarget)\n\n // Restore viewport\n\n const viewport = camera.viewport\n\n if (viewport !== undefined) {\n renderer.state.viewport(viewport)\n }\n\n scope.visible = true\n }\n\n this.getRenderTarget = function () {\n return renderTarget\n }\n\n this.dispose = function () {\n renderTarget.dispose()\n scope.material.dispose()\n }\n }\n}\n\nexport { Reflector }\n", "import {\n Color,\n Matrix4,\n Mesh,\n PerspectiveCamera,\n Plane,\n Quaternion,\n ShaderMaterial,\n UniformsUtils,\n Vector3,\n Vector4,\n WebGLRenderTarget,\n NoToneMapping,\n HalfFloatType,\n} from 'three'\nimport { version } from '../_polyfill/constants'\n\nclass Refractor extends Mesh {\n static RefractorShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n tDiffuse: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n },\n\n vertexShader: /* glsl */ `\n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec4 vUv;\n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\n\t\t}`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isRefractor = true\n\n this.type = 'Refractor'\n this.camera = new PerspectiveCamera()\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0x7f7f7f)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const shader = options.shader || Refractor.RefractorShader\n const multisample = options.multisample !== undefined ? options.multisample : 4\n\n //\n\n const virtualCamera = this.camera\n virtualCamera.matrixAutoUpdate = false\n virtualCamera.userData.refractor = true\n\n //\n\n const refractorPlane = new Plane()\n const textureMatrix = new Matrix4()\n\n // render target\n\n const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight, {\n samples: multisample,\n type: HalfFloatType,\n })\n\n // material\n\n this.material = new ShaderMaterial({\n uniforms: UniformsUtils.clone(shader.uniforms),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n transparent: true, // ensures, refractors are drawn from farthest to closest\n })\n\n this.material.uniforms['color'].value = color\n this.material.uniforms['tDiffuse'].value = renderTarget.texture\n this.material.uniforms['textureMatrix'].value = textureMatrix\n\n // functions\n\n const visible = (function () {\n const refractorWorldPosition = new Vector3()\n const cameraWorldPosition = new Vector3()\n const rotationMatrix = new Matrix4()\n\n const view = new Vector3()\n const normal = new Vector3()\n\n return function visible(camera) {\n refractorWorldPosition.setFromMatrixPosition(scope.matrixWorld)\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld)\n\n view.subVectors(refractorWorldPosition, cameraWorldPosition)\n\n rotationMatrix.extractRotation(scope.matrixWorld)\n\n normal.set(0, 0, 1)\n normal.applyMatrix4(rotationMatrix)\n\n return view.dot(normal) < 0\n }\n })()\n\n const updateRefractorPlane = (function () {\n const normal = new Vector3()\n const position = new Vector3()\n const quaternion = new Quaternion()\n const scale = new Vector3()\n\n return function updateRefractorPlane() {\n scope.matrixWorld.decompose(position, quaternion, scale)\n normal.set(0, 0, 1).applyQuaternion(quaternion).normalize()\n\n // flip the normal because we want to cull everything above the plane\n\n normal.negate()\n\n refractorPlane.setFromNormalAndCoplanarPoint(normal, position)\n }\n })()\n\n const updateVirtualCamera = (function () {\n const clipPlane = new Plane()\n const clipVector = new Vector4()\n const q = new Vector4()\n\n return function updateVirtualCamera(camera) {\n virtualCamera.matrixWorld.copy(camera.matrixWorld)\n virtualCamera.matrixWorldInverse.copy(virtualCamera.matrixWorld).invert()\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix)\n virtualCamera.far = camera.far // used in WebGLBackground\n\n // The following code creates an oblique view frustum for clipping.\n // see: Lengyel, Eric. “Oblique View Frustum Depth Projection and Clipping”.\n // Journal of Game Development, Vol. 1, No. 2 (2005), Charles River Media, pp. 5–16\n\n clipPlane.copy(refractorPlane)\n clipPlane.applyMatrix4(virtualCamera.matrixWorldInverse)\n\n clipVector.set(clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.constant)\n\n // calculate the clip-space corner point opposite the clipping plane and\n // transform it into camera space by multiplying it by the inverse of the projection matrix\n\n const projectionMatrix = virtualCamera.projectionMatrix\n\n q.x = (Math.sign(clipVector.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0]\n q.y = (Math.sign(clipVector.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5]\n q.z = -1.0\n q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14]\n\n // calculate the scaled plane vector\n\n clipVector.multiplyScalar(2.0 / clipVector.dot(q))\n\n // replacing the third row of the projection matrix\n\n projectionMatrix.elements[2] = clipVector.x\n projectionMatrix.elements[6] = clipVector.y\n projectionMatrix.elements[10] = clipVector.z + 1.0 - clipBias\n projectionMatrix.elements[14] = clipVector.w\n }\n })()\n\n // This will update the texture matrix that is used for projective texture mapping in the shader.\n // see: http://developer.download.nvidia.com/assets/gamedev/docs/projective_texture_mapping.pdf\n\n function updateTextureMatrix(camera) {\n // this matrix does range mapping to [ 0, 1 ]\n\n textureMatrix.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\n // we use \"Object Linear Texgen\", so we need to multiply the texture matrix T\n // (matrix above) with the projection and view matrix of the virtual camera\n // and the model matrix of the refractor\n\n textureMatrix.multiply(camera.projectionMatrix)\n textureMatrix.multiply(camera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n }\n\n //\n\n function render(renderer, scene, camera) {\n scope.visible = false\n\n const currentRenderTarget = renderer.getRenderTarget()\n const currentXrEnabled = renderer.xr.enabled\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate\n const currentToneMapping = renderer.toneMapping\n\n let isSRGB = false\n if ('outputColorSpace' in renderer) isSRGB = renderer.outputColorSpace === 'srgb'\n else isSRGB = renderer.outputEncoding === 3001 // sRGBEncoding\n\n renderer.xr.enabled = false // avoid camera modification\n renderer.shadowMap.autoUpdate = false // avoid re-computing shadows\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'srgb-linear'\n else renderer.outputEncoding = 3000 // LinearEncoding\n renderer.toneMapping = NoToneMapping\n\n renderer.setRenderTarget(renderTarget)\n if (renderer.autoClear === false) renderer.clear()\n renderer.render(scene, virtualCamera)\n\n renderer.xr.enabled = currentXrEnabled\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate\n renderer.toneMapping = currentToneMapping\n renderer.setRenderTarget(currentRenderTarget)\n\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = isSRGB ? 'srgb' : 'srgb-linear'\n else renderer.outputEncoding = isSRGB ? 3001 : 3000\n\n // restore viewport\n\n const viewport = camera.viewport\n\n if (viewport !== undefined) {\n renderer.state.viewport(viewport)\n }\n\n scope.visible = true\n }\n\n //\n\n this.onBeforeRender = function (renderer, scene, camera) {\n // ensure refractors are rendered only once per frame\n\n if (camera.userData.refractor === true) return\n\n // avoid rendering when the refractor is viewed from behind\n\n if (!visible(camera) === true) return\n\n // update\n\n updateRefractorPlane()\n\n updateTextureMatrix(camera)\n\n updateVirtualCamera(camera)\n\n render(renderer, scene, camera)\n }\n\n this.getRenderTarget = function () {\n return renderTarget\n }\n\n this.dispose = function () {\n renderTarget.dispose()\n scope.material.dispose()\n }\n }\n}\n\nexport { Refractor }\n", "import { Matrix4, Mesh, MeshBasicMaterial, EqualStencilFunc, IncrementStencilOp } from 'three'\n\n/**\n * A shadow Mesh that follows a shadow-casting Mesh in the scene, but is confined to a single plane.\n */\n\nconst _shadowMatrix = new Matrix4()\n\nclass ShadowMesh extends Mesh {\n constructor(mesh) {\n const shadowMaterial = new MeshBasicMaterial({\n color: 0x000000,\n transparent: true,\n opacity: 0.6,\n depthWrite: false,\n stencilWrite: true,\n stencilFunc: EqualStencilFunc,\n stencilRef: 0,\n stencilZPass: IncrementStencilOp,\n })\n\n super(mesh.geometry, shadowMaterial)\n\n this.isShadowMesh = true\n\n this.meshMatrix = mesh.matrixWorld\n\n this.frustumCulled = false\n this.matrixAutoUpdate = false\n }\n\n update(plane, lightPosition4D) {\n // based on https://www.opengl.org/archives/resources/features/StencilTalk/tsld021.htm\n\n const dot =\n plane.normal.x * lightPosition4D.x +\n plane.normal.y * lightPosition4D.y +\n plane.normal.z * lightPosition4D.z +\n -plane.constant * lightPosition4D.w\n\n const sme = _shadowMatrix.elements\n\n sme[0] = dot - lightPosition4D.x * plane.normal.x\n sme[4] = -lightPosition4D.x * plane.normal.y\n sme[8] = -lightPosition4D.x * plane.normal.z\n sme[12] = -lightPosition4D.x * -plane.constant\n\n sme[1] = -lightPosition4D.y * plane.normal.x\n sme[5] = dot - lightPosition4D.y * plane.normal.y\n sme[9] = -lightPosition4D.y * plane.normal.z\n sme[13] = -lightPosition4D.y * -plane.constant\n\n sme[2] = -lightPosition4D.z * plane.normal.x\n sme[6] = -lightPosition4D.z * plane.normal.y\n sme[10] = dot - lightPosition4D.z * plane.normal.z\n sme[14] = -lightPosition4D.z * -plane.constant\n\n sme[3] = -lightPosition4D.w * plane.normal.x\n sme[7] = -lightPosition4D.w * plane.normal.y\n sme[11] = -lightPosition4D.w * plane.normal.z\n sme[15] = dot - lightPosition4D.w * -plane.constant\n\n this.matrix.multiplyMatrices(_shadowMatrix, this.meshMatrix)\n }\n}\n\nexport { ShadowMesh }\n", "import {\n AdditiveBlending,\n Box2,\n BufferGeometry,\n ClampToEdgeWrapping,\n Color,\n DataTexture,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n Mesh,\n MeshBasicMaterial,\n NearestFilter,\n RGBAFormat,\n RawShaderMaterial,\n Vector2,\n Vector3,\n Vector4,\n} from 'three'\n\nconst geometry = new BufferGeometry()\n\nconst float32Array = new Float32Array([-1, -1, 0, 0, 0, 1, -1, 0, 1, 0, 1, 1, 0, 1, 1, -1, 1, 0, 0, 1])\n\nconst interleavedBuffer = new InterleavedBuffer(float32Array, 5)\n\ngeometry.setIndex([0, 1, 2, 0, 2, 3])\ngeometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false))\ngeometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false))\n\nclass Lensflare extends Mesh {\n static Geometry = geometry\n\n constructor() {\n super(Lensflare.Geometry, new MeshBasicMaterial({ opacity: 0, transparent: true }))\n\n this.isLensflare = true\n\n this.type = 'Lensflare'\n this.frustumCulled = false\n this.renderOrder = Infinity\n\n //\n\n const positionScreen = new Vector3()\n const positionView = new Vector3()\n\n // textures\n const tempMap = new DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, RGBAFormat)\n tempMap.minFilter = NearestFilter\n tempMap.magFilter = NearestFilter\n tempMap.wrapS = ClampToEdgeWrapping\n tempMap.wrapT = ClampToEdgeWrapping\n\n const occlusionMap = new DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, RGBAFormat)\n occlusionMap.minFilter = NearestFilter\n occlusionMap.magFilter = NearestFilter\n occlusionMap.wrapS = ClampToEdgeWrapping\n occlusionMap.wrapT = ClampToEdgeWrapping\n\n // material\n\n const geometry = Lensflare.Geometry\n\n const material1a = new RawShaderMaterial({\n uniforms: {\n scale: { value: null },\n screenPosition: { value: null },\n },\n vertexShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n\n\t\t\t\t}`,\n depthTest: true,\n depthWrite: false,\n transparent: false,\n })\n\n const material1b = new RawShaderMaterial({\n uniforms: {\n map: { value: tempMap },\n scale: { value: null },\n screenPosition: { value: null },\n },\n vertexShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\t\t\t\tattribute vec2 uv;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUV = uv;\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform sampler2D map;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = texture2D( map, vUV );\n\n\t\t\t\t}`,\n depthTest: false,\n depthWrite: false,\n transparent: false,\n })\n\n // the following object is used for occlusionMap generation\n\n const mesh1 = new Mesh(geometry, material1a)\n\n //\n\n const elements = []\n\n const shader = LensflareElement.Shader\n\n const material2 = new RawShaderMaterial({\n uniforms: {\n map: { value: null },\n occlusionMap: { value: occlusionMap },\n color: { value: new Color(0xffffff) },\n scale: { value: new Vector2() },\n screenPosition: { value: new Vector3() },\n },\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n blending: AdditiveBlending,\n transparent: true,\n depthWrite: false,\n })\n\n const mesh2 = new Mesh(geometry, material2)\n\n this.addElement = function (element) {\n elements.push(element)\n }\n\n //\n\n const scale = new Vector2()\n const screenPositionPixels = new Vector2()\n const validArea = new Box2()\n const viewport = new Vector4()\n\n this.onBeforeRender = function (renderer, scene, camera) {\n renderer.getCurrentViewport(viewport)\n\n const invAspect = viewport.w / viewport.z\n const halfViewportWidth = viewport.z / 2.0\n const halfViewportHeight = viewport.w / 2.0\n\n let size = 16 / viewport.w\n scale.set(size * invAspect, size)\n\n validArea.min.set(viewport.x, viewport.y)\n validArea.max.set(viewport.x + (viewport.z - 16), viewport.y + (viewport.w - 16))\n\n // calculate position in screen space\n\n positionView.setFromMatrixPosition(this.matrixWorld)\n positionView.applyMatrix4(camera.matrixWorldInverse)\n\n if (positionView.z > 0) return // lensflare is behind the camera\n\n positionScreen.copy(positionView).applyMatrix4(camera.projectionMatrix)\n\n // horizontal and vertical coordinate of the lower left corner of the pixels to copy\n\n screenPositionPixels.x = viewport.x + positionScreen.x * halfViewportWidth + halfViewportWidth - 8\n screenPositionPixels.y = viewport.y + positionScreen.y * halfViewportHeight + halfViewportHeight - 8\n\n // screen cull\n\n if (validArea.containsPoint(screenPositionPixels)) {\n // save current RGB to temp texture\n\n renderer.copyFramebufferToTexture(screenPositionPixels, tempMap)\n\n // render pink quad\n\n let uniforms = material1a.uniforms\n uniforms['scale'].value = scale\n uniforms['screenPosition'].value = positionScreen\n\n renderer.renderBufferDirect(camera, null, geometry, material1a, mesh1, null)\n\n // copy result to occlusionMap\n\n renderer.copyFramebufferToTexture(screenPositionPixels, occlusionMap)\n\n // restore graphics\n\n uniforms = material1b.uniforms\n uniforms['scale'].value = scale\n uniforms['screenPosition'].value = positionScreen\n\n renderer.renderBufferDirect(camera, null, geometry, material1b, mesh1, null)\n\n // render elements\n\n const vecX = -positionScreen.x * 2\n const vecY = -positionScreen.y * 2\n\n for (let i = 0, l = elements.length; i < l; i++) {\n const element = elements[i]\n\n const uniforms = material2.uniforms\n\n uniforms['color'].value.copy(element.color)\n uniforms['map'].value = element.texture\n uniforms['screenPosition'].value.x = positionScreen.x + vecX * element.distance\n uniforms['screenPosition'].value.y = positionScreen.y + vecY * element.distance\n\n size = element.size / viewport.w\n const invAspect = viewport.w / viewport.z\n\n uniforms['scale'].value.set(size * invAspect, size)\n\n material2.uniformsNeedUpdate = true\n\n renderer.renderBufferDirect(camera, null, geometry, material2, mesh2, null)\n }\n }\n }\n\n this.dispose = function () {\n material1a.dispose()\n material1b.dispose()\n material2.dispose()\n\n tempMap.dispose()\n occlusionMap.dispose()\n\n for (let i = 0, l = elements.length; i < l; i++) {\n elements[i].texture.dispose()\n }\n }\n }\n}\n\n//\n\nclass LensflareElement {\n static Shader = {\n uniforms: {\n map: { value: null },\n occlusionMap: { value: null },\n color: { value: null },\n scale: { value: null },\n screenPosition: { value: null },\n },\n\n vertexShader: /* glsl */ `\n\n\t\tprecision highp float;\n\n\t\tuniform vec3 screenPosition;\n\t\tuniform vec2 scale;\n\n\t\tuniform sampler2D occlusionMap;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvUV = uv;\n\n\t\t\tvec2 pos = position.xy;\n\n\t\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\n\n\t\t\tvVisibility = visibility.r / 9.0;\n\t\t\tvVisibility *= 1.0 - visibility.g / 9.0;\n\t\t\tvVisibility *= visibility.b / 9.0;\n\n\t\t\tgl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\tprecision highp float;\n\n\t\tuniform sampler2D map;\n\t\tuniform vec3 color;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texture = texture2D( map, vUV );\n\t\t\ttexture.a *= vVisibility;\n\t\t\tgl_FragColor = texture;\n\t\t\tgl_FragColor.rgb *= color;\n\n\t\t}`,\n }\n\n constructor(texture, size = 1, distance = 0, color = new Color(0xffffff)) {\n this.texture = texture\n this.size = size\n this.distance = distance\n this.color = color\n }\n}\n\nexport { Lensflare, LensflareElement }\n", "import { BufferAttribute, BufferGeometry, Color, DynamicDrawUsage, Mesh, Sphere, Vector3 } from 'three'\n\n/**\n * Port of http://webglsamples.org/blob/blob.html\n */\n\nclass MarchingCubes extends Mesh {\n constructor(resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000) {\n const geometry = new BufferGeometry()\n\n super(geometry, material)\n\n this.isMarchingCubes = true\n\n const scope = this\n\n // temp buffers used in polygonize\n\n const vlist = new Float32Array(12 * 3)\n const nlist = new Float32Array(12 * 3)\n const clist = new Float32Array(12 * 3)\n\n this.enableUvs = enableUvs\n this.enableColors = enableColors\n\n // functions have to be object properties\n // prototype functions kill performance\n // (tested and it was 4x slower !!!)\n\n this.init = function (resolution) {\n this.resolution = resolution\n\n // parameters\n\n this.isolation = 80.0\n\n // size of field, 32 is pushing it in Javascript :)\n\n this.size = resolution\n this.size2 = this.size * this.size\n this.size3 = this.size2 * this.size\n this.halfsize = this.size / 2.0\n\n // deltas\n\n this.delta = 2.0 / this.size\n this.yd = this.size\n this.zd = this.size2\n\n this.field = new Float32Array(this.size3)\n this.normal_cache = new Float32Array(this.size3 * 3)\n this.palette = new Float32Array(this.size3 * 3)\n\n //\n\n this.count = 0\n\n const maxVertexCount = maxPolyCount * 3\n\n this.positionArray = new Float32Array(maxVertexCount * 3)\n const positionAttribute = new BufferAttribute(this.positionArray, 3)\n positionAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('position', positionAttribute)\n\n this.normalArray = new Float32Array(maxVertexCount * 3)\n const normalAttribute = new BufferAttribute(this.normalArray, 3)\n normalAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('normal', normalAttribute)\n\n if (this.enableUvs) {\n this.uvArray = new Float32Array(maxVertexCount * 2)\n const uvAttribute = new BufferAttribute(this.uvArray, 2)\n uvAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('uv', uvAttribute)\n }\n\n if (this.enableColors) {\n this.colorArray = new Float32Array(maxVertexCount * 3)\n const colorAttribute = new BufferAttribute(this.colorArray, 3)\n colorAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('color', colorAttribute)\n }\n\n geometry.boundingSphere = new Sphere(new Vector3(), 1)\n }\n\n ///////////////////////\n // Polygonization\n ///////////////////////\n\n function lerp(a, b, t) {\n return a + (b - a) * t\n }\n\n function VIntX(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1),\n nc = scope.normal_cache\n\n vlist[offset + 0] = x + mu * scope.delta\n vlist[offset + 1] = y\n vlist[offset + 2] = z\n\n nlist[offset + 0] = lerp(nc[q + 0], nc[q + 3], mu)\n nlist[offset + 1] = lerp(nc[q + 1], nc[q + 4], mu)\n nlist[offset + 2] = lerp(nc[q + 2], nc[q + 5], mu)\n\n clist[offset + 0] = lerp(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu)\n clist[offset + 1] = lerp(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu)\n clist[offset + 2] = lerp(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu)\n }\n\n function VIntY(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1),\n nc = scope.normal_cache\n\n vlist[offset + 0] = x\n vlist[offset + 1] = y + mu * scope.delta\n vlist[offset + 2] = z\n\n const q2 = q + scope.yd * 3\n\n nlist[offset + 0] = lerp(nc[q + 0], nc[q2 + 0], mu)\n nlist[offset + 1] = lerp(nc[q + 1], nc[q2 + 1], mu)\n nlist[offset + 2] = lerp(nc[q + 2], nc[q2 + 2], mu)\n\n clist[offset + 0] = lerp(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu)\n clist[offset + 1] = lerp(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu)\n clist[offset + 2] = lerp(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu)\n }\n\n function VIntZ(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1),\n nc = scope.normal_cache\n\n vlist[offset + 0] = x\n vlist[offset + 1] = y\n vlist[offset + 2] = z + mu * scope.delta\n\n const q2 = q + scope.zd * 3\n\n nlist[offset + 0] = lerp(nc[q + 0], nc[q2 + 0], mu)\n nlist[offset + 1] = lerp(nc[q + 1], nc[q2 + 1], mu)\n nlist[offset + 2] = lerp(nc[q + 2], nc[q2 + 2], mu)\n\n clist[offset + 0] = lerp(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu)\n clist[offset + 1] = lerp(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu)\n clist[offset + 2] = lerp(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu)\n }\n\n function compNorm(q) {\n const q3 = q * 3\n\n if (scope.normal_cache[q3] === 0.0) {\n scope.normal_cache[q3 + 0] = scope.field[q - 1] - scope.field[q + 1]\n scope.normal_cache[q3 + 1] = scope.field[q - scope.yd] - scope.field[q + scope.yd]\n scope.normal_cache[q3 + 2] = scope.field[q - scope.zd] - scope.field[q + scope.zd]\n }\n }\n\n // Returns total number of triangles. Fills triangles.\n // (this is where most of time is spent - it's inner work of O(n3) loop )\n\n function polygonize(fx, fy, fz, q, isol) {\n // cache indices\n const q1 = q + 1,\n qy = q + scope.yd,\n qz = q + scope.zd,\n q1y = q1 + scope.yd,\n q1z = q1 + scope.zd,\n qyz = q + scope.yd + scope.zd,\n q1yz = q1 + scope.yd + scope.zd\n\n let cubeindex = 0\n const field0 = scope.field[q],\n field1 = scope.field[q1],\n field2 = scope.field[qy],\n field3 = scope.field[q1y],\n field4 = scope.field[qz],\n field5 = scope.field[q1z],\n field6 = scope.field[qyz],\n field7 = scope.field[q1yz]\n\n if (field0 < isol) cubeindex |= 1\n if (field1 < isol) cubeindex |= 2\n if (field2 < isol) cubeindex |= 8\n if (field3 < isol) cubeindex |= 4\n if (field4 < isol) cubeindex |= 16\n if (field5 < isol) cubeindex |= 32\n if (field6 < isol) cubeindex |= 128\n if (field7 < isol) cubeindex |= 64\n\n // if cube is entirely in/out of the surface - bail, nothing to draw\n\n const bits = edgeTable[cubeindex]\n if (bits === 0) return 0\n\n const d = scope.delta,\n fx2 = fx + d,\n fy2 = fy + d,\n fz2 = fz + d\n\n // top of the cube\n\n if (bits & 1) {\n compNorm(q)\n compNorm(q1)\n VIntX(q * 3, 0, isol, fx, fy, fz, field0, field1, q, q1)\n }\n\n if (bits & 2) {\n compNorm(q1)\n compNorm(q1y)\n VIntY(q1 * 3, 3, isol, fx2, fy, fz, field1, field3, q1, q1y)\n }\n\n if (bits & 4) {\n compNorm(qy)\n compNorm(q1y)\n VIntX(qy * 3, 6, isol, fx, fy2, fz, field2, field3, qy, q1y)\n }\n\n if (bits & 8) {\n compNorm(q)\n compNorm(qy)\n VIntY(q * 3, 9, isol, fx, fy, fz, field0, field2, q, qy)\n }\n\n // bottom of the cube\n\n if (bits & 16) {\n compNorm(qz)\n compNorm(q1z)\n VIntX(qz * 3, 12, isol, fx, fy, fz2, field4, field5, qz, q1z)\n }\n\n if (bits & 32) {\n compNorm(q1z)\n compNorm(q1yz)\n VIntY(q1z * 3, 15, isol, fx2, fy, fz2, field5, field7, q1z, q1yz)\n }\n\n if (bits & 64) {\n compNorm(qyz)\n compNorm(q1yz)\n VIntX(qyz * 3, 18, isol, fx, fy2, fz2, field6, field7, qyz, q1yz)\n }\n\n if (bits & 128) {\n compNorm(qz)\n compNorm(qyz)\n VIntY(qz * 3, 21, isol, fx, fy, fz2, field4, field6, qz, qyz)\n }\n\n // vertical lines of the cube\n if (bits & 256) {\n compNorm(q)\n compNorm(qz)\n VIntZ(q * 3, 24, isol, fx, fy, fz, field0, field4, q, qz)\n }\n\n if (bits & 512) {\n compNorm(q1)\n compNorm(q1z)\n VIntZ(q1 * 3, 27, isol, fx2, fy, fz, field1, field5, q1, q1z)\n }\n\n if (bits & 1024) {\n compNorm(q1y)\n compNorm(q1yz)\n VIntZ(q1y * 3, 30, isol, fx2, fy2, fz, field3, field7, q1y, q1yz)\n }\n\n if (bits & 2048) {\n compNorm(qy)\n compNorm(qyz)\n VIntZ(qy * 3, 33, isol, fx, fy2, fz, field2, field6, qy, qyz)\n }\n\n cubeindex <<= 4 // re-purpose cubeindex into an offset into triTable\n\n let o1,\n o2,\n o3,\n numtris = 0,\n i = 0\n\n // here is where triangles are created\n\n while (triTable[cubeindex + i] != -1) {\n o1 = cubeindex + i\n o2 = o1 + 1\n o3 = o1 + 2\n\n posnormtriv(vlist, nlist, clist, 3 * triTable[o1], 3 * triTable[o2], 3 * triTable[o3])\n\n i += 3\n numtris++\n }\n\n return numtris\n }\n\n function posnormtriv(pos, norm, colors, o1, o2, o3) {\n const c = scope.count * 3\n\n // positions\n\n scope.positionArray[c + 0] = pos[o1]\n scope.positionArray[c + 1] = pos[o1 + 1]\n scope.positionArray[c + 2] = pos[o1 + 2]\n\n scope.positionArray[c + 3] = pos[o2]\n scope.positionArray[c + 4] = pos[o2 + 1]\n scope.positionArray[c + 5] = pos[o2 + 2]\n\n scope.positionArray[c + 6] = pos[o3]\n scope.positionArray[c + 7] = pos[o3 + 1]\n scope.positionArray[c + 8] = pos[o3 + 2]\n\n // normals\n\n if (scope.material.flatShading === true) {\n const nx = (norm[o1 + 0] + norm[o2 + 0] + norm[o3 + 0]) / 3\n const ny = (norm[o1 + 1] + norm[o2 + 1] + norm[o3 + 1]) / 3\n const nz = (norm[o1 + 2] + norm[o2 + 2] + norm[o3 + 2]) / 3\n\n scope.normalArray[c + 0] = nx\n scope.normalArray[c + 1] = ny\n scope.normalArray[c + 2] = nz\n\n scope.normalArray[c + 3] = nx\n scope.normalArray[c + 4] = ny\n scope.normalArray[c + 5] = nz\n\n scope.normalArray[c + 6] = nx\n scope.normalArray[c + 7] = ny\n scope.normalArray[c + 8] = nz\n } else {\n scope.normalArray[c + 0] = norm[o1 + 0]\n scope.normalArray[c + 1] = norm[o1 + 1]\n scope.normalArray[c + 2] = norm[o1 + 2]\n\n scope.normalArray[c + 3] = norm[o2 + 0]\n scope.normalArray[c + 4] = norm[o2 + 1]\n scope.normalArray[c + 5] = norm[o2 + 2]\n\n scope.normalArray[c + 6] = norm[o3 + 0]\n scope.normalArray[c + 7] = norm[o3 + 1]\n scope.normalArray[c + 8] = norm[o3 + 2]\n }\n\n // uvs\n\n if (scope.enableUvs) {\n const d = scope.count * 2\n\n scope.uvArray[d + 0] = pos[o1 + 0]\n scope.uvArray[d + 1] = pos[o1 + 2]\n\n scope.uvArray[d + 2] = pos[o2 + 0]\n scope.uvArray[d + 3] = pos[o2 + 2]\n\n scope.uvArray[d + 4] = pos[o3 + 0]\n scope.uvArray[d + 5] = pos[o3 + 2]\n }\n\n // colors\n\n if (scope.enableColors) {\n scope.colorArray[c + 0] = colors[o1 + 0]\n scope.colorArray[c + 1] = colors[o1 + 1]\n scope.colorArray[c + 2] = colors[o1 + 2]\n\n scope.colorArray[c + 3] = colors[o2 + 0]\n scope.colorArray[c + 4] = colors[o2 + 1]\n scope.colorArray[c + 5] = colors[o2 + 2]\n\n scope.colorArray[c + 6] = colors[o3 + 0]\n scope.colorArray[c + 7] = colors[o3 + 1]\n scope.colorArray[c + 8] = colors[o3 + 2]\n }\n\n scope.count += 3\n }\n\n /////////////////////////////////////\n // Metaballs\n /////////////////////////////////////\n\n // Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after\n // a fixed distance, determined by strength and subtract.\n\n this.addBall = function (ballx, bally, ballz, strength, subtract, colors) {\n const sign = Math.sign(strength)\n strength = Math.abs(strength)\n const userDefineColor = !(colors === undefined || colors === null)\n let ballColor = new Color(ballx, bally, ballz)\n\n if (userDefineColor) {\n try {\n ballColor =\n colors instanceof Color\n ? colors\n : Array.isArray(colors)\n ? new Color(\n Math.min(Math.abs(colors[0]), 1),\n Math.min(Math.abs(colors[1]), 1),\n Math.min(Math.abs(colors[2]), 1),\n )\n : new Color(colors)\n } catch (err) {\n ballColor = new Color(ballx, bally, ballz)\n }\n }\n\n // Let's solve the equation to find the radius:\n // 1.0 / (0.000001 + radius^2) * strength - subtract = 0\n // strength / (radius^2) = subtract\n // strength = subtract * radius^2\n // radius^2 = strength / subtract\n // radius = sqrt(strength / subtract)\n\n const radius = this.size * Math.sqrt(strength / subtract),\n zs = ballz * this.size,\n ys = bally * this.size,\n xs = ballx * this.size\n\n let min_z = Math.floor(zs - radius)\n if (min_z < 1) min_z = 1\n let max_z = Math.floor(zs + radius)\n if (max_z > this.size - 1) max_z = this.size - 1\n let min_y = Math.floor(ys - radius)\n if (min_y < 1) min_y = 1\n let max_y = Math.floor(ys + radius)\n if (max_y > this.size - 1) max_y = this.size - 1\n let min_x = Math.floor(xs - radius)\n if (min_x < 1) min_x = 1\n let max_x = Math.floor(xs + radius)\n if (max_x > this.size - 1) max_x = this.size - 1\n\n // Don't polygonize in the outer layer because normals aren't\n // well-defined there.\n\n let x, y, z, y_offset, z_offset, fx, fy, fz, fz2, fy2, val\n\n for (z = min_z; z < max_z; z++) {\n z_offset = this.size2 * z\n fz = z / this.size - ballz\n fz2 = fz * fz\n\n for (y = min_y; y < max_y; y++) {\n y_offset = z_offset + this.size * y\n fy = y / this.size - bally\n fy2 = fy * fy\n\n for (x = min_x; x < max_x; x++) {\n fx = x / this.size - ballx\n val = strength / (0.000001 + fx * fx + fy2 + fz2) - subtract\n if (val > 0.0) {\n this.field[y_offset + x] += val * sign\n\n // optimization\n // http://www.geisswerks.com/ryan/BLOBS/blobs.html\n const ratio = Math.sqrt((x - xs) * (x - xs) + (y - ys) * (y - ys) + (z - zs) * (z - zs)) / radius\n const contrib = 1 - ratio * ratio * ratio * (ratio * (ratio * 6 - 15) + 10)\n this.palette[(y_offset + x) * 3 + 0] += ballColor.r * contrib\n this.palette[(y_offset + x) * 3 + 1] += ballColor.g * contrib\n this.palette[(y_offset + x) * 3 + 2] += ballColor.b * contrib\n }\n }\n }\n }\n }\n\n this.addPlaneX = function (strength, subtract) {\n // cache attribute lookups\n const size = this.size,\n yd = this.yd,\n zd = this.zd,\n field = this.field\n\n let x,\n y,\n z,\n xx,\n val,\n xdiv,\n cxy,\n dist = size * Math.sqrt(strength / subtract)\n\n if (dist > size) dist = size\n\n for (x = 0; x < dist; x++) {\n xdiv = x / size\n xx = xdiv * xdiv\n val = strength / (0.0001 + xx) - subtract\n\n if (val > 0.0) {\n for (y = 0; y < size; y++) {\n cxy = x + y * yd\n\n for (z = 0; z < size; z++) {\n field[zd * z + cxy] += val\n }\n }\n }\n }\n }\n\n this.addPlaneY = function (strength, subtract) {\n // cache attribute lookups\n const size = this.size,\n yd = this.yd,\n zd = this.zd,\n field = this.field\n\n let x,\n y,\n z,\n yy,\n val,\n ydiv,\n cy,\n cxy,\n dist = size * Math.sqrt(strength / subtract)\n\n if (dist > size) dist = size\n\n for (y = 0; y < dist; y++) {\n ydiv = y / size\n yy = ydiv * ydiv\n val = strength / (0.0001 + yy) - subtract\n\n if (val > 0.0) {\n cy = y * yd\n\n for (x = 0; x < size; x++) {\n cxy = cy + x\n\n for (z = 0; z < size; z++) field[zd * z + cxy] += val\n }\n }\n }\n }\n\n this.addPlaneZ = function (strength, subtract) {\n // cache attribute lookups\n\n const size = this.size,\n yd = this.yd,\n zd = this.zd,\n field = this.field\n\n let x,\n y,\n z,\n zz,\n val,\n zdiv,\n cz,\n cyz,\n dist = size * Math.sqrt(strength / subtract)\n\n if (dist > size) dist = size\n\n for (z = 0; z < dist; z++) {\n zdiv = z / size\n zz = zdiv * zdiv\n val = strength / (0.0001 + zz) - subtract\n if (val > 0.0) {\n cz = zd * z\n\n for (y = 0; y < size; y++) {\n cyz = cz + y * yd\n\n for (x = 0; x < size; x++) field[cyz + x] += val\n }\n }\n }\n }\n\n /////////////////////////////////////\n // Updates\n /////////////////////////////////////\n\n this.setCell = function (x, y, z, value) {\n const index = this.size2 * z + this.size * y + x\n this.field[index] = value\n }\n\n this.getCell = function (x, y, z) {\n const index = this.size2 * z + this.size * y + x\n return this.field[index]\n }\n\n this.blur = function (intensity = 1) {\n const field = this.field\n const fieldCopy = field.slice()\n const size = this.size\n const size2 = this.size2\n for (let x = 0; x < size; x++) {\n for (let y = 0; y < size; y++) {\n for (let z = 0; z < size; z++) {\n const index = size2 * z + size * y + x\n let val = fieldCopy[index]\n let count = 1\n\n for (let x2 = -1; x2 <= 1; x2 += 2) {\n const x3 = x2 + x\n if (x3 < 0 || x3 >= size) continue\n\n for (let y2 = -1; y2 <= 1; y2 += 2) {\n const y3 = y2 + y\n if (y3 < 0 || y3 >= size) continue\n\n for (let z2 = -1; z2 <= 1; z2 += 2) {\n const z3 = z2 + z\n if (z3 < 0 || z3 >= size) continue\n\n const index2 = size2 * z3 + size * y3 + x3\n const val2 = fieldCopy[index2]\n\n count++\n val += (intensity * (val2 - val)) / count\n }\n }\n }\n\n field[index] = val\n }\n }\n }\n }\n\n this.reset = function () {\n // wipe the normal cache\n\n for (let i = 0; i < this.size3; i++) {\n this.normal_cache[i * 3] = 0.0\n this.field[i] = 0.0\n this.palette[i * 3] = this.palette[i * 3 + 1] = this.palette[i * 3 + 2] = 0.0\n }\n }\n\n this.update = function () {\n this.count = 0\n\n // Triangulate. Yeah, this is slow.\n\n const smin2 = this.size - 2\n\n for (let z = 1; z < smin2; z++) {\n const z_offset = this.size2 * z\n const fz = (z - this.halfsize) / this.halfsize //+ 1\n\n for (let y = 1; y < smin2; y++) {\n const y_offset = z_offset + this.size * y\n const fy = (y - this.halfsize) / this.halfsize //+ 1\n\n for (let x = 1; x < smin2; x++) {\n const fx = (x - this.halfsize) / this.halfsize //+ 1\n const q = y_offset + x\n\n polygonize(fx, fy, fz, q, this.isolation)\n }\n }\n }\n\n // set the draw range to only the processed triangles\n\n this.geometry.setDrawRange(0, this.count)\n\n // update geometry data\n\n geometry.getAttribute('position').needsUpdate = true\n geometry.getAttribute('normal').needsUpdate = true\n\n if (this.enableUvs) geometry.getAttribute('uv').needsUpdate = true\n if (this.enableColors) geometry.getAttribute('color').needsUpdate = true\n\n // safety check\n\n if (this.count / 3 > maxPolyCount)\n console.warn(\n 'THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.',\n )\n }\n\n this.init(resolution)\n }\n}\n\n/////////////////////////////////////\n// Marching cubes lookup tables\n/////////////////////////////////////\n\n// These tables are straight from Paul Bourke's page:\n// http://paulbourke.net/geometry/polygonise/\n// who in turn got them from Cory Gene Bloyd.\n\n// prettier-ignore\nconst edgeTable = new Int32Array( [\n\t0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,\n\t0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,\n\t0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,\n\t0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,\n\t0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,\n\t0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,\n\t0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,\n\t0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,\n\t0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,\n\t0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,\n\t0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,\n\t0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,\n\t0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,\n\t0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,\n\t0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,\n\t0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,\n\t0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,\n\t0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,\n\t0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,\n\t0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,\n\t0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,\n\t0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,\n\t0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,\n\t0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,\n\t0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,\n\t0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,\n\t0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,\n\t0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,\n\t0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,\n\t0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,\n\t0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,\n\t0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ] );\n\n// prettier-ignore\nconst triTable = new Int32Array( [\n\t- 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 8, 3, 9, 8, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 2, 10, 0, 2, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 8, 3, 2, 10, 8, 10, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 11, 2, 8, 11, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 9, 0, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 11, 2, 1, 9, 11, 9, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 10, 1, 11, 10, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 10, 1, 0, 8, 10, 8, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 9, 0, 3, 11, 9, 11, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 3, 0, 7, 3, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 1, 9, 4, 7, 1, 7, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 4, 7, 3, 0, 4, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 2, 10, 9, 0, 2, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,\n\t8, 4, 7, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 4, 7, 11, 2, 4, 2, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 0, 1, 8, 4, 7, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, - 1, - 1, - 1, - 1,\n\t3, 10, 1, 3, 11, 10, 7, 8, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, - 1, - 1, - 1, - 1,\n\t4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,\n\t4, 7, 11, 4, 11, 9, 9, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 4, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 5, 4, 1, 5, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 5, 4, 8, 3, 5, 3, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 8, 1, 2, 10, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 2, 10, 5, 4, 2, 4, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, - 1, - 1, - 1, - 1,\n\t9, 5, 4, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 11, 2, 0, 8, 11, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 5, 4, 0, 1, 5, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, - 1, - 1, - 1, - 1,\n\t10, 3, 11, 10, 1, 3, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, - 1, - 1, - 1, - 1,\n\t5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,\n\t5, 4, 8, 5, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 7, 8, 5, 7, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 3, 0, 9, 5, 3, 5, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 7, 8, 0, 1, 7, 1, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 7, 8, 9, 5, 7, 10, 1, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, - 1, - 1, - 1, - 1,\n\t8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, - 1, - 1, - 1, - 1,\n\t2, 10, 5, 2, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 9, 5, 7, 8, 9, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,\n\t2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, - 1, - 1, - 1, - 1,\n\t11, 2, 1, 11, 1, 7, 7, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, - 1, - 1, - 1, - 1,\n\t5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, - 1,\n\t11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, - 1,\n\t11, 10, 5, 7, 11, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 0, 1, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 8, 3, 1, 9, 8, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 6, 5, 2, 6, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 6, 5, 1, 2, 6, 3, 0, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 6, 5, 9, 0, 6, 0, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, - 1, - 1, - 1, - 1,\n\t2, 3, 11, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 0, 8, 11, 2, 0, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, - 1, - 1, - 1, - 1,\n\t6, 3, 11, 6, 5, 3, 5, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,\n\t3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, - 1, - 1, - 1, - 1,\n\t6, 5, 9, 6, 9, 11, 11, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 10, 6, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 3, 0, 4, 7, 3, 6, 5, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 9, 0, 5, 10, 6, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,\n\t6, 1, 2, 6, 5, 1, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, - 1, - 1, - 1, - 1,\n\t8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, - 1, - 1, - 1, - 1,\n\t7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, - 1,\n\t3, 11, 2, 7, 8, 4, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1,\n\t9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, - 1,\n\t8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,\n\t5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, - 1,\n\t0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, - 1,\n\t6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, - 1, - 1, - 1, - 1,\n\t10, 4, 9, 6, 4, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 10, 6, 4, 9, 10, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 0, 1, 10, 6, 0, 6, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,\n\t1, 4, 9, 1, 2, 4, 2, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, - 1, - 1, - 1, - 1,\n\t0, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 3, 2, 8, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 4, 9, 10, 6, 4, 11, 2, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, - 1, - 1, - 1, - 1,\n\t3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,\n\t6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, - 1,\n\t9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, - 1, - 1, - 1, - 1,\n\t8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, - 1,\n\t3, 11, 6, 3, 6, 0, 0, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 4, 8, 11, 6, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 10, 6, 7, 8, 10, 8, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, - 1, - 1, - 1, - 1,\n\t10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, - 1, - 1, - 1, - 1,\n\t10, 6, 7, 10, 7, 1, 1, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,\n\t2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, - 1,\n\t7, 8, 0, 7, 0, 6, 6, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 3, 2, 6, 7, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,\n\t2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, - 1,\n\t1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, - 1,\n\t11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, - 1, - 1, - 1, - 1,\n\t8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, - 1,\n\t0, 9, 1, 11, 6, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, - 1, - 1, - 1, - 1,\n\t7, 11, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 8, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 1, 9, 8, 3, 1, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 1, 2, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 3, 0, 8, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 9, 0, 2, 10, 9, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, - 1, - 1, - 1, - 1,\n\t7, 2, 3, 6, 2, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 0, 8, 7, 6, 0, 6, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 7, 6, 2, 3, 7, 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, - 1, - 1, - 1, - 1,\n\t10, 7, 6, 10, 1, 7, 1, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, - 1, - 1, - 1, - 1,\n\t0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, - 1, - 1, - 1, - 1,\n\t7, 6, 10, 7, 10, 8, 8, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 8, 4, 11, 8, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 6, 11, 3, 0, 6, 0, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 6, 11, 8, 4, 6, 9, 0, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, - 1, - 1, - 1, - 1,\n\t6, 8, 4, 6, 11, 8, 2, 10, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, - 1, - 1, - 1, - 1,\n\t4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, - 1, - 1, - 1, - 1,\n\t10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, - 1,\n\t8, 2, 3, 8, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, - 1, - 1, - 1, - 1,\n\t1, 9, 4, 1, 4, 2, 2, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, - 1, - 1, - 1, - 1,\n\t10, 1, 0, 10, 0, 6, 6, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, - 1,\n\t10, 9, 4, 6, 10, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 5, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 4, 9, 5, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 0, 1, 5, 4, 0, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, - 1, - 1, - 1, - 1,\n\t9, 5, 4, 10, 1, 2, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, - 1, - 1, - 1, - 1,\n\t7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, - 1, - 1, - 1, - 1,\n\t3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, - 1,\n\t7, 2, 3, 7, 6, 2, 5, 4, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, - 1, - 1, - 1, - 1,\n\t3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, - 1, - 1, - 1, - 1,\n\t6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, - 1,\n\t9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, - 1, - 1, - 1, - 1,\n\t1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, - 1,\n\t4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, - 1,\n\t7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, - 1, - 1, - 1, - 1,\n\t6, 9, 5, 6, 11, 9, 11, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, - 1, - 1, - 1, - 1,\n\t0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, - 1, - 1, - 1, - 1,\n\t6, 11, 3, 6, 3, 5, 5, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, - 1, - 1, - 1, - 1,\n\t0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, - 1,\n\t11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, - 1,\n\t6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, - 1, - 1, - 1, - 1,\n\t5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, - 1, - 1, - 1, - 1,\n\t9, 5, 6, 9, 6, 0, 0, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, - 1,\n\t1, 5, 6, 2, 1, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, - 1,\n\t10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, - 1, - 1, - 1, - 1,\n\t0, 3, 8, 5, 6, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 5, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 5, 10, 7, 5, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 5, 10, 11, 7, 5, 8, 3, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 11, 7, 5, 10, 11, 1, 9, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, - 1, - 1, - 1, - 1,\n\t11, 1, 2, 11, 7, 1, 7, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, - 1, - 1, - 1, - 1,\n\t9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, - 1, - 1, - 1, - 1,\n\t7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, - 1,\n\t2, 5, 10, 2, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, - 1, - 1, - 1, - 1,\n\t9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, - 1, - 1, - 1, - 1,\n\t9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, - 1,\n\t1, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 7, 0, 7, 1, 1, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 0, 3, 9, 3, 5, 5, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 8, 7, 5, 9, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 8, 4, 5, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, - 1, - 1, - 1, - 1,\n\t10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, - 1,\n\t2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, - 1, - 1, - 1, - 1,\n\t0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, - 1,\n\t0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, - 1,\n\t9, 4, 5, 2, 11, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, - 1, - 1, - 1, - 1,\n\t5, 10, 2, 5, 2, 4, 4, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, - 1,\n\t5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, - 1, - 1, - 1, - 1,\n\t8, 4, 5, 8, 5, 3, 3, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 4, 5, 1, 0, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, - 1, - 1, - 1, - 1,\n\t9, 4, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 11, 7, 4, 9, 11, 9, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, - 1, - 1, - 1, - 1,\n\t1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, - 1, - 1, - 1, - 1,\n\t3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, - 1,\n\t4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, - 1, - 1, - 1, - 1,\n\t9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, - 1,\n\t11, 7, 4, 11, 4, 2, 2, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, - 1, - 1, - 1, - 1,\n\t2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, - 1, - 1, - 1, - 1,\n\t9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, - 1,\n\t3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, - 1,\n\t1, 10, 2, 8, 7, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 1, 4, 1, 7, 7, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, - 1, - 1, - 1, - 1,\n\t4, 0, 3, 7, 4, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 8, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 9, 3, 9, 11, 11, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 10, 0, 10, 8, 8, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 1, 10, 11, 3, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 11, 1, 11, 9, 9, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, - 1, - 1, - 1, - 1,\n\t0, 2, 11, 8, 0, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 2, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 3, 8, 2, 8, 10, 10, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 10, 2, 0, 9, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, - 1, - 1, - 1, - 1,\n\t1, 10, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 3, 8, 9, 1, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 9, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 3, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t- 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 ] );\n\nexport { MarchingCubes, edgeTable, triTable }\n", "// Ported from Stefan Gustavson's java implementation\n// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf\n// Read Stefan's excellent paper for details on how this code works.\n//\n// Sean McCullough banksean@gmail.com\n//\n\nexport interface NumberGenerator {\n random: () => number\n}\n\n// Added 4D noise\nexport class SimplexNoise {\n private grad3 = [\n [1, 1, 0],\n [-1, 1, 0],\n [1, -1, 0],\n [-1, -1, 0],\n [1, 0, 1],\n [-1, 0, 1],\n [1, 0, -1],\n [-1, 0, -1],\n [0, 1, 1],\n [0, -1, 1],\n [0, 1, -1],\n [0, -1, -1],\n ]\n\n private grad4 = [\n [0, 1, 1, 1],\n [0, 1, 1, -1],\n [0, 1, -1, 1],\n [0, 1, -1, -1],\n [0, -1, 1, 1],\n [0, -1, 1, -1],\n [0, -1, -1, 1],\n [0, -1, -1, -1],\n [1, 0, 1, 1],\n [1, 0, 1, -1],\n [1, 0, -1, 1],\n [1, 0, -1, -1],\n [-1, 0, 1, 1],\n [-1, 0, 1, -1],\n [-1, 0, -1, 1],\n [-1, 0, -1, -1],\n [1, 1, 0, 1],\n [1, 1, 0, -1],\n [1, -1, 0, 1],\n [1, -1, 0, -1],\n [-1, 1, 0, 1],\n [-1, 1, 0, -1],\n [-1, -1, 0, 1],\n [-1, -1, 0, -1],\n [1, 1, 1, 0],\n [1, 1, -1, 0],\n [1, -1, 1, 0],\n [1, -1, -1, 0],\n [-1, 1, 1, 0],\n [-1, 1, -1, 0],\n [-1, -1, 1, 0],\n [-1, -1, -1, 0],\n ]\n\n private p: number[] = []\n\n // To remove the need for index wrapping, double the permutation table length\n private perm: number[] = []\n\n // A lookup table to traverse the simplex around a given point in 4D.\n // Details can be found where this table is used, in the 4D noise method.\n private simplex = [\n [0, 1, 2, 3],\n [0, 1, 3, 2],\n [0, 0, 0, 0],\n [0, 2, 3, 1],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 2, 3, 0],\n [0, 2, 1, 3],\n [0, 0, 0, 0],\n [0, 3, 1, 2],\n [0, 3, 2, 1],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 3, 2, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 2, 0, 3],\n [0, 0, 0, 0],\n [1, 3, 0, 2],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 3, 0, 1],\n [2, 3, 1, 0],\n [1, 0, 2, 3],\n [1, 0, 3, 2],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 0, 3, 1],\n [0, 0, 0, 0],\n [2, 1, 3, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 0, 1, 3],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [3, 0, 1, 2],\n [3, 0, 2, 1],\n [0, 0, 0, 0],\n [3, 1, 2, 0],\n [2, 1, 0, 3],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [3, 1, 0, 2],\n [0, 0, 0, 0],\n [3, 2, 0, 1],\n [3, 2, 1, 0],\n ]\n\n /**\n * You can pass in a random number generator object if you like.\n * It is assumed to have a random() method.\n */\n constructor(r: NumberGenerator = Math) {\n for (let i = 0; i < 256; i++) {\n this.p[i] = Math.floor(r.random() * 256)\n }\n\n for (let i = 0; i < 512; i++) {\n this.perm[i] = this.p[i & 255]\n }\n }\n\n public dot = (g: number[], x: number, y: number): number => {\n return g[0] * x + g[1] * y\n }\n\n public dot3 = (g: number[], x: number, y: number, z: number): number => {\n return g[0] * x + g[1] * y + g[2] * z\n }\n\n public dot4 = (g: number[], x: number, y: number, z: number, w: number): number => {\n return g[0] * x + g[1] * y + g[2] * z + g[3] * w\n }\n\n public noise = (xin: number, yin: number): number => {\n let n0\n let n1\n let n2 // Noise contributions from the three corners\n // Skew the input space to determine which simplex cell we're in\n const F2 = 0.5 * (Math.sqrt(3.0) - 1.0)\n const s = (xin + yin) * F2 // Hairy factor for 2D\n const i = Math.floor(xin + s)\n const j = Math.floor(yin + s)\n const G2 = (3.0 - Math.sqrt(3.0)) / 6.0\n const t = (i + j) * G2\n const X0 = i - t // Unskew the cell origin back to (x,y) space\n const Y0 = j - t\n const x0 = xin - X0 // The x,y distances from the cell origin\n const y0 = yin - Y0\n // For the 2D case, the simplex shape is an equilateral triangle.\n // Determine which simplex we are in.\n // upper triangle, YX order: (0,0)->(0,1)->(1,1)\n let i1 = 0\n // Offsets for second (middle) corner of simplex in (i,j) coords\n let j1 = 1\n if (x0 > y0) {\n i1 = 1\n j1 = 0\n }\n\n // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and\n // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where\n // c = (3-sqrt(3))/6\n const x1 = x0 - i1 + G2 // Offsets for middle corner in (x,y) unskewed coords\n const y1 = y0 - j1 + G2\n const x2 = x0 - 1.0 + 2.0 * G2 // Offsets for last corner in (x,y) unskewed coords\n const y2 = y0 - 1.0 + 2.0 * G2\n // Work out the hashed gradient indices of the three simplex corners\n const ii = i & 255\n const jj = j & 255\n const gi0 = this.perm[ii + this.perm[jj]] % 12\n const gi1 = this.perm[ii + i1 + this.perm[jj + j1]] % 12\n const gi2 = this.perm[ii + 1 + this.perm[jj + 1]] % 12\n // Calculate the contribution from the three corners\n let t0 = 0.5 - x0 * x0 - y0 * y0\n if (t0 < 0) {\n n0 = 0.0\n } else {\n t0 *= t0\n n0 = t0 * t0 * this.dot(this.grad3[gi0], x0, y0) // (x,y) of grad3 used for 2D gradient\n }\n\n let t1 = 0.5 - x1 * x1 - y1 * y1\n if (t1 < 0) {\n n1 = 0.0\n } else {\n t1 *= t1\n n1 = t1 * t1 * this.dot(this.grad3[gi1], x1, y1)\n }\n\n let t2 = 0.5 - x2 * x2 - y2 * y2\n if (t2 < 0) {\n n2 = 0.0\n } else {\n t2 *= t2\n n2 = t2 * t2 * this.dot(this.grad3[gi2], x2, y2)\n }\n\n // Add contributions from each corner to get the final noise value.\n // The result is scaled to return values in the interval [-1,1].\n return 70.0 * (n0 + n1 + n2)\n }\n\n // 3D simplex noise\n private noise3d = (xin: number, yin: number, zin: number): number => {\n // Noise contributions from the four corners\n let n0\n let n1\n let n2\n let n3\n // Skew the input space to determine which simplex cell we're in\n const F3 = 1.0 / 3.0\n const s = (xin + yin + zin) * F3 // Very nice and simple skew factor for 3D\n const i = Math.floor(xin + s)\n const j = Math.floor(yin + s)\n const k = Math.floor(zin + s)\n const G3 = 1.0 / 6.0 // Very nice and simple unskew factor, too\n const t = (i + j + k) * G3\n const X0 = i - t // Unskew the cell origin back to (x,y,z) space\n const Y0 = j - t\n const Z0 = k - t\n const x0 = xin - X0 // The x,y,z distances from the cell origin\n const y0 = yin - Y0\n const z0 = zin - Z0\n // For the 3D case, the simplex shape is a slightly irregular tetrahedron.\n // Determine which simplex we are in.\n let i1\n let j1\n let k1 // Offsets for second corner of simplex in (i,j,k) coords\n let i2\n let j2\n let k2 // Offsets for third corner of simplex in (i,j,k) coords\n if (x0 >= y0) {\n if (y0 >= z0) {\n i1 = 1\n j1 = 0\n k1 = 0\n i2 = 1\n j2 = 1\n k2 = 0\n\n // X Y Z order\n } else if (x0 >= z0) {\n i1 = 1\n j1 = 0\n k1 = 0\n i2 = 1\n j2 = 0\n k2 = 1\n\n // X Z Y order\n } else {\n i1 = 0\n j1 = 0\n k1 = 1\n i2 = 1\n j2 = 0\n k2 = 1\n } // Z X Y order\n } else {\n // x0 {\n // For faster and easier lookups\n const grad4 = this.grad4\n const simplex = this.simplex\n const perm = this.perm\n\n // The skewing and unskewing factors are hairy again for the 4D case\n const F4 = (Math.sqrt(5.0) - 1.0) / 4.0\n const G4 = (5.0 - Math.sqrt(5.0)) / 20.0\n let n0\n let n1\n let n2\n let n3\n let n4 // Noise contributions from the five corners\n // Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in\n const s = (x + y + z + w) * F4 // Factor for 4D skewing\n const i = Math.floor(x + s)\n const j = Math.floor(y + s)\n const k = Math.floor(z + s)\n const l = Math.floor(w + s)\n const t = (i + j + k + l) * G4 // Factor for 4D unskewing\n const X0 = i - t // Unskew the cell origin back to (x,y,z,w) space\n const Y0 = j - t\n const Z0 = k - t\n const W0 = l - t\n const x0 = x - X0 // The x,y,z,w distances from the cell origin\n const y0 = y - Y0\n const z0 = z - Z0\n const w0 = w - W0\n\n // For the 4D case, the simplex is a 4D shape I won't even try to describe.\n // To find out which of the 24 possible simplices we're in, we need to\n // determine the magnitude ordering of x0, y0, z0 and w0.\n // The method below is a good way of finding the ordering of x,y,z,w and\n // then find the correct traversal order for the simplex we’re in.\n // First, six pair-wise comparisons are performed between each possible pair\n // of the four coordinates, and the results are used to add up binary bits\n // for an integer index.\n const c1 = x0 > y0 ? 32 : 0\n const c2 = x0 > z0 ? 16 : 0\n const c3 = y0 > z0 ? 8 : 0\n const c4 = x0 > w0 ? 4 : 0\n const c5 = y0 > w0 ? 2 : 0\n const c6 = z0 > w0 ? 1 : 0\n const c = c1 + c2 + c3 + c4 + c5 + c6\n // The integer offsets for the second simplex corner\n let i1\n let j1\n let k1\n let l1\n\n // The integer offsets for the third simplex corner\n let i2\n let j2\n let k2\n let l2\n\n // The integer offsets for the fourth simplex corner\n let i3\n let j3\n let k3\n let l3\n // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order.\n // Many values of c will never occur, since e.g. x>y>z>w makes x= 3 ? 1 : 0\n j1 = simplex[c][1] >= 3 ? 1 : 0\n k1 = simplex[c][2] >= 3 ? 1 : 0\n l1 = simplex[c][3] >= 3 ? 1 : 0\n // The number 2 in the \"simplex\" array is at the second largest coordinate.\n i2 = simplex[c][0] >= 2 ? 1 : 0\n j2 = simplex[c][1] >= 2 ? 1 : 0\n k2 = simplex[c][2] >= 2 ? 1 : 0\n l2 = simplex[c][3] >= 2 ? 1 : 0\n // The number 1 in the \"simplex\" array is at the second smallest coordinate.\n i3 = simplex[c][0] >= 1 ? 1 : 0\n j3 = simplex[c][1] >= 1 ? 1 : 0\n k3 = simplex[c][2] >= 1 ? 1 : 0\n l3 = simplex[c][3] >= 1 ? 1 : 0\n // The fifth corner has all coordinate offsets = 1, so no need to look that up.\n const x1 = x0 - i1 + G4 // Offsets for second corner in (x,y,z,w) coords\n const y1 = y0 - j1 + G4\n const z1 = z0 - k1 + G4\n const w1 = w0 - l1 + G4\n const x2 = x0 - i2 + 2.0 * G4 // Offsets for third corner in (x,y,z,w) coords\n const y2 = y0 - j2 + 2.0 * G4\n const z2 = z0 - k2 + 2.0 * G4\n const w2 = w0 - l2 + 2.0 * G4\n const x3 = x0 - i3 + 3.0 * G4 // Offsets for fourth corner in (x,y,z,w) coords\n const y3 = y0 - j3 + 3.0 * G4\n const z3 = z0 - k3 + 3.0 * G4\n const w3 = w0 - l3 + 3.0 * G4\n const x4 = x0 - 1.0 + 4.0 * G4 // Offsets for last corner in (x,y,z,w) coords\n const y4 = y0 - 1.0 + 4.0 * G4\n const z4 = z0 - 1.0 + 4.0 * G4\n const w4 = w0 - 1.0 + 4.0 * G4\n // Work out the hashed gradient indices of the five simplex corners\n const ii = i & 255\n const jj = j & 255\n const kk = k & 255\n const ll = l & 255\n const gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32\n const gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32\n const gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32\n const gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32\n const gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32\n // Calculate the contribution from the five corners\n let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0\n if (t0 < 0) {\n n0 = 0.0\n } else {\n t0 *= t0\n n0 = t0 * t0 * this.dot4(grad4[gi0], x0, y0, z0, w0)\n }\n\n let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1\n if (t1 < 0) {\n n1 = 0.0\n } else {\n t1 *= t1\n n1 = t1 * t1 * this.dot4(grad4[gi1], x1, y1, z1, w1)\n }\n\n let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2\n if (t2 < 0) {\n n2 = 0.0\n } else {\n t2 *= t2\n n2 = t2 * t2 * this.dot4(grad4[gi2], x2, y2, z2, w2)\n }\n\n let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3\n if (t3 < 0) {\n n3 = 0.0\n } else {\n t3 *= t3\n n3 = t3 * t3 * this.dot4(grad4[gi3], x3, y3, z3, w3)\n }\n\n let t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4\n if (t4 < 0) {\n n4 = 0.0\n } else {\n t4 *= t4\n n4 = t4 * t4 * this.dot4(grad4[gi4], x4, y4, z4, w4)\n }\n\n // Sum up and scale the result to cover the range [-1,1]\n return 27.0 * (n0 + n1 + n2 + n3 + n4)\n }\n}\n", "import {\n BufferGeometry,\n DynamicDrawUsage,\n Float32BufferAttribute,\n MathUtils,\n Uint32BufferAttribute,\n Vector3,\n} from 'three'\nimport { SimplexNoise } from '../math/SimplexNoise'\n\n/**\n * @fileoverview LightningStrike object for creating lightning strikes and voltaic arcs.\n *\n *\n * Usage\n *\n * var myRay = new LightningStrike( paramsObject );\n * var myRayMesh = new THREE.Mesh( myRay, myMaterial );\n * scene.add( myRayMesh );\n * ...\n * myRay.update( currentTime );\n *\n * The \"currentTime\" can vary its rate, go forwards, backwards or even jump, but it cannot be negative.\n *\n * You should normally leave the ray position to (0, 0, 0). You should control it by changing the sourceOffset and destOffset parameters.\n *\n *\n * LightningStrike parameters\n *\n * The paramsObject can contain any of the following parameters.\n *\n * Legend:\n * 'LightningStrike' (also called 'ray'): An independent voltaic arc with its ramifications and defined with a set of parameters.\n * 'Subray': A ramification of the ray. It is not a LightningStrike object.\n * 'Segment': A linear segment piece of a subray.\n * 'Leaf segment': A ray segment which cannot be smaller.\n *\n *\n * The following parameters can be changed any time and if they vary smoothly, the ray form will also change smoothly:\n *\n * @param {Vector3} sourceOffset The point where the ray starts.\n *\n * @param {Vector3} destOffset The point where the ray ends.\n *\n * @param {double} timeScale The rate at wich the ray form changes in time. Default: 1\n *\n * @param {double} roughness From 0 to 1. The higher the value, the more wrinkled is the ray. Default: 0.9\n *\n * @param {double} straightness From 0 to 1. The higher the value, the more straight will be a subray path. Default: 0.7\n *\n * @param {Vector3} up0 Ray 'up' direction at the ray starting point. Must be normalized. It should be perpendicular to the ray forward direction but it doesn't matter much.\n *\n * @param {Vector3} up1 Like the up0 parameter but at the end of the ray. Must be normalized.\n *\n * @param {double} radius0 Radius of the main ray trunk at the start point. Default: 1\n *\n * @param {double} radius1 Radius of the main ray trunk at the end point. Default: 1\n *\n * @param {double} radius0Factor The radius0 of a subray is this factor times the radius0 of its parent subray. Default: 0.5\n *\n * @param {double} radius1Factor The radius1 of a subray is this factor times the radius1 of its parent subray. Default: 0.2\n *\n * @param {minRadius} Minimum value a subray radius0 or radius1 can get. Default: 0.1\n *\n *\n * The following parameters should not be changed after lightning creation. They can be changed but the ray will change its form abruptly:\n *\n * @param {boolean} isEternal If true the ray never extinguishes. Otherwise its life is controlled by the 'birthTime' and 'deathTime' parameters. Default: true if any of those two parameters is undefined.\n *\n * @param {double} birthTime The time at which the ray starts its life and begins propagating. Only if isEternal is false. Default: None.\n *\n * @param {double} deathTime The time at which the ray ends vanishing and its life. Only if isEternal is false. Default: None.\n *\n * @param {double} propagationTimeFactor From 0 to 1. Lifetime factor at which the ray ends propagating and enters the steady phase. For example, 0.1 means it is propagating 1/10 of its lifetime. Default: 0.1\n *\n * @param {double} vanishingTimeFactor From 0 to 1. Lifetime factor at which the ray ends the steady phase and begins vanishing. For example, 0.9 means it is vanishing 1/10 of its lifetime. Default: 0.9\n *\n * @param {double} subrayPeriod Subrays cycle periodically. This is their time period. Default: 4\n *\n * @param {double} subrayDutyCycle From 0 to 1. This is the fraction of time a subray is active. Default: 0.6\n *\n *\n * These parameters cannot change after lightning creation:\n *\n * @param {integer} maxIterations: Greater than 0. The number of ray's leaf segments is 2**maxIterations. Default: 9\n *\n * @param {boolean} isStatic Set to true only for rays which won't change over time and are not attached to moving objects (Rare case). It is used to set the vertex buffers non-dynamic. You can omit calling update() for these rays.\n *\n * @param {integer} ramification Greater than 0. Maximum number of child subrays a subray can have. Default: 5\n *\n * @param {integer} maxSubrayRecursion Greater than 0. Maximum level of recursion (subray descendant generations). Default: 3\n *\n * @param {double} recursionProbability From 0 to 1. The lower the value, the less chance each new generation of subrays has to generate new subrays. Default: 0.6\n *\n * @param {boolean} generateUVs If true, the ray geometry will have uv coordinates generated. u runs along the ray, and v across its perimeter. Default: false.\n *\n * @param {Object} randomGenerator Set here your random number generator which will seed the SimplexNoise and other decisions during ray tree creation.\n * It can be used to generate repeatable rays. For that, set also the noiseSeed parameter, and each ray created with that generator and seed pair will be identical in time.\n * The randomGenerator parameter should be an object with a random() function similar to Math.random, but seedable.\n * It must have also a getSeed() method, which returns the current seed, and a setSeed( seed ) method, which accepts as seed a fractional number from 0 to 1, as well as any other number.\n * The default value is an internal generator for some uses and Math.random for others (It is non-repeatable even if noiseSeed is supplied)\n *\n * @param {double} noiseSeed Seed used to make repeatable rays (see the randomGenerator)\n *\n * @param {function} onDecideSubrayCreation Set this to change the callback which decides subray creation. You can look at the default callback in the code (createDefaultSubrayCreationCallbacks)for more info.\n *\n * @param {function} onSubrayCreation This is another callback, more simple than the previous one. It can be used to adapt the form of subrays or other parameters once a subray has been created and initialized. It is used in the examples to adapt subrays to a sphere or to a plane.\n *\n *\n */\n\nclass LightningStrike extends BufferGeometry {\n // Ray states\n static RAY_INITIALIZED = 0\n static RAY_UNBORN = 1\n static RAY_PROPAGATING = 2\n static RAY_STEADY = 3\n static RAY_VANISHING = 4\n static RAY_EXTINGUISHED = 5\n\n static COS30DEG = Math.cos((30 * Math.PI) / 180)\n static SIN30DEG = Math.sin((30 * Math.PI) / 180)\n\n constructor(rayParameters = {}) {\n super()\n\n this.isLightningStrike = true\n\n this.type = 'LightningStrike'\n\n // Set parameters, and set undefined parameters to default values\n this.init(LightningStrike.copyParameters(rayParameters, rayParameters))\n\n // Creates and populates the mesh\n this.createMesh()\n }\n\n static createRandomGenerator() {\n const numSeeds = 2053\n const seeds = []\n\n for (let i = 0; i < numSeeds; i++) {\n seeds.push(Math.random())\n }\n\n const generator = {\n currentSeed: 0,\n\n random: function () {\n const value = seeds[generator.currentSeed]\n\n generator.currentSeed = (generator.currentSeed + 1) % numSeeds\n\n return value\n },\n\n getSeed: function () {\n return generator.currentSeed / numSeeds\n },\n\n setSeed: function (seed) {\n generator.currentSeed = Math.floor(seed * numSeeds) % numSeeds\n },\n }\n\n return generator\n }\n\n static copyParameters(dest = {}, source = {}) {\n const vecCopy = function (v) {\n if (source === dest) {\n return v\n } else {\n return v.clone()\n }\n }\n\n ;(dest.sourceOffset = source.sourceOffset !== undefined ? vecCopy(source.sourceOffset) : new Vector3(0, 100, 0)),\n (dest.destOffset = source.destOffset !== undefined ? vecCopy(source.destOffset) : new Vector3(0, 0, 0)),\n (dest.timeScale = source.timeScale !== undefined ? source.timeScale : 1),\n (dest.roughness = source.roughness !== undefined ? source.roughness : 0.9),\n (dest.straightness = source.straightness !== undefined ? source.straightness : 0.7),\n (dest.up0 = source.up0 !== undefined ? vecCopy(source.up0) : new Vector3(0, 0, 1))\n ;(dest.up1 = source.up1 !== undefined ? vecCopy(source.up1) : new Vector3(0, 0, 1)),\n (dest.radius0 = source.radius0 !== undefined ? source.radius0 : 1),\n (dest.radius1 = source.radius1 !== undefined ? source.radius1 : 1),\n (dest.radius0Factor = source.radius0Factor !== undefined ? source.radius0Factor : 0.5),\n (dest.radius1Factor = source.radius1Factor !== undefined ? source.radius1Factor : 0.2),\n (dest.minRadius = source.minRadius !== undefined ? source.minRadius : 0.2),\n // These parameters should not be changed after lightning creation. They can be changed but the ray will change its form abruptly:\n\n (dest.isEternal =\n source.isEternal !== undefined\n ? source.isEternal\n : source.birthTime === undefined || source.deathTime === undefined),\n (dest.birthTime = source.birthTime),\n (dest.deathTime = source.deathTime),\n (dest.propagationTimeFactor = source.propagationTimeFactor !== undefined ? source.propagationTimeFactor : 0.1),\n (dest.vanishingTimeFactor = source.vanishingTimeFactor !== undefined ? source.vanishingTimeFactor : 0.9),\n (dest.subrayPeriod = source.subrayPeriod !== undefined ? source.subrayPeriod : 4),\n (dest.subrayDutyCycle = source.subrayDutyCycle !== undefined ? source.subrayDutyCycle : 0.6)\n\n // These parameters cannot change after lightning creation:\n\n dest.maxIterations = source.maxIterations !== undefined ? source.maxIterations : 9\n dest.isStatic = source.isStatic !== undefined ? source.isStatic : false\n dest.ramification = source.ramification !== undefined ? source.ramification : 5\n dest.maxSubrayRecursion = source.maxSubrayRecursion !== undefined ? source.maxSubrayRecursion : 3\n dest.recursionProbability = source.recursionProbability !== undefined ? source.recursionProbability : 0.6\n dest.generateUVs = source.generateUVs !== undefined ? source.generateUVs : false\n ;(dest.randomGenerator = source.randomGenerator),\n (dest.noiseSeed = source.noiseSeed),\n (dest.onDecideSubrayCreation = source.onDecideSubrayCreation),\n (dest.onSubrayCreation = source.onSubrayCreation)\n\n return dest\n }\n\n update(time) {\n if (this.isStatic) return\n\n if (\n this.rayParameters.isEternal ||\n (this.rayParameters.birthTime <= time && time <= this.rayParameters.deathTime)\n ) {\n this.updateMesh(time)\n\n if (time < this.subrays[0].endPropagationTime) {\n this.state = LightningStrike.RAY_PROPAGATING\n } else if (time > this.subrays[0].beginVanishingTime) {\n this.state = LightningStrike.RAY_VANISHING\n } else {\n this.state = LightningStrike.RAY_STEADY\n }\n\n this.visible = true\n } else {\n this.visible = false\n\n if (time < this.rayParameters.birthTime) {\n this.state = LightningStrike.RAY_UNBORN\n } else {\n this.state = LightningStrike.RAY_EXTINGUISHED\n }\n }\n }\n\n init(rayParameters) {\n // Init all the state from the parameters\n\n this.rayParameters = rayParameters\n\n // These parameters cannot change after lightning creation:\n\n this.maxIterations = rayParameters.maxIterations !== undefined ? Math.floor(rayParameters.maxIterations) : 9\n rayParameters.maxIterations = this.maxIterations\n this.isStatic = rayParameters.isStatic !== undefined ? rayParameters.isStatic : false\n rayParameters.isStatic = this.isStatic\n this.ramification = rayParameters.ramification !== undefined ? Math.floor(rayParameters.ramification) : 5\n rayParameters.ramification = this.ramification\n this.maxSubrayRecursion =\n rayParameters.maxSubrayRecursion !== undefined ? Math.floor(rayParameters.maxSubrayRecursion) : 3\n rayParameters.maxSubrayRecursion = this.maxSubrayRecursion\n this.recursionProbability =\n rayParameters.recursionProbability !== undefined ? rayParameters.recursionProbability : 0.6\n rayParameters.recursionProbability = this.recursionProbability\n this.generateUVs = rayParameters.generateUVs !== undefined ? rayParameters.generateUVs : false\n rayParameters.generateUVs = this.generateUVs\n\n // Random generator\n if (rayParameters.randomGenerator !== undefined) {\n this.randomGenerator = rayParameters.randomGenerator\n this.seedGenerator = rayParameters.randomGenerator\n\n if (rayParameters.noiseSeed !== undefined) {\n this.seedGenerator.setSeed(rayParameters.noiseSeed)\n }\n } else {\n this.randomGenerator = LightningStrike.createRandomGenerator()\n this.seedGenerator = Math\n }\n\n // Ray creation callbacks\n if (rayParameters.onDecideSubrayCreation !== undefined) {\n this.onDecideSubrayCreation = rayParameters.onDecideSubrayCreation\n } else {\n this.createDefaultSubrayCreationCallbacks()\n\n if (rayParameters.onSubrayCreation !== undefined) {\n this.onSubrayCreation = rayParameters.onSubrayCreation\n }\n }\n\n // Internal state\n\n this.state = LightningStrike.RAY_INITIALIZED\n\n this.maxSubrays = Math.ceil(1 + Math.pow(this.ramification, Math.max(0, this.maxSubrayRecursion - 1)))\n rayParameters.maxSubrays = this.maxSubrays\n\n this.maxRaySegments = 2 * (1 << this.maxIterations)\n\n this.subrays = []\n\n for (let i = 0; i < this.maxSubrays; i++) {\n this.subrays.push(this.createSubray())\n }\n\n this.raySegments = []\n\n for (let i = 0; i < this.maxRaySegments; i++) {\n this.raySegments.push(this.createSegment())\n }\n\n this.time = 0\n this.timeFraction = 0\n this.currentSegmentCallback = null\n this.currentCreateTriangleVertices = this.generateUVs\n ? this.createTriangleVerticesWithUVs\n : this.createTriangleVerticesWithoutUVs\n this.numSubrays = 0\n this.currentSubray = null\n this.currentSegmentIndex = 0\n this.isInitialSegment = false\n this.subrayProbability = 0\n\n this.currentVertex = 0\n this.currentIndex = 0\n this.currentCoordinate = 0\n this.currentUVCoordinate = 0\n this.vertices = null\n this.uvs = null\n this.indices = null\n this.positionAttribute = null\n this.uvsAttribute = null\n\n this.simplexX = new SimplexNoise(this.seedGenerator)\n this.simplexY = new SimplexNoise(this.seedGenerator)\n this.simplexZ = new SimplexNoise(this.seedGenerator)\n\n // Temp vectors\n this.forwards = new Vector3()\n this.forwardsFill = new Vector3()\n this.side = new Vector3()\n this.down = new Vector3()\n this.middlePos = new Vector3()\n this.middleLinPos = new Vector3()\n this.newPos = new Vector3()\n this.vPos = new Vector3()\n this.cross1 = new Vector3()\n }\n\n createMesh() {\n const maxDrawableSegmentsPerSubRay = 1 << this.maxIterations\n\n const maxVerts = 3 * (maxDrawableSegmentsPerSubRay + 1) * this.maxSubrays\n const maxIndices = 18 * maxDrawableSegmentsPerSubRay * this.maxSubrays\n\n this.vertices = new Float32Array(maxVerts * 3)\n this.indices = new Uint32Array(maxIndices)\n\n if (this.generateUVs) {\n this.uvs = new Float32Array(maxVerts * 2)\n }\n\n // Populate the mesh\n this.fillMesh(0)\n\n this.setIndex(new Uint32BufferAttribute(this.indices, 1))\n\n this.positionAttribute = new Float32BufferAttribute(this.vertices, 3)\n this.setAttribute('position', this.positionAttribute)\n\n if (this.generateUVs) {\n this.uvsAttribute = new Float32BufferAttribute(new Float32Array(this.uvs), 2)\n this.setAttribute('uv', this.uvsAttribute)\n }\n\n if (!this.isStatic) {\n this.index.usage = DynamicDrawUsage\n this.positionAttribute.usage = DynamicDrawUsage\n\n if (this.generateUVs) {\n this.uvsAttribute.usage = DynamicDrawUsage\n }\n }\n\n // Store buffers for later modification\n this.vertices = this.positionAttribute.array\n this.indices = this.index.array\n\n if (this.generateUVs) {\n this.uvs = this.uvsAttribute.array\n }\n }\n\n updateMesh(time) {\n this.fillMesh(time)\n\n this.drawRange.count = this.currentIndex\n\n this.index.needsUpdate = true\n\n this.positionAttribute.needsUpdate = true\n\n if (this.generateUVs) {\n this.uvsAttribute.needsUpdate = true\n }\n }\n\n fillMesh(time) {\n const scope = this\n\n this.currentVertex = 0\n this.currentIndex = 0\n this.currentCoordinate = 0\n this.currentUVCoordinate = 0\n\n this.fractalRay(time, function fillVertices(segment) {\n const subray = scope.currentSubray\n\n if (time < subray.birthTime) {\n //&& ( ! this.rayParameters.isEternal || scope.currentSubray.recursion > 0 ) ) {\n\n return\n } else if (this.rayParameters.isEternal && scope.currentSubray.recursion == 0) {\n // Eternal rays don't propagate nor vanish, but its subrays do\n\n scope.createPrism(segment)\n\n scope.onDecideSubrayCreation(segment, scope)\n } else if (time < subray.endPropagationTime) {\n if (scope.timeFraction >= segment.fraction0 * subray.propagationTimeFactor) {\n // Ray propagation has arrived to this segment\n\n scope.createPrism(segment)\n\n scope.onDecideSubrayCreation(segment, scope)\n }\n } else if (time < subray.beginVanishingTime) {\n // Ray is steady (nor propagating nor vanishing)\n\n scope.createPrism(segment)\n\n scope.onDecideSubrayCreation(segment, scope)\n } else {\n if (scope.timeFraction <= subray.vanishingTimeFactor + segment.fraction1 * (1 - subray.vanishingTimeFactor)) {\n // Segment has not yet vanished\n\n scope.createPrism(segment)\n }\n\n scope.onDecideSubrayCreation(segment, scope)\n }\n })\n }\n\n addNewSubray(/*rayParameters*/) {\n return this.subrays[this.numSubrays++]\n }\n\n initSubray(subray, rayParameters) {\n subray.pos0.copy(rayParameters.sourceOffset)\n subray.pos1.copy(rayParameters.destOffset)\n subray.up0.copy(rayParameters.up0)\n subray.up1.copy(rayParameters.up1)\n subray.radius0 = rayParameters.radius0\n subray.radius1 = rayParameters.radius1\n subray.birthTime = rayParameters.birthTime\n subray.deathTime = rayParameters.deathTime\n subray.timeScale = rayParameters.timeScale\n subray.roughness = rayParameters.roughness\n subray.straightness = rayParameters.straightness\n subray.propagationTimeFactor = rayParameters.propagationTimeFactor\n subray.vanishingTimeFactor = rayParameters.vanishingTimeFactor\n\n subray.maxIterations = this.maxIterations\n subray.seed = rayParameters.noiseSeed !== undefined ? rayParameters.noiseSeed : 0\n subray.recursion = 0\n }\n\n fractalRay(time, segmentCallback) {\n this.time = time\n this.currentSegmentCallback = segmentCallback\n this.numSubrays = 0\n\n // Add the top level subray\n this.initSubray(this.addNewSubray(), this.rayParameters)\n\n // Process all subrays that are being generated until consuming all of them\n for (let subrayIndex = 0; subrayIndex < this.numSubrays; subrayIndex++) {\n const subray = this.subrays[subrayIndex]\n this.currentSubray = subray\n\n this.randomGenerator.setSeed(subray.seed)\n\n subray.endPropagationTime = MathUtils.lerp(subray.birthTime, subray.deathTime, subray.propagationTimeFactor)\n subray.beginVanishingTime = MathUtils.lerp(subray.deathTime, subray.birthTime, 1 - subray.vanishingTimeFactor)\n\n const random1 = this.randomGenerator.random\n subray.linPos0.set(random1(), random1(), random1()).multiplyScalar(1000)\n subray.linPos1.set(random1(), random1(), random1()).multiplyScalar(1000)\n\n this.timeFraction = (time - subray.birthTime) / (subray.deathTime - subray.birthTime)\n\n this.currentSegmentIndex = 0\n this.isInitialSegment = true\n\n const segment = this.getNewSegment()\n segment.iteration = 0\n segment.pos0.copy(subray.pos0)\n segment.pos1.copy(subray.pos1)\n segment.linPos0.copy(subray.linPos0)\n segment.linPos1.copy(subray.linPos1)\n segment.up0.copy(subray.up0)\n segment.up1.copy(subray.up1)\n segment.radius0 = subray.radius0\n segment.radius1 = subray.radius1\n segment.fraction0 = 0\n segment.fraction1 = 1\n segment.positionVariationFactor = 1 - subray.straightness\n\n this.subrayProbability =\n (this.ramification * Math.pow(this.recursionProbability, subray.recursion)) / (1 << subray.maxIterations)\n\n this.fractalRayRecursive(segment)\n }\n\n this.currentSegmentCallback = null\n this.currentSubray = null\n }\n\n fractalRayRecursive(segment) {\n // Leave recursion condition\n if (segment.iteration >= this.currentSubray.maxIterations) {\n this.currentSegmentCallback(segment)\n\n return\n }\n\n // Interpolation\n this.forwards.subVectors(segment.pos1, segment.pos0)\n let lForwards = this.forwards.length()\n\n if (lForwards < 0.000001) {\n this.forwards.set(0, 0, 0.01)\n lForwards = this.forwards.length()\n }\n\n const middleRadius = (segment.radius0 + segment.radius1) * 0.5\n const middleFraction = (segment.fraction0 + segment.fraction1) * 0.5\n\n const timeDimension = this.time * this.currentSubray.timeScale * Math.pow(2, segment.iteration)\n\n this.middlePos.lerpVectors(segment.pos0, segment.pos1, 0.5)\n this.middleLinPos.lerpVectors(segment.linPos0, segment.linPos1, 0.5)\n const p = this.middleLinPos\n\n // Noise\n this.newPos.set(\n this.simplexX.noise4d(p.x, p.y, p.z, timeDimension),\n this.simplexY.noise4d(p.x, p.y, p.z, timeDimension),\n this.simplexZ.noise4d(p.x, p.y, p.z, timeDimension),\n )\n\n this.newPos.multiplyScalar(segment.positionVariationFactor * lForwards)\n this.newPos.add(this.middlePos)\n\n // Recursion\n\n const newSegment1 = this.getNewSegment()\n newSegment1.pos0.copy(segment.pos0)\n newSegment1.pos1.copy(this.newPos)\n newSegment1.linPos0.copy(segment.linPos0)\n newSegment1.linPos1.copy(this.middleLinPos)\n newSegment1.up0.copy(segment.up0)\n newSegment1.up1.copy(segment.up1)\n newSegment1.radius0 = segment.radius0\n newSegment1.radius1 = middleRadius\n newSegment1.fraction0 = segment.fraction0\n newSegment1.fraction1 = middleFraction\n newSegment1.positionVariationFactor = segment.positionVariationFactor * this.currentSubray.roughness\n newSegment1.iteration = segment.iteration + 1\n\n const newSegment2 = this.getNewSegment()\n newSegment2.pos0.copy(this.newPos)\n newSegment2.pos1.copy(segment.pos1)\n newSegment2.linPos0.copy(this.middleLinPos)\n newSegment2.linPos1.copy(segment.linPos1)\n this.cross1.crossVectors(segment.up0, this.forwards.normalize())\n newSegment2.up0.crossVectors(this.forwards, this.cross1).normalize()\n newSegment2.up1.copy(segment.up1)\n newSegment2.radius0 = middleRadius\n newSegment2.radius1 = segment.radius1\n newSegment2.fraction0 = middleFraction\n newSegment2.fraction1 = segment.fraction1\n newSegment2.positionVariationFactor = segment.positionVariationFactor * this.currentSubray.roughness\n newSegment2.iteration = segment.iteration + 1\n\n this.fractalRayRecursive(newSegment1)\n\n this.fractalRayRecursive(newSegment2)\n }\n\n createPrism(segment) {\n // Creates one triangular prism and its vertices at the segment\n\n this.forwardsFill.subVectors(segment.pos1, segment.pos0).normalize()\n\n if (this.isInitialSegment) {\n this.currentCreateTriangleVertices(segment.pos0, segment.up0, this.forwardsFill, segment.radius0, 0)\n\n this.isInitialSegment = false\n }\n\n this.currentCreateTriangleVertices(segment.pos1, segment.up0, this.forwardsFill, segment.radius1, segment.fraction1)\n\n this.createPrismFaces()\n }\n\n createTriangleVerticesWithoutUVs(pos, up, forwards, radius) {\n // Create an equilateral triangle (only vertices)\n\n this.side.crossVectors(up, forwards).multiplyScalar(radius * LightningStrike.COS30DEG)\n this.down.copy(up).multiplyScalar(-radius * LightningStrike.SIN30DEG)\n\n const p = this.vPos\n const v = this.vertices\n\n p.copy(pos).sub(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n p.copy(pos).add(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n p.copy(up).multiplyScalar(radius).add(pos)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n this.currentVertex += 3\n }\n\n createTriangleVerticesWithUVs(pos, up, forwards, radius, u) {\n // Create an equilateral triangle (only vertices)\n\n this.side.crossVectors(up, forwards).multiplyScalar(radius * LightningStrike.COS30DEG)\n this.down.copy(up).multiplyScalar(-radius * LightningStrike.SIN30DEG)\n\n const p = this.vPos\n const v = this.vertices\n const uv = this.uvs\n\n p.copy(pos).sub(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n uv[this.currentUVCoordinate++] = u\n uv[this.currentUVCoordinate++] = 0\n\n p.copy(pos).add(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n uv[this.currentUVCoordinate++] = u\n uv[this.currentUVCoordinate++] = 0.5\n\n p.copy(up).multiplyScalar(radius).add(pos)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n uv[this.currentUVCoordinate++] = u\n uv[this.currentUVCoordinate++] = 1\n\n this.currentVertex += 3\n }\n\n createPrismFaces(vertex /*, index*/) {\n const indices = this.indices\n vertex = this.currentVertex - 6\n\n indices[this.currentIndex++] = vertex + 1\n indices[this.currentIndex++] = vertex + 2\n indices[this.currentIndex++] = vertex + 5\n indices[this.currentIndex++] = vertex + 1\n indices[this.currentIndex++] = vertex + 5\n indices[this.currentIndex++] = vertex + 4\n indices[this.currentIndex++] = vertex + 0\n indices[this.currentIndex++] = vertex + 1\n indices[this.currentIndex++] = vertex + 4\n indices[this.currentIndex++] = vertex + 0\n indices[this.currentIndex++] = vertex + 4\n indices[this.currentIndex++] = vertex + 3\n indices[this.currentIndex++] = vertex + 2\n indices[this.currentIndex++] = vertex + 0\n indices[this.currentIndex++] = vertex + 3\n indices[this.currentIndex++] = vertex + 2\n indices[this.currentIndex++] = vertex + 3\n indices[this.currentIndex++] = vertex + 5\n }\n\n createDefaultSubrayCreationCallbacks() {\n const random1 = this.randomGenerator.random\n\n this.onDecideSubrayCreation = function (segment, lightningStrike) {\n // Decide subrays creation at parent (sub)ray segment\n\n const subray = lightningStrike.currentSubray\n\n const period = lightningStrike.rayParameters.subrayPeriod\n const dutyCycle = lightningStrike.rayParameters.subrayDutyCycle\n\n const phase0 =\n lightningStrike.rayParameters.isEternal && subray.recursion == 0\n ? -random1() * period\n : MathUtils.lerp(subray.birthTime, subray.endPropagationTime, segment.fraction0) - random1() * period\n\n const phase = lightningStrike.time - phase0\n const currentCycle = Math.floor(phase / period)\n\n const childSubraySeed = random1() * (currentCycle + 1)\n\n const isActive = phase % period <= dutyCycle * period\n\n let probability = 0\n\n if (isActive) {\n probability = lightningStrike.subrayProbability\n // Distribution test: probability *= segment.fraction0 > 0.5 && segment.fraction0 < 0.9 ? 1 / 0.4 : 0;\n }\n\n if (\n subray.recursion < lightningStrike.maxSubrayRecursion &&\n lightningStrike.numSubrays < lightningStrike.maxSubrays &&\n random1() < probability\n ) {\n const childSubray = lightningStrike.addNewSubray()\n\n const parentSeed = lightningStrike.randomGenerator.getSeed()\n childSubray.seed = childSubraySeed\n lightningStrike.randomGenerator.setSeed(childSubraySeed)\n\n childSubray.recursion = subray.recursion + 1\n childSubray.maxIterations = Math.max(1, subray.maxIterations - 1)\n\n childSubray.linPos0.set(random1(), random1(), random1()).multiplyScalar(1000)\n childSubray.linPos1.set(random1(), random1(), random1()).multiplyScalar(1000)\n childSubray.up0.copy(subray.up0)\n childSubray.up1.copy(subray.up1)\n childSubray.radius0 = segment.radius0 * lightningStrike.rayParameters.radius0Factor\n childSubray.radius1 = Math.min(\n lightningStrike.rayParameters.minRadius,\n segment.radius1 * lightningStrike.rayParameters.radius1Factor,\n )\n\n childSubray.birthTime = phase0 + currentCycle * period\n childSubray.deathTime = childSubray.birthTime + period * dutyCycle\n\n if (!lightningStrike.rayParameters.isEternal && subray.recursion == 0) {\n childSubray.birthTime = Math.max(childSubray.birthTime, subray.birthTime)\n childSubray.deathTime = Math.min(childSubray.deathTime, subray.deathTime)\n }\n\n childSubray.timeScale = subray.timeScale * 2\n childSubray.roughness = subray.roughness\n childSubray.straightness = subray.straightness\n childSubray.propagationTimeFactor = subray.propagationTimeFactor\n childSubray.vanishingTimeFactor = subray.vanishingTimeFactor\n\n lightningStrike.onSubrayCreation(segment, subray, childSubray, lightningStrike)\n\n lightningStrike.randomGenerator.setSeed(parentSeed)\n }\n }\n\n const vec1Pos = new Vector3()\n const vec2Forward = new Vector3()\n const vec3Side = new Vector3()\n const vec4Up = new Vector3()\n\n this.onSubrayCreation = function (segment, parentSubray, childSubray, lightningStrike) {\n // Decide childSubray origin and destination positions (pos0 and pos1) and possibly other properties of childSubray\n\n // Just use the default cone position generator\n lightningStrike.subrayCylinderPosition(segment, parentSubray, childSubray, 0.5, 0.6, 0.2)\n }\n\n this.subrayConePosition = function (\n segment,\n parentSubray,\n childSubray,\n heightFactor,\n sideWidthFactor,\n minSideWidthFactor,\n ) {\n // Sets childSubray pos0 and pos1 in a cone\n\n childSubray.pos0.copy(segment.pos0)\n\n vec1Pos.subVectors(parentSubray.pos1, parentSubray.pos0)\n vec2Forward.copy(vec1Pos).normalize()\n vec1Pos.multiplyScalar(segment.fraction0 + (1 - segment.fraction0) * (random1() * heightFactor))\n const length = vec1Pos.length()\n vec3Side.crossVectors(parentSubray.up0, vec2Forward)\n const angle = 2 * Math.PI * random1()\n vec3Side.multiplyScalar(Math.cos(angle))\n vec4Up.copy(parentSubray.up0).multiplyScalar(Math.sin(angle))\n\n childSubray.pos1\n .copy(vec3Side)\n .add(vec4Up)\n .multiplyScalar(length * sideWidthFactor * (minSideWidthFactor + random1() * (1 - minSideWidthFactor)))\n .add(vec1Pos)\n .add(parentSubray.pos0)\n }\n\n this.subrayCylinderPosition = function (\n segment,\n parentSubray,\n childSubray,\n heightFactor,\n sideWidthFactor,\n minSideWidthFactor,\n ) {\n // Sets childSubray pos0 and pos1 in a cylinder\n\n childSubray.pos0.copy(segment.pos0)\n\n vec1Pos.subVectors(parentSubray.pos1, parentSubray.pos0)\n vec2Forward.copy(vec1Pos).normalize()\n vec1Pos.multiplyScalar(segment.fraction0 + (1 - segment.fraction0) * ((2 * random1() - 1) * heightFactor))\n const length = vec1Pos.length()\n vec3Side.crossVectors(parentSubray.up0, vec2Forward)\n const angle = 2 * Math.PI * random1()\n vec3Side.multiplyScalar(Math.cos(angle))\n vec4Up.copy(parentSubray.up0).multiplyScalar(Math.sin(angle))\n\n childSubray.pos1\n .copy(vec3Side)\n .add(vec4Up)\n .multiplyScalar(length * sideWidthFactor * (minSideWidthFactor + random1() * (1 - minSideWidthFactor)))\n .add(vec1Pos)\n .add(parentSubray.pos0)\n }\n }\n\n createSubray() {\n return {\n seed: 0,\n maxIterations: 0,\n recursion: 0,\n pos0: new Vector3(),\n pos1: new Vector3(),\n linPos0: new Vector3(),\n linPos1: new Vector3(),\n up0: new Vector3(),\n up1: new Vector3(),\n radius0: 0,\n radius1: 0,\n birthTime: 0,\n deathTime: 0,\n timeScale: 0,\n roughness: 0,\n straightness: 0,\n propagationTimeFactor: 0,\n vanishingTimeFactor: 0,\n endPropagationTime: 0,\n beginVanishingTime: 0,\n }\n }\n\n createSegment() {\n return {\n iteration: 0,\n pos0: new Vector3(),\n pos1: new Vector3(),\n linPos0: new Vector3(),\n linPos1: new Vector3(),\n up0: new Vector3(),\n up1: new Vector3(),\n radius0: 0,\n radius1: 0,\n fraction0: 0,\n fraction1: 0,\n positionVariationFactor: 0,\n }\n }\n\n getNewSegment() {\n return this.raySegments[this.currentSegmentIndex++]\n }\n\n copy(source) {\n super.copy(source)\n\n this.init(LightningStrike.copyParameters({}, source.rayParameters))\n\n return this\n }\n\n clone() {\n return new this.constructor(LightningStrike.copyParameters({}, this.rayParameters))\n }\n}\n\nexport { LightningStrike }\n", "import {\n Color,\n Matrix4,\n Mesh,\n PerspectiveCamera,\n ShaderMaterial,\n UniformsUtils,\n Vector2,\n Vector3,\n WebGLRenderTarget,\n DepthTexture,\n UnsignedShortType,\n NearestFilter,\n Plane,\n HalfFloatType,\n} from 'three'\n\nclass ReflectorForSSRPass extends Mesh {\n static ReflectorShader = {\n defines: {\n DISTANCE_ATTENUATION: true,\n FRESNEL: true,\n },\n\n uniforms: {\n color: { value: null },\n tDiffuse: { value: null },\n tDepth: { value: null },\n textureMatrix: { value: new Matrix4() },\n maxDistance: { value: 180 },\n opacity: { value: 0.5 },\n fresnelCoe: { value: null },\n virtualCameraNear: { value: null },\n virtualCameraFar: { value: null },\n virtualCameraProjectionMatrix: { value: new Matrix4() },\n virtualCameraMatrixWorld: { value: new Matrix4() },\n virtualCameraProjectionMatrixInverse: { value: new Matrix4() },\n resolution: { value: new Vector2() },\n },\n\n vertexShader: /* glsl */ `\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform sampler2D tDepth;\n\t\tuniform float maxDistance;\n\t\tuniform float opacity;\n\t\tuniform float fresnelCoe;\n\t\tuniform float virtualCameraNear;\n\t\tuniform float virtualCameraFar;\n\t\tuniform mat4 virtualCameraProjectionMatrix;\n\t\tuniform mat4 virtualCameraProjectionMatrixInverse;\n\t\tuniform mat4 virtualCameraMatrixWorld;\n\t\tuniform vec2 resolution;\n\t\tvarying vec4 vUv;\n\t\t#include \n\t\tfloat blendOverlay( float base, float blend ) {\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\t\t}\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\treturn perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar );\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view\n\t\t}\n\t\tvoid main() {\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\t#ifdef useDepthTexture\n\t\t\t\tvec2 uv=(gl_FragCoord.xy-.5)/resolution.xy;\n\t\t\t\tuv.x=1.-uv.x;\n\t\t\t\tfloat depth = texture2DProj( tDepth, vUv ).r;\n\t\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\t\tfloat clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3];\n\t\t\t\tvec3 viewPosition=getViewPosition( uv, depth, clipW );\n\t\t\t\tvec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz;\n\t\t\t\tif(worldPosition.y>maxDistance) discard;\n\t\t\t\tfloat op=opacity;\n\t\t\t\t#ifdef DISTANCE_ATTENUATION\n\t\t\t\t\tfloat ratio=1.-(worldPosition.y/maxDistance);\n\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t#endif\n\t\t\t\t#ifdef FRESNEL\n\t\t\t\t\top*=fresnelCoe;\n\t\t\t\t#endif\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), op );\n\t\t\t#else\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\t\t\t#endif\n\t\t}\n\t`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isReflectorForSSRPass = true\n\n this.type = 'ReflectorForSSRPass'\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0x7f7f7f)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const shader = options.shader || ReflectorForSSRPass.ReflectorShader\n const useDepthTexture = options.useDepthTexture === true\n const yAxis = new Vector3(0, 1, 0)\n const vecTemp0 = new Vector3()\n const vecTemp1 = new Vector3()\n\n //\n\n scope.needsUpdate = false\n scope.maxDistance = ReflectorForSSRPass.ReflectorShader.uniforms.maxDistance.value\n scope.opacity = ReflectorForSSRPass.ReflectorShader.uniforms.opacity.value\n scope.color = color\n scope.resolution = options.resolution || new Vector2(window.innerWidth, window.innerHeight)\n\n scope._distanceAttenuation = ReflectorForSSRPass.ReflectorShader.defines.DISTANCE_ATTENUATION\n Object.defineProperty(scope, 'distanceAttenuation', {\n get() {\n return scope._distanceAttenuation\n },\n set(val) {\n if (scope._distanceAttenuation === val) return\n scope._distanceAttenuation = val\n scope.material.defines.DISTANCE_ATTENUATION = val\n scope.material.needsUpdate = true\n },\n })\n\n scope._fresnel = ReflectorForSSRPass.ReflectorShader.defines.FRESNEL\n Object.defineProperty(scope, 'fresnel', {\n get() {\n return scope._fresnel\n },\n set(val) {\n if (scope._fresnel === val) return\n scope._fresnel = val\n scope.material.defines.FRESNEL = val\n scope.material.needsUpdate = true\n },\n })\n\n const normal = new Vector3()\n const reflectorWorldPosition = new Vector3()\n const cameraWorldPosition = new Vector3()\n const rotationMatrix = new Matrix4()\n const lookAtPosition = new Vector3(0, 0, -1)\n\n const view = new Vector3()\n const target = new Vector3()\n\n const textureMatrix = new Matrix4()\n const virtualCamera = new PerspectiveCamera()\n\n let depthTexture\n\n if (useDepthTexture) {\n depthTexture = new DepthTexture()\n depthTexture.type = UnsignedShortType\n depthTexture.minFilter = NearestFilter\n depthTexture.magFilter = NearestFilter\n }\n\n const parameters = {\n depthTexture: useDepthTexture ? depthTexture : null,\n type: HalfFloatType,\n }\n\n const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight, parameters)\n\n const material = new ShaderMaterial({\n transparent: useDepthTexture,\n defines: Object.assign({}, ReflectorForSSRPass.ReflectorShader.defines, {\n useDepthTexture,\n }),\n uniforms: UniformsUtils.clone(shader.uniforms),\n fragmentShader: shader.fragmentShader,\n vertexShader: shader.vertexShader,\n })\n\n material.uniforms['tDiffuse'].value = renderTarget.texture\n material.uniforms['color'].value = scope.color\n material.uniforms['textureMatrix'].value = textureMatrix\n if (useDepthTexture) {\n material.uniforms['tDepth'].value = renderTarget.depthTexture\n }\n\n this.material = material\n\n const globalPlane = new Plane(new Vector3(0, 1, 0), clipBias)\n const globalPlanes = [globalPlane]\n\n this.doRender = function (renderer, scene, camera) {\n material.uniforms['maxDistance'].value = scope.maxDistance\n material.uniforms['color'].value = scope.color\n material.uniforms['opacity'].value = scope.opacity\n\n vecTemp0.copy(camera.position).normalize()\n vecTemp1.copy(vecTemp0).reflect(yAxis)\n material.uniforms['fresnelCoe'].value = (vecTemp0.dot(vecTemp1) + 1) / 2 // TODO: Also need to use glsl viewPosition and viewNormal per pixel.\n\n reflectorWorldPosition.setFromMatrixPosition(scope.matrixWorld)\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld)\n\n rotationMatrix.extractRotation(scope.matrixWorld)\n\n normal.set(0, 0, 1)\n normal.applyMatrix4(rotationMatrix)\n\n view.subVectors(reflectorWorldPosition, cameraWorldPosition)\n\n // Avoid rendering when reflector is facing away\n\n if (view.dot(normal) > 0) return\n\n view.reflect(normal).negate()\n view.add(reflectorWorldPosition)\n\n rotationMatrix.extractRotation(camera.matrixWorld)\n\n lookAtPosition.set(0, 0, -1)\n lookAtPosition.applyMatrix4(rotationMatrix)\n lookAtPosition.add(cameraWorldPosition)\n\n target.subVectors(reflectorWorldPosition, lookAtPosition)\n target.reflect(normal).negate()\n target.add(reflectorWorldPosition)\n\n virtualCamera.position.copy(view)\n virtualCamera.up.set(0, 1, 0)\n virtualCamera.up.applyMatrix4(rotationMatrix)\n virtualCamera.up.reflect(normal)\n virtualCamera.lookAt(target)\n\n virtualCamera.far = camera.far // Used in WebGLBackground\n\n virtualCamera.updateMatrixWorld()\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix)\n\n material.uniforms['virtualCameraNear'].value = camera.near\n material.uniforms['virtualCameraFar'].value = camera.far\n material.uniforms['virtualCameraMatrixWorld'].value = virtualCamera.matrixWorld\n material.uniforms['virtualCameraProjectionMatrix'].value = camera.projectionMatrix\n material.uniforms['virtualCameraProjectionMatrixInverse'].value = camera.projectionMatrixInverse\n material.uniforms['resolution'].value = scope.resolution\n\n // Update the texture matrix\n textureMatrix.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 textureMatrix.multiply(virtualCamera.projectionMatrix)\n textureMatrix.multiply(virtualCamera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n\n // scope.visible = false;\n\n const currentRenderTarget = renderer.getRenderTarget()\n\n const currentXrEnabled = renderer.xr.enabled\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate\n const currentClippingPlanes = renderer.clippingPlanes\n\n renderer.xr.enabled = false // Avoid camera modification\n renderer.shadowMap.autoUpdate = false // Avoid re-computing shadows\n renderer.clippingPlanes = globalPlanes\n\n renderer.setRenderTarget(renderTarget)\n\n renderer.state.buffers.depth.setMask(true) // make sure the depth buffer is writable so it can be properly cleared, see #18897\n\n if (renderer.autoClear === false) renderer.clear()\n renderer.render(scene, virtualCamera)\n\n renderer.xr.enabled = currentXrEnabled\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate\n renderer.clippingPlanes = currentClippingPlanes\n\n renderer.setRenderTarget(currentRenderTarget)\n\n // Restore viewport\n\n const viewport = camera.viewport\n\n if (viewport !== undefined) {\n renderer.state.viewport(viewport)\n }\n\n // scope.visible = true;\n }\n\n this.getRenderTarget = function () {\n return renderTarget\n }\n }\n}\n\nexport { ReflectorForSSRPass }\n", "import { BackSide, BoxGeometry, Mesh, ShaderMaterial, UniformsUtils, Vector3 } from 'three'\nimport { version } from '../_polyfill/constants'\n\nconst SkyShader = {\n uniforms: {\n turbidity: { value: 2 },\n rayleigh: { value: 1 },\n mieCoefficient: { value: 0.005 },\n mieDirectionalG: { value: 0.8 },\n sunPosition: { value: new Vector3() },\n up: { value: new Vector3(0, 1, 0) },\n },\n\n vertexShader: /* glsl */ `\n uniform vec3 sunPosition;\n uniform float rayleigh;\n uniform float turbidity;\n uniform float mieCoefficient;\n uniform vec3 up;\n\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n // constants for atmospheric scattering\n const float e = 2.71828182845904523536028747135266249775724709369995957;\n const float pi = 3.141592653589793238462643383279502884197169;\n\n // wavelength of used primaries, according to preetham\n const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n // mie stuff\n // K coefficient for the primaries\n const float v = 4.0;\n const vec3 K = vec3( 0.686, 0.678, 0.666 );\n // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n // earth shadow hack\n // cutoffAngle = pi / 1.95;\n const float cutoffAngle = 1.6110731556870734;\n const float steepness = 1.5;\n const float EE = 1000.0;\n\n float sunIntensity( float zenithAngleCos ) {\n zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n }\n\n vec3 totalMie( float T ) {\n float c = ( 0.2 * T ) * 10E-18;\n return 0.434 * c * MieConst;\n }\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = worldPosition.xyz;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n gl_Position.z = gl_Position.w; // set z to camera.far\n\n vSunDirection = normalize( sunPosition );\n\n vSunE = sunIntensity( dot( vSunDirection, up ) );\n\n vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n // extinction (absorbtion + out scattering)\n // rayleigh coefficients\n vBetaR = totalRayleigh * rayleighCoefficient;\n\n // mie coefficients\n vBetaM = totalMie( turbidity ) * mieCoefficient;\n\n }\n `,\n\n fragmentShader: /* glsl */ `\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n uniform float mieDirectionalG;\n uniform vec3 up;\n\n const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n // constants for atmospheric scattering\n const float pi = 3.141592653589793238462643383279502884197169;\n\n const float n = 1.0003; // refractive index of air\n const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n // optical length at zenith for molecules\n const float rayleighZenithLength = 8.4E3;\n const float mieZenithLength = 1.25E3;\n // 66 arc seconds -> degrees, and the cosine of that\n const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n // 3.0 / ( 16.0 * pi )\n const float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n // 1.0 / ( 4.0 * pi )\n const float ONE_OVER_FOURPI = 0.07957747154594767;\n\n float rayleighPhase( float cosTheta ) {\n return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n }\n\n float hgPhase( float cosTheta, float g ) {\n float g2 = pow( g, 2.0 );\n float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n }\n\n void main() {\n\n vec3 direction = normalize( vWorldPosition - cameraPos );\n\n // optical length\n // cutoff angle at 90 to avoid singularity in next formula.\n float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n float sR = rayleighZenithLength * inverse;\n float sM = mieZenithLength * inverse;\n\n // combined extinction factor\n vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n // in scattering\n float cosTheta = dot( direction, vSunDirection );\n\n float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n vec3 betaRTheta = vBetaR * rPhase;\n\n float mPhase = hgPhase( cosTheta, mieDirectionalG );\n vec3 betaMTheta = vBetaM * mPhase;\n\n vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n // nightsky\n float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]\n float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]\n vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n vec3 L0 = vec3( 0.1 ) * Fex;\n\n // composition + solar disc\n float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n L0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n gl_FragColor = vec4( retColor, 1.0 );\n\n #include \n #include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\n }\n `,\n}\n\nconst material = new ShaderMaterial({\n name: 'SkyShader',\n fragmentShader: SkyShader.fragmentShader,\n vertexShader: SkyShader.vertexShader,\n uniforms: UniformsUtils.clone(SkyShader.uniforms),\n side: BackSide,\n depthWrite: false,\n})\n\n/**\n * Based on \"A Practical Analytic Model for Daylight\"\n * aka The Preetham Model, the de facto standard analytic skydome model\n * https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight\n *\n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n */\nclass Sky extends Mesh {\n constructor() {\n super(new BoxGeometry(1, 1, 1), material)\n }\n\n static SkyShader = SkyShader\n public static material = material\n}\n\nexport { Sky }\n", "import {\n Clock,\n Color,\n Matrix4,\n Mesh,\n RepeatWrapping,\n ShaderMaterial,\n UniformsLib,\n UniformsUtils,\n Vector2,\n Vector4,\n} from 'three'\nimport { Reflector } from './Reflector'\nimport { Refractor } from './Refractor'\nimport { version } from '../_polyfill/constants'\n\n/**\n * References:\n *\thttp://www.valvesoftware.com/publications/2010/siggraph2010_vlachos_waterflow.pdf\n * \thttp://graphicsrunner.blogspot.de/2010/08/water-using-flow-maps.html\n *\n */\n\nclass Water2 extends Mesh {\n static WaterShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n reflectivity: {\n value: 0,\n },\n\n tReflectionMap: {\n value: null,\n },\n\n tRefractionMap: {\n value: null,\n },\n\n tNormalMap0: {\n value: null,\n },\n\n tNormalMap1: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n\n config: {\n value: new Vector4(),\n },\n },\n\n vertexShader: /* glsl */ `\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tvCoord = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvToEye = cameraPosition - worldPosition.xyz;\n\n\t\t\tvec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex\n\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform sampler2D tReflectionMap;\n\t\tuniform sampler2D tRefractionMap;\n\t\tuniform sampler2D tNormalMap0;\n\t\tuniform sampler2D tNormalMap1;\n\n\t\t#ifdef USE_FLOWMAP\n\t\t\tuniform sampler2D tFlowMap;\n\t\t#else\n\t\t\tuniform vec2 flowDirection;\n\t\t#endif\n\n\t\tuniform vec3 color;\n\t\tuniform float reflectivity;\n\t\tuniform vec4 config;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tfloat flowMapOffset0 = config.x;\n\t\t\tfloat flowMapOffset1 = config.y;\n\t\t\tfloat halfCycle = config.z;\n\t\t\tfloat scale = config.w;\n\n\t\t\tvec3 toEye = normalize( vToEye );\n\n\t\t\t// determine flow direction\n\t\t\tvec2 flow;\n\t\t\t#ifdef USE_FLOWMAP\n\t\t\t\tflow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;\n\t\t\t#else\n\t\t\t\tflow = flowDirection;\n\t\t\t#endif\n\t\t\tflow.x *= - 1.0;\n\n\t\t\t// sample normal maps (distort uvs with flowdata)\n\t\t\tvec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );\n\t\t\tvec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );\n\n\t\t\t// linear interpolate to get the final normal color\n\t\t\tfloat flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;\n\t\t\tvec4 normalColor = mix( normalColor0, normalColor1, flowLerp );\n\n\t\t\t// calculate normal vector\n\t\t\tvec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n\n\t\t\t// calculate the fresnel term to blend reflection and refraction maps\n\t\t\tfloat theta = max( dot( toEye, normal ), 0.0 );\n\t\t\tfloat reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );\n\n\t\t\t// calculate final uv coords\n\t\t\tvec3 coord = vCoord.xyz / vCoord.w;\n\t\t\tvec2 uv = coord.xy + coord.z * normal.xz * 0.05;\n\n\t\t\tvec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );\n\t\t\tvec4 refractColor = texture2D( tRefractionMap, uv );\n\n\t\t\t// multiply water color with the mix of both textures\n\t\t\tgl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );\n\n\t\t\t#include \n\t\t\t#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\t\t\t#include \n\n\t\t}`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isWater = true\n\n this.type = 'Water'\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0xffffff)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const flowDirection = options.flowDirection || new Vector2(1, 0)\n const flowSpeed = options.flowSpeed || 0.03\n const reflectivity = options.reflectivity || 0.02\n const scale = options.scale || 1\n const shader = options.shader || Water2.WaterShader\n const encoding = options.encoding !== undefined ? options.encoding : 3000\n\n const flowMap = options.flowMap || undefined\n const normalMap0 = options.normalMap0\n const normalMap1 = options.normalMap1\n\n const cycle = 0.15 // a cycle of a flow map phase\n const halfCycle = cycle * 0.5\n const textureMatrix = new Matrix4()\n const clock = new Clock()\n\n // internal components\n\n if (Reflector === undefined) {\n console.error('THREE.Water: Required component Reflector not found.')\n return\n }\n\n if (Refractor === undefined) {\n console.error('THREE.Water: Required component Refractor not found.')\n return\n }\n\n const reflector = new Reflector(geometry, {\n textureWidth: textureWidth,\n textureHeight: textureHeight,\n clipBias: clipBias,\n encoding: encoding,\n })\n\n const refractor = new Refractor(geometry, {\n textureWidth: textureWidth,\n textureHeight: textureHeight,\n clipBias: clipBias,\n encoding: encoding,\n })\n\n reflector.matrixAutoUpdate = false\n refractor.matrixAutoUpdate = false\n\n // material\n\n this.material = new ShaderMaterial({\n uniforms: UniformsUtils.merge([UniformsLib['fog'], shader.uniforms]),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n transparent: true,\n fog: true,\n })\n\n if (flowMap !== undefined) {\n this.material.defines.USE_FLOWMAP = ''\n this.material.uniforms['tFlowMap'] = {\n type: 't',\n value: flowMap,\n }\n } else {\n this.material.uniforms['flowDirection'] = {\n type: 'v2',\n value: flowDirection,\n }\n }\n\n // maps\n\n normalMap0.wrapS = normalMap0.wrapT = RepeatWrapping\n normalMap1.wrapS = normalMap1.wrapT = RepeatWrapping\n\n this.material.uniforms['tReflectionMap'].value = reflector.getRenderTarget().texture\n this.material.uniforms['tRefractionMap'].value = refractor.getRenderTarget().texture\n this.material.uniforms['tNormalMap0'].value = normalMap0\n this.material.uniforms['tNormalMap1'].value = normalMap1\n\n // water\n\n this.material.uniforms['color'].value = color\n this.material.uniforms['reflectivity'].value = reflectivity\n this.material.uniforms['textureMatrix'].value = textureMatrix\n\n // inital values\n\n this.material.uniforms['config'].value.x = 0 // flowMapOffset0\n this.material.uniforms['config'].value.y = halfCycle // flowMapOffset1\n this.material.uniforms['config'].value.z = halfCycle // halfCycle\n this.material.uniforms['config'].value.w = scale // scale\n\n // functions\n\n function updateTextureMatrix(camera) {\n textureMatrix.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\n textureMatrix.multiply(camera.projectionMatrix)\n textureMatrix.multiply(camera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n }\n\n function updateFlow() {\n const delta = clock.getDelta()\n const config = scope.material.uniforms['config']\n\n config.value.x += flowSpeed * delta // flowMapOffset0\n config.value.y = config.value.x + halfCycle // flowMapOffset1\n\n // Important: The distance between offsets should be always the value of \"halfCycle\".\n // Moreover, both offsets should be in the range of [ 0, cycle ].\n // This approach ensures a smooth water flow and avoids \"reset\" effects.\n\n if (config.value.x >= cycle) {\n config.value.x = 0\n config.value.y = halfCycle\n } else if (config.value.y >= cycle) {\n config.value.y = config.value.y - cycle\n }\n }\n\n //\n\n this.onBeforeRender = function (renderer, scene, camera) {\n updateTextureMatrix(camera)\n updateFlow()\n\n scope.visible = false\n\n reflector.matrixWorld.copy(scope.matrixWorld)\n refractor.matrixWorld.copy(scope.matrixWorld)\n\n reflector.onBeforeRender(renderer, scene, camera)\n refractor.onBeforeRender(renderer, scene, camera)\n\n scope.visible = true\n }\n }\n}\n\nexport { Water2 }\n", "/**\n * This class generates custom mipmaps for a roughness map by encoding the lost variation in the\n * normal map mip levels as increased roughness in the corresponding roughness mip levels. This\n * helps with rendering accuracy for MeshStandardMaterial, and also helps with anti-aliasing when\n * using PMREM. If the normal map is larger than the roughness map, the roughness map will be\n * enlarged to match the dimensions of the normal map.\n */\n\nimport {\n MathUtils,\n Mesh,\n NoBlending,\n OrthographicCamera,\n PlaneGeometry,\n RawShaderMaterial,\n Vector2,\n WebGLRenderTarget,\n} from 'three'\n\nvar _mipmapMaterial = _getMipmapMaterial()\n\nvar _mesh = new Mesh(new PlaneGeometry(2, 2), _mipmapMaterial)\n\nvar _flatCamera = new OrthographicCamera(0, 1, 0, 1, 0, 1)\n\nvar _tempTarget = null\n\nclass RoughnessMipmapper {\n constructor(renderer) {\n this._renderer = renderer\n\n this._renderer.compile(_mesh, _flatCamera)\n }\n\n generateMipmaps = function (material) {\n if ('roughnessMap' in material === false) return\n\n var { roughnessMap, normalMap } = material\n\n if (\n roughnessMap === null ||\n normalMap === null ||\n !roughnessMap.generateMipmaps ||\n material.userData.roughnessUpdated\n ) {\n return\n }\n\n material.userData.roughnessUpdated = true\n\n var width = Math.max(roughnessMap.image.width, normalMap.image.width)\n\n var height = Math.max(roughnessMap.image.height, normalMap.image.height)\n\n if (!MathUtils.isPowerOfTwo(width) || !MathUtils.isPowerOfTwo(height)) return\n\n var oldTarget = this._renderer.getRenderTarget()\n\n var autoClear = this._renderer.autoClear\n\n this._renderer.autoClear = false\n\n if (_tempTarget === null || _tempTarget.width !== width || _tempTarget.height !== height) {\n if (_tempTarget !== null) _tempTarget.dispose()\n\n _tempTarget = new WebGLRenderTarget(width, height, {\n depthBuffer: false,\n })\n\n _tempTarget.scissorTest = true\n }\n\n if (width !== roughnessMap.image.width || height !== roughnessMap.image.height) {\n var params = {\n wrapS: roughnessMap.wrapS,\n wrapT: roughnessMap.wrapT,\n magFilter: roughnessMap.magFilter,\n minFilter: roughnessMap.minFilter,\n depthBuffer: false,\n }\n\n var newRoughnessTarget = new WebGLRenderTarget(width, height, params)\n\n newRoughnessTarget.texture.generateMipmaps = true\n\n // Setting the render target causes the memory to be allocated.\n\n this._renderer.setRenderTarget(newRoughnessTarget)\n\n material.roughnessMap = newRoughnessTarget.texture\n\n if (material.metalnessMap == roughnessMap) material.metalnessMap = material.roughnessMap\n\n if (material.aoMap == roughnessMap) material.aoMap = material.roughnessMap\n }\n\n _mipmapMaterial.uniforms.roughnessMap.value = roughnessMap\n\n _mipmapMaterial.uniforms.normalMap.value = normalMap\n\n var position = new Vector2(0, 0)\n\n var texelSize = _mipmapMaterial.uniforms.texelSize.value\n\n for (let mip = 0; width >= 1 && height >= 1; ++mip, width /= 2, height /= 2) {\n // Rendering to a mip level is not allowed in webGL1. Instead we must set\n // up a secondary texture to write the result to, then copy it back to the\n // proper mipmap level.\n\n texelSize.set(1.0 / width, 1.0 / height)\n\n if (mip == 0) texelSize.set(0.0, 0.0)\n\n _tempTarget.viewport.set(position.x, position.y, width, height)\n\n _tempTarget.scissor.set(position.x, position.y, width, height)\n\n this._renderer.setRenderTarget(_tempTarget)\n\n this._renderer.render(_mesh, _flatCamera)\n\n this._renderer.copyFramebufferToTexture(position, material.roughnessMap, mip)\n\n _mipmapMaterial.uniforms.roughnessMap.value = material.roughnessMap\n }\n\n if (roughnessMap !== material.roughnessMap) roughnessMap.dispose()\n\n this._renderer.setRenderTarget(oldTarget)\n\n this._renderer.autoClear = autoClear\n }\n\n dispose = function () {\n _mipmapMaterial.dispose()\n\n _mesh.geometry.dispose()\n\n if (_tempTarget != null) _tempTarget.dispose()\n }\n}\n\nfunction _getMipmapMaterial() {\n var shaderMaterial = new RawShaderMaterial({\n uniforms: {\n roughnessMap: { value: null },\n normalMap: { value: null },\n texelSize: { value: new Vector2(1, 1) },\n },\n\n vertexShader: /* glsl */ `\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n fragmentShader: /* glsl */ `\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tuniform sampler2D roughnessMap;\n\t\t\tuniform sampler2D normalMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec4 envMapTexelToLinear( vec4 a ) { return a; }\n\n\t\t\t#include \n\n\t\t\tfloat roughnessToVariance( float roughness ) {\n\n\t\t\t\tfloat variance = 0.0;\n\n\t\t\t\tif ( roughness >= r1 ) {\n\n\t\t\t\t\tvariance = ( r0 - roughness ) * ( v1 - v0 ) / ( r0 - r1 ) + v0;\n\n\t\t\t\t} else if ( roughness >= r4 ) {\n\n\t\t\t\t\tvariance = ( r1 - roughness ) * ( v4 - v1 ) / ( r1 - r4 ) + v1;\n\n\t\t\t\t} else if ( roughness >= r5 ) {\n\n\t\t\t\t\tvariance = ( r4 - roughness ) * ( v5 - v4 ) / ( r4 - r5 ) + v4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfloat roughness2 = roughness * roughness;\n\n\t\t\t\t\tvariance = 1.79 * roughness2 * roughness2;\n\n\t\t\t\t}\n\n\t\t\t\treturn variance;\n\n\t\t\t}\n\n\t\t\tfloat varianceToRoughness( float variance ) {\n\n\t\t\t\tfloat roughness = 0.0;\n\n\t\t\t\tif ( variance >= v1 ) {\n\n\t\t\t\t\troughness = ( v0 - variance ) * ( r1 - r0 ) / ( v0 - v1 ) + r0;\n\n\t\t\t\t} else if ( variance >= v4 ) {\n\n\t\t\t\t\troughness = ( v1 - variance ) * ( r4 - r1 ) / ( v1 - v4 ) + r1;\n\n\t\t\t\t} else if ( variance >= v5 ) {\n\n\t\t\t\t\troughness = ( v4 - variance ) * ( r5 - r4 ) / ( v4 - v5 ) + r4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\troughness = pow( 0.559 * variance, 0.25 ); // 0.559 = 1.0 / 1.79\n\n\t\t\t\t}\n\n\t\t\t\treturn roughness;\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = texture2D( roughnessMap, vUv, - 1.0 );\n\n\t\t\t\tif ( texelSize.x == 0.0 ) return;\n\n\t\t\t\tfloat roughness = gl_FragColor.g;\n\n\t\t\t\tfloat variance = roughnessToVariance( roughness );\n\n\t\t\t\tvec3 avgNormal;\n\n\t\t\t\tfor ( float x = - 1.0; x < 2.0; x += 2.0 ) {\n\n\t\t\t\t\tfor ( float y = - 1.0; y < 2.0; y += 2.0 ) {\n\n\t\t\t\t\t\tvec2 uv = vUv + vec2( x, y ) * 0.25 * texelSize;\n\n\t\t\t\t\t\tavgNormal += normalize( texture2D( normalMap, uv, - 1.0 ).xyz - 0.5 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvariance += 1.0 - 0.25 * length( avgNormal );\n\n\t\t\t\tgl_FragColor.g = varianceToRoughness( variance );\n\n\t\t\t}\n\t\t`,\n\n blending: NoBlending,\n depthTest: false,\n depthWrite: false,\n })\n\n shaderMaterial.type = 'RoughnessMipmapper'\n\n return shaderMaterial\n}\n\nexport { RoughnessMipmapper }\n", "/**\n * Unpack RGBA depth shader\n * - show RGBA encoded depth as monochrome color\n */\n\nexport const UnpackDepthRGBAShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n '#include ',\n\n 'void main() {',\n\n '\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );',\n '\tgl_FragColor = vec4( vec3( depth ), opacity );',\n\n '}',\n ].join('\\n'),\n}\n", "import { IUniform, Texture, Vector2 } from 'three'\n\nexport interface BokehShader2Uniforms {\n textureWidth: IUniform\n textureHeight: IUniform\n\n focalDepth: IUniform\n focalLength: IUniform\n fstop: IUniform\n\n tColor: IUniform\n tDepth: IUniform\n\n maxblur: IUniform\n\n showFocus: IUniform\n manualdof: IUniform\n vignetting: IUniform\n depthblur: IUniform\n\n threshold: IUniform\n gain: IUniform\n bias: IUniform\n fringe: IUniform\n\n znear: IUniform\n zfar: IUniform\n\n noise: IUniform\n dithering: IUniform\n pentagon: IUniform\n\n shaderFocus: IUniform\n focusCoords: IUniform\n}\n\n/**\n * Depth-of-field shader with bokeh\n * ported from GLSL shader by Martins Upitis\n * http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update)\n *\n * Requires #define RINGS and SAMPLES integers\n */\n\nexport const BokehShader2: {\n uniforms: BokehShader2Uniforms\n vertexShader: string\n fragmentShader: string\n} = {\n uniforms: {\n textureWidth: { value: 1.0 },\n textureHeight: { value: 1.0 },\n\n focalDepth: { value: 1.0 },\n focalLength: { value: 24.0 },\n fstop: { value: 0.9 },\n\n tColor: { value: null },\n tDepth: { value: null },\n\n maxblur: { value: 1.0 },\n\n showFocus: { value: 0 },\n manualdof: { value: 0 },\n vignetting: { value: 0 },\n depthblur: { value: 0 },\n\n threshold: { value: 0.5 },\n gain: { value: 2.0 },\n bias: { value: 0.5 },\n fringe: { value: 0.7 },\n\n znear: { value: 0.1 },\n zfar: { value: 100 },\n\n noise: { value: 1 },\n dithering: { value: 0.0001 },\n pentagon: { value: 0 },\n\n shaderFocus: { value: 1 },\n focusCoords: { value: new Vector2() },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tColor;',\n 'uniform sampler2D tDepth;',\n 'uniform float textureWidth;',\n 'uniform float textureHeight;',\n\n 'uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below',\n 'uniform float focalLength; //focal length in mm',\n 'uniform float fstop; //f-stop value',\n 'uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)',\n\n '/*',\n 'make sure that these two values are the same for your camera, otherwise distances will be wrong.',\n '*/',\n\n 'uniform float znear; // camera clipping start',\n 'uniform float zfar; // camera clipping end',\n\n '//------------------------------------------',\n '//user variables',\n\n 'const int samples = SAMPLES; //samples on the first ring',\n 'const int rings = RINGS; //ring count',\n\n 'const int maxringsamples = rings * samples;',\n\n 'uniform bool manualdof; // manual dof calculation',\n 'float ndofstart = 1.0; // near dof blur start',\n 'float ndofdist = 2.0; // near dof blur falloff distance',\n 'float fdofstart = 1.0; // far dof blur start',\n 'float fdofdist = 3.0; // far dof blur falloff distance',\n\n 'float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)',\n\n 'uniform bool vignetting; // use optical lens vignetting',\n\n 'float vignout = 1.3; // vignetting outer border',\n 'float vignin = 0.0; // vignetting inner border',\n 'float vignfade = 22.0; // f-stops till vignete fades',\n\n 'uniform bool shaderFocus;',\n '// disable if you use external focalDepth value',\n\n 'uniform vec2 focusCoords;',\n '// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)',\n '// if center of screen use vec2(0.5, 0.5);',\n\n 'uniform float maxblur;',\n '//clamp value of max blur (0.0 = no blur, 1.0 default)',\n\n 'uniform float threshold; // highlight threshold;',\n 'uniform float gain; // highlight gain;',\n\n 'uniform float bias; // bokeh edge bias',\n 'uniform float fringe; // bokeh chromatic aberration / fringing',\n\n 'uniform bool noise; //use noise instead of pattern for sample dithering',\n\n 'uniform float dithering;',\n\n 'uniform bool depthblur; // blur the depth buffer',\n 'float dbsize = 1.25; // depth blur size',\n\n '/*',\n 'next part is experimental',\n 'not looking good with small sample and ring count',\n 'looks okay starting from samples = 4, rings = 4',\n '*/',\n\n 'uniform bool pentagon; //use pentagon as bokeh shape?',\n 'float feather = 0.4; //pentagon shape feather',\n\n '//------------------------------------------',\n\n 'float penta(vec2 coords) {',\n '\t//pentagonal shape',\n '\tfloat scale = float(rings) - 1.3;',\n '\tvec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);',\n '\tvec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);',\n '\tvec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);',\n '\tvec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);',\n '\tvec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);',\n '\tvec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);',\n\n '\tvec4 one = vec4( 1.0 );',\n\n '\tvec4 P = vec4((coords),vec2(scale, scale));',\n\n '\tvec4 dist = vec4(0.0);',\n '\tfloat inorout = -4.0;',\n\n '\tdist.x = dot( P, HS0 );',\n '\tdist.y = dot( P, HS1 );',\n '\tdist.z = dot( P, HS2 );',\n '\tdist.w = dot( P, HS3 );',\n\n '\tdist = smoothstep( -feather, feather, dist );',\n\n '\tinorout += dot( dist, one );',\n\n '\tdist.x = dot( P, HS4 );',\n '\tdist.y = HS5.w - abs( P.z );',\n\n '\tdist = smoothstep( -feather, feather, dist );',\n '\tinorout += dist.x;',\n\n '\treturn clamp( inorout, 0.0, 1.0 );',\n '}',\n\n 'float bdepth(vec2 coords) {',\n '\t// Depth buffer blur',\n '\tfloat d = 0.0;',\n '\tfloat kernel[9];',\n '\tvec2 offset[9];',\n\n '\tvec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;',\n\n '\toffset[0] = vec2(-wh.x,-wh.y);',\n '\toffset[1] = vec2( 0.0, -wh.y);',\n '\toffset[2] = vec2( wh.x -wh.y);',\n\n '\toffset[3] = vec2(-wh.x, 0.0);',\n '\toffset[4] = vec2( 0.0, 0.0);',\n '\toffset[5] = vec2( wh.x, 0.0);',\n\n '\toffset[6] = vec2(-wh.x, wh.y);',\n '\toffset[7] = vec2( 0.0, wh.y);',\n '\toffset[8] = vec2( wh.x, wh.y);',\n\n '\tkernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;',\n '\tkernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;',\n '\tkernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;',\n\n '\tfor( int i=0; i<9; i++ ) {',\n '\t\tfloat tmp = texture2D(tDepth, coords + offset[i]).r;',\n '\t\td += tmp * kernel[i];',\n '\t}',\n\n '\treturn d;',\n '}',\n\n 'vec3 color(vec2 coords,float blur) {',\n '\t//processing the sample',\n\n '\tvec3 col = vec3(0.0);',\n '\tvec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);',\n\n '\tcol.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;',\n '\tcol.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;',\n '\tcol.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;',\n\n '\tvec3 lumcoeff = vec3(0.299,0.587,0.114);',\n '\tfloat lum = dot(col.rgb, lumcoeff);',\n '\tfloat thresh = max((lum-threshold)*gain, 0.0);',\n '\treturn col+mix(vec3(0.0),col,thresh*blur);',\n '}',\n\n 'vec3 debugFocus(vec3 col, float blur, float depth) {',\n '\tfloat edge = 0.002*depth; //distance based edge smoothing',\n '\tfloat m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);',\n '\tfloat e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);',\n\n '\tcol = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);',\n '\tcol = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);',\n\n '\treturn col;',\n '}',\n\n 'float linearize(float depth) {',\n '\treturn -zfar * znear / (depth * (zfar - znear) - zfar);',\n '}',\n\n 'float vignette() {',\n '\tfloat dist = distance(vUv.xy, vec2(0.5,0.5));',\n '\tdist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);',\n '\treturn clamp(dist,0.0,1.0);',\n '}',\n\n 'float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {',\n '\tfloat rings2 = float(rings);',\n '\tfloat step = PI*2.0 / float(ringsamples);',\n '\tfloat pw = cos(j*step)*i;',\n '\tfloat ph = sin(j*step)*i;',\n '\tfloat p = 1.0;',\n '\tif (pentagon) {',\n '\t\tp = penta(vec2(pw,ph));',\n '\t}',\n '\tcol += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;',\n '\treturn 1.0 * mix(1.0, i /rings2, bias) * p;',\n '}',\n\n 'void main() {',\n '\t//scene depth calculation',\n\n '\tfloat depth = linearize(texture2D(tDepth,vUv.xy).x);',\n\n '\t// Blur depth?',\n '\tif ( depthblur ) {',\n '\t\tdepth = linearize(bdepth(vUv.xy));',\n '\t}',\n\n '\t//focal plane calculation',\n\n '\tfloat fDepth = focalDepth;',\n\n '\tif (shaderFocus) {',\n\n '\t\tfDepth = linearize(texture2D(tDepth,focusCoords).x);',\n\n '\t}',\n\n '\t// dof blur factor calculation',\n\n '\tfloat blur = 0.0;',\n\n '\tif (manualdof) {',\n '\t\tfloat a = depth-fDepth; // Focal plane',\n '\t\tfloat b = (a-fdofstart)/fdofdist; // Far DoF',\n '\t\tfloat c = (-a-ndofstart)/ndofdist; // Near Dof',\n '\t\tblur = (a>0.0) ? b : c;',\n '\t} else {',\n '\t\tfloat f = focalLength; // focal length in mm',\n '\t\tfloat d = fDepth*1000.0; // focal plane in mm',\n '\t\tfloat o = depth*1000.0; // depth in mm',\n\n '\t\tfloat a = (o*f)/(o-f);',\n '\t\tfloat b = (d*f)/(d-f);',\n '\t\tfloat c = (d-f)/(d*fstop*CoC);',\n\n '\t\tblur = abs(a-b)*c;',\n '\t}',\n\n '\tblur = clamp(blur,0.0,1.0);',\n\n '\t// calculation of pattern for dithering',\n\n '\tvec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;',\n\n '\t// getting blur x and y step factor',\n\n '\tfloat w = (1.0/textureWidth)*blur*maxblur+noise.x;',\n '\tfloat h = (1.0/textureHeight)*blur*maxblur+noise.y;',\n\n '\t// calculation of final color',\n\n '\tvec3 col = vec3(0.0);',\n\n '\tif(blur < 0.05) {',\n '\t\t//some optimization thingy',\n '\t\tcol = texture2D(tColor, vUv.xy).rgb;',\n '\t} else {',\n '\t\tcol = texture2D(tColor, vUv.xy).rgb;',\n '\t\tfloat s = 1.0;',\n '\t\tint ringsamples;',\n\n '\t\tfor (int i = 1; i <= rings; i++) {',\n '\t\t\t/*unboxstart*/',\n '\t\t\tringsamples = i * samples;',\n\n '\t\t\tfor (int j = 0 ; j < maxringsamples ; j++) {',\n '\t\t\t\tif (j >= ringsamples) break;',\n '\t\t\t\ts += gather(float(i), float(j), ringsamples, col, w, h, blur);',\n '\t\t\t}',\n '\t\t\t/*unboxend*/',\n '\t\t}',\n\n '\t\tcol /= s; //divide by sample count',\n '\t}',\n\n '\tif (showFocus) {',\n '\t\tcol = debugFocus(col, blur, depth);',\n '\t}',\n\n '\tif (vignetting) {',\n '\t\tcol *= vignette();',\n '\t}',\n\n '\tgl_FragColor.rgb = col;',\n '\tgl_FragColor.a = 1.0;',\n '} ',\n ].join('\\n'),\n}\n\nexport const BokehDepthShader = {\n uniforms: {\n mNear: { value: 1.0 },\n mFar: { value: 1000.0 },\n },\n\n vertexShader: [\n 'varying float vViewZDepth;',\n\n 'void main() {',\n\n '\t#include ',\n '\t#include ',\n\n '\tvViewZDepth = - mvPosition.z;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float mNear;',\n 'uniform float mFar;',\n\n 'varying float vViewZDepth;',\n\n 'void main() {',\n\n '\tfloat color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );',\n '\tgl_FragColor = vec4( vec3( color ), 1.0 );',\n\n '} ',\n ].join('\\n'),\n}\n", "import { Triangle, Vector3 } from 'three'\n\n/**\n * Utility class for sampling weighted random points on the surface of a mesh.\n *\n * Building the sampler is a one-time O(n) operation. Once built, any number of\n * random samples may be selected in O(logn) time. Memory usage is O(n).\n *\n * References:\n * - http://www.joesfer.com/?p=84\n * - https://stackoverflow.com/a/4322940/1314762\n */\n\nconst _face = new Triangle()\nconst _color = new Vector3()\n\nclass MeshSurfaceSampler {\n constructor(mesh) {\n let geometry = mesh.geometry\n\n if (geometry.index) {\n console.warn('THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry.')\n\n geometry = geometry.toNonIndexed()\n }\n\n this.geometry = geometry\n this.randomFunction = Math.random\n\n this.positionAttribute = this.geometry.getAttribute('position')\n this.colorAttribute = this.geometry.getAttribute('color')\n this.weightAttribute = null\n\n this.distribution = null\n }\n\n setWeightAttribute(name) {\n this.weightAttribute = name ? this.geometry.getAttribute(name) : null\n\n return this\n }\n\n build() {\n const positionAttribute = this.positionAttribute\n const weightAttribute = this.weightAttribute\n\n const faceWeights = new Float32Array(positionAttribute.count / 3)\n\n // Accumulate weights for each mesh face.\n\n for (let i = 0; i < positionAttribute.count; i += 3) {\n let faceWeight = 1\n\n if (weightAttribute) {\n faceWeight = weightAttribute.getX(i) + weightAttribute.getX(i + 1) + weightAttribute.getX(i + 2)\n }\n\n _face.a.fromBufferAttribute(positionAttribute, i)\n _face.b.fromBufferAttribute(positionAttribute, i + 1)\n _face.c.fromBufferAttribute(positionAttribute, i + 2)\n faceWeight *= _face.getArea()\n\n faceWeights[i / 3] = faceWeight\n }\n\n // Store cumulative total face weights in an array, where weight index\n // corresponds to face index.\n\n this.distribution = new Float32Array(positionAttribute.count / 3)\n\n let cumulativeTotal = 0\n\n for (let i = 0; i < faceWeights.length; i++) {\n cumulativeTotal += faceWeights[i]\n\n this.distribution[i] = cumulativeTotal\n }\n\n return this\n }\n\n setRandomGenerator(randomFunction) {\n this.randomFunction = randomFunction\n return this\n }\n\n sample(targetPosition, targetNormal, targetColor) {\n const faceIndex = this.sampleFaceIndex()\n return this.sampleFace(faceIndex, targetPosition, targetNormal, targetColor)\n }\n\n sampleFaceIndex() {\n const cumulativeTotal = this.distribution[this.distribution.length - 1]\n return this.binarySearch(this.randomFunction() * cumulativeTotal)\n }\n\n binarySearch(x) {\n const dist = this.distribution\n let start = 0\n let end = dist.length - 1\n\n let index = -1\n\n while (start <= end) {\n const mid = Math.ceil((start + end) / 2)\n\n if (mid === 0 || (dist[mid - 1] <= x && dist[mid] > x)) {\n index = mid\n\n break\n } else if (x < dist[mid]) {\n end = mid - 1\n } else {\n start = mid + 1\n }\n }\n\n return index\n }\n\n sampleFace(faceIndex, targetPosition, targetNormal, targetColor) {\n let u = this.randomFunction()\n let v = this.randomFunction()\n\n if (u + v > 1) {\n u = 1 - u\n v = 1 - v\n }\n\n _face.a.fromBufferAttribute(this.positionAttribute, faceIndex * 3)\n _face.b.fromBufferAttribute(this.positionAttribute, faceIndex * 3 + 1)\n _face.c.fromBufferAttribute(this.positionAttribute, faceIndex * 3 + 2)\n\n targetPosition\n .set(0, 0, 0)\n .addScaledVector(_face.a, u)\n .addScaledVector(_face.b, v)\n .addScaledVector(_face.c, 1 - (u + v))\n\n if (targetNormal !== undefined) {\n _face.getNormal(targetNormal)\n }\n\n if (targetColor !== undefined && this.colorAttribute !== undefined) {\n _face.a.fromBufferAttribute(this.colorAttribute, faceIndex * 3)\n _face.b.fromBufferAttribute(this.colorAttribute, faceIndex * 3 + 1)\n _face.c.fromBufferAttribute(this.colorAttribute, faceIndex * 3 + 2)\n\n _color\n .set(0, 0, 0)\n .addScaledVector(_face.a, u)\n .addScaledVector(_face.b, v)\n .addScaledVector(_face.c, 1 - (u + v))\n\n targetColor.r = _color.x\n targetColor.g = _color.y\n targetColor.b = _color.z\n }\n\n return this\n }\n}\n\nexport { MeshSurfaceSampler }\n", "import { Box3, MathUtils, Matrix4, Matrix3, Ray, Vector3 } from 'three'\n\n// module scope helper variables\n\nconst a = {\n c: null, // center\n u: [new Vector3(), new Vector3(), new Vector3()], // basis vectors\n e: [], // half width\n}\n\nconst b = {\n c: null, // center\n u: [new Vector3(), new Vector3(), new Vector3()], // basis vectors\n e: [], // half width\n}\n\nconst R = [[], [], []]\nconst AbsR = [[], [], []]\nconst t = []\n\nconst xAxis = new Vector3()\nconst yAxis = new Vector3()\nconst zAxis = new Vector3()\nconst v1 = new Vector3()\nconst size = new Vector3()\nconst closestPoint = new Vector3()\nconst rotationMatrix = new Matrix3()\nconst aabb = new Box3()\nconst matrix = new Matrix4()\nconst inverse = new Matrix4()\nconst localRay = new Ray()\n\n// OBB\n\nclass OBB {\n constructor(center = new Vector3(), halfSize = new Vector3(), rotation = new Matrix3()) {\n this.center = center\n this.halfSize = halfSize\n this.rotation = rotation\n }\n\n set(center, halfSize, rotation) {\n this.center = center\n this.halfSize = halfSize\n this.rotation = rotation\n\n return this\n }\n\n copy(obb) {\n this.center.copy(obb.center)\n this.halfSize.copy(obb.halfSize)\n this.rotation.copy(obb.rotation)\n\n return this\n }\n\n clone() {\n return new this.constructor().copy(this)\n }\n\n getSize(result) {\n return result.copy(this.halfSize).multiplyScalar(2)\n }\n\n /**\n * Reference: Closest Point on OBB to Point in Real-Time Collision Detection\n * by Christer Ericson (chapter 5.1.4)\n */\n clampPoint(point, result) {\n const halfSize = this.halfSize\n\n v1.subVectors(point, this.center)\n this.rotation.extractBasis(xAxis, yAxis, zAxis)\n\n // start at the center position of the OBB\n\n result.copy(this.center)\n\n // project the target onto the OBB axes and walk towards that point\n\n const x = MathUtils.clamp(v1.dot(xAxis), -halfSize.x, halfSize.x)\n result.add(xAxis.multiplyScalar(x))\n\n const y = MathUtils.clamp(v1.dot(yAxis), -halfSize.y, halfSize.y)\n result.add(yAxis.multiplyScalar(y))\n\n const z = MathUtils.clamp(v1.dot(zAxis), -halfSize.z, halfSize.z)\n result.add(zAxis.multiplyScalar(z))\n\n return result\n }\n\n containsPoint(point) {\n v1.subVectors(point, this.center)\n this.rotation.extractBasis(xAxis, yAxis, zAxis)\n\n // project v1 onto each axis and check if these points lie inside the OBB\n\n return (\n Math.abs(v1.dot(xAxis)) <= this.halfSize.x &&\n Math.abs(v1.dot(yAxis)) <= this.halfSize.y &&\n Math.abs(v1.dot(zAxis)) <= this.halfSize.z\n )\n }\n\n intersectsBox3(box3) {\n return this.intersectsOBB(obb.fromBox3(box3))\n }\n\n intersectsSphere(sphere) {\n // find the point on the OBB closest to the sphere center\n\n this.clampPoint(sphere.center, closestPoint)\n\n // if that point is inside the sphere, the OBB and sphere intersect\n\n return closestPoint.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius\n }\n\n /**\n * Reference: OBB-OBB Intersection in Real-Time Collision Detection\n * by Christer Ericson (chapter 4.4.1)\n *\n */\n intersectsOBB(obb, epsilon = Number.EPSILON) {\n // prepare data structures (the code uses the same nomenclature like the reference)\n\n a.c = this.center\n a.e[0] = this.halfSize.x\n a.e[1] = this.halfSize.y\n a.e[2] = this.halfSize.z\n this.rotation.extractBasis(a.u[0], a.u[1], a.u[2])\n\n b.c = obb.center\n b.e[0] = obb.halfSize.x\n b.e[1] = obb.halfSize.y\n b.e[2] = obb.halfSize.z\n obb.rotation.extractBasis(b.u[0], b.u[1], b.u[2])\n\n // compute rotation matrix expressing b in a's coordinate frame\n\n for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 3; j++) {\n R[i][j] = a.u[i].dot(b.u[j])\n }\n }\n\n // compute translation vector\n\n v1.subVectors(b.c, a.c)\n\n // bring translation into a's coordinate frame\n\n t[0] = v1.dot(a.u[0])\n t[1] = v1.dot(a.u[1])\n t[2] = v1.dot(a.u[2])\n\n // compute common subexpressions. Add in an epsilon term to\n // counteract arithmetic errors when two edges are parallel and\n // their cross product is (near) null\n\n for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 3; j++) {\n AbsR[i][j] = Math.abs(R[i][j]) + epsilon\n }\n }\n\n let ra, rb\n\n // test axes L = A0, L = A1, L = A2\n\n for (let i = 0; i < 3; i++) {\n ra = a.e[i]\n rb = b.e[0] * AbsR[i][0] + b.e[1] * AbsR[i][1] + b.e[2] * AbsR[i][2]\n if (Math.abs(t[i]) > ra + rb) return false\n }\n\n // test axes L = B0, L = B1, L = B2\n\n for (let i = 0; i < 3; i++) {\n ra = a.e[0] * AbsR[0][i] + a.e[1] * AbsR[1][i] + a.e[2] * AbsR[2][i]\n rb = b.e[i]\n if (Math.abs(t[0] * R[0][i] + t[1] * R[1][i] + t[2] * R[2][i]) > ra + rb) return false\n }\n\n // test axis L = A0 x B0\n\n ra = a.e[1] * AbsR[2][0] + a.e[2] * AbsR[1][0]\n rb = b.e[1] * AbsR[0][2] + b.e[2] * AbsR[0][1]\n if (Math.abs(t[2] * R[1][0] - t[1] * R[2][0]) > ra + rb) return false\n\n // test axis L = A0 x B1\n\n ra = a.e[1] * AbsR[2][1] + a.e[2] * AbsR[1][1]\n rb = b.e[0] * AbsR[0][2] + b.e[2] * AbsR[0][0]\n if (Math.abs(t[2] * R[1][1] - t[1] * R[2][1]) > ra + rb) return false\n\n // test axis L = A0 x B2\n\n ra = a.e[1] * AbsR[2][2] + a.e[2] * AbsR[1][2]\n rb = b.e[0] * AbsR[0][1] + b.e[1] * AbsR[0][0]\n if (Math.abs(t[2] * R[1][2] - t[1] * R[2][2]) > ra + rb) return false\n\n // test axis L = A1 x B0\n\n ra = a.e[0] * AbsR[2][0] + a.e[2] * AbsR[0][0]\n rb = b.e[1] * AbsR[1][2] + b.e[2] * AbsR[1][1]\n if (Math.abs(t[0] * R[2][0] - t[2] * R[0][0]) > ra + rb) return false\n\n // test axis L = A1 x B1\n\n ra = a.e[0] * AbsR[2][1] + a.e[2] * AbsR[0][1]\n rb = b.e[0] * AbsR[1][2] + b.e[2] * AbsR[1][0]\n if (Math.abs(t[0] * R[2][1] - t[2] * R[0][1]) > ra + rb) return false\n\n // test axis L = A1 x B2\n\n ra = a.e[0] * AbsR[2][2] + a.e[2] * AbsR[0][2]\n rb = b.e[0] * AbsR[1][1] + b.e[1] * AbsR[1][0]\n if (Math.abs(t[0] * R[2][2] - t[2] * R[0][2]) > ra + rb) return false\n\n // test axis L = A2 x B0\n\n ra = a.e[0] * AbsR[1][0] + a.e[1] * AbsR[0][0]\n rb = b.e[1] * AbsR[2][2] + b.e[2] * AbsR[2][1]\n if (Math.abs(t[1] * R[0][0] - t[0] * R[1][0]) > ra + rb) return false\n\n // test axis L = A2 x B1\n\n ra = a.e[0] * AbsR[1][1] + a.e[1] * AbsR[0][1]\n rb = b.e[0] * AbsR[2][2] + b.e[2] * AbsR[2][0]\n if (Math.abs(t[1] * R[0][1] - t[0] * R[1][1]) > ra + rb) return false\n\n // test axis L = A2 x B2\n\n ra = a.e[0] * AbsR[1][2] + a.e[1] * AbsR[0][2]\n rb = b.e[0] * AbsR[2][1] + b.e[1] * AbsR[2][0]\n if (Math.abs(t[1] * R[0][2] - t[0] * R[1][2]) > ra + rb) return false\n\n // since no separating axis is found, the OBBs must be intersecting\n\n return true\n }\n\n /**\n * Reference: Testing Box Against Plane in Real-Time Collision Detection\n * by Christer Ericson (chapter 5.2.3)\n */\n intersectsPlane(plane) {\n this.rotation.extractBasis(xAxis, yAxis, zAxis)\n\n // compute the projection interval radius of this OBB onto L(t) = this->center + t * p.normal;\n\n const r =\n this.halfSize.x * Math.abs(plane.normal.dot(xAxis)) +\n this.halfSize.y * Math.abs(plane.normal.dot(yAxis)) +\n this.halfSize.z * Math.abs(plane.normal.dot(zAxis))\n\n // compute distance of the OBB's center from the plane\n\n const d = plane.normal.dot(this.center) - plane.constant\n\n // Intersection occurs when distance d falls within [-r,+r] interval\n\n return Math.abs(d) <= r\n }\n\n /**\n * Performs a ray/OBB intersection test and stores the intersection point\n * to the given 3D vector. If no intersection is detected, *null* is returned.\n */\n intersectRay(ray, result) {\n // the idea is to perform the intersection test in the local space\n // of the OBB.\n\n this.getSize(size)\n aabb.setFromCenterAndSize(v1.set(0, 0, 0), size)\n\n // create a 4x4 transformation matrix\n\n matrix.setFromMatrix3(this.rotation)\n matrix.setPosition(this.center)\n\n // transform ray to the local space of the OBB\n\n inverse.copy(matrix).invert()\n localRay.copy(ray).applyMatrix4(inverse)\n\n // perform ray <-> AABB intersection test\n\n if (localRay.intersectBox(aabb, result)) {\n // transform the intersection point back to world space\n\n return result.applyMatrix4(matrix)\n } else {\n return null\n }\n }\n\n /**\n * Performs a ray/OBB intersection test. Returns either true or false if\n * there is a intersection or not.\n */\n intersectsRay(ray) {\n return this.intersectRay(ray, v1) !== null\n }\n\n fromBox3(box3) {\n box3.getCenter(this.center)\n\n box3.getSize(this.halfSize).multiplyScalar(0.5)\n\n this.rotation.identity()\n\n return this\n }\n\n equals(obb) {\n return obb.center.equals(this.center) && obb.halfSize.equals(this.halfSize) && obb.rotation.equals(this.rotation)\n }\n\n applyMatrix4(matrix) {\n const e = matrix.elements\n\n let sx = v1.set(e[0], e[1], e[2]).length()\n const sy = v1.set(e[4], e[5], e[6]).length()\n const sz = v1.set(e[8], e[9], e[10]).length()\n\n const det = matrix.determinant()\n if (det < 0) sx = -sx\n\n rotationMatrix.setFromMatrix4(matrix)\n\n const invSX = 1 / sx\n const invSY = 1 / sy\n const invSZ = 1 / sz\n\n rotationMatrix.elements[0] *= invSX\n rotationMatrix.elements[1] *= invSX\n rotationMatrix.elements[2] *= invSX\n\n rotationMatrix.elements[3] *= invSY\n rotationMatrix.elements[4] *= invSY\n rotationMatrix.elements[5] *= invSY\n\n rotationMatrix.elements[6] *= invSZ\n rotationMatrix.elements[7] *= invSZ\n rotationMatrix.elements[8] *= invSZ\n\n this.rotation.multiply(rotationMatrix)\n\n this.halfSize.x *= sx\n this.halfSize.y *= sy\n this.halfSize.z *= sz\n\n v1.setFromMatrixPosition(matrix)\n this.center.add(v1)\n\n return this\n }\n}\n\nconst obb = new OBB()\n\nexport { OBB }\n", "import { Vector3 } from 'three'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\nconst _v3 = new Vector3()\n\nconst EPS = 1e-10\n\nclass Capsule {\n constructor(start = new Vector3(0, 0, 0), end = new Vector3(0, 1, 0), radius = 1) {\n this.start = start\n this.end = end\n this.radius = radius\n }\n\n clone() {\n return new Capsule(this.start.clone(), this.end.clone(), this.radius)\n }\n\n set(start, end, radius) {\n this.start.copy(start)\n this.end.copy(end)\n this.radius = radius\n }\n\n copy(capsule) {\n this.start.copy(capsule.start)\n this.end.copy(capsule.end)\n this.radius = capsule.radius\n }\n\n getCenter(target) {\n return target.copy(this.end).add(this.start).multiplyScalar(0.5)\n }\n\n translate(v) {\n this.start.add(v)\n this.end.add(v)\n }\n\n checkAABBAxis(p1x, p1y, p2x, p2y, minx, maxx, miny, maxy, radius) {\n return (\n (minx - p1x < radius || minx - p2x < radius) &&\n (p1x - maxx < radius || p2x - maxx < radius) &&\n (miny - p1y < radius || miny - p2y < radius) &&\n (p1y - maxy < radius || p2y - maxy < radius)\n )\n }\n\n intersectsBox(box) {\n return (\n this.checkAABBAxis(\n this.start.x,\n this.start.y,\n this.end.x,\n this.end.y,\n box.min.x,\n box.max.x,\n box.min.y,\n box.max.y,\n this.radius,\n ) &&\n this.checkAABBAxis(\n this.start.x,\n this.start.z,\n this.end.x,\n this.end.z,\n box.min.x,\n box.max.x,\n box.min.z,\n box.max.z,\n this.radius,\n ) &&\n this.checkAABBAxis(\n this.start.y,\n this.start.z,\n this.end.y,\n this.end.z,\n box.min.y,\n box.max.y,\n box.min.z,\n box.max.z,\n this.radius,\n )\n )\n }\n\n lineLineMinimumPoints(line1, line2) {\n const r = _v1.copy(line1.end).sub(line1.start)\n const s = _v2.copy(line2.end).sub(line2.start)\n const w = _v3.copy(line2.start).sub(line1.start)\n\n const a = r.dot(s),\n b = r.dot(r),\n c = s.dot(s),\n d = s.dot(w),\n e = r.dot(w)\n\n let t1, t2\n const divisor = b * c - a * a\n\n if (Math.abs(divisor) < EPS) {\n const d1 = -d / c\n const d2 = (a - d) / c\n\n if (Math.abs(d1 - 0.5) < Math.abs(d2 - 0.5)) {\n t1 = 0\n t2 = d1\n } else {\n t1 = 1\n t2 = d2\n }\n } else {\n t1 = (d * a + e * c) / divisor\n t2 = (t1 * a - d) / c\n }\n\n t2 = Math.max(0, Math.min(1, t2))\n t1 = Math.max(0, Math.min(1, t1))\n\n const point1 = r.multiplyScalar(t1).add(line1.start)\n const point2 = s.multiplyScalar(t2).add(line2.start)\n\n return [point1, point2]\n }\n}\n\nexport { Capsule }\n", "// https://cs.nyu.edu/~perlin/noise/\n\nfunction init() {\n // prettier-ignore\n const _p = [ 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10,\n 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87,\n 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211,\n 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208,\n 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5,\n 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119,\n 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232,\n 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249,\n 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205,\n 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180 ];\n\n for (let i = 0; i < 256; i++) {\n _p[256 + i] = _p[i]\n }\n\n return _p\n}\n\nconst _p = init()\n\nfunction fade(t) {\n return t * t * t * (t * (t * 6 - 15) + 10)\n}\n\nfunction lerp(t, a, b) {\n return a + t * (b - a)\n}\n\nfunction grad(hash, x, y, z) {\n const h = hash & 15\n const u = h < 8 ? x : y,\n v = h < 4 ? y : h == 12 || h == 14 ? x : z\n return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v)\n}\n\nclass ImprovedNoise {\n noise(x, y, z) {\n const floorX = Math.floor(x),\n floorY = Math.floor(y),\n floorZ = Math.floor(z)\n\n const X = floorX & 255,\n Y = floorY & 255,\n Z = floorZ & 255\n\n x -= floorX\n y -= floorY\n z -= floorZ\n\n const xMinus1 = x - 1,\n yMinus1 = y - 1,\n zMinus1 = z - 1\n\n const u = fade(x),\n v = fade(y),\n w = fade(z)\n\n const A = _p[X] + Y,\n AA = _p[A] + Z,\n AB = _p[A + 1] + Z,\n B = _p[X + 1] + Y,\n BA = _p[B] + Z,\n BB = _p[B + 1] + Z\n\n return lerp(\n w,\n lerp(\n v,\n lerp(u, grad(_p[AA], x, y, z), grad(_p[BA], xMinus1, y, z)),\n lerp(u, grad(_p[AB], x, yMinus1, z), grad(_p[BB], xMinus1, yMinus1, z)),\n ),\n lerp(\n v,\n lerp(u, grad(_p[AA + 1], x, y, zMinus1), grad(_p[BA + 1], xMinus1, y, zMinus1)),\n lerp(u, grad(_p[AB + 1], x, yMinus1, zMinus1), grad(_p[BB + 1], xMinus1, yMinus1, zMinus1)),\n ),\n )\n }\n}\n\nexport { ImprovedNoise }\n", "import { Box3, Line3, Plane, Sphere, Triangle, Vector3 } from 'three'\nimport { Capsule } from '../math/Capsule'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\nconst _plane = new Plane()\nconst _line1 = new Line3()\nconst _line2 = new Line3()\nconst _sphere = new Sphere()\nconst _capsule = new Capsule()\n\nclass Octree {\n constructor(box) {\n this.triangles = []\n this.box = box\n this.subTrees = []\n }\n\n addTriangle(triangle) {\n if (!this.bounds) this.bounds = new Box3()\n\n this.bounds.min.x = Math.min(this.bounds.min.x, triangle.a.x, triangle.b.x, triangle.c.x)\n this.bounds.min.y = Math.min(this.bounds.min.y, triangle.a.y, triangle.b.y, triangle.c.y)\n this.bounds.min.z = Math.min(this.bounds.min.z, triangle.a.z, triangle.b.z, triangle.c.z)\n this.bounds.max.x = Math.max(this.bounds.max.x, triangle.a.x, triangle.b.x, triangle.c.x)\n this.bounds.max.y = Math.max(this.bounds.max.y, triangle.a.y, triangle.b.y, triangle.c.y)\n this.bounds.max.z = Math.max(this.bounds.max.z, triangle.a.z, triangle.b.z, triangle.c.z)\n\n this.triangles.push(triangle)\n\n return this\n }\n\n calcBox() {\n this.box = this.bounds.clone()\n\n // offset small amount to account for regular grid\n this.box.min.x -= 0.01\n this.box.min.y -= 0.01\n this.box.min.z -= 0.01\n\n return this\n }\n\n split(level) {\n if (!this.box) return\n\n const subTrees = []\n const halfsize = _v2.copy(this.box.max).sub(this.box.min).multiplyScalar(0.5)\n\n for (let x = 0; x < 2; x++) {\n for (let y = 0; y < 2; y++) {\n for (let z = 0; z < 2; z++) {\n const box = new Box3()\n const v = _v1.set(x, y, z)\n\n box.min.copy(this.box.min).add(v.multiply(halfsize))\n box.max.copy(box.min).add(halfsize)\n\n subTrees.push(new Octree(box))\n }\n }\n }\n\n let triangle\n\n while ((triangle = this.triangles.pop())) {\n for (let i = 0; i < subTrees.length; i++) {\n if (subTrees[i].box.intersectsTriangle(triangle)) {\n subTrees[i].triangles.push(triangle)\n }\n }\n }\n\n for (let i = 0; i < subTrees.length; i++) {\n const len = subTrees[i].triangles.length\n\n if (len > 8 && level < 16) {\n subTrees[i].split(level + 1)\n }\n\n if (len !== 0) {\n this.subTrees.push(subTrees[i])\n }\n }\n\n return this\n }\n\n build() {\n this.calcBox()\n this.split(0)\n\n return this\n }\n\n getRayTriangles(ray, triangles) {\n for (let i = 0; i < this.subTrees.length; i++) {\n const subTree = this.subTrees[i]\n if (!ray.intersectsBox(subTree.box)) continue\n\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1) triangles.push(subTree.triangles[j])\n }\n } else {\n subTree.getRayTriangles(ray, triangles)\n }\n }\n\n return triangles\n }\n\n triangleCapsuleIntersect(capsule, triangle) {\n triangle.getPlane(_plane)\n\n const d1 = _plane.distanceToPoint(capsule.start) - capsule.radius\n const d2 = _plane.distanceToPoint(capsule.end) - capsule.radius\n\n if ((d1 > 0 && d2 > 0) || (d1 < -capsule.radius && d2 < -capsule.radius)) {\n return false\n }\n\n const delta = Math.abs(d1 / (Math.abs(d1) + Math.abs(d2)))\n const intersectPoint = _v1.copy(capsule.start).lerp(capsule.end, delta)\n\n if (triangle.containsPoint(intersectPoint)) {\n return { normal: _plane.normal.clone(), point: intersectPoint.clone(), depth: Math.abs(Math.min(d1, d2)) }\n }\n\n const r2 = capsule.radius * capsule.radius\n\n const line1 = _line1.set(capsule.start, capsule.end)\n\n const lines = [\n [triangle.a, triangle.b],\n [triangle.b, triangle.c],\n [triangle.c, triangle.a],\n ]\n\n for (let i = 0; i < lines.length; i++) {\n const line2 = _line2.set(lines[i][0], lines[i][1])\n\n const [point1, point2] = capsule.lineLineMinimumPoints(line1, line2)\n\n if (point1.distanceToSquared(point2) < r2) {\n return {\n normal: point1.clone().sub(point2).normalize(),\n point: point2.clone(),\n depth: capsule.radius - point1.distanceTo(point2),\n }\n }\n }\n\n return false\n }\n\n triangleSphereIntersect(sphere, triangle) {\n triangle.getPlane(_plane)\n\n if (!sphere.intersectsPlane(_plane)) return false\n\n const depth = Math.abs(_plane.distanceToSphere(sphere))\n const r2 = sphere.radius * sphere.radius - depth * depth\n\n const plainPoint = _plane.projectPoint(sphere.center, _v1)\n\n if (triangle.containsPoint(sphere.center)) {\n return {\n normal: _plane.normal.clone(),\n point: plainPoint.clone(),\n depth: Math.abs(_plane.distanceToSphere(sphere)),\n }\n }\n\n const lines = [\n [triangle.a, triangle.b],\n [triangle.b, triangle.c],\n [triangle.c, triangle.a],\n ]\n\n for (let i = 0; i < lines.length; i++) {\n _line1.set(lines[i][0], lines[i][1])\n _line1.closestPointToPoint(plainPoint, true, _v2)\n\n const d = _v2.distanceToSquared(sphere.center)\n\n if (d < r2) {\n return {\n normal: sphere.center.clone().sub(_v2).normalize(),\n point: _v2.clone(),\n depth: sphere.radius - Math.sqrt(d),\n }\n }\n }\n\n return false\n }\n\n getSphereTriangles(sphere, triangles) {\n for (let i = 0; i < this.subTrees.length; i++) {\n const subTree = this.subTrees[i]\n\n if (!sphere.intersectsBox(subTree.box)) continue\n\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1) triangles.push(subTree.triangles[j])\n }\n } else {\n subTree.getSphereTriangles(sphere, triangles)\n }\n }\n }\n\n getCapsuleTriangles(capsule, triangles) {\n for (let i = 0; i < this.subTrees.length; i++) {\n const subTree = this.subTrees[i]\n\n if (!capsule.intersectsBox(subTree.box)) continue\n\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1) triangles.push(subTree.triangles[j])\n }\n } else {\n subTree.getCapsuleTriangles(capsule, triangles)\n }\n }\n }\n\n sphereIntersect(sphere) {\n _sphere.copy(sphere)\n\n const triangles = []\n let result,\n hit = false\n\n this.getSphereTriangles(sphere, triangles)\n\n for (let i = 0; i < triangles.length; i++) {\n if ((result = this.triangleSphereIntersect(_sphere, triangles[i]))) {\n hit = true\n\n _sphere.center.add(result.normal.multiplyScalar(result.depth))\n }\n }\n\n if (hit) {\n const collisionVector = _sphere.center.clone().sub(sphere.center)\n const depth = collisionVector.length()\n\n return { normal: collisionVector.normalize(), depth: depth }\n }\n\n return false\n }\n\n capsuleIntersect(capsule) {\n _capsule.copy(capsule)\n\n const triangles = []\n let result,\n hit = false\n\n this.getCapsuleTriangles(_capsule, triangles)\n\n for (let i = 0; i < triangles.length; i++) {\n if ((result = this.triangleCapsuleIntersect(_capsule, triangles[i]))) {\n hit = true\n\n _capsule.translate(result.normal.multiplyScalar(result.depth))\n }\n }\n\n if (hit) {\n const collisionVector = _capsule.getCenter(new Vector3()).sub(capsule.getCenter(_v1))\n const depth = collisionVector.length()\n\n return { normal: collisionVector.normalize(), depth: depth }\n }\n\n return false\n }\n\n rayIntersect(ray) {\n if (ray.direction.length() === 0) return\n\n const triangles = []\n let triangle,\n position,\n distance = 1e100\n\n this.getRayTriangles(ray, triangles)\n\n for (let i = 0; i < triangles.length; i++) {\n const result = ray.intersectTriangle(triangles[i].a, triangles[i].b, triangles[i].c, true, _v1)\n\n if (result) {\n const newdistance = result.sub(ray.origin).length()\n\n if (distance > newdistance) {\n position = result.clone().add(ray.origin)\n distance = newdistance\n triangle = triangles[i]\n }\n }\n }\n\n return distance < 1e100 ? { distance: distance, triangle: triangle, position: position } : false\n }\n\n fromGraphNode(group) {\n group.updateWorldMatrix(true, true)\n\n group.traverse((obj) => {\n if (obj.isMesh === true) {\n let geometry,\n isTemp = false\n\n if (obj.geometry.index !== null) {\n isTemp = true\n geometry = obj.geometry.toNonIndexed()\n } else {\n geometry = obj.geometry\n }\n\n const positionAttribute = geometry.getAttribute('position')\n\n for (let i = 0; i < positionAttribute.count; i += 3) {\n const v1 = new Vector3().fromBufferAttribute(positionAttribute, i)\n const v2 = new Vector3().fromBufferAttribute(positionAttribute, i + 1)\n const v3 = new Vector3().fromBufferAttribute(positionAttribute, i + 2)\n\n v1.applyMatrix4(obj.matrixWorld)\n v2.applyMatrix4(obj.matrixWorld)\n v3.applyMatrix4(obj.matrixWorld)\n\n this.addTriangle(new Triangle(v1, v2, v3))\n }\n\n if (isTemp) {\n geometry.dispose()\n }\n }\n })\n\n this.build()\n\n return this\n }\n}\n\nexport { Octree }\n", "import { MathUtils, Spherical, Vector3, EventDispatcher, Camera } from 'three'\n\nconst targetPosition = new Vector3()\n\nexport class FirstPersonControls extends EventDispatcher {\n public object: Camera\n public domElement?: HTMLElement | null\n\n public enabled = true\n\n public movementSpeed = 1.0\n public lookSpeed = 0.005\n\n public lookVertical = true\n public autoForward = false\n\n public activeLook = true\n\n public heightSpeed = false\n public heightCoef = 1.0\n public heightMin = 0.0\n public heightMax = 1.0\n\n public constrainVertical = false\n public verticalMin = 0\n public verticalMax = Math.PI\n\n public mouseDragOn = false\n\n // internals\n\n private autoSpeedFactor = 0.0\n\n private mouseX = 0\n private mouseY = 0\n\n private moveForward = false\n private moveBackward = false\n private moveLeft = false\n private moveRight = false\n private moveUp = false\n private moveDown = false\n\n private viewHalfX = 0\n private viewHalfY = 0\n\n private lat = 0\n private lon = 0\n\n private lookDirection = new Vector3()\n private spherical = new Spherical()\n private target = new Vector3()\n\n constructor(object: Camera, domElement?: HTMLElement | null) {\n super()\n\n this.object = object\n this.domElement = domElement\n\n this.setOrientation()\n\n if (domElement) this.connect(domElement)\n }\n\n public connect = (domElement: HTMLElement): void => {\n domElement.setAttribute('tabindex', '-1')\n\n domElement.style.touchAction = 'none'\n\n domElement.addEventListener('contextmenu', this.contextmenu)\n domElement.addEventListener('mousemove', this.onMouseMove)\n domElement.addEventListener('mousedown', this.onMouseDown)\n domElement.addEventListener('mouseup', this.onMouseUp)\n\n this.domElement = domElement\n\n window.addEventListener('keydown', this.onKeyDown)\n window.addEventListener('keyup', this.onKeyUp)\n\n this.handleResize()\n }\n\n public dispose = (): void => {\n this.domElement?.removeEventListener('contextmenu', this.contextmenu)\n this.domElement?.removeEventListener('mousedown', this.onMouseDown)\n this.domElement?.removeEventListener('mousemove', this.onMouseMove)\n this.domElement?.removeEventListener('mouseup', this.onMouseUp)\n\n window.removeEventListener('keydown', this.onKeyDown)\n window.removeEventListener('keyup', this.onKeyUp)\n }\n\n public handleResize = (): void => {\n if (this.domElement) {\n this.viewHalfX = this.domElement.offsetWidth / 2\n this.viewHalfY = this.domElement.offsetHeight / 2\n }\n }\n\n private onMouseDown = (event: MouseEvent): void => {\n this.domElement?.focus()\n\n if (this.activeLook) {\n switch (event.button) {\n case 0:\n this.moveForward = true\n break\n case 2:\n this.moveBackward = true\n break\n }\n }\n\n this.mouseDragOn = true\n }\n\n private onMouseUp = (event: MouseEvent): void => {\n if (this.activeLook) {\n switch (event.button) {\n case 0:\n this.moveForward = false\n break\n case 2:\n this.moveBackward = false\n break\n }\n }\n\n this.mouseDragOn = false\n }\n\n private onMouseMove = (event: MouseEvent): void => {\n if (this.domElement) {\n this.mouseX = event.pageX - this.domElement.offsetLeft - this.viewHalfX\n this.mouseY = event.pageY - this.domElement.offsetTop - this.viewHalfY\n }\n }\n\n private onKeyDown = (event: KeyboardEvent): void => {\n switch (event.code) {\n case 'ArrowUp':\n case 'KeyW':\n this.moveForward = true\n break\n\n case 'ArrowLeft':\n case 'KeyA':\n this.moveLeft = true\n break\n\n case 'ArrowDown':\n case 'KeyS':\n this.moveBackward = true\n break\n\n case 'ArrowRight':\n case 'KeyD':\n this.moveRight = true\n break\n\n case 'KeyR':\n this.moveUp = true\n break\n case 'KeyF':\n this.moveDown = true\n break\n }\n }\n\n private onKeyUp = (event: KeyboardEvent): void => {\n switch (event.code) {\n case 'ArrowUp':\n case 'KeyW':\n this.moveForward = false\n break\n\n case 'ArrowLeft':\n case 'KeyA':\n this.moveLeft = false\n break\n\n case 'ArrowDown':\n case 'KeyS':\n this.moveBackward = false\n break\n\n case 'ArrowRight':\n case 'KeyD':\n this.moveRight = false\n break\n\n case 'KeyR':\n this.moveUp = false\n break\n case 'KeyF':\n this.moveDown = false\n break\n }\n }\n\n public lookAt = (x: Vector3 | number, y?: number, z?: number): this => {\n if (x instanceof Vector3) {\n this.target.copy(x)\n } else if (y && z) {\n this.target.set(x, y, z)\n }\n\n this.object.lookAt(this.target)\n\n this.setOrientation()\n\n return this\n }\n\n public update = (delta: number): void => {\n if (!this.enabled) return\n\n if (this.heightSpeed) {\n const y = MathUtils.clamp(this.object.position.y, this.heightMin, this.heightMax)\n const heightDelta = y - this.heightMin\n\n this.autoSpeedFactor = delta * (heightDelta * this.heightCoef)\n } else {\n this.autoSpeedFactor = 0.0\n }\n\n const actualMoveSpeed = delta * this.movementSpeed\n\n if (this.moveForward || (this.autoForward && !this.moveBackward)) {\n this.object.translateZ(-(actualMoveSpeed + this.autoSpeedFactor))\n }\n if (this.moveBackward) this.object.translateZ(actualMoveSpeed)\n\n if (this.moveLeft) this.object.translateX(-actualMoveSpeed)\n if (this.moveRight) this.object.translateX(actualMoveSpeed)\n\n if (this.moveUp) this.object.translateY(actualMoveSpeed)\n if (this.moveDown) this.object.translateY(-actualMoveSpeed)\n\n let actualLookSpeed = delta * this.lookSpeed\n\n if (!this.activeLook) {\n actualLookSpeed = 0\n }\n\n let verticalLookRatio = 1\n\n if (this.constrainVertical) {\n verticalLookRatio = Math.PI / (this.verticalMax - this.verticalMin)\n }\n\n this.lon -= this.mouseX * actualLookSpeed\n if (this.lookVertical) this.lat -= this.mouseY * actualLookSpeed * verticalLookRatio\n\n this.lat = Math.max(-85, Math.min(85, this.lat))\n\n let phi = MathUtils.degToRad(90 - this.lat)\n const theta = MathUtils.degToRad(this.lon)\n\n if (this.constrainVertical) {\n phi = MathUtils.mapLinear(phi, 0, Math.PI, this.verticalMin, this.verticalMax)\n }\n\n const position = this.object.position\n\n targetPosition.setFromSphericalCoords(1, phi, theta).add(position)\n\n this.object.lookAt(targetPosition)\n }\n\n private contextmenu = (event: Event): void => event.preventDefault()\n\n private setOrientation = (): void => {\n this.lookDirection.set(0, 0, -1).applyQuaternion(this.object.quaternion)\n this.spherical.setFromVector3(this.lookDirection)\n this.lat = 90 - MathUtils.radToDeg(this.spherical.phi)\n this.lon = MathUtils.radToDeg(this.spherical.theta)\n }\n}\n", "import { Euler, Camera, EventDispatcher, Vector3 } from 'three'\n\nconst _euler = new Euler(0, 0, 0, 'YXZ')\nconst _vector = new Vector3()\nconst _changeEvent = { type: 'change' }\nconst _lockEvent = { type: 'lock' }\nconst _unlockEvent = { type: 'unlock' }\nconst _PI_2 = Math.PI / 2\n\nclass PointerLockControls extends EventDispatcher {\n public camera: Camera\n public domElement?: HTMLElement\n public isLocked: boolean\n public minPolarAngle: number\n public maxPolarAngle: number\n public pointerSpeed: number\n\n constructor(camera: Camera, domElement?: HTMLElement) {\n super()\n\n this.camera = camera\n this.domElement = domElement\n this.isLocked = false\n\n // Set to constrain the pitch of the camera\n // Range is 0 to Math.PI radians\n this.minPolarAngle = 0 // radians\n this.maxPolarAngle = Math.PI // radians\n\n this.pointerSpeed = 1.0\n if (domElement) this.connect(domElement)\n }\n\n private onMouseMove = (event: MouseEvent): void => {\n if (!this.domElement || this.isLocked === false) return\n const movementX = event.movementX || (event as any).mozMovementX || (event as any).webkitMovementX || 0\n const movementY = event.movementY || (event as any).mozMovementY || (event as any).webkitMovementY || 0\n _euler.setFromQuaternion(this.camera.quaternion)\n _euler.y -= movementX * 0.002 * this.pointerSpeed\n _euler.x -= movementY * 0.002 * this.pointerSpeed\n _euler.x = Math.max(_PI_2 - this.maxPolarAngle, Math.min(_PI_2 - this.minPolarAngle, _euler.x))\n this.camera.quaternion.setFromEuler(_euler)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n private onPointerlockChange = (): void => {\n if (!this.domElement) return\n if (this.domElement.ownerDocument.pointerLockElement === this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_lockEvent)\n this.isLocked = true\n } else {\n // @ts-ignore\n this.dispatchEvent(_unlockEvent)\n this.isLocked = false\n }\n }\n\n private onPointerlockError = (): void => {\n console.error('THREE.PointerLockControls: Unable to use Pointer Lock API')\n }\n\n public connect = (domElement: HTMLElement): void => {\n this.domElement = domElement || this.domElement\n if (!this.domElement) return\n this.domElement.ownerDocument.addEventListener('mousemove', this.onMouseMove)\n this.domElement.ownerDocument.addEventListener('pointerlockchange', this.onPointerlockChange)\n this.domElement.ownerDocument.addEventListener('pointerlockerror', this.onPointerlockError)\n }\n\n public disconnect = (): void => {\n if (!this.domElement) return\n this.domElement.ownerDocument.removeEventListener('mousemove', this.onMouseMove)\n this.domElement.ownerDocument.removeEventListener('pointerlockchange', this.onPointerlockChange)\n this.domElement.ownerDocument.removeEventListener('pointerlockerror', this.onPointerlockError)\n }\n\n public dispose = (): void => {\n this.disconnect()\n }\n\n public getObject = (): Camera => {\n // retaining this method for backward compatibility\n return this.camera\n }\n\n private direction = new Vector3(0, 0, -1)\n public getDirection = (v: Vector3): Vector3 => {\n return v.copy(this.direction).applyQuaternion(this.camera.quaternion)\n }\n\n public moveForward = (distance: number): void => {\n // move forward parallel to the xz-plane\n // assumes camera.up is y-up\n _vector.setFromMatrixColumn(this.camera.matrix, 0)\n _vector.crossVectors(this.camera.up, _vector)\n this.camera.position.addScaledVector(_vector, distance)\n }\n\n public moveRight = (distance: number): void => {\n _vector.setFromMatrixColumn(this.camera.matrix, 0)\n this.camera.position.addScaledVector(_vector, distance)\n }\n\n public lock = (): void => {\n if (this.domElement) this.domElement.requestPointerLock()\n }\n\n public unlock = (): void => {\n if (this.domElement) this.domElement.ownerDocument.exitPointerLock()\n }\n}\n\nexport { PointerLockControls }\n", "import {\n EventDispatcher,\n Matrix4,\n MOUSE,\n OrthographicCamera,\n PerspectiveCamera,\n Quaternion,\n Spherical,\n TOUCH,\n Vector2,\n Vector3,\n Ray,\n Plane,\n} from 'three'\n\nconst _ray = new Ray()\nconst _plane = new Plane()\nconst TILT_LIMIT = Math.cos(70 * (Math.PI / 180))\n\n// This set of controls 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 moduloWrapAround = (offset: number, capacity: number) => ((offset % capacity) + capacity) % capacity\n\nclass OrbitControls extends EventDispatcher {\n object: PerspectiveCamera | OrthographicCamera\n domElement: HTMLElement | undefined\n // Set to false to disable this control\n enabled = true\n // \"target\" sets the location of focus, where the object orbits around\n target = new Vector3()\n // How far you can dolly in and out ( PerspectiveCamera only )\n minDistance = 0\n maxDistance = Infinity\n // How far you can zoom in and out ( OrthographicCamera only )\n minZoom = 0\n maxZoom = Infinity\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n minPolarAngle = 0 // radians\n 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 minAzimuthAngle = -Infinity // radians\n 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 enableDamping = false\n 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 enableZoom = true\n zoomSpeed = 1.0\n // Set to false to disable rotating\n enableRotate = true\n rotateSpeed = 1.0\n // Set to false to disable panning\n enablePan = true\n panSpeed = 1.0\n screenSpacePanning = true // if false, pan orthogonal to world-space direction camera.up\n keyPanSpeed = 7.0 // pixels moved per arrow key push\n 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 autoRotate = false\n autoRotateSpeed = 2.0 // 30 seconds per orbit when fps is 60\n reverseOrbit = false // true if you want to reverse the orbit to mouse drag from left to right = orbits left\n reverseHorizontalOrbit = false // true if you want to reverse the horizontal orbit direction\n reverseVerticalOrbit = false // true if you want to reverse the vertical orbit direction\n // The four arrow keys\n keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' }\n // Mouse buttons\n mouseButtons: Partial<{\n LEFT: MOUSE\n MIDDLE: MOUSE\n RIGHT: MOUSE\n }> = {\n LEFT: MOUSE.ROTATE,\n MIDDLE: MOUSE.DOLLY,\n RIGHT: MOUSE.PAN,\n }\n // Touch fingers\n touches: Partial<{\n ONE: TOUCH\n TWO: TOUCH\n }> = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }\n target0: Vector3\n position0: Vector3\n zoom0: number\n // the target DOM element for key events\n _domElementKeyEvents: any = null\n\n getPolarAngle: () => number\n getAzimuthalAngle: () => number\n setPolarAngle: (x: number) => void\n setAzimuthalAngle: (x: number) => void\n getDistance: () => number\n\n listenToKeyEvents: (domElement: HTMLElement) => void\n stopListenToKeyEvents: () => void\n saveState: () => void\n reset: () => void\n update: () => void\n connect: (domElement: HTMLElement) => void\n dispose: () => void\n\n constructor(object: PerspectiveCamera | OrthographicCamera, domElement?: HTMLElement) {\n super()\n\n this.object = object\n this.domElement = domElement\n\n // for reset\n this.target0 = this.target.clone()\n this.position0 = this.object.position.clone()\n this.zoom0 = this.object.zoom\n\n //\n // public methods\n //\n\n this.getPolarAngle = (): number => spherical.phi\n\n this.getAzimuthalAngle = (): number => spherical.theta\n\n this.setPolarAngle = (value: number): void => {\n // use modulo wrapping to safeguard value\n let phi = moduloWrapAround(value, 2 * Math.PI)\n let currentPhi = spherical.phi\n\n // convert to the equivalent shortest angle\n if (currentPhi < 0) currentPhi += 2 * Math.PI\n if (phi < 0) phi += 2 * Math.PI\n let phiDist = Math.abs(phi - currentPhi)\n if (2 * Math.PI - phiDist < phiDist) {\n if (phi < currentPhi) {\n phi += 2 * Math.PI\n } else {\n currentPhi += 2 * Math.PI\n }\n }\n sphericalDelta.phi = phi - currentPhi\n scope.update()\n }\n\n this.setAzimuthalAngle = (value: number): void => {\n // use modulo wrapping to safeguard value\n let theta = moduloWrapAround(value, 2 * Math.PI)\n let currentTheta = spherical.theta\n\n // convert to the equivalent shortest angle\n if (currentTheta < 0) currentTheta += 2 * Math.PI\n if (theta < 0) theta += 2 * Math.PI\n let thetaDist = Math.abs(theta - currentTheta)\n if (2 * Math.PI - thetaDist < thetaDist) {\n if (theta < currentTheta) {\n theta += 2 * Math.PI\n } else {\n currentTheta += 2 * Math.PI\n }\n }\n sphericalDelta.theta = theta - currentTheta\n scope.update()\n }\n\n this.getDistance = (): number => scope.object.position.distanceTo(scope.target)\n\n this.listenToKeyEvents = (domElement: HTMLElement): void => {\n domElement.addEventListener('keydown', onKeyDown)\n this._domElementKeyEvents = domElement\n }\n\n this.stopListenToKeyEvents = (): void => {\n this._domElementKeyEvents.removeEventListener('keydown', onKeyDown)\n this._domElementKeyEvents = null\n }\n\n this.saveState = (): void => {\n scope.target0.copy(scope.target)\n scope.position0.copy(scope.object.position)\n scope.zoom0 = scope.object.zoom\n }\n\n this.reset = (): void => {\n scope.target.copy(scope.target0)\n scope.object.position.copy(scope.position0)\n scope.object.zoom = scope.zoom0\n scope.object.updateProjectionMatrix()\n\n // @ts-ignore\n scope.dispatchEvent(changeEvent)\n\n scope.update()\n\n state = STATE.NONE\n }\n\n // this method is exposed, but perhaps it would be better if we can make it private...\n this.update = ((): (() => void) => {\n const offset = new Vector3()\n const up = new Vector3(0, 1, 0)\n\n // so camera.up is the orbit axis\n const quat = new Quaternion().setFromUnitVectors(object.up, up)\n const quatInverse = quat.clone().invert()\n\n const lastPosition = new Vector3()\n const lastQuaternion = new Quaternion()\n\n const twoPI = 2 * Math.PI\n\n return function update(): boolean {\n const position = scope.object.position\n\n // update new up direction\n quat.setFromUnitVectors(object.up, up)\n quatInverse.copy(quat).invert()\n\n offset.copy(position).sub(scope.target)\n\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion(quat)\n\n // angle from z-axis around y-axis\n spherical.setFromVector3(offset)\n\n if (scope.autoRotate && state === STATE.NONE) {\n rotateLeft(getAutoRotationAngle())\n }\n\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\n // restrict theta to be between desired limits\n\n let min = scope.minAzimuthAngle\n let max = scope.maxAzimuthAngle\n\n if (isFinite(min) && isFinite(max)) {\n if (min < -Math.PI) min += twoPI\n else if (min > Math.PI) min -= twoPI\n\n if (max < -Math.PI) max += twoPI\n else if (max > Math.PI) max -= twoPI\n\n if (min <= max) {\n spherical.theta = Math.max(min, Math.min(max, spherical.theta))\n } else {\n spherical.theta =\n spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta)\n }\n }\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\n // move target to panned location\n\n if (scope.enableDamping === true) {\n scope.target.addScaledVector(panOffset, scope.dampingFactor)\n } else {\n scope.target.add(panOffset)\n }\n\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 as OrthographicCamera).isOrthographicCamera) {\n spherical.radius = clampDistance(spherical.radius)\n } else {\n spherical.radius = clampDistance(spherical.radius * scale)\n }\n\n offset.setFromSpherical(spherical)\n\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion(quatInverse)\n\n position.copy(scope.target).add(offset)\n\n if (!scope.object.matrixAutoUpdate) scope.object.updateMatrix()\n scope.object.lookAt(scope.target)\n\n if (scope.enableDamping === true) {\n sphericalDelta.theta *= 1 - scope.dampingFactor\n sphericalDelta.phi *= 1 - scope.dampingFactor\n\n panOffset.multiplyScalar(1 - scope.dampingFactor)\n } else {\n sphericalDelta.set(0, 0, 0)\n\n panOffset.set(0, 0, 0)\n }\n\n // adjust camera position\n let zoomChanged = false\n if (scope.zoomToCursor && performCursorZoom) {\n let newRadius = null\n if (scope.object instanceof PerspectiveCamera && 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\n const radiusDelta = prevRadius - newRadius\n scope.object.position.addScaledVector(dollyDirection, radiusDelta)\n scope.object.updateMatrixWorld()\n } else if ((scope.object as OrthographicCamera).isOrthographicCamera) {\n // adjust the ortho camera position based on zoom changes\n const mouseBefore = new Vector3(mouse.x, mouse.y, 0)\n mouseBefore.unproject(scope.object)\n\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 const mouseAfter = new Vector3(mouse.x, mouse.y, 0)\n mouseAfter.unproject(scope.object)\n\n scope.object.position.sub(mouseAfter).add(mouseBefore)\n scope.object.updateMatrixWorld()\n\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\n // handle the placement of the target\n if (newRadius !== null) {\n if (scope.screenSpacePanning) {\n // position the orbit target in front of the new camera position\n scope.target\n .set(0, 0, -1)\n .transformDirection(scope.object.matrix)\n .multiplyScalar(newRadius)\n .add(scope.object.position)\n } else {\n // get the ray and translation plane to compute target\n _ray.origin.copy(scope.object.position)\n _ray.direction.set(0, 0, -1).transformDirection(scope.object.matrix)\n\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(_ray.direction)) < TILT_LIMIT) {\n object.lookAt(scope.target)\n } else {\n _plane.setFromNormalAndCoplanarPoint(scope.object.up, scope.target)\n _ray.intersectPlane(_plane, scope.target)\n }\n }\n }\n } else if (scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera) {\n zoomChanged = scale !== 1\n\n if (zoomChanged) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / scale))\n scope.object.updateProjectionMatrix()\n }\n }\n\n scale = 1\n performCursorZoom = false\n\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\n if (\n zoomChanged ||\n lastPosition.distanceToSquared(scope.object.position) > EPS ||\n 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS\n ) {\n // @ts-ignore\n scope.dispatchEvent(changeEvent)\n\n lastPosition.copy(scope.object.position)\n lastQuaternion.copy(scope.object.quaternion)\n zoomChanged = false\n\n return true\n }\n\n return false\n }\n })()\n\n // https://github.com/mrdoob/three.js/issues/20575\n this.connect = (domElement: HTMLElement): void => {\n if ((domElement as any) === document) {\n console.error(\n 'THREE.OrbitControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.',\n )\n }\n scope.domElement = domElement\n // disables touch scroll\n // touch-action needs to be defined for pointer events to work on mobile\n // https://stackoverflow.com/a/48254578\n scope.domElement.style.touchAction = 'none'\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 }\n\n this.dispose = (): void => {\n // Enabling touch scroll\n if (scope.domElement) {\n scope.domElement.style.touchAction = 'auto'\n }\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?.ownerDocument.removeEventListener('pointermove', onPointerMove)\n scope.domElement?.ownerDocument.removeEventListener('pointerup', onPointerUp)\n if (scope._domElementKeyEvents !== null) {\n scope._domElementKeyEvents.removeEventListener('keydown', onKeyDown)\n }\n //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n }\n\n //\n // internals\n //\n\n const scope = this\n\n const changeEvent = { type: 'change' }\n const startEvent = { type: 'start' }\n const endEvent = { type: 'end' }\n\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\n let state = STATE.NONE\n\n const EPS = 0.000001\n\n // current position in spherical coordinates\n const spherical = new Spherical()\n const sphericalDelta = new Spherical()\n\n let scale = 1\n const panOffset = new Vector3()\n\n const rotateStart = new Vector2()\n const rotateEnd = new Vector2()\n const rotateDelta = new Vector2()\n\n const panStart = new Vector2()\n const panEnd = new Vector2()\n const panDelta = new Vector2()\n\n const dollyStart = new Vector2()\n const dollyEnd = new Vector2()\n const dollyDelta = new Vector2()\n\n const dollyDirection = new Vector3()\n const mouse = new Vector2()\n let performCursorZoom = false\n\n const pointers: PointerEvent[] = []\n const pointerPositions: { [key: string]: Vector2 } = {}\n\n function getAutoRotationAngle(): number {\n return ((2 * Math.PI) / 60 / 60) * scope.autoRotateSpeed\n }\n\n function getZoomScale(): number {\n return Math.pow(0.95, scope.zoomSpeed)\n }\n\n function rotateLeft(angle: number): void {\n if (scope.reverseOrbit || scope.reverseHorizontalOrbit) {\n sphericalDelta.theta += angle\n } else {\n sphericalDelta.theta -= angle\n }\n }\n\n function rotateUp(angle: number): void {\n if (scope.reverseOrbit || scope.reverseVerticalOrbit) {\n sphericalDelta.phi += angle\n } else {\n sphericalDelta.phi -= angle\n }\n }\n\n const panLeft = (() => {\n const v = new Vector3()\n\n return function panLeft(distance: number, objectMatrix: Matrix4) {\n v.setFromMatrixColumn(objectMatrix, 0) // get X column of objectMatrix\n v.multiplyScalar(-distance)\n\n panOffset.add(v)\n }\n })()\n\n const panUp = (() => {\n const v = new Vector3()\n\n return function panUp(distance: number, objectMatrix: Matrix4) {\n if (scope.screenSpacePanning === true) {\n v.setFromMatrixColumn(objectMatrix, 1)\n } else {\n v.setFromMatrixColumn(objectMatrix, 0)\n v.crossVectors(scope.object.up, v)\n }\n\n v.multiplyScalar(distance)\n\n panOffset.add(v)\n }\n })()\n\n // deltaX and deltaY are in pixels; right and down are positive\n const pan = (() => {\n const offset = new Vector3()\n\n return function pan(deltaX: number, deltaY: number) {\n const element = scope.domElement\n\n if (element && scope.object instanceof PerspectiveCamera && scope.object.isPerspectiveCamera) {\n // perspective\n const position = scope.object.position\n offset.copy(position).sub(scope.target)\n let targetDistance = offset.length()\n\n // half of the fov is center to top of screen\n targetDistance *= Math.tan(((scope.object.fov / 2) * Math.PI) / 180.0)\n\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 (element && scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera) {\n // orthographic\n panLeft(\n (deltaX * (scope.object.right - scope.object.left)) / scope.object.zoom / element.clientWidth,\n scope.object.matrix,\n )\n panUp(\n (deltaY * (scope.object.top - scope.object.bottom)) / scope.object.zoom / element.clientHeight,\n scope.object.matrix,\n )\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\n function dollyOut(dollyScale: number) {\n if (\n (scope.object instanceof PerspectiveCamera && scope.object.isPerspectiveCamera) ||\n (scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera)\n ) {\n 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\n function dollyIn(dollyScale: number) {\n if (\n (scope.object instanceof PerspectiveCamera && scope.object.isPerspectiveCamera) ||\n (scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera)\n ) {\n 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\n function updateMouseParameters(event: MouseEvent): void {\n if (!scope.zoomToCursor || !scope.domElement) {\n return\n }\n\n performCursorZoom = true\n\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\n mouse.x = (x / w) * 2 - 1\n mouse.y = -(y / h) * 2 + 1\n\n dollyDirection.set(mouse.x, mouse.y, 1).unproject(scope.object).sub(scope.object.position).normalize()\n }\n\n function clampDistance(dist: number): number {\n return Math.max(scope.minDistance, Math.min(scope.maxDistance, dist))\n }\n\n //\n // event callbacks - update the object state\n //\n\n function handleMouseDownRotate(event: MouseEvent) {\n rotateStart.set(event.clientX, event.clientY)\n }\n\n function handleMouseDownDolly(event: MouseEvent) {\n updateMouseParameters(event)\n dollyStart.set(event.clientX, event.clientY)\n }\n\n function handleMouseDownPan(event: MouseEvent) {\n panStart.set(event.clientX, event.clientY)\n }\n\n function handleMouseMoveRotate(event: MouseEvent) {\n rotateEnd.set(event.clientX, event.clientY)\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed)\n\n const element = scope.domElement\n\n if (element) {\n rotateLeft((2 * Math.PI * rotateDelta.x) / element.clientHeight) // yes, height\n rotateUp((2 * Math.PI * rotateDelta.y) / element.clientHeight)\n }\n rotateStart.copy(rotateEnd)\n scope.update()\n }\n\n function handleMouseMoveDolly(event: MouseEvent) {\n dollyEnd.set(event.clientX, event.clientY)\n dollyDelta.subVectors(dollyEnd, dollyStart)\n\n if (dollyDelta.y > 0) {\n dollyOut(getZoomScale())\n } else if (dollyDelta.y < 0) {\n dollyIn(getZoomScale())\n }\n\n dollyStart.copy(dollyEnd)\n scope.update()\n }\n\n function handleMouseMovePan(event: MouseEvent) {\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\n function handleMouseWheel(event: WheelEvent) {\n updateMouseParameters(event)\n\n if (event.deltaY < 0) {\n dollyIn(getZoomScale())\n } else if (event.deltaY > 0) {\n dollyOut(getZoomScale())\n }\n\n scope.update()\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n let needsUpdate = false\n\n switch (event.code) {\n case scope.keys.UP:\n pan(0, scope.keyPanSpeed)\n needsUpdate = true\n break\n\n case scope.keys.BOTTOM:\n pan(0, -scope.keyPanSpeed)\n needsUpdate = true\n break\n\n case scope.keys.LEFT:\n pan(scope.keyPanSpeed, 0)\n needsUpdate = true\n break\n\n case scope.keys.RIGHT:\n pan(-scope.keyPanSpeed, 0)\n needsUpdate = true\n break\n }\n\n if (needsUpdate) {\n // prevent the browser from scrolling on cursor keys\n event.preventDefault()\n scope.update()\n }\n }\n\n function handleTouchStartRotate() {\n if (pointers.length == 1) {\n 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\n rotateStart.set(x, y)\n }\n }\n\n function handleTouchStartPan() {\n if (pointers.length == 1) {\n 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\n panStart.set(x, y)\n }\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\n dollyStart.set(0, distance)\n }\n\n function handleTouchStartDollyPan() {\n if (scope.enableZoom) handleTouchStartDolly()\n if (scope.enablePan) handleTouchStartPan()\n }\n\n function handleTouchStartDollyRotate() {\n if (scope.enableZoom) handleTouchStartDolly()\n if (scope.enableRotate) handleTouchStartRotate()\n }\n\n function handleTouchMoveRotate(event: PointerEvent) {\n if (pointers.length == 1) {\n 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\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed)\n\n const element = scope.domElement\n\n if (element) {\n rotateLeft((2 * Math.PI * rotateDelta.x) / element.clientHeight) // yes, height\n rotateUp((2 * Math.PI * rotateDelta.y) / element.clientHeight)\n }\n rotateStart.copy(rotateEnd)\n }\n\n function handleTouchMovePan(event: PointerEvent) {\n if (pointers.length == 1) {\n 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\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed)\n pan(panDelta.x, panDelta.y)\n panStart.copy(panEnd)\n }\n\n function handleTouchMoveDolly(event: PointerEvent) {\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\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\n function handleTouchMoveDollyPan(event: PointerEvent) {\n if (scope.enableZoom) handleTouchMoveDolly(event)\n if (scope.enablePan) handleTouchMovePan(event)\n }\n\n function handleTouchMoveDollyRotate(event: PointerEvent) {\n if (scope.enableZoom) handleTouchMoveDolly(event)\n if (scope.enableRotate) handleTouchMoveRotate(event)\n }\n\n //\n // event handlers - FSM: listen for events and reset state\n //\n\n function onPointerDown(event: PointerEvent) {\n if (scope.enabled === false) return\n\n if (pointers.length === 0) {\n scope.domElement?.ownerDocument.addEventListener('pointermove', onPointerMove)\n scope.domElement?.ownerDocument.addEventListener('pointerup', onPointerUp)\n }\n\n addPointer(event)\n\n if (event.pointerType === 'touch') {\n onTouchStart(event)\n } else {\n onMouseDown(event)\n }\n }\n\n function onPointerMove(event: PointerEvent) {\n if (scope.enabled === false) return\n\n if (event.pointerType === 'touch') {\n onTouchMove(event)\n } else {\n onMouseMove(event)\n }\n }\n\n function onPointerUp(event: PointerEvent) {\n removePointer(event)\n\n if (pointers.length === 0) {\n scope.domElement?.releasePointerCapture(event.pointerId)\n\n scope.domElement?.ownerDocument.removeEventListener('pointermove', onPointerMove)\n scope.domElement?.ownerDocument.removeEventListener('pointerup', onPointerUp)\n }\n\n // @ts-ignore\n scope.dispatchEvent(endEvent)\n\n state = STATE.NONE\n }\n\n function onMouseDown(event: MouseEvent) {\n let mouseAction\n\n switch (event.button) {\n case 0:\n mouseAction = scope.mouseButtons.LEFT\n break\n\n case 1:\n mouseAction = scope.mouseButtons.MIDDLE\n break\n\n case 2:\n mouseAction = scope.mouseButtons.RIGHT\n break\n\n default:\n mouseAction = -1\n }\n\n switch (mouseAction) {\n case MOUSE.DOLLY:\n if (scope.enableZoom === false) return\n handleMouseDownDolly(event)\n state = STATE.DOLLY\n break\n\n case 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\n case 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\n default:\n state = STATE.NONE\n }\n\n if (state !== STATE.NONE) {\n // @ts-ignore\n scope.dispatchEvent(startEvent)\n }\n }\n\n function onMouseMove(event: MouseEvent) {\n if (scope.enabled === false) return\n\n switch (state) {\n case STATE.ROTATE:\n if (scope.enableRotate === false) return\n handleMouseMoveRotate(event)\n break\n\n case STATE.DOLLY:\n if (scope.enableZoom === false) return\n handleMouseMoveDolly(event)\n break\n\n case STATE.PAN:\n if (scope.enablePan === false) return\n handleMouseMovePan(event)\n break\n }\n }\n\n function onMouseWheel(event: WheelEvent) {\n if (scope.enabled === false || scope.enableZoom === false || (state !== STATE.NONE && state !== STATE.ROTATE)) {\n return\n }\n\n event.preventDefault()\n\n // @ts-ignore\n scope.dispatchEvent(startEvent)\n\n handleMouseWheel(event)\n\n // @ts-ignore\n scope.dispatchEvent(endEvent)\n }\n\n function onKeyDown(event: KeyboardEvent) {\n if (scope.enabled === false || scope.enablePan === false) return\n handleKeyDown(event)\n }\n\n function onTouchStart(event: PointerEvent) {\n trackPointer(event)\n\n switch (pointers.length) {\n case 1:\n switch (scope.touches.ONE) {\n case TOUCH.ROTATE:\n if (scope.enableRotate === false) return\n handleTouchStartRotate()\n state = STATE.TOUCH_ROTATE\n break\n\n case TOUCH.PAN:\n if (scope.enablePan === false) return\n handleTouchStartPan()\n state = STATE.TOUCH_PAN\n break\n\n default:\n state = STATE.NONE\n }\n\n break\n\n case 2:\n switch (scope.touches.TWO) {\n case TOUCH.DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return\n handleTouchStartDollyPan()\n state = STATE.TOUCH_DOLLY_PAN\n break\n\n case TOUCH.DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return\n handleTouchStartDollyRotate()\n state = STATE.TOUCH_DOLLY_ROTATE\n break\n\n default:\n state = STATE.NONE\n }\n\n break\n\n default:\n state = STATE.NONE\n }\n\n if (state !== STATE.NONE) {\n // @ts-ignore\n scope.dispatchEvent(startEvent)\n }\n }\n\n function onTouchMove(event: PointerEvent) {\n trackPointer(event)\n\n switch (state) {\n case STATE.TOUCH_ROTATE:\n if (scope.enableRotate === false) return\n handleTouchMoveRotate(event)\n scope.update()\n break\n\n case STATE.TOUCH_PAN:\n if (scope.enablePan === false) return\n handleTouchMovePan(event)\n scope.update()\n break\n\n case STATE.TOUCH_DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return\n handleTouchMoveDollyPan(event)\n scope.update()\n break\n\n case STATE.TOUCH_DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return\n handleTouchMoveDollyRotate(event)\n scope.update()\n break\n\n default:\n state = STATE.NONE\n }\n }\n\n function onContextMenu(event: Event) {\n if (scope.enabled === false) return\n event.preventDefault()\n }\n\n function addPointer(event: PointerEvent) {\n pointers.push(event)\n }\n\n function removePointer(event: PointerEvent) {\n delete pointerPositions[event.pointerId]\n\n for (let i = 0; i < pointers.length; i++) {\n if (pointers[i].pointerId == event.pointerId) {\n pointers.splice(i, 1)\n return\n }\n }\n }\n\n function trackPointer(event: PointerEvent) {\n let position = pointerPositions[event.pointerId]\n\n if (position === undefined) {\n position = new Vector2()\n pointerPositions[event.pointerId] = position\n }\n\n position.set(event.pageX, event.pageY)\n }\n\n function getSecondPointerPosition(event: PointerEvent) {\n const pointer = event.pointerId === pointers[0].pointerId ? pointers[1] : pointers[0]\n return pointerPositions[pointer.pointerId]\n }\n\n // connect events\n if (domElement !== undefined) this.connect(domElement)\n // force an update at start\n this.update()\n }\n}\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n// This is very similar to OrbitControls, another set of touch behavior\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 constructor(object: PerspectiveCamera | OrthographicCamera, domElement?: HTMLElement) {\n super(object, domElement)\n\n this.screenSpacePanning = false // pan orthogonal to world-space direction camera.up\n\n this.mouseButtons.LEFT = MOUSE.PAN\n this.mouseButtons.RIGHT = MOUSE.ROTATE\n\n this.touches.ONE = TOUCH.PAN\n this.touches.TWO = TOUCH.DOLLY_ROTATE\n }\n}\n\nexport { OrbitControls, MapControls }\n", "import {\n GridHelper,\n EllipseCurve,\n BufferGeometry,\n Line,\n LineBasicMaterial,\n Raycaster,\n Group,\n Box3,\n Sphere,\n Quaternion,\n Vector2,\n Vector3,\n Matrix4,\n MathUtils,\n Scene,\n PerspectiveCamera,\n OrthographicCamera,\n Mesh,\n Material,\n EventDispatcher,\n} from 'three'\n\ntype Camera = OrthographicCamera | PerspectiveCamera\ntype Operation = 'PAN' | 'ROTATE' | 'ZOOM' | 'FOV'\ntype MouseButtonType = number | 'WHEEL'\ntype ModifierKey = 'CTRL' | 'SHIFT'\ntype MouseAction = {\n operation: Operation\n mouse: MouseButtonType\n key: ModifierKey | null\n}\n\ntype Transformation = {\n camera: Matrix4 | null\n gizmos: Matrix4 | null\n}\n\n//trackball state\nconst STATE = {\n IDLE: Symbol(),\n ROTATE: Symbol(),\n PAN: Symbol(),\n SCALE: Symbol(),\n FOV: Symbol(),\n FOCUS: Symbol(),\n ZROTATE: Symbol(),\n TOUCH_MULTI: Symbol(),\n ANIMATION_FOCUS: Symbol(),\n ANIMATION_ROTATE: Symbol(),\n}\n\nconst INPUT = {\n NONE: Symbol(),\n ONE_FINGER: Symbol(),\n ONE_FINGER_SWITCHED: Symbol(),\n TWO_FINGER: Symbol(),\n MULT_FINGER: Symbol(),\n CURSOR: Symbol(),\n}\n\n//cursor center coordinates\nconst _center = {\n x: 0,\n y: 0,\n}\n\n//transformation matrices for gizmos and camera\nconst _transformation: Transformation = {\n camera: new Matrix4(),\n gizmos: new Matrix4(),\n}\n\n//events\nconst _changeEvent = { type: 'change' }\nconst _startEvent = { type: 'start' }\nconst _endEvent = { type: 'end' }\n\n/**\n *\n * @param {CamOrthographicCamera | PerspectiveCameraera} camera Virtual camera used in the scene\n * @param {HTMLElement=null} domElement Renderer's dom element\n * @param {Scene=null} scene The scene to be rendered\n */\nclass ArcballControls extends EventDispatcher {\n private camera: OrthographicCamera | PerspectiveCamera | null\n private domElement: HTMLElement | null | undefined\n private scene: Scene | null | undefined\n\n private mouseActions: (MouseAction & { state: Symbol })[]\n private _mouseOp: Operation | null\n\n private _v2_1: Vector2\n private _v3_1: Vector3\n private _v3_2: Vector3\n\n private _m4_1: Matrix4\n private _m4_2: Matrix4\n\n private _quat: Quaternion\n\n private _translationMatrix: Matrix4\n private _rotationMatrix: Matrix4\n private _scaleMatrix: Matrix4\n\n private _rotationAxis: Vector3\n\n private _cameraMatrixState: Matrix4\n private _cameraProjectionState: Matrix4\n\n private _fovState: number\n private _upState: Vector3\n private _zoomState: number\n private _nearPos: number\n private _farPos: number\n\n private _gizmoMatrixState: Matrix4\n\n private _up0: Vector3\n private _zoom0: number\n private _fov0: number\n private _initialNear: number\n private _nearPos0: number\n private _initialFar: number\n private _farPos0: number\n private _cameraMatrixState0: Matrix4\n private _gizmoMatrixState0: Matrix4\n\n private _button: MouseButtonType\n private _touchStart: PointerEvent[]\n private _touchCurrent: PointerEvent[]\n private _input: Symbol\n\n private _switchSensibility: number\n private _startFingerDistance: number\n private _currentFingerDistance: number\n private _startFingerRotation: number\n private _currentFingerRotation: number\n\n private _devPxRatio: number\n private _downValid: boolean\n private _nclicks: number\n private _downEvents: PointerEvent[]\n private _clickStart: number\n private _maxDownTime: number\n private _maxInterval: number\n private _posThreshold: number\n private _movementThreshold: number\n\n private _currentCursorPosition: Vector3\n private _startCursorPosition: Vector3\n\n private _grid: GridHelper | null\n private _gridPosition: Vector3\n\n private _gizmos: Group\n private _curvePts: number\n\n private _timeStart: number\n private _animationId: number\n\n public focusAnimationTime: number\n\n private _timePrev: number\n private _timeCurrent: number\n private _anglePrev: number\n private _angleCurrent: number\n private _cursorPosPrev: Vector3\n private _cursorPosCurr: Vector3\n private _wPrev: number\n private _wCurr: number\n\n public adjustNearFar: boolean\n public scaleFactor: number\n public dampingFactor: number\n public wMax: number\n public enableAnimations: boolean\n public enableGrid: boolean\n public cursorZoom: boolean\n public minFov: number\n public maxFov: number\n\n public enabled: boolean\n public enablePan: boolean\n public enableRotate: boolean\n public enableZoom: boolean\n\n public minDistance: number\n public maxDistance: number\n public minZoom: number\n public maxZoom: number\n\n private target: Vector3\n private _currentTarget: Vector3\n\n private _tbRadius: number\n\n private _state: Symbol\n\n constructor(\n camera: Camera | null,\n domElement: HTMLElement | null | undefined = null,\n scene: Scene | null | undefined = null,\n ) {\n super()\n this.camera = null\n this.domElement = domElement\n this.scene = scene\n\n this.mouseActions = []\n this._mouseOp = null\n\n //global vectors and matrices that are used in some operations to avoid creating new objects every time (e.g. every time cursor moves)\n this._v2_1 = new Vector2()\n this._v3_1 = new Vector3()\n this._v3_2 = new Vector3()\n\n this._m4_1 = new Matrix4()\n this._m4_2 = new Matrix4()\n\n this._quat = new Quaternion()\n\n //transformation matrices\n this._translationMatrix = new Matrix4() //matrix for translation operation\n this._rotationMatrix = new Matrix4() //matrix for rotation operation\n this._scaleMatrix = new Matrix4() //matrix for scaling operation\n\n this._rotationAxis = new Vector3() //axis for rotate operation\n\n //camera state\n this._cameraMatrixState = new Matrix4()\n this._cameraProjectionState = new Matrix4()\n\n this._fovState = 1\n this._upState = new Vector3()\n this._zoomState = 1\n this._nearPos = 0\n this._farPos = 0\n\n this._gizmoMatrixState = new Matrix4()\n\n //initial values\n this._up0 = new Vector3()\n this._zoom0 = 1\n this._fov0 = 0\n this._initialNear = 0\n this._nearPos0 = 0\n this._initialFar = 0\n this._farPos0 = 0\n this._cameraMatrixState0 = new Matrix4()\n this._gizmoMatrixState0 = new Matrix4()\n\n //pointers array\n this._button = -1\n this._touchStart = []\n this._touchCurrent = []\n this._input = INPUT.NONE\n\n //two fingers touch interaction\n this._switchSensibility = 32 //minimum movement to be performed to fire single pan start after the second finger has been released\n this._startFingerDistance = 0 //distance between two fingers\n this._currentFingerDistance = 0\n this._startFingerRotation = 0 //amount of rotation performed with two fingers\n this._currentFingerRotation = 0\n\n //double tap\n this._devPxRatio = 0\n this._downValid = true\n this._nclicks = 0\n this._downEvents = []\n this._clickStart = 0 //first click time\n this._maxDownTime = 250\n this._maxInterval = 300\n this._posThreshold = 24\n this._movementThreshold = 24\n\n //cursor positions\n this._currentCursorPosition = new Vector3()\n this._startCursorPosition = new Vector3()\n\n //grid\n this._grid = null //grid to be visualized during pan operation\n this._gridPosition = new Vector3()\n\n //gizmos\n this._gizmos = new Group()\n this._curvePts = 128\n\n //animations\n this._timeStart = -1 //initial time\n this._animationId = -1\n\n //focus animation\n this.focusAnimationTime = 500 //duration of focus animation in ms\n\n //rotate animation\n this._timePrev = 0 //time at which previous rotate operation has been detected\n this._timeCurrent = 0 //time at which current rotate operation has been detected\n this._anglePrev = 0 //angle of previous rotation\n this._angleCurrent = 0 //angle of current rotation\n this._cursorPosPrev = new Vector3() //cursor position when previous rotate operation has been detected\n this._cursorPosCurr = new Vector3() //cursor position when current rotate operation has been detected\n this._wPrev = 0 //angular velocity of the previous rotate operation\n this._wCurr = 0 //angular velocity of the current rotate operation\n\n //parameters\n this.adjustNearFar = false\n this.scaleFactor = 1.1 //zoom/distance multiplier\n this.dampingFactor = 25\n this.wMax = 20 //maximum angular velocity allowed\n this.enableAnimations = true //if animations should be performed\n this.enableGrid = false //if grid should be showed during pan operation\n this.cursorZoom = false //if wheel zoom should be cursor centered\n this.minFov = 5\n this.maxFov = 90\n\n this.enabled = true\n this.enablePan = true\n this.enableRotate = true\n this.enableZoom = true\n\n this.minDistance = 0\n this.maxDistance = Infinity\n this.minZoom = 0\n this.maxZoom = Infinity\n\n //trackball parameters\n this.target = new Vector3(0, 0, 0)\n this._currentTarget = new Vector3(0, 0, 0)\n\n this._tbRadius = 1\n\n //FSA\n this._state = STATE.IDLE\n\n this.setCamera(camera)\n\n if (this.scene) {\n this.scene.add(this._gizmos)\n }\n\n this._devPxRatio = window.devicePixelRatio\n\n this.initializeMouseActions()\n\n if (this.domElement) this.connect(this.domElement)\n\n window.addEventListener('resize', this.onWindowResize)\n }\n\n //listeners\n\n private onWindowResize = (): void => {\n const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3\n if (this.camera) {\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n }\n\n const newRadius = this._tbRadius / scale\n // @ts-ignore\n const curve = new EllipseCurve(0, 0, newRadius, newRadius)\n const points = curve.getPoints(this._curvePts)\n const curveGeometry = new BufferGeometry().setFromPoints(points)\n\n for (const gizmo in this._gizmos.children) {\n const child = this._gizmos.children[gizmo] as Mesh\n child.geometry = curveGeometry\n }\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n private onContextMenu = (event: MouseEvent): void => {\n if (!this.enabled) {\n return\n }\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n if (this.mouseActions[i].mouse == 2) {\n //prevent only if button 2 is actually used\n event.preventDefault()\n break\n }\n }\n }\n\n private onPointerCancel = (): void => {\n this._touchStart.splice(0, this._touchStart.length)\n this._touchCurrent.splice(0, this._touchCurrent.length)\n this._input = INPUT.NONE\n }\n\n private onPointerDown = (event: PointerEvent): void => {\n if (event.button == 0 && event.isPrimary) {\n this._downValid = true\n this._downEvents.push(event)\n } else {\n this._downValid = false\n }\n\n if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {\n this._touchStart.push(event)\n this._touchCurrent.push(event)\n\n switch (this._input) {\n case INPUT.NONE:\n //singleStart\n this._input = INPUT.ONE_FINGER\n this.onSinglePanStart(event, 'ROTATE')\n\n window.addEventListener('pointermove', this.onPointerMove)\n window.addEventListener('pointerup', this.onPointerUp)\n\n break\n\n case INPUT.ONE_FINGER:\n case INPUT.ONE_FINGER_SWITCHED:\n //doubleStart\n this._input = INPUT.TWO_FINGER\n\n this.onRotateStart()\n this.onPinchStart()\n this.onDoublePanStart()\n\n break\n\n case INPUT.TWO_FINGER:\n //multipleStart\n this._input = INPUT.MULT_FINGER\n this.onTriplePanStart()\n break\n }\n } else if (event.pointerType != 'touch' && this._input == INPUT.NONE) {\n let modifier: ModifierKey | null = null\n\n if (event.ctrlKey || event.metaKey) {\n modifier = 'CTRL'\n } else if (event.shiftKey) {\n modifier = 'SHIFT'\n }\n\n this._mouseOp = this.getOpFromAction(event.button, modifier)\n if (this._mouseOp) {\n window.addEventListener('pointermove', this.onPointerMove)\n window.addEventListener('pointerup', this.onPointerUp)\n\n //singleStart\n this._input = INPUT.CURSOR\n this._button = event.button\n this.onSinglePanStart(event, this._mouseOp)\n }\n }\n }\n\n private onPointerMove = (event: PointerEvent): void => {\n if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {\n switch (this._input) {\n case INPUT.ONE_FINGER:\n //singleMove\n this.updateTouchEvent(event)\n\n this.onSinglePanMove(event, STATE.ROTATE)\n break\n\n case INPUT.ONE_FINGER_SWITCHED:\n const movement = this.calculatePointersDistance(this._touchCurrent[0], event) * this._devPxRatio\n\n if (movement >= this._switchSensibility) {\n //singleMove\n this._input = INPUT.ONE_FINGER\n this.updateTouchEvent(event)\n\n this.onSinglePanStart(event, 'ROTATE')\n break\n }\n\n break\n\n case INPUT.TWO_FINGER:\n //rotate/pan/pinchMove\n this.updateTouchEvent(event)\n\n this.onRotateMove()\n this.onPinchMove()\n this.onDoublePanMove()\n\n break\n\n case INPUT.MULT_FINGER:\n //multMove\n this.updateTouchEvent(event)\n\n this.onTriplePanMove()\n break\n }\n } else if (event.pointerType != 'touch' && this._input == INPUT.CURSOR) {\n let modifier: ModifierKey | null = null\n\n if (event.ctrlKey || event.metaKey) {\n modifier = 'CTRL'\n } else if (event.shiftKey) {\n modifier = 'SHIFT'\n }\n\n const mouseOpState = this.getOpStateFromAction(this._button, modifier)\n\n if (mouseOpState) {\n this.onSinglePanMove(event, mouseOpState)\n }\n }\n\n //checkDistance\n if (this._downValid) {\n const movement =\n this.calculatePointersDistance(this._downEvents[this._downEvents.length - 1], event) * this._devPxRatio\n if (movement > this._movementThreshold) {\n this._downValid = false\n }\n }\n }\n\n private onPointerUp = (event: PointerEvent): void => {\n if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {\n const nTouch = this._touchCurrent.length\n\n for (let i = 0; i < nTouch; i++) {\n if (this._touchCurrent[i].pointerId == event.pointerId) {\n this._touchCurrent.splice(i, 1)\n this._touchStart.splice(i, 1)\n break\n }\n }\n\n switch (this._input) {\n case INPUT.ONE_FINGER:\n case INPUT.ONE_FINGER_SWITCHED:\n //singleEnd\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n this._input = INPUT.NONE\n this.onSinglePanEnd()\n\n break\n\n case INPUT.TWO_FINGER:\n //doubleEnd\n this.onDoublePanEnd()\n this.onPinchEnd()\n this.onRotateEnd()\n\n //switching to singleStart\n this._input = INPUT.ONE_FINGER_SWITCHED\n\n break\n\n case INPUT.MULT_FINGER:\n if (this._touchCurrent.length == 0) {\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n //multCancel\n this._input = INPUT.NONE\n this.onTriplePanEnd()\n }\n\n break\n }\n } else if (event.pointerType != 'touch' && this._input == INPUT.CURSOR) {\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n this._input = INPUT.NONE\n this.onSinglePanEnd()\n this._button = -1\n }\n\n if (event.isPrimary) {\n if (this._downValid) {\n const downTime = event.timeStamp - this._downEvents[this._downEvents.length - 1].timeStamp\n\n if (downTime <= this._maxDownTime) {\n if (this._nclicks == 0) {\n //first valid click detected\n this._nclicks = 1\n this._clickStart = performance.now()\n } else {\n const clickInterval = event.timeStamp - this._clickStart\n const movement = this.calculatePointersDistance(this._downEvents[1], this._downEvents[0]) * this._devPxRatio\n\n if (clickInterval <= this._maxInterval && movement <= this._posThreshold) {\n //second valid click detected\n //fire double tap and reset values\n this._nclicks = 0\n this._downEvents.splice(0, this._downEvents.length)\n this.onDoubleTap(event)\n } else {\n //new 'first click'\n this._nclicks = 1\n this._downEvents.shift()\n this._clickStart = performance.now()\n }\n }\n } else {\n this._downValid = false\n this._nclicks = 0\n this._downEvents.splice(0, this._downEvents.length)\n }\n } else {\n this._nclicks = 0\n this._downEvents.splice(0, this._downEvents.length)\n }\n }\n }\n\n private onWheel = (event: WheelEvent): void => {\n if (this.enabled && this.enableZoom && this.domElement) {\n let modifier: ModifierKey | null = null\n\n if (event.ctrlKey || event.metaKey) {\n modifier = 'CTRL'\n } else if (event.shiftKey) {\n modifier = 'SHIFT'\n }\n\n const mouseOp = this.getOpFromAction('WHEEL', modifier)\n\n if (mouseOp) {\n event.preventDefault()\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n const notchDeltaY = 125 //distance of one notch of mouse wheel\n let sgn = event.deltaY / notchDeltaY\n\n let size = 1\n\n if (sgn > 0) {\n size = 1 / this.scaleFactor\n } else if (sgn < 0) {\n size = this.scaleFactor\n }\n\n switch (mouseOp) {\n case 'ZOOM':\n this.updateTbState(STATE.SCALE, true)\n\n if (sgn > 0) {\n size = 1 / Math.pow(this.scaleFactor, sgn)\n } else if (sgn < 0) {\n size = Math.pow(this.scaleFactor, -sgn)\n }\n\n if (this.cursorZoom && this.enablePan) {\n let scalePoint\n\n if (this.camera instanceof OrthographicCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .multiplyScalar(1 / this.camera.zoom)\n .add(this._gizmos.position)\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .add(this._gizmos.position)\n }\n\n if (scalePoint !== undefined) this.applyTransformMatrix(this.applyScale(size, scalePoint))\n } else {\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position))\n }\n\n if (this._grid) {\n this.disposeGrid()\n this.drawGrid()\n }\n\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n\n break\n\n case 'FOV':\n if (this.camera instanceof PerspectiveCamera) {\n this.updateTbState(STATE.FOV, true)\n\n //Vertigo effect\n\n //\t fov / 2\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\tx\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t\t| _ _ _\\\n //\t\t\ty\n\n //check for iOs shift shortcut\n if (event.deltaX != 0) {\n sgn = event.deltaX / notchDeltaY\n\n size = 1\n\n if (sgn > 0) {\n size = 1 / Math.pow(this.scaleFactor, sgn)\n } else if (sgn < 0) {\n size = Math.pow(this.scaleFactor, -sgn)\n }\n }\n\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n const x = this._v3_1.distanceTo(this._gizmos.position)\n let xNew = x / size //distance between camera and gizmos if scale(size, scalepoint) would be performed\n\n //check min and max distance\n xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance)\n\n const y = x * Math.tan(MathUtils.DEG2RAD * this.camera.fov * 0.5)\n\n //calculate new fov\n let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2)\n\n //check min and max fov\n if (newFov > this.maxFov) {\n newFov = this.maxFov\n } else if (newFov < this.minFov) {\n newFov = this.minFov\n }\n\n const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2))\n size = x / newDistance\n\n this.setFov(newFov)\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position, false))\n }\n\n if (this._grid) {\n this.disposeGrid()\n this.drawGrid()\n }\n\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n\n break\n }\n }\n }\n }\n\n private onSinglePanStart = (event: PointerEvent, operation: Operation): void => {\n if (this.enabled && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.setCenter(event.clientX, event.clientY)\n\n switch (operation) {\n case 'PAN':\n if (!this.enablePan) return\n\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n if (this.camera) {\n this.updateTbState(STATE.PAN, true)\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n if (this.enableGrid) {\n this.drawGrid()\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n break\n\n case 'ROTATE':\n if (!this.enableRotate) return\n\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n }\n\n if (this.camera) {\n this.updateTbState(STATE.ROTATE, true)\n const rayDir = this.unprojectOnTbSurface(this.camera, _center.x, _center.y, this.domElement, this._tbRadius)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n this.activateGizmos(true)\n if (this.enableAnimations) {\n this._timePrev = this._timeCurrent = performance.now()\n this._angleCurrent = this._anglePrev = 0\n this._cursorPosPrev.copy(this._startCursorPosition)\n this._cursorPosCurr.copy(this._cursorPosPrev)\n this._wCurr = 0\n this._wPrev = this._wCurr\n }\n }\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n break\n\n case 'FOV':\n if (!this.enableZoom) return\n\n if (this.camera instanceof PerspectiveCamera) {\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n this.updateTbState(STATE.FOV, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n }\n break\n\n case 'ZOOM':\n if (!this.enableZoom) return\n\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n this.updateTbState(STATE.SCALE, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n break\n }\n }\n }\n\n private onSinglePanMove = (event: PointerEvent, opState: Symbol): void => {\n if (this.enabled && this.domElement) {\n const restart = opState != this._state\n this.setCenter(event.clientX, event.clientY)\n\n switch (opState) {\n case STATE.PAN:\n if (this.enablePan && this.camera) {\n if (restart) {\n //switch to pan operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n if (this.enableGrid) {\n this.drawGrid()\n }\n\n this.activateGizmos(false)\n } else {\n //continue with pan operation\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n if (rayDir !== undefined) {\n this._currentCursorPosition.copy(rayDir)\n }\n this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition))\n }\n }\n\n break\n\n case STATE.ROTATE:\n if (this.enableRotate && this.camera) {\n if (restart) {\n //switch to rotate operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n const rayDir = this.unprojectOnTbSurface(\n this.camera,\n _center.x,\n _center.y,\n this.domElement,\n this._tbRadius,\n )\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(true)\n } else {\n //continue with rotate operation\n const rayDir = this.unprojectOnTbSurface(\n this.camera,\n _center.x,\n _center.y,\n this.domElement,\n this._tbRadius,\n )\n if (rayDir !== undefined) {\n this._currentCursorPosition.copy(rayDir)\n }\n\n const distance = this._startCursorPosition.distanceTo(this._currentCursorPosition)\n const angle = this._startCursorPosition.angleTo(this._currentCursorPosition)\n const amount = Math.max(distance / this._tbRadius, angle) //effective rotation angle\n\n this.applyTransformMatrix(\n this.rotate(this.calculateRotationAxis(this._startCursorPosition, this._currentCursorPosition), amount),\n )\n\n if (this.enableAnimations) {\n this._timePrev = this._timeCurrent\n this._timeCurrent = performance.now()\n this._anglePrev = this._angleCurrent\n this._angleCurrent = amount\n this._cursorPosPrev.copy(this._cursorPosCurr)\n this._cursorPosCurr.copy(this._currentCursorPosition)\n this._wPrev = this._wCurr\n this._wCurr = this.calculateAngularSpeed(\n this._anglePrev,\n this._angleCurrent,\n this._timePrev,\n this._timeCurrent,\n )\n }\n }\n }\n\n break\n\n case STATE.SCALE:\n if (this.enableZoom) {\n if (restart) {\n //switch to zoom operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(false)\n } else {\n //continue with zoom operation\n const screenNotches = 8 //how many wheel notches corresponds to a full screen pan\n this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y\n\n let size = 1\n\n if (movement < 0) {\n size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches)\n } else if (movement > 0) {\n size = Math.pow(this.scaleFactor, movement * screenNotches)\n }\n\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position))\n }\n }\n\n break\n\n case STATE.FOV:\n if (this.enableZoom && this.camera instanceof PerspectiveCamera) {\n if (restart) {\n //switch to fov operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(false)\n } else {\n //continue with fov operation\n const screenNotches = 8 //how many wheel notches corresponds to a full screen pan\n this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y\n\n let size = 1\n\n if (movement < 0) {\n size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches)\n } else if (movement > 0) {\n size = Math.pow(this.scaleFactor, movement * screenNotches)\n }\n\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n const x = this._v3_1.distanceTo(this._gizmos.position)\n let xNew = x / size //distance between camera and gizmos if scale(size, scalepoint) would be performed\n\n //check min and max distance\n xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance)\n\n const y = x * Math.tan(MathUtils.DEG2RAD * this._fovState * 0.5)\n\n //calculate new fov\n let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2)\n\n //check min and max fov\n newFov = MathUtils.clamp(newFov, this.minFov, this.maxFov)\n\n const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2))\n size = x / newDistance\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n\n this.setFov(newFov)\n this.applyTransformMatrix(this.applyScale(size, this._v3_2, false))\n\n //adjusting distance\n const direction = this._gizmos.position\n .clone()\n .sub(this.camera.position)\n .normalize()\n .multiplyScalar(newDistance / x)\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z)\n }\n }\n\n break\n }\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onSinglePanEnd = (): void => {\n if (this._state == STATE.ROTATE) {\n if (!this.enableRotate) {\n return\n }\n\n if (this.enableAnimations) {\n //perform rotation animation\n const deltaTime = performance.now() - this._timeCurrent\n if (deltaTime < 120) {\n const w = Math.abs((this._wPrev + this._wCurr) / 2)\n\n const self = this\n this._animationId = window.requestAnimationFrame(function (t) {\n self.updateTbState(STATE.ANIMATION_ROTATE, true)\n const rotationAxis = self.calculateRotationAxis(self._cursorPosPrev, self._cursorPosCurr)\n\n self.onRotationAnim(t, rotationAxis, Math.min(w, self.wMax))\n })\n } else {\n //cursor has been standing still for over 120 ms since last movement\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n } else {\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n } else if (this._state == STATE.PAN || this._state == STATE.IDLE) {\n this.updateTbState(STATE.IDLE, false)\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onDoubleTap = (event: PointerEvent): void => {\n if (this.enabled && this.enablePan && this.scene && this.camera && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.setCenter(event.clientX, event.clientY)\n const hitP = this.unprojectOnObj(this.getCursorNDC(_center.x, _center.y, this.domElement), this.camera)\n\n if (hitP && this.enableAnimations) {\n const self = this\n if (this._animationId != -1) {\n window.cancelAnimationFrame(this._animationId)\n }\n\n this._timeStart = -1\n this._animationId = window.requestAnimationFrame(function (t) {\n self.updateTbState(STATE.ANIMATION_FOCUS, true)\n self.onFocusAnim(t, hitP, self._cameraMatrixState, self._gizmoMatrixState)\n })\n } else if (hitP && !this.enableAnimations) {\n this.updateTbState(STATE.FOCUS, true)\n this.focus(hitP, this.scaleFactor)\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onDoublePanStart = (): void => {\n if (this.enabled && this.enablePan && this.camera && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(STATE.PAN, true)\n\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n this._currentCursorPosition.copy(this._startCursorPosition)\n\n this.activateGizmos(false)\n }\n }\n\n private onDoublePanMove = (): void => {\n if (this.enabled && this.enablePan && this.camera && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n\n if (this._state != STATE.PAN) {\n this.updateTbState(STATE.PAN, true)\n this._startCursorPosition.copy(this._currentCursorPosition)\n }\n\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true)\n if (rayDir !== undefined) this._currentCursorPosition.copy(rayDir)\n this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition, true))\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onDoublePanEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onRotateStart = (): void => {\n if (this.enabled && this.enableRotate) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(STATE.ZROTATE, true)\n\n //this._startFingerRotation = event.rotation;\n\n this._startFingerRotation =\n this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) +\n this.getAngle(this._touchStart[1], this._touchStart[0])\n this._currentFingerRotation = this._startFingerRotation\n\n this.camera?.getWorldDirection(this._rotationAxis) //rotation axis\n\n if (!this.enablePan && !this.enableZoom) {\n this.activateGizmos(true)\n }\n }\n }\n\n private onRotateMove = (): void => {\n if (this.enabled && this.enableRotate && this.camera && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n let rotationPoint\n\n if (this._state != STATE.ZROTATE) {\n this.updateTbState(STATE.ZROTATE, true)\n this._startFingerRotation = this._currentFingerRotation\n }\n\n //this._currentFingerRotation = event.rotation;\n this._currentFingerRotation =\n this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) +\n this.getAngle(this._touchStart[1], this._touchStart[0])\n\n if (!this.enablePan) {\n rotationPoint = new Vector3().setFromMatrixPosition(this._gizmoMatrixState)\n } else if (this.camera) {\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n rotationPoint = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .multiplyScalar(1 / this.camera.zoom)\n .add(this._v3_2)\n }\n\n const amount = MathUtils.DEG2RAD * (this._startFingerRotation - this._currentFingerRotation)\n\n if (rotationPoint !== undefined) {\n this.applyTransformMatrix(this.zRotate(rotationPoint, amount))\n }\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onRotateEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onPinchStart = (): void => {\n if (this.enabled && this.enableZoom) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n this.updateTbState(STATE.SCALE, true)\n\n this._startFingerDistance = this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1])\n this._currentFingerDistance = this._startFingerDistance\n\n this.activateGizmos(false)\n }\n }\n\n private onPinchMove = (): void => {\n if (this.enabled && this.enableZoom && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n const minDistance = 12 //minimum distance between fingers (in css pixels)\n\n if (this._state != STATE.SCALE) {\n this._startFingerDistance = this._currentFingerDistance\n this.updateTbState(STATE.SCALE, true)\n }\n\n this._currentFingerDistance = Math.max(\n this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]),\n minDistance * this._devPxRatio,\n )\n const amount = this._currentFingerDistance / this._startFingerDistance\n\n let scalePoint\n\n if (!this.enablePan) {\n scalePoint = this._gizmos.position\n } else {\n if (this.camera instanceof OrthographicCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .multiplyScalar(1 / this.camera.zoom)\n .add(this._gizmos.position)\n } else if (this.camera instanceof PerspectiveCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .add(this._gizmos.position)\n }\n }\n\n if (scalePoint !== undefined) {\n this.applyTransformMatrix(this.applyScale(amount, scalePoint))\n }\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onPinchEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onTriplePanStart = (): void => {\n if (this.enabled && this.enableZoom && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(STATE.SCALE, true)\n\n //const center = event.center;\n let clientX = 0\n let clientY = 0\n const nFingers = this._touchCurrent.length\n\n for (let i = 0; i < nFingers; i++) {\n clientX += this._touchCurrent[i].clientX\n clientY += this._touchCurrent[i].clientY\n }\n\n this.setCenter(clientX / nFingers, clientY / nFingers)\n\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n }\n }\n\n private onTriplePanMove = (): void => {\n if (this.enabled && this.enableZoom && this.camera && this.domElement) {\n //\t fov / 2\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\tx\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t\t| _ _ _\\\n //\t\t\ty\n\n //const center = event.center;\n let clientX = 0\n let clientY = 0\n const nFingers = this._touchCurrent.length\n\n for (let i = 0; i < nFingers; i++) {\n clientX += this._touchCurrent[i].clientX\n clientY += this._touchCurrent[i].clientY\n }\n\n this.setCenter(clientX / nFingers, clientY / nFingers)\n\n const screenNotches = 8 //how many wheel notches corresponds to a full screen pan\n this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y\n\n let size = 1\n\n if (movement < 0) {\n size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches)\n } else if (movement > 0) {\n size = Math.pow(this.scaleFactor, movement * screenNotches)\n }\n\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n const x = this._v3_1.distanceTo(this._gizmos.position)\n let xNew = x / size //distance between camera and gizmos if scale(size, scalepoint) would be performed\n\n //check min and max distance\n xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance)\n\n const y = x * Math.tan(MathUtils.DEG2RAD * this._fovState * 0.5)\n\n //calculate new fov\n let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2)\n\n //check min and max fov\n newFov = MathUtils.clamp(newFov, this.minFov, this.maxFov)\n\n const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2))\n size = x / newDistance\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n\n this.setFov(newFov)\n this.applyTransformMatrix(this.applyScale(size, this._v3_2, false))\n\n //adjusting distance\n const direction = this._gizmos.position\n .clone()\n .sub(this.camera.position)\n .normalize()\n .multiplyScalar(newDistance / x)\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onTriplePanEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n //this.dispatchEvent( _changeEvent );\n }\n\n /**\n * Set _center's x/y coordinates\n * @param {Number} clientX\n * @param {Number} clientY\n */\n private setCenter = (clientX: number, clientY: number): void => {\n _center.x = clientX\n _center.y = clientY\n }\n\n /**\n * Set default mouse actions\n */\n private initializeMouseActions = (): void => {\n this.setMouseAction('PAN', 0, 'CTRL')\n this.setMouseAction('PAN', 2)\n\n this.setMouseAction('ROTATE', 0)\n\n this.setMouseAction('ZOOM', 'WHEEL')\n this.setMouseAction('ZOOM', 1)\n\n this.setMouseAction('FOV', 'WHEEL', 'SHIFT')\n this.setMouseAction('FOV', 1, 'SHIFT')\n }\n\n /**\n * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one\n * @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV)\n * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches\n * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed\n * @returns {Boolean} True if the mouse action has been successfully added, false otherwise\n */\n private setMouseAction = (operation: Operation, mouse: MouseButtonType, key: ModifierKey | null = null): boolean => {\n const operationInput = ['PAN', 'ROTATE', 'ZOOM', 'FOV']\n const mouseInput = [0, 1, 2, 'WHEEL']\n const keyInput = ['CTRL', 'SHIFT', null]\n let state\n\n if (!operationInput.includes(operation) || !mouseInput.includes(mouse) || !keyInput.includes(key)) {\n //invalid parameters\n return false\n }\n\n if (mouse == 'WHEEL') {\n if (operation != 'ZOOM' && operation != 'FOV') {\n //cannot associate 2D operation to 1D input\n return false\n }\n }\n\n switch (operation) {\n case 'PAN':\n state = STATE.PAN\n break\n\n case 'ROTATE':\n state = STATE.ROTATE\n break\n\n case 'ZOOM':\n state = STATE.SCALE\n break\n\n case 'FOV':\n state = STATE.FOV\n break\n }\n\n const action = {\n operation: operation,\n mouse: mouse,\n key: key,\n state: state,\n }\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n if (this.mouseActions[i].mouse == action.mouse && this.mouseActions[i].key == action.key) {\n this.mouseActions.splice(i, 1, action)\n return true\n }\n }\n\n this.mouseActions.push(action)\n return true\n }\n\n /**\n * Return the operation associated to a mouse/keyboard combination\n * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches\n * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed\n * @returns The operation if it has been found, null otherwise\n */\n private getOpFromAction = (mouse: MouseButtonType, key: ModifierKey | null): Operation | null => {\n let action\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == key) {\n return action.operation\n }\n }\n\n if (key) {\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == null) {\n return action.operation\n }\n }\n }\n\n return null\n }\n\n /**\n * Get the operation associated to mouse and key combination and returns the corresponding FSA state\n * @param {Number} mouse Mouse button\n * @param {String} key Keyboard modifier\n * @returns The FSA state obtained from the operation associated to mouse/keyboard combination\n */\n private getOpStateFromAction = (mouse: MouseButtonType, key: ModifierKey | null): Symbol | null => {\n let action\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == key) {\n return action.state\n }\n }\n\n if (key) {\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == null) {\n return action.state\n }\n }\n }\n\n return null\n }\n\n /**\n * Calculate the angle between two pointers\n * @param {PointerEvent} p1\n * @param {PointerEvent} p2\n * @returns {Number} The angle between two pointers in degrees\n */\n private getAngle = (p1: PointerEvent, p2: PointerEvent): number => {\n return (Math.atan2(p2.clientY - p1.clientY, p2.clientX - p1.clientX) * 180) / Math.PI\n }\n\n /**\n * Update a PointerEvent inside current pointerevents array\n * @param {PointerEvent} event\n */\n private updateTouchEvent = (event: PointerEvent): void => {\n for (let i = 0; i < this._touchCurrent.length; i++) {\n if (this._touchCurrent[i].pointerId == event.pointerId) {\n this._touchCurrent.splice(i, 1, event)\n break\n }\n }\n }\n\n /**\n * Apply a transformation matrix, to the camera and gizmos\n * @param {Object} transformation Object containing matrices to apply to camera and gizmos\n */\n private applyTransformMatrix(transformation: Transformation | undefined): void {\n if (transformation?.camera && this.camera) {\n this._m4_1.copy(this._cameraMatrixState).premultiply(transformation.camera)\n this._m4_1.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n this.camera.updateMatrix()\n\n //update camera up vector\n if (this._state == STATE.ROTATE || this._state == STATE.ZROTATE || this._state == STATE.ANIMATION_ROTATE) {\n this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion)\n }\n }\n\n if (transformation?.gizmos) {\n this._m4_1.copy(this._gizmoMatrixState).premultiply(transformation.gizmos)\n this._m4_1.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n this._gizmos.updateMatrix()\n }\n\n if (\n (this._state == STATE.SCALE || this._state == STATE.FOCUS || this._state == STATE.ANIMATION_FOCUS) &&\n this.camera\n ) {\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n\n if (this.adjustNearFar) {\n const cameraDistance = this.camera.position.distanceTo(this._gizmos.position)\n\n const bb = new Box3()\n bb.setFromObject(this._gizmos)\n const sphere = new Sphere()\n bb.getBoundingSphere(sphere)\n\n const adjustedNearPosition = Math.max(this._nearPos0, sphere.radius + sphere.center.length())\n const regularNearPosition = cameraDistance - this._initialNear\n\n const minNearPos = Math.min(adjustedNearPosition, regularNearPosition)\n this.camera.near = cameraDistance - minNearPos\n\n const adjustedFarPosition = Math.min(this._farPos0, -sphere.radius + sphere.center.length())\n const regularFarPosition = cameraDistance - this._initialFar\n\n const minFarPos = Math.min(adjustedFarPosition, regularFarPosition)\n this.camera.far = cameraDistance - minFarPos\n\n this.camera.updateProjectionMatrix()\n } else {\n let update = false\n\n if (this.camera.near != this._initialNear) {\n this.camera.near = this._initialNear\n update = true\n }\n\n if (this.camera.far != this._initialFar) {\n this.camera.far = this._initialFar\n update = true\n }\n\n if (update) {\n this.camera.updateProjectionMatrix()\n }\n }\n }\n }\n\n /**\n * Calculate the angular speed\n * @param {Number} p0 Position at t0\n * @param {Number} p1 Position at t1\n * @param {Number} t0 Initial time in milliseconds\n * @param {Number} t1 Ending time in milliseconds\n */\n private calculateAngularSpeed = (p0: number, p1: number, t0: number, t1: number): number => {\n const s = p1 - p0\n const t = (t1 - t0) / 1000\n if (t == 0) {\n return 0\n }\n\n return s / t\n }\n\n /**\n * Calculate the distance between two pointers\n * @param {PointerEvent} p0 The first pointer\n * @param {PointerEvent} p1 The second pointer\n * @returns {number} The distance between the two pointers\n */\n private calculatePointersDistance = (p0: PointerEvent, p1: PointerEvent): number => {\n return Math.sqrt(Math.pow(p1.clientX - p0.clientX, 2) + Math.pow(p1.clientY - p0.clientY, 2))\n }\n\n /**\n * Calculate the rotation axis as the vector perpendicular between two vectors\n * @param {Vector3} vec1 The first vector\n * @param {Vector3} vec2 The second vector\n * @returns {Vector3} The normalized rotation axis\n */\n private calculateRotationAxis = (vec1: Vector3, vec2: Vector3): Vector3 => {\n this._rotationMatrix.extractRotation(this._cameraMatrixState)\n this._quat.setFromRotationMatrix(this._rotationMatrix)\n\n this._rotationAxis.crossVectors(vec1, vec2).applyQuaternion(this._quat)\n return this._rotationAxis.normalize().clone()\n }\n\n /**\n * Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum\n * @param {Camera} camera\n * @returns {Number} The trackball radius\n */\n private calculateTbRadius = (camera: Camera): number | undefined => {\n const factor = 0.67\n const distance = camera.position.distanceTo(this._gizmos.position)\n\n if (camera instanceof PerspectiveCamera) {\n const halfFovV = MathUtils.DEG2RAD * camera.fov * 0.5 //vertical fov/2 in radians\n const halfFovH = Math.atan(camera.aspect * Math.tan(halfFovV)) //horizontal fov/2 in radians\n return Math.tan(Math.min(halfFovV, halfFovH)) * distance * factor\n } else if (camera instanceof OrthographicCamera) {\n return Math.min(camera.top, camera.right) * factor\n }\n }\n\n /**\n * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in\n * @param {Vector3} point The point of interest\n * @param {Number} size Scale factor\n * @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)\n */\n private focus = (point: Vector3, size: number, amount = 1): void => {\n if (this.camera) {\n const focusPoint = point.clone()\n\n //move center of camera (along with gizmos) towards point of interest\n focusPoint.sub(this._gizmos.position).multiplyScalar(amount)\n this._translationMatrix.makeTranslation(focusPoint.x, focusPoint.y, focusPoint.z)\n\n const gizmoStateTemp = this._gizmoMatrixState.clone()\n this._gizmoMatrixState.premultiply(this._translationMatrix)\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n const cameraStateTemp = this._cameraMatrixState.clone()\n this._cameraMatrixState.premultiply(this._translationMatrix)\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n\n //apply zoom\n if (this.enableZoom) {\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position))\n }\n\n this._gizmoMatrixState.copy(gizmoStateTemp)\n this._cameraMatrixState.copy(cameraStateTemp)\n }\n }\n\n /**\n * Draw a grid and add it to the scene\n */\n private drawGrid = (): void => {\n if (this.scene) {\n const color = 0x888888\n const multiplier = 3\n let size, divisions, maxLength, tick\n\n if (this.camera instanceof OrthographicCamera) {\n const width = this.camera.right - this.camera.left\n const height = this.camera.bottom - this.camera.top\n\n maxLength = Math.max(width, height)\n tick = maxLength / 20\n\n size = (maxLength / this.camera.zoom) * multiplier\n divisions = (size / tick) * this.camera.zoom\n } else if (this.camera instanceof PerspectiveCamera) {\n const distance = this.camera.position.distanceTo(this._gizmos.position)\n const halfFovV = MathUtils.DEG2RAD * this.camera.fov * 0.5\n const halfFovH = Math.atan(this.camera.aspect * Math.tan(halfFovV))\n\n maxLength = Math.tan(Math.max(halfFovV, halfFovH)) * distance * 2\n tick = maxLength / 20\n\n size = maxLength * multiplier\n divisions = size / tick\n }\n\n if (this._grid == null && this.camera) {\n this._grid = new GridHelper(size, divisions, color, color)\n this._grid.position.copy(this._gizmos.position)\n this._gridPosition.copy(this._grid.position)\n this._grid.quaternion.copy(this.camera.quaternion)\n this._grid.rotateX(Math.PI * 0.5)\n\n this.scene.add(this._grid)\n }\n }\n }\n\n public connect = (domElement: HTMLElement): void => {\n // https://github.com/mrdoob/three.js/issues/20575\n\n if ((domElement as any) === document) {\n console.error(\n 'THREE.ArcballControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.',\n )\n }\n this.domElement = domElement\n // disables touch scroll\n // touch-action needs to be defined for pointer events to work on mobile\n // https://stackoverflow.com/a/48254578\n this.domElement.style.touchAction = 'none'\n this.domElement.addEventListener('contextmenu', this.onContextMenu)\n this.domElement.addEventListener('pointerdown', this.onPointerDown)\n this.domElement.addEventListener('pointercancel', this.onPointerCancel)\n this.domElement.addEventListener('wheel', this.onWheel)\n }\n\n /**\n * Remove all listeners, stop animations and clean scene\n */\n public dispose = (): void => {\n if (this._animationId != -1) {\n window.cancelAnimationFrame(this._animationId)\n }\n\n this.domElement?.removeEventListener('pointerdown', this.onPointerDown)\n this.domElement?.removeEventListener('pointercancel', this.onPointerCancel)\n this.domElement?.removeEventListener('wheel', this.onWheel)\n this.domElement?.removeEventListener('contextmenu', this.onContextMenu)\n\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n window.removeEventListener('resize', this.onWindowResize)\n\n this.scene?.remove(this._gizmos)\n this.disposeGrid()\n }\n\n /**\n * remove the grid from the scene\n */\n private disposeGrid = (): void => {\n if (this._grid && this.scene) {\n this.scene.remove(this._grid)\n this._grid = null\n }\n }\n\n /**\n * Compute the easing out cubic function for ease out effect in animation\n * @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation)\n * @returns {Number} Result of easing out cubic at time t\n */\n private easeOutCubic = (t: number): number => {\n return 1 - Math.pow(1 - t, 3)\n }\n\n /**\n * Make rotation gizmos more or less visible\n * @param {Boolean} isActive If true, make gizmos more visible\n */\n private activateGizmos = (isActive: boolean): void => {\n for (const gizmo of this._gizmos.children) {\n ;(gizmo as Mesh).material.setValues({ opacity: isActive ? 1 : 0.6 })\n }\n }\n\n /**\n * Calculate the cursor position in NDC\n * @param {number} x Cursor horizontal coordinate within the canvas\n * @param {number} y Cursor vertical coordinate within the canvas\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @returns {Vector2} Cursor normalized position inside the canvas\n */\n private getCursorNDC = (cursorX: number, cursorY: number, canvas: HTMLElement): Vector2 => {\n const canvasRect = canvas.getBoundingClientRect()\n this._v2_1.setX(((cursorX - canvasRect.left) / canvasRect.width) * 2 - 1)\n this._v2_1.setY(((canvasRect.bottom - cursorY) / canvasRect.height) * 2 - 1)\n return this._v2_1.clone()\n }\n\n /**\n * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas\n * @param {Number} x Cursor horizontal coordinate within the canvas\n * @param {Number} y Cursor vertical coordinate within the canvas\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @returns {Vector2} Cursor position inside the canvas\n */\n private getCursorPosition = (cursorX: number, cursorY: number, canvas: HTMLElement): Vector2 => {\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas))\n if (this.camera instanceof OrthographicCamera) {\n this._v2_1.x *= (this.camera.right - this.camera.left) * 0.5\n this._v2_1.y *= (this.camera.top - this.camera.bottom) * 0.5\n }\n return this._v2_1.clone()\n }\n\n /**\n * Set the camera to be controlled\n * @param {Camera} camera The virtual camera to be controlled\n */\n private setCamera = (camera: Camera | null): void => {\n if (camera) {\n camera.lookAt(this.target)\n camera.updateMatrix()\n\n //setting state\n if (camera instanceof PerspectiveCamera) {\n this._fov0 = camera.fov\n this._fovState = camera.fov\n }\n\n this._cameraMatrixState0.copy(camera.matrix)\n this._cameraMatrixState.copy(this._cameraMatrixState0)\n this._cameraProjectionState.copy(camera.projectionMatrix)\n this._zoom0 = camera.zoom\n this._zoomState = this._zoom0\n\n this._initialNear = camera.near\n this._nearPos0 = camera.position.distanceTo(this.target) - camera.near\n this._nearPos = this._initialNear\n\n this._initialFar = camera.far\n this._farPos0 = camera.position.distanceTo(this.target) - camera.far\n this._farPos = this._initialFar\n\n this._up0.copy(camera.up)\n this._upState.copy(camera.up)\n\n this.camera = camera\n\n this.camera.updateProjectionMatrix()\n\n //making gizmos\n const tbRadius = this.calculateTbRadius(camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this.target, this._tbRadius)\n }\n }\n\n /**\n * Set gizmos visibility\n * @param {Boolean} value Value of gizmos visibility\n */\n public setGizmosVisible(value: boolean): void {\n this._gizmos.visible = value\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n /**\n * Creates the rotation gizmos matching trackball center and radius\n * @param {Vector3} tbCenter The trackball center\n * @param {number} tbRadius The trackball radius\n */\n private makeGizmos = (tbCenter: Vector3, tbRadius: number): void => {\n // @ts-ignore\n const curve = new EllipseCurve(0, 0, tbRadius, tbRadius)\n const points = curve.getPoints(this._curvePts)\n\n //geometry\n const curveGeometry = new BufferGeometry().setFromPoints(points)\n\n //material\n const curveMaterialX = new LineBasicMaterial({ color: 0xff8080, fog: false, transparent: true, opacity: 0.6 })\n const curveMaterialY = new LineBasicMaterial({ color: 0x80ff80, fog: false, transparent: true, opacity: 0.6 })\n const curveMaterialZ = new LineBasicMaterial({ color: 0x8080ff, fog: false, transparent: true, opacity: 0.6 })\n\n //line\n const gizmoX = new Line(curveGeometry, curveMaterialX)\n const gizmoY = new Line(curveGeometry, curveMaterialY)\n const gizmoZ = new Line(curveGeometry, curveMaterialZ)\n\n const rotation = Math.PI * 0.5\n gizmoX.rotation.x = rotation\n gizmoY.rotation.y = rotation\n\n //setting state\n this._gizmoMatrixState0.identity().setPosition(tbCenter)\n this._gizmoMatrixState.copy(this._gizmoMatrixState0)\n\n if (this.camera && this.camera.zoom != 1) {\n //adapt gizmos size to camera zoom\n const size = 1 / this.camera.zoom\n this._scaleMatrix.makeScale(size, size, size)\n this._translationMatrix.makeTranslation(-tbCenter.x, -tbCenter.y, -tbCenter.z)\n\n this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix)\n this._translationMatrix.makeTranslation(tbCenter.x, tbCenter.y, tbCenter.z)\n this._gizmoMatrixState.premultiply(this._translationMatrix)\n }\n\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n this._gizmos.clear()\n\n this._gizmos.add(gizmoX)\n this._gizmos.add(gizmoY)\n this._gizmos.add(gizmoZ)\n }\n\n /**\n * Perform animation for focus operation\n * @param {Number} time Instant in which this function is called as performance.now()\n * @param {Vector3} point Point of interest for focus operation\n * @param {Matrix4} cameraMatrix Camera matrix\n * @param {Matrix4} gizmoMatrix Gizmos matrix\n */\n private onFocusAnim = (time: number, point: Vector3, cameraMatrix: Matrix4, gizmoMatrix: Matrix4): void => {\n if (this._timeStart == -1) {\n //animation start\n this._timeStart = time\n }\n\n if (this._state == STATE.ANIMATION_FOCUS) {\n const deltaTime = time - this._timeStart\n const animTime = deltaTime / this.focusAnimationTime\n\n this._gizmoMatrixState.copy(gizmoMatrix)\n\n if (animTime >= 1) {\n //animation end\n\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n this.focus(point, this.scaleFactor)\n\n this._timeStart = -1\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n } else {\n const amount = this.easeOutCubic(animTime)\n const size = 1 - amount + this.scaleFactor * amount\n\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n this.focus(point, size, amount)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n const self = this\n this._animationId = window.requestAnimationFrame(function (t) {\n self.onFocusAnim(t, point, cameraMatrix, gizmoMatrix.clone())\n })\n }\n } else {\n //interrupt animation\n\n this._animationId = -1\n this._timeStart = -1\n }\n }\n\n /**\n * Perform animation for rotation operation\n * @param {Number} time Instant in which this function is called as performance.now()\n * @param {Vector3} rotationAxis Rotation axis\n * @param {number} w0 Initial angular velocity\n */\n private onRotationAnim = (time: number, rotationAxis: Vector3, w0: number): void => {\n if (this._timeStart == -1) {\n //animation start\n this._anglePrev = 0\n this._angleCurrent = 0\n this._timeStart = time\n }\n\n if (this._state == STATE.ANIMATION_ROTATE) {\n //w = w0 + alpha * t\n const deltaTime = (time - this._timeStart) / 1000\n const w = w0 + -this.dampingFactor * deltaTime\n\n if (w > 0) {\n //tetha = 0.5 * alpha * t^2 + w0 * t + tetha0\n this._angleCurrent = 0.5 * -this.dampingFactor * Math.pow(deltaTime, 2) + w0 * deltaTime + 0\n this.applyTransformMatrix(this.rotate(rotationAxis, this._angleCurrent))\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n const self = this\n this._animationId = window.requestAnimationFrame(function (t) {\n self.onRotationAnim(t, rotationAxis, w0)\n })\n } else {\n this._animationId = -1\n this._timeStart = -1\n\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n } else {\n //interrupt animation\n\n this._animationId = -1\n this._timeStart = -1\n\n if (this._state != STATE.ROTATE) {\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n }\n\n /**\n * Perform pan operation moving camera between two points\n * @param {Vector3} p0 Initial point\n * @param {Vector3} p1 Ending point\n * @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)\n */\n private pan = (p0: Vector3, p1: Vector3, adjust = false): Transformation => {\n if (this.camera) {\n const movement = p0.clone().sub(p1)\n\n if (this.camera instanceof OrthographicCamera) {\n //adjust movement amount\n movement.multiplyScalar(1 / this.camera.zoom)\n }\n\n if (this.camera instanceof PerspectiveCamera && adjust) {\n //adjust movement amount\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState0) //camera's initial position\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0) //gizmo's initial position\n const distanceFactor =\n this._v3_1.distanceTo(this._v3_2) / this.camera.position.distanceTo(this._gizmos.position)\n movement.multiplyScalar(1 / distanceFactor)\n }\n\n this._v3_1.set(movement.x, movement.y, 0).applyQuaternion(this.camera.quaternion)\n\n this._m4_1.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z)\n\n this.setTransformationMatrices(this._m4_1, this._m4_1)\n }\n return _transformation\n }\n\n /**\n * Reset trackball\n */\n public reset = (): void => {\n if (this.camera) {\n this.camera.zoom = this._zoom0\n\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.fov = this._fov0\n }\n\n this.camera.near = this._nearPos\n this.camera.far = this._farPos\n this._cameraMatrixState.copy(this._cameraMatrixState0)\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n this.camera.up.copy(this._up0)\n\n this.camera.updateMatrix()\n this.camera.updateProjectionMatrix()\n\n this._gizmoMatrixState.copy(this._gizmoMatrixState0)\n this._gizmoMatrixState0.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n this._gizmos.updateMatrix()\n\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this._gizmos.position, this._tbRadius)\n\n this.camera.lookAt(this._gizmos.position)\n\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n /**\n * Rotate the camera around an axis passing by trackball's center\n * @param {Vector3} axis Rotation axis\n * @param {number} angle Angle in radians\n * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera\n */\n private rotate = (axis: Vector3, angle: number): Transformation => {\n const point = this._gizmos.position //rotation center\n this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z)\n this._rotationMatrix.makeRotationAxis(axis, -angle)\n\n //rotate camera\n this._m4_1.makeTranslation(point.x, point.y, point.z)\n this._m4_1.multiply(this._rotationMatrix)\n this._m4_1.multiply(this._translationMatrix)\n\n this.setTransformationMatrices(this._m4_1)\n\n return _transformation\n }\n\n public copyState = (): void => {\n if (this.camera) {\n const state = JSON.stringify(\n this.camera instanceof OrthographicCamera\n ? {\n arcballState: {\n cameraFar: this.camera.far,\n cameraMatrix: this.camera.matrix,\n cameraNear: this.camera.near,\n cameraUp: this.camera.up,\n cameraZoom: this.camera.zoom,\n gizmoMatrix: this._gizmos.matrix,\n },\n }\n : {\n arcballState: {\n cameraFar: this.camera.far,\n cameraFov: this.camera.fov,\n cameraMatrix: this.camera.matrix,\n cameraNear: this.camera.near,\n cameraUp: this.camera.up,\n cameraZoom: this.camera.zoom,\n gizmoMatrix: this._gizmos.matrix,\n },\n },\n )\n\n navigator.clipboard.writeText(state)\n }\n }\n\n public pasteState = (): void => {\n const self = this\n navigator.clipboard.readText().then(function resolved(value) {\n self.setStateFromJSON(value)\n })\n }\n\n /**\n * Save the current state of the control. This can later be recovered with .reset\n */\n public saveState = (): void => {\n if (!this.camera) return\n\n this._cameraMatrixState0.copy(this.camera.matrix)\n this._gizmoMatrixState0.copy(this._gizmos.matrix)\n this._nearPos = this.camera.near\n this._farPos = this.camera.far\n this._zoom0 = this.camera.zoom\n this._up0.copy(this.camera.up)\n\n if (this.camera instanceof PerspectiveCamera) {\n this._fov0 = this.camera.fov\n }\n }\n\n /**\n * Perform uniform scale operation around a given point\n * @param {Number} size Scale factor\n * @param {Vector3} point Point around which scale\n * @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only)\n * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos\n */\n private applyScale = (size: number, point: Vector3, scaleGizmos = true): Transformation | undefined => {\n if (!this.camera) return\n\n const scalePoint = point.clone()\n let sizeInverse = 1 / size\n\n if (this.camera instanceof OrthographicCamera) {\n //camera zoom\n this.camera.zoom = this._zoomState\n this.camera.zoom *= size\n\n //check min and max zoom\n if (this.camera.zoom > this.maxZoom) {\n this.camera.zoom = this.maxZoom\n sizeInverse = this._zoomState / this.maxZoom\n } else if (this.camera.zoom < this.minZoom) {\n this.camera.zoom = this.minZoom\n sizeInverse = this._zoomState / this.minZoom\n }\n\n this.camera.updateProjectionMatrix()\n\n this._v3_1.setFromMatrixPosition(this._gizmoMatrixState) //gizmos position\n\n //scale gizmos so they appear in the same spot having the same dimension\n this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse)\n this._translationMatrix.makeTranslation(-this._v3_1.x, -this._v3_1.y, -this._v3_1.z)\n\n this._m4_2.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z).multiply(this._scaleMatrix)\n this._m4_2.multiply(this._translationMatrix)\n\n //move camera and gizmos to obtain pinch effect\n scalePoint.sub(this._v3_1)\n\n const amount = scalePoint.clone().multiplyScalar(sizeInverse)\n scalePoint.sub(amount)\n\n this._m4_1.makeTranslation(scalePoint.x, scalePoint.y, scalePoint.z)\n this._m4_2.premultiply(this._m4_1)\n\n this.setTransformationMatrices(this._m4_1, this._m4_2)\n return _transformation\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n\n //move camera\n let distance = this._v3_1.distanceTo(scalePoint)\n let amount = distance - distance * sizeInverse\n\n //check min and max distance\n const newDistance = distance - amount\n if (newDistance < this.minDistance) {\n sizeInverse = this.minDistance / distance\n amount = distance - distance * sizeInverse\n } else if (newDistance > this.maxDistance) {\n sizeInverse = this.maxDistance / distance\n amount = distance - distance * sizeInverse\n }\n\n let direction = scalePoint.clone().sub(this._v3_1).normalize().multiplyScalar(amount)\n\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z)\n\n if (scaleGizmos) {\n //scale gizmos so they appear in the same spot having the same dimension\n const pos = this._v3_2\n\n distance = pos.distanceTo(scalePoint)\n amount = distance - distance * sizeInverse\n direction = scalePoint.clone().sub(this._v3_2).normalize().multiplyScalar(amount)\n\n this._translationMatrix.makeTranslation(pos.x, pos.y, pos.z)\n this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse)\n\n this._m4_2.makeTranslation(direction.x, direction.y, direction.z).multiply(this._translationMatrix)\n this._m4_2.multiply(this._scaleMatrix)\n\n this._translationMatrix.makeTranslation(-pos.x, -pos.y, -pos.z)\n\n this._m4_2.multiply(this._translationMatrix)\n this.setTransformationMatrices(this._m4_1, this._m4_2)\n } else {\n this.setTransformationMatrices(this._m4_1)\n }\n\n return _transformation\n }\n }\n\n /**\n * Set camera fov\n * @param {Number} value fov to be setted\n */\n private setFov = (value: number): void => {\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.fov = MathUtils.clamp(value, this.minFov, this.maxFov)\n this.camera.updateProjectionMatrix()\n }\n }\n\n /**\n * Set the trackball's center point\n * @param {Number} x X coordinate\n * @param {Number} y Y coordinate\n * @param {Number} z Z coordinate\n */\n public setTarget = (x: number, y: number, z: number): void => {\n if (this.camera) {\n this.target.set(x, y, z)\n this._gizmos.position.set(x, y, z) //for correct radius calculation\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this.target, this._tbRadius)\n this.camera.lookAt(this.target)\n }\n }\n\n /**\n * Set values in transformation object\n * @param {Matrix4} camera Transformation to be applied to the camera\n * @param {Matrix4} gizmos Transformation to be applied to gizmos\n */\n private setTransformationMatrices(camera: Matrix4 | null = null, gizmos: Matrix4 | null = null): void {\n if (camera) {\n if (_transformation.camera) {\n _transformation.camera.copy(camera)\n } else {\n _transformation.camera = camera.clone()\n }\n } else {\n _transformation.camera = null\n }\n\n if (gizmos) {\n if (_transformation.gizmos) {\n _transformation.gizmos.copy(gizmos)\n } else {\n _transformation.gizmos = gizmos.clone()\n }\n } else {\n _transformation.gizmos = null\n }\n }\n\n /**\n * Rotate camera around its direction axis passing by a given point by a given angle\n * @param {Vector3} point The point where the rotation axis is passing trough\n * @param {Number} angle Angle in radians\n * @returns The computed transormation matix\n */\n private zRotate = (point: Vector3, angle: number): Transformation => {\n this._rotationMatrix.makeRotationAxis(this._rotationAxis, angle)\n this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z)\n\n this._m4_1.makeTranslation(point.x, point.y, point.z)\n this._m4_1.multiply(this._rotationMatrix)\n this._m4_1.multiply(this._translationMatrix)\n\n this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(point) //vector from rotation center to gizmos position\n this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis, angle) //apply rotation\n this._v3_2.sub(this._v3_1)\n\n this._m4_2.makeTranslation(this._v3_2.x, this._v3_2.y, this._v3_2.z)\n\n this.setTransformationMatrices(this._m4_1, this._m4_2)\n return _transformation\n }\n\n /**\n * Unproject the cursor on the 3D object surface\n * @param {Vector2} cursor Cursor coordinates in NDC\n * @param {Camera} camera Virtual camera\n * @returns {Vector3} The point of intersection with the model, if exist, null otherwise\n */\n private unprojectOnObj = (cursor: Vector2, camera: Camera): Vector3 | null => {\n if (!this.scene) return null\n\n const raycaster = new Raycaster()\n raycaster.near = camera.near\n raycaster.far = camera.far\n raycaster.setFromCamera(cursor, camera)\n\n const intersect = raycaster.intersectObjects(this.scene.children, true)\n for (let i = 0; i < intersect.length; i++) {\n if (intersect[i].object.uuid != this._gizmos.uuid && intersect[i].face) {\n return intersect[i].point.clone()\n }\n }\n\n return null\n }\n\n /**\n * Unproject the cursor on the trackball surface\n * @param {Camera} camera The virtual camera\n * @param {Number} cursorX Cursor horizontal coordinate on screen\n * @param {Number} cursorY Cursor vertical coordinate on screen\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @param {number} tbRadius The trackball radius\n * @returns {Vector3} The unprojected point on the trackball surface\n */\n private unprojectOnTbSurface = (\n camera: Camera,\n cursorX: number,\n cursorY: number,\n canvas: HTMLElement,\n tbRadius: number,\n ): Vector3 | undefined => {\n if (camera instanceof OrthographicCamera) {\n this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas))\n this._v3_1.set(this._v2_1.x, this._v2_1.y, 0)\n\n const x2 = Math.pow(this._v2_1.x, 2)\n const y2 = Math.pow(this._v2_1.y, 2)\n const r2 = Math.pow(this._tbRadius, 2)\n\n if (x2 + y2 <= r2 * 0.5) {\n //intersection with sphere\n this._v3_1.setZ(Math.sqrt(r2 - (x2 + y2)))\n } else {\n //intersection with hyperboloid\n this._v3_1.setZ((r2 * 0.5) / Math.sqrt(x2 + y2))\n }\n\n return this._v3_1\n }\n\n if (camera instanceof PerspectiveCamera) {\n //unproject cursor on the near plane\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas))\n\n this._v3_1.set(this._v2_1.x, this._v2_1.y, -1)\n this._v3_1.applyMatrix4(camera.projectionMatrixInverse)\n\n const rayDir = this._v3_1.clone().normalize() //unprojected ray direction\n const cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position)\n const radius2 = Math.pow(tbRadius, 2)\n\n //\t camera\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\th\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t_ _ | _ _ _\\ _ _ near plane\n //\t\t\tl\n\n const h = this._v3_1.z\n const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2))\n\n if (l == 0) {\n //ray aligned with camera\n rayDir.set(this._v3_1.x, this._v3_1.y, tbRadius)\n return rayDir\n }\n\n const m = h / l\n const q = cameraGizmoDistance\n\n /*\n * calculate intersection point between unprojected ray and trackball surface\n *|y = m * x + q\n *|x^2 + y^2 = r^2\n *\n * (m^2 + 1) * x^2 + (2 * m * q) * x + q^2 - r^2 = 0\n */\n let a = Math.pow(m, 2) + 1\n let b = 2 * m * q\n let c = Math.pow(q, 2) - radius2\n let delta = Math.pow(b, 2) - 4 * a * c\n\n if (delta >= 0) {\n //intersection with sphere\n this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a))\n this._v2_1.setY(m * this._v2_1.x + q)\n\n const angle = MathUtils.RAD2DEG * this._v2_1.angle()\n\n if (angle >= 45) {\n //if angle between intersection point and X' axis is >= 45°, return that point\n //otherwise, calculate intersection point with hyperboloid\n\n const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2))\n rayDir.multiplyScalar(rayLength)\n rayDir.z += cameraGizmoDistance\n return rayDir\n }\n }\n\n //intersection with hyperboloid\n /*\n *|y = m * x + q\n *|y = (1 / x) * (r^2 / 2)\n *\n * m * x^2 + q * x - r^2 / 2 = 0\n */\n\n a = m\n b = q\n c = -radius2 * 0.5\n delta = Math.pow(b, 2) - 4 * a * c\n this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a))\n this._v2_1.setY(m * this._v2_1.x + q)\n\n const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2))\n\n rayDir.multiplyScalar(rayLength)\n rayDir.z += cameraGizmoDistance\n return rayDir\n }\n }\n\n /**\n * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera\n * @param {Camera} camera The virtual camera\n * @param {Number} cursorX Cursor horizontal coordinate on screen\n * @param {Number} cursorY Cursor vertical coordinate on screen\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only)\n * @returns {Vector3} The unprojected point on the trackball plane\n */\n private unprojectOnTbPlane = (\n camera: Camera,\n cursorX: number,\n cursorY: number,\n canvas: HTMLElement,\n initialDistance = false,\n ): Vector3 | undefined => {\n if (camera instanceof OrthographicCamera) {\n this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas))\n this._v3_1.set(this._v2_1.x, this._v2_1.y, 0)\n\n return this._v3_1.clone()\n }\n\n if (camera instanceof PerspectiveCamera) {\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas))\n\n //unproject cursor on the near plane\n this._v3_1.set(this._v2_1.x, this._v2_1.y, -1)\n this._v3_1.applyMatrix4(camera.projectionMatrixInverse)\n\n const rayDir = this._v3_1.clone().normalize() //unprojected ray direction\n\n //\t camera\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\th\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t_ _ | _ _ _\\ _ _ near plane\n //\t\t\tl\n\n const h = this._v3_1.z\n const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2))\n let cameraGizmoDistance\n\n if (initialDistance) {\n cameraGizmoDistance = this._v3_1\n .setFromMatrixPosition(this._cameraMatrixState0)\n .distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0))\n } else {\n cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position)\n }\n\n /*\n * calculate intersection point between unprojected ray and the plane\n *|y = mx + q\n *|y = 0\n *\n * x = -q/m\n */\n if (l == 0) {\n //ray aligned with camera\n rayDir.set(0, 0, 0)\n return rayDir\n }\n\n const m = h / l\n const q = cameraGizmoDistance\n const x = -q / m\n\n const rayLength = Math.sqrt(Math.pow(q, 2) + Math.pow(x, 2))\n rayDir.multiplyScalar(rayLength)\n rayDir.z = 0\n return rayDir\n }\n }\n\n /**\n * Update camera and gizmos state\n */\n private updateMatrixState = (): void => {\n if (!this.camera) return\n\n //update camera and gizmos state\n this._cameraMatrixState.copy(this.camera.matrix)\n this._gizmoMatrixState.copy(this._gizmos.matrix)\n\n if (this.camera instanceof OrthographicCamera) {\n this._cameraProjectionState.copy(this.camera.projectionMatrix)\n this.camera.updateProjectionMatrix()\n this._zoomState = this.camera.zoom\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n this._fovState = this.camera.fov\n }\n }\n\n /**\n * Update the trackball FSA\n * @param {STATE} newState New state of the FSA\n * @param {Boolean} updateMatrices If matriices state should be updated\n */\n private updateTbState = (newState: Symbol, updateMatrices: boolean): void => {\n this._state = newState\n if (updateMatrices) {\n this.updateMatrixState()\n }\n }\n\n public update = (): void => {\n const EPS = 0.000001\n\n // Update target and gizmos state\n if (!this.target.equals(this._currentTarget) && this.camera) {\n this._gizmos.position.set(this.target.x, this.target.y, this.target.z) //for correct radius calculation\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this.target, this._tbRadius)\n this._currentTarget.copy(this.target)\n }\n\n if (!this.camera) return\n\n //check min/max parameters\n if (this.camera instanceof OrthographicCamera) {\n //check zoom\n if (this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom) {\n const newZoom = MathUtils.clamp(this.camera.zoom, this.minZoom, this.maxZoom)\n this.applyTransformMatrix(this.applyScale(newZoom / this.camera.zoom, this._gizmos.position, true))\n }\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n //check distance\n const distance = this.camera.position.distanceTo(this._gizmos.position)\n\n if (distance > this.maxDistance + EPS || distance < this.minDistance - EPS) {\n const newDistance = MathUtils.clamp(distance, this.minDistance, this.maxDistance)\n this.applyTransformMatrix(this.applyScale(newDistance / distance, this._gizmos.position))\n this.updateMatrixState()\n }\n\n //check fov\n if (this.camera.fov < this.minFov || this.camera.fov > this.maxFov) {\n this.camera.fov = MathUtils.clamp(this.camera.fov, this.minFov, this.maxFov)\n this.camera.updateProjectionMatrix()\n }\n\n const oldRadius = this._tbRadius\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n\n if (oldRadius < this._tbRadius - EPS || oldRadius > this._tbRadius + EPS) {\n const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3\n const newRadius = this._tbRadius / scale\n // @ts-ignore\n const curve = new EllipseCurve(0, 0, newRadius, newRadius)\n const points = curve.getPoints(this._curvePts)\n const curveGeometry = new BufferGeometry().setFromPoints(points)\n\n for (const gizmo in this._gizmos.children) {\n const child = this._gizmos.children[gizmo] as Mesh\n child.geometry = curveGeometry\n }\n }\n }\n\n this.camera.lookAt(this._gizmos.position)\n }\n\n private setStateFromJSON = (json: string): void => {\n const state = JSON.parse(json)\n\n if (state.arcballState && this.camera) {\n this._cameraMatrixState.fromArray(state.arcballState.cameraMatrix.elements)\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n\n this.camera.up.copy(state.arcballState.cameraUp)\n this.camera.near = state.arcballState.cameraNear\n this.camera.far = state.arcballState.cameraFar\n\n this.camera.zoom = state.arcballState.cameraZoom\n\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.fov = state.arcballState.cameraFov\n }\n\n this._gizmoMatrixState.fromArray(state.arcballState.gizmoMatrix.elements)\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n this.camera.updateMatrix()\n this.camera.updateProjectionMatrix()\n\n this._gizmos.updateMatrix()\n\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n const gizmoTmp = new Matrix4().copy(this._gizmoMatrixState0)\n this.makeGizmos(this._gizmos.position, this._tbRadius)\n this._gizmoMatrixState0.copy(gizmoTmp)\n\n this.camera.lookAt(this._gizmos.position)\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n}\n\nexport { ArcballControls }\n", "import { OrthographicCamera, PlaneGeometry, Mesh, Material, Renderer, WebGLRenderer, WebGLRenderTarget } from 'three'\n\nclass Pass {\n // if set to true, the pass is processed by the composer\n public enabled = true\n\n // if set to true, the pass indicates to swap read and write buffer after rendering\n public needsSwap = true\n\n // if set to true, the pass clears its buffer before rendering\n public clear = false\n\n // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.\n public renderToScreen = false\n\n public setSize(width: number, height: number): void {}\n\n public render(\n renderer: WebGLRenderer,\n writeBuffer: WebGLRenderTarget,\n readBuffer: WebGLRenderTarget,\n deltaTime: number,\n maskActive?: unknown,\n ): void {\n console.error('THREE.Pass: .render() must be implemented in derived pass.')\n }\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\nclass FullScreenQuad {\n public camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1)\n public geometry = new PlaneGeometry(2, 2)\n private mesh: Mesh\n\n constructor(material: TMaterial) {\n this.mesh = new Mesh(this.geometry, material)\n }\n\n public get material(): TMaterial {\n return this.mesh.material\n }\n\n public set material(value: TMaterial) {\n this.mesh.material = value\n }\n\n public dispose(): void {\n this.mesh.geometry.dispose()\n }\n\n public render(renderer: Renderer): void {\n renderer.render(this.mesh, this.camera)\n }\n}\n\nexport { Pass, FullScreenQuad }\n", "export const DigitalGlitch = {\n uniforms: {\n tDiffuse: { value: null }, //diffuse texture\n tDisp: { value: null }, //displacement texture for digital glitch squares\n byp: { value: 0 }, //apply the glitch ?\n amount: { value: 0.08 },\n angle: { value: 0.02 },\n seed: { value: 0.02 },\n seed_x: { value: 0.02 }, //-1,1\n seed_y: { value: 0.02 }, //-1,1\n distortion_x: { value: 0.5 },\n distortion_y: { value: 0.6 },\n col_s: { value: 0.05 },\n },\n\n vertexShader: `varying vec2 vUv;\n void main() {\n \t vUv = uv;\n \t gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }`,\n\n fragmentShader: `uniform int byp; //should we apply the glitch ?\n uniform sampler2D tDiffuse;\n uniform sampler2D tDisp;\n uniform float amount;\n uniform float angle;\n uniform float seed;\n uniform float seed_x;\n uniform float seed_y;\n uniform float distortion_x;\n uniform float distortion_y;\n uniform float col_s;\n\n varying vec2 vUv;\n\n float rand(vec2 co){\n \t return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n void main() {\n \tif(byp<1) {\n \t\tvec2 p = vUv;\n \t\tfloat xs = floor(gl_FragCoord.x / 0.5);\n \t\tfloat ys = floor(gl_FragCoord.y / 0.5);\n //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch\n \t\tvec4 normal = texture2D (tDisp, p*seed*seed);\n \t\tif(p.ydistortion_x-col_s*seed) {\n \t\t\tif(seed_x>0.){\n \t\t\t\tp.y = 1. - (p.y + distortion_y);\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.y = distortion_y;\n \t\t\t}\n \t\t}\n \t\tif(p.xdistortion_y-col_s*seed) {\n \t\t\tif(seed_y>0.){\n \t\t\t\tp.x=distortion_x;\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.x = 1. - (p.x + distortion_x);\n \t\t\t}\n \t\t}\n \t\tp.x+=normal.x*seed_x*(seed/5.);\n \t\tp.y+=normal.y*seed_y*(seed/5.);\n //base from RGB shift shader\n \t\tvec2 offset = amount * vec2( cos(angle), sin(angle));\n \t\tvec4 cr = texture2D(tDiffuse, p + offset);\n \t\tvec4 cga = texture2D(tDiffuse, p);\n \t\tvec4 cb = texture2D(tDiffuse, p - offset);\n \t\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\n //add noise\n \t\tvec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);\n \t\tgl_FragColor = gl_FragColor+ snow;\n \t}\n \telse {\n \t\tgl_FragColor=texture2D (tDiffuse, vUv);\n \t}\n }`,\n}\n", "/**\n * RGB Halftone shader for three.js.\n *\tNOTE:\n * \t\tShape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square)\n *\t\tBlending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker)\n */\n\nexport const HalftoneShader = {\n uniforms: {\n tDiffuse: { value: null },\n shape: { value: 1 },\n radius: { value: 4 },\n rotateR: { value: (Math.PI / 12) * 1 },\n rotateG: { value: (Math.PI / 12) * 2 },\n rotateB: { value: (Math.PI / 12) * 3 },\n scatter: { value: 0 },\n width: { value: 1 },\n height: { value: 1 },\n blending: { value: 1 },\n blendingMode: { value: 1 },\n greyscale: { value: false },\n disable: { value: false },\n },\n\n vertexShader: [\n 'varying vec2 vUV;',\n\n 'void main() {',\n\n '\tvUV = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define SQRT2_MINUS_ONE 0.41421356',\n '#define SQRT2_HALF_MINUS_ONE 0.20710678',\n '#define PI2 6.28318531',\n '#define SHAPE_DOT 1',\n '#define SHAPE_ELLIPSE 2',\n '#define SHAPE_LINE 3',\n '#define SHAPE_SQUARE 4',\n '#define BLENDING_LINEAR 1',\n '#define BLENDING_MULTIPLY 2',\n '#define BLENDING_ADD 3',\n '#define BLENDING_LIGHTER 4',\n '#define BLENDING_DARKER 5',\n 'uniform sampler2D tDiffuse;',\n 'uniform float radius;',\n 'uniform float rotateR;',\n 'uniform float rotateG;',\n 'uniform float rotateB;',\n 'uniform float scatter;',\n 'uniform float width;',\n 'uniform float height;',\n 'uniform int shape;',\n 'uniform bool disable;',\n 'uniform float blending;',\n 'uniform int blendingMode;',\n 'varying vec2 vUV;',\n 'uniform bool greyscale;',\n 'const int samples = 8;',\n\n 'float blend( float a, float b, float t ) {',\n\n // linear blend\n '\treturn a * ( 1.0 - t ) + b * t;',\n\n '}',\n\n 'float hypot( float x, float y ) {',\n\n // vector magnitude\n '\treturn sqrt( x * x + y * y );',\n\n '}',\n\n 'float rand( vec2 seed ){',\n\n // get pseudo-random number\n 'return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );',\n\n '}',\n\n 'float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {',\n\n // apply shape-specific transforms\n '\tfloat dist = hypot( coord.x - p.x, coord.y - p.y );',\n '\tfloat rad = channel;',\n\n '\tif ( shape == SHAPE_DOT ) {',\n\n '\t\trad = pow( abs( rad ), 1.125 ) * rad_max;',\n\n '\t} else if ( shape == SHAPE_ELLIPSE ) {',\n\n '\t\trad = pow( abs( rad ), 1.125 ) * rad_max;',\n\n '\t\tif ( dist != 0.0 ) {',\n '\t\t\tfloat dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );',\n '\t\t\tdist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;',\n '\t\t}',\n\n '\t} else if ( shape == SHAPE_LINE ) {',\n\n '\t\trad = pow( abs( rad ), 1.5) * rad_max;',\n '\t\tfloat dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;',\n '\t\tdist = hypot( normal.x * dot_p, normal.y * dot_p );',\n\n '\t} else if ( shape == SHAPE_SQUARE ) {',\n\n '\t\tfloat theta = atan( p.y - coord.y, p.x - coord.x ) - angle;',\n '\t\tfloat sin_t = abs( sin( theta ) );',\n '\t\tfloat cos_t = abs( cos( theta ) );',\n '\t\trad = pow( abs( rad ), 1.4 );',\n '\t\trad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );',\n\n '\t}',\n\n '\treturn rad - dist;',\n\n '}',\n\n 'struct Cell {',\n\n // grid sample positions\n '\tvec2 normal;',\n '\tvec2 p1;',\n '\tvec2 p2;',\n '\tvec2 p3;',\n '\tvec2 p4;',\n '\tfloat samp2;',\n '\tfloat samp1;',\n '\tfloat samp3;',\n '\tfloat samp4;',\n\n '};',\n\n 'vec4 getSample( vec2 point ) {',\n\n // multi-sampled point\n '\tvec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );',\n '\tfloat base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;',\n '\tfloat step = PI2 / float( samples );',\n '\tfloat dist = radius * 0.66;',\n\n '\tfor ( int i = 0; i < samples; ++i ) {',\n\n '\t\tfloat r = base + step * float( i );',\n '\t\tvec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );',\n '\t\ttex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );',\n\n '\t}',\n\n '\ttex /= float( samples ) + 1.0;',\n '\treturn tex;',\n\n '}',\n\n 'float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {',\n\n // get colour for given point\n '\tfloat dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;',\n\n '\tif ( channel == 0 ) {',\n\n '\t\tc.samp1 = getSample( c.p1 ).r;',\n '\t\tc.samp2 = getSample( c.p2 ).r;',\n '\t\tc.samp3 = getSample( c.p3 ).r;',\n '\t\tc.samp4 = getSample( c.p4 ).r;',\n\n '\t} else if (channel == 1) {',\n\n '\t\tc.samp1 = getSample( c.p1 ).g;',\n '\t\tc.samp2 = getSample( c.p2 ).g;',\n '\t\tc.samp3 = getSample( c.p3 ).g;',\n '\t\tc.samp4 = getSample( c.p4 ).g;',\n\n '\t} else {',\n\n '\t\tc.samp1 = getSample( c.p1 ).b;',\n '\t\tc.samp3 = getSample( c.p3 ).b;',\n '\t\tc.samp2 = getSample( c.p2 ).b;',\n '\t\tc.samp4 = getSample( c.p4 ).b;',\n\n '\t}',\n\n '\tdist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );',\n '\tdist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );',\n '\tdist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );',\n '\tdist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );',\n '\tres = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres = clamp( res, 0.0, 1.0 );',\n\n '\treturn res;',\n\n '}',\n\n 'Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {',\n\n // get containing cell\n '\tCell c;',\n\n // calc grid\n '\tvec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );',\n '\tfloat threshold = step * 0.5;',\n '\tfloat dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );',\n '\tfloat dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );',\n '\tvec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );',\n '\tfloat offset_normal = mod( hypot( offset.x, offset.y ), step );',\n '\tfloat normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;',\n '\tfloat normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;',\n '\tfloat offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );',\n '\tfloat line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;',\n '\tfloat line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;',\n\n // get closest corner\n '\tc.normal = n;',\n '\tc.p1.x = p.x - n.x * normal_scale + n.y * line_scale;',\n '\tc.p1.y = p.y - n.y * normal_scale - n.x * line_scale;',\n\n // scatter\n '\tif ( scatter != 0.0 ) {',\n\n '\t\tfloat off_mag = scatter * threshold * 0.5;',\n '\t\tfloat off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;',\n '\t\tc.p1.x += cos( off_angle ) * off_mag;',\n '\t\tc.p1.y += sin( off_angle ) * off_mag;',\n\n '\t}',\n\n // find corners\n '\tfloat normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );',\n '\tfloat line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );',\n '\tc.p2.x = c.p1.x - n.x * normal_step;',\n '\tc.p2.y = c.p1.y - n.y * normal_step;',\n '\tc.p3.x = c.p1.x + n.y * line_step;',\n '\tc.p3.y = c.p1.y - n.x * line_step;',\n '\tc.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;',\n '\tc.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;',\n\n '\treturn c;',\n\n '}',\n\n 'float blendColour( float a, float b, float t ) {',\n\n // blend colours\n '\tif ( blendingMode == BLENDING_LINEAR ) {',\n '\t\treturn blend( a, b, 1.0 - t );',\n '\t} else if ( blendingMode == BLENDING_ADD ) {',\n '\t\treturn blend( a, min( 1.0, a + b ), t );',\n '\t} else if ( blendingMode == BLENDING_MULTIPLY ) {',\n '\t\treturn blend( a, max( 0.0, a * b ), t );',\n '\t} else if ( blendingMode == BLENDING_LIGHTER ) {',\n '\t\treturn blend( a, max( a, b ), t );',\n '\t} else if ( blendingMode == BLENDING_DARKER ) {',\n '\t\treturn blend( a, min( a, b ), t );',\n '\t} else {',\n '\t\treturn blend( a, b, 1.0 - t );',\n '\t}',\n\n '}',\n\n 'void main() {',\n\n '\tif ( ! disable ) {',\n\n // setup\n '\t\tvec2 p = vec2( vUV.x * width, vUV.y * height );',\n '\t\tvec2 origin = vec2( 0, 0 );',\n '\t\tfloat aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;',\n\n // get channel samples\n '\t\tCell cell_r = getReferenceCell( p, origin, rotateR, radius );',\n '\t\tCell cell_g = getReferenceCell( p, origin, rotateG, radius );',\n '\t\tCell cell_b = getReferenceCell( p, origin, rotateB, radius );',\n '\t\tfloat r = getDotColour( cell_r, p, 0, rotateR, aa );',\n '\t\tfloat g = getDotColour( cell_g, p, 1, rotateG, aa );',\n '\t\tfloat b = getDotColour( cell_b, p, 2, rotateB, aa );',\n\n // blend with original\n '\t\tvec4 colour = texture2D( tDiffuse, vUV );',\n '\t\tr = blendColour( r, colour.r, blending );',\n '\t\tg = blendColour( g, colour.g, blending );',\n '\t\tb = blendColour( b, colour.b, blending );',\n\n '\t\tif ( greyscale ) {',\n '\t\t\tr = g = b = (r + b + g) / 3.0;',\n '\t\t}',\n\n '\t\tgl_FragColor = vec4( r, g, b, 1.0 );',\n\n '\t} else {',\n\n '\t\tgl_FragColor = texture2D( tDiffuse, vUV );',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * WebGL port of Subpixel Morphological Antialiasing (SMAA) v2.8\n * Preset: SMAA 1x Medium (with color edge detection)\n * https://github.com/iryoku/smaa/releases/tag/v2.8\n */\n\nexport const SMAAEdgesShader = {\n defines: {\n SMAA_THRESHOLD: '0.1',\n },\n\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 3 ];',\n\n 'void SMAAEdgeDetectionVS( vec2 texcoord ) {',\n '\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );', // WebGL port note: Changed sign in W component\n '\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );', // WebGL port note: Changed sign in W component\n '\tvOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );', // WebGL port note: Changed sign in W component\n '}',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tSMAAEdgeDetectionVS( vUv );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 3 ];',\n\n 'vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {',\n '\tvec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );',\n\n // Calculate color deltas:\n '\tvec4 delta;',\n '\tvec3 C = texture2D( colorTex, texcoord ).rgb;',\n\n '\tvec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;',\n '\tvec3 t = abs( C - Cleft );',\n '\tdelta.x = max( max( t.r, t.g ), t.b );',\n\n '\tvec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;',\n '\tt = abs( C - Ctop );',\n '\tdelta.y = max( max( t.r, t.g ), t.b );',\n\n // We do the usual threshold:\n '\tvec2 edges = step( threshold, delta.xy );',\n\n // Then discard if there is no edge:\n '\tif ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )',\n '\t\tdiscard;',\n\n // Calculate right and bottom deltas:\n '\tvec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;',\n '\tt = abs( C - Cright );',\n '\tdelta.z = max( max( t.r, t.g ), t.b );',\n\n '\tvec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;',\n '\tt = abs( C - Cbottom );',\n '\tdelta.w = max( max( t.r, t.g ), t.b );',\n\n // Calculate the maximum delta in the direct neighborhood:\n '\tfloat maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );',\n\n // Calculate left-left and top-top deltas:\n '\tvec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;',\n '\tt = abs( C - Cleftleft );',\n '\tdelta.z = max( max( t.r, t.g ), t.b );',\n\n '\tvec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;',\n '\tt = abs( C - Ctoptop );',\n '\tdelta.w = max( max( t.r, t.g ), t.b );',\n\n // Calculate the final maximum delta:\n '\tmaxDelta = max( max( maxDelta, delta.z ), delta.w );',\n\n // Local contrast adaptation in action:\n '\tedges.xy *= step( 0.5 * maxDelta, delta.xy );',\n\n '\treturn vec4( edges, 0.0, 0.0 );',\n '}',\n\n 'void main() {',\n\n '\tgl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SMAAWeightsShader = {\n defines: {\n SMAA_MAX_SEARCH_STEPS: '8',\n SMAA_AREATEX_MAX_DISTANCE: '16',\n SMAA_AREATEX_PIXEL_SIZE: '( 1.0 / vec2( 160.0, 560.0 ) )',\n SMAA_AREATEX_SUBTEX_SIZE: '( 1.0 / 7.0 )',\n },\n\n uniforms: {\n tDiffuse: { value: null },\n tArea: { value: null },\n tSearch: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 3 ];',\n 'varying vec2 vPixcoord;',\n\n 'void SMAABlendingWeightCalculationVS( vec2 texcoord ) {',\n '\tvPixcoord = texcoord / resolution;',\n\n // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n '\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );', // WebGL port note: Changed sign in Y and W components\n '\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );', // WebGL port note: Changed sign in Y and W components\n\n // And these for the searches, they indicate the ends of the loops:\n '\tvOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );',\n\n '}',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tSMAABlendingWeightCalculationVS( vUv );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 )',\n\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tArea;',\n 'uniform sampler2D tSearch;',\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[3];',\n 'varying vec2 vPixcoord;',\n\n '#if __VERSION__ == 100',\n 'vec2 round( vec2 x ) {',\n '\treturn sign( x ) * floor( abs( x ) + 0.5 );',\n '}',\n '#endif',\n\n 'float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {',\n // Not required if searchTex accesses are set to point:\n // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);\n // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +\n // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\n '\te.r = bias + e.r * scale;',\n '\treturn 255.0 * texture2D( searchTex, e, 0.0 ).r;',\n '}',\n\n 'float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n /**\n * @PSEUDO_GATHER4\n * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to\n * sample between edge, thus fetching four edges in a row.\n * Sampling with different offsets in each direction allows to disambiguate\n * which edges are active from the four fetched ones.\n */\n '\tvec2 e = vec2( 0.0, 1.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord -= vec2( 2.0, 0.0 ) * resolution;',\n '\t\tif ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;',\n '\t}',\n\n // We correct the previous (-0.25, -0.125) offset we applied:\n '\ttexcoord.x += 0.25 * resolution.x;',\n\n // The searches are bias by 1, so adjust the coords accordingly:\n '\ttexcoord.x += resolution.x;',\n\n // Disambiguate the length added by the last step:\n '\ttexcoord.x += 2.0 * resolution.x;', // Undo last step\n '\ttexcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);',\n\n '\treturn texcoord.x;',\n '}',\n\n 'float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n '\tvec2 e = vec2( 0.0, 1.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord += vec2( 2.0, 0.0 ) * resolution;',\n '\t\tif ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;',\n '\t}',\n\n '\ttexcoord.x -= 0.25 * resolution.x;',\n '\ttexcoord.x -= resolution.x;',\n '\ttexcoord.x -= 2.0 * resolution.x;',\n '\ttexcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );',\n\n '\treturn texcoord.x;',\n '}',\n\n 'float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n '\tvec2 e = vec2( 1.0, 0.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord += vec2( 0.0, 2.0 ) * resolution;', // WebGL port note: Changed sign\n '\t\tif ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;',\n '\t}',\n\n '\ttexcoord.y -= 0.25 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y -= resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y -= 2.0 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );', // WebGL port note: Changed sign\n\n '\treturn texcoord.y;',\n '}',\n\n 'float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n '\tvec2 e = vec2( 1.0, 0.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord -= vec2( 0.0, 2.0 ) * resolution;', // WebGL port note: Changed sign\n '\t\tif ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;',\n '\t}',\n\n '\ttexcoord.y += 0.25 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y += resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y += 2.0 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );', // WebGL port note: Changed sign\n\n '\treturn texcoord.y;',\n '}',\n\n 'vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {',\n // Rounding prevents precision errors of bilinear filtering:\n '\tvec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;',\n\n // We do a scale and bias for mapping to texel space:\n '\ttexcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );',\n\n // Move to proper place, according to the subpixel offset:\n '\ttexcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;',\n\n '\treturn texture2D( areaTex, texcoord, 0.0 ).rg;',\n '}',\n\n 'vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {',\n '\tvec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );',\n\n '\tvec2 e = texture2D( edgesTex, texcoord ).rg;',\n\n '\tif ( e.g > 0.0 ) {', // Edge at north\n '\t\tvec2 d;',\n\n // Find the distance to the left:\n '\t\tvec2 coords;',\n '\t\tcoords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );',\n '\t\tcoords.y = offset[ 1 ].y;', // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)\n '\t\td.x = coords.x;',\n\n // Now fetch the left crossing edges, two at a time using bilinear\n // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n // discern what value each edge has:\n '\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).r;',\n\n // Find the distance to the right:\n '\t\tcoords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );',\n '\t\td.y = coords.x;',\n\n // We want the distances to be in pixel units (doing this here allow to\n // better interleave arithmetic and memory accesses):\n '\t\td = d / resolution.x - pixcoord.x;',\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n '\t\tvec2 sqrt_d = sqrt( abs( d ) );',\n\n // Fetch the right crossing edges:\n '\t\tcoords.y -= 1.0 * resolution.y;', // WebGL port note: Added\n '\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;',\n\n // Ok, we know how this pattern looks like, now it is time for getting\n // the actual area:\n '\t\tweights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );',\n '\t}',\n\n '\tif ( e.r > 0.0 ) {', // Edge at west\n '\t\tvec2 d;',\n\n // Find the distance to the top:\n '\t\tvec2 coords;',\n\n '\t\tcoords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );',\n '\t\tcoords.x = offset[ 0 ].x;', // offset[1].x = texcoord.x - 0.25 * resolution.x;\n '\t\td.x = coords.y;',\n\n // Fetch the top crossing edges:\n '\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).g;',\n\n // Find the distance to the bottom:\n '\t\tcoords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );',\n '\t\td.y = coords.y;',\n\n // We want the distances to be in pixel units:\n '\t\td = d / resolution.y - pixcoord.y;',\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n '\t\tvec2 sqrt_d = sqrt( abs( d ) );',\n\n // Fetch the bottom crossing edges:\n '\t\tcoords.y -= 1.0 * resolution.y;', // WebGL port note: Added\n '\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;',\n\n // Get the area for this direction:\n '\t\tweights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );',\n '\t}',\n\n '\treturn weights;',\n '}',\n\n 'void main() {',\n\n '\tgl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SMAABlendShader = {\n uniforms: {\n tDiffuse: { value: null },\n tColor: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 2 ];',\n\n 'void SMAANeighborhoodBlendingVS( vec2 texcoord ) {',\n '\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );', // WebGL port note: Changed sign in W component\n '\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );', // WebGL port note: Changed sign in W component\n '}',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tSMAANeighborhoodBlendingVS( vUv );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tColor;',\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 2 ];',\n\n 'vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {',\n // Fetch the blending weights for current pixel:\n '\tvec4 a;',\n '\ta.xz = texture2D( blendTex, texcoord ).xz;',\n '\ta.y = texture2D( blendTex, offset[ 1 ].zw ).g;',\n '\ta.w = texture2D( blendTex, offset[ 1 ].xy ).a;',\n\n // Is there any blending weight with a value greater than 0.0?\n '\tif ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {',\n '\t\treturn texture2D( colorTex, texcoord, 0.0 );',\n '\t} else {',\n // Up to 4 lines can be crossing a pixel (one through each edge). We\n // favor blending by choosing the line with the maximum weight for each\n // direction:\n '\t\tvec2 offset;',\n '\t\toffset.x = a.a > a.b ? a.a : -a.b;', // left vs. right\n '\t\toffset.y = a.g > a.r ? -a.g : a.r;', // top vs. bottom // WebGL port note: Changed signs\n\n // Then we go in the direction that has the maximum weight:\n '\t\tif ( abs( offset.x ) > abs( offset.y )) {', // horizontal vs. vertical\n '\t\t\toffset.y = 0.0;',\n '\t\t} else {',\n '\t\t\toffset.x = 0.0;',\n '\t\t}',\n\n // Fetch the opposite color and lerp by hand:\n '\t\tvec4 C = texture2D( colorTex, texcoord, 0.0 );',\n '\t\ttexcoord += sign( offset ) * resolution;',\n '\t\tvec4 Cop = texture2D( colorTex, texcoord, 0.0 );',\n '\t\tfloat s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );',\n\n // WebGL port note: Added gamma correction\n '\t\tC.xyz = pow(C.xyz, vec3(2.2));',\n '\t\tCop.xyz = pow(Cop.xyz, vec3(2.2));',\n '\t\tvec4 mixed = mix(C, Cop, s);',\n '\t\tmixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));',\n\n '\t\treturn mixed;',\n '\t}',\n '}',\n\n 'void main() {',\n\n '\tgl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Film grain & scanlines shader\n *\n * - ported from HLSL to WebGL / GLSL\n * http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html\n *\n * Screen Space Static Postprocessor\n *\n * Produces an analogue noise overlay similar to a film grain / TV static\n *\n * Original implementation and noise algorithm\n * Pat 'Hawthorne' Shearon\n *\n * Optimized scanlines + noise version with intensity scaling\n * Georg 'Leviathan' Steinrohder\n *\n * This version is provided under a Creative Commons Attribution 3.0 License\n * http://creativecommons.org/licenses/by/3.0/\n */\n\nexport const FilmShader = {\n uniforms: {\n tDiffuse: { value: null },\n time: { value: 0.0 },\n nIntensity: { value: 0.5 },\n sIntensity: { value: 0.05 },\n sCount: { value: 4096 },\n grayscale: { value: 1 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n // control parameter\n 'uniform float time;',\n\n 'uniform bool grayscale;',\n\n // noise effect intensity value (0 = no effect, 1 = full effect)\n 'uniform float nIntensity;',\n\n // scanlines effect intensity value (0 = no effect, 1 = full effect)\n 'uniform float sIntensity;',\n\n // scanlines effect count value (0 = no effect, 4096 = full effect)\n 'uniform float sCount;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n // sample the source\n '\tvec4 cTextureScreen = texture2D( tDiffuse, vUv );',\n\n // make some noise\n '\tfloat dx = rand( vUv + time );',\n\n // add noise\n '\tvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );',\n\n // get us a sine and cosine\n '\tvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );',\n\n // add scanlines\n '\tcResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;',\n\n // interpolate between source and result by intensity\n '\tcResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );',\n\n // convert to grayscale if desired\n '\tif( grayscale ) {',\n\n '\t\tcResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );',\n\n '\t}',\n\n '\tgl_FragColor = vec4( cResult, cTextureScreen.a );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Full-screen textured quad shader\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type CopyShaderUniforms = {\n opacity: IUniform\n tDiffuse: IUniform\n}\n\nexport interface ICopyShader extends IShader {}\n\nexport const CopyShader: ICopyShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n '\tgl_FragColor = opacity * texel;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Matrix4, Vector2 } from 'three'\n\n/**\n * References:\n * http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html\n * https://learnopengl.com/Advanced-Lighting/SSAO\n * https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl\n */\n\nexport const SSAOShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1,\n KERNEL_SIZE: 32,\n },\n\n uniforms: {\n tDiffuse: { value: null },\n tNormal: { value: null },\n tDepth: { value: null },\n tNoise: { value: null },\n kernel: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n resolution: { value: new Vector2() },\n cameraProjectionMatrix: { value: new Matrix4() },\n cameraInverseProjectionMatrix: { value: new Matrix4() },\n kernelRadius: { value: 8 },\n minDistance: { value: 0.005 },\n maxDistance: { value: 0.05 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tNormal;',\n 'uniform sampler2D tDepth;',\n 'uniform sampler2D tNoise;',\n\n 'uniform vec3 kernel[ KERNEL_SIZE ];',\n\n 'uniform vec2 resolution;',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n 'uniform mat4 cameraProjectionMatrix;',\n 'uniform mat4 cameraInverseProjectionMatrix;',\n\n 'uniform float kernelRadius;',\n 'uniform float minDistance;', // avoid artifacts caused by neighbour fragments with minimal depth difference\n 'uniform float maxDistance;', // avoid the influence of fragments which are too far away\n\n 'varying vec2 vUv;',\n\n '#include ',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n\n '\treturn texture2D( tDepth, screenPosition ).x;',\n\n '}',\n\n 'float getLinearDepth( const in vec2 screenPosition ) {',\n\n '\t#if PERSPECTIVE_CAMERA == 1',\n\n '\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;',\n '\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );',\n '\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );',\n\n '\t#else',\n\n '\t\treturn texture2D( tDepth, screenPosition ).x;',\n\n '\t#endif',\n\n '}',\n\n 'float getViewZ( const in float depth ) {',\n\n '\t#if PERSPECTIVE_CAMERA == 1',\n\n '\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );',\n\n '\t#else',\n\n '\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );',\n\n '\t#endif',\n\n '}',\n\n 'vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {',\n\n '\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];',\n\n '\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );',\n\n '\tclipPosition *= clipW; // unprojection.',\n\n '\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;',\n\n '}',\n\n 'vec3 getViewNormal( const in vec2 screenPosition ) {',\n\n '\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );',\n\n '}',\n\n 'void main() {',\n\n '\tfloat depth = getDepth( vUv );',\n '\tfloat viewZ = getViewZ( depth );',\n\n '\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );',\n '\tvec3 viewNormal = getViewNormal( vUv );',\n\n ' vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );',\n '\tvec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;',\n\n // compute matrix used to reorient a kernel vector\n\n '\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );',\n '\tvec3 bitangent = cross( viewNormal, tangent );',\n '\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );',\n\n ' float occlusion = 0.0;',\n\n ' for ( int i = 0; i < KERNEL_SIZE; i ++ ) {',\n\n '\t\tvec3 sampleVector = kernelMatrix * kernel[ i ];', // reorient sample vector in view space\n '\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );', // calculate sample point\n\n '\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );', // project point and calculate NDC\n '\t\tsamplePointNDC /= samplePointNDC.w;',\n\n '\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;', // compute uv coordinates\n\n '\t\tfloat realDepth = getLinearDepth( samplePointUv );', // get linear depth from depth texture\n '\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );', // compute linear depth of the sample view Z value\n '\t\tfloat delta = sampleDepth - realDepth;',\n\n '\t\tif ( delta > minDistance && delta < maxDistance ) {', // if fragment is before sample point, increase occlusion\n\n '\t\t\tocclusion += 1.0;',\n\n '\t\t}',\n\n '\t}',\n\n '\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );',\n\n '\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SSAODepthShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1,\n },\n\n uniforms: {\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDepth;',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n\n 'varying vec2 vUv;',\n\n '#include ',\n\n 'float getLinearDepth( const in vec2 screenPosition ) {',\n\n '\t#if PERSPECTIVE_CAMERA == 1',\n\n '\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;',\n '\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );',\n '\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );',\n\n '\t#else',\n\n '\t\treturn texture2D( tDepth, screenPosition ).x;',\n\n '\t#endif',\n\n '}',\n\n 'void main() {',\n\n '\tfloat depth = getLinearDepth( vUv );',\n '\tgl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SSAOBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2() },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 texelSize = ( 1.0 / resolution );',\n '\tfloat result = 0.0;',\n\n '\tfor ( int i = - 2; i <= 2; i ++ ) {',\n\n '\t\tfor ( int j = - 2; j <= 2; j ++ ) {',\n\n '\t\t\tvec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;',\n '\t\t\tresult += texture2D( tDiffuse, vUv + offset ).r;',\n\n '\t\t}',\n\n '\t}',\n\n '\tgl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "import {\n AddEquation,\n Color,\n CustomBlending,\n DataTexture,\n DepthTexture,\n DstAlphaFactor,\n DstColorFactor,\n FloatType,\n MathUtils,\n MeshNormalMaterial,\n NearestFilter,\n NoBlending,\n RedFormat,\n LuminanceFormat,\n DepthStencilFormat,\n UnsignedInt248Type,\n RepeatWrapping,\n ShaderMaterial,\n UniformsUtils,\n Vector3,\n WebGLRenderTarget,\n ZeroFactor,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { SimplexNoise } from '../math/SimplexNoise'\nimport { SSAOShader, SSAOBlurShader, SSAODepthShader } from '../shaders/SSAOShader'\n\nimport { CopyShader } from '../shaders/CopyShader'\n\nclass SSAOPass extends Pass {\n static OUTPUT = {\n Default: 0,\n SSAO: 1,\n Blur: 2,\n Beauty: 3,\n Depth: 4,\n Normal: 5,\n }\n\n constructor(scene, camera, width, height) {\n super()\n\n this.width = width !== undefined ? width : 512\n this.height = height !== undefined ? height : 512\n\n this.clear = true\n\n this.camera = camera\n this.scene = scene\n\n this.kernelRadius = 8\n this.kernelSize = 32\n this.kernel = []\n this.noiseTexture = null\n this.output = 0\n\n this.minDistance = 0.005\n this.maxDistance = 0.1\n\n this._visibilityCache = new Map()\n\n //\n\n this.generateSampleKernel()\n this.generateRandomKernelRotations()\n\n // beauty render target\n\n const depthTexture = new DepthTexture()\n depthTexture.format = DepthStencilFormat\n depthTexture.type = UnsignedInt248Type\n\n this.beautyRenderTarget = new WebGLRenderTarget(this.width, this.height)\n\n // normal render target with depth buffer\n\n this.normalRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n depthTexture: depthTexture,\n })\n\n // ssao render target\n\n this.ssaoRenderTarget = new WebGLRenderTarget(this.width, this.height)\n\n this.blurRenderTarget = this.ssaoRenderTarget.clone()\n\n // ssao material\n\n if (SSAOShader === undefined) {\n console.error('THREE.SSAOPass: The pass relies on SSAOShader.')\n }\n\n this.ssaoMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSAOShader.defines),\n uniforms: UniformsUtils.clone(SSAOShader.uniforms),\n vertexShader: SSAOShader.vertexShader,\n fragmentShader: SSAOShader.fragmentShader,\n blending: NoBlending,\n })\n\n this.ssaoMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.ssaoMaterial.uniforms['tNormal'].value = this.normalRenderTarget.texture\n this.ssaoMaterial.uniforms['tDepth'].value = this.normalRenderTarget.depthTexture\n this.ssaoMaterial.uniforms['tNoise'].value = this.noiseTexture\n this.ssaoMaterial.uniforms['kernel'].value = this.kernel\n this.ssaoMaterial.uniforms['cameraNear'].value = this.camera.near\n this.ssaoMaterial.uniforms['cameraFar'].value = this.camera.far\n this.ssaoMaterial.uniforms['resolution'].value.set(this.width, this.height)\n this.ssaoMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssaoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n // normal material\n\n this.normalMaterial = new MeshNormalMaterial()\n this.normalMaterial.blending = NoBlending\n\n // blur material\n\n this.blurMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSAOBlurShader.defines),\n uniforms: UniformsUtils.clone(SSAOBlurShader.uniforms),\n vertexShader: SSAOBlurShader.vertexShader,\n fragmentShader: SSAOBlurShader.fragmentShader,\n })\n this.blurMaterial.uniforms['tDiffuse'].value = this.ssaoRenderTarget.texture\n this.blurMaterial.uniforms['resolution'].value.set(this.width, this.height)\n\n // material for rendering the depth\n\n this.depthRenderMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSAODepthShader.defines),\n uniforms: UniformsUtils.clone(SSAODepthShader.uniforms),\n vertexShader: SSAODepthShader.vertexShader,\n fragmentShader: SSAODepthShader.fragmentShader,\n blending: NoBlending,\n })\n this.depthRenderMaterial.uniforms['tDepth'].value = this.normalRenderTarget.depthTexture\n this.depthRenderMaterial.uniforms['cameraNear'].value = this.camera.near\n this.depthRenderMaterial.uniforms['cameraFar'].value = this.camera.far\n\n // material for rendering the content of a render target\n\n this.copyMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n blendSrc: DstColorFactor,\n blendDst: ZeroFactor,\n blendEquation: AddEquation,\n blendSrcAlpha: DstAlphaFactor,\n blendDstAlpha: ZeroFactor,\n blendEquationAlpha: AddEquation,\n })\n\n this.fsQuad = new FullScreenQuad(null)\n\n this.originalClearColor = new Color()\n }\n\n dispose() {\n // dispose render targets\n\n this.beautyRenderTarget.dispose()\n this.normalRenderTarget.dispose()\n this.ssaoRenderTarget.dispose()\n this.blurRenderTarget.dispose()\n\n // dispose materials\n\n this.normalMaterial.dispose()\n this.blurMaterial.dispose()\n this.copyMaterial.dispose()\n this.depthRenderMaterial.dispose()\n\n // dipsose full screen quad\n\n this.fsQuad.dispose()\n }\n\n render(renderer, writeBuffer /*, readBuffer, deltaTime, maskActive */) {\n if (renderer.capabilities.isWebGL2 === false) this.noiseTexture.format = LuminanceFormat\n\n // render beauty\n\n renderer.setRenderTarget(this.beautyRenderTarget)\n renderer.clear()\n renderer.render(this.scene, this.camera)\n\n // render normals and depth (honor only meshes, points and lines do not contribute to SSAO)\n\n this.overrideVisibility()\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0)\n this.restoreVisibility()\n\n // render SSAO\n\n this.ssaoMaterial.uniforms['kernelRadius'].value = this.kernelRadius\n this.ssaoMaterial.uniforms['minDistance'].value = this.minDistance\n this.ssaoMaterial.uniforms['maxDistance'].value = this.maxDistance\n this.renderPass(renderer, this.ssaoMaterial, this.ssaoRenderTarget)\n\n // render blur\n\n this.renderPass(renderer, this.blurMaterial, this.blurRenderTarget)\n\n // output result to screen\n\n switch (this.output) {\n case SSAOPass.OUTPUT.SSAO:\n this.copyMaterial.uniforms['tDiffuse'].value = this.ssaoRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Blur:\n this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Beauty:\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Depth:\n this.renderPass(renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Normal:\n this.copyMaterial.uniforms['tDiffuse'].value = this.normalRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Default:\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget.texture\n this.copyMaterial.blending = CustomBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n default:\n console.warn('THREE.SSAOPass: Unknown output type.')\n }\n }\n\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n // save original state\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n\n // setup pass state\n renderer.autoClear = false\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.fsQuad.material = passMaterial\n this.fsQuad.render(renderer)\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.overrideMaterial = overrideMaterial\n renderer.render(this.scene, this.camera)\n this.scene.overrideMaterial = null\n\n // restore original state\n\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n setSize(width, height) {\n this.width = width\n this.height = height\n\n this.beautyRenderTarget.setSize(width, height)\n this.ssaoRenderTarget.setSize(width, height)\n this.normalRenderTarget.setSize(width, height)\n this.blurRenderTarget.setSize(width, height)\n\n this.ssaoMaterial.uniforms['resolution'].value.set(width, height)\n this.ssaoMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssaoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n this.blurMaterial.uniforms['resolution'].value.set(width, height)\n }\n\n generateSampleKernel() {\n const kernelSize = this.kernelSize\n const kernel = this.kernel\n\n for (let i = 0; i < kernelSize; i++) {\n const sample = new Vector3()\n sample.x = Math.random() * 2 - 1\n sample.y = Math.random() * 2 - 1\n sample.z = Math.random()\n\n sample.normalize()\n\n let scale = i / kernelSize\n scale = MathUtils.lerp(0.1, 1, scale * scale)\n sample.multiplyScalar(scale)\n\n kernel.push(sample)\n }\n }\n\n generateRandomKernelRotations() {\n const width = 4,\n height = 4\n\n if (SimplexNoise === undefined) {\n console.error('THREE.SSAOPass: The pass relies on SimplexNoise.')\n }\n\n const simplex = new SimplexNoise()\n\n const size = width * height\n const data = new Float32Array(size)\n\n for (let i = 0; i < size; i++) {\n const x = Math.random() * 2 - 1\n const y = Math.random() * 2 - 1\n const z = 0\n\n data[i] = simplex.noise3d(x, y, z)\n }\n\n this.noiseTexture = new DataTexture(data, width, height, RedFormat, FloatType)\n this.noiseTexture.wrapS = RepeatWrapping\n this.noiseTexture.wrapT = RepeatWrapping\n this.noiseTexture.needsUpdate = true\n }\n\n overrideVisibility() {\n const scene = this.scene\n const cache = this._visibilityCache\n\n scene.traverse(function (object) {\n cache.set(object, object.visible)\n\n if (object.isPoints || object.isLine) object.visible = false\n })\n }\n\n restoreVisibility() {\n const scene = this.scene\n const cache = this._visibilityCache\n\n scene.traverse(function (object) {\n const visible = cache.get(object)\n object.visible = visible\n })\n\n cache.clear()\n }\n}\n\nexport { SSAOPass }\n", "/**\n * Depth-of-field shader with bokeh\n * ported from GLSL shader by Martins Upitis\n * http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type BokehShaderDefines = {\n DEPTH_PACKING: number\n PERSPECTIVE_CAMERA: number\n}\n\nexport type BokehShaderUniforms = {\n aperture: IUniform\n aspect: IUniform\n farClip: IUniform\n focus: IUniform\n maxblur: IUniform\n nearClip: IUniform\n tColor: IUniform\n tDepth: IUniform\n}\n\nexport interface IBokehShader extends IShader {}\n\nexport const BokehShader: IBokehShader = {\n defines: {\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n\n uniforms: {\n tColor: { value: null },\n tDepth: { value: null },\n focus: { value: 1.0 },\n aspect: { value: 1.0 },\n aperture: { value: 0.025 },\n maxblur: { value: 0.01 },\n nearClip: { value: 1.0 },\n farClip: { value: 1000.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tColor;',\n 'uniform sampler2D tDepth;',\n\n 'uniform float maxblur;', // max blur amount\n 'uniform float aperture;', // aperture - bigger values for shallower depth of field\n\n 'uniform float nearClip;',\n 'uniform float farClip;',\n\n 'uniform float focus;',\n 'uniform float aspect;',\n\n '#include ',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n '\t#if DEPTH_PACKING == 1',\n '\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );',\n '\t#else',\n '\treturn texture2D( tDepth, screenPosition ).x;',\n '\t#endif',\n '}',\n\n 'float getViewZ( const in float depth ) {',\n '\t#if PERSPECTIVE_CAMERA == 1',\n '\treturn perspectiveDepthToViewZ( depth, nearClip, farClip );',\n '\t#else',\n '\treturn orthographicDepthToViewZ( depth, nearClip, farClip );',\n '\t#endif',\n '}',\n\n 'void main() {',\n\n '\tvec2 aspectcorrect = vec2( 1.0, aspect );',\n\n '\tfloat viewZ = getViewZ( getDepth( vUv ) );',\n\n '\tfloat factor = ( focus + viewZ );', // viewZ is <= 0, so this is a difference equation\n\n '\tvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );',\n\n '\tvec2 dofblur9 = dofblur * 0.9;',\n '\tvec2 dofblur7 = dofblur * 0.7;',\n '\tvec2 dofblur4 = dofblur * 0.4;',\n\n '\tvec4 col = vec4( 0.0 );',\n\n '\tcol += texture2D( tColor, vUv.xy );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );',\n\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );',\n\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );',\n\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );',\n\n '\tgl_FragColor = col / 41.0;',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Luminosity\n * http://en.wikipedia.org/wiki/Luminosity\n */\n\nexport const LuminosityShader = {\n uniforms: {\n tDiffuse: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tfloat l = linearToRelativeLuminance( texel.rgb );',\n\n '\tgl_FragColor = vec4( l, l, l, texel.w );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Full-screen tone-mapping shader based on http://www.cis.rit.edu/people/faculty/ferwerda/publications/sig02_paper.pdf\n */\n\nexport const ToneMapShader = {\n uniforms: {\n tDiffuse: { value: null },\n averageLuminance: { value: 1.0 },\n luminanceMap: { value: null },\n maxLuminance: { value: 16.0 },\n minLuminance: { value: 0.01 },\n middleGrey: { value: 0.6 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'uniform float middleGrey;',\n 'uniform float minLuminance;',\n 'uniform float maxLuminance;',\n '#ifdef ADAPTED_LUMINANCE',\n '\tuniform sampler2D luminanceMap;',\n '#else',\n '\tuniform float averageLuminance;',\n '#endif',\n\n 'vec3 ToneMap( vec3 vColor ) {',\n '\t#ifdef ADAPTED_LUMINANCE',\n // Get the calculated average luminance\n '\t\tfloat fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;',\n '\t#else',\n '\t\tfloat fLumAvg = averageLuminance;',\n '\t#endif',\n\n // Calculate the luminance of the current pixel\n '\tfloat fLumPixel = linearToRelativeLuminance( vColor );',\n\n // Apply the modified operator (Eq. 4)\n '\tfloat fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );',\n\n '\tfloat fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);',\n '\treturn fLumCompressed * vColor;',\n '}',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tgl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color } from 'three'\n\n/**\n * Luminosity\n * http://en.wikipedia.org/wiki/Luminosity\n */\n\nexport const LuminosityHighPassShader = {\n shaderID: 'luminosityHighPass',\n\n uniforms: {\n tDiffuse: { value: null },\n luminosityThreshold: { value: 1.0 },\n smoothWidth: { value: 1.0 },\n defaultColor: { value: new Color(0x000000) },\n defaultOpacity: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform vec3 defaultColor;',\n 'uniform float defaultOpacity;',\n 'uniform float luminosityThreshold;',\n 'uniform float smoothWidth;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tvec3 luma = vec3( 0.299, 0.587, 0.114 );',\n\n '\tfloat v = dot( texel.xyz, luma );',\n\n '\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );',\n\n '\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );',\n\n '\tgl_FragColor = mix( outputColor, texel, alpha );',\n\n '}',\n ].join('\\n'),\n}\n", "import {\n AdditiveBlending,\n Color,\n HalfFloatType,\n MeshBasicMaterial,\n ShaderMaterial,\n UniformsUtils,\n Vector2,\n Vector3,\n WebGLRenderTarget,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { CopyShader } from '../shaders/CopyShader'\nimport { LuminosityHighPassShader } from '../shaders/LuminosityHighPassShader'\n\n/**\n * UnrealBloomPass is inspired by the bloom pass of Unreal Engine. It creates a\n * mip map chain of bloom textures and blurs them with different radii. Because\n * of the weighted combination of mips, and because larger blurs are done on\n * higher mips, this effect provides good quality and performance.\n *\n * Reference:\n * - https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/\n */\nclass UnrealBloomPass extends Pass {\n static BlurDirectionX = new Vector2(1.0, 0.0)\n static BlurDirectionY = new Vector2(0.0, 1.0)\n\n constructor(resolution, strength, radius, threshold) {\n super()\n\n this.strength = strength !== undefined ? strength : 1\n this.radius = radius\n this.threshold = threshold\n this.resolution = resolution !== undefined ? new Vector2(resolution.x, resolution.y) : new Vector2(256, 256)\n\n // create color only once here, reuse it later inside the render function\n this.clearColor = new Color(0, 0, 0)\n\n // render targets\n this.renderTargetsHorizontal = []\n this.renderTargetsVertical = []\n this.nMips = 5\n let resx = Math.round(this.resolution.x / 2)\n let resy = Math.round(this.resolution.y / 2)\n\n this.renderTargetBright = new WebGLRenderTarget(resx, resy, { type: HalfFloatType })\n this.renderTargetBright.texture.name = 'UnrealBloomPass.bright'\n this.renderTargetBright.texture.generateMipmaps = false\n\n for (let i = 0; i < this.nMips; i++) {\n const renderTargetHorizonal = new WebGLRenderTarget(resx, resy, { type: HalfFloatType })\n\n renderTargetHorizonal.texture.name = 'UnrealBloomPass.h' + i\n renderTargetHorizonal.texture.generateMipmaps = false\n\n this.renderTargetsHorizontal.push(renderTargetHorizonal)\n\n const renderTargetVertical = new WebGLRenderTarget(resx, resy, { type: HalfFloatType })\n\n renderTargetVertical.texture.name = 'UnrealBloomPass.v' + i\n renderTargetVertical.texture.generateMipmaps = false\n\n this.renderTargetsVertical.push(renderTargetVertical)\n\n resx = Math.round(resx / 2)\n\n resy = Math.round(resy / 2)\n }\n\n // luminosity high pass material\n\n const highPassShader = LuminosityHighPassShader\n this.highPassUniforms = UniformsUtils.clone(highPassShader.uniforms)\n\n this.highPassUniforms['luminosityThreshold'].value = threshold\n this.highPassUniforms['smoothWidth'].value = 0.01\n\n this.materialHighPassFilter = new ShaderMaterial({\n uniforms: this.highPassUniforms,\n vertexShader: highPassShader.vertexShader,\n fragmentShader: highPassShader.fragmentShader,\n defines: {},\n })\n\n // Gaussian Blur Materials\n this.separableBlurMaterials = []\n const kernelSizeArray = [3, 5, 7, 9, 11]\n resx = Math.round(this.resolution.x / 2)\n resy = Math.round(this.resolution.y / 2)\n\n for (let i = 0; i < this.nMips; i++) {\n this.separableBlurMaterials.push(this.getSeperableBlurMaterial(kernelSizeArray[i]))\n\n this.separableBlurMaterials[i].uniforms['texSize'].value = new Vector2(resx, resy)\n\n resx = Math.round(resx / 2)\n\n resy = Math.round(resy / 2)\n }\n\n // Composite material\n this.compositeMaterial = this.getCompositeMaterial(this.nMips)\n this.compositeMaterial.uniforms['blurTexture1'].value = this.renderTargetsVertical[0].texture\n this.compositeMaterial.uniforms['blurTexture2'].value = this.renderTargetsVertical[1].texture\n this.compositeMaterial.uniforms['blurTexture3'].value = this.renderTargetsVertical[2].texture\n this.compositeMaterial.uniforms['blurTexture4'].value = this.renderTargetsVertical[3].texture\n this.compositeMaterial.uniforms['blurTexture5'].value = this.renderTargetsVertical[4].texture\n this.compositeMaterial.uniforms['bloomStrength'].value = strength\n this.compositeMaterial.uniforms['bloomRadius'].value = 0.1\n this.compositeMaterial.needsUpdate = true\n\n const bloomFactors = [1.0, 0.8, 0.6, 0.4, 0.2]\n this.compositeMaterial.uniforms['bloomFactors'].value = bloomFactors\n this.bloomTintColors = [\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n ]\n this.compositeMaterial.uniforms['bloomTintColors'].value = this.bloomTintColors\n\n // copy material\n\n const copyShader = CopyShader\n\n this.copyUniforms = UniformsUtils.clone(copyShader.uniforms)\n this.copyUniforms['opacity'].value = 1.0\n\n this.materialCopy = new ShaderMaterial({\n uniforms: this.copyUniforms,\n vertexShader: copyShader.vertexShader,\n fragmentShader: copyShader.fragmentShader,\n blending: AdditiveBlending,\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.enabled = true\n this.needsSwap = false\n\n this._oldClearColor = new Color()\n this.oldClearAlpha = 1\n\n this.basic = new MeshBasicMaterial()\n\n this.fsQuad = new FullScreenQuad(null)\n }\n\n dispose() {\n for (let i = 0; i < this.renderTargetsHorizontal.length; i++) {\n this.renderTargetsHorizontal[i].dispose()\n }\n\n for (let i = 0; i < this.renderTargetsVertical.length; i++) {\n this.renderTargetsVertical[i].dispose()\n }\n\n this.renderTargetBright.dispose()\n\n //\n\n for (let i = 0; i < this.separableBlurMaterials.length; i++) {\n this.separableBlurMaterials[i].dispose()\n }\n\n this.compositeMaterial.dispose()\n this.materialCopy.dispose()\n this.basic.dispose()\n\n //\n\n this.fsQuad.dispose()\n }\n\n setSize(width, height) {\n let resx = Math.round(width / 2)\n let resy = Math.round(height / 2)\n\n this.renderTargetBright.setSize(resx, resy)\n\n for (let i = 0; i < this.nMips; i++) {\n this.renderTargetsHorizontal[i].setSize(resx, resy)\n this.renderTargetsVertical[i].setSize(resx, resy)\n\n this.separableBlurMaterials[i].uniforms['texSize'].value = new Vector2(resx, resy)\n\n resx = Math.round(resx / 2)\n resy = Math.round(resy / 2)\n }\n }\n\n render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {\n renderer.getClearColor(this._oldClearColor)\n this.oldClearAlpha = renderer.getClearAlpha()\n const oldAutoClear = renderer.autoClear\n renderer.autoClear = false\n\n renderer.setClearColor(this.clearColor, 0)\n\n if (maskActive) renderer.state.buffers.stencil.setTest(false)\n\n // Render input to screen\n\n if (this.renderToScreen) {\n this.fsQuad.material = this.basic\n this.basic.map = readBuffer.texture\n\n renderer.setRenderTarget(null)\n renderer.clear()\n this.fsQuad.render(renderer)\n }\n\n // 1. Extract Bright Areas\n\n this.highPassUniforms['tDiffuse'].value = readBuffer.texture\n this.highPassUniforms['luminosityThreshold'].value = this.threshold\n this.fsQuad.material = this.materialHighPassFilter\n\n renderer.setRenderTarget(this.renderTargetBright)\n renderer.clear()\n this.fsQuad.render(renderer)\n\n // 2. Blur All the mips progressively\n\n let inputRenderTarget = this.renderTargetBright\n\n for (let i = 0; i < this.nMips; i++) {\n this.fsQuad.material = this.separableBlurMaterials[i]\n\n this.separableBlurMaterials[i].uniforms['colorTexture'].value = inputRenderTarget.texture\n this.separableBlurMaterials[i].uniforms['direction'].value = UnrealBloomPass.BlurDirectionX\n renderer.setRenderTarget(this.renderTargetsHorizontal[i])\n renderer.clear()\n this.fsQuad.render(renderer)\n\n this.separableBlurMaterials[i].uniforms['colorTexture'].value = this.renderTargetsHorizontal[i].texture\n this.separableBlurMaterials[i].uniforms['direction'].value = UnrealBloomPass.BlurDirectionY\n renderer.setRenderTarget(this.renderTargetsVertical[i])\n renderer.clear()\n this.fsQuad.render(renderer)\n\n inputRenderTarget = this.renderTargetsVertical[i]\n }\n\n // Composite All the mips\n\n this.fsQuad.material = this.compositeMaterial\n this.compositeMaterial.uniforms['bloomStrength'].value = this.strength\n this.compositeMaterial.uniforms['bloomRadius'].value = this.radius\n this.compositeMaterial.uniforms['bloomTintColors'].value = this.bloomTintColors\n\n renderer.setRenderTarget(this.renderTargetsHorizontal[0])\n renderer.clear()\n this.fsQuad.render(renderer)\n\n // Blend it additively over the input texture\n\n this.fsQuad.material = this.materialCopy\n this.copyUniforms['tDiffuse'].value = this.renderTargetsHorizontal[0].texture\n\n if (maskActive) renderer.state.buffers.stencil.setTest(true)\n\n if (this.renderToScreen) {\n renderer.setRenderTarget(null)\n this.fsQuad.render(renderer)\n } else {\n renderer.setRenderTarget(readBuffer)\n this.fsQuad.render(renderer)\n }\n\n // Restore renderer settings\n\n renderer.setClearColor(this._oldClearColor, this.oldClearAlpha)\n renderer.autoClear = oldAutoClear\n }\n\n getSeperableBlurMaterial(kernelRadius) {\n return new ShaderMaterial({\n defines: {\n KERNEL_RADIUS: kernelRadius,\n SIGMA: kernelRadius,\n },\n\n uniforms: {\n colorTexture: { value: null },\n texSize: { value: new Vector2(0.5, 0.5) },\n direction: { value: new Vector2(0.5, 0.5) },\n },\n\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n\n fragmentShader: `#include \n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}`,\n })\n }\n\n getCompositeMaterial(nMips) {\n return new ShaderMaterial({\n defines: {\n NUM_MIPS: nMips,\n },\n\n uniforms: {\n blurTexture1: { value: null },\n blurTexture2: { value: null },\n blurTexture3: { value: null },\n blurTexture4: { value: null },\n blurTexture5: { value: null },\n bloomStrength: { value: 1.0 },\n bloomFactors: { value: null },\n bloomTintColors: { value: null },\n bloomRadius: { value: 0.0 },\n },\n\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n\n fragmentShader: `varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}`,\n })\n }\n}\n\nexport { UnrealBloomPass }\n", "import { Matrix4, Vector2 } from 'three'\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type SAOShaderDefines = Record<\n 'DEPTH_PACKING' | 'DIFFUSE_TEXTURE' | 'NORMAL_TEXTURE' | 'NUM_RINGS' | 'NUM_SAMPLES' | 'PERSPECTIVE_CAMERA',\n number\n>\n\nexport type SAOShaderUniforms = {\n bias: IUniform\n cameraFar: IUniform\n cameraInverseProjectionMatrix: IUniform\n cameraNear: IUniform\n cameraProjectionMatrix: IUniform\n intensity: IUniform\n kernelRadius: IUniform\n minResolution: IUniform\n randomSeed: IUniform\n scale: IUniform\n size: IUniform\n tDepth: IUniform\n tDiffuse: IUniform\n tNormal: IUniform\n}\n\nexport interface ISAOShader extends IShader {\n defines: SAOShaderDefines\n needsUpdate?: boolean\n}\n\nexport const SAOShader: ISAOShader = {\n defines: {\n NUM_SAMPLES: 7,\n NUM_RINGS: 4,\n NORMAL_TEXTURE: 0,\n DIFFUSE_TEXTURE: 0,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n uniforms: {\n tDepth: { value: null },\n tDiffuse: { value: null },\n tNormal: { value: null },\n size: { value: new Vector2(512, 512) },\n\n cameraNear: { value: 1 },\n cameraFar: { value: 100 },\n cameraProjectionMatrix: { value: new Matrix4() },\n cameraInverseProjectionMatrix: { value: new Matrix4() },\n\n scale: { value: 1.0 },\n intensity: { value: 0.1 },\n bias: { value: 0.5 },\n\n minResolution: { value: 0.0 },\n kernelRadius: { value: 100.0 },\n randomSeed: { value: 0.0 },\n },\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '}',\n ].join('\\n'),\n fragmentShader: [\n '#include ',\n\n 'varying vec2 vUv;',\n\n '#if DIFFUSE_TEXTURE == 1',\n 'uniform sampler2D tDiffuse;',\n '#endif',\n\n 'uniform sampler2D tDepth;',\n\n '#if NORMAL_TEXTURE == 1',\n 'uniform sampler2D tNormal;',\n '#endif',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n 'uniform mat4 cameraProjectionMatrix;',\n 'uniform mat4 cameraInverseProjectionMatrix;',\n\n 'uniform float scale;',\n 'uniform float intensity;',\n 'uniform float bias;',\n 'uniform float kernelRadius;',\n 'uniform float minResolution;',\n 'uniform vec2 size;',\n 'uniform float randomSeed;',\n\n '// RGBA depth',\n\n '#include ',\n\n 'vec4 getDefaultColor( const in vec2 screenPosition ) {',\n '\t#if DIFFUSE_TEXTURE == 1',\n '\treturn texture2D( tDiffuse, vUv );',\n '\t#else',\n '\treturn vec4( 1.0 );',\n '\t#endif',\n '}',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n '\t#if DEPTH_PACKING == 1',\n '\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );',\n '\t#else',\n '\treturn texture2D( tDepth, screenPosition ).x;',\n '\t#endif',\n '}',\n\n 'float getViewZ( const in float depth ) {',\n '\t#if PERSPECTIVE_CAMERA == 1',\n '\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#else',\n '\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#endif',\n '}',\n\n 'vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {',\n '\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];',\n '\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );',\n '\tclipPosition *= clipW; // unprojection.',\n\n '\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;',\n '}',\n\n 'vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {',\n '\t#if NORMAL_TEXTURE == 1',\n '\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );',\n '\t#else',\n '\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );',\n '\t#endif',\n '}',\n\n 'float scaleDividedByCameraFar;',\n 'float minResolutionMultipliedByCameraFar;',\n\n 'float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {',\n '\tvec3 viewDelta = sampleViewPosition - centerViewPosition;',\n '\tfloat viewDistance = length( viewDelta );',\n '\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;',\n\n '\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );',\n '}',\n\n '// moving costly divides into consts',\n 'const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );',\n 'const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );',\n\n 'float getAmbientOcclusion( const in vec3 centerViewPosition ) {',\n '\t// precompute some variables require in getOcclusion.',\n '\tscaleDividedByCameraFar = scale / cameraFar;',\n '\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;',\n '\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );',\n\n '\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/',\n '\tfloat angle = rand( vUv + randomSeed ) * PI2;',\n '\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;',\n '\tvec2 radiusStep = radius;',\n\n '\tfloat occlusionSum = 0.0;',\n '\tfloat weightSum = 0.0;',\n\n '\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {',\n '\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;',\n '\t\tradius += radiusStep;',\n '\t\tangle += ANGLE_STEP;',\n\n '\t\tfloat sampleDepth = getDepth( sampleUv );',\n '\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {',\n '\t\t\tcontinue;',\n '\t\t}',\n\n '\t\tfloat sampleViewZ = getViewZ( sampleDepth );',\n '\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );',\n '\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );',\n '\t\tweightSum += 1.0;',\n '\t}',\n\n '\tif( weightSum == 0.0 ) discard;',\n\n '\treturn occlusionSum * ( intensity / weightSum );',\n '}',\n\n 'void main() {',\n '\tfloat centerDepth = getDepth( vUv );',\n '\tif( centerDepth >= ( 1.0 - EPSILON ) ) {',\n '\t\tdiscard;',\n '\t}',\n\n '\tfloat centerViewZ = getViewZ( centerDepth );',\n '\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );',\n\n '\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );',\n\n '\tgl_FragColor = getDefaultColor( vUv );',\n '\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;',\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type DepthLimitedBlurShaderDefines = {\n DEPTH_PACKING: number\n KERNEL_RADIUS: number\n PERSPECTIVE_CAMERA: number\n}\n\nexport type DepthLimitedBlurShaderUniforms = {\n cameraFar: IUniform\n cameraNear: IUniform\n depthCutoff: IUniform\n sampleUvOffsets: IUniform\n sampleWeights: IUniform\n size: IUniform\n tDepth: IUniform\n tDiffuse: IUniform\n}\n\nexport interface IDepthLimitedBlurShader\n extends IShader {\n defines: DepthLimitedBlurShaderDefines\n needsUpdate?: boolean\n}\n\nexport const DepthLimitedBlurShader: IDepthLimitedBlurShader = {\n defines: {\n KERNEL_RADIUS: 4,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n uniforms: {\n tDiffuse: { value: null },\n size: { value: new Vector2(512, 512) },\n sampleUvOffsets: { value: [new Vector2(0, 0)] },\n sampleWeights: { value: [1.0] },\n tDepth: { value: null },\n cameraNear: { value: 10 },\n cameraFar: { value: 1000 },\n depthCutoff: { value: 10 },\n },\n vertexShader: [\n '#include ',\n\n 'uniform vec2 size;',\n\n 'varying vec2 vUv;',\n 'varying vec2 vInvSize;',\n\n 'void main() {',\n '\tvUv = uv;',\n '\tvInvSize = 1.0 / size;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '}',\n ].join('\\n'),\n fragmentShader: [\n '#include ',\n '#include ',\n\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tDepth;',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n 'uniform float depthCutoff;',\n\n 'uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];',\n 'uniform float sampleWeights[ KERNEL_RADIUS + 1 ];',\n\n 'varying vec2 vUv;',\n 'varying vec2 vInvSize;',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n '\t#if DEPTH_PACKING == 1',\n '\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );',\n '\t#else',\n '\treturn texture2D( tDepth, screenPosition ).x;',\n '\t#endif',\n '}',\n\n 'float getViewZ( const in float depth ) {',\n '\t#if PERSPECTIVE_CAMERA == 1',\n '\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#else',\n '\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#endif',\n '}',\n\n 'void main() {',\n '\tfloat depth = getDepth( vUv );',\n '\tif( depth >= ( 1.0 - EPSILON ) ) {',\n '\t\tdiscard;',\n '\t}',\n\n '\tfloat centerViewZ = -getViewZ( depth );',\n '\tbool rBreak = false, lBreak = false;',\n\n '\tfloat weightSum = sampleWeights[0];',\n '\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;',\n\n '\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {',\n\n '\t\tfloat sampleWeight = sampleWeights[i];',\n '\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;',\n\n '\t\tvec2 sampleUv = vUv + sampleUvOffset;',\n '\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );',\n\n '\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;',\n\n '\t\tif( ! rBreak ) {',\n '\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;',\n '\t\t\tweightSum += sampleWeight;',\n '\t\t}',\n\n '\t\tsampleUv = vUv - sampleUvOffset;',\n '\t\tviewZ = -getViewZ( getDepth( sampleUv ) );',\n\n '\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;',\n\n '\t\tif( ! lBreak ) {',\n '\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;',\n '\t\t\tweightSum += sampleWeight;',\n '\t\t}',\n\n '\t}',\n\n '\tgl_FragColor = diffuseSum / weightSum;',\n '}',\n ].join('\\n'),\n}\n\nexport const BlurShaderUtils = {\n createSampleWeights: (kernelRadius: number, stdDev: number): number[] => {\n const gaussian = (x: number, stdDev: number): number => {\n return Math.exp(-(x * x) / (2.0 * (stdDev * stdDev))) / (Math.sqrt(2.0 * Math.PI) * stdDev)\n }\n\n const weights: number[] = []\n\n for (let i = 0; i <= kernelRadius; i++) {\n weights.push(gaussian(i, stdDev))\n }\n\n return weights\n },\n\n createSampleOffsets: (kernelRadius: number, uvIncrement: Vector2): Vector2[] => {\n const offsets: Vector2[] = []\n\n for (let i = 0; i <= kernelRadius; i++) {\n offsets.push(uvIncrement.clone().multiplyScalar(i))\n }\n\n return offsets\n },\n\n configure: (shader: IDepthLimitedBlurShader, kernelRadius: number, stdDev: number, uvIncrement: Vector2): void => {\n shader.defines['KERNEL_RADIUS'] = kernelRadius\n shader.uniforms['sampleUvOffsets'].value = BlurShaderUtils.createSampleOffsets(kernelRadius, uvIncrement)\n shader.uniforms['sampleWeights'].value = BlurShaderUtils.createSampleWeights(kernelRadius, stdDev)\n shader.needsUpdate = true\n },\n}\n", "import {\n AddEquation,\n Color,\n CustomBlending,\n DepthTexture,\n DstAlphaFactor,\n DstColorFactor,\n HalfFloatType,\n MeshDepthMaterial,\n MeshNormalMaterial,\n NearestFilter,\n NoBlending,\n RGBADepthPacking,\n ShaderMaterial,\n UniformsUtils,\n UnsignedShortType,\n Vector2,\n WebGLRenderTarget,\n ZeroFactor,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { SAOShader } from '../shaders/SAOShader'\nimport { DepthLimitedBlurShader } from '../shaders/DepthLimitedBlurShader'\nimport { BlurShaderUtils } from '../shaders/DepthLimitedBlurShader'\nimport { CopyShader } from '../shaders/CopyShader'\nimport { UnpackDepthRGBAShader } from '../shaders/UnpackDepthRGBAShader'\n\n/**\n * SAO implementation inspired from bhouston previous SAO work\n */\nclass SAOPass extends Pass {\n static OUTPUT = {\n Beauty: 1,\n Default: 0,\n SAO: 2,\n Depth: 3,\n Normal: 4,\n }\n\n constructor(scene, camera, useDepthTexture = false, useNormals = false, resolution = new Vector2(256, 256)) {\n super()\n\n this.scene = scene\n this.camera = camera\n\n this.clear = true\n this.needsSwap = false\n\n this.supportsDepthTextureExtension = useDepthTexture\n this.supportsNormalTexture = useNormals\n\n this.originalClearColor = new Color()\n this._oldClearColor = new Color()\n this.oldClearAlpha = 1\n\n this.params = {\n output: 0,\n saoBias: 0.5,\n saoIntensity: 0.18,\n saoScale: 1,\n saoKernelRadius: 100,\n saoMinResolution: 0,\n saoBlur: true,\n saoBlurRadius: 8,\n saoBlurStdDev: 4,\n saoBlurDepthCutoff: 0.01,\n }\n\n this.resolution = new Vector2(resolution.x, resolution.y)\n\n this.saoRenderTarget = new WebGLRenderTarget(this.resolution.x, this.resolution.y, { type: HalfFloatType })\n this.blurIntermediateRenderTarget = this.saoRenderTarget.clone()\n this.beautyRenderTarget = this.saoRenderTarget.clone()\n\n this.normalRenderTarget = new WebGLRenderTarget(this.resolution.x, this.resolution.y, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n })\n this.depthRenderTarget = this.normalRenderTarget.clone()\n\n let depthTexture\n\n if (this.supportsDepthTextureExtension) {\n depthTexture = new DepthTexture()\n depthTexture.type = UnsignedShortType\n\n this.beautyRenderTarget.depthTexture = depthTexture\n this.beautyRenderTarget.depthBuffer = true\n }\n\n this.depthMaterial = new MeshDepthMaterial()\n this.depthMaterial.depthPacking = RGBADepthPacking\n this.depthMaterial.blending = NoBlending\n\n this.normalMaterial = new MeshNormalMaterial()\n this.normalMaterial.blending = NoBlending\n\n this.saoMaterial = new ShaderMaterial({\n defines: Object.assign({}, SAOShader.defines),\n fragmentShader: SAOShader.fragmentShader,\n vertexShader: SAOShader.vertexShader,\n uniforms: UniformsUtils.clone(SAOShader.uniforms),\n })\n this.saoMaterial.extensions.derivatives = true\n this.saoMaterial.defines['DEPTH_PACKING'] = this.supportsDepthTextureExtension ? 0 : 1\n this.saoMaterial.defines['NORMAL_TEXTURE'] = this.supportsNormalTexture ? 1 : 0\n this.saoMaterial.defines['PERSPECTIVE_CAMERA'] = this.camera.isPerspectiveCamera ? 1 : 0\n this.saoMaterial.uniforms['tDepth'].value = this.supportsDepthTextureExtension\n ? depthTexture\n : this.depthRenderTarget.texture\n this.saoMaterial.uniforms['tNormal'].value = this.normalRenderTarget.texture\n this.saoMaterial.uniforms['size'].value.set(this.resolution.x, this.resolution.y)\n this.saoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n this.saoMaterial.uniforms['cameraProjectionMatrix'].value = this.camera.projectionMatrix\n this.saoMaterial.blending = NoBlending\n\n this.vBlurMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(DepthLimitedBlurShader.uniforms),\n defines: Object.assign({}, DepthLimitedBlurShader.defines),\n vertexShader: DepthLimitedBlurShader.vertexShader,\n fragmentShader: DepthLimitedBlurShader.fragmentShader,\n })\n this.vBlurMaterial.defines['DEPTH_PACKING'] = this.supportsDepthTextureExtension ? 0 : 1\n this.vBlurMaterial.defines['PERSPECTIVE_CAMERA'] = this.camera.isPerspectiveCamera ? 1 : 0\n this.vBlurMaterial.uniforms['tDiffuse'].value = this.saoRenderTarget.texture\n this.vBlurMaterial.uniforms['tDepth'].value = this.supportsDepthTextureExtension\n ? depthTexture\n : this.depthRenderTarget.texture\n this.vBlurMaterial.uniforms['size'].value.set(this.resolution.x, this.resolution.y)\n this.vBlurMaterial.blending = NoBlending\n\n this.hBlurMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(DepthLimitedBlurShader.uniforms),\n defines: Object.assign({}, DepthLimitedBlurShader.defines),\n vertexShader: DepthLimitedBlurShader.vertexShader,\n fragmentShader: DepthLimitedBlurShader.fragmentShader,\n })\n this.hBlurMaterial.defines['DEPTH_PACKING'] = this.supportsDepthTextureExtension ? 0 : 1\n this.hBlurMaterial.defines['PERSPECTIVE_CAMERA'] = this.camera.isPerspectiveCamera ? 1 : 0\n this.hBlurMaterial.uniforms['tDiffuse'].value = this.blurIntermediateRenderTarget.texture\n this.hBlurMaterial.uniforms['tDepth'].value = this.supportsDepthTextureExtension\n ? depthTexture\n : this.depthRenderTarget.texture\n this.hBlurMaterial.uniforms['size'].value.set(this.resolution.x, this.resolution.y)\n this.hBlurMaterial.blending = NoBlending\n\n this.materialCopy = new ShaderMaterial({\n uniforms: UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n blending: NoBlending,\n })\n this.materialCopy.transparent = true\n this.materialCopy.depthTest = false\n this.materialCopy.depthWrite = false\n this.materialCopy.blending = CustomBlending\n this.materialCopy.blendSrc = DstColorFactor\n this.materialCopy.blendDst = ZeroFactor\n this.materialCopy.blendEquation = AddEquation\n this.materialCopy.blendSrcAlpha = DstAlphaFactor\n this.materialCopy.blendDstAlpha = ZeroFactor\n this.materialCopy.blendEquationAlpha = AddEquation\n\n this.depthCopy = new ShaderMaterial({\n uniforms: UniformsUtils.clone(UnpackDepthRGBAShader.uniforms),\n vertexShader: UnpackDepthRGBAShader.vertexShader,\n fragmentShader: UnpackDepthRGBAShader.fragmentShader,\n blending: NoBlending,\n })\n\n this.fsQuad = new FullScreenQuad(null)\n }\n\n render(renderer, writeBuffer, readBuffer /*, deltaTime, maskActive*/) {\n // Rendering readBuffer first when rendering to screen\n if (this.renderToScreen) {\n this.materialCopy.blending = NoBlending\n this.materialCopy.uniforms['tDiffuse'].value = readBuffer.texture\n this.materialCopy.needsUpdate = true\n this.renderPass(renderer, this.materialCopy, null)\n }\n\n if (this.params.output === 1) {\n return\n }\n\n renderer.getClearColor(this._oldClearColor)\n this.oldClearAlpha = renderer.getClearAlpha()\n const oldAutoClear = renderer.autoClear\n renderer.autoClear = false\n\n renderer.setRenderTarget(this.depthRenderTarget)\n renderer.clear()\n\n this.saoMaterial.uniforms['bias'].value = this.params.saoBias\n this.saoMaterial.uniforms['intensity'].value = this.params.saoIntensity\n this.saoMaterial.uniforms['scale'].value = this.params.saoScale\n this.saoMaterial.uniforms['kernelRadius'].value = this.params.saoKernelRadius\n this.saoMaterial.uniforms['minResolution'].value = this.params.saoMinResolution\n this.saoMaterial.uniforms['cameraNear'].value = this.camera.near\n this.saoMaterial.uniforms['cameraFar'].value = this.camera.far\n // this.saoMaterial.uniforms['randomSeed'].value = Math.random();\n\n const depthCutoff = this.params.saoBlurDepthCutoff * (this.camera.far - this.camera.near)\n this.vBlurMaterial.uniforms['depthCutoff'].value = depthCutoff\n this.hBlurMaterial.uniforms['depthCutoff'].value = depthCutoff\n\n this.vBlurMaterial.uniforms['cameraNear'].value = this.camera.near\n this.vBlurMaterial.uniforms['cameraFar'].value = this.camera.far\n this.hBlurMaterial.uniforms['cameraNear'].value = this.camera.near\n this.hBlurMaterial.uniforms['cameraFar'].value = this.camera.far\n\n this.params.saoBlurRadius = Math.floor(this.params.saoBlurRadius)\n if (this.prevStdDev !== this.params.saoBlurStdDev || this.prevNumSamples !== this.params.saoBlurRadius) {\n BlurShaderUtils.configure(\n this.vBlurMaterial,\n this.params.saoBlurRadius,\n this.params.saoBlurStdDev,\n new Vector2(0, 1),\n )\n BlurShaderUtils.configure(\n this.hBlurMaterial,\n this.params.saoBlurRadius,\n this.params.saoBlurStdDev,\n new Vector2(1, 0),\n )\n this.prevStdDev = this.params.saoBlurStdDev\n this.prevNumSamples = this.params.saoBlurRadius\n }\n\n // Rendering scene to depth texture\n renderer.setClearColor(0x000000)\n renderer.setRenderTarget(this.beautyRenderTarget)\n renderer.clear()\n renderer.render(this.scene, this.camera)\n\n // Re-render scene if depth texture extension is not supported\n if (!this.supportsDepthTextureExtension) {\n // Clear rule : far clipping plane in both RGBA and Basic encoding\n this.renderOverride(renderer, this.depthMaterial, this.depthRenderTarget, 0x000000, 1.0)\n }\n\n if (this.supportsNormalTexture) {\n // Clear rule : default normal is facing the camera\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0)\n }\n\n // Rendering SAO texture\n this.renderPass(renderer, this.saoMaterial, this.saoRenderTarget, 0xffffff, 1.0)\n\n // Blurring SAO texture\n if (this.params.saoBlur) {\n this.renderPass(renderer, this.vBlurMaterial, this.blurIntermediateRenderTarget, 0xffffff, 1.0)\n this.renderPass(renderer, this.hBlurMaterial, this.saoRenderTarget, 0xffffff, 1.0)\n }\n\n let outputMaterial = this.materialCopy\n // Setting up SAO rendering\n if (this.params.output === 3) {\n if (this.supportsDepthTextureExtension) {\n this.materialCopy.uniforms['tDiffuse'].value = this.beautyRenderTarget.depthTexture\n this.materialCopy.needsUpdate = true\n } else {\n this.depthCopy.uniforms['tDiffuse'].value = this.depthRenderTarget.texture\n this.depthCopy.needsUpdate = true\n outputMaterial = this.depthCopy\n }\n } else if (this.params.output === 4) {\n this.materialCopy.uniforms['tDiffuse'].value = this.normalRenderTarget.texture\n this.materialCopy.needsUpdate = true\n } else {\n this.materialCopy.uniforms['tDiffuse'].value = this.saoRenderTarget.texture\n this.materialCopy.needsUpdate = true\n }\n\n // Blending depends on output, only want a CustomBlending when showing SAO\n if (this.params.output === 0) {\n outputMaterial.blending = CustomBlending\n } else {\n outputMaterial.blending = NoBlending\n }\n\n // Rendering SAOPass result on top of previous pass\n this.renderPass(renderer, outputMaterial, this.renderToScreen ? null : readBuffer)\n\n renderer.setClearColor(this._oldClearColor, this.oldClearAlpha)\n renderer.autoClear = oldAutoClear\n }\n\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n // save original state\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n\n // setup pass state\n renderer.autoClear = false\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.fsQuad.material = passMaterial\n this.fsQuad.render(renderer)\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.overrideMaterial = overrideMaterial\n renderer.render(this.scene, this.camera)\n this.scene.overrideMaterial = null\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n setSize(width, height) {\n this.beautyRenderTarget.setSize(width, height)\n this.saoRenderTarget.setSize(width, height)\n this.blurIntermediateRenderTarget.setSize(width, height)\n this.normalRenderTarget.setSize(width, height)\n this.depthRenderTarget.setSize(width, height)\n\n this.saoMaterial.uniforms['size'].value.set(width, height)\n this.saoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n this.saoMaterial.uniforms['cameraProjectionMatrix'].value = this.camera.projectionMatrix\n this.saoMaterial.needsUpdate = true\n\n this.vBlurMaterial.uniforms['size'].value.set(width, height)\n this.vBlurMaterial.needsUpdate = true\n\n this.hBlurMaterial.uniforms['size'].value.set(width, height)\n this.hBlurMaterial.needsUpdate = true\n }\n\n dispose() {\n this.saoRenderTarget.dispose()\n this.blurIntermediateRenderTarget.dispose()\n this.beautyRenderTarget.dispose()\n this.normalRenderTarget.dispose()\n this.depthRenderTarget.dispose()\n\n this.depthMaterial.dispose()\n this.normalMaterial.dispose()\n this.saoMaterial.dispose()\n this.vBlurMaterial.dispose()\n this.hBlurMaterial.dispose()\n this.materialCopy.dispose()\n this.depthCopy.dispose()\n\n this.fsQuad.dispose()\n }\n}\n\nexport { SAOPass }\n", "/**\n * Afterimage shader\n * I created this effect inspired by a demo on codepen:\n * https://codepen.io/brunoimbrizi/pen/MoRJaN?page=1&\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type AfterimageShaderUniforms = {\n damp: IUniform\n tNew: IUniform\n tOld: IUniform\n}\n\nexport interface IAfterimageShader extends IShader {}\n\nexport const AfterimageShader: IAfterimageShader = {\n uniforms: {\n damp: { value: 0.96 },\n tOld: { value: null },\n tNew: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float damp;',\n\n 'uniform sampler2D tOld;',\n 'uniform sampler2D tNew;',\n\n 'varying vec2 vUv;',\n\n 'vec4 when_gt( vec4 x, float y ) {',\n\n '\treturn max( sign( x - y ), 0.0 );',\n\n '}',\n\n 'void main() {',\n\n '\tvec4 texelOld = texture2D( tOld, vUv );',\n '\tvec4 texelNew = texture2D( tNew, vUv );',\n\n '\ttexelOld *= damp * when_gt( texelOld, 0.1 );',\n\n '\tgl_FragColor = max(texelNew, texelOld);',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Dot screen shader\n * based on glfx.js sepia shader\n * https://github.com/evanw/glfx.js\n */\n\nexport const DotScreenShader = {\n uniforms: {\n tDiffuse: { value: null },\n tSize: { value: new Vector2(256, 256) },\n center: { value: new Vector2(0.5, 0.5) },\n angle: { value: 1.57 },\n scale: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec2 center;',\n 'uniform float angle;',\n 'uniform float scale;',\n 'uniform vec2 tSize;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'float pattern() {',\n\n '\tfloat s = sin( angle ), c = cos( angle );',\n\n '\tvec2 tex = vUv * tSize - center;',\n '\tvec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;',\n\n '\treturn ( sin( point.x ) * sin( point.y ) ) * 4.0;',\n\n '}',\n\n 'void main() {',\n\n '\tvec4 color = texture2D( tDiffuse, vUv );',\n\n '\tfloat average = ( color.r + color.g + color.b ) / 3.0;',\n\n '\tgl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Matrix4, Vector2 } from 'three'\n/**\n * References:\n * https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html\n */\n\nexport const SSRShader = {\n defines: {\n MAX_STEP: 0,\n isPerspectiveCamera: true,\n isDistanceAttenuation: true,\n isFresnel: true,\n isInfiniteThick: false,\n isSelective: false,\n },\n\n uniforms: {\n tDiffuse: { value: null },\n tNormal: { value: null },\n tMetalness: { value: null },\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n resolution: { value: new Vector2() },\n cameraProjectionMatrix: { value: new Matrix4() },\n cameraInverseProjectionMatrix: { value: new Matrix4() },\n opacity: { value: 0.5 },\n maxDistance: { value: 180 },\n cameraRange: { value: 0 },\n surfDist: { value: 0.007 },\n thickTolerance: { value: 0.03 },\n },\n\n vertexShader: /* glsl */ `\n\n varying vec2 vUv;\n\n void main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `,\n\n fragmentShader: /* glsl */ `\n\t\t// precision highp float;\n\t\tprecision highp sampler2D;\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tDepth;\n\t\tuniform sampler2D tNormal;\n\t\tuniform sampler2D tMetalness;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float cameraRange;\n\t\tuniform vec2 resolution;\n\t\tuniform float opacity;\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n\t\tuniform float maxDistance;\n\t\tuniform float surfDist;\n\t\tuniform mat4 cameraProjectionMatrix;\n\t\tuniform mat4 cameraInverseProjectionMatrix;\n\t\tuniform float thickTolerance;\n\t\t#include \n\t\tfloat pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {\n\t\t\t//x0: point, x1: linePointA, x2: linePointB\n\t\t\t//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html\n\t\t\treturn length(cross(x0-x1,x0-x2))/length(x2-x1);\n\t\t}\n\t\tfloat pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){\n\t\t\t// https://mathworld.wolfram.com/Point-PlaneDistance.html\n\t\t\t//// https://en.wikipedia.org/wiki/Plane_(geometry)\n\t\t\t//// http://paulbourke.net/geometry/pointlineplane/\n\t\t\tfloat a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;\n\t\t\tfloat x0=point.x,y0=point.y,z0=point.z;\n\t\t\tfloat x=planePoint.x,y=planePoint.y,z=planePoint.z;\n\t\t\tfloat d=-(a*x+b*y+c*z);\n\t\t\tfloat distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);\n\t\t\treturn distance;\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#else\n\t\t\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#endif\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view\n\t\t}\n\t\tvec3 getViewNormal( const in vec2 uv ) {\n\t\t\treturn unpackRGBToNormal( texture2D( tNormal, uv ).xyz );\n\t\t}\n\t\tvec2 viewPositionToXY(vec3 viewPosition){\n\t\t\tvec2 xy;\n\t\t\tvec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);\n\t\t\txy=clip.xy;//clip\n\t\t\tfloat clipW=clip.w;\n\t\t\txy/=clipW;//NDC\n\t\t\txy=(xy+1.)/2.;//uv\n\t\t\txy*=resolution;//screen\n\t\t\treturn xy;\n\t\t}\n\t\tvoid main(){\n\t\t\t#ifdef isSelective\n\t\t\t\tfloat metalness=texture2D(tMetalness,vUv).r;\n\t\t\t\tif(metalness==0.) return;\n\t\t\t#endif\n\n\t\t\tfloat depth = getDepth( vUv );\n\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\tif(-viewZ>=cameraFar) return;\n\n\t\t\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];\n\t\t\tvec3 viewPosition=getViewPosition( vUv, depth, clipW );\n\n\t\t\tvec2 d0=gl_FragCoord.xy;\n\t\t\tvec2 d1;\n\n\t\t\tvec3 viewNormal=getViewNormal( vUv );\n\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tvec3 viewIncidenceDir=normalize(viewPosition);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#else\n\t\t\t\tvec3 viewIncidenceDir=vec3(0,0,-1);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#endif\n\n\t\t\tfloat maxReflectRayLen=maxDistance/dot(-viewIncidenceDir,viewNormal);\n\t\t\t// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html\n\t\t\t// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen=cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen==dot(a,b)\n\t\t\t// maxReflectRayLen==maxDistance/dot(a,b)\n\n\t\t\tvec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tif(d1viewPosition.z>-cameraNear){\n\t\t\t\t\t//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx\n\t\t\t\t\tfloat t=(-cameraNear-viewPosition.z)/viewReflectDir.z;\n\t\t\t\t\td1viewPosition=viewPosition+viewReflectDir*t;\n\t\t\t\t}\n\t\t\t#endif\n\t\t\td1=viewPositionToXY(d1viewPosition);\n\n\t\t\tfloat totalLen=length(d1-d0);\n\t\t\tfloat xLen=d1.x-d0.x;\n\t\t\tfloat yLen=d1.y-d0.y;\n\t\t\tfloat totalStep=max(abs(xLen),abs(yLen));\n\t\t\tfloat xSpan=xLen/totalStep;\n\t\t\tfloat ySpan=yLen/totalStep;\n\t\t\tfor(float i=0.;i=totalStep) break;\n\t\t\t\tvec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);\n\t\t\t\tif(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;\n\t\t\t\tfloat s=length(xy-d0)/totalLen;\n\t\t\t\tvec2 uv=xy/resolution;\n\n\t\t\t\tfloat d = getDepth(uv);\n\t\t\t\tfloat vZ = getViewZ( d );\n\t\t\t\tif(-vZ>=cameraFar) continue;\n\t\t\t\tfloat cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];\n\t\t\t\tvec3 vP=getViewPosition( uv, d, cW );\n\n\t\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\t\t// https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf\n\t\t\t\t\tfloat recipVPZ=1./viewPosition.z;\n\t\t\t\t\tfloat viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));\n\t\t\t\t\tfloat sD=surfDist*cW;\n\t\t\t\t#else\n\t\t\t\t\tfloat viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);\n\t\t\t\t\tfloat sD=surfDist;\n\t\t\t\t#endif\n\t\t\t\tif(viewReflectRayZ-sD>vZ) continue;\n\n\t\t\t\t#ifdef isInfiniteThick\n\t\t\t\t\tif(viewReflectRayZ+thickTolerance*clipW=0.) continue;\n\t\t\t\t\tfloat distance=pointPlaneDistance(vP,viewPosition,viewNormal);\n\t\t\t\t\tif(distance>maxDistance) break;\n\t\t\t\t\t#ifdef isDistanceAttenuation\n\t\t\t\t\t\tfloat ratio=1.-(distance/maxDistance);\n\t\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t\t#endif\n\t\t\t\t\t#ifdef isFresnel\n\t\t\t\t\t\tfloat fresnel=(dot(viewIncidenceDir,viewReflectDir)+1.)/2.;\n\t\t\t\t\t\top*=fresnel;\n\t\t\t\t\t#endif\n\t\t\t\t\tvec4 reflectColor=texture2D(tDiffuse,uv);\n\t\t\t\t\tgl_FragColor.xyz=reflectColor.xyz;\n\t\t\t\t\tgl_FragColor.a=op;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t`,\n}\n\nexport const SSRDepthShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1,\n },\n\n uniforms: {\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n },\n\n vertexShader: /* glsl */ `\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `,\n\n fragmentShader: /* glsl */ `\n\n uniform sampler2D tDepth;\n\n uniform float cameraNear;\n uniform float cameraFar;\n\n varying vec2 vUv;\n\n #include \n\n\t\tfloat getLinearDepth( const in vec2 uv ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\tfloat fragCoordZ = texture2D( tDepth, uv ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn texture2D( tDepth, uv ).x;\n\n\t\t\t#endif\n\n\t\t}\n\n void main() {\n\n \tfloat depth = getLinearDepth( vUv );\n\t\t\tfloat d = 1.0 - depth;\n\t\t\t// d=(d-.999)*1000.;\n \tgl_FragColor = vec4( vec3( d ), 1.0 );\n\n }\n\n `,\n}\n\nexport const SSRBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2() },\n opacity: { value: 0.5 },\n },\n\n vertexShader: /* glsl */ `\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `,\n\n fragmentShader: /* glsl */ `\n\n uniform sampler2D tDiffuse;\n uniform vec2 resolution;\n varying vec2 vUv;\n void main() {\n\t\t\t//reverse engineering from PhotoShop blur filter, then change coefficient\n\n \tvec2 texelSize = ( 1.0 / resolution );\n\n\t\t\tvec4 c=texture2D(tDiffuse,vUv);\n\n\t\t\tvec2 offset;\n\n\t\t\toffset=(vec2(-1,0))*texelSize;\n\t\t\tvec4 cl=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(1,0))*texelSize;\n\t\t\tvec4 cr=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,-1))*texelSize;\n\t\t\tvec4 cb=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,1))*texelSize;\n\t\t\tvec4 ct=texture2D(tDiffuse,vUv+offset);\n\n\t\t\t// float coeCenter=.5;\n\t\t\t// float coeSide=.125;\n\t\t\tfloat coeCenter=.2;\n\t\t\tfloat coeSide=.2;\n\t\t\tfloat a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;\n\t\t\tvec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;\n\t\t\tgl_FragColor=vec4(rgb,a);\n\n\t\t}\n\t`,\n}\n", "import {\n AddEquation,\n Color,\n NormalBlending,\n DepthTexture,\n SrcAlphaFactor,\n OneMinusSrcAlphaFactor,\n MeshNormalMaterial,\n MeshBasicMaterial,\n NearestFilter,\n NoBlending,\n ShaderMaterial,\n UniformsUtils,\n UnsignedShortType,\n WebGLRenderTarget,\n HalfFloatType,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { SSRShader } from '../shaders/SSRShader'\nimport { SSRBlurShader } from '../shaders/SSRShader'\nimport { SSRDepthShader } from '../shaders/SSRShader'\nimport { CopyShader } from '../shaders/CopyShader'\n\nclass SSRPass extends Pass {\n static OUTPUT = {\n Default: 0,\n SSR: 1,\n Beauty: 3,\n Depth: 4,\n Normal: 5,\n Metalness: 7,\n }\n constructor({ renderer, scene, camera, width, height, selects, bouncing = false, groundReflector }) {\n super()\n\n this.width = width !== undefined ? width : 512\n this.height = height !== undefined ? height : 512\n\n this.clear = true\n\n this.renderer = renderer\n this.scene = scene\n this.camera = camera\n this.groundReflector = groundReflector\n\n this.opacity = SSRShader.uniforms.opacity.value\n this.output = 0\n\n this.maxDistance = SSRShader.uniforms.maxDistance.value\n this.thickness = SSRShader.uniforms.thickness.value\n\n this.tempColor = new Color()\n\n this._selects = selects\n this.selective = Array.isArray(this._selects)\n Object.defineProperty(this, 'selects', {\n get() {\n return this._selects\n },\n set(val) {\n if (this._selects === val) return\n this._selects = val\n if (Array.isArray(val)) {\n this.selective = true\n this.ssrMaterial.defines.SELECTIVE = true\n this.ssrMaterial.needsUpdate = true\n } else {\n this.selective = false\n this.ssrMaterial.defines.SELECTIVE = false\n this.ssrMaterial.needsUpdate = true\n }\n },\n })\n\n this._bouncing = bouncing\n Object.defineProperty(this, 'bouncing', {\n get() {\n return this._bouncing\n },\n set(val) {\n if (this._bouncing === val) return\n this._bouncing = val\n if (val) {\n this.ssrMaterial.uniforms['tDiffuse'].value = this.prevRenderTarget.texture\n } else {\n this.ssrMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n }\n },\n })\n\n this.blur = true\n\n this._distanceAttenuation = SSRShader.defines.DISTANCE_ATTENUATION\n Object.defineProperty(this, 'distanceAttenuation', {\n get() {\n return this._distanceAttenuation\n },\n set(val) {\n if (this._distanceAttenuation === val) return\n this._distanceAttenuation = val\n this.ssrMaterial.defines.DISTANCE_ATTENUATION = val\n this.ssrMaterial.needsUpdate = true\n },\n })\n\n this._fresnel = SSRShader.defines.FRESNEL\n Object.defineProperty(this, 'fresnel', {\n get() {\n return this._fresnel\n },\n set(val) {\n if (this._fresnel === val) return\n this._fresnel = val\n this.ssrMaterial.defines.FRESNEL = val\n this.ssrMaterial.needsUpdate = true\n },\n })\n\n this._infiniteThick = SSRShader.defines.INFINITE_THICK\n Object.defineProperty(this, 'infiniteThick', {\n get() {\n return this._infiniteThick\n },\n set(val) {\n if (this._infiniteThick === val) return\n this._infiniteThick = val\n this.ssrMaterial.defines.INFINITE_THICK = val\n this.ssrMaterial.needsUpdate = true\n },\n })\n\n // beauty render target with depth buffer\n\n const depthTexture = new DepthTexture()\n depthTexture.type = UnsignedShortType\n depthTexture.minFilter = NearestFilter\n depthTexture.magFilter = NearestFilter\n\n this.beautyRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n depthTexture: depthTexture,\n depthBuffer: true,\n })\n\n //for bouncing\n this.prevRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n })\n\n // normal render target\n\n this.normalRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n })\n\n // metalness render target\n\n this.metalnessRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n })\n\n // ssr render target\n\n this.ssrRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n })\n\n this.blurRenderTarget = this.ssrRenderTarget.clone()\n this.blurRenderTarget2 = this.ssrRenderTarget.clone()\n // this.blurRenderTarget3 = this.ssrRenderTarget.clone();\n\n // ssr material\n\n this.ssrMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSRShader.defines, {\n MAX_STEP: Math.sqrt(this.width * this.width + this.height * this.height),\n }),\n uniforms: UniformsUtils.clone(SSRShader.uniforms),\n vertexShader: SSRShader.vertexShader,\n fragmentShader: SSRShader.fragmentShader,\n blending: NoBlending,\n })\n\n this.ssrMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.ssrMaterial.uniforms['tNormal'].value = this.normalRenderTarget.texture\n this.ssrMaterial.defines.SELECTIVE = this.selective\n this.ssrMaterial.needsUpdate = true\n this.ssrMaterial.uniforms['tMetalness'].value = this.metalnessRenderTarget.texture\n this.ssrMaterial.uniforms['tDepth'].value = this.beautyRenderTarget.depthTexture\n this.ssrMaterial.uniforms['cameraNear'].value = this.camera.near\n this.ssrMaterial.uniforms['cameraFar'].value = this.camera.far\n this.ssrMaterial.uniforms['thickness'].value = this.thickness\n this.ssrMaterial.uniforms['resolution'].value.set(this.width, this.height)\n this.ssrMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssrMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n // normal material\n\n this.normalMaterial = new MeshNormalMaterial()\n this.normalMaterial.blending = NoBlending\n\n // metalnessOn material\n\n this.metalnessOnMaterial = new MeshBasicMaterial({\n color: 'white',\n })\n\n // metalnessOff material\n\n this.metalnessOffMaterial = new MeshBasicMaterial({\n color: 'black',\n })\n\n // blur material\n\n this.blurMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSRBlurShader.defines),\n uniforms: UniformsUtils.clone(SSRBlurShader.uniforms),\n vertexShader: SSRBlurShader.vertexShader,\n fragmentShader: SSRBlurShader.fragmentShader,\n })\n this.blurMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.blurMaterial.uniforms['resolution'].value.set(this.width, this.height)\n\n // blur material 2\n\n this.blurMaterial2 = new ShaderMaterial({\n defines: Object.assign({}, SSRBlurShader.defines),\n uniforms: UniformsUtils.clone(SSRBlurShader.uniforms),\n vertexShader: SSRBlurShader.vertexShader,\n fragmentShader: SSRBlurShader.fragmentShader,\n })\n this.blurMaterial2.uniforms['tDiffuse'].value = this.blurRenderTarget.texture\n this.blurMaterial2.uniforms['resolution'].value.set(this.width, this.height)\n\n // // blur material 3\n\n // this.blurMaterial3 = new ShaderMaterial({\n // defines: Object.assign({}, SSRBlurShader.defines),\n // uniforms: UniformsUtils.clone(SSRBlurShader.uniforms),\n // vertexShader: SSRBlurShader.vertexShader,\n // fragmentShader: SSRBlurShader.fragmentShader\n // });\n // this.blurMaterial3.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture;\n // this.blurMaterial3.uniforms['resolution'].value.set(this.width, this.height);\n\n // material for rendering the depth\n\n this.depthRenderMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSRDepthShader.defines),\n uniforms: UniformsUtils.clone(SSRDepthShader.uniforms),\n vertexShader: SSRDepthShader.vertexShader,\n fragmentShader: SSRDepthShader.fragmentShader,\n blending: NoBlending,\n })\n this.depthRenderMaterial.uniforms['tDepth'].value = this.beautyRenderTarget.depthTexture\n this.depthRenderMaterial.uniforms['cameraNear'].value = this.camera.near\n this.depthRenderMaterial.uniforms['cameraFar'].value = this.camera.far\n\n // material for rendering the content of a render target\n\n this.copyMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n blendSrc: SrcAlphaFactor,\n blendDst: OneMinusSrcAlphaFactor,\n blendEquation: AddEquation,\n blendSrcAlpha: SrcAlphaFactor,\n blendDstAlpha: OneMinusSrcAlphaFactor,\n blendEquationAlpha: AddEquation,\n // premultipliedAlpha:true,\n })\n\n this.fsQuad = new FullScreenQuad(null)\n\n this.originalClearColor = new Color()\n }\n\n dispose() {\n // dispose render targets\n\n this.beautyRenderTarget.dispose()\n this.prevRenderTarget.dispose()\n this.normalRenderTarget.dispose()\n this.metalnessRenderTarget.dispose()\n this.ssrRenderTarget.dispose()\n this.blurRenderTarget.dispose()\n this.blurRenderTarget2.dispose()\n // this.blurRenderTarget3.dispose();\n\n // dispose materials\n\n this.normalMaterial.dispose()\n this.metalnessOnMaterial.dispose()\n this.metalnessOffMaterial.dispose()\n this.blurMaterial.dispose()\n this.blurMaterial2.dispose()\n this.copyMaterial.dispose()\n this.depthRenderMaterial.dispose()\n\n // dipsose full screen quad\n\n this.fsQuad.dispose()\n }\n\n render(renderer, writeBuffer /*, readBuffer, deltaTime, maskActive */) {\n // render beauty and depth\n\n renderer.setRenderTarget(this.beautyRenderTarget)\n renderer.clear()\n if (this.groundReflector) {\n this.groundReflector.visible = false\n this.groundReflector.doRender(this.renderer, this.scene, this.camera)\n this.groundReflector.visible = true\n }\n\n renderer.render(this.scene, this.camera)\n if (this.groundReflector) this.groundReflector.visible = false\n\n // render normals\n\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 0, 0)\n\n // render metalnesses\n\n if (this.selective) {\n this.renderMetalness(renderer, this.metalnessOnMaterial, this.metalnessRenderTarget, 0, 0)\n }\n\n // render SSR\n\n this.ssrMaterial.uniforms['opacity'].value = this.opacity\n this.ssrMaterial.uniforms['maxDistance'].value = this.maxDistance\n this.ssrMaterial.uniforms['thickness'].value = this.thickness\n this.renderPass(renderer, this.ssrMaterial, this.ssrRenderTarget)\n\n // render blur\n\n if (this.blur) {\n this.renderPass(renderer, this.blurMaterial, this.blurRenderTarget)\n this.renderPass(renderer, this.blurMaterial2, this.blurRenderTarget2)\n // this.renderPass(renderer, this.blurMaterial3, this.blurRenderTarget3);\n }\n\n // output result to screen\n\n switch (this.output) {\n case SSRPass.OUTPUT.Default:\n if (this.bouncing) {\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NormalBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n\n this.copyMaterial.uniforms['tDiffuse'].value = this.prevRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n } else {\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NormalBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n }\n\n break\n case SSRPass.OUTPUT.SSR:\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n if (this.bouncing) {\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n\n this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NormalBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n }\n\n break\n\n case SSRPass.OUTPUT.Beauty:\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSRPass.OUTPUT.Depth:\n this.renderPass(renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSRPass.OUTPUT.Normal:\n this.copyMaterial.uniforms['tDiffuse'].value = this.normalRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSRPass.OUTPUT.Metalness:\n this.copyMaterial.uniforms['tDiffuse'].value = this.metalnessRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n default:\n console.warn('THREE.SSRPass: Unknown output type.')\n }\n }\n\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n // save original state\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor))\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor)\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n\n // setup pass state\n renderer.autoClear = false\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.fsQuad.material = passMaterial\n this.fsQuad.render(renderer)\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor))\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor)\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.overrideMaterial = overrideMaterial\n renderer.render(this.scene, this.camera)\n this.scene.overrideMaterial = null\n\n // restore original state\n\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderMetalness(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor))\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor)\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.traverseVisible((child) => {\n child._SSRPassBackupMaterial = child.material\n if (this._selects.includes(child)) {\n child.material = this.metalnessOnMaterial\n } else {\n child.material = this.metalnessOffMaterial\n }\n })\n renderer.render(this.scene, this.camera)\n this.scene.traverseVisible((child) => {\n child.material = child._SSRPassBackupMaterial\n })\n\n // restore original state\n\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n setSize(width, height) {\n this.width = width\n this.height = height\n\n this.ssrMaterial.defines.MAX_STEP = Math.sqrt(width * width + height * height)\n this.ssrMaterial.needsUpdate = true\n this.beautyRenderTarget.setSize(width, height)\n this.prevRenderTarget.setSize(width, height)\n this.ssrRenderTarget.setSize(width, height)\n this.normalRenderTarget.setSize(width, height)\n this.metalnessRenderTarget.setSize(width, height)\n this.blurRenderTarget.setSize(width, height)\n this.blurRenderTarget2.setSize(width, height)\n // this.blurRenderTarget3.setSize(width, height);\n\n this.ssrMaterial.uniforms['resolution'].value.set(width, height)\n this.ssrMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssrMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n this.blurMaterial.uniforms['resolution'].value.set(width, height)\n this.blurMaterial2.uniforms['resolution'].value.set(width, height)\n }\n}\n\nexport { SSRPass }\n", "import { Vector2 } from 'three'\n\n/**\n * Convolution shader\n * ported from o3d sample to WebGL / GLSL\n * http://o3d.googlecode.com/svn/trunk/samples/convolution.html\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type ConvolutionShaderDefines = {\n KERNEL_SIZE_FLOAT: string\n KERNEL_SIZE_INT: string\n}\n\nexport type ConvolutionShaderUniforms = {\n cKernel: IUniform\n tDiffuse: IUniform\n uImageIncrement: IUniform\n}\n\nexport interface IConvolutionShader extends IShader {\n buildKernel: (sigma: number) => number[]\n}\n\nexport const ConvolutionShader: IConvolutionShader = {\n defines: {\n KERNEL_SIZE_FLOAT: '25.0',\n KERNEL_SIZE_INT: '25',\n },\n\n uniforms: {\n tDiffuse: { value: null },\n uImageIncrement: { value: new Vector2(0.001953125, 0.0) },\n cKernel: { value: [] },\n },\n\n vertexShader: [\n 'uniform vec2 uImageIncrement;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float cKernel[ KERNEL_SIZE_INT ];',\n\n 'uniform sampler2D tDiffuse;',\n 'uniform vec2 uImageIncrement;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 imageCoord = vUv;',\n '\tvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );',\n\n '\tfor( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {',\n\n '\t\tsum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];',\n '\t\timageCoord += uImageIncrement;',\n\n '\t}',\n\n '\tgl_FragColor = sum;',\n\n '}',\n ].join('\\n'),\n\n buildKernel: function (sigma) {\n // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway.\n\n function gauss(x: number, sigma: number): number {\n return Math.exp(-(x * x) / (2.0 * sigma * sigma))\n }\n\n const kMaxKernelSize = 25\n\n const kernelSize = Math.min(2 * Math.ceil(sigma * 3.0) + 1, kMaxKernelSize)\n\n const halfWidth = (kernelSize - 1) * 0.5\n\n const values: number[] = new Array(kernelSize)\n\n let sum = 0.0\n\n for (let i = 0; i < kernelSize; ++i) {\n values[i] = gauss(i - halfWidth, sigma)\n sum += values[i]\n }\n\n // normalize the kernel\n\n for (let i = 0; i < kernelSize; ++i) values[i] /= sum\n\n return values\n },\n}\n", "import { WebGLRenderer } from 'three'\n\nclass ARButton {\n static createButton(renderer: WebGLRenderer, sessionInit: XRSessionInit = {}): HTMLButtonElement | HTMLAnchorElement {\n const button = document.createElement('button')\n\n function showStartAR(/*device*/): void {\n if ((sessionInit as any).domOverlay === undefined) {\n const overlay = document.createElement('div')\n overlay.style.display = 'none'\n document.body.appendChild(overlay)\n\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')\n svg.setAttribute('width', '38px')\n svg.setAttribute('height', '38px')\n svg.style.position = 'absolute'\n svg.style.right = '20px'\n svg.style.top = '20px'\n svg.addEventListener('click', function () {\n currentSession?.end()\n })\n overlay.appendChild(svg)\n\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')\n path.setAttribute('d', 'M 12,12 L 28,28 M 28,12 12,28')\n path.setAttribute('stroke', '#fff')\n path.setAttribute('stroke-width', '2px')\n svg.appendChild(path)\n\n if (sessionInit.optionalFeatures === undefined) {\n sessionInit.optionalFeatures = []\n }\n\n sessionInit.optionalFeatures.push('dom-overlay')\n ;(sessionInit as any).domOverlay = { root: overlay }\n }\n\n //\n\n let currentSession: XRSession | null = null\n\n async function onSessionStarted(session: XRSession): Promise {\n session.addEventListener('end', onSessionEnded)\n\n renderer.xr.setReferenceSpaceType('local')\n\n await renderer.xr.setSession(session as any)\n\n button.textContent = 'STOP AR'\n ;(sessionInit as any).domOverlay!.root.style.display = ''\n\n currentSession = session\n }\n\n function onSessionEnded(/*event*/): void {\n currentSession!.removeEventListener('end', onSessionEnded)\n\n button.textContent = 'START AR'\n ;(sessionInit as any).domOverlay!.root.style.display = 'none'\n\n currentSession = null\n }\n\n //\n\n button.style.display = ''\n\n button.style.cursor = 'pointer'\n button.style.left = 'calc(50% - 50px)'\n button.style.width = '100px'\n\n button.textContent = 'START AR'\n\n button.onmouseenter = (): void => {\n button.style.opacity = '1.0'\n }\n\n button.onmouseleave = (): void => {\n button.style.opacity = '0.5'\n }\n\n button.onclick = (): void => {\n if (currentSession === null) {\n ;(navigator as Navigator).xr!.requestSession('immersive-ar', sessionInit).then(onSessionStarted)\n } else {\n currentSession.end()\n }\n }\n }\n\n function disableButton(): void {\n button.style.display = ''\n\n button.style.cursor = 'auto'\n button.style.left = 'calc(50% - 75px)'\n button.style.width = '150px'\n\n button.onmouseenter = null\n button.onmouseleave = null\n\n button.onclick = null\n }\n\n function showARNotSupported(): void {\n disableButton()\n\n button.textContent = 'AR NOT SUPPORTED'\n }\n\n function stylizeElement(element: HTMLElement): void {\n element.style.position = 'absolute'\n element.style.bottom = '20px'\n element.style.padding = '12px 6px'\n element.style.border = '1px solid #fff'\n element.style.borderRadius = '4px'\n element.style.background = 'rgba(0,0,0,0.1)'\n element.style.color = '#fff'\n element.style.font = 'normal 13px sans-serif'\n element.style.textAlign = 'center'\n element.style.opacity = '0.5'\n element.style.outline = 'none'\n element.style.zIndex = '999'\n }\n\n if ('xr' in navigator) {\n button.id = 'ARButton'\n button.style.display = 'none'\n\n stylizeElement(button)\n\n // Query for session mode\n ;(navigator as Navigator)\n .xr!.isSessionSupported('immersive-ar')\n .then(function (supported: boolean) {\n supported ? showStartAR() : showARNotSupported()\n })\n .catch(showARNotSupported)\n\n return button\n } else {\n const message = document.createElement('a')\n\n if (window.isSecureContext === false) {\n message.href = document.location.href.replace(/^http:/, 'https:')\n message.innerHTML = 'WEBXR NEEDS HTTPS' // TODO Improve message\n } else {\n message.href = 'https://immersiveweb.dev/'\n message.innerHTML = 'WEBXR NOT AVAILABLE'\n }\n\n message.style.left = 'calc(50% - 90px)'\n message.style.width = '180px'\n message.style.textDecoration = 'none'\n\n stylizeElement(message)\n\n return message\n }\n }\n}\n\nexport { ARButton }\n", "export function decodeText(array) {\n if (typeof TextDecoder !== 'undefined') {\n return new TextDecoder().decode(array)\n }\n\n // Avoid the String.fromCharCode.apply(null, array) shortcut, which\n // throws a \"maximum call stack size exceeded\" error for large arrays.\n\n let s = ''\n\n for (let i = 0, il = array.length; i < il; i++) {\n // Implicitly assumes little-endian.\n s += String.fromCharCode(array[i])\n }\n\n try {\n // merges multi-byte utf-8 characters.\n\n return decodeURIComponent(escape(s))\n } catch (e) {\n // see https://github.com/mrdoob/three.js/issues/16358\n\n return s\n }\n}\n", "import {\n AnimationClip,\n Bone,\n Box3,\n BufferAttribute,\n BufferGeometry,\n ClampToEdgeWrapping,\n Color,\n DirectionalLight,\n DoubleSide,\n FileLoader,\n FrontSide,\n Group,\n ImageBitmapLoader,\n InstancedMesh,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n Interpolant,\n InterpolateDiscrete,\n InterpolateLinear,\n Line,\n LineBasicMaterial,\n LineLoop,\n LineSegments,\n LinearFilter,\n LinearMipmapLinearFilter,\n LinearMipmapNearestFilter,\n Loader,\n LoaderUtils,\n Material,\n MathUtils,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n MeshPhysicalMaterial,\n MeshStandardMaterial,\n MirroredRepeatWrapping,\n NearestFilter,\n NearestMipmapLinearFilter,\n NearestMipmapNearestFilter,\n NumberKeyframeTrack,\n Object3D,\n OrthographicCamera,\n PerspectiveCamera,\n PointLight,\n Points,\n PointsMaterial,\n PropertyBinding,\n Quaternion,\n QuaternionKeyframeTrack,\n RepeatWrapping,\n Skeleton,\n SkinnedMesh,\n Sphere,\n SpotLight,\n Texture,\n TextureLoader,\n TriangleFanDrawMode,\n TriangleStripDrawMode,\n Vector2,\n Vector3,\n VectorKeyframeTrack,\n InstancedBufferAttribute,\n} from 'three'\nimport { toTrianglesDrawMode } from '../utils/BufferGeometryUtils'\nimport { version } from '../_polyfill/constants'\nimport { decodeText } from '../_polyfill/LoaderUtils'\n\nconst SRGBColorSpace = 'srgb'\nconst LinearSRGBColorSpace = 'srgb-linear'\nconst sRGBEncoding = 3001\nconst LinearEncoding = 3000\n\nclass GLTFLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n this.dracoLoader = null\n this.ktx2Loader = null\n this.meshoptDecoder = null\n\n this.pluginCallbacks = []\n\n this.register(function (parser) {\n return new GLTFMaterialsClearcoatExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsDispersionExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFTextureBasisUExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFTextureWebPExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFTextureAVIFExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsSheenExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsTransmissionExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsVolumeExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsIorExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsEmissiveStrengthExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsSpecularExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsIridescenceExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsAnisotropyExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsBumpExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFLightsExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMeshoptCompression(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMeshGpuInstancing(parser)\n })\n }\n\n load(url, onLoad, onProgress, onError) {\n const scope = this\n\n let resourcePath\n\n if (this.resourcePath !== '') {\n resourcePath = this.resourcePath\n } else if (this.path !== '') {\n // If a base path is set, resources will be relative paths from that plus the relative path of the gltf file\n // Example path = 'https://my-cnd-server.com/', url = 'assets/models/model.gltf'\n // resourcePath = 'https://my-cnd-server.com/assets/models/'\n // referenced resource 'model.bin' will be loaded from 'https://my-cnd-server.com/assets/models/model.bin'\n // referenced resource '../textures/texture.png' will be loaded from 'https://my-cnd-server.com/assets/textures/texture.png'\n const relativeUrl = LoaderUtils.extractUrlBase(url)\n resourcePath = LoaderUtils.resolveURL(relativeUrl, this.path)\n } else {\n resourcePath = LoaderUtils.extractUrlBase(url)\n }\n\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\n const _onError = function (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n scope.manager.itemError(url)\n scope.manager.itemEnd(url)\n }\n\n const loader = new FileLoader(this.manager)\n\n loader.setPath(this.path)\n loader.setResponseType('arraybuffer')\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n function (data) {\n try {\n scope.parse(\n data,\n resourcePath,\n function (gltf) {\n onLoad(gltf)\n\n scope.manager.itemEnd(url)\n },\n _onError,\n )\n } catch (e) {\n _onError(e)\n }\n },\n onProgress,\n _onError,\n )\n }\n\n setDRACOLoader(dracoLoader) {\n this.dracoLoader = dracoLoader\n return this\n }\n\n setDDSLoader() {\n throw new Error('THREE.GLTFLoader: \"MSFT_texture_dds\" no longer supported. Please update to \"KHR_texture_basisu\".')\n }\n\n setKTX2Loader(ktx2Loader) {\n this.ktx2Loader = ktx2Loader\n return this\n }\n\n setMeshoptDecoder(meshoptDecoder) {\n this.meshoptDecoder = meshoptDecoder\n return this\n }\n\n register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) {\n this.pluginCallbacks.push(callback)\n }\n\n return this\n }\n\n unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) {\n this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1)\n }\n\n return this\n }\n\n parse(data, path, onLoad, onError) {\n let json\n const extensions = {}\n const plugins = {}\n\n if (typeof data === 'string') {\n json = JSON.parse(data)\n } else if (data instanceof ArrayBuffer) {\n const magic = decodeText(new Uint8Array(data.slice(0, 4)))\n\n if (magic === BINARY_EXTENSION_HEADER_MAGIC) {\n try {\n extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data)\n } catch (error) {\n if (onError) onError(error)\n return\n }\n\n json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content)\n } else {\n json = JSON.parse(decodeText(new Uint8Array(data)))\n }\n } else {\n json = data\n }\n\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\n const parser = new 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\n parser.fileLoader.setRequestHeader(this.requestHeader)\n\n for (let i = 0; i < this.pluginCallbacks.length; i++) {\n const plugin = this.pluginCallbacks[i](parser)\n\n if (!plugin.name) console.error('THREE.GLTFLoader: Invalid plugin found: missing name')\n\n plugins[plugin.name] = plugin\n\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\n if (json.extensionsUsed) {\n for (let i = 0; i < json.extensionsUsed.length; ++i) {\n const extensionName = json.extensionsUsed[i]\n const extensionsRequired = json.extensionsRequired || []\n\n switch (extensionName) {\n case EXTENSIONS.KHR_MATERIALS_UNLIT:\n extensions[extensionName] = new GLTFMaterialsUnlitExtension()\n break\n\n case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader)\n break\n\n case EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n extensions[extensionName] = new GLTFTextureTransformExtension()\n break\n\n case EXTENSIONS.KHR_MESH_QUANTIZATION:\n extensions[extensionName] = new GLTFMeshQuantizationExtension()\n break\n\n default:\n if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === undefined) {\n console.warn('THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".')\n }\n }\n }\n }\n\n parser.setExtensions(extensions)\n parser.setPlugins(plugins)\n parser.parse(onLoad, onError)\n }\n\n parseAsync(data, path) {\n const scope = this\n\n return new Promise(function (resolve, reject) {\n scope.parse(data, path, resolve, reject)\n })\n }\n}\n\n/* GLTFREGISTRY */\n\nfunction GLTFRegistry() {\n let objects = {}\n\n return {\n get: function (key) {\n return objects[key]\n },\n\n add: function (key, object) {\n objects[key] = object\n },\n\n remove: function (key) {\n delete objects[key]\n },\n\n removeAll: function () {\n objects = {}\n },\n }\n}\n\n/*********************************/\n/********** EXTENSIONS ***********/\n/*********************************/\n\nconst 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_DISPERSION: 'KHR_materials_dispersion',\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_MATERIALS_BUMP: 'EXT_materials_bump',\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/**\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL\n\n // Object3D instance caches\n this.cache = { refs: {}, uses: {} }\n }\n\n _markDefs() {\n const parser = this.parser\n const nodeDefs = this.parser.json.nodes || []\n\n for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {\n const nodeDef = nodeDefs[nodeIndex]\n\n if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== undefined) {\n parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light)\n }\n }\n }\n\n _loadLight(lightIndex) {\n const parser = this.parser\n const cacheKey = 'light:' + lightIndex\n let dependency = parser.cache.get(cacheKey)\n\n if (dependency) return dependency\n\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\n const color = new Color(0xffffff)\n\n if (lightDef.color !== undefined)\n color.setRGB(lightDef.color[0], lightDef.color[1], lightDef.color[2], LinearSRGBColorSpace)\n\n const range = lightDef.range !== undefined ? lightDef.range : 0\n\n switch (lightDef.type) {\n case 'directional':\n lightNode = new DirectionalLight(color)\n lightNode.target.position.set(0, 0, -1)\n lightNode.add(lightNode.target)\n break\n\n case 'point':\n lightNode = new PointLight(color)\n lightNode.distance = range\n break\n\n case 'spot':\n lightNode = new 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 =\n 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\n default:\n throw new Error('THREE.GLTFLoader: Unexpected light type: ' + lightDef.type)\n }\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\n lightNode.decay = 2\n\n assignExtrasToUserData(lightNode, lightDef)\n\n if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity\n\n lightNode.name = parser.createUniqueName(lightDef.name || 'light_' + lightIndex)\n\n dependency = Promise.resolve(lightNode)\n\n parser.cache.add(cacheKey, dependency)\n\n return dependency\n }\n\n getDependency(type, index) {\n if (type !== 'light') return\n\n return this._loadLight(index)\n }\n\n createNodeAttachment(nodeIndex) {\n const self = 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\n if (lightIndex === undefined) return null\n\n return this._loadLight(lightIndex).then(function (light) {\n return parser._getNodeRef(self.cache, lightIndex, light)\n })\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 constructor() {\n this.name = EXTENSIONS.KHR_MATERIALS_UNLIT\n }\n\n getMaterialType() {\n return MeshBasicMaterial\n }\n\n extendParams(materialParams, materialDef, parser) {\n const pending = []\n\n materialParams.color = new Color(1.0, 1.0, 1.0)\n materialParams.opacity = 1.0\n\n const metallicRoughness = materialDef.pbrMetallicRoughness\n\n if (metallicRoughness) {\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor\n\n materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace)\n materialParams.opacity = array[3]\n }\n\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace))\n }\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const emissiveStrength = materialDef.extensions[this.name].emissiveStrength\n\n if (emissiveStrength !== undefined) {\n materialParams.emissiveIntensity = emissiveStrength\n }\n\n return Promise.resolve()\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.clearcoatFactor !== undefined) {\n materialParams.clearcoat = extension.clearcoatFactor\n }\n\n if (extension.clearcoatTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatMap', extension.clearcoatTexture))\n }\n\n if (extension.clearcoatRoughnessFactor !== undefined) {\n materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor\n }\n\n if (extension.clearcoatRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture))\n }\n\n if (extension.clearcoatNormalTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture))\n\n if (extension.clearcoatNormalTexture.scale !== undefined) {\n const scale = extension.clearcoatNormalTexture.scale\n\n materialParams.clearcoatNormalScale = new Vector2(scale, scale)\n }\n }\n\n return Promise.all(pending)\n }\n}\n\n/**\n * Materials dispersion Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion\n */\nclass GLTFMaterialsDispersionExtension {\n constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.dispersion = extension.dispersion !== undefined ? extension.dispersion : 0\n\n return Promise.resolve()\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.iridescenceFactor !== undefined) {\n materialParams.iridescence = extension.iridescenceFactor\n }\n\n if (extension.iridescenceTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'iridescenceMap', extension.iridescenceTexture))\n }\n\n if (extension.iridescenceIor !== undefined) {\n materialParams.iridescenceIOR = extension.iridescenceIor\n }\n\n if (materialParams.iridescenceThicknessRange === undefined) {\n materialParams.iridescenceThicknessRange = [100, 400]\n }\n\n if (extension.iridescenceThicknessMinimum !== undefined) {\n materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum\n }\n\n if (extension.iridescenceThicknessMaximum !== undefined) {\n materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum\n }\n\n if (extension.iridescenceThicknessTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'iridescenceThicknessMap', extension.iridescenceThicknessTexture),\n )\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_SHEEN\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n materialParams.sheenColor = new Color(0, 0, 0)\n materialParams.sheenRoughness = 0\n materialParams.sheen = 1\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.sheenColorFactor !== undefined) {\n const colorFactor = extension.sheenColorFactor\n materialParams.sheenColor.setRGB(colorFactor[0], colorFactor[1], colorFactor[2], LinearSRGBColorSpace)\n }\n\n if (extension.sheenRoughnessFactor !== undefined) {\n materialParams.sheenRoughness = extension.sheenRoughnessFactor\n }\n\n if (extension.sheenColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'sheenColorMap', extension.sheenColorTexture, SRGBColorSpace))\n }\n\n if (extension.sheenRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.transmissionFactor !== undefined) {\n materialParams.transmission = extension.transmissionFactor\n }\n\n if (extension.transmissionTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'transmissionMap', extension.transmissionTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_VOLUME\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0\n\n if (extension.thicknessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'thicknessMap', extension.thicknessTexture))\n }\n\n materialParams.attenuationDistance = extension.attenuationDistance || Infinity\n\n const colorArray = extension.attenuationColor || [1, 1, 1]\n materialParams.attenuationColor = new Color().setRGB(\n colorArray[0],\n colorArray[1],\n colorArray[2],\n LinearSRGBColorSpace,\n )\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_IOR\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.ior = extension.ior !== undefined ? extension.ior : 1.5\n\n return Promise.resolve()\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0\n\n if (extension.specularTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'specularIntensityMap', extension.specularTexture))\n }\n\n const colorArray = extension.specularColorFactor || [1, 1, 1]\n materialParams.specularColor = new Color().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace)\n\n if (extension.specularColorTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'specularColorMap', extension.specularColorTexture, SRGBColorSpace),\n )\n }\n\n return Promise.all(pending)\n }\n}\n\n/**\n * Materials bump Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump\n */\nclass GLTFMaterialsBumpExtension {\n constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.EXT_MATERIALS_BUMP\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.bumpScale = extension.bumpFactor !== undefined ? extension.bumpFactor : 1.0\n\n if (extension.bumpTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'bumpMap', extension.bumpTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.anisotropyStrength !== undefined) {\n materialParams.anisotropy = extension.anisotropyStrength\n }\n\n if (extension.anisotropyRotation !== undefined) {\n materialParams.anisotropyRotation = extension.anisotropyRotation\n }\n\n if (extension.anisotropyTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'anisotropyMap', extension.anisotropyTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_TEXTURE_BASISU\n }\n\n loadTexture(textureIndex) {\n const parser = this.parser\n const json = parser.json\n\n const textureDef = json.textures[textureIndex]\n\n if (!textureDef.extensions || !textureDef.extensions[this.name]) {\n return null\n }\n\n const extension = textureDef.extensions[this.name]\n const loader = parser.options.ktx2Loader\n\n if (!loader) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error('THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures')\n } else {\n // Assumes that the extension is optional and that a fallback texture is present\n return null\n }\n }\n\n return parser.loadTextureImage(textureIndex, extension.source, loader)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.EXT_TEXTURE_WEBP\n this.isSupported = null\n }\n\n loadTexture(textureIndex) {\n const name = this.name\n const parser = this.parser\n const json = parser.json\n\n const textureDef = json.textures[textureIndex]\n\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null\n }\n\n const extension = textureDef.extensions[name]\n const source = json.images[extension.source]\n\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\n return this.detectSupport().then(function (isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader)\n\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error('THREE.GLTFLoader: WebP required by asset but unsupported.')\n }\n\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex)\n })\n }\n\n detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function (resolve) {\n const image = new Image()\n\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\n image.onload = image.onerror = function () {\n resolve(image.height === 1)\n }\n })\n }\n\n return this.isSupported\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.EXT_TEXTURE_AVIF\n this.isSupported = null\n }\n\n loadTexture(textureIndex) {\n const name = this.name\n const parser = this.parser\n const json = parser.json\n\n const textureDef = json.textures[textureIndex]\n\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null\n }\n\n const extension = textureDef.extensions[name]\n const source = json.images[extension.source]\n\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\n return this.detectSupport().then(function (isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader)\n\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error('THREE.GLTFLoader: AVIF required by asset but unsupported.')\n }\n\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex)\n })\n }\n\n detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function (resolve) {\n const image = new Image()\n\n // Lossy test image.\n image.src =\n 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI='\n image.onload = image.onerror = function () {\n resolve(image.height === 1)\n }\n })\n }\n\n return this.isSupported\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 constructor(parser) {\n this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION\n this.parser = parser\n }\n\n loadBufferView(index) {\n const json = this.parser.json\n const bufferView = json.bufferViews[index]\n\n if (bufferView.extensions && bufferView.extensions[this.name]) {\n const extensionDef = bufferView.extensions[this.name]\n\n const buffer = this.parser.getDependency('buffer', extensionDef.buffer)\n const decoder = this.parser.options.meshoptDecoder\n\n if (!decoder || !decoder.supported) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error('THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files')\n } else {\n // Assumes that the extension is optional and that fallback buffer data is present\n return null\n }\n }\n\n return buffer.then(function (res) {\n const byteOffset = extensionDef.byteOffset || 0\n const byteLength = extensionDef.byteLength || 0\n\n const count = extensionDef.count\n const stride = extensionDef.byteStride\n\n const source = new Uint8Array(res, byteOffset, byteLength)\n\n if (decoder.decodeGltfBufferAsync) {\n return decoder\n .decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter)\n .then(function (res) {\n return res.buffer\n })\n } else {\n // 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(\n new Uint8Array(result),\n count,\n stride,\n source,\n extensionDef.mode,\n extensionDef.filter,\n )\n return result\n })\n }\n })\n } else {\n return null\n }\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 constructor(parser) {\n this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING\n this.parser = parser\n }\n\n createNodeMesh(nodeIndex) {\n const json = this.parser.json\n const nodeDef = json.nodes[nodeIndex]\n\n if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === undefined) {\n return null\n }\n\n const meshDef = json.meshes[nodeDef.mesh]\n\n // No Points or Lines + Instancing support yet\n\n for (const primitive of meshDef.primitives) {\n if (\n primitive.mode !== WEBGL_CONSTANTS.TRIANGLES &&\n primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP &&\n primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN &&\n primitive.mode !== undefined\n ) {\n return null\n }\n }\n\n const extensionDef = nodeDef.extensions[this.name]\n const attributesDef = extensionDef.attributes\n\n // @TODO: Can we support InstancedMesh + SkinnedMesh?\n\n const pending = []\n const attributes = {}\n\n for (const key in attributesDef) {\n pending.push(\n this.parser.getDependency('accessor', attributesDef[key]).then((accessor) => {\n attributes[key] = accessor\n return attributes[key]\n }),\n )\n }\n\n if (pending.length < 1) {\n return null\n }\n\n pending.push(this.parser.createNodeMesh(nodeIndex))\n\n return Promise.all(pending).then((results) => {\n const nodeObject = results.pop()\n const meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject]\n const count = results[0].count // All attribute counts should be same\n const instancedMeshes = []\n\n for (const mesh of meshes) {\n // Temporal variables\n const m = new Matrix4()\n const p = new Vector3()\n const q = new Quaternion()\n const s = new Vector3(1, 1, 1)\n\n const instancedMesh = new InstancedMesh(mesh.geometry, mesh.material, count)\n\n for (let i = 0; i < count; i++) {\n if (attributes.TRANSLATION) {\n p.fromBufferAttribute(attributes.TRANSLATION, i)\n }\n\n if (attributes.ROTATION) {\n q.fromBufferAttribute(attributes.ROTATION, i)\n }\n\n if (attributes.SCALE) {\n s.fromBufferAttribute(attributes.SCALE, i)\n }\n\n instancedMesh.setMatrixAt(i, m.compose(p, q, s))\n }\n\n // Add instance attributes to the geometry, excluding TRS.\n for (const attributeName in attributes) {\n if (attributeName === '_COLOR_0') {\n const attr = attributes[attributeName]\n instancedMesh.instanceColor = new InstancedBufferAttribute(attr.array, attr.itemSize, attr.normalized)\n } else if (attributeName !== 'TRANSLATION' && attributeName !== 'ROTATION' && attributeName !== 'SCALE') {\n mesh.geometry.setAttribute(attributeName, attributes[attributeName])\n }\n }\n\n // Just in case\n Object3D.prototype.copy.call(instancedMesh, mesh)\n\n this.parser.assignFinalMaterial(instancedMesh)\n\n instancedMeshes.push(instancedMesh)\n }\n\n if (nodeObject.isGroup) {\n nodeObject.clear()\n\n nodeObject.add(...instancedMeshes)\n\n return nodeObject\n }\n\n return instancedMeshes[0]\n })\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 constructor(data) {\n this.name = EXTENSIONS.KHR_BINARY_GLTF\n this.content = null\n this.body = null\n\n const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH)\n\n this.header = {\n magic: decodeText(new Uint8Array(data.slice(0, 4))),\n version: headerView.getUint32(4, true),\n length: headerView.getUint32(8, true),\n }\n\n if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {\n throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.')\n } else if (this.header.version < 2.0) {\n throw new Error('THREE.GLTFLoader: Legacy binary file detected.')\n }\n\n const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH\n const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH)\n let chunkIndex = 0\n\n while (chunkIndex < chunkContentsLength) {\n const chunkLength = chunkView.getUint32(chunkIndex, true)\n chunkIndex += 4\n\n const chunkType = chunkView.getUint32(chunkIndex, true)\n chunkIndex += 4\n\n if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {\n const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength)\n this.content = decodeText(contentArray)\n } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {\n const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex\n this.body = data.slice(byteOffset, byteOffset + chunkLength)\n }\n\n // Clients must ignore chunks with unknown types.\n\n chunkIndex += chunkLength\n }\n\n if (this.content === null) {\n throw new Error('THREE.GLTFLoader: JSON content not found.')\n }\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 constructor(json, dracoLoader) {\n if (!dracoLoader) {\n throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.')\n }\n\n this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION\n this.json = json\n this.dracoLoader = dracoLoader\n this.dracoLoader.preload()\n }\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\n for (const attributeName in gltfAttributeMap) {\n const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase()\n\n threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName]\n }\n\n for (const attributeName in primitive.attributes) {\n const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase()\n\n if (gltfAttributeMap[attributeName] !== undefined) {\n const accessorDef = json.accessors[primitive.attributes[attributeName]]\n const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType]\n\n attributeTypeMap[threeAttributeName] = componentType.name\n attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true\n }\n }\n\n return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) {\n return new Promise(function (resolve, reject) {\n dracoLoader.decodeDracoFile(\n bufferView,\n function (geometry) {\n for (const attributeName in geometry.attributes) {\n const attribute = geometry.attributes[attributeName]\n const normalized = attributeNormalizedMap[attributeName]\n\n if (normalized !== undefined) attribute.normalized = normalized\n }\n\n resolve(geometry)\n },\n threeAttributeMap,\n attributeTypeMap,\n LinearSRGBColorSpace,\n reject,\n )\n })\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 */\nclass GLTFTextureTransformExtension {\n constructor() {\n this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM\n }\n\n extendTexture(texture, transform) {\n if (\n (transform.texCoord === undefined || transform.texCoord === texture.channel) &&\n transform.offset === undefined &&\n transform.rotation === undefined &&\n transform.scale === undefined\n ) {\n // See https://github.com/mrdoob/three.js/issues/21819.\n return texture\n }\n\n texture = texture.clone()\n\n if (transform.texCoord !== undefined) {\n texture.channel = transform.texCoord\n }\n\n if (transform.offset !== undefined) {\n texture.offset.fromArray(transform.offset)\n }\n\n if (transform.rotation !== undefined) {\n texture.rotation = transform.rotation\n }\n\n if (transform.scale !== undefined) {\n texture.repeat.fromArray(transform.scale)\n }\n\n texture.needsUpdate = true\n\n return texture\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 constructor() {\n this.name = EXTENSIONS.KHR_MESH_QUANTIZATION\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 constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n super(parameterPositions, sampleValues, sampleSize, resultBuffer)\n }\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\n const result = this.resultBuffer,\n values = this.sampleValues,\n valueSize = this.valueSize,\n offset = index * valueSize * 3 + valueSize\n\n for (let i = 0; i !== valueSize; i++) {\n result[i] = values[offset + i]\n }\n\n return result\n }\n\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer\n const values = this.sampleValues\n const stride = this.valueSize\n\n const stride2 = stride * 2\n const stride3 = stride * 3\n\n const td = t1 - t0\n\n const p = (t - t0) / td\n const pp = p * p\n const ppp = pp * p\n\n const offset1 = i1 * stride3\n const offset0 = offset1 - stride3\n\n const s2 = -2 * ppp + 3 * pp\n const s3 = ppp - pp\n const s0 = 1 - s2\n const s1 = s3 - pp + p\n\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\n result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1\n }\n\n return result\n }\n}\n\nconst _q = new Quaternion()\n\nclass GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {\n interpolate_(i1, t0, t, t1) {\n const result = super.interpolate_(i1, t0, t, t1)\n\n _q.fromArray(result).normalize().toArray(result)\n\n return result\n }\n}\n\n/*********************************/\n/********** INTERNALS ************/\n/*********************************/\n\n/* CONSTANTS */\n\nconst 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}\n\nconst WEBGL_COMPONENT_TYPES = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array,\n}\n\nconst WEBGL_FILTERS = {\n 9728: NearestFilter,\n 9729: LinearFilter,\n 9984: NearestMipmapNearestFilter,\n 9985: LinearMipmapNearestFilter,\n 9986: NearestMipmapLinearFilter,\n 9987: LinearMipmapLinearFilter,\n}\n\nconst WEBGL_WRAPPINGS = {\n 33071: ClampToEdgeWrapping,\n 33648: MirroredRepeatWrapping,\n 10497: RepeatWrapping,\n}\n\nconst 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}\n\nconst ATTRIBUTES = {\n POSITION: 'position',\n NORMAL: 'normal',\n TANGENT: 'tangent',\n // uv => uv1, 4 uv channels\n // https://github.com/mrdoob/three.js/pull/25943\n // https://github.com/mrdoob/three.js/pull/25788\n ...(version >= 152\n ? {\n TEXCOORD_0: 'uv',\n TEXCOORD_1: 'uv1',\n TEXCOORD_2: 'uv2',\n TEXCOORD_3: 'uv3',\n }\n : {\n TEXCOORD_0: 'uv',\n TEXCOORD_1: 'uv2',\n }),\n\n COLOR_0: 'color',\n WEIGHTS_0: 'skinWeight',\n JOINTS_0: 'skinIndex',\n}\n\nconst PATH_PROPERTIES = {\n scale: 'scale',\n translation: 'position',\n rotation: 'quaternion',\n weights: 'morphTargetInfluences',\n}\n\nconst INTERPOLATION = {\n CUBICSPLINE: undefined, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each\n // keyframe track will be initialized with a default interpolation type, then modified.\n LINEAR: InterpolateLinear,\n STEP: InterpolateDiscrete,\n}\n\nconst ALPHA_MODES = {\n OPAQUE: 'OPAQUE',\n MASK: 'MASK',\n BLEND: '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 if (cache['DefaultMaterial'] === undefined) {\n cache['DefaultMaterial'] = new MeshStandardMaterial({\n color: 0xffffff,\n emissive: 0x000000,\n metalness: 1,\n roughness: 1,\n transparent: false,\n depthTest: true,\n side: FrontSide,\n })\n }\n\n return cache['DefaultMaterial']\n}\n\nfunction addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {\n // Add unknown glTF extensions to an object's userData.\n\n for (const name in objectDef.extensions) {\n if (knownExtensions[name] === undefined) {\n object.userData.gltfExtensions = object.userData.gltfExtensions || {}\n object.userData.gltfExtensions[name] = objectDef.extensions[name]\n }\n }\n}\n\n/**\n * @param {Object3D|Material|BufferGeometry} object\n * @param {GLTF.definition} gltfDef\n */\nfunction assignExtrasToUserData(object, gltfDef) {\n if (gltfDef.extras !== undefined) {\n if (typeof gltfDef.extras === 'object') {\n Object.assign(object.userData, gltfDef.extras)\n } else {\n console.warn('THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras)\n }\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 let hasMorphPosition = false\n let hasMorphNormal = false\n let hasMorphColor = false\n\n for (let i = 0, il = targets.length; i < il; i++) {\n const target = targets[i]\n\n if (target.POSITION !== undefined) hasMorphPosition = true\n if (target.NORMAL !== undefined) hasMorphNormal = true\n if (target.COLOR_0 !== undefined) hasMorphColor = true\n\n if (hasMorphPosition && hasMorphNormal && hasMorphColor) break\n }\n\n if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry)\n\n const pendingPositionAccessors = []\n const pendingNormalAccessors = []\n const pendingColorAccessors = []\n\n for (let i = 0, il = targets.length; i < il; i++) {\n const target = targets[i]\n\n if (hasMorphPosition) {\n const pendingAccessor =\n target.POSITION !== undefined ? parser.getDependency('accessor', target.POSITION) : geometry.attributes.position\n\n pendingPositionAccessors.push(pendingAccessor)\n }\n\n if (hasMorphNormal) {\n const pendingAccessor =\n target.NORMAL !== undefined ? parser.getDependency('accessor', target.NORMAL) : geometry.attributes.normal\n\n pendingNormalAccessors.push(pendingAccessor)\n }\n\n if (hasMorphColor) {\n const pendingAccessor =\n target.COLOR_0 !== undefined ? parser.getDependency('accessor', target.COLOR_0) : geometry.attributes.color\n\n pendingColorAccessors.push(pendingAccessor)\n }\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\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\n return geometry\n })\n}\n\n/**\n * @param {Mesh} mesh\n * @param {GLTF.Mesh} meshDef\n */\nfunction updateMorphTargets(mesh, meshDef) {\n mesh.updateMorphTargets()\n\n if (meshDef.weights !== undefined) {\n for (let i = 0, il = meshDef.weights.length; i < il; i++) {\n mesh.morphTargetInfluences[i] = meshDef.weights[i]\n }\n }\n\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\n if (mesh.morphTargetInfluences.length === targetNames.length) {\n mesh.morphTargetDictionary = {}\n\n for (let i = 0, il = targetNames.length; i < il; i++) {\n mesh.morphTargetDictionary[targetNames[i]] = i\n }\n } else {\n console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.')\n }\n }\n}\n\nfunction createPrimitiveKey(primitiveDef) {\n let geometryKey\n\n const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]\n\n if (dracoExtension) {\n geometryKey =\n 'draco:' +\n dracoExtension.bufferView +\n ':' +\n dracoExtension.indices +\n ':' +\n createAttributesKey(dracoExtension.attributes)\n } else {\n geometryKey = primitiveDef.indices + ':' + createAttributesKey(primitiveDef.attributes) + ':' + primitiveDef.mode\n }\n\n if (primitiveDef.targets !== undefined) {\n for (let i = 0, il = primitiveDef.targets.length; i < il; i++) {\n geometryKey += ':' + createAttributesKey(primitiveDef.targets[i])\n }\n }\n\n return geometryKey\n}\n\nfunction createAttributesKey(attributes) {\n let attributesKey = ''\n\n const keys = Object.keys(attributes).sort()\n\n for (let i = 0, il = keys.length; i < il; i++) {\n attributesKey += keys[i] + ':' + attributes[keys[i]] + ';'\n }\n\n return attributesKey\n}\n\nfunction getNormalizedComponentScale(constructor) {\n // Reference:\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data\n\n switch (constructor) {\n case Int8Array:\n return 1 / 127\n\n case Uint8Array:\n return 1 / 255\n\n case Int16Array:\n return 1 / 32767\n\n case Uint16Array:\n return 1 / 65535\n\n default:\n throw new Error('THREE.GLTFLoader: Unsupported normalized accessor component type.')\n }\n}\n\nfunction 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\n return 'image/png'\n}\n\nconst _identityMatrix = new Matrix4()\n\n/* GLTF PARSER */\n\nclass GLTFParser {\n constructor(json = {}, options = {}) {\n this.json = json\n this.extensions = {}\n this.plugins = {}\n this.options = options\n\n // loader object cache\n this.cache = new GLTFRegistry()\n\n // associations between Three.js objects and glTF elements\n this.associations = new Map()\n\n // BufferGeometry caching\n this.primitiveCache = {}\n\n // Node cache\n this.nodeCache = {}\n\n // Object3D instance caches\n this.meshCache = { refs: {}, uses: {} }\n this.cameraCache = { refs: {}, uses: {} }\n this.lightCache = { refs: {}, uses: {} }\n\n this.sourceCache = {}\n this.textureCache = {}\n\n // Track node names, to ensure no duplicates\n this.nodeNamesUsed = {}\n\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\n let isSafari = false\n let isFirefox = false\n let firefoxVersion = -1\n\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent !== '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\n if (typeof createImageBitmap === 'undefined' || isSafari || (isFirefox && firefoxVersion < 98)) {\n this.textureLoader = new TextureLoader(this.options.manager)\n } else {\n this.textureLoader = new ImageBitmapLoader(this.options.manager)\n }\n\n this.textureLoader.setCrossOrigin(this.options.crossOrigin)\n this.textureLoader.setRequestHeader(this.options.requestHeader)\n\n this.fileLoader = new FileLoader(this.options.manager)\n this.fileLoader.setResponseType('arraybuffer')\n\n if (this.options.crossOrigin === 'use-credentials') {\n this.fileLoader.setWithCredentials(true)\n }\n }\n\n setExtensions(extensions) {\n this.extensions = extensions\n }\n\n setPlugins(plugins) {\n this.plugins = plugins\n }\n\n parse(onLoad, onError) {\n const parser = this\n const json = this.json\n const extensions = this.extensions\n\n // Clear the loader cache\n this.cache.removeAll()\n this.nodeCache = {}\n\n // Mark the special nodes/meshes in json for efficient parse\n this._invokeAll(function (ext) {\n return ext._markDefs && ext._markDefs()\n })\n\n Promise.all(\n this._invokeAll(function (ext) {\n return ext.beforeRoot && ext.beforeRoot()\n }),\n )\n .then(function () {\n return Promise.all([\n parser.getDependencies('scene'),\n parser.getDependencies('animation'),\n parser.getDependencies('camera'),\n ])\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\n addUnknownExtensionsToUserData(extensions, result, json)\n\n assignExtrasToUserData(result, json)\n\n return Promise.all(\n parser._invokeAll(function (ext) {\n return ext.afterRoot && ext.afterRoot(result)\n }),\n ).then(function () {\n for (const scene of result.scenes) {\n scene.updateMatrixWorld()\n }\n\n onLoad(result)\n })\n })\n .catch(onError)\n }\n\n /**\n * Marks the special nodes/meshes in json for efficient parse.\n */\n _markDefs() {\n const nodeDefs = this.json.nodes || []\n const skinDefs = this.json.skins || []\n const meshDefs = this.json.meshes || []\n\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\n for (let i = 0, il = joints.length; i < il; i++) {\n nodeDefs[joints[i]].isBone = true\n }\n }\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\n if (nodeDef.mesh !== undefined) {\n this._addNodeRef(this.meshCache, nodeDef.mesh)\n\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) {\n meshDefs[nodeDef.mesh].isSkinnedMesh = true\n }\n }\n\n if (nodeDef.camera !== undefined) {\n this._addNodeRef(this.cameraCache, nodeDef.camera)\n }\n }\n }\n\n /**\n * Counts references to shared node / Object3D resources. These resources\n * can be reused, or \"instantiated\", at multiple nodes in the scene\n * hierarchy. Mesh, Camera, and Light instances are instantiated and must\n * be marked. Non-scenegraph resources (like Materials, Geometries, and\n * Textures) can be reused directly and are not marked here.\n *\n * Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n */\n _addNodeRef(cache, index) {\n if (index === undefined) return\n\n if (cache.refs[index] === undefined) {\n cache.refs[index] = cache.uses[index] = 0\n }\n\n cache.refs[index]++\n }\n\n /** Returns a reference to a shared resource, cloning it if necessary. */\n _getNodeRef(cache, index, object) {\n if (cache.refs[index] <= 1) return object\n\n const ref = object.clone()\n\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) {\n this.associations.set(clone, mappings)\n }\n\n for (const [i, child] of original.children.entries()) {\n updateMappings(child, clone.children[i])\n }\n }\n\n updateMappings(object, ref)\n\n ref.name += '_instance_' + cache.uses[index]++\n\n return ref\n }\n\n _invokeOne(func) {\n const extensions = Object.values(this.plugins)\n extensions.push(this)\n\n for (let i = 0; i < extensions.length; i++) {\n const result = func(extensions[i])\n\n if (result) return result\n }\n\n return null\n }\n\n _invokeAll(func) {\n const extensions = Object.values(this.plugins)\n extensions.unshift(this)\n\n const pending = []\n\n for (let i = 0; i < extensions.length; i++) {\n const result = func(extensions[i])\n\n if (result) pending.push(result)\n }\n\n return pending\n }\n\n /**\n * Requests the specified dependency asynchronously, with caching.\n * @param {string} type\n * @param {number} index\n * @return {Promise}\n */\n getDependency(type, index) {\n const cacheKey = type + ':' + index\n let dependency = this.cache.get(cacheKey)\n\n if (!dependency) {\n switch (type) {\n case 'scene':\n dependency = this.loadScene(index)\n break\n\n case 'node':\n dependency = this._invokeOne(function (ext) {\n return ext.loadNode && ext.loadNode(index)\n })\n break\n\n case 'mesh':\n dependency = this._invokeOne(function (ext) {\n return ext.loadMesh && ext.loadMesh(index)\n })\n break\n\n case 'accessor':\n dependency = this.loadAccessor(index)\n break\n\n case 'bufferView':\n dependency = this._invokeOne(function (ext) {\n return ext.loadBufferView && ext.loadBufferView(index)\n })\n break\n\n case 'buffer':\n dependency = this.loadBuffer(index)\n break\n\n case 'material':\n dependency = this._invokeOne(function (ext) {\n return ext.loadMaterial && ext.loadMaterial(index)\n })\n break\n\n case 'texture':\n dependency = this._invokeOne(function (ext) {\n return ext.loadTexture && ext.loadTexture(index)\n })\n break\n\n case 'skin':\n dependency = this.loadSkin(index)\n break\n\n case 'animation':\n dependency = this._invokeOne(function (ext) {\n return ext.loadAnimation && ext.loadAnimation(index)\n })\n break\n\n case 'camera':\n dependency = this.loadCamera(index)\n break\n\n default:\n dependency = this._invokeOne(function (ext) {\n return ext != this && ext.getDependency && ext.getDependency(type, index)\n })\n\n if (!dependency) {\n throw new Error('Unknown type: ' + type)\n }\n\n break\n }\n\n this.cache.add(cacheKey, dependency)\n }\n\n return dependency\n }\n\n /**\n * Requests all dependencies of the specified type asynchronously, with caching.\n * @param {string} type\n * @return {Promise>}\n */\n getDependencies(type) {\n let dependencies = this.cache.get(type)\n\n if (!dependencies) {\n const parser = this\n const defs = this.json[type + (type === 'mesh' ? 'es' : 's')] || []\n\n dependencies = Promise.all(\n defs.map(function (def, index) {\n return parser.getDependency(type, index)\n }),\n )\n\n this.cache.add(type, dependencies)\n }\n\n return dependencies\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferIndex\n * @return {Promise}\n */\n loadBuffer(bufferIndex) {\n const bufferDef = this.json.buffers[bufferIndex]\n const loader = this.fileLoader\n\n if (bufferDef.type && bufferDef.type !== 'arraybuffer') {\n throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.')\n }\n\n // If present, GLB container is required to be the first buffer.\n if (bufferDef.uri === undefined && bufferIndex === 0) {\n return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body)\n }\n\n const options = this.options\n\n return new Promise(function (resolve, reject) {\n loader.load(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 /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferViewIndex\n * @return {Promise}\n */\n loadBufferView(bufferViewIndex) {\n const bufferViewDef = this.json.bufferViews[bufferViewIndex]\n\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 /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n * @param {number} accessorIndex\n * @return {Promise}\n */\n loadAccessor(accessorIndex) {\n const parser = this\n const json = this.json\n\n const accessorDef = this.json.accessors[accessorIndex]\n\n if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) {\n const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]\n const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]\n const normalized = accessorDef.normalized === true\n\n const array = new TypedArray(accessorDef.count * itemSize)\n return Promise.resolve(new BufferAttribute(array, itemSize, normalized))\n }\n\n const pendingBufferViews = []\n\n if (accessorDef.bufferView !== undefined) {\n pendingBufferViews.push(this.getDependency('bufferView', accessorDef.bufferView))\n } else {\n pendingBufferViews.push(null)\n }\n\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\n return Promise.all(pendingBufferViews).then(function (bufferViews) {\n const bufferView = bufferViews[0]\n\n const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]\n const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]\n\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 =\n accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride : undefined\n const normalized = accessorDef.normalized === true\n let array, bufferAttribute\n\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 =\n 'InterleavedBuffer:' +\n accessorDef.bufferView +\n ':' +\n accessorDef.componentType +\n ':' +\n ibSlice +\n ':' +\n accessorDef.count\n let ib = parser.cache.get(ibCacheKey)\n\n if (!ib) {\n array = new TypedArray(bufferView, ibSlice * byteStride, (accessorDef.count * byteStride) / elementBytes)\n\n // Integer parameters to IB/IBA are in array elements, not bytes.\n ib = new InterleavedBuffer(array, byteStride / elementBytes)\n\n parser.cache.add(ibCacheKey, ib)\n }\n\n bufferAttribute = new InterleavedBufferAttribute(\n ib,\n itemSize,\n (byteOffset % byteStride) / elementBytes,\n normalized,\n )\n } else {\n if (bufferView === null) {\n array = new TypedArray(accessorDef.count * itemSize)\n } else {\n array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize)\n }\n\n bufferAttribute = new BufferAttribute(array, itemSize, normalized)\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors\n if (accessorDef.sparse !== undefined) {\n const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR\n const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType]\n\n const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0\n const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0\n\n const sparseIndices = new TypedArrayIndices(\n bufferViews[1],\n byteOffsetIndices,\n accessorDef.sparse.count * itemSizeIndices,\n )\n const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize)\n\n if (bufferView !== null) {\n // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.\n bufferAttribute = new BufferAttribute(\n bufferAttribute.array.slice(),\n bufferAttribute.itemSize,\n bufferAttribute.normalized,\n )\n }\n\n for (let i = 0, il = sparseIndices.length; i < il; i++) {\n const index = sparseIndices[i]\n\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\n return bufferAttribute\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n * @param {number} textureIndex\n * @return {Promise}\n */\n 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\n let loader = this.textureLoader\n\n if (sourceDef.uri) {\n const handler = options.manager.getHandler(sourceDef.uri)\n if (handler !== null) loader = handler\n }\n\n return this.loadTextureImage(textureIndex, sourceIndex, loader)\n }\n\n loadTextureImage(textureIndex, sourceIndex, loader) {\n const parser = this\n const json = this.json\n\n const textureDef = json.textures[textureIndex]\n const sourceDef = json.images[sourceIndex]\n\n const cacheKey = (sourceDef.uri || sourceDef.bufferView) + ':' + textureDef.sampler\n\n if (this.textureCache[cacheKey]) {\n // See https://github.com/mrdoob/three.js/issues/21559.\n return this.textureCache[cacheKey]\n }\n\n const promise = this.loadImageSource(sourceIndex, loader)\n .then(function (texture) {\n texture.flipY = false\n\n texture.name = textureDef.name || sourceDef.name || ''\n\n if (\n texture.name === '' &&\n typeof sourceDef.uri === 'string' &&\n sourceDef.uri.startsWith('data:image/') === false\n ) {\n texture.name = sourceDef.uri\n }\n\n const samplers = json.samplers || {}\n const sampler = samplers[textureDef.sampler] || {}\n\n texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter\n texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter\n texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping\n texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping\n\n parser.associations.set(texture, { textures: textureIndex })\n\n return texture\n })\n .catch(function () {\n return null\n })\n\n this.textureCache[cacheKey] = promise\n\n return promise\n }\n\n loadImageSource(sourceIndex, loader) {\n const parser = this\n const json = this.json\n const options = this.options\n\n if (this.sourceCache[sourceIndex] !== undefined) {\n return this.sourceCache[sourceIndex].then((texture) => texture.clone())\n }\n\n const sourceDef = json.images[sourceIndex]\n\n const URL = self.URL || self.webkitURL\n\n let sourceURI = sourceDef.uri || ''\n let isObjectURL = false\n\n if (sourceDef.bufferView !== undefined) {\n // Load binary image data from bufferView, if provided.\n\n sourceURI = parser.getDependency('bufferView', sourceDef.bufferView).then(function (bufferView) {\n isObjectURL = true\n const blob = new Blob([bufferView], { type: sourceDef.mimeType })\n sourceURI = URL.createObjectURL(blob)\n return sourceURI\n })\n } else if (sourceDef.uri === undefined) {\n throw new Error('THREE.GLTFLoader: Image ' + sourceIndex + ' is missing URI and bufferView')\n }\n\n const promise = Promise.resolve(sourceURI)\n .then(function (sourceURI) {\n return new Promise(function (resolve, reject) {\n let onLoad = resolve\n\n if (loader.isImageBitmapLoader === true) {\n onLoad = function (imageBitmap) {\n const texture = new Texture(imageBitmap)\n texture.needsUpdate = true\n\n resolve(texture)\n }\n }\n\n loader.load(LoaderUtils.resolveURL(sourceURI, options.path), onLoad, undefined, reject)\n })\n })\n .then(function (texture) {\n // Clean up resources and configure Texture.\n\n if (isObjectURL === true) {\n URL.revokeObjectURL(sourceURI)\n }\n\n assignExtrasToUserData(texture, sourceDef)\n\n texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri)\n\n return texture\n })\n .catch(function (error) {\n console.error(\"THREE.GLTFLoader: Couldn't load texture\", sourceURI)\n throw error\n })\n\n this.sourceCache[sourceIndex] = promise\n return promise\n }\n\n /**\n * Asynchronously assigns a texture to the given material parameters.\n * @param {Object} materialParams\n * @param {string} mapName\n * @param {Object} mapDef\n * @return {Promise}\n */\n assignTexture(materialParams, mapName, mapDef, colorSpace) {\n const parser = this\n\n return this.getDependency('texture', mapDef.index).then(function (texture) {\n if (!texture) return null\n\n if (mapDef.texCoord !== undefined && mapDef.texCoord > 0) {\n texture = texture.clone()\n texture.channel = mapDef.texCoord\n }\n\n if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {\n const transform =\n mapDef.extensions !== undefined ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined\n\n if (transform) {\n const gltfReference = parser.associations.get(texture)\n texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform)\n parser.associations.set(texture, gltfReference)\n }\n }\n\n if (colorSpace !== undefined) {\n // Convert from legacy encoding to colorSpace\n if (typeof colorSpace === 'number')\n colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace\n\n // Set colorSpace if able, fallback to legacy encoding\n if ('colorSpace' in texture) texture.colorSpace = colorSpace\n else texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding\n }\n\n materialParams[mapName] = texture\n\n return texture\n })\n }\n\n /**\n * Assigns final material to a Mesh, Line, or Points instance. The instance\n * already has a material (generated from the glTF material options alone)\n * but reuse of the same glTF material may require multiple threejs materials\n * to accommodate different primitive types, defines, etc. New materials will\n * be created if necessary, and reused from a cache.\n * @param {Object3D} mesh Mesh, Line, or Points instance.\n */\n assignFinalMaterial(mesh) {\n const geometry = mesh.geometry\n let material = mesh.material\n\n const useDerivativeTangents = geometry.attributes.tangent === undefined\n const useVertexColors = geometry.attributes.color !== undefined\n const useFlatShading = geometry.attributes.normal === undefined\n\n if (mesh.isPoints) {\n const cacheKey = 'PointsMaterial:' + material.uuid\n\n let pointsMaterial = this.cache.get(cacheKey)\n\n if (!pointsMaterial) {\n pointsMaterial = new PointsMaterial()\n 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\n this.cache.add(cacheKey, pointsMaterial)\n }\n\n material = pointsMaterial\n } else if (mesh.isLine) {\n const cacheKey = 'LineBasicMaterial:' + material.uuid\n\n let lineMaterial = this.cache.get(cacheKey)\n\n if (!lineMaterial) {\n lineMaterial = new LineBasicMaterial()\n Material.prototype.copy.call(lineMaterial, material)\n lineMaterial.color.copy(material.color)\n lineMaterial.map = material.map\n\n this.cache.add(cacheKey, lineMaterial)\n }\n\n material = lineMaterial\n }\n\n // Clone the material if it will be modified\n if (useDerivativeTangents || useVertexColors || useFlatShading) {\n let cacheKey = 'ClonedMaterial:' + material.uuid + ':'\n\n if (useDerivativeTangents) cacheKey += 'derivative-tangents:'\n if (useVertexColors) cacheKey += 'vertex-colors:'\n if (useFlatShading) cacheKey += 'flat-shading:'\n\n let cachedMaterial = this.cache.get(cacheKey)\n\n if (!cachedMaterial) {\n cachedMaterial = material.clone()\n\n if (useVertexColors) cachedMaterial.vertexColors = true\n if (useFlatShading) cachedMaterial.flatShading = true\n\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\n this.cache.add(cacheKey, cachedMaterial)\n\n this.associations.set(cachedMaterial, this.associations.get(material))\n }\n\n material = cachedMaterial\n }\n\n mesh.material = material\n }\n\n getMaterialType(/* materialIndex */) {\n return MeshStandardMaterial\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n * @param {number} materialIndex\n * @return {Promise}\n */\n loadMaterial(materialIndex) {\n const parser = this\n const json = this.json\n const extensions = this.extensions\n const materialDef = json.materials[materialIndex]\n\n let materialType\n const materialParams = {}\n const materialExtensions = materialDef.extensions || {}\n\n const pending = []\n\n if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) {\n const kmuExtension = extensions[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\n const metallicRoughness = materialDef.pbrMetallicRoughness || {}\n\n materialParams.color = new Color(1.0, 1.0, 1.0)\n materialParams.opacity = 1.0\n\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor\n\n materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace)\n materialParams.opacity = array[3]\n }\n\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace))\n }\n\n materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0\n materialParams.roughness =\n metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0\n\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\n materialType = this._invokeOne(function (ext) {\n return ext.getMaterialType && ext.getMaterialType(materialIndex)\n })\n\n pending.push(\n Promise.all(\n this._invokeAll(function (ext) {\n return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams)\n }),\n ),\n )\n }\n\n if (materialDef.doubleSided === true) {\n materialParams.side = DoubleSide\n }\n\n const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE\n\n if (alphaMode === ALPHA_MODES.BLEND) {\n materialParams.transparent = true\n\n // See: https://github.com/mrdoob/three.js/issues/17706\n materialParams.depthWrite = false\n } else {\n materialParams.transparent = false\n\n if (alphaMode === ALPHA_MODES.MASK) {\n materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5\n }\n }\n\n if (materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture))\n\n materialParams.normalScale = new Vector2(1, 1)\n\n if (materialDef.normalTexture.scale !== undefined) {\n const scale = materialDef.normalTexture.scale\n\n materialParams.normalScale.set(scale, scale)\n }\n }\n\n if (materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture))\n\n if (materialDef.occlusionTexture.strength !== undefined) {\n materialParams.aoMapIntensity = materialDef.occlusionTexture.strength\n }\n }\n\n if (materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial) {\n const emissiveFactor = materialDef.emissiveFactor\n materialParams.emissive = new Color().setRGB(\n emissiveFactor[0],\n emissiveFactor[1],\n emissiveFactor[2],\n LinearSRGBColorSpace,\n )\n }\n\n if (materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'emissiveMap', materialDef.emissiveTexture, SRGBColorSpace))\n }\n\n return Promise.all(pending).then(function () {\n const material = new materialType(materialParams)\n\n if (materialDef.name) material.name = materialDef.name\n\n assignExtrasToUserData(material, materialDef)\n\n parser.associations.set(material, { materials: materialIndex })\n\n if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef)\n\n return material\n })\n }\n\n /** When Object3D instances are targeted by animation, they need unique names. */\n createUniqueName(originalName) {\n const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || '')\n\n if (sanitizedName in this.nodeNamesUsed) {\n return sanitizedName + '_' + ++this.nodeNamesUsed[sanitizedName]\n } else {\n this.nodeNamesUsed[sanitizedName] = 0\n\n return sanitizedName\n }\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n *\n * Creates BufferGeometries from primitives.\n *\n * @param {Array} primitives\n * @return {Promise>}\n */\n loadGeometries(primitives) {\n const parser = this\n const extensions = this.extensions\n const cache = this.primitiveCache\n\n function createDracoPrimitive(primitive) {\n return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]\n .decodePrimitive(primitive, parser)\n .then(function (geometry) {\n return addPrimitiveAttributes(geometry, primitive, parser)\n })\n }\n\n const pending = []\n\n for (let i = 0, il = primitives.length; i < il; i++) {\n const primitive = primitives[i]\n const cacheKey = createPrimitiveKey(primitive)\n\n // See if we've already created this geometry\n const cached = cache[cacheKey]\n\n if (cached) {\n // Use the cached geometry if it exists\n pending.push(cached.promise)\n } else {\n let geometryPromise\n\n if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {\n // Use DRACO geometry if available\n geometryPromise = createDracoPrimitive(primitive)\n } else {\n // Otherwise create a new geometry\n geometryPromise = addPrimitiveAttributes(new BufferGeometry(), primitive, parser)\n }\n\n // Cache this geometry\n cache[cacheKey] = { primitive: primitive, promise: geometryPromise }\n\n pending.push(geometryPromise)\n }\n }\n\n return Promise.all(pending)\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n * @param {number} meshIndex\n * @return {Promise}\n */\n loadMesh(meshIndex) {\n const parser = this\n const json = this.json\n const extensions = this.extensions\n\n const meshDef = json.meshes[meshIndex]\n const primitives = meshDef.primitives\n\n const pending = []\n\n for (let i = 0, il = primitives.length; i < il; i++) {\n const material =\n primitives[i].material === undefined\n ? createDefaultMaterial(this.cache)\n : this.getDependency('material', primitives[i].material)\n\n pending.push(material)\n }\n\n pending.push(parser.loadGeometries(primitives))\n\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\n const meshes = []\n\n for (let i = 0, il = geometries.length; i < il; i++) {\n const geometry = geometries[i]\n const primitive = primitives[i]\n\n // 1. create Mesh\n\n let mesh\n\n const material = materials[i]\n\n if (\n primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||\n primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||\n primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ||\n primitive.mode === undefined\n ) {\n // .isSkinnedMesh isn't in glTF spec. See ._markDefs()\n mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh(geometry, material) : new Mesh(geometry, material)\n\n if (mesh.isSkinnedMesh === true) {\n // normalize skin weights to fix malformed assets (see #15319)\n mesh.normalizeSkinWeights()\n }\n\n if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode)\n } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode)\n }\n } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {\n mesh = new LineSegments(geometry, material)\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {\n mesh = new Line(geometry, material)\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {\n mesh = new LineLoop(geometry, material)\n } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {\n mesh = new Points(geometry, material)\n } else {\n throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode)\n }\n\n if (Object.keys(mesh.geometry.morphAttributes).length > 0) {\n updateMorphTargets(mesh, meshDef)\n }\n\n mesh.name = parser.createUniqueName(meshDef.name || 'mesh_' + meshIndex)\n\n assignExtrasToUserData(mesh, meshDef)\n\n if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive)\n\n parser.assignFinalMaterial(mesh)\n\n meshes.push(mesh)\n }\n\n for (let i = 0, il = meshes.length; i < il; i++) {\n parser.associations.set(meshes[i], {\n meshes: meshIndex,\n primitives: i,\n })\n }\n\n if (meshes.length === 1) {\n if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, meshes[0], meshDef)\n\n return meshes[0]\n }\n\n const group = new Group()\n\n if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, group, meshDef)\n\n parser.associations.set(group, { meshes: meshIndex })\n\n for (let i = 0, il = meshes.length; i < il; i++) {\n group.add(meshes[i])\n }\n\n return group\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n * @param {number} cameraIndex\n * @return {Promise}\n */\n loadCamera(cameraIndex) {\n let camera\n const cameraDef = this.json.cameras[cameraIndex]\n const params = cameraDef[cameraDef.type]\n\n if (!params) {\n console.warn('THREE.GLTFLoader: Missing camera parameters.')\n return\n }\n\n if (cameraDef.type === 'perspective') {\n camera = new PerspectiveCamera(\n MathUtils.radToDeg(params.yfov),\n params.aspectRatio || 1,\n params.znear || 1,\n params.zfar || 2e6,\n )\n } else if (cameraDef.type === 'orthographic') {\n camera = new OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar)\n }\n\n if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name)\n\n assignExtrasToUserData(camera, cameraDef)\n\n return Promise.resolve(camera)\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n * @param {number} skinIndex\n * @return {Promise}\n */\n loadSkin(skinIndex) {\n const skinDef = this.json.skins[skinIndex]\n\n const pending = []\n\n for (let i = 0, il = skinDef.joints.length; i < il; i++) {\n pending.push(this._loadNodeShallow(skinDef.joints[i]))\n }\n\n if (skinDef.inverseBindMatrices !== undefined) {\n pending.push(this.getDependency('accessor', skinDef.inverseBindMatrices))\n } else {\n pending.push(null)\n }\n\n return Promise.all(pending).then(function (results) {\n const inverseBindMatrices = results.pop()\n const jointNodes = results\n\n // Note that bones (joint nodes) may or may not be in the\n // scene graph at this time.\n\n const bones = []\n const boneInverses = []\n\n for (let i = 0, il = jointNodes.length; i < il; i++) {\n const jointNode = jointNodes[i]\n\n if (jointNode) {\n bones.push(jointNode)\n\n const mat = new Matrix4()\n\n if (inverseBindMatrices !== null) {\n mat.fromArray(inverseBindMatrices.array, i * 16)\n }\n\n boneInverses.push(mat)\n } else {\n console.warn('THREE.GLTFLoader: Joint \"%s\" could not be found.', skinDef.joints[i])\n }\n }\n\n return new Skeleton(bones, boneInverses)\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\n * @param {number} animationIndex\n * @return {Promise}\n */\n loadAnimation(animationIndex) {\n const json = this.json\n const parser = this\n\n const animationDef = json.animations[animationIndex]\n const animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex\n\n const pendingNodes = []\n const pendingInputAccessors = []\n const pendingOutputAccessors = []\n const pendingSamplers = []\n const pendingTargets = []\n\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\n if (target.node === undefined) continue\n\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\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\n const tracks = []\n\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\n if (node === undefined) continue\n\n if (node.updateMatrix) {\n node.updateMatrix()\n }\n\n const createdTracks = parser._createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target)\n\n if (createdTracks) {\n for (let k = 0; k < createdTracks.length; k++) {\n tracks.push(createdTracks[k])\n }\n }\n }\n\n return new AnimationClip(animationName, undefined, tracks)\n })\n }\n\n createNodeMesh(nodeIndex) {\n const json = this.json\n const parser = this\n const nodeDef = json.nodes[nodeIndex]\n\n if (nodeDef.mesh === undefined) return null\n\n return parser.getDependency('mesh', nodeDef.mesh).then(function (mesh) {\n const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh)\n\n // if weights are provided on the node, override weights on the mesh.\n if (nodeDef.weights !== undefined) {\n node.traverse(function (o) {\n if (!o.isMesh) return\n\n for (let i = 0, il = nodeDef.weights.length; i < il; i++) {\n o.morphTargetInfluences[i] = nodeDef.weights[i]\n }\n })\n }\n\n return node\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy\n * @param {number} nodeIndex\n * @return {Promise}\n */\n loadNode(nodeIndex) {\n const json = this.json\n const parser = this\n\n const nodeDef = json.nodes[nodeIndex]\n\n const nodePending = parser._loadNodeShallow(nodeIndex)\n\n const childPending = []\n const childrenDef = nodeDef.children || []\n\n for (let i = 0, il = childrenDef.length; i < il; i++) {\n childPending.push(parser.getDependency('node', childrenDef[i]))\n }\n\n const skeletonPending =\n nodeDef.skin === undefined ? Promise.resolve(null) : parser.getDependency('skin', nodeDef.skin)\n\n return Promise.all([nodePending, Promise.all(childPending), skeletonPending]).then(function (results) {\n const node = results[0]\n const children = results[1]\n const skeleton = results[2]\n\n if (skeleton !== null) {\n // 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\n mesh.bind(skeleton, _identityMatrix)\n })\n }\n\n for (let i = 0, il = children.length; i < il; i++) {\n node.add(children[i])\n }\n\n return node\n })\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\n // This method is called from .loadNode() and .loadSkin().\n // Cache a node to avoid duplication.\n\n if (this.nodeCache[nodeIndex] !== undefined) {\n return this.nodeCache[nodeIndex]\n }\n\n const nodeDef = json.nodes[nodeIndex]\n\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\n const pending = []\n\n const meshPromise = parser._invokeOne(function (ext) {\n return ext.createNodeMesh && ext.createNodeMesh(nodeIndex)\n })\n\n if (meshPromise) {\n pending.push(meshPromise)\n }\n\n if (nodeDef.camera !== undefined) {\n pending.push(\n parser.getDependency('camera', nodeDef.camera).then(function (camera) {\n return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera)\n }),\n )\n }\n\n parser\n ._invokeAll(function (ext) {\n return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex)\n })\n .forEach(function (promise) {\n pending.push(promise)\n })\n\n this.nodeCache[nodeIndex] = Promise.all(pending).then(function (objects) {\n let node\n\n // .isBone isn't in glTF spec. See ._markDefs\n if (nodeDef.isBone === true) {\n node = new Bone()\n } else if (objects.length > 1) {\n node = new Group()\n } else if (objects.length === 1) {\n node = objects[0]\n } else {\n node = new Object3D()\n }\n\n if (node !== objects[0]) {\n for (let i = 0, il = objects.length; i < il; i++) {\n node.add(objects[i])\n }\n }\n\n if (nodeDef.name) {\n node.userData.name = nodeDef.name\n node.name = nodeName\n }\n\n assignExtrasToUserData(node, nodeDef)\n\n if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef)\n\n if (nodeDef.matrix !== undefined) {\n const matrix = new Matrix4()\n matrix.fromArray(nodeDef.matrix)\n node.applyMatrix4(matrix)\n } else {\n if (nodeDef.translation !== undefined) {\n node.position.fromArray(nodeDef.translation)\n }\n\n if (nodeDef.rotation !== undefined) {\n node.quaternion.fromArray(nodeDef.rotation)\n }\n\n if (nodeDef.scale !== undefined) {\n node.scale.fromArray(nodeDef.scale)\n }\n }\n\n if (!parser.associations.has(node)) {\n parser.associations.set(node, {})\n }\n\n parser.associations.get(node).nodes = nodeIndex\n\n return node\n })\n\n return this.nodeCache[nodeIndex]\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes\n * @param {number} sceneIndex\n * @return {Promise}\n */\n loadScene(sceneIndex) {\n const extensions = this.extensions\n const sceneDef = this.json.scenes[sceneIndex]\n const parser = this\n\n // Loader returns Group, not Scene.\n // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172\n const scene = new Group()\n if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name)\n\n assignExtrasToUserData(scene, sceneDef)\n\n if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef)\n\n const nodeIds = sceneDef.nodes || []\n\n const pending = []\n\n for (let i = 0, il = nodeIds.length; i < il; i++) {\n pending.push(parser.getDependency('node', nodeIds[i]))\n }\n\n return Promise.all(pending).then(function (nodes) {\n for (let i = 0, il = nodes.length; i < il; i++) {\n scene.add(nodes[i])\n }\n\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\n for (const [key, value] of parser.associations) {\n if (key instanceof Material || key instanceof Texture) {\n reducedAssociations.set(key, value)\n }\n }\n\n node.traverse((node) => {\n const mappings = parser.associations.get(node)\n\n if (mappings != null) {\n reducedAssociations.set(node, mappings)\n }\n })\n\n return reducedAssociations\n }\n\n parser.associations = reduceAssociations(scene)\n\n return scene\n })\n }\n\n _createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target) {\n const tracks = []\n\n const targetName = node.name ? node.name : node.uuid\n const targetNames = []\n\n if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {\n node.traverse(function (object) {\n if (object.morphTargetInfluences) {\n targetNames.push(object.name ? object.name : object.uuid)\n }\n })\n } else {\n targetNames.push(targetName)\n }\n\n let TypedKeyframeTrack\n\n switch (PATH_PROPERTIES[target.path]) {\n case PATH_PROPERTIES.weights:\n TypedKeyframeTrack = NumberKeyframeTrack\n break\n\n case PATH_PROPERTIES.rotation:\n TypedKeyframeTrack = QuaternionKeyframeTrack\n break\n\n case PATH_PROPERTIES.position:\n case PATH_PROPERTIES.scale:\n TypedKeyframeTrack = VectorKeyframeTrack\n break\n\n default:\n switch (outputAccessor.itemSize) {\n case 1:\n TypedKeyframeTrack = NumberKeyframeTrack\n break\n case 2:\n case 3:\n default:\n TypedKeyframeTrack = VectorKeyframeTrack\n break\n }\n\n break\n }\n\n const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[sampler.interpolation] : InterpolateLinear\n\n const outputArray = this._getArrayFromAccessor(outputAccessor)\n\n for (let j = 0, jl = targetNames.length; j < jl; j++) {\n const track = new TypedKeyframeTrack(\n targetNames[j] + '.' + PATH_PROPERTIES[target.path],\n inputAccessor.array,\n outputArray,\n interpolation,\n )\n\n // Override interpolation with custom factory method.\n if (sampler.interpolation === 'CUBICSPLINE') {\n this._createCubicSplineTrackInterpolant(track)\n }\n\n tracks.push(track)\n }\n\n return tracks\n }\n\n _getArrayFromAccessor(accessor) {\n let outputArray = accessor.array\n\n if (accessor.normalized) {\n const scale = getNormalizedComponentScale(outputArray.constructor)\n const scaled = new Float32Array(outputArray.length)\n\n for (let j = 0, jl = outputArray.length; j < jl; j++) {\n scaled[j] = outputArray[j] * scale\n }\n\n outputArray = scaled\n }\n\n return outputArray\n }\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\n const interpolantType =\n this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant\n\n return new interpolantType(this.times, this.values, this.getValueSize() / 3, result)\n }\n\n // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.\n track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true\n }\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n */\nfunction computeBounds(geometry, primitiveDef, parser) {\n const attributes = primitiveDef.attributes\n\n const box = new Box3()\n\n if (attributes.POSITION !== undefined) {\n const accessor = parser.json.accessors[attributes.POSITION]\n\n const min = accessor.min\n const max = accessor.max\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n if (min !== undefined && max !== undefined) {\n box.set(new Vector3(min[0], min[1], min[2]), new Vector3(max[0], max[1], max[2]))\n\n if (accessor.normalized) {\n const boxScale = getNormalizedComponentScale(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\n return\n }\n } else {\n return\n }\n\n const targets = primitiveDef.targets\n\n if (targets !== undefined) {\n const maxDisplacement = new Vector3()\n const vector = new Vector3()\n\n for (let i = 0, il = targets.length; i < il; i++) {\n const target = targets[i]\n\n if (target.POSITION !== undefined) {\n const accessor = parser.json.accessors[target.POSITION]\n const min = accessor.min\n const max = accessor.max\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\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\n if (accessor.normalized) {\n const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType])\n vector.multiplyScalar(boxScale)\n }\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 {\n console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.')\n }\n }\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\n geometry.boundingBox = box\n\n const sphere = new Sphere()\n\n box.getCenter(sphere.center)\n sphere.radius = box.min.distanceTo(box.max) / 2\n\n geometry.boundingSphere = sphere\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 const attributes = primitiveDef.attributes\n\n const pending = []\n\n function assignAttributeAccessor(accessorIndex, attributeName) {\n return parser.getDependency('accessor', accessorIndex).then(function (accessor) {\n geometry.setAttribute(attributeName, accessor)\n })\n }\n\n for (const gltfAttributeName in attributes) {\n const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase()\n\n // Skip attributes already provided by e.g. Draco extension.\n if (threeAttributeName in geometry.attributes) continue\n\n pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName))\n }\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\n pending.push(accessor)\n }\n\n assignExtrasToUserData(geometry, primitiveDef)\n\n computeBounds(geometry, primitiveDef, parser)\n\n return Promise.all(pending).then(function () {\n return primitiveDef.targets !== undefined ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry\n })\n}\n\nexport { GLTFLoader }\n", "import * as THREE from 'three'\n\nconst PINCH_MAX = 0.05\nconst PINCH_THRESHOLD = 0.02\nconst PINCH_MIN = 0.01\nconst POINTER_ADVANCE_MAX = 0.02\nconst POINTER_OPACITY_MAX = 1\nconst POINTER_OPACITY_MIN = 0.4\nconst POINTER_FRONT_RADIUS = 0.002\nconst POINTER_REAR_RADIUS = 0.01\nconst POINTER_REAR_RADIUS_MIN = 0.003\nconst POINTER_LENGTH = 0.035\nconst POINTER_SEGMENTS = 16\nconst POINTER_RINGS = 12\nconst POINTER_HEMISPHERE_ANGLE = 110\nconst YAXIS = new THREE.Vector3(0, 1, 0)\nconst ZAXIS = new THREE.Vector3(0, 0, 1)\n\nconst CURSOR_RADIUS = 0.02\nconst CURSOR_MAX_DISTANCE = 1.5\n\nclass OculusHandPointerModel extends THREE.Object3D {\n constructor(hand, controller) {\n super()\n\n this.hand = hand\n this.controller = controller\n\n // Unused\n this.motionController = null\n this.envMap = null\n this.mesh = null\n\n this.pointerGeometry = null\n this.pointerMesh = null\n this.pointerObject = null\n\n this.pinched = false\n this.attached = false\n\n this.cursorObject = null\n\n this.raycaster = null\n\n this._onConnected = this._onConnected.bind(this)\n this._onDisconnected = this._onDisconnected.bind(this)\n this.hand.addEventListener('connected', this._onConnected)\n this.hand.addEventListener('disconnected', this._onDisconnected)\n }\n\n _onConnected(event) {\n const xrInputSource = event.data\n if (xrInputSource.hand) {\n this.visible = true\n this.xrInputSource = xrInputSource\n\n this.createPointer()\n }\n }\n\n _onDisconnected() {\n this.visible = false\n this.xrInputSource = null\n\n this.pointerGeometry?.dispose()\n this.pointerMesh?.material.dispose()\n\n this.clear()\n }\n\n _drawVerticesRing(vertices, baseVector, ringIndex) {\n const segmentVector = baseVector.clone()\n for (var i = 0; i < POINTER_SEGMENTS; i++) {\n segmentVector.applyAxisAngle(ZAXIS, (Math.PI * 2) / POINTER_SEGMENTS)\n const vid = ringIndex * POINTER_SEGMENTS + i\n vertices[3 * vid] = segmentVector.x\n vertices[3 * vid + 1] = segmentVector.y\n vertices[3 * vid + 2] = segmentVector.z\n }\n }\n\n _updatePointerVertices(rearRadius) {\n const vertices = this.pointerGeometry.attributes.position.array\n // first ring for front face\n const frontFaceBase = new THREE.Vector3(POINTER_FRONT_RADIUS, 0, -1 * (POINTER_LENGTH - rearRadius))\n this._drawVerticesRing(vertices, frontFaceBase, 0)\n\n // rings for rear hemisphere\n const rearBase = new THREE.Vector3(\n Math.sin((Math.PI * POINTER_HEMISPHERE_ANGLE) / 180) * rearRadius,\n Math.cos((Math.PI * POINTER_HEMISPHERE_ANGLE) / 180) * rearRadius,\n 0,\n )\n for (var i = 0; i < POINTER_RINGS; i++) {\n this._drawVerticesRing(vertices, rearBase, i + 1)\n rearBase.applyAxisAngle(YAXIS, (Math.PI * POINTER_HEMISPHERE_ANGLE) / 180 / (POINTER_RINGS * -2))\n }\n\n // front and rear face center vertices\n const frontCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS)\n const rearCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS) + 1\n const frontCenter = new THREE.Vector3(0, 0, -1 * (POINTER_LENGTH - rearRadius))\n vertices[frontCenterIndex * 3] = frontCenter.x\n vertices[frontCenterIndex * 3 + 1] = frontCenter.y\n vertices[frontCenterIndex * 3 + 2] = frontCenter.z\n const rearCenter = new THREE.Vector3(0, 0, rearRadius)\n vertices[rearCenterIndex * 3] = rearCenter.x\n vertices[rearCenterIndex * 3 + 1] = rearCenter.y\n vertices[rearCenterIndex * 3 + 2] = rearCenter.z\n\n this.pointerGeometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3))\n // verticesNeedUpdate = true;\n }\n\n createPointer() {\n var i, j\n const vertices = new Array(((POINTER_RINGS + 1) * POINTER_SEGMENTS + 2) * 3).fill(0)\n // const vertices = [];\n const indices = []\n this.pointerGeometry = new THREE.BufferGeometry()\n\n this.pointerGeometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3))\n\n this._updatePointerVertices(POINTER_REAR_RADIUS)\n\n // construct faces to connect rings\n for (i = 0; i < POINTER_RINGS; i++) {\n for (j = 0; j < POINTER_SEGMENTS - 1; j++) {\n indices.push(i * POINTER_SEGMENTS + j, i * POINTER_SEGMENTS + j + 1, (i + 1) * POINTER_SEGMENTS + j)\n indices.push(i * POINTER_SEGMENTS + j + 1, (i + 1) * POINTER_SEGMENTS + j + 1, (i + 1) * POINTER_SEGMENTS + j)\n }\n\n indices.push((i + 1) * POINTER_SEGMENTS - 1, i * POINTER_SEGMENTS, (i + 2) * POINTER_SEGMENTS - 1)\n indices.push(i * POINTER_SEGMENTS, (i + 1) * POINTER_SEGMENTS, (i + 2) * POINTER_SEGMENTS - 1)\n }\n\n // construct front and rear face\n const frontCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS)\n const rearCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS) + 1\n\n for (i = 0; i < POINTER_SEGMENTS - 1; i++) {\n indices.push(frontCenterIndex, i + 1, i)\n indices.push(rearCenterIndex, i + POINTER_SEGMENTS * POINTER_RINGS, i + POINTER_SEGMENTS * POINTER_RINGS + 1)\n }\n\n indices.push(frontCenterIndex, 0, POINTER_SEGMENTS - 1)\n indices.push(rearCenterIndex, POINTER_SEGMENTS * (POINTER_RINGS + 1) - 1, POINTER_SEGMENTS * POINTER_RINGS)\n\n const material = new THREE.MeshBasicMaterial()\n material.transparent = true\n material.opacity = POINTER_OPACITY_MIN\n\n this.pointerGeometry.setIndex(indices)\n\n this.pointerMesh = new THREE.Mesh(this.pointerGeometry, material)\n\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS)\n this.pointerObject = new THREE.Object3D()\n this.pointerObject.add(this.pointerMesh)\n\n this.raycaster = new THREE.Raycaster()\n\n // create cursor\n const cursorGeometry = new THREE.SphereGeometry(CURSOR_RADIUS, 10, 10)\n const cursorMaterial = new THREE.MeshBasicMaterial()\n cursorMaterial.transparent = true\n cursorMaterial.opacity = POINTER_OPACITY_MIN\n\n this.cursorObject = new THREE.Mesh(cursorGeometry, cursorMaterial)\n this.pointerObject.add(this.cursorObject)\n\n this.add(this.pointerObject)\n }\n\n _updateRaycaster() {\n if (this.raycaster) {\n const pointerMatrix = this.pointerObject.matrixWorld\n const tempMatrix = new THREE.Matrix4()\n tempMatrix.identity().extractRotation(pointerMatrix)\n this.raycaster.ray.origin.setFromMatrixPosition(pointerMatrix)\n this.raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix)\n }\n }\n\n _updatePointer() {\n this.pointerObject.visible = this.controller.visible\n const indexTip = this.hand.joints['index-finger-tip']\n const thumbTip = this.hand.joints['thumb-tip']\n const distance = indexTip.position.distanceTo(thumbTip.position)\n const position = indexTip.position.clone().add(thumbTip.position).multiplyScalar(0.5)\n this.pointerObject.position.copy(position)\n this.pointerObject.quaternion.copy(this.controller.quaternion)\n\n this.pinched = distance <= PINCH_THRESHOLD\n\n const pinchScale = (distance - PINCH_MIN) / (PINCH_MAX - PINCH_MIN)\n const focusScale = (distance - PINCH_MIN) / (PINCH_THRESHOLD - PINCH_MIN)\n if (pinchScale > 1) {\n this._updatePointerVertices(POINTER_REAR_RADIUS)\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS)\n this.pointerMesh.material.opacity = POINTER_OPACITY_MIN\n } else if (pinchScale > 0) {\n const rearRadius = (POINTER_REAR_RADIUS - POINTER_REAR_RADIUS_MIN) * pinchScale + POINTER_REAR_RADIUS_MIN\n this._updatePointerVertices(rearRadius)\n if (focusScale < 1) {\n this.pointerMesh.position.set(0, 0, -1 * rearRadius - (1 - focusScale) * POINTER_ADVANCE_MAX)\n this.pointerMesh.material.opacity =\n POINTER_OPACITY_MIN + (1 - focusScale) * (POINTER_OPACITY_MAX - POINTER_OPACITY_MIN)\n } else {\n this.pointerMesh.position.set(0, 0, -1 * rearRadius)\n this.pointerMesh.material.opacity = POINTER_OPACITY_MIN\n }\n } else {\n this._updatePointerVertices(POINTER_REAR_RADIUS_MIN)\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS_MIN - POINTER_ADVANCE_MAX)\n this.pointerMesh.material.opacity = POINTER_OPACITY_MAX\n }\n\n this.cursorObject.material.opacity = this.pointerMesh.material.opacity\n }\n\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force)\n if (this.pointerGeometry) {\n this._updatePointer()\n this._updateRaycaster()\n }\n }\n\n isPinched() {\n return this.pinched\n }\n\n setAttached(attached) {\n this.attached = attached\n }\n\n isAttached() {\n return this.attached\n }\n\n intersectObject(object, recursive = true) {\n if (this.raycaster) {\n return this.raycaster.intersectObject(object, recursive)\n }\n }\n\n intersectObjects(objects, recursive = true) {\n if (this.raycaster) {\n return this.raycaster.intersectObjects(objects, recursive)\n }\n }\n\n checkIntersections(objects, recursive = false) {\n if (this.raycaster && !this.attached) {\n const intersections = this.raycaster.intersectObjects(objects, recursive)\n const direction = new THREE.Vector3(0, 0, -1)\n if (intersections.length > 0) {\n const intersection = intersections[0]\n const distance = intersection.distance\n this.cursorObject.position.copy(direction.multiplyScalar(distance))\n } else {\n this.cursorObject.position.copy(direction.multiplyScalar(CURSOR_MAX_DISTANCE))\n }\n }\n }\n\n setCursor(distance) {\n const direction = new THREE.Vector3(0, 0, -1)\n if (this.raycaster && !this.attached) {\n this.cursorObject.position.copy(direction.multiplyScalar(distance))\n }\n }\n\n dispose() {\n this._onDisconnected()\n this.hand.removeEventListener('connected', this._onConnected)\n this.hand.removeEventListener('disconnected', this._onDisconnected)\n }\n}\n\nexport { OculusHandPointerModel }\n", "import { WebGLRenderer } from 'three'\n\nclass VRButton {\n static createButton(renderer: WebGLRenderer, sessionInit: XRSessionInit = {}): HTMLButtonElement | HTMLAnchorElement {\n const button = document.createElement('button')\n\n function showEnterVR(/*device*/): void {\n let currentSession: XRSession | null = null\n\n async function onSessionStarted(session: XRSession): Promise {\n session.addEventListener('end', onSessionEnded)\n\n await renderer.xr.setSession(session as any)\n button.textContent = 'EXIT VR'\n\n currentSession = session\n }\n\n function onSessionEnded(/*event*/): void {\n currentSession!.removeEventListener('end', onSessionEnded)\n\n button.textContent = 'ENTER VR'\n\n currentSession = null\n }\n\n //\n\n button.style.display = ''\n\n button.style.cursor = 'pointer'\n button.style.left = 'calc(50% - 50px)'\n button.style.width = '100px'\n\n button.textContent = 'ENTER VR'\n\n button.onmouseenter = (): void => {\n button.style.opacity = '1.0'\n }\n\n button.onmouseleave = (): void => {\n button.style.opacity = '0.5'\n }\n\n button.onclick = (): void => {\n if (currentSession === null) {\n // WebXR's requestReferenceSpace only works if the corresponding feature\n // was requested at session creation time. For simplicity, just ask for\n // the interesting ones as optional features, but be aware that the\n // requestReferenceSpace call will fail if it turns out to be unavailable.\n // ('local' is always available for immersive sessions and doesn't need to\n // be requested separately.)\n\n const optionalFeatures = [sessionInit.optionalFeatures, 'local-floor', 'bounded-floor', 'hand-tracking']\n .flat()\n .filter(Boolean) as string[]\n\n ;(navigator as Navigator).xr\n ?.requestSession('immersive-vr', { ...sessionInit, optionalFeatures })\n .then(onSessionStarted)\n } else {\n currentSession.end()\n }\n }\n }\n\n function disableButton(): void {\n button.style.display = ''\n\n button.style.cursor = 'auto'\n button.style.left = 'calc(50% - 75px)'\n button.style.width = '150px'\n\n button.onmouseenter = null\n button.onmouseleave = null\n\n button.onclick = null\n }\n\n function showWebXRNotFound(): void {\n disableButton()\n\n button.textContent = 'VR NOT SUPPORTED'\n }\n\n function stylizeElement(element: HTMLElement): void {\n element.style.position = 'absolute'\n element.style.bottom = '20px'\n element.style.padding = '12px 6px'\n element.style.border = '1px solid #fff'\n element.style.borderRadius = '4px'\n element.style.background = 'rgba(0,0,0,0.1)'\n element.style.color = '#fff'\n element.style.font = 'normal 13px sans-serif'\n element.style.textAlign = 'center'\n element.style.opacity = '0.5'\n element.style.outline = 'none'\n element.style.zIndex = '999'\n }\n\n if ('xr' in navigator) {\n stylizeElement(button)\n button.id = 'VRButton'\n button.style.display = 'none'\n\n // Query for session mode\n navigator.xr!.isSessionSupported('immersive-vr').then((supported) => {\n supported ? showEnterVR() : showWebXRNotFound()\n\n if (supported && VRButton.xrSessionIsGranted) {\n button.click()\n }\n })\n\n return button\n } else {\n const message = document.createElement('a')\n\n if (window.isSecureContext === false) {\n message.href = document.location.href.replace(/^http:/, 'https:')\n message.innerHTML = 'WEBXR NEEDS HTTPS' // TODO Improve message\n } else {\n message.href = 'https://immersiveweb.dev/'\n message.innerHTML = 'WEBXR NOT AVAILABLE'\n }\n\n message.style.left = 'calc(50% - 90px)'\n message.style.width = '180px'\n message.style.textDecoration = 'none'\n\n stylizeElement(message)\n\n return message\n }\n }\n\n static xrSessionIsGranted = false\n\n static registerSessionGrantedListener(): void {\n if (typeof navigator !== 'undefined' && 'xr' in navigator) {\n ;(navigator as Navigator).xr!.addEventListener('sessiongranted', () => {\n VRButton.xrSessionIsGranted = true\n })\n }\n }\n}\n\nVRButton.registerSessionGrantedListener()\n\nexport { VRButton }\n", "/**\n * @webxr-input-profiles/motion-controllers 1.0.0 https://github.com/immersive-web/webxr-input-profiles\n */\n\nimport type { Object3D } from 'three'\n\ninterface GamepadIndices {\n button: number\n xAxis?: number\n yAxis?: number\n}\n\ninterface VisualResponseDescription {\n componentProperty: string\n states: string[]\n valueNodeProperty: string\n valueNodeName: string\n minNodeName?: string\n maxNodeName?: string\n}\n\ntype VisualResponses = Record\n\ninterface ComponentDescription {\n type: string\n gamepadIndices: GamepadIndices\n rootNodeName: string\n visualResponses: VisualResponses\n touchPointNodeName?: string\n}\n\ninterface Components {\n [componentKey: string]: ComponentDescription\n}\n\ninterface LayoutDescription {\n selectComponentId: string\n components: Components\n gamepadMapping: string\n rootNodeName: string\n assetPath: string\n}\n\ntype Layouts = Partial>\n\nexport interface Profile {\n profileId: string\n fallbackProfileIds: string[]\n layouts: Layouts\n}\n\ninterface ProfilesList {\n [profileId: string]: { path: string; deprecated?: boolean } | undefined\n}\n\nconst MotionControllerConstants = {\n Handedness: {\n NONE: 'none',\n LEFT: 'left',\n RIGHT: 'right',\n },\n\n ComponentState: {\n DEFAULT: 'default',\n TOUCHED: 'touched',\n PRESSED: 'pressed',\n },\n\n ComponentProperty: {\n BUTTON: 'button',\n X_AXIS: 'xAxis',\n Y_AXIS: 'yAxis',\n STATE: 'state',\n },\n\n ComponentType: {\n TRIGGER: 'trigger',\n SQUEEZE: 'squeeze',\n TOUCHPAD: 'touchpad',\n THUMBSTICK: 'thumbstick',\n BUTTON: 'button',\n },\n\n ButtonTouchThreshold: 0.05,\n\n AxisTouchThreshold: 0.1,\n\n VisualResponseProperty: {\n TRANSFORM: 'transform',\n VISIBILITY: 'visibility',\n },\n}\n\n/**\n * @description Static helper function to fetch a JSON file and turn it into a JS object\n * @param {string} path - Path to JSON file to be fetched\n */\nasync function fetchJsonFile(path: string): Promise {\n const response = await fetch(path)\n if (!response.ok) {\n throw new Error(response.statusText)\n } else {\n return response.json()\n }\n}\n\nasync function fetchProfilesList(basePath: string): Promise {\n if (!basePath) {\n throw new Error('No basePath supplied')\n }\n\n const profileListFileName = 'profilesList.json'\n const profilesList = await fetchJsonFile(`${basePath}/${profileListFileName}`)\n return profilesList\n}\n\nasync function fetchProfile(\n xrInputSource: XRInputSource,\n basePath: string,\n defaultProfile: string | null = null,\n getAssetPath = true,\n): Promise<{ profile: Profile; assetPath: string | undefined }> {\n if (!xrInputSource) {\n throw new Error('No xrInputSource supplied')\n }\n\n if (!basePath) {\n throw new Error('No basePath supplied')\n }\n\n // Get the list of profiles\n const supportedProfilesList = await fetchProfilesList(basePath)\n\n // Find the relative path to the first requested profile that is recognized\n let match: { profileId: string; profilePath: string; deprecated: boolean } | undefined = undefined\n xrInputSource.profiles.some((profileId: string) => {\n const supportedProfile = supportedProfilesList[profileId]\n if (supportedProfile) {\n match = {\n profileId,\n profilePath: `${basePath}/${supportedProfile.path}`,\n deprecated: !!supportedProfile.deprecated,\n }\n }\n return !!match\n })\n\n if (!match) {\n if (!defaultProfile) {\n throw new Error('No matching profile name found')\n }\n\n const supportedProfile = supportedProfilesList[defaultProfile]\n if (!supportedProfile) {\n throw new Error(`No matching profile name found and default profile \"${defaultProfile}\" missing.`)\n }\n\n match = {\n profileId: defaultProfile,\n profilePath: `${basePath}/${supportedProfile.path}`,\n deprecated: !!supportedProfile.deprecated,\n }\n }\n\n const profile = await fetchJsonFile(match.profilePath)\n\n let assetPath: string | undefined = undefined\n if (getAssetPath) {\n let layout\n if ((xrInputSource.handedness as string) === 'any') {\n layout = profile.layouts[Object.keys(profile.layouts)[0] as XRHandedness]\n } else {\n layout = profile.layouts[xrInputSource.handedness]\n }\n if (!layout) {\n throw new Error(`No matching handedness, ${xrInputSource.handedness}, in profile ${match.profileId}`)\n }\n\n if (layout.assetPath) {\n assetPath = match.profilePath.replace('profile.json', layout.assetPath)\n }\n }\n\n return { profile, assetPath }\n}\n\n/** @constant {Object} */\nconst defaultComponentValues = {\n xAxis: 0,\n yAxis: 0,\n button: 0,\n state: MotionControllerConstants.ComponentState.DEFAULT,\n}\n\n/**\n * @description Converts an X, Y coordinate from the range -1 to 1 (as reported by the Gamepad\n * API) to the range 0 to 1 (for interpolation). Also caps the X, Y values to be bounded within\n * a circle. This ensures that thumbsticks are not animated outside the bounds of their physical\n * range of motion and touchpads do not report touch locations off their physical bounds.\n * @param {number | undefined} x The original x coordinate in the range -1 to 1\n * @param {number | undefined} y The original y coordinate in the range -1 to 1\n */\nfunction normalizeAxes(\n x: number | undefined = 0,\n y: number | undefined = 0,\n): { normalizedXAxis: number; normalizedYAxis: number } {\n let xAxis = x\n let yAxis = y\n\n // Determine if the point is outside the bounds of the circle\n // and, if so, place it on the edge of the circle\n const hypotenuse = Math.sqrt(x * x + y * y)\n if (hypotenuse > 1) {\n const theta = Math.atan2(y, x)\n xAxis = Math.cos(theta)\n yAxis = Math.sin(theta)\n }\n\n // Scale and move the circle so values are in the interpolation range. The circle's origin moves\n // from (0, 0) to (0.5, 0.5). The circle's radius scales from 1 to be 0.5.\n const result = {\n normalizedXAxis: xAxis * 0.5 + 0.5,\n normalizedYAxis: yAxis * 0.5 + 0.5,\n }\n return result\n}\n\n/**\n * Contains the description of how the 3D model should visually respond to a specific user input.\n * This is accomplished by initializing the object with the name of a node in the 3D model and\n * property that need to be modified in response to user input, the name of the nodes representing\n * the allowable range of motion, and the name of the input which triggers the change. In response\n * to the named input changing, this object computes the appropriate weighting to use for\n * interpolating between the range of motion nodes.\n */\nclass VisualResponse implements VisualResponseDescription {\n value: number | boolean\n componentProperty: string\n states: string[]\n valueNodeName: string\n valueNodeProperty: string\n minNodeName?: string\n maxNodeName?: string\n valueNode: Object3D | undefined\n minNode: Object3D | undefined\n maxNode: Object3D | undefined\n constructor(visualResponseDescription: VisualResponseDescription) {\n this.componentProperty = visualResponseDescription.componentProperty\n this.states = visualResponseDescription.states\n this.valueNodeName = visualResponseDescription.valueNodeName\n this.valueNodeProperty = visualResponseDescription.valueNodeProperty\n\n if (this.valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM) {\n this.minNodeName = visualResponseDescription.minNodeName\n this.maxNodeName = visualResponseDescription.maxNodeName\n }\n\n // Initializes the response's current value based on default data\n this.value = 0\n this.updateFromComponent(defaultComponentValues)\n }\n\n /**\n * Computes the visual response's interpolation weight based on component state\n * @param {Object} componentValues - The component from which to update\n * @param {number | undefined} xAxis - The reported X axis value of the component\n * @param {number | undefined} yAxis - The reported Y axis value of the component\n * @param {number | undefined} button - The reported value of the component's button\n * @param {string} state - The component's active state\n */\n updateFromComponent({\n xAxis,\n yAxis,\n button,\n state,\n }: {\n xAxis?: number\n yAxis?: number\n button?: number\n state: string\n }): void {\n const { normalizedXAxis, normalizedYAxis } = normalizeAxes(xAxis, yAxis)\n switch (this.componentProperty) {\n case MotionControllerConstants.ComponentProperty.X_AXIS:\n this.value = this.states.includes(state) ? normalizedXAxis : 0.5\n break\n case MotionControllerConstants.ComponentProperty.Y_AXIS:\n this.value = this.states.includes(state) ? normalizedYAxis : 0.5\n break\n case MotionControllerConstants.ComponentProperty.BUTTON:\n this.value = this.states.includes(state) && button ? button : 0\n break\n case MotionControllerConstants.ComponentProperty.STATE:\n if (this.valueNodeProperty === MotionControllerConstants.VisualResponseProperty.VISIBILITY) {\n this.value = this.states.includes(state)\n } else {\n this.value = this.states.includes(state) ? 1.0 : 0.0\n }\n break\n default:\n throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)\n }\n }\n}\n\nclass Component implements ComponentDescription {\n id: string\n values: {\n state: string\n button: number | undefined\n xAxis: number | undefined\n yAxis: number | undefined\n }\n\n type: string\n gamepadIndices: GamepadIndices\n rootNodeName: string\n visualResponses: Record\n touchPointNodeName?: string | undefined\n touchPointNode?: Object3D\n\n /**\n * @param {string} componentId - Id of the component\n * @param {InputProfileComponent} componentDescription - Description of the component to be created\n */\n constructor(componentId: string, componentDescription: ComponentDescription) {\n if (\n !componentId ||\n !componentDescription ||\n !componentDescription.visualResponses ||\n !componentDescription.gamepadIndices ||\n Object.keys(componentDescription.gamepadIndices).length === 0\n ) {\n throw new Error('Invalid arguments supplied')\n }\n\n this.id = componentId\n this.type = componentDescription.type\n this.rootNodeName = componentDescription.rootNodeName\n this.touchPointNodeName = componentDescription.touchPointNodeName\n\n // Build all the visual responses for this component\n this.visualResponses = {}\n Object.keys(componentDescription.visualResponses).forEach((responseName) => {\n const visualResponse = new VisualResponse(componentDescription.visualResponses[responseName])\n this.visualResponses[responseName] = visualResponse\n })\n\n // Set default values\n this.gamepadIndices = Object.assign({}, componentDescription.gamepadIndices)\n\n this.values = {\n state: MotionControllerConstants.ComponentState.DEFAULT,\n button: this.gamepadIndices.button !== undefined ? 0 : undefined,\n xAxis: this.gamepadIndices.xAxis !== undefined ? 0 : undefined,\n yAxis: this.gamepadIndices.yAxis !== undefined ? 0 : undefined,\n }\n }\n\n get data(): { id: Component['id'] } & Component['values'] {\n const data = { id: this.id, ...this.values }\n return data\n }\n\n /**\n * @description Poll for updated data based on current gamepad state\n * @param {Object} gamepad - The gamepad object from which the component data should be polled\n */\n updateFromGamepad(gamepad: Gamepad): void {\n // Set the state to default before processing other data sources\n this.values.state = MotionControllerConstants.ComponentState.DEFAULT\n\n // Get and normalize button\n if (this.gamepadIndices.button !== undefined && gamepad.buttons.length > this.gamepadIndices.button) {\n const gamepadButton = gamepad.buttons[this.gamepadIndices.button]\n this.values.button = gamepadButton.value\n this.values.button = this.values.button! < 0 ? 0 : this.values.button\n this.values.button = this.values.button! > 1 ? 1 : this.values.button\n\n // Set the state based on the button\n if (gamepadButton.pressed || this.values.button === 1) {\n this.values.state = MotionControllerConstants.ComponentState.PRESSED\n } else if (gamepadButton.touched || this.values.button! > MotionControllerConstants.ButtonTouchThreshold) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED\n }\n }\n\n // Get and normalize x axis value\n if (this.gamepadIndices.xAxis !== undefined && gamepad.axes.length > this.gamepadIndices.xAxis) {\n this.values.xAxis = gamepad.axes[this.gamepadIndices.xAxis]\n this.values.xAxis = this.values.xAxis! < -1 ? -1 : this.values.xAxis\n this.values.xAxis = this.values.xAxis! > 1 ? 1 : this.values.xAxis\n\n // If the state is still default, check if the xAxis makes it touched\n if (\n this.values.state === MotionControllerConstants.ComponentState.DEFAULT &&\n Math.abs(this.values.xAxis!) > MotionControllerConstants.AxisTouchThreshold\n ) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED\n }\n }\n\n // Get and normalize Y axis value\n if (this.gamepadIndices.yAxis !== undefined && gamepad.axes.length > this.gamepadIndices.yAxis) {\n this.values.yAxis = gamepad.axes[this.gamepadIndices.yAxis]\n this.values.yAxis = this.values.yAxis! < -1 ? -1 : this.values.yAxis\n this.values.yAxis = this.values.yAxis! > 1 ? 1 : this.values.yAxis\n\n // If the state is still default, check if the yAxis makes it touched\n if (\n this.values.state === MotionControllerConstants.ComponentState.DEFAULT &&\n Math.abs(this.values.yAxis!) > MotionControllerConstants.AxisTouchThreshold\n ) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED\n }\n }\n\n // Update the visual response weights based on the current component data\n Object.values(this.visualResponses).forEach((visualResponse) => {\n visualResponse.updateFromComponent(this.values)\n })\n }\n}\n/**\n * @description Builds a motion controller with components and visual responses based on the\n * supplied profile description. Data is polled from the xrInputSource's gamepad.\n * @author Nell Waliczek / https://github.com/NellWaliczek\n */\nclass MotionController {\n xrInputSource: XRInputSource\n assetUrl: string\n layoutDescription: LayoutDescription\n id: string\n components: Record\n /**\n * @param {XRInputSource} xrInputSource - The XRInputSource to build the MotionController around\n * @param {Profile} profile - The best matched profile description for the supplied xrInputSource\n * @param {string} assetUrl\n */\n constructor(xrInputSource: XRInputSource, profile: Profile, assetUrl: string) {\n if (!xrInputSource) {\n throw new Error('No xrInputSource supplied')\n }\n\n if (!profile) {\n throw new Error('No profile supplied')\n }\n\n if (!profile.layouts[xrInputSource.handedness]) {\n throw new Error('No layout for ' + xrInputSource.handedness + ' handedness')\n }\n\n this.xrInputSource = xrInputSource\n this.assetUrl = assetUrl\n this.id = profile.profileId\n\n // Build child components as described in the profile description\n this.layoutDescription = profile.layouts[xrInputSource.handedness]!\n\n this.components = {}\n Object.keys(this.layoutDescription.components).forEach((componentId) => {\n const componentDescription = this.layoutDescription.components[componentId]\n this.components[componentId] = new Component(componentId, componentDescription)\n })\n\n // Initialize components based on current gamepad state\n this.updateFromGamepad()\n }\n\n get gripSpace(): XRInputSource['gripSpace'] {\n return this.xrInputSource.gripSpace\n }\n\n get targetRaySpace(): XRInputSource['targetRaySpace'] {\n return this.xrInputSource.targetRaySpace\n }\n\n /**\n * @description Returns a subset of component data for simplified debugging\n */\n get data(): Array {\n const data: Array = []\n Object.values(this.components).forEach((component) => {\n data.push(component.data)\n })\n return data\n }\n\n /**\n * @description Poll for updated data based on current gamepad state\n */\n updateFromGamepad(): void {\n Object.values(this.components).forEach((component) => {\n component.updateFromGamepad(this.xrInputSource.gamepad!)\n })\n }\n}\n\nexport { MotionControllerConstants, MotionController, fetchProfile, fetchProfilesList }\n", "import {\n DynamicDrawUsage,\n SphereGeometry,\n BoxGeometry,\n MeshStandardMaterial,\n InstancedMesh,\n Matrix4,\n Vector3,\n} from 'three'\n\nconst _matrix = new Matrix4()\nconst _vector = new Vector3()\n\nclass XRHandPrimitiveModel {\n constructor(handModel, controller, path, handedness, options) {\n this.controller = controller\n this.handModel = handModel\n this.envMap = null\n\n let geometry\n\n if (!options || !options.primitive || options.primitive === 'sphere') {\n geometry = new SphereGeometry(1, 10, 10)\n } else if (options.primitive === 'box') {\n geometry = new BoxGeometry(1, 1, 1)\n }\n\n const material = new MeshStandardMaterial()\n\n this.handMesh = new InstancedMesh(geometry, material, 30)\n this.handMesh.instanceMatrix.setUsage(DynamicDrawUsage) // will be updated every frame\n this.handMesh.castShadow = true\n this.handMesh.receiveShadow = true\n this.handModel.add(this.handMesh)\n\n this.joints = [\n 'wrist',\n 'thumb-metacarpal',\n 'thumb-phalanx-proximal',\n 'thumb-phalanx-distal',\n 'thumb-tip',\n 'index-finger-metacarpal',\n 'index-finger-phalanx-proximal',\n 'index-finger-phalanx-intermediate',\n 'index-finger-phalanx-distal',\n 'index-finger-tip',\n 'middle-finger-metacarpal',\n 'middle-finger-phalanx-proximal',\n 'middle-finger-phalanx-intermediate',\n 'middle-finger-phalanx-distal',\n 'middle-finger-tip',\n 'ring-finger-metacarpal',\n 'ring-finger-phalanx-proximal',\n 'ring-finger-phalanx-intermediate',\n 'ring-finger-phalanx-distal',\n 'ring-finger-tip',\n 'pinky-finger-metacarpal',\n 'pinky-finger-phalanx-proximal',\n 'pinky-finger-phalanx-intermediate',\n 'pinky-finger-phalanx-distal',\n 'pinky-finger-tip',\n ]\n }\n\n updateMesh() {\n const defaultRadius = 0.008\n const joints = this.controller.joints\n\n let count = 0\n\n for (let i = 0; i < this.joints.length; i++) {\n const joint = joints[this.joints[i]]\n\n if (joint.visible) {\n _vector.setScalar(joint.jointRadius || defaultRadius)\n _matrix.compose(joint.position, joint.quaternion, _vector)\n this.handMesh.setMatrixAt(i, _matrix)\n\n count++\n }\n }\n\n this.handMesh.count = count\n this.handMesh.instanceMatrix.needsUpdate = true\n }\n}\n\nexport { XRHandPrimitiveModel }\n", "import { BoxGeometry, Vector3 } from 'three'\n\nconst tempNormal = new Vector3()\n\nfunction getUv(faceDirVector, normal, uvAxis, projectionAxis, radius, sideLength) {\n const totArcLength = (2 * Math.PI * radius) / 4\n\n // length of the planes between the arcs on each axis\n const centerLength = Math.max(sideLength - 2 * radius, 0)\n const halfArc = Math.PI / 4\n\n // Get the vector projected onto the Y plane\n tempNormal.copy(normal)\n tempNormal[projectionAxis] = 0\n tempNormal.normalize()\n\n // total amount of UV space alloted to a single arc\n const arcUvRatio = (0.5 * totArcLength) / (totArcLength + centerLength)\n\n // the distance along one arc the point is at\n const arcAngleRatio = 1.0 - tempNormal.angleTo(faceDirVector) / halfArc\n\n if (Math.sign(tempNormal[uvAxis]) === 1) {\n return arcAngleRatio * arcUvRatio\n } else {\n // total amount of UV space alloted to the plane between the arcs\n const lenUv = centerLength / (totArcLength + centerLength)\n return lenUv + arcUvRatio + arcUvRatio * (1.0 - arcAngleRatio)\n }\n}\n\nclass RoundedBoxGeometry extends BoxGeometry {\n constructor(width = 1, height = 1, depth = 1, segments = 2, radius = 0.1) {\n // ensure segments is odd so we have a plane connecting the rounded corners\n segments = segments * 2 + 1\n\n // ensure radius isn't bigger than shortest side\n radius = Math.min(width / 2, height / 2, depth / 2, radius)\n\n super(1, 1, 1, segments, segments, segments)\n\n // if we just have one segment we're the same as a regular box\n if (segments === 1) return\n\n const geometry2 = this.toNonIndexed()\n\n this.index = null\n this.attributes.position = geometry2.attributes.position\n this.attributes.normal = geometry2.attributes.normal\n this.attributes.uv = geometry2.attributes.uv\n\n //\n\n const position = new Vector3()\n const normal = new Vector3()\n\n const box = new Vector3(width, height, depth).divideScalar(2).subScalar(radius)\n\n const positions = this.attributes.position.array\n const normals = this.attributes.normal.array\n const uvs = this.attributes.uv.array\n\n const faceTris = positions.length / 6\n const faceDirVector = new Vector3()\n const halfSegmentSize = 0.5 / segments\n\n for (let i = 0, j = 0; i < positions.length; i += 3, j += 2) {\n position.fromArray(positions, i)\n normal.copy(position)\n normal.x -= Math.sign(normal.x) * halfSegmentSize\n normal.y -= Math.sign(normal.y) * halfSegmentSize\n normal.z -= Math.sign(normal.z) * halfSegmentSize\n normal.normalize()\n\n positions[i + 0] = box.x * Math.sign(position.x) + normal.x * radius\n positions[i + 1] = box.y * Math.sign(position.y) + normal.y * radius\n positions[i + 2] = box.z * Math.sign(position.z) + normal.z * radius\n\n normals[i + 0] = normal.x\n normals[i + 1] = normal.y\n normals[i + 2] = normal.z\n\n const side = Math.floor(i / faceTris)\n\n switch (side) {\n case 0: // right\n // generate UVs along Z then Y\n faceDirVector.set(1, 0, 0)\n uvs[j + 0] = getUv(faceDirVector, normal, 'z', 'y', radius, depth)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'z', radius, height)\n break\n\n case 1: // left\n // generate UVs along Z then Y\n faceDirVector.set(-1, 0, 0)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'z', 'y', radius, depth)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'z', radius, height)\n break\n\n case 2: // top\n // generate UVs along X then Z\n faceDirVector.set(0, 1, 0)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'x', 'z', radius, width)\n uvs[j + 1] = getUv(faceDirVector, normal, 'z', 'x', radius, depth)\n break\n\n case 3: // bottom\n // generate UVs along X then Z\n faceDirVector.set(0, -1, 0)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'x', 'z', radius, width)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'z', 'x', radius, depth)\n break\n\n case 4: // front\n // generate UVs along X then Y\n faceDirVector.set(0, 0, 1)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'x', 'y', radius, width)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'x', radius, height)\n break\n\n case 5: // back\n // generate UVs along X then Y\n faceDirVector.set(0, 0, -1)\n uvs[j + 0] = getUv(faceDirVector, normal, 'x', 'y', radius, width)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'x', radius, height)\n break\n }\n }\n }\n}\n\nexport { RoundedBoxGeometry }\n", "import { Vector3, Matrix4 } from 'three'\n\nconst inverseProjectionMatrix = new Matrix4()\n\nclass CSMFrustum {\n constructor(data) {\n data = data || {}\n\n this.vertices = {\n near: [new Vector3(), new Vector3(), new Vector3(), new Vector3()],\n far: [new Vector3(), new Vector3(), new Vector3(), new Vector3()],\n }\n\n if (data.projectionMatrix !== undefined) {\n this.setFromProjectionMatrix(data.projectionMatrix, data.maxFar || 10000)\n }\n }\n\n setFromProjectionMatrix(projectionMatrix, maxFar) {\n const isOrthographic = projectionMatrix.elements[2 * 4 + 3] === 0\n\n inverseProjectionMatrix.copy(projectionMatrix).invert()\n\n // 3 --- 0 vertices.near/far order\n // | |\n // 2 --- 1\n // clip space spans from [-1, 1]\n\n this.vertices.near[0].set(1, 1, -1)\n this.vertices.near[1].set(1, -1, -1)\n this.vertices.near[2].set(-1, -1, -1)\n this.vertices.near[3].set(-1, 1, -1)\n this.vertices.near.forEach(function (v) {\n v.applyMatrix4(inverseProjectionMatrix)\n })\n\n this.vertices.far[0].set(1, 1, 1)\n this.vertices.far[1].set(1, -1, 1)\n this.vertices.far[2].set(-1, -1, 1)\n this.vertices.far[3].set(-1, 1, 1)\n this.vertices.far.forEach(function (v) {\n v.applyMatrix4(inverseProjectionMatrix)\n\n const absZ = Math.abs(v.z)\n if (isOrthographic) {\n v.z *= Math.min(maxFar / absZ, 1.0)\n } else {\n v.multiplyScalar(Math.min(maxFar / absZ, 1.0))\n }\n })\n\n return this.vertices\n }\n\n split(breaks, target) {\n while (breaks.length > target.length) {\n target.push(new CSMFrustum())\n }\n\n target.length = breaks.length\n\n for (let i = 0; i < breaks.length; i++) {\n const cascade = target[i]\n\n if (i === 0) {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.near[j].copy(this.vertices.near[j])\n }\n } else {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.near[j].lerpVectors(this.vertices.near[j], this.vertices.far[j], breaks[i - 1])\n }\n }\n\n if (i === breaks.length - 1) {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.far[j].copy(this.vertices.far[j])\n }\n } else {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.far[j].lerpVectors(this.vertices.near[j], this.vertices.far[j], breaks[i])\n }\n }\n }\n }\n\n toSpace(cameraMatrix, target) {\n for (let i = 0; i < 4; i++) {\n target.vertices.near[i].copy(this.vertices.near[i]).applyMatrix4(cameraMatrix)\n\n target.vertices.far[i].copy(this.vertices.far[i]).applyMatrix4(cameraMatrix)\n }\n }\n}\n\nexport { CSMFrustum }\n", "import { Vector2, Vector3, DirectionalLight, MathUtils, ShaderChunk, Matrix4, Box3 } from 'three'\nimport { CSMFrustum } from './CSMFrustum'\nimport { CSMShader } from './CSMShader'\n\nconst _cameraToLightMatrix = new Matrix4()\nconst _lightSpaceFrustum = new CSMFrustum()\nconst _center = new Vector3()\nconst _bbox = new Box3()\nconst _uniformArray = []\nconst _logArray = []\n\nexport class CSM {\n constructor(data) {\n data = data || {}\n\n this.camera = data.camera\n this.parent = data.parent\n this.cascades = data.cascades || 3\n this.maxFar = data.maxFar || 100000\n this.mode = data.mode || 'practical'\n this.shadowMapSize = data.shadowMapSize || 2048\n this.shadowBias = data.shadowBias || 0.000001\n this.lightDirection = data.lightDirection || new Vector3(1, -1, 1).normalize()\n this.lightIntensity = data.lightIntensity || 1\n this.lightNear = data.lightNear || 1\n this.lightFar = data.lightFar || 2000\n this.lightMargin = data.lightMargin || 200\n this.customSplitsCallback = data.customSplitsCallback\n this.fade = false\n this.mainFrustum = new CSMFrustum()\n this.frustums = []\n this.breaks = []\n\n this.lights = []\n this.shaders = new Map()\n\n this.createLights()\n this.updateFrustums()\n this.injectInclude()\n }\n\n createLights() {\n for (let i = 0; i < this.cascades; i++) {\n const light = new DirectionalLight(0xffffff, this.lightIntensity)\n light.castShadow = true\n light.shadow.mapSize.width = this.shadowMapSize\n light.shadow.mapSize.height = this.shadowMapSize\n\n light.shadow.camera.near = this.lightNear\n light.shadow.camera.far = this.lightFar\n light.shadow.bias = this.shadowBias\n\n this.parent.add(light)\n this.parent.add(light.target)\n this.lights.push(light)\n }\n }\n\n initCascades() {\n const camera = this.camera\n camera.updateProjectionMatrix()\n this.mainFrustum.setFromProjectionMatrix(camera.projectionMatrix, this.maxFar)\n this.mainFrustum.split(this.breaks, this.frustums)\n }\n\n updateShadowBounds() {\n const frustums = this.frustums\n for (let i = 0; i < frustums.length; i++) {\n const light = this.lights[i]\n const shadowCam = light.shadow.camera\n const frustum = this.frustums[i]\n\n // Get the two points that represent that furthest points on the frustum assuming\n // that's either the diagonal across the far plane or the diagonal across the whole\n // frustum itself.\n const nearVerts = frustum.vertices.near\n const farVerts = frustum.vertices.far\n const point1 = farVerts[0]\n let point2\n if (point1.distanceTo(farVerts[2]) > point1.distanceTo(nearVerts[2])) {\n point2 = farVerts[2]\n } else {\n point2 = nearVerts[2]\n }\n\n let squaredBBWidth = point1.distanceTo(point2)\n if (this.fade) {\n // expand the shadow extents by the fade margin if fade is enabled.\n const camera = this.camera\n const far = Math.max(camera.far, this.maxFar)\n const linearDepth = frustum.vertices.far[0].z / (far - camera.near)\n const margin = 0.25 * Math.pow(linearDepth, 2.0) * (far - camera.near)\n\n squaredBBWidth += margin\n }\n\n shadowCam.left = -squaredBBWidth / 2\n shadowCam.right = squaredBBWidth / 2\n shadowCam.top = squaredBBWidth / 2\n shadowCam.bottom = -squaredBBWidth / 2\n shadowCam.updateProjectionMatrix()\n }\n }\n\n getBreaks() {\n const camera = this.camera\n const far = Math.min(camera.far, this.maxFar)\n this.breaks.length = 0\n\n switch (this.mode) {\n case 'uniform':\n uniformSplit(this.cascades, camera.near, far, this.breaks)\n break\n case 'logarithmic':\n logarithmicSplit(this.cascades, camera.near, far, this.breaks)\n break\n case 'practical':\n practicalSplit(this.cascades, camera.near, far, 0.5, this.breaks)\n break\n case 'custom':\n if (this.customSplitsCallback === undefined) console.error('CSM: Custom split scheme callback not defined.')\n this.customSplitsCallback(this.cascades, camera.near, far, this.breaks)\n break\n }\n\n function uniformSplit(amount, near, far, target) {\n for (let i = 1; i < amount; i++) {\n target.push((near + ((far - near) * i) / amount) / far)\n }\n\n target.push(1)\n }\n\n function logarithmicSplit(amount, near, far, target) {\n for (let i = 1; i < amount; i++) {\n target.push((near * (far / near) ** (i / amount)) / far)\n }\n\n target.push(1)\n }\n\n function practicalSplit(amount, near, far, lambda, target) {\n _uniformArray.length = 0\n _logArray.length = 0\n logarithmicSplit(amount, near, far, _logArray)\n uniformSplit(amount, near, far, _uniformArray)\n\n for (let i = 1; i < amount; i++) {\n target.push(MathUtils.lerp(_uniformArray[i - 1], _logArray[i - 1], lambda))\n }\n\n target.push(1)\n }\n }\n\n update() {\n const camera = this.camera\n const frustums = this.frustums\n for (let i = 0; i < frustums.length; i++) {\n const light = this.lights[i]\n const shadowCam = light.shadow.camera\n const texelWidth = (shadowCam.right - shadowCam.left) / this.shadowMapSize\n const texelHeight = (shadowCam.top - shadowCam.bottom) / this.shadowMapSize\n light.shadow.camera.updateMatrixWorld(true)\n _cameraToLightMatrix.multiplyMatrices(light.shadow.camera.matrixWorldInverse, camera.matrixWorld)\n frustums[i].toSpace(_cameraToLightMatrix, _lightSpaceFrustum)\n\n const nearVerts = _lightSpaceFrustum.vertices.near\n const farVerts = _lightSpaceFrustum.vertices.far\n _bbox.makeEmpty()\n for (let j = 0; j < 4; j++) {\n _bbox.expandByPoint(nearVerts[j])\n _bbox.expandByPoint(farVerts[j])\n }\n\n _bbox.getCenter(_center)\n _center.z = _bbox.max.z + this.lightMargin\n _center.x = Math.floor(_center.x / texelWidth) * texelWidth\n _center.y = Math.floor(_center.y / texelHeight) * texelHeight\n _center.applyMatrix4(light.shadow.camera.matrixWorld)\n\n light.position.copy(_center)\n light.target.position.copy(_center)\n\n light.target.position.x += this.lightDirection.x\n light.target.position.y += this.lightDirection.y\n light.target.position.z += this.lightDirection.z\n }\n }\n\n injectInclude() {\n ShaderChunk.lights_fragment_begin = CSMShader.lights_fragment_begin\n ShaderChunk.lights_pars_begin = CSMShader.lights_pars_begin\n }\n\n setupMaterial(material) {\n material.defines = material.defines || {}\n material.defines.USE_CSM = 1\n material.defines.CSM_CASCADES = this.cascades\n\n if (this.fade) {\n material.defines.CSM_FADE = ''\n }\n\n const breaksVec2 = []\n const scope = this\n const shaders = this.shaders\n\n material.onBeforeCompile = function (shader) {\n const far = Math.min(scope.camera.far, scope.maxFar)\n scope.getExtendedBreaks(breaksVec2)\n\n shader.uniforms.CSM_cascades = { value: breaksVec2 }\n shader.uniforms.cameraNear = { value: scope.camera.near }\n shader.uniforms.shadowFar = { value: far }\n\n shaders.set(material, shader)\n }\n\n shaders.set(material, null)\n }\n\n updateUniforms() {\n const far = Math.min(this.camera.far, this.maxFar)\n const shaders = this.shaders\n\n shaders.forEach(function (shader, material) {\n if (shader !== null) {\n const uniforms = shader.uniforms\n this.getExtendedBreaks(uniforms.CSM_cascades.value)\n uniforms.cameraNear.value = this.camera.near\n uniforms.shadowFar.value = far\n }\n\n if (!this.fade && 'CSM_FADE' in material.defines) {\n delete material.defines.CSM_FADE\n material.needsUpdate = true\n } else if (this.fade && !('CSM_FADE' in material.defines)) {\n material.defines.CSM_FADE = ''\n material.needsUpdate = true\n }\n }, this)\n }\n\n getExtendedBreaks(target) {\n while (target.length < this.breaks.length) {\n target.push(new Vector2())\n }\n\n target.length = this.breaks.length\n\n for (let i = 0; i < this.cascades; i++) {\n const amount = this.breaks[i]\n const prev = this.breaks[i - 1] || 0\n target[i].x = prev\n target[i].y = amount\n }\n }\n\n updateFrustums() {\n this.getBreaks()\n this.initCascades()\n this.updateShadowBounds()\n this.updateUniforms()\n }\n\n remove() {\n for (let i = 0; i < this.lights.length; i++) {\n this.parent.remove(this.lights[i])\n }\n }\n\n dispose() {\n const shaders = this.shaders\n shaders.forEach(function (shader, material) {\n delete material.onBeforeCompile\n delete material.defines.USE_CSM\n delete material.defines.CSM_CASCADES\n delete material.defines.CSM_FADE\n\n if (shader !== null) {\n delete shader.uniforms.CSM_cascades\n delete shader.uniforms.cameraNear\n delete shader.uniforms.shadowFar\n }\n\n material.needsUpdate = true\n })\n shaders.clear()\n }\n}\n", "/**\n * ACES Filmic Tone Mapping Shader by Stephen Hill\n * source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\n *\n * this implementation of ACES is modified to accommodate a brighter viewing environment.\n * the scale factor of 1/0.6 is subjective. see discussion in #19621.\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type ACESFilmicToneMappingShaderUniforms = {\n exposure: IUniform\n tDiffuse: IUniform\n}\n\nexport interface IACESFilmicToneMappingShader extends IShader {}\n\nexport const ACESFilmicToneMappingShader: IACESFilmicToneMappingShader = {\n uniforms: {\n tDiffuse: { value: null },\n exposure: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define saturate(a) clamp( a, 0.0, 1.0 )',\n\n 'uniform sampler2D tDiffuse;',\n\n 'uniform float exposure;',\n\n 'varying vec2 vUv;',\n\n 'vec3 RRTAndODTFit( vec3 v ) {',\n\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\n '}',\n\n 'vec3 ACESFilmicToneMapping( vec3 color ) {',\n\n // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n '\tconst mat3 ACESInputMat = mat3(',\n '\t\tvec3( 0.59719, 0.07600, 0.02840 ),', // transposed from source\n '\t\tvec3( 0.35458, 0.90834, 0.13383 ),',\n '\t\tvec3( 0.04823, 0.01566, 0.83777 )',\n '\t);',\n\n // ODT_SAT => XYZ => D60_2_D65 => sRGB\n '\tconst mat3 ACESOutputMat = mat3(',\n '\t\tvec3( 1.60475, -0.10208, -0.00327 ),', // transposed from source\n '\t\tvec3( -0.53108, 1.10813, -0.07276 ),',\n '\t\tvec3( -0.07367, -0.00605, 1.07602 )',\n '\t);',\n\n '\tcolor = ACESInputMat * color;',\n\n // Apply RRT and ODT\n '\tcolor = RRTAndODTFit( color );',\n\n '\tcolor = ACESOutputMat * color;',\n\n // Clamp to [0, 1]\n '\treturn saturate( color );',\n\n '}',\n\n 'void main() {',\n\n '\tvec4 tex = texture2D( tDiffuse, vUv );',\n\n '\ttex.rgb *= exposure / 0.6;', // pre-exposed, outside of the tone mapping function\n\n '\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Simple test shader\n */\n\nimport type { IShader } from './types'\n\nexport type BasicShaderUniforms = {}\n\nexport interface IBasicShader extends IShader {}\n\nexport const BasicShader: IBasicShader = {\n uniforms: {},\n\n vertexShader: [\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: ['void main() {', '\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );', '}'].join('\\n'),\n}\n", "/**\n * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass]\n * - based on Nvidia example\n * http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type BleachBypassShaderUniforms = {\n opacity: IUniform\n tDiffuse: IUniform\n}\n\nexport interface IBleachBypassShader extends IShader {}\n\nexport const BleachBypassShader: IBleachBypassShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 base = texture2D( tDiffuse, vUv );',\n\n '\tvec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );',\n '\tfloat lum = dot( lumCoeff, base.rgb );',\n '\tvec3 blend = vec3( lum );',\n\n '\tfloat L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );',\n\n '\tvec3 result1 = 2.0 * base.rgb * blend;',\n '\tvec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );',\n\n '\tvec3 newColor = mix( result1, result2, L );',\n\n '\tfloat A2 = opacity * base.a;',\n '\tvec3 mixRGB = A2 * newColor.rgb;',\n '\tmixRGB += ( ( 1.0 - A2 ) * base.rgb );',\n\n '\tgl_FragColor = vec4( mixRGB, base.a );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Blend two textures\n */\n\nexport const BlendShader = {\n uniforms: {\n tDiffuse1: { value: null },\n tDiffuse2: { value: null },\n mixRatio: { value: 0.5 },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n 'uniform float mixRatio;',\n\n 'uniform sampler2D tDiffuse1;',\n 'uniform sampler2D tDiffuse2;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel1 = texture2D( tDiffuse1, vUv );',\n '\tvec4 texel2 = texture2D( tDiffuse2, vUv );',\n '\tgl_FragColor = opacity * mix( texel1, texel2, mixRatio );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Brightness and contrast adjustment\n * https://github.com/evanw/glfx.js\n * brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)\n * contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)\n */\n\nexport const BrightnessContrastShader = {\n uniforms: {\n tDiffuse: { value: null },\n brightness: { value: 0 },\n contrast: { value: 0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float brightness;',\n 'uniform float contrast;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tgl_FragColor = texture2D( tDiffuse, vUv );',\n\n '\tgl_FragColor.rgb += brightness;',\n\n '\tif (contrast > 0.0) {',\n '\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;',\n '\t} else {',\n '\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;',\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector3 } from 'three'\n\n/**\n * Color correction\n */\n\nexport const ColorCorrectionShader = {\n uniforms: {\n tDiffuse: { value: null },\n powRGB: { value: new Vector3(2, 2, 2) },\n mulRGB: { value: new Vector3(1, 1, 1) },\n addRGB: { value: new Vector3(0, 0, 0) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform vec3 powRGB;',\n 'uniform vec3 mulRGB;',\n 'uniform vec3 addRGB;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tgl_FragColor = texture2D( tDiffuse, vUv );',\n '\tgl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color } from 'three'\n\n/**\n * Colorify shader\n */\n\nexport const ColorifyShader = {\n uniforms: {\n tDiffuse: { value: null },\n color: { value: new Color(0xffffff) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 color;',\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tvec3 luma = vec3( 0.299, 0.587, 0.114 );',\n '\tfloat v = dot( texel.xyz, luma );',\n\n '\tgl_FragColor = vec4( v * color, texel.w );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Depth-of-field shader using mipmaps\n * - from Matt Handley @applmak\n * - requires power-of-2 sized render target with enabled mipmaps\n */\n\nexport const DOFMipMapShader = {\n uniforms: {\n tColor: { value: null },\n tDepth: { value: null },\n focus: { value: 1.0 },\n maxblur: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float focus;',\n 'uniform float maxblur;',\n\n 'uniform sampler2D tColor;',\n 'uniform sampler2D tDepth;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 depth = texture2D( tDepth, vUv );',\n\n '\tfloat factor = depth.x - focus;',\n\n '\tvec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );',\n\n '\tgl_FragColor = col;',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * NVIDIA FXAA by Timothy Lottes\n * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n * - WebGL port by @supereggbert\n * http://www.glge.org/demos/fxaa/\n */\n\nexport const FXAAShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'precision highp float;',\n '',\n 'uniform sampler2D tDiffuse;',\n '',\n 'uniform vec2 resolution;',\n '',\n 'varying vec2 vUv;',\n '',\n '// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)',\n '',\n '//----------------------------------------------------------------------------------',\n '// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag',\n '// SDK Version: v3.00',\n '// Email: gameworks@nvidia.com',\n '// Site: http://developer.nvidia.com/',\n '//',\n '// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.',\n '//',\n '// Redistribution and use in source and binary forms, with or without',\n '// modification, are permitted provided that the following conditions',\n '// are met:',\n '// * Redistributions of source code must retain the above copyright',\n '// notice, this list of conditions and the following disclaimer.',\n '// * Redistributions in binary form must reproduce the above copyright',\n '// notice, this list of conditions and the following disclaimer in the',\n '// documentation and/or other materials provided with the distribution.',\n '// * Neither the name of NVIDIA CORPORATION nor the names of its',\n '// contributors may be used to endorse or promote products derived',\n '// from this software without specific prior written permission.',\n '//',\n \"// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY\",\n '// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE',\n '// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR',\n '// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR',\n '// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,',\n '// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,',\n '// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR',\n '// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY',\n '// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT',\n '// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE',\n '// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.',\n '//',\n '//----------------------------------------------------------------------------------',\n '',\n '#define FXAA_PC 1',\n '#define FXAA_GLSL_100 1',\n '#define FXAA_QUALITY_PRESET 12',\n '',\n '#define FXAA_GREEN_AS_LUMA 1',\n '',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_PC_CONSOLE',\n ' //',\n ' // The console algorithm for PC is included',\n ' // for developers targeting really low spec machines.',\n ' // Likely better to just run FXAA_PC, and use a really low preset.',\n ' //',\n ' #define FXAA_PC_CONSOLE 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_GLSL_120',\n ' #define FXAA_GLSL_120 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_GLSL_130',\n ' #define FXAA_GLSL_130 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_HLSL_3',\n ' #define FXAA_HLSL_3 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_HLSL_4',\n ' #define FXAA_HLSL_4 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_HLSL_5',\n ' #define FXAA_HLSL_5 0',\n '#endif',\n '/*==========================================================================*/',\n '#ifndef FXAA_GREEN_AS_LUMA',\n ' //',\n ' // For those using non-linear color,',\n ' // and either not able to get luma in alpha, or not wanting to,',\n ' // this enables FXAA to run using green as a proxy for luma.',\n ' // So with this enabled, no need to pack luma in alpha.',\n ' //',\n ' // This will turn off AA on anything which lacks some amount of green.',\n ' // Pure red and blue or combination of only R and B, will get no AA.',\n ' //',\n ' // Might want to lower the settings for both,',\n ' // fxaaConsoleEdgeThresholdMin',\n ' // fxaaQualityEdgeThresholdMin',\n ' // In order to insure AA does not get turned off on colors',\n ' // which contain a minor amount of green.',\n ' //',\n ' // 1 = On.',\n ' // 0 = Off.',\n ' //',\n ' #define FXAA_GREEN_AS_LUMA 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_EARLY_EXIT',\n ' //',\n \" // Controls algorithm's early exit path.\",\n ' // On PS3 turning this ON adds 2 cycles to the shader.',\n ' // On 360 turning this OFF adds 10ths of a millisecond to the shader.',\n ' // Turning this off on console will result in a more blurry image.',\n ' // So this defaults to on.',\n ' //',\n ' // 1 = On.',\n ' // 0 = Off.',\n ' //',\n ' #define FXAA_EARLY_EXIT 1',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_DISCARD',\n ' //',\n ' // Only valid for PC OpenGL currently.',\n ' // Probably will not work when FXAA_GREEN_AS_LUMA = 1.',\n ' //',\n \" // 1 = Use discard on pixels which don't need AA.\",\n ' // For APIs which enable concurrent TEX+ROP from same surface.',\n \" // 0 = Return unchanged color on pixels which don't need AA.\",\n ' //',\n ' #define FXAA_DISCARD 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_FAST_PIXEL_OFFSET',\n ' //',\n ' // Used for GLSL 120 only.',\n ' //',\n ' // 1 = GL API supports fast pixel offsets',\n ' // 0 = do not use fast pixel offsets',\n ' //',\n ' #ifdef GL_EXT_gpu_shader4',\n ' #define FXAA_FAST_PIXEL_OFFSET 1',\n ' #endif',\n ' #ifdef GL_NV_gpu_shader5',\n ' #define FXAA_FAST_PIXEL_OFFSET 1',\n ' #endif',\n ' #ifdef GL_ARB_gpu_shader5',\n ' #define FXAA_FAST_PIXEL_OFFSET 1',\n ' #endif',\n ' #ifndef FXAA_FAST_PIXEL_OFFSET',\n ' #define FXAA_FAST_PIXEL_OFFSET 0',\n ' #endif',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_GATHER4_ALPHA',\n ' //',\n ' // 1 = API supports gather4 on alpha channel.',\n ' // 0 = API does not support gather4 on alpha channel.',\n ' //',\n ' #if (FXAA_HLSL_5 == 1)',\n ' #define FXAA_GATHER4_ALPHA 1',\n ' #endif',\n ' #ifdef GL_ARB_gpu_shader5',\n ' #define FXAA_GATHER4_ALPHA 1',\n ' #endif',\n ' #ifdef GL_NV_gpu_shader5',\n ' #define FXAA_GATHER4_ALPHA 1',\n ' #endif',\n ' #ifndef FXAA_GATHER4_ALPHA',\n ' #define FXAA_GATHER4_ALPHA 0',\n ' #endif',\n '#endif',\n '',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - TUNING KNOBS',\n '------------------------------------------------------------------------------',\n 'NOTE the other tuning knobs are now in the shader function inputs!',\n '============================================================================*/',\n '#ifndef FXAA_QUALITY_PRESET',\n ' //',\n ' // Choose the quality preset.',\n ' // This needs to be compiled into the shader as it effects code.',\n ' // Best option to include multiple presets is to',\n ' // in each shader define the preset, then include this file.',\n ' //',\n ' // OPTIONS',\n ' // -----------------------------------------------------------------------',\n ' // 10 to 15 - default medium dither (10=fastest, 15=highest quality)',\n ' // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)',\n ' // 39 - no dither, very expensive',\n ' //',\n ' // NOTES',\n ' // -----------------------------------------------------------------------',\n ' // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)',\n ' // 13 = about same speed as FXAA 3.9 and better than 12',\n ' // 23 = closest to FXAA 3.9 visually and performance wise',\n ' // _ = the lowest digit is directly related to performance',\n ' // _ = the highest digit is directly related to style',\n ' //',\n ' #define FXAA_QUALITY_PRESET 12',\n '#endif',\n '',\n '',\n '/*============================================================================',\n '',\n ' FXAA QUALITY - PRESETS',\n '',\n '============================================================================*/',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - MEDIUM DITHER PRESETS',\n '============================================================================*/',\n '#if (FXAA_QUALITY_PRESET == 10)',\n ' #define FXAA_QUALITY_PS 3',\n ' #define FXAA_QUALITY_P0 1.5',\n ' #define FXAA_QUALITY_P1 3.0',\n ' #define FXAA_QUALITY_P2 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 11)',\n ' #define FXAA_QUALITY_PS 4',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 3.0',\n ' #define FXAA_QUALITY_P3 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 12)',\n ' #define FXAA_QUALITY_PS 5',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 4.0',\n ' #define FXAA_QUALITY_P4 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 13)',\n ' #define FXAA_QUALITY_PS 6',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 4.0',\n ' #define FXAA_QUALITY_P5 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 14)',\n ' #define FXAA_QUALITY_PS 7',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 4.0',\n ' #define FXAA_QUALITY_P6 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 15)',\n ' #define FXAA_QUALITY_PS 8',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 4.0',\n ' #define FXAA_QUALITY_P7 12.0',\n '#endif',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - LOW DITHER PRESETS',\n '============================================================================*/',\n '#if (FXAA_QUALITY_PRESET == 20)',\n ' #define FXAA_QUALITY_PS 3',\n ' #define FXAA_QUALITY_P0 1.5',\n ' #define FXAA_QUALITY_P1 2.0',\n ' #define FXAA_QUALITY_P2 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 21)',\n ' #define FXAA_QUALITY_PS 4',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 22)',\n ' #define FXAA_QUALITY_PS 5',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 23)',\n ' #define FXAA_QUALITY_PS 6',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 24)',\n ' #define FXAA_QUALITY_PS 7',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 3.0',\n ' #define FXAA_QUALITY_P6 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 25)',\n ' #define FXAA_QUALITY_PS 8',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 4.0',\n ' #define FXAA_QUALITY_P7 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 26)',\n ' #define FXAA_QUALITY_PS 9',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 4.0',\n ' #define FXAA_QUALITY_P8 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 27)',\n ' #define FXAA_QUALITY_PS 10',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 4.0',\n ' #define FXAA_QUALITY_P9 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 28)',\n ' #define FXAA_QUALITY_PS 11',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 2.0',\n ' #define FXAA_QUALITY_P9 4.0',\n ' #define FXAA_QUALITY_P10 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 29)',\n ' #define FXAA_QUALITY_PS 12',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 2.0',\n ' #define FXAA_QUALITY_P9 2.0',\n ' #define FXAA_QUALITY_P10 4.0',\n ' #define FXAA_QUALITY_P11 8.0',\n '#endif',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - EXTREME QUALITY',\n '============================================================================*/',\n '#if (FXAA_QUALITY_PRESET == 39)',\n ' #define FXAA_QUALITY_PS 12',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.0',\n ' #define FXAA_QUALITY_P2 1.0',\n ' #define FXAA_QUALITY_P3 1.0',\n ' #define FXAA_QUALITY_P4 1.0',\n ' #define FXAA_QUALITY_P5 1.5',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 2.0',\n ' #define FXAA_QUALITY_P9 2.0',\n ' #define FXAA_QUALITY_P10 4.0',\n ' #define FXAA_QUALITY_P11 8.0',\n '#endif',\n '',\n '',\n '',\n '/*============================================================================',\n '',\n ' API PORTING',\n '',\n '============================================================================*/',\n '#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)',\n ' #define FxaaBool bool',\n ' #define FxaaDiscard discard',\n ' #define FxaaFloat float',\n ' #define FxaaFloat2 vec2',\n ' #define FxaaFloat3 vec3',\n ' #define FxaaFloat4 vec4',\n ' #define FxaaHalf float',\n ' #define FxaaHalf2 vec2',\n ' #define FxaaHalf3 vec3',\n ' #define FxaaHalf4 vec4',\n ' #define FxaaInt2 ivec2',\n ' #define FxaaSat(x) clamp(x, 0.0, 1.0)',\n ' #define FxaaTex sampler2D',\n '#else',\n ' #define FxaaBool bool',\n ' #define FxaaDiscard clip(-1)',\n ' #define FxaaFloat float',\n ' #define FxaaFloat2 float2',\n ' #define FxaaFloat3 float3',\n ' #define FxaaFloat4 float4',\n ' #define FxaaHalf half',\n ' #define FxaaHalf2 half2',\n ' #define FxaaHalf3 half3',\n ' #define FxaaHalf4 half4',\n ' #define FxaaSat(x) saturate(x)',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_GLSL_100 == 1)',\n ' #define FxaaTexTop(t, p) texture2D(t, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_GLSL_120 == 1)',\n ' // Requires,',\n ' // #version 120',\n ' // And at least,',\n ' // #extension GL_EXT_gpu_shader4 : enable',\n ' // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)',\n ' #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)',\n ' #if (FXAA_FAST_PIXEL_OFFSET == 1)',\n ' #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)',\n ' #else',\n ' #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)',\n ' #endif',\n ' #if (FXAA_GATHER4_ALPHA == 1)',\n ' // use #extension GL_ARB_gpu_shader5 : enable',\n ' #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)',\n ' #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)',\n ' #define FxaaTexGreen4(t, p) textureGather(t, p, 1)',\n ' #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)',\n ' #endif',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_GLSL_130 == 1)',\n ' // Requires \"#version 130\" or better',\n ' #define FxaaTexTop(t, p) textureLod(t, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)',\n ' #if (FXAA_GATHER4_ALPHA == 1)',\n ' // use #extension GL_ARB_gpu_shader5 : enable',\n ' #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)',\n ' #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)',\n ' #define FxaaTexGreen4(t, p) textureGather(t, p, 1)',\n ' #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)',\n ' #endif',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_HLSL_3 == 1)',\n ' #define FxaaInt2 float2',\n ' #define FxaaTex sampler2D',\n ' #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))',\n ' #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_HLSL_4 == 1)',\n ' #define FxaaInt2 int2',\n ' struct FxaaTex { SamplerState smpl; Texture2D tex; };',\n ' #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_HLSL_5 == 1)',\n ' #define FxaaInt2 int2',\n ' struct FxaaTex { SamplerState smpl; Texture2D tex; };',\n ' #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)',\n ' #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)',\n ' #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)',\n ' #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)',\n ' #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)',\n '#endif',\n '',\n '',\n '/*============================================================================',\n ' GREEN AS LUMA OPTION SUPPORT FUNCTION',\n '============================================================================*/',\n '#if (FXAA_GREEN_AS_LUMA == 0)',\n ' FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }',\n '#else',\n ' FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }',\n '#endif',\n '',\n '',\n '',\n '',\n '/*============================================================================',\n '',\n ' FXAA3 QUALITY - PC',\n '',\n '============================================================================*/',\n '#if (FXAA_PC == 1)',\n '/*--------------------------------------------------------------------------*/',\n 'FxaaFloat4 FxaaPixelShader(',\n ' //',\n ' // Use noperspective interpolation here (turn off perspective interpolation).',\n ' // {xy} = center of pixel',\n ' FxaaFloat2 pos,',\n ' //',\n ' // Used only for FXAA Console, and not used on the 360 version.',\n ' // Use noperspective interpolation here (turn off perspective interpolation).',\n ' // {xy_} = upper left of pixel',\n ' // {_zw} = lower right of pixel',\n ' FxaaFloat4 fxaaConsolePosPos,',\n ' //',\n ' // Input color texture.',\n ' // {rgb_} = color in linear or perceptual color space',\n ' // if (FXAA_GREEN_AS_LUMA == 0)',\n ' // {__a} = luma in perceptual color space (not linear)',\n ' FxaaTex tex,',\n ' //',\n ' // Only used on the optimized 360 version of FXAA Console.',\n ' // For everything but 360, just use the same input here as for \"tex\".',\n ' // For 360, same texture, just alias with a 2nd sampler.',\n ' // This sampler needs to have an exponent bias of -1.',\n ' FxaaTex fxaaConsole360TexExpBiasNegOne,',\n ' //',\n ' // Only used on the optimized 360 version of FXAA Console.',\n ' // For everything but 360, just use the same input here as for \"tex\".',\n ' // For 360, same texture, just alias with a 3nd sampler.',\n ' // This sampler needs to have an exponent bias of -2.',\n ' FxaaTex fxaaConsole360TexExpBiasNegTwo,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This must be from a constant/uniform.',\n ' // {x_} = 1.0/screenWidthInPixels',\n ' // {_y} = 1.0/screenHeightInPixels',\n ' FxaaFloat2 fxaaQualityRcpFrame,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This must be from a constant/uniform.',\n ' // This effects sub-pixel AA quality and inversely sharpness.',\n ' // Where N ranges between,',\n ' // N = 0.50 (default)',\n ' // N = 0.33 (sharper)',\n ' // {x__} = -N/screenWidthInPixels',\n ' // {_y_} = -N/screenHeightInPixels',\n ' // {_z_} = N/screenWidthInPixels',\n ' // {__w} = N/screenHeightInPixels',\n ' FxaaFloat4 fxaaConsoleRcpFrameOpt,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // Not used on 360, but used on PS3 and PC.',\n ' // This must be from a constant/uniform.',\n ' // {x__} = -2.0/screenWidthInPixels',\n ' // {_y_} = -2.0/screenHeightInPixels',\n ' // {_z_} = 2.0/screenWidthInPixels',\n ' // {__w} = 2.0/screenHeightInPixels',\n ' FxaaFloat4 fxaaConsoleRcpFrameOpt2,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.',\n ' // This must be from a constant/uniform.',\n ' // {x__} = 8.0/screenWidthInPixels',\n ' // {_y_} = 8.0/screenHeightInPixels',\n ' // {_z_} = -4.0/screenWidthInPixels',\n ' // {__w} = -4.0/screenHeightInPixels',\n ' FxaaFloat4 fxaaConsole360RcpFrameOpt2,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This used to be the FXAA_QUALITY_SUBPIX define.',\n ' // It is here now to allow easier tuning.',\n ' // Choose the amount of sub-pixel aliasing removal.',\n ' // This can effect sharpness.',\n ' // 1.00 - upper limit (softer)',\n ' // 0.75 - default amount of filtering',\n ' // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)',\n ' // 0.25 - almost off',\n ' // 0.00 - completely off',\n ' FxaaFloat fxaaQualitySubpix,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.',\n ' // It is here now to allow easier tuning.',\n ' // The minimum amount of local contrast required to apply algorithm.',\n ' // 0.333 - too little (faster)',\n ' // 0.250 - low quality',\n ' // 0.166 - default',\n ' // 0.125 - high quality',\n ' // 0.063 - overkill (slower)',\n ' FxaaFloat fxaaQualityEdgeThreshold,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.',\n ' // It is here now to allow easier tuning.',\n ' // Trims the algorithm from processing darks.',\n ' // 0.0833 - upper limit (default, the start of visible unfiltered edges)',\n ' // 0.0625 - high quality (faster)',\n ' // 0.0312 - visible limit (slower)',\n ' // Special notes when using FXAA_GREEN_AS_LUMA,',\n ' // Likely want to set this to zero.',\n ' // As colors that are mostly not-green',\n ' // will appear very dark in the green channel!',\n ' // Tune by looking at mostly non-green content,',\n ' // then start at zero and increase until aliasing is a problem.',\n ' FxaaFloat fxaaQualityEdgeThresholdMin,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.',\n ' // It is here now to allow easier tuning.',\n ' // This does not effect PS3, as this needs to be compiled in.',\n ' // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.',\n ' // Due to the PS3 being ALU bound,',\n ' // there are only three safe values here: 2 and 4 and 8.',\n ' // These options use the shaders ability to a free *|/ by 2|4|8.',\n ' // For all other platforms can be a non-power of two.',\n ' // 8.0 is sharper (default!!!)',\n ' // 4.0 is softer',\n ' // 2.0 is really soft (good only for vector graphics inputs)',\n ' FxaaFloat fxaaConsoleEdgeSharpness,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.',\n ' // It is here now to allow easier tuning.',\n ' // This does not effect PS3, as this needs to be compiled in.',\n ' // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.',\n ' // Due to the PS3 being ALU bound,',\n ' // there are only two safe values here: 1/4 and 1/8.',\n ' // These options use the shaders ability to a free *|/ by 2|4|8.',\n ' // The console setting has a different mapping than the quality setting.',\n ' // Other platforms can use other values.',\n ' // 0.125 leaves less aliasing, but is softer (default!!!)',\n ' // 0.25 leaves more aliasing, and is sharper',\n ' FxaaFloat fxaaConsoleEdgeThreshold,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.',\n ' // It is here now to allow easier tuning.',\n ' // Trims the algorithm from processing darks.',\n ' // The console setting has a different mapping than the quality setting.',\n ' // This only applies when FXAA_EARLY_EXIT is 1.',\n ' // This does not apply to PS3,',\n ' // PS3 was simplified to avoid more shader instructions.',\n ' // 0.06 - faster but more aliasing in darks',\n ' // 0.05 - default',\n ' // 0.04 - slower and less aliasing in darks',\n ' // Special notes when using FXAA_GREEN_AS_LUMA,',\n ' // Likely want to set this to zero.',\n ' // As colors that are mostly not-green',\n ' // will appear very dark in the green channel!',\n ' // Tune by looking at mostly non-green content,',\n ' // then start at zero and increase until aliasing is a problem.',\n ' FxaaFloat fxaaConsoleEdgeThresholdMin,',\n ' //',\n ' // Extra constants for 360 FXAA Console only.',\n ' // Use zeros or anything else for other platforms.',\n ' // These must be in physical constant registers and NOT immediates.',\n ' // Immediates will result in compiler un-optimizing.',\n ' // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)',\n ' FxaaFloat4 fxaaConsole360ConstDir',\n ') {',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat2 posM;',\n ' posM.x = pos.x;',\n ' posM.y = pos.y;',\n ' #if (FXAA_GATHER4_ALPHA == 1)',\n ' #if (FXAA_DISCARD == 0)',\n ' FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);',\n ' #if (FXAA_GREEN_AS_LUMA == 0)',\n ' #define lumaM rgbyM.w',\n ' #else',\n ' #define lumaM rgbyM.y',\n ' #endif',\n ' #endif',\n ' #if (FXAA_GREEN_AS_LUMA == 0)',\n ' FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);',\n ' FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));',\n ' #else',\n ' FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);',\n ' FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));',\n ' #endif',\n ' #if (FXAA_DISCARD == 1)',\n ' #define lumaM luma4A.w',\n ' #endif',\n ' #define lumaE luma4A.z',\n ' #define lumaS luma4A.x',\n ' #define lumaSE luma4A.y',\n ' #define lumaNW luma4B.w',\n ' #define lumaN luma4B.z',\n ' #define lumaW luma4B.x',\n ' #else',\n ' FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);',\n ' #if (FXAA_GREEN_AS_LUMA == 0)',\n ' #define lumaM rgbyM.w',\n ' #else',\n ' #define lumaM rgbyM.y',\n ' #endif',\n ' #if (FXAA_GLSL_100 == 1)',\n ' FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));',\n ' #else',\n ' FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));',\n ' #endif',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat maxSM = max(lumaS, lumaM);',\n ' FxaaFloat minSM = min(lumaS, lumaM);',\n ' FxaaFloat maxESM = max(lumaE, maxSM);',\n ' FxaaFloat minESM = min(lumaE, minSM);',\n ' FxaaFloat maxWN = max(lumaN, lumaW);',\n ' FxaaFloat minWN = min(lumaN, lumaW);',\n ' FxaaFloat rangeMax = max(maxWN, maxESM);',\n ' FxaaFloat rangeMin = min(minWN, minESM);',\n ' FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;',\n ' FxaaFloat range = rangeMax - rangeMin;',\n ' FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);',\n ' FxaaBool earlyExit = range < rangeMaxClamped;',\n '/*--------------------------------------------------------------------------*/',\n ' if(earlyExit)',\n ' #if (FXAA_DISCARD == 1)',\n ' FxaaDiscard;',\n ' #else',\n ' return rgbyM;',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_GATHER4_ALPHA == 0)',\n ' #if (FXAA_GLSL_100 == 1)',\n ' FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));',\n ' #else',\n ' FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));',\n ' #endif',\n ' #else',\n ' FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat lumaNS = lumaN + lumaS;',\n ' FxaaFloat lumaWE = lumaW + lumaE;',\n ' FxaaFloat subpixRcpRange = 1.0/range;',\n ' FxaaFloat subpixNSWE = lumaNS + lumaWE;',\n ' FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;',\n ' FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat lumaNESE = lumaNE + lumaSE;',\n ' FxaaFloat lumaNWNE = lumaNW + lumaNE;',\n ' FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;',\n ' FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat lumaNWSW = lumaNW + lumaSW;',\n ' FxaaFloat lumaSWSE = lumaSW + lumaSE;',\n ' FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);',\n ' FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);',\n ' FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;',\n ' FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;',\n ' FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;',\n ' FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;',\n ' FxaaFloat lengthSign = fxaaQualityRcpFrame.x;',\n ' FxaaBool horzSpan = edgeHorz >= edgeVert;',\n ' FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;',\n '/*--------------------------------------------------------------------------*/',\n ' if(!horzSpan) lumaN = lumaW;',\n ' if(!horzSpan) lumaS = lumaE;',\n ' if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;',\n ' FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat gradientN = lumaN - lumaM;',\n ' FxaaFloat gradientS = lumaS - lumaM;',\n ' FxaaFloat lumaNN = lumaN + lumaM;',\n ' FxaaFloat lumaSS = lumaS + lumaM;',\n ' FxaaBool pairN = abs(gradientN) >= abs(gradientS);',\n ' FxaaFloat gradient = max(abs(gradientN), abs(gradientS));',\n ' if(pairN) lengthSign = -lengthSign;',\n ' FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat2 posB;',\n ' posB.x = posM.x;',\n ' posB.y = posM.y;',\n ' FxaaFloat2 offNP;',\n ' offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;',\n ' offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;',\n ' if(!horzSpan) posB.x += lengthSign * 0.5;',\n ' if( horzSpan) posB.y += lengthSign * 0.5;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat2 posN;',\n ' posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;',\n ' posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;',\n ' FxaaFloat2 posP;',\n ' posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;',\n ' posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;',\n ' FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;',\n ' FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));',\n ' FxaaFloat subpixE = subpixC * subpixC;',\n ' FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));',\n '/*--------------------------------------------------------------------------*/',\n ' if(!pairN) lumaNN = lumaSS;',\n ' FxaaFloat gradientScaled = gradient * 1.0/4.0;',\n ' FxaaFloat lumaMM = lumaM - lumaNN * 0.5;',\n ' FxaaFloat subpixF = subpixD * subpixE;',\n ' FxaaBool lumaMLTZero = lumaMM < 0.0;',\n '/*--------------------------------------------------------------------------*/',\n ' lumaEndN -= lumaNN * 0.5;',\n ' lumaEndP -= lumaNN * 0.5;',\n ' FxaaBool doneN = abs(lumaEndN) >= gradientScaled;',\n ' FxaaBool doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;',\n ' FxaaBool doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;',\n '/*--------------------------------------------------------------------------*/',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 3)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 4)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 5)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 6)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 7)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 8)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 9)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 10)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 11)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 12)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat dstN = posM.x - posN.x;',\n ' FxaaFloat dstP = posP.x - posM.x;',\n ' if(!horzSpan) dstN = posM.y - posN.y;',\n ' if(!horzSpan) dstP = posP.y - posM.y;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;',\n ' FxaaFloat spanLength = (dstP + dstN);',\n ' FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;',\n ' FxaaFloat spanLengthRcp = 1.0/spanLength;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaBool directionN = dstN < dstP;',\n ' FxaaFloat dst = min(dstN, dstP);',\n ' FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;',\n ' FxaaFloat subpixG = subpixF * subpixF;',\n ' FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;',\n ' FxaaFloat subpixH = subpixG * fxaaQualitySubpix;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;',\n ' FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);',\n ' if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;',\n ' if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;',\n ' #if (FXAA_DISCARD == 1)',\n ' return FxaaTexTop(tex, posM);',\n ' #else',\n ' return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);',\n ' #endif',\n '}',\n '/*==========================================================================*/',\n '#endif',\n '',\n 'void main() {',\n ' gl_FragColor = FxaaPixelShader(',\n ' vUv,',\n ' vec4(0.0),',\n ' tDiffuse,',\n ' tDiffuse,',\n ' tDiffuse,',\n ' resolution,',\n ' vec4(0.0),',\n ' vec4(0.0),',\n ' vec4(0.0),',\n ' 0.75,',\n ' 0.166,',\n ' 0.0833,',\n ' 0.0,',\n ' 0.0,',\n ' 0.0,',\n ' vec4(0.0)',\n ' );',\n '',\n ' // TODO avoid querying texture twice for same texel',\n ' gl_FragColor.a = texture2D(tDiffuse, vUv).a;',\n '}',\n ].join('\\n'),\n}\n", "/**\n * Focus shader\n * based on PaintEffect postprocess from ro.me\n * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js\n */\n\nexport const FocusShader = {\n uniforms: {\n tDiffuse: { value: null },\n screenWidth: { value: 1024 },\n screenHeight: { value: 1024 },\n sampleDistance: { value: 0.94 },\n waveFactor: { value: 0.00125 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float screenWidth;',\n 'uniform float screenHeight;',\n 'uniform float sampleDistance;',\n 'uniform float waveFactor;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 color, org, tmp, add;',\n '\tfloat sample_dist, f;',\n '\tvec2 vin;',\n '\tvec2 uv = vUv;',\n\n '\tadd = color = org = texture2D( tDiffuse, uv );',\n\n '\tvin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );',\n '\tsample_dist = dot( vin, vin ) * 2.0;',\n\n '\tf = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;',\n\n '\tvec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tcolor = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );',\n '\tcolor = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );',\n\n '\tgl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Edge Detection Shader using Frei-Chen filter\n * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector\n *\n * aspect: vec2 of (1/width, 1/height)\n */\n\nexport const FreiChenShader = {\n uniforms: {\n tDiffuse: { value: null },\n aspect: { value: new Vector2(512, 512) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'varying vec2 vUv;',\n\n 'uniform vec2 aspect;',\n\n 'vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);',\n\n 'mat3 G[9];',\n\n // hard coded matrix values!!!! as suggested in https://github.com/neilmendoza/ofxPostProcessing/blob/master/src/EdgePass.cpp#L45\n\n 'const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );',\n 'const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );',\n 'const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );',\n 'const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );',\n 'const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );',\n 'const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );',\n 'const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );',\n 'const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );',\n 'const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );',\n\n 'void main(void)',\n '{',\n\n '\tG[0] = g0,',\n '\tG[1] = g1,',\n '\tG[2] = g2,',\n '\tG[3] = g3,',\n '\tG[4] = g4,',\n '\tG[5] = g5,',\n '\tG[6] = g6,',\n '\tG[7] = g7,',\n '\tG[8] = g8;',\n\n '\tmat3 I;',\n '\tfloat cnv[9];',\n '\tvec3 sample;',\n\n /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */\n '\tfor (float i=0.0; i<3.0; i++) {',\n '\t\tfor (float j=0.0; j<3.0; j++) {',\n '\t\t\tsample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;',\n '\t\t\tI[int(i)][int(j)] = length(sample);',\n '\t\t}',\n '\t}',\n\n /* calculate the convolution values for all the masks */\n '\tfor (int i=0; i<9; i++) {',\n '\t\tfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);',\n '\t\tcnv[i] = dp3 * dp3;',\n '\t}',\n\n '\tfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);',\n '\tfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);',\n\n '\tgl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);',\n '}',\n ].join('\\n'),\n}\n", "/**\n * Based on Nvidia Cg tutorial\n */\n\nexport const FresnelShader = {\n uniforms: {\n mRefractionRatio: { value: 1.02 },\n mFresnelBias: { value: 0.1 },\n mFresnelPower: { value: 2.0 },\n mFresnelScale: { value: 1.0 },\n tCube: { value: null },\n },\n\n vertexShader: [\n 'uniform float mRefractionRatio;',\n 'uniform float mFresnelBias;',\n 'uniform float mFresnelScale;',\n 'uniform float mFresnelPower;',\n\n 'varying vec3 vReflect;',\n 'varying vec3 vRefract[3];',\n 'varying float vReflectionFactor;',\n\n 'void main() {',\n\n '\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n '\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n\n '\tvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );',\n\n '\tvec3 I = worldPosition.xyz - cameraPosition;',\n\n '\tvReflect = reflect( I, worldNormal );',\n '\tvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );',\n '\tvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );',\n '\tvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );',\n '\tvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );',\n\n '\tgl_Position = projectionMatrix * mvPosition;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform samplerCube tCube;',\n\n 'varying vec3 vReflect;',\n 'varying vec3 vRefract[3];',\n 'varying float vReflectionFactor;',\n\n 'void main() {',\n\n '\tvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );',\n '\tvec4 refractedColor = vec4( 1.0 );',\n\n '\trefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;',\n '\trefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;',\n '\trefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;',\n\n '\tgl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Gamma Correction Shader\n * http://en.wikipedia.org/wiki/gamma_correction\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type GammaCorrectionShaderUniforms = {\n tDiffuse: IUniform\n}\n\nexport interface IGammaCorrectionShader extends IShader {}\n\nexport const GammaCorrectionShader: IGammaCorrectionShader = {\n uniforms: {\n tDiffuse: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 tex = texture2D( tDiffuse, vUv );',\n\n '\tgl_FragColor = LinearTosRGB( tex );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color, Vector3 } from 'three'\n\n/**\n * God-rays (crepuscular rays)\n *\n * Similar implementation to the one used by Crytek for CryEngine 2 [Sousa2008].\n * Blurs a mask generated from the depth map along radial lines emanating from the light\n * source. The blur repeatedly applies a blur filter of increasing support but constant\n * sample count to produce a blur filter with large support.\n *\n * My implementation performs 3 passes, similar to the implementation from Sousa. I found\n * just 6 samples per pass produced acceptible results. The blur is applied three times,\n * with decreasing filter support. The result is equivalent to a single pass with\n * 6*6*6 = 216 samples.\n *\n * References:\n *\n * Sousa2008 - Crysis Next Gen Effects, GDC2008, http://www.crytek.com/sites/default/files/GDC08_SousaT_CrysisEffects.ppt\n */\n\nexport const GodRaysDepthMaskShader = {\n uniforms: {\n tInput: {\n value: null,\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n ' vUv = uv;',\n ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tInput;',\n\n 'void main() {',\n\n '\tgl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv );',\n\n '}',\n ].join('\\n'),\n}\n\n/**\n * The god-ray generation shader.\n *\n * First pass:\n *\n * The depth map is blurred along radial lines towards the \"sun\". The\n * output is written to a temporary render target (I used a 1/4 sized\n * target).\n *\n * Pass two & three:\n *\n * The results of the previous pass are re-blurred, each time with a\n * decreased distance between samples.\n */\n\nexport const GodRaysGenerateShader = {\n uniforms: {\n tInput: {\n value: null,\n },\n fStepSize: {\n value: 1.0,\n },\n vSunPositionScreenSpace: {\n value: new Vector3(),\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n ' vUv = uv;',\n ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define TAPS_PER_PASS 6.0',\n\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tInput;',\n\n 'uniform vec3 vSunPositionScreenSpace;',\n 'uniform float fStepSize;', // filter step size\n\n 'void main() {',\n\n // delta from current pixel to \"sun\" position\n\n '\tvec2 delta = vSunPositionScreenSpace.xy - vUv;',\n '\tfloat dist = length( delta );',\n\n // Step vector (uv space)\n\n '\tvec2 stepv = fStepSize * delta / dist;',\n\n // Number of iterations between pixel and sun\n\n '\tfloat iters = dist/fStepSize;',\n\n '\tvec2 uv = vUv.xy;',\n '\tfloat col = 0.0;',\n\n // This breaks ANGLE in Chrome 22\n //\t- see http://code.google.com/p/chromium/issues/detail?id=153105\n\n /*\n\t\t// Unrolling didnt do much on my hardware (ATI Mobility Radeon 3450),\n\t\t// so i've just left the loop\n\n\t\t\"for ( float i = 0.0; i < TAPS_PER_PASS; i += 1.0 ) {\",\n\n\t\t// Accumulate samples, making sure we dont walk past the light source.\n\n\t\t// The check for uv.y < 1 would not be necessary with \"border\" UV wrap\n\t\t// mode, with a black border color. I don't think this is currently\n\t\t// exposed by three.js. As a result there might be artifacts when the\n\t\t// sun is to the left, right or bottom of screen as these cases are\n\t\t// not specifically handled.\n\n\t\t\"\tcol += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );\",\n\t\t\"\tuv += stepv;\",\n\n\t\t\"}\",\n\t\t*/\n\n // Unrolling loop manually makes it work in ANGLE\n\n '\tfloat f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) );', // used to fade out godrays\n\n '\tif ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n // Should technically be dividing by 'iters', but 'TAPS_PER_PASS' smooths out\n // objectionable artifacts, in particular near the sun position. The side\n // effect is that the result is darker than it should be around the sun, as\n // TAPS_PER_PASS is greater than the number of samples actually accumulated.\n // When the result is inverted (in the shader 'godrays_combine', this produces\n // a slight bright spot at the position of the sun, even when it is occluded.\n\n '\tgl_FragColor = vec4( col/TAPS_PER_PASS );',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n\n/**\n * Additively applies god rays from texture tGodRays to a background (tColors).\n * fGodRayIntensity attenuates the god rays.\n */\n\nexport const GodRaysCombineShader = {\n uniforms: {\n tColors: {\n value: null,\n },\n\n tGodRays: {\n value: null,\n },\n\n fGodRayIntensity: {\n value: 0.69,\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tColors;',\n 'uniform sampler2D tGodRays;',\n\n 'uniform float fGodRayIntensity;',\n\n 'void main() {',\n\n // Since THREE.MeshDepthMaterial renders foreground objects white and background\n // objects black, the god-rays will be white streaks. Therefore value is inverted\n // before being combined with tColors\n\n '\tgl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r );',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n\n/**\n * A dodgy sun/sky shader. Makes a bright spot at the sun location. Would be\n * cheaper/faster/simpler to implement this as a simple sun sprite.\n */\n\nexport const GodRaysFakeSunShader = {\n uniforms: {\n vSunPositionScreenSpace: {\n value: new Vector3(),\n },\n\n fAspect: {\n value: 1.0,\n },\n\n sunColor: {\n value: new Color(0xffee00),\n },\n\n bgColor: {\n value: new Color(0x000000),\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'varying vec2 vUv;',\n\n 'uniform vec3 vSunPositionScreenSpace;',\n 'uniform float fAspect;',\n\n 'uniform vec3 sunColor;',\n 'uniform vec3 bgColor;',\n\n 'void main() {',\n\n '\tvec2 diff = vUv - vSunPositionScreenSpace.xy;',\n\n // Correct for aspect ratio\n\n '\tdiff.x *= fAspect;',\n\n '\tfloat prop = clamp( length( diff ) / 0.5, 0.0, 1.0 );',\n '\tprop = 0.35 * pow( 1.0 - prop, 3.0 );',\n\n '\tgl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor;',\n '\tgl_FragColor.w = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Two pass Gaussian blur filter (horizontal and vertical blur shaders)\n * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/\n * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type HorizontalBlurShaderUniforms = {\n tDiffuse: IUniform\n h: IUniform\n}\n\nexport interface IHorizontalBlurShader extends IShader {}\n\nexport const HorizontalBlurShader: IHorizontalBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n h: { value: 1.0 / 512.0 },\n },\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n fragmentShader: /* glsl */ `\n uniform sampler2D tDiffuse;\n uniform float h;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec4 sum = vec4( 0.0 );\n\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n \tgl_FragColor = sum;\n\n }\n `,\n}\n", "/**\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nexport const HorizontalTiltShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n h: { value: 1.0 / 512.0 },\n r: { value: 0.35 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float h;',\n 'uniform float r;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 sum = vec4( 0.0 );',\n\n '\tfloat hh = h * abs( r - vUv.y );',\n\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;',\n\n '\tgl_FragColor = sum;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Hue and saturation adjustment\n * https://github.com/evanw/glfx.js\n * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc.\n * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)\n */\n\nexport const HueSaturationShader = {\n uniforms: {\n tDiffuse: { value: null },\n hue: { value: 0 },\n saturation: { value: 0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float hue;',\n 'uniform float saturation;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tgl_FragColor = texture2D( tDiffuse, vUv );',\n\n // hue\n '\tfloat angle = hue * 3.14159265;',\n '\tfloat s = sin(angle), c = cos(angle);',\n '\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;',\n '\tfloat len = length(gl_FragColor.rgb);',\n '\tgl_FragColor.rgb = vec3(',\n '\t\tdot(gl_FragColor.rgb, weights.xyz),',\n '\t\tdot(gl_FragColor.rgb, weights.zxy),',\n '\t\tdot(gl_FragColor.rgb, weights.yzx)',\n '\t);',\n\n // saturation\n '\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;',\n '\tif (saturation > 0.0) {',\n '\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));',\n '\t} else {',\n '\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);',\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Kaleidoscope Shader\n * Radial reflection around center point\n * Ported from: http://pixelshaders.com/editor/\n * by Toby Schachman / http://tobyschachman.com/\n *\n * sides: number of reflections\n * angle: initial angle in radians\n */\n\nexport const KaleidoShader = {\n uniforms: {\n tDiffuse: { value: null },\n sides: { value: 6.0 },\n angle: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float sides;',\n 'uniform float angle;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 p = vUv - 0.5;',\n '\tfloat r = length(p);',\n '\tfloat a = atan(p.y, p.x) + angle;',\n '\tfloat tau = 2. * 3.1416 ;',\n '\ta = mod(a, tau/sides);',\n '\ta = abs(a - tau/sides/2.) ;',\n '\tp = r * vec2(cos(a), sin(a));',\n '\tvec4 color = texture2D(tDiffuse, p + 0.5);',\n '\tgl_FragColor = color;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Mirror Shader\n * Copies half the input to the other half\n *\n * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom)\n */\n\nexport const MirrorShader = {\n uniforms: {\n tDiffuse: { value: null },\n side: { value: 1 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform int side;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 p = vUv;',\n '\tif (side == 0){',\n '\t\tif (p.x > 0.5) p.x = 1.0 - p.x;',\n '\t}else if (side == 1){',\n '\t\tif (p.x < 0.5) p.x = 1.0 - p.x;',\n '\t}else if (side == 2){',\n '\t\tif (p.y < 0.5) p.y = 1.0 - p.y;',\n '\t}else if (side == 3){',\n '\t\tif (p.y > 0.5) p.y = 1.0 - p.y;',\n '\t} ',\n '\tvec4 color = texture2D(tDiffuse, p);',\n '\tgl_FragColor = color;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Normal map shader\n * - compute normals from heightmap\n */\n\nexport const NormalMapShader = {\n uniforms: {\n heightMap: { value: null },\n resolution: { value: new Vector2(512, 512) },\n scale: { value: new Vector2(1, 1) },\n height: { value: 0.05 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float height;',\n 'uniform vec2 resolution;',\n 'uniform sampler2D heightMap;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tfloat val = texture2D( heightMap, vUv ).x;',\n\n '\tfloat valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;',\n '\tfloat valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;',\n\n '\tgl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "// Parallax Occlusion shaders from\n// http://sunandblackcat.com/tipFullView.php?topicid=28\n// No tangent-space transforms logic based on\n// http://mmikkelsen3d.blogspot.sk/2012/02/parallaxpoc-mapping-and-no-tangent.html\n\nexport const ParallaxShader = {\n // Ordered from fastest to best quality.\n modes: {\n none: 'NO_PARALLAX',\n basic: 'USE_BASIC_PARALLAX',\n steep: 'USE_STEEP_PARALLAX',\n occlusion: 'USE_OCLUSION_PARALLAX', // a.k.a. POM\n relief: 'USE_RELIEF_PARALLAX',\n },\n\n uniforms: {\n bumpMap: { value: null },\n map: { value: null },\n parallaxScale: { value: null },\n parallaxMinLayers: { value: null },\n parallaxMaxLayers: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n 'varying vec3 vViewPosition;',\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n '\tvViewPosition = -mvPosition.xyz;',\n '\tvNormal = normalize( normalMatrix * normal );',\n '\tgl_Position = projectionMatrix * mvPosition;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D bumpMap;',\n 'uniform sampler2D map;',\n\n 'uniform float parallaxScale;',\n 'uniform float parallaxMinLayers;',\n 'uniform float parallaxMaxLayers;',\n\n 'varying vec2 vUv;',\n 'varying vec3 vViewPosition;',\n 'varying vec3 vNormal;',\n\n '#ifdef USE_BASIC_PARALLAX',\n\n '\tvec2 parallaxMap( in vec3 V ) {',\n\n '\t\tfloat initialHeight = texture2D( bumpMap, vUv ).r;',\n\n // No Offset Limitting: messy, floating output at grazing angles.\n //\"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;\",\n\n // Offset Limiting\n '\t\tvec2 texCoordOffset = parallaxScale * V.xy * initialHeight;',\n '\t\treturn vUv - texCoordOffset;',\n\n '\t}',\n\n '#else',\n\n '\tvec2 parallaxMap( in vec3 V ) {',\n\n // Determine number of layers from angle between V and N\n '\t\tfloat numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );',\n\n '\t\tfloat layerHeight = 1.0 / numLayers;',\n '\t\tfloat currentLayerHeight = 0.0;',\n // Shift of texture coordinates for each iteration\n '\t\tvec2 dtex = parallaxScale * V.xy / V.z / numLayers;',\n\n '\t\tvec2 currentTextureCoords = vUv;',\n\n '\t\tfloat heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;',\n\n // while ( heightFromTexture > currentLayerHeight )\n // Infinite loops are not well supported. Do a \"large\" finite\n // loop, but not too large, as it slows down some compilers.\n '\t\tfor ( int i = 0; i < 30; i += 1 ) {',\n '\t\t\tif ( heightFromTexture <= currentLayerHeight ) {',\n '\t\t\t\tbreak;',\n '\t\t\t}',\n '\t\t\tcurrentLayerHeight += layerHeight;',\n // Shift texture coordinates along vector V\n '\t\t\tcurrentTextureCoords -= dtex;',\n '\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;',\n '\t\t}',\n\n '\t\t#ifdef USE_STEEP_PARALLAX',\n\n '\t\t\treturn currentTextureCoords;',\n\n '\t\t#elif defined( USE_RELIEF_PARALLAX )',\n\n '\t\t\tvec2 deltaTexCoord = dtex / 2.0;',\n '\t\t\tfloat deltaHeight = layerHeight / 2.0;',\n\n // Return to the mid point of previous layer\n '\t\t\tcurrentTextureCoords += deltaTexCoord;',\n '\t\t\tcurrentLayerHeight -= deltaHeight;',\n\n // Binary search to increase precision of Steep Parallax Mapping\n '\t\t\tconst int numSearches = 5;',\n '\t\t\tfor ( int i = 0; i < numSearches; i += 1 ) {',\n\n '\t\t\t\tdeltaTexCoord /= 2.0;',\n '\t\t\t\tdeltaHeight /= 2.0;',\n '\t\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;',\n // Shift along or against vector V\n '\t\t\t\tif( heightFromTexture > currentLayerHeight ) {', // Below the surface\n\n '\t\t\t\t\tcurrentTextureCoords -= deltaTexCoord;',\n '\t\t\t\t\tcurrentLayerHeight += deltaHeight;',\n\n '\t\t\t\t} else {', // above the surface\n\n '\t\t\t\t\tcurrentTextureCoords += deltaTexCoord;',\n '\t\t\t\t\tcurrentLayerHeight -= deltaHeight;',\n\n '\t\t\t\t}',\n\n '\t\t\t}',\n '\t\t\treturn currentTextureCoords;',\n\n '\t\t#elif defined( USE_OCLUSION_PARALLAX )',\n\n '\t\t\tvec2 prevTCoords = currentTextureCoords + dtex;',\n\n // Heights for linear interpolation\n '\t\t\tfloat nextH = heightFromTexture - currentLayerHeight;',\n '\t\t\tfloat prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;',\n\n // Proportions for linear interpolation\n '\t\t\tfloat weight = nextH / ( nextH - prevH );',\n\n // Interpolation of texture coordinates\n '\t\t\treturn prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );',\n\n '\t\t#else', // NO_PARALLAX\n\n '\t\t\treturn vUv;',\n\n '\t\t#endif',\n\n '\t}',\n '#endif',\n\n 'vec2 perturbUv( vec3 surfPosition, vec3 surfNormal, vec3 viewPosition ) {',\n\n '\tvec2 texDx = dFdx( vUv );',\n '\tvec2 texDy = dFdy( vUv );',\n\n '\tvec3 vSigmaX = dFdx( surfPosition );',\n '\tvec3 vSigmaY = dFdy( surfPosition );',\n '\tvec3 vR1 = cross( vSigmaY, surfNormal );',\n '\tvec3 vR2 = cross( surfNormal, vSigmaX );',\n '\tfloat fDet = dot( vSigmaX, vR1 );',\n\n '\tvec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );',\n '\tvec3 vProjVtex;',\n '\tvProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;',\n '\tvProjVtex.z = dot( surfNormal, viewPosition );',\n\n '\treturn parallaxMap( vProjVtex );',\n '}',\n\n 'void main() {',\n\n '\tvec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );',\n '\tgl_FragColor = texture2D( map, mapUv );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Pixelation shader\n */\n\nexport const PixelShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: null },\n pixelSize: { value: 1 },\n },\n\n vertexShader: [\n 'varying highp vec2 vUv;',\n\n 'void main() {',\n\n 'vUv = uv;',\n 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float pixelSize;',\n 'uniform vec2 resolution;',\n\n 'varying highp vec2 vUv;',\n\n 'void main(){',\n\n 'vec2 dxy = pixelSize / resolution;',\n 'vec2 coord = dxy * floor( vUv / dxy );',\n 'gl_FragColor = texture2D(tDiffuse, coord);',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * RGB Shift Shader\n * Shifts red and blue channels from center in opposite directions\n * Ported from http://kriss.cx/tom/2009/05/rgb-shift/\n * by Tom Butterworth / http://kriss.cx/tom/\n *\n * amount: shift distance (1 is width of input)\n * angle: shift angle in radians\n */\n\nexport const RGBShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 0.005 },\n angle: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float amount;',\n 'uniform float angle;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 offset = amount * vec2( cos(angle), sin(angle));',\n '\tvec4 cr = texture2D(tDiffuse, vUv + offset);',\n '\tvec4 cga = texture2D(tDiffuse, vUv);',\n '\tvec4 cb = texture2D(tDiffuse, vUv - offset);',\n '\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Sepia tone shader\n * based on glfx.js sepia shader\n * https://github.com/evanw/glfx.js\n */\n\nexport const SepiaShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float amount;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 color = texture2D( tDiffuse, vUv );',\n '\tvec3 c = color.rgb;',\n\n '\tcolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );',\n '\tcolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );',\n '\tcolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );',\n\n '\tgl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Sobel Edge Detection (see https://youtu.be/uihBwtPIBxM)\n *\n * As mentioned in the video the Sobel operator expects a grayscale image as input.\n *\n */\n\nexport const SobelOperatorShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2() },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform vec2 resolution;',\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );',\n\n // kernel definition (in glsl matrices are filled in column-major order)\n\n '\tconst mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );', // x direction kernel\n '\tconst mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );', // y direction kernel\n\n // fetch the 3x3 neighbourhood of a fragment\n\n // first column\n\n '\tfloat tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;',\n '\tfloat tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;',\n '\tfloat tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;',\n\n // second column\n\n '\tfloat tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;',\n '\tfloat tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;',\n '\tfloat tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;',\n\n // third column\n\n '\tfloat tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;',\n '\tfloat tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;',\n '\tfloat tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;',\n\n // gradient value in x direction\n\n '\tfloat valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ',\n '\t\tGx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ',\n '\t\tGx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ',\n\n // gradient value in y direction\n\n '\tfloat valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ',\n '\t\tGy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ',\n '\t\tGy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ',\n\n // magnitute of the total gradient\n\n '\tfloat G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );',\n\n '\tgl_FragColor = vec4( vec3( G ), 1 );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Technicolor Shader\n * Simulates the look of the two-strip technicolor process popular in early 20th century films.\n * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm\n * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html\n */\n\nexport const TechnicolorShader = {\n uniforms: {\n tDiffuse: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );',\n '\tvec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);',\n\n '\tgl_FragColor = newTex;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color, Vector3 } from 'three'\n\n/**\n * Currently contains:\n *\n *\ttoon1\n *\ttoon2\n *\thatching\n *\tdotted\n */\n\nexport const ToonShader1 = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xffffff) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n 'varying vec3 vRefract;',\n\n 'void main() {',\n\n '\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n '\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n '\tvec3 worldNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );',\n\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '\tvec3 I = worldPosition.xyz - cameraPosition;',\n '\tvRefract = refract( normalize( I ), worldNormal, 1.02 );',\n\n '\tgl_Position = projectionMatrix * mvPosition;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'varying vec3 vRefract;',\n\n 'void main() {',\n\n '\tfloat directionalLightWeighting = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);',\n '\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;',\n\n '\tfloat intensity = smoothstep( - 0.5, 1.0, pow( length(lightWeighting), 20.0 ) );',\n '\tintensity += length(lightWeighting) * 0.2;',\n\n '\tfloat cameraWeighting = dot( normalize( vNormal ), vRefract );',\n '\tintensity += pow( 1.0 - length( cameraWeighting ), 6.0 );',\n '\tintensity = intensity * 0.2 + 0.3;',\n\n '\tif ( intensity < 0.50 ) {',\n\n '\t\tgl_FragColor = vec4( 2.0 * intensity * uBaseColor, 1.0 );',\n\n '\t} else {',\n\n '\t\tgl_FragColor = vec4( 1.0 - 2.0 * ( 1.0 - intensity ) * ( 1.0 - uBaseColor ), 1.0 );',\n\n '}',\n\n '}',\n ].join('\\n'),\n}\n\nexport const ToonShader2 = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xeeeeee) },\n uLineColor1: { value: new Color(0x808080) },\n uLineColor2: { value: new Color(0x000000) },\n uLineColor3: { value: new Color(0x000000) },\n uLineColor4: { value: new Color(0x000000) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n 'uniform vec3 uLineColor1;',\n 'uniform vec3 uLineColor2;',\n 'uniform vec3 uLineColor3;',\n 'uniform vec3 uLineColor4;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tfloat camera = max( dot( normalize( vNormal ), vec3( 0.0, 0.0, 1.0 ) ), 0.4);',\n '\tfloat light = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);',\n\n '\tgl_FragColor = vec4( uBaseColor, 1.0 );',\n\n '\tif ( length(uAmbientLightColor + uDirLightColor * light) < 1.00 ) {',\n\n '\t\tgl_FragColor *= vec4( uLineColor1, 1.0 );',\n\n '\t}',\n\n '\tif ( length(uAmbientLightColor + uDirLightColor * camera) < 0.50 ) {',\n\n '\t\tgl_FragColor *= vec4( uLineColor2, 1.0 );',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n\nexport const ToonShaderHatching = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xffffff) },\n uLineColor1: { value: new Color(0x000000) },\n uLineColor2: { value: new Color(0x000000) },\n uLineColor3: { value: new Color(0x000000) },\n uLineColor4: { value: new Color(0x000000) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n 'uniform vec3 uLineColor1;',\n 'uniform vec3 uLineColor2;',\n 'uniform vec3 uLineColor3;',\n 'uniform vec3 uLineColor4;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tfloat directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);',\n '\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;',\n\n '\tgl_FragColor = vec4( uBaseColor, 1.0 );',\n\n '\tif ( length(lightWeighting) < 1.00 ) {',\n\n '\t\tif ( mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.75 ) {',\n\n '\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor2, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.50 ) {',\n\n '\t\tif (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor3, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.3465 ) {',\n\n '\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor4, 1.0 );',\n\n '\t}',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n\nexport const ToonShaderDotted = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xffffff) },\n uLineColor1: { value: new Color(0x000000) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n 'uniform vec3 uLineColor1;',\n 'uniform vec3 uLineColor2;',\n 'uniform vec3 uLineColor3;',\n 'uniform vec3 uLineColor4;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n 'float directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);',\n 'vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;',\n\n 'gl_FragColor = vec4( uBaseColor, 1.0 );',\n\n 'if ( length(lightWeighting) < 1.00 ) {',\n\n '\t\tif ( ( mod(gl_FragCoord.x, 4.001) + mod(gl_FragCoord.y, 4.0) ) > 6.00 ) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.50 ) {',\n\n '\t\tif ( ( mod(gl_FragCoord.x + 2.0, 4.001) + mod(gl_FragCoord.y + 2.0, 4.0) ) > 6.00 ) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Triangle blur shader\n * based on glfx.js triangle blur shader\n * https://github.com/evanw/glfx.js\n *\n * A basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\n\nexport const TriangleBlurShader = {\n uniforms: {\n texture: { value: null },\n delta: { value: new Vector2(1, 1) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n '#define ITERATIONS 10.0',\n\n 'uniform sampler2D texture;',\n 'uniform vec2 delta;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 color = vec4( 0.0 );',\n\n '\tfloat total = 0.0;',\n\n // randomize the lookup values to hide the fixed number of samples\n\n '\tfloat offset = rand( vUv );',\n\n '\tfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {',\n\n '\t\tfloat percent = ( t + offset - 0.5 ) / ITERATIONS;',\n '\t\tfloat weight = 1.0 - abs( percent );',\n\n '\t\tcolor += texture2D( texture, vUv + delta * percent ) * weight;',\n '\t\ttotal += weight;',\n\n '\t}',\n\n '\tgl_FragColor = color / total;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Two pass Gaussian blur filter (horizontal and vertical blur shaders)\n * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/\n * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type VerticalBlurShaderUniforms = {\n tDiffuse: IUniform\n v: IUniform\n}\n\nexport interface IVerticalBlurShader extends IShader {}\n\nexport const VerticalBlurShader: IVerticalBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n v: { value: 1.0 / 512.0 },\n },\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n fragmentShader: /* glsl */ `\n\n uniform sampler2D tDiffuse;\n uniform float v;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 sum = vec4( 0.0 );\n\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n gl_FragColor = sum;\n\n }\n `,\n}\n", "/**\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nexport const VerticalTiltShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n v: { value: 1.0 / 512.0 },\n r: { value: 0.35 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float v;',\n 'uniform float r;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 sum = vec4( 0.0 );',\n\n '\tfloat vv = v * abs( r - vUv.y );',\n\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;',\n\n '\tgl_FragColor = sum;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Vignette shader\n * based on PaintEffect postprocess from ro.me\n * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js\n */\n\nexport const VignetteShader = {\n uniforms: {\n tDiffuse: { value: null },\n offset: { value: 1.0 },\n darkness: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float offset;',\n 'uniform float darkness;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n // Eskil's vignette\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n '\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );',\n '\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );',\n\n /*\n\t\t// alternative version from glfx.js\n\t\t// this one makes more \"dusty\" look (as opposed to \"burned\")\n\n\t\t\"\tvec4 color = texture2D( tDiffuse, vUv );\",\n\t\t\"\tfloat dist = distance( vUv, vec2( 0.5 ) );\",\n\t\t\"\tcolor.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );\",\n\t\t\"\tgl_FragColor = color;\",\n\t\t*/\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2, Vector3 } from 'three'\n\n/**\n * Shaders to render 3D volumes using raycasting.\n * The applied techniques are based on similar implementations in the Visvis and Vispy projects.\n * This is not the only approach, therefore it's marked 1.\n */\n\nexport const VolumeRenderShader1 = {\n uniforms: {\n u_size: { value: new Vector3(1, 1, 1) },\n u_renderstyle: { value: 0 },\n u_renderthreshold: { value: 0.5 },\n u_clim: { value: new Vector2(1, 1) },\n u_data: { value: null },\n u_cmdata: { value: null },\n },\n vertexShader: [\n '\t\tvarying vec4 v_nearpos;',\n '\t\tvarying vec4 v_farpos;',\n '\t\tvarying vec3 v_position;',\n\n '\t\tvoid main() {',\n // Prepare transforms to map to \"camera view\". See also:\n // https://threejs.org/docs/#api/renderers/webgl/WebGLProgram\n '\t\t\t\tmat4 viewtransformf = modelViewMatrix;',\n '\t\t\t\tmat4 viewtransformi = inverse(modelViewMatrix);',\n\n // Project local vertex coordinate to camera position. Then do a step\n // backward (in cam coords) to the near clipping plane, and project back. Do\n // the same for the far clipping plane. This gives us all the information we\n // need to calculate the ray and truncate it to the viewing cone.\n '\t\t\t\tvec4 position4 = vec4(position, 1.0);',\n '\t\t\t\tvec4 pos_in_cam = viewtransformf * position4;',\n\n // Intersection of ray and near clipping plane (z = -1 in clip coords)\n '\t\t\t\tpos_in_cam.z = -pos_in_cam.w;',\n '\t\t\t\tv_nearpos = viewtransformi * pos_in_cam;',\n\n // Intersection of ray and far clipping plane (z = +1 in clip coords)\n '\t\t\t\tpos_in_cam.z = pos_in_cam.w;',\n '\t\t\t\tv_farpos = viewtransformi * pos_in_cam;',\n\n // Set varyings and output pos\n '\t\t\t\tv_position = position;',\n '\t\t\t\tgl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;',\n '\t\t}',\n ].join('\\n'),\n fragmentShader: [\n '\t\tprecision highp float;',\n '\t\tprecision mediump sampler3D;',\n\n '\t\tuniform vec3 u_size;',\n '\t\tuniform int u_renderstyle;',\n '\t\tuniform float u_renderthreshold;',\n '\t\tuniform vec2 u_clim;',\n\n '\t\tuniform sampler3D u_data;',\n '\t\tuniform sampler2D u_cmdata;',\n\n '\t\tvarying vec3 v_position;',\n '\t\tvarying vec4 v_nearpos;',\n '\t\tvarying vec4 v_farpos;',\n\n // The maximum distance through our rendering volume is sqrt(3).\n '\t\tconst int MAX_STEPS = 887;\t// 887 for 512^3, 1774 for 1024^3',\n '\t\tconst int REFINEMENT_STEPS = 4;',\n '\t\tconst float relative_step_size = 1.0;',\n '\t\tconst vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);',\n '\t\tconst vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);',\n '\t\tconst vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);',\n '\t\tconst float shininess = 40.0;',\n\n '\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);',\n '\t\tvoid cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);',\n\n '\t\tfloat sample1(vec3 texcoords);',\n '\t\tvec4 apply_colormap(float val);',\n '\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);',\n\n '\t\tvoid main() {',\n // Normalize clipping plane info\n '\t\t\t\tvec3 farpos = v_farpos.xyz / v_farpos.w;',\n '\t\t\t\tvec3 nearpos = v_nearpos.xyz / v_nearpos.w;',\n\n // Calculate unit vector pointing in the view direction through this fragment.\n '\t\t\t\tvec3 view_ray = normalize(nearpos.xyz - farpos.xyz);',\n\n // Compute the (negative) distance to the front surface or near clipping plane.\n // v_position is the back face of the cuboid, so the initial distance calculated in the dot\n // product below is the distance from near clip plane to the back of the cuboid\n '\t\t\t\tfloat distance = dot(nearpos - v_position, view_ray);',\n '\t\t\t\tdistance = max(distance, min((-0.5 - v_position.x) / view_ray.x,',\n '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.x - 0.5 - v_position.x) / view_ray.x));',\n '\t\t\t\tdistance = max(distance, min((-0.5 - v_position.y) / view_ray.y,',\n '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.y - 0.5 - v_position.y) / view_ray.y));',\n '\t\t\t\tdistance = max(distance, min((-0.5 - v_position.z) / view_ray.z,',\n '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.z - 0.5 - v_position.z) / view_ray.z));',\n\n // Now we have the starting position on the front surface\n '\t\t\t\tvec3 front = v_position + view_ray * distance;',\n\n // Decide how many steps to take\n '\t\t\t\tint nsteps = int(-distance / relative_step_size + 0.5);',\n '\t\t\t\tif ( nsteps < 1 )',\n '\t\t\t\t\t\tdiscard;',\n\n // Get starting location and step vector in texture coordinates\n '\t\t\t\tvec3 step = ((v_position - front) / u_size) / float(nsteps);',\n '\t\t\t\tvec3 start_loc = front / u_size;',\n\n // For testing: show the number of steps. This helps to establish\n // whether the rays are correctly oriented\n //'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);',\n //'return;',\n\n '\t\t\t\tif (u_renderstyle == 0)',\n '\t\t\t\t\t\tcast_mip(start_loc, step, nsteps, view_ray);',\n '\t\t\t\telse if (u_renderstyle == 1)',\n '\t\t\t\t\t\tcast_iso(start_loc, step, nsteps, view_ray);',\n\n '\t\t\t\tif (gl_FragColor.a < 0.05)',\n '\t\t\t\t\t\tdiscard;',\n '\t\t}',\n\n '\t\tfloat sample1(vec3 texcoords) {',\n '\t\t\t\t/* Sample float value from a 3D texture. Assumes intensity data. */',\n '\t\t\t\treturn texture(u_data, texcoords.xyz).r;',\n '\t\t}',\n\n '\t\tvec4 apply_colormap(float val) {',\n '\t\t\t\tval = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);',\n '\t\t\t\treturn texture2D(u_cmdata, vec2(val, 0.5));',\n '\t\t}',\n\n '\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {',\n\n '\t\t\t\tfloat max_val = -1e6;',\n '\t\t\t\tint max_i = 100;',\n '\t\t\t\tvec3 loc = start_loc;',\n\n // Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with\n // non-constant expression. So we use a hard-coded max, and an additional condition\n // inside the loop.\n '\t\t\t\tfor (int iter=0; iter= nsteps)',\n '\t\t\t\t\t\t\t\tbreak;',\n // Sample from the 3D texture\n '\t\t\t\t\t\tfloat val = sample1(loc);',\n // Apply MIP operation\n '\t\t\t\t\t\tif (val > max_val) {',\n '\t\t\t\t\t\t\t\tmax_val = val;',\n '\t\t\t\t\t\t\t\tmax_i = iter;',\n '\t\t\t\t\t\t}',\n // Advance location deeper into the volume\n '\t\t\t\t\t\tloc += step;',\n '\t\t\t\t}',\n\n // Refine location, gives crispier images\n '\t\t\t\tvec3 iloc = start_loc + step * (float(max_i) - 0.5);',\n '\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);',\n '\t\t\t\tfor (int i=0; i= nsteps)',\n '\t\t\t\t\t\t\t\tbreak;',\n\n // Sample from the 3D texture\n '\t\t\t\t\t\tfloat val = sample1(loc);',\n\n '\t\t\t\t\t\tif (val > low_threshold) {',\n // Take the last interval in smaller steps\n '\t\t\t\t\t\t\t\tvec3 iloc = loc - 0.5 * step;',\n '\t\t\t\t\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);',\n '\t\t\t\t\t\t\t\tfor (int i=0; i u_renderthreshold) {',\n '\t\t\t\t\t\t\t\t\t\t\t\tgl_FragColor = add_lighting(val, iloc, dstep, view_ray);',\n '\t\t\t\t\t\t\t\t\t\t\t\treturn;',\n '\t\t\t\t\t\t\t\t\t\t}',\n '\t\t\t\t\t\t\t\t\t\tiloc += istep;',\n '\t\t\t\t\t\t\t\t}',\n '\t\t\t\t\t\t}',\n\n // Advance location deeper into the volume\n '\t\t\t\t\t\tloc += step;',\n '\t\t\t\t}',\n '\t\t}',\n\n '\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)',\n '\t\t{',\n // Calculate color by incorporating lighting\n\n // View direction\n '\t\t\t\tvec3 V = normalize(view_ray);',\n\n // calculate normal vector from gradient\n '\t\t\t\tvec3 N;',\n '\t\t\t\tfloat val1, val2;',\n '\t\t\t\tval1 = sample1(loc + vec3(-step[0], 0.0, 0.0));',\n '\t\t\t\tval2 = sample1(loc + vec3(+step[0], 0.0, 0.0));',\n '\t\t\t\tN[0] = val1 - val2;',\n '\t\t\t\tval = max(max(val1, val2), val);',\n '\t\t\t\tval1 = sample1(loc + vec3(0.0, -step[1], 0.0));',\n '\t\t\t\tval2 = sample1(loc + vec3(0.0, +step[1], 0.0));',\n '\t\t\t\tN[1] = val1 - val2;',\n '\t\t\t\tval = max(max(val1, val2), val);',\n '\t\t\t\tval1 = sample1(loc + vec3(0.0, 0.0, -step[2]));',\n '\t\t\t\tval2 = sample1(loc + vec3(0.0, 0.0, +step[2]));',\n '\t\t\t\tN[2] = val1 - val2;',\n '\t\t\t\tval = max(max(val1, val2), val);',\n\n '\t\t\t\tfloat gm = length(N); // gradient magnitude',\n '\t\t\t\tN = normalize(N);',\n\n // Flip normal so it points towards viewer\n '\t\t\t\tfloat Nselect = float(dot(N, V) > 0.0);',\n '\t\t\t\tN = (2.0 * Nselect - 1.0) * N;\t// ==\tNselect * N - (1.0-Nselect)*N;',\n\n // Init colors\n '\t\t\t\tvec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);',\n '\t\t\t\tvec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);',\n '\t\t\t\tvec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);',\n\n // note: could allow multiple lights\n '\t\t\t\tfor (int i=0; i<1; i++)',\n '\t\t\t\t{',\n // Get light direction (make sure to prevent zero devision)\n '\t\t\t\t\t\tvec3 L = normalize(view_ray);\t//lightDirs[i];',\n '\t\t\t\t\t\tfloat lightEnabled = float( length(L) > 0.0 );',\n '\t\t\t\t\t\tL = normalize(L + (1.0 - lightEnabled));',\n\n // Calculate lighting properties\n '\t\t\t\t\t\tfloat lambertTerm = clamp(dot(N, L), 0.0, 1.0);',\n '\t\t\t\t\t\tvec3 H = normalize(L+V); // Halfway vector',\n '\t\t\t\t\t\tfloat specularTerm = pow(max(dot(H, N), 0.0), shininess);',\n\n // Calculate mask\n '\t\t\t\t\t\tfloat mask1 = lightEnabled;',\n\n // Calculate colors\n '\t\t\t\t\t\tambient_color +=\tmask1 * ambient_color;\t// * gl_LightSource[i].ambient;',\n '\t\t\t\t\t\tdiffuse_color +=\tmask1 * lambertTerm;',\n '\t\t\t\t\t\tspecular_color += mask1 * specularTerm * specular_color;',\n '\t\t\t\t}',\n\n // Calculate final color by componing different components\n '\t\t\t\tvec4 final_color;',\n '\t\t\t\tvec4 color = apply_colormap(val);',\n '\t\t\t\tfinal_color = color * (ambient_color + diffuse_color) + specular_color;',\n '\t\t\t\tfinal_color.a = color.a;',\n '\t\t\t\treturn final_color;',\n '\t\t}',\n ].join('\\n'),\n}\n", "export const WaterRefractionShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n time: {\n value: 0,\n },\n\n tDiffuse: {\n value: null,\n },\n\n tDudv: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n },\n\n vertexShader: [\n 'uniform mat4 textureMatrix;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vUvRefraction;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tvUvRefraction = textureMatrix * vec4( position, 1.0 );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 color;',\n 'uniform float time;',\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tDudv;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vUvRefraction;',\n\n 'float blendOverlay( float base, float blend ) {',\n\n '\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );',\n\n '}',\n\n 'vec3 blendOverlay( vec3 base, vec3 blend ) {',\n\n '\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );',\n\n '}',\n\n 'void main() {',\n\n ' float waveStrength = 0.1;',\n ' float waveSpeed = 0.03;',\n\n // simple distortion (ripple) via dudv map (see https://www.youtube.com/watch?v=6B7IF6GOu7s)\n\n '\tvec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;',\n '\tdistortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );',\n '\tvec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;',\n\n // new uv coords\n\n ' vec4 uv = vec4( vUvRefraction );',\n ' uv.xy += distortion;',\n\n '\tvec4 base = texture2DProj( tDiffuse, uv );',\n\n '\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Group, Matrix4, Raycaster, Vector2 } from 'three'\n\nconst _pointer = new Vector2()\nconst _event = { type: '', data: _pointer }\n\nclass InteractiveGroup extends Group {\n constructor(renderer, camera) {\n super()\n\n const scope = this\n\n const raycaster = new Raycaster()\n const tempMatrix = new Matrix4()\n\n // Pointer Events\n\n const element = renderer.domElement\n\n function onPointerEvent(event) {\n event.stopPropagation()\n\n _pointer.x = (event.clientX / element.clientWidth) * 2 - 1\n _pointer.y = -(event.clientY / element.clientHeight) * 2 + 1\n\n raycaster.setFromCamera(_pointer, camera)\n\n const intersects = raycaster.intersectObjects(scope.children, false)\n\n if (intersects.length > 0) {\n const intersection = intersects[0]\n\n const object = intersection.object\n const uv = intersection.uv\n\n _event.type = event.type\n _event.data.set(uv.x, 1 - uv.y)\n\n object.dispatchEvent(_event)\n }\n }\n\n element.addEventListener('pointerdown', onPointerEvent)\n element.addEventListener('pointerup', onPointerEvent)\n element.addEventListener('pointermove', onPointerEvent)\n element.addEventListener('mousedown', onPointerEvent)\n element.addEventListener('mouseup', onPointerEvent)\n element.addEventListener('mousemove', onPointerEvent)\n element.addEventListener('click', onPointerEvent)\n\n // WebXR Controller Events\n // TODO: Dispatch pointerevents too\n\n const events = {\n move: 'mousemove',\n select: 'click',\n selectstart: 'mousedown',\n selectend: 'mouseup',\n }\n\n function onXRControllerEvent(event) {\n const controller = event.target\n\n tempMatrix.identity().extractRotation(controller.matrixWorld)\n\n raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld)\n raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix)\n\n const intersections = raycaster.intersectObjects(scope.children, false)\n\n if (intersections.length > 0) {\n const intersection = intersections[0]\n\n const object = intersection.object\n const uv = intersection.uv\n\n _event.type = events[event.type]\n _event.data.set(uv.x, 1 - uv.y)\n\n object.dispatchEvent(_event)\n }\n }\n\n const controller1 = renderer.xr.getController(0)\n controller1.addEventListener('move', onXRControllerEvent)\n controller1.addEventListener('select', onXRControllerEvent)\n controller1.addEventListener('selectstart', onXRControllerEvent)\n controller1.addEventListener('selectend', onXRControllerEvent)\n\n const controller2 = renderer.xr.getController(1)\n controller2.addEventListener('move', onXRControllerEvent)\n controller2.addEventListener('select', onXRControllerEvent)\n controller2.addEventListener('selectstart', onXRControllerEvent)\n controller2.addEventListener('selectend', onXRControllerEvent)\n }\n}\n\nexport { InteractiveGroup }\n", "import { Frustum, Vector3 } from 'three'\n\nconst frustum = new Frustum()\nconst center = new Vector3()\n\nconst tmpPoint = new Vector3()\n\nconst vecNear = new Vector3()\nconst vecTopLeft = new Vector3()\nconst vecTopRight = new Vector3()\nconst vecDownRight = new Vector3()\nconst vecDownLeft = new Vector3()\n\nconst vecFarTopLeft = new Vector3()\nconst vecFarTopRight = new Vector3()\nconst vecFarDownRight = new Vector3()\nconst vecFarDownLeft = new Vector3()\n\nconst vectemp1 = new Vector3()\nconst vectemp2 = new Vector3()\nconst vectemp3 = new Vector3()\n\nclass SelectionBox {\n constructor(camera, scene, deep) {\n this.camera = camera\n this.scene = scene\n this.startPoint = new Vector3()\n this.endPoint = new Vector3()\n this.collection = []\n this.deep = deep || Number.MAX_VALUE\n }\n\n select(startPoint, endPoint) {\n this.startPoint = startPoint || this.startPoint\n this.endPoint = endPoint || this.endPoint\n this.collection = []\n\n this.updateFrustum(this.startPoint, this.endPoint)\n this.searchChildInFrustum(frustum, this.scene)\n\n return this.collection\n }\n\n updateFrustum(startPoint, endPoint) {\n startPoint = startPoint || this.startPoint\n endPoint = endPoint || this.endPoint\n\n // Avoid invalid frustum\n\n if (startPoint.x === endPoint.x) {\n endPoint.x += Number.EPSILON\n }\n\n if (startPoint.y === endPoint.y) {\n endPoint.y += Number.EPSILON\n }\n\n this.camera.updateProjectionMatrix()\n this.camera.updateMatrixWorld()\n\n if (this.camera.isPerspectiveCamera) {\n tmpPoint.copy(startPoint)\n tmpPoint.x = Math.min(startPoint.x, endPoint.x)\n tmpPoint.y = Math.max(startPoint.y, endPoint.y)\n endPoint.x = Math.max(startPoint.x, endPoint.x)\n endPoint.y = Math.min(startPoint.y, endPoint.y)\n\n vecNear.setFromMatrixPosition(this.camera.matrixWorld)\n vecTopLeft.copy(tmpPoint)\n vecTopRight.set(endPoint.x, tmpPoint.y, 0)\n vecDownRight.copy(endPoint)\n vecDownLeft.set(tmpPoint.x, endPoint.y, 0)\n\n vecTopLeft.unproject(this.camera)\n vecTopRight.unproject(this.camera)\n vecDownRight.unproject(this.camera)\n vecDownLeft.unproject(this.camera)\n\n vectemp1.copy(vecTopLeft).sub(vecNear)\n vectemp2.copy(vecTopRight).sub(vecNear)\n vectemp3.copy(vecDownRight).sub(vecNear)\n vectemp1.normalize()\n vectemp2.normalize()\n vectemp3.normalize()\n\n vectemp1.multiplyScalar(this.deep)\n vectemp2.multiplyScalar(this.deep)\n vectemp3.multiplyScalar(this.deep)\n vectemp1.add(vecNear)\n vectemp2.add(vecNear)\n vectemp3.add(vecNear)\n\n var planes = frustum.planes\n\n planes[0].setFromCoplanarPoints(vecNear, vecTopLeft, vecTopRight)\n planes[1].setFromCoplanarPoints(vecNear, vecTopRight, vecDownRight)\n planes[2].setFromCoplanarPoints(vecDownRight, vecDownLeft, vecNear)\n planes[3].setFromCoplanarPoints(vecDownLeft, vecTopLeft, vecNear)\n planes[4].setFromCoplanarPoints(vecTopRight, vecDownRight, vecDownLeft)\n planes[5].setFromCoplanarPoints(vectemp3, vectemp2, vectemp1)\n planes[5].normal.multiplyScalar(-1)\n } else if (this.camera.isOrthographicCamera) {\n const left = Math.min(startPoint.x, endPoint.x)\n const top = Math.max(startPoint.y, endPoint.y)\n const right = Math.max(startPoint.x, endPoint.x)\n const down = Math.min(startPoint.y, endPoint.y)\n\n vecTopLeft.set(left, top, -1)\n vecTopRight.set(right, top, -1)\n vecDownRight.set(right, down, -1)\n vecDownLeft.set(left, down, -1)\n\n vecFarTopLeft.set(left, top, 1)\n vecFarTopRight.set(right, top, 1)\n vecFarDownRight.set(right, down, 1)\n vecFarDownLeft.set(left, down, 1)\n\n vecTopLeft.unproject(this.camera)\n vecTopRight.unproject(this.camera)\n vecDownRight.unproject(this.camera)\n vecDownLeft.unproject(this.camera)\n\n vecFarTopLeft.unproject(this.camera)\n vecFarTopRight.unproject(this.camera)\n vecFarDownRight.unproject(this.camera)\n vecFarDownLeft.unproject(this.camera)\n\n var planes = frustum.planes\n\n planes[0].setFromCoplanarPoints(vecTopLeft, vecFarTopLeft, vecFarTopRight)\n planes[1].setFromCoplanarPoints(vecTopRight, vecFarTopRight, vecFarDownRight)\n planes[2].setFromCoplanarPoints(vecFarDownRight, vecFarDownLeft, vecDownLeft)\n planes[3].setFromCoplanarPoints(vecFarDownLeft, vecFarTopLeft, vecTopLeft)\n planes[4].setFromCoplanarPoints(vecTopRight, vecDownRight, vecDownLeft)\n planes[5].setFromCoplanarPoints(vecFarDownRight, vecFarTopRight, vecFarTopLeft)\n planes[5].normal.multiplyScalar(-1)\n } else {\n console.error('THREE.SelectionBox: Unsupported camera type.')\n }\n }\n\n searchChildInFrustum(frustum, object) {\n if (object.isMesh || object.isLine || object.isPoints) {\n if (object.material !== undefined) {\n if (object.geometry.boundingSphere === null) object.geometry.computeBoundingSphere()\n\n center.copy(object.geometry.boundingSphere.center)\n\n center.applyMatrix4(object.matrixWorld)\n\n if (frustum.containsPoint(center)) {\n this.collection.push(object)\n }\n }\n }\n\n if (object.children.length > 0) {\n for (let x = 0; x < object.children.length; x++) {\n this.searchChildInFrustum(frustum, object.children[x])\n }\n }\n }\n}\n\nexport { SelectionBox }\n", "async function AmmoPhysics() {\n if ('Ammo' in window === false) {\n console.error(\"AmmoPhysics: Couldn't find Ammo.js\")\n return\n }\n\n const AmmoLib = await Ammo()\n\n const frameRate = 60\n\n const collisionConfiguration = new AmmoLib.btDefaultCollisionConfiguration()\n const dispatcher = new AmmoLib.btCollisionDispatcher(collisionConfiguration)\n const broadphase = new AmmoLib.btDbvtBroadphase()\n const solver = new AmmoLib.btSequentialImpulseConstraintSolver()\n const world = new AmmoLib.btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration)\n world.setGravity(new AmmoLib.btVector3(0, -9.8, 0))\n\n const worldTransform = new AmmoLib.btTransform()\n\n //\n\n function getShape(geometry) {\n const parameters = geometry.parameters\n\n // TODO change type to is*\n\n if (geometry.type === 'BoxGeometry') {\n const sx = parameters.width !== undefined ? parameters.width / 2 : 0.5\n const sy = parameters.height !== undefined ? parameters.height / 2 : 0.5\n const sz = parameters.depth !== undefined ? parameters.depth / 2 : 0.5\n\n const shape = new AmmoLib.btBoxShape(new AmmoLib.btVector3(sx, sy, sz))\n shape.setMargin(0.05)\n\n return shape\n } else if (geometry.type === 'SphereGeometry' || geometry.type === 'IcosahedronGeometry') {\n const radius = parameters.radius !== undefined ? parameters.radius : 1\n\n const shape = new AmmoLib.btSphereShape(radius)\n shape.setMargin(0.05)\n\n return shape\n }\n\n return null\n }\n\n const meshes = []\n const meshMap = new WeakMap()\n\n function addMesh(mesh, mass = 0) {\n const shape = getShape(mesh.geometry)\n\n if (shape !== null) {\n if (mesh.isInstancedMesh) {\n handleInstancedMesh(mesh, mass, shape)\n } else if (mesh.isMesh) {\n handleMesh(mesh, mass, shape)\n }\n }\n }\n\n function handleMesh(mesh, mass, shape) {\n const position = mesh.position\n const quaternion = mesh.quaternion\n\n const transform = new AmmoLib.btTransform()\n transform.setIdentity()\n transform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z))\n transform.setRotation(new AmmoLib.btQuaternion(quaternion.x, quaternion.y, quaternion.z, quaternion.w))\n\n const motionState = new AmmoLib.btDefaultMotionState(transform)\n\n const localInertia = new AmmoLib.btVector3(0, 0, 0)\n shape.calculateLocalInertia(mass, localInertia)\n\n const rbInfo = new AmmoLib.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia)\n\n const body = new AmmoLib.btRigidBody(rbInfo)\n // body.setFriction( 4 );\n world.addRigidBody(body)\n\n if (mass > 0) {\n meshes.push(mesh)\n meshMap.set(mesh, body)\n }\n }\n\n function handleInstancedMesh(mesh, mass, shape) {\n const array = mesh.instanceMatrix.array\n\n const bodies = []\n\n for (let i = 0; i < mesh.count; i++) {\n const index = i * 16\n\n const transform = new AmmoLib.btTransform()\n transform.setFromOpenGLMatrix(array.slice(index, index + 16))\n\n const motionState = new AmmoLib.btDefaultMotionState(transform)\n\n const localInertia = new AmmoLib.btVector3(0, 0, 0)\n shape.calculateLocalInertia(mass, localInertia)\n\n const rbInfo = new AmmoLib.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia)\n\n const body = new AmmoLib.btRigidBody(rbInfo)\n world.addRigidBody(body)\n\n bodies.push(body)\n }\n\n if (mass > 0) {\n mesh.instanceMatrix.setUsage(35048) // THREE.DynamicDrawUsage = 35048\n meshes.push(mesh)\n\n meshMap.set(mesh, bodies)\n }\n }\n\n //\n\n function setMeshPosition(mesh, position, index = 0) {\n if (mesh.isInstancedMesh) {\n const bodies = meshMap.get(mesh)\n const body = bodies[index]\n\n body.setAngularVelocity(new AmmoLib.btVector3(0, 0, 0))\n body.setLinearVelocity(new AmmoLib.btVector3(0, 0, 0))\n\n worldTransform.setIdentity()\n worldTransform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z))\n body.setWorldTransform(worldTransform)\n } else if (mesh.isMesh) {\n const body = meshMap.get(mesh)\n\n body.setAngularVelocity(new AmmoLib.btVector3(0, 0, 0))\n body.setLinearVelocity(new AmmoLib.btVector3(0, 0, 0))\n\n worldTransform.setIdentity()\n worldTransform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z))\n body.setWorldTransform(worldTransform)\n }\n }\n\n //\n\n let lastTime = 0\n\n function step() {\n const time = performance.now()\n\n if (lastTime > 0) {\n const delta = (time - lastTime) / 1000\n\n // console.time( 'world.step' );\n world.stepSimulation(delta, 10)\n // console.timeEnd( 'world.step' );\n }\n\n lastTime = time\n\n //\n\n for (let i = 0, l = meshes.length; i < l; i++) {\n const mesh = meshes[i]\n\n if (mesh.isInstancedMesh) {\n const array = mesh.instanceMatrix.array\n const bodies = meshMap.get(mesh)\n\n for (let j = 0; j < bodies.length; j++) {\n const body = bodies[j]\n\n const motionState = body.getMotionState()\n motionState.getWorldTransform(worldTransform)\n\n const position = worldTransform.getOrigin()\n const quaternion = worldTransform.getRotation()\n\n compose(position, quaternion, array, j * 16)\n }\n\n mesh.instanceMatrix.needsUpdate = true\n } else if (mesh.isMesh) {\n const body = meshMap.get(mesh)\n\n const motionState = body.getMotionState()\n motionState.getWorldTransform(worldTransform)\n\n const position = worldTransform.getOrigin()\n const quaternion = worldTransform.getRotation()\n mesh.position.set(position.x(), position.y(), position.z())\n mesh.quaternion.set(quaternion.x(), quaternion.y(), quaternion.z(), quaternion.w())\n }\n }\n }\n\n // animate\n\n setInterval(step, 1000 / frameRate)\n\n return {\n addMesh: addMesh,\n setMeshPosition: setMeshPosition,\n // addCompoundMesh\n }\n}\n\nfunction compose(position, quaternion, array, index) {\n const x = quaternion.x(),\n y = quaternion.y(),\n z = quaternion.z(),\n w = quaternion.w()\n const x2 = x + x,\n y2 = y + y,\n z2 = z + z\n const xx = x * x2,\n xy = x * y2,\n xz = x * z2\n const yy = y * y2,\n yz = y * z2,\n zz = z * z2\n const wx = w * x2,\n wy = w * y2,\n wz = w * z2\n\n array[index + 0] = 1 - (yy + zz)\n array[index + 1] = xy + wz\n array[index + 2] = xz - wy\n array[index + 3] = 0\n\n array[index + 4] = xy - wz\n array[index + 5] = 1 - (xx + zz)\n array[index + 6] = yz + wx\n array[index + 7] = 0\n\n array[index + 8] = xz + wy\n array[index + 9] = yz - wx\n array[index + 10] = 1 - (xx + yy)\n array[index + 11] = 0\n\n array[index + 12] = position.x()\n array[index + 13] = position.y()\n array[index + 14] = position.z()\n array[index + 15] = 1\n}\n\nexport { AmmoPhysics }\n", "/**\n * Ascii generation is based on https://github.com/hassadee/jsascii/blob/master/jsascii.js\n *\n * 16 April 2012 - @blurspline\n */\n\nclass AsciiEffect {\n constructor(renderer, charSet = ' .:-=+*#%@', options = {}) {\n // ' .,:;=|iI+hHOE#`$';\n // darker bolder character set from https://github.com/saw/Canvas-ASCII-Art/\n // ' .\\'`^\",:;Il!i~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$'.split('');\n\n // Some ASCII settings\n\n const fResolution = options['resolution'] || 0.15 // Higher for more details\n const iScale = options['scale'] || 1\n const bColor = options['color'] || false // nice but slows down rendering!\n const bAlpha = options['alpha'] || false // Transparency\n const bBlock = options['block'] || false // blocked characters. like good O dos\n const bInvert = options['invert'] || false // black is white, white is black\n const strResolution = options['strResolution'] || 'low'\n\n let width, height\n\n const domElement = document.createElement('div')\n domElement.style.cursor = 'default'\n\n const oAscii = document.createElement('table')\n domElement.appendChild(oAscii)\n\n let iWidth, iHeight\n let oImg\n\n this.setSize = function (w, h) {\n width = w\n height = h\n\n renderer.setSize(w, h)\n\n initAsciiSize()\n }\n\n this.render = function (scene, camera) {\n renderer.render(scene, camera)\n asciifyImage(oAscii)\n }\n\n this.domElement = domElement\n\n // Throw in ascii library from https://github.com/hassadee/jsascii/blob/master/jsascii.js (MIT License)\n\n function initAsciiSize() {\n iWidth = Math.floor(width * fResolution)\n iHeight = Math.floor(height * fResolution)\n\n oCanvas.width = iWidth\n oCanvas.height = iHeight\n // oCanvas.style.display = \"none\";\n // oCanvas.style.width = iWidth;\n // oCanvas.style.height = iHeight;\n\n oImg = renderer.domElement\n\n if (oImg.style.backgroundColor) {\n oAscii.rows[0].cells[0].style.backgroundColor = oImg.style.backgroundColor\n oAscii.rows[0].cells[0].style.color = oImg.style.color\n }\n\n oAscii.cellSpacing = 0\n oAscii.cellPadding = 0\n\n const oStyle = oAscii.style\n oStyle.whiteSpace = 'pre'\n oStyle.margin = '0px'\n oStyle.padding = '0px'\n oStyle.letterSpacing = fLetterSpacing + 'px'\n oStyle.fontFamily = strFont\n oStyle.fontSize = fFontSize + 'px'\n oStyle.lineHeight = fLineHeight + 'px'\n oStyle.textAlign = 'left'\n oStyle.textDecoration = 'none'\n }\n\n const aDefaultCharList = ' .,:;i1tfLCG08@'.split('')\n const aDefaultColorCharList = ' CGO08@'.split('')\n const strFont = 'courier new, monospace'\n\n const oCanvasImg = renderer.domElement\n\n const oCanvas = document.createElement('canvas')\n if (!oCanvas.getContext) {\n return\n }\n\n const oCtx = oCanvas.getContext('2d')\n if (!oCtx.getImageData) {\n return\n }\n\n let aCharList = bColor ? aDefaultColorCharList : aDefaultCharList\n\n if (charSet) aCharList = charSet\n\n // Setup dom\n\n const fFontSize = (2 / fResolution) * iScale\n const fLineHeight = (2 / fResolution) * iScale\n\n // adjust letter-spacing for all combinations of scale and resolution to get it to fit the image width.\n\n let fLetterSpacing = 0\n\n if (strResolution == 'low') {\n switch (iScale) {\n case 1:\n fLetterSpacing = -1\n break\n case 2:\n case 3:\n fLetterSpacing = -2.1\n break\n case 4:\n fLetterSpacing = -3.1\n break\n case 5:\n fLetterSpacing = -4.15\n break\n }\n }\n\n if (strResolution == 'medium') {\n switch (iScale) {\n case 1:\n fLetterSpacing = 0\n break\n case 2:\n fLetterSpacing = -1\n break\n case 3:\n fLetterSpacing = -1.04\n break\n case 4:\n case 5:\n fLetterSpacing = -2.1\n break\n }\n }\n\n if (strResolution == 'high') {\n switch (iScale) {\n case 1:\n case 2:\n fLetterSpacing = 0\n break\n case 3:\n case 4:\n case 5:\n fLetterSpacing = -1\n break\n }\n }\n\n // can't get a span or div to flow like an img element, but a table works?\n\n // convert img element to ascii\n\n function asciifyImage(oAscii) {\n oCtx.clearRect(0, 0, iWidth, iHeight)\n oCtx.drawImage(oCanvasImg, 0, 0, iWidth, iHeight)\n const oImgData = oCtx.getImageData(0, 0, iWidth, iHeight).data\n\n // Coloring loop starts now\n let strChars = ''\n\n // console.time('rendering');\n\n for (let y = 0; y < iHeight; y += 2) {\n for (let x = 0; x < iWidth; x++) {\n const iOffset = (y * iWidth + x) * 4\n\n const iRed = oImgData[iOffset]\n const iGreen = oImgData[iOffset + 1]\n const iBlue = oImgData[iOffset + 2]\n const iAlpha = oImgData[iOffset + 3]\n let iCharIdx\n\n let fBrightness\n\n fBrightness = (0.3 * iRed + 0.59 * iGreen + 0.11 * iBlue) / 255\n // fBrightness = (0.3*iRed + 0.5*iGreen + 0.3*iBlue) / 255;\n\n if (iAlpha == 0) {\n // should calculate alpha instead, but quick hack :)\n //fBrightness *= (iAlpha / 255);\n fBrightness = 1\n }\n\n iCharIdx = Math.floor((1 - fBrightness) * (aCharList.length - 1))\n\n if (bInvert) {\n iCharIdx = aCharList.length - iCharIdx - 1\n }\n\n // good for debugging\n //fBrightness = Math.floor(fBrightness * 10);\n //strThisChar = fBrightness;\n\n let strThisChar = aCharList[iCharIdx]\n\n if (strThisChar === undefined || strThisChar == ' ') strThisChar = ' '\n\n if (bColor) {\n strChars +=\n \"\" +\n strThisChar +\n ''\n } else {\n strChars += strThisChar\n }\n }\n\n strChars += '
'\n }\n\n oAscii.innerHTML = `${strChars}`\n\n // console.timeEnd('rendering');\n\n // return oAscii;\n }\n }\n}\n\nexport { AsciiEffect }\n", "import {\n AmbientLight,\n AnimationClip,\n Bone,\n BufferGeometry,\n ClampToEdgeWrapping,\n Color,\n DirectionalLight,\n EquirectangularReflectionMapping,\n Euler,\n FileLoader,\n Float32BufferAttribute,\n Group,\n Line,\n LineBasicMaterial,\n Loader,\n LoaderUtils,\n MathUtils,\n Matrix3,\n Matrix4,\n Mesh,\n MeshLambertMaterial,\n MeshPhongMaterial,\n NumberKeyframeTrack,\n Object3D,\n OrthographicCamera,\n PerspectiveCamera,\n PointLight,\n PropertyBinding,\n Quaternion,\n QuaternionKeyframeTrack,\n RepeatWrapping,\n Skeleton,\n SkinnedMesh,\n SpotLight,\n Texture,\n TextureLoader,\n Uint16BufferAttribute,\n Vector3,\n Vector4,\n VectorKeyframeTrack,\n} from 'three'\nimport { unzlibSync } from 'fflate'\nimport { NURBSCurve } from '../curves/NURBSCurve'\nimport { decodeText } from '../_polyfill/LoaderUtils'\n\n/**\n * Loader loads FBX file and generates Group representing FBX scene.\n * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format\n * Versions lower than this may load but will probably have errors\n *\n * Needs Support:\n * Morph normals / blend shape normals\n *\n * FBX format references:\n * \thttps://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html (C++ SDK reference)\n *\n * Binary format specification:\n *\thttps://code.blender.org/2013/08/fbx-binary-file-format-specification/\n */\n\nlet fbxTree\nlet connections\nlet sceneGraph\n\nclass FBXLoader extends Loader {\n constructor(manager) {\n super(manager)\n }\n\n load(url, onLoad, onProgress, onError) {\n const scope = this\n\n const path = scope.path === '' ? LoaderUtils.extractUrlBase(url) : scope.path\n\n const loader = new FileLoader(this.manager)\n loader.setPath(scope.path)\n loader.setResponseType('arraybuffer')\n loader.setRequestHeader(scope.requestHeader)\n loader.setWithCredentials(scope.withCredentials)\n\n loader.load(\n url,\n function (buffer) {\n try {\n onLoad(scope.parse(buffer, path))\n } catch (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n scope.manager.itemError(url)\n }\n },\n onProgress,\n onError,\n )\n }\n\n parse(FBXBuffer, path) {\n if (isFbxFormatBinary(FBXBuffer)) {\n fbxTree = new BinaryParser().parse(FBXBuffer)\n } else {\n const FBXText = convertArrayBufferToString(FBXBuffer)\n\n if (!isFbxFormatASCII(FBXText)) {\n throw new Error('THREE.FBXLoader: Unknown format.')\n }\n\n if (getFbxVersion(FBXText) < 7000) {\n throw new Error('THREE.FBXLoader: FBX version not supported, FileVersion: ' + getFbxVersion(FBXText))\n }\n\n fbxTree = new TextParser().parse(FBXText)\n }\n\n // console.log( fbxTree );\n\n const textureLoader = new TextureLoader(this.manager)\n .setPath(this.resourcePath || path)\n .setCrossOrigin(this.crossOrigin)\n\n return new FBXTreeParser(textureLoader, this.manager).parse(fbxTree)\n }\n}\n\n// Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group\nclass FBXTreeParser {\n constructor(textureLoader, manager) {\n this.textureLoader = textureLoader\n this.manager = manager\n }\n\n parse() {\n connections = this.parseConnections()\n\n const images = this.parseImages()\n const textures = this.parseTextures(images)\n const materials = this.parseMaterials(textures)\n const deformers = this.parseDeformers()\n const geometryMap = new GeometryParser().parse(deformers)\n\n this.parseScene(deformers, geometryMap, materials)\n\n return sceneGraph\n }\n\n // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )\n // and details the connection type\n parseConnections() {\n const connectionMap = new Map()\n\n if ('Connections' in fbxTree) {\n const rawConnections = fbxTree.Connections.connections\n\n rawConnections.forEach(function (rawConnection) {\n const fromID = rawConnection[0]\n const toID = rawConnection[1]\n const relationship = rawConnection[2]\n\n if (!connectionMap.has(fromID)) {\n connectionMap.set(fromID, {\n parents: [],\n children: [],\n })\n }\n\n const parentRelationship = { ID: toID, relationship: relationship }\n connectionMap.get(fromID).parents.push(parentRelationship)\n\n if (!connectionMap.has(toID)) {\n connectionMap.set(toID, {\n parents: [],\n children: [],\n })\n }\n\n const childRelationship = { ID: fromID, relationship: relationship }\n connectionMap.get(toID).children.push(childRelationship)\n })\n }\n\n return connectionMap\n }\n\n // Parse FBXTree.Objects.Video for embedded image data\n // These images are connected to textures in FBXTree.Objects.Textures\n // via FBXTree.Connections.\n parseImages() {\n const images = {}\n const blobs = {}\n\n if ('Video' in fbxTree.Objects) {\n const videoNodes = fbxTree.Objects.Video\n\n for (const nodeID in videoNodes) {\n const videoNode = videoNodes[nodeID]\n\n const id = parseInt(nodeID)\n\n images[id] = videoNode.RelativeFilename || videoNode.Filename\n\n // raw image data is in videoNode.Content\n if ('Content' in videoNode) {\n const arrayBufferContent = videoNode.Content instanceof ArrayBuffer && videoNode.Content.byteLength > 0\n const base64Content = typeof videoNode.Content === 'string' && videoNode.Content !== ''\n\n if (arrayBufferContent || base64Content) {\n const image = this.parseImage(videoNodes[nodeID])\n\n blobs[videoNode.RelativeFilename || videoNode.Filename] = image\n }\n }\n }\n }\n\n for (const id in images) {\n const filename = images[id]\n\n if (blobs[filename] !== undefined) images[id] = blobs[filename]\n else images[id] = images[id].split('\\\\').pop()\n }\n\n return images\n }\n\n // Parse embedded image data in FBXTree.Video.Content\n parseImage(videoNode) {\n const content = videoNode.Content\n const fileName = videoNode.RelativeFilename || videoNode.Filename\n const extension = fileName.slice(fileName.lastIndexOf('.') + 1).toLowerCase()\n\n let type\n\n switch (extension) {\n case 'bmp':\n type = 'image/bmp'\n break\n\n case 'jpg':\n case 'jpeg':\n type = 'image/jpeg'\n break\n\n case 'png':\n type = 'image/png'\n break\n\n case 'tif':\n type = 'image/tiff'\n break\n\n case 'tga':\n if (this.manager.getHandler('.tga') === null) {\n console.warn('FBXLoader: TGA loader not found, skipping ', fileName)\n }\n\n type = 'image/tga'\n break\n\n default:\n console.warn('FBXLoader: Image type \"' + extension + '\" is not supported.')\n return\n }\n\n if (typeof content === 'string') {\n // ASCII format\n\n return 'data:' + type + ';base64,' + content\n } else {\n // Binary Format\n\n const array = new Uint8Array(content)\n return window.URL.createObjectURL(new Blob([array], { type: type }))\n }\n }\n\n // Parse nodes in FBXTree.Objects.Texture\n // These contain details such as UV scaling, cropping, rotation etc and are connected\n // to images in FBXTree.Objects.Video\n parseTextures(images) {\n const textureMap = new Map()\n\n if ('Texture' in fbxTree.Objects) {\n const textureNodes = fbxTree.Objects.Texture\n for (const nodeID in textureNodes) {\n const texture = this.parseTexture(textureNodes[nodeID], images)\n textureMap.set(parseInt(nodeID), texture)\n }\n }\n\n return textureMap\n }\n\n // Parse individual node in FBXTree.Objects.Texture\n parseTexture(textureNode, images) {\n const texture = this.loadTexture(textureNode, images)\n\n texture.ID = textureNode.id\n\n texture.name = textureNode.attrName\n\n const wrapModeU = textureNode.WrapModeU\n const wrapModeV = textureNode.WrapModeV\n\n const valueU = wrapModeU !== undefined ? wrapModeU.value : 0\n const valueV = wrapModeV !== undefined ? wrapModeV.value : 0\n\n // http://download.autodesk.com/us/fbx/SDKdocs/FBX_SDK_Help/files/fbxsdkref/class_k_fbx_texture.html#889640e63e2e681259ea81061b85143a\n // 0: repeat(default), 1: clamp\n\n texture.wrapS = valueU === 0 ? RepeatWrapping : ClampToEdgeWrapping\n texture.wrapT = valueV === 0 ? RepeatWrapping : ClampToEdgeWrapping\n\n if ('Scaling' in textureNode) {\n const values = textureNode.Scaling.value\n\n texture.repeat.x = values[0]\n texture.repeat.y = values[1]\n }\n\n return texture\n }\n\n // load a texture specified as a blob or data URI, or via an external URL using TextureLoader\n loadTexture(textureNode, images) {\n let fileName\n\n const currentPath = this.textureLoader.path\n\n const children = connections.get(textureNode.id).children\n\n if (children !== undefined && children.length > 0 && images[children[0].ID] !== undefined) {\n fileName = images[children[0].ID]\n\n if (fileName.indexOf('blob:') === 0 || fileName.indexOf('data:') === 0) {\n this.textureLoader.setPath(undefined)\n }\n }\n\n let texture\n\n const extension = textureNode.FileName.slice(-3).toLowerCase()\n\n if (extension === 'tga') {\n const loader = this.manager.getHandler('.tga')\n\n if (loader === null) {\n console.warn('FBXLoader: TGA loader not found, creating placeholder texture for', textureNode.RelativeFilename)\n texture = new Texture()\n } else {\n loader.setPath(this.textureLoader.path)\n texture = loader.load(fileName)\n }\n } else if (extension === 'psd') {\n console.warn(\n 'FBXLoader: PSD textures are not supported, creating placeholder texture for',\n textureNode.RelativeFilename,\n )\n texture = new Texture()\n } else {\n texture = this.textureLoader.load(fileName)\n }\n\n this.textureLoader.setPath(currentPath)\n\n return texture\n }\n\n // Parse nodes in FBXTree.Objects.Material\n parseMaterials(textureMap) {\n const materialMap = new Map()\n\n if ('Material' in fbxTree.Objects) {\n const materialNodes = fbxTree.Objects.Material\n\n for (const nodeID in materialNodes) {\n const material = this.parseMaterial(materialNodes[nodeID], textureMap)\n\n if (material !== null) materialMap.set(parseInt(nodeID), material)\n }\n }\n\n return materialMap\n }\n\n // Parse single node in FBXTree.Objects.Material\n // Materials are connected to texture maps in FBXTree.Objects.Textures\n // FBX format currently only supports Lambert and Phong shading models\n parseMaterial(materialNode, textureMap) {\n const ID = materialNode.id\n const name = materialNode.attrName\n let type = materialNode.ShadingModel\n\n // Case where FBX wraps shading model in property object.\n if (typeof type === 'object') {\n type = type.value\n }\n\n // Ignore unused materials which don't have any connections.\n if (!connections.has(ID)) return null\n\n const parameters = this.parseParameters(materialNode, textureMap, ID)\n\n let material\n\n switch (type.toLowerCase()) {\n case 'phong':\n material = new MeshPhongMaterial()\n break\n case 'lambert':\n material = new MeshLambertMaterial()\n break\n default:\n console.warn('THREE.FBXLoader: unknown material type \"%s\". Defaulting to MeshPhongMaterial.', type)\n material = new MeshPhongMaterial()\n break\n }\n\n material.setValues(parameters)\n material.name = name\n\n return material\n }\n\n // Parse FBX material and return parameters suitable for a three.js material\n // Also parse the texture map and return any textures associated with the material\n parseParameters(materialNode, textureMap, ID) {\n const parameters = {}\n\n if (materialNode.BumpFactor) {\n parameters.bumpScale = materialNode.BumpFactor.value\n }\n\n if (materialNode.Diffuse) {\n parameters.color = new Color().fromArray(materialNode.Diffuse.value)\n } else if (\n materialNode.DiffuseColor &&\n (materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB')\n ) {\n // The blender exporter exports diffuse here instead of in materialNode.Diffuse\n parameters.color = new Color().fromArray(materialNode.DiffuseColor.value)\n }\n\n if (materialNode.DisplacementFactor) {\n parameters.displacementScale = materialNode.DisplacementFactor.value\n }\n\n if (materialNode.Emissive) {\n parameters.emissive = new Color().fromArray(materialNode.Emissive.value)\n } else if (\n materialNode.EmissiveColor &&\n (materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB')\n ) {\n // The blender exporter exports emissive color here instead of in materialNode.Emissive\n parameters.emissive = new Color().fromArray(materialNode.EmissiveColor.value)\n }\n\n if (materialNode.EmissiveFactor) {\n parameters.emissiveIntensity = parseFloat(materialNode.EmissiveFactor.value)\n }\n\n if (materialNode.Opacity) {\n parameters.opacity = parseFloat(materialNode.Opacity.value)\n }\n\n if (parameters.opacity < 1.0) {\n parameters.transparent = true\n }\n\n if (materialNode.ReflectionFactor) {\n parameters.reflectivity = materialNode.ReflectionFactor.value\n }\n\n if (materialNode.Shininess) {\n parameters.shininess = materialNode.Shininess.value\n }\n\n if (materialNode.Specular) {\n parameters.specular = new Color().fromArray(materialNode.Specular.value)\n } else if (materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color') {\n // The blender exporter exports specular color here instead of in materialNode.Specular\n parameters.specular = new Color().fromArray(materialNode.SpecularColor.value)\n }\n\n const scope = this\n connections.get(ID).children.forEach(function (child) {\n const type = child.relationship\n\n switch (type) {\n case 'Bump':\n parameters.bumpMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'Maya|TEX_ao_map':\n parameters.aoMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'DiffuseColor':\n case 'Maya|TEX_color_map':\n parameters.map = scope.getTexture(textureMap, child.ID)\n if (parameters.map !== undefined) {\n if ('colorSpace' in parameters.map) parameters.map.colorSpace = 'srgb'\n else parameters.map.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'DisplacementColor':\n parameters.displacementMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'EmissiveColor':\n parameters.emissiveMap = scope.getTexture(textureMap, child.ID)\n if (parameters.emissiveMap !== undefined) {\n if ('colorSpace' in parameters.emissiveMap) parameters.emissiveMap.colorSpace = 'srgb'\n else parameters.emissiveMap.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'NormalMap':\n case 'Maya|TEX_normal_map':\n parameters.normalMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'ReflectionColor':\n parameters.envMap = scope.getTexture(textureMap, child.ID)\n if (parameters.envMap !== undefined) {\n parameters.envMap.mapping = EquirectangularReflectionMapping\n\n if ('colorSpace' in parameters.envMap) parameters.envMap.colorSpace = 'srgb'\n else parameters.envMap.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'SpecularColor':\n parameters.specularMap = scope.getTexture(textureMap, child.ID)\n if (parameters.specularMap !== undefined) {\n if ('colorSpace' in parameters.specularMap) parameters.specularMap.colorSpace = 'srgb'\n else parameters.specularMap.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'TransparentColor':\n case 'TransparencyFactor':\n parameters.alphaMap = scope.getTexture(textureMap, child.ID)\n parameters.transparent = true\n break\n\n case 'AmbientColor':\n case 'ShininessExponent': // AKA glossiness map\n case 'SpecularFactor': // AKA specularLevel\n case 'VectorDisplacementColor': // NOTE: Seems to be a copy of DisplacementColor\n default:\n console.warn('THREE.FBXLoader: %s map is not supported in three.js, skipping texture.', type)\n break\n }\n })\n\n return parameters\n }\n\n // get a texture from the textureMap for use by a material.\n getTexture(textureMap, id) {\n // if the texture is a layered texture, just use the first layer and issue a warning\n if ('LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture) {\n console.warn('THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.')\n id = connections.get(id).children[0].ID\n }\n\n return textureMap.get(id)\n }\n\n // Parse nodes in FBXTree.Objects.Deformer\n // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here\n // Generates map of Skeleton-like objects for use later when generating and binding skeletons.\n parseDeformers() {\n const skeletons = {}\n const morphTargets = {}\n\n if ('Deformer' in fbxTree.Objects) {\n const DeformerNodes = fbxTree.Objects.Deformer\n\n for (const nodeID in DeformerNodes) {\n const deformerNode = DeformerNodes[nodeID]\n\n const relationships = connections.get(parseInt(nodeID))\n\n if (deformerNode.attrType === 'Skin') {\n const skeleton = this.parseSkeleton(relationships, DeformerNodes)\n skeleton.ID = nodeID\n\n if (relationships.parents.length > 1) {\n console.warn('THREE.FBXLoader: skeleton attached to more than one geometry is not supported.')\n }\n skeleton.geometryID = relationships.parents[0].ID\n\n skeletons[nodeID] = skeleton\n } else if (deformerNode.attrType === 'BlendShape') {\n const morphTarget = {\n id: nodeID,\n }\n\n morphTarget.rawTargets = this.parseMorphTargets(relationships, DeformerNodes)\n morphTarget.id = nodeID\n\n if (relationships.parents.length > 1) {\n console.warn('THREE.FBXLoader: morph target attached to more than one geometry is not supported.')\n }\n\n morphTargets[nodeID] = morphTarget\n }\n }\n }\n\n return {\n skeletons: skeletons,\n morphTargets: morphTargets,\n }\n }\n\n // Parse single nodes in FBXTree.Objects.Deformer\n // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'\n // Each skin node represents a skeleton and each cluster node represents a bone\n parseSkeleton(relationships, deformerNodes) {\n const rawBones = []\n\n relationships.children.forEach(function (child) {\n const boneNode = deformerNodes[child.ID]\n\n if (boneNode.attrType !== 'Cluster') return\n\n const rawBone = {\n ID: child.ID,\n indices: [],\n weights: [],\n transformLink: new Matrix4().fromArray(boneNode.TransformLink.a),\n // transform: new Matrix4().fromArray( boneNode.Transform.a ),\n // linkMode: boneNode.Mode,\n }\n\n if ('Indexes' in boneNode) {\n rawBone.indices = boneNode.Indexes.a\n rawBone.weights = boneNode.Weights.a\n }\n\n rawBones.push(rawBone)\n })\n\n return {\n rawBones: rawBones,\n bones: [],\n }\n }\n\n // The top level morph deformer node has type \"BlendShape\" and sub nodes have type \"BlendShapeChannel\"\n parseMorphTargets(relationships, deformerNodes) {\n const rawMorphTargets = []\n\n for (let i = 0; i < relationships.children.length; i++) {\n const child = relationships.children[i]\n\n const morphTargetNode = deformerNodes[child.ID]\n\n const rawMorphTarget = {\n name: morphTargetNode.attrName,\n initialWeight: morphTargetNode.DeformPercent,\n id: morphTargetNode.id,\n fullWeights: morphTargetNode.FullWeights.a,\n }\n\n if (morphTargetNode.attrType !== 'BlendShapeChannel') return\n\n rawMorphTarget.geoID = connections.get(parseInt(child.ID)).children.filter(function (child) {\n return child.relationship === undefined\n })[0].ID\n\n rawMorphTargets.push(rawMorphTarget)\n }\n\n return rawMorphTargets\n }\n\n // create the main Group() to be returned by the loader\n parseScene(deformers, geometryMap, materialMap) {\n sceneGraph = new Group()\n\n const modelMap = this.parseModels(deformers.skeletons, geometryMap, materialMap)\n\n const modelNodes = fbxTree.Objects.Model\n\n const scope = this\n modelMap.forEach(function (model) {\n const modelNode = modelNodes[model.ID]\n scope.setLookAtProperties(model, modelNode)\n\n const parentConnections = connections.get(model.ID).parents\n\n parentConnections.forEach(function (connection) {\n const parent = modelMap.get(connection.ID)\n if (parent !== undefined) parent.add(model)\n })\n\n if (model.parent === null) {\n sceneGraph.add(model)\n }\n })\n\n this.bindSkeleton(deformers.skeletons, geometryMap, modelMap)\n\n this.createAmbientLight()\n\n sceneGraph.traverse(function (node) {\n if (node.userData.transformData) {\n if (node.parent) {\n node.userData.transformData.parentMatrix = node.parent.matrix\n node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld\n }\n\n const transform = generateTransform(node.userData.transformData)\n\n node.applyMatrix4(transform)\n node.updateWorldMatrix()\n }\n })\n\n const animations = new AnimationParser().parse()\n\n // if all the models where already combined in a single group, just return that\n if (sceneGraph.children.length === 1 && sceneGraph.children[0].isGroup) {\n sceneGraph.children[0].animations = animations\n sceneGraph = sceneGraph.children[0]\n }\n\n sceneGraph.animations = animations\n }\n\n // parse nodes in FBXTree.Objects.Model\n parseModels(skeletons, geometryMap, materialMap) {\n const modelMap = new Map()\n const modelNodes = fbxTree.Objects.Model\n\n for (const nodeID in modelNodes) {\n const id = parseInt(nodeID)\n const node = modelNodes[nodeID]\n const relationships = connections.get(id)\n\n let model = this.buildSkeleton(relationships, skeletons, id, node.attrName)\n\n if (!model) {\n switch (node.attrType) {\n case 'Camera':\n model = this.createCamera(relationships)\n break\n case 'Light':\n model = this.createLight(relationships)\n break\n case 'Mesh':\n model = this.createMesh(relationships, geometryMap, materialMap)\n break\n case 'NurbsCurve':\n model = this.createCurve(relationships, geometryMap)\n break\n case 'LimbNode':\n case 'Root':\n model = new Bone()\n break\n case 'Null':\n default:\n model = new Group()\n break\n }\n\n model.name = node.attrName ? PropertyBinding.sanitizeNodeName(node.attrName) : ''\n\n model.ID = id\n }\n\n this.getTransformData(model, node)\n modelMap.set(id, model)\n }\n\n return modelMap\n }\n\n buildSkeleton(relationships, skeletons, id, name) {\n let bone = null\n\n relationships.parents.forEach(function (parent) {\n for (const ID in skeletons) {\n const skeleton = skeletons[ID]\n\n skeleton.rawBones.forEach(function (rawBone, i) {\n if (rawBone.ID === parent.ID) {\n const subBone = bone\n bone = new Bone()\n\n bone.matrixWorld.copy(rawBone.transformLink)\n\n // set name and id here - otherwise in cases where \"subBone\" is created it will not have a name / id\n\n bone.name = name ? PropertyBinding.sanitizeNodeName(name) : ''\n bone.ID = id\n\n skeleton.bones[i] = bone\n\n // In cases where a bone is shared between multiple meshes\n // duplicate the bone here and and it as a child of the first bone\n if (subBone !== null) {\n bone.add(subBone)\n }\n }\n })\n }\n })\n\n return bone\n }\n\n // create a PerspectiveCamera or OrthographicCamera\n createCamera(relationships) {\n let model\n let cameraAttribute\n\n relationships.children.forEach(function (child) {\n const attr = fbxTree.Objects.NodeAttribute[child.ID]\n\n if (attr !== undefined) {\n cameraAttribute = attr\n }\n })\n\n if (cameraAttribute === undefined) {\n model = new Object3D()\n } else {\n let type = 0\n if (cameraAttribute.CameraProjectionType !== undefined && cameraAttribute.CameraProjectionType.value === 1) {\n type = 1\n }\n\n let nearClippingPlane = 1\n if (cameraAttribute.NearPlane !== undefined) {\n nearClippingPlane = cameraAttribute.NearPlane.value / 1000\n }\n\n let farClippingPlane = 1000\n if (cameraAttribute.FarPlane !== undefined) {\n farClippingPlane = cameraAttribute.FarPlane.value / 1000\n }\n\n let width = window.innerWidth\n let height = window.innerHeight\n\n if (cameraAttribute.AspectWidth !== undefined && cameraAttribute.AspectHeight !== undefined) {\n width = cameraAttribute.AspectWidth.value\n height = cameraAttribute.AspectHeight.value\n }\n\n const aspect = width / height\n\n let fov = 45\n if (cameraAttribute.FieldOfView !== undefined) {\n fov = cameraAttribute.FieldOfView.value\n }\n\n const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null\n\n switch (type) {\n case 0: // Perspective\n model = new PerspectiveCamera(fov, aspect, nearClippingPlane, farClippingPlane)\n if (focalLength !== null) model.setFocalLength(focalLength)\n break\n\n case 1: // Orthographic\n model = new OrthographicCamera(\n -width / 2,\n width / 2,\n height / 2,\n -height / 2,\n nearClippingPlane,\n farClippingPlane,\n )\n break\n\n default:\n console.warn('THREE.FBXLoader: Unknown camera type ' + type + '.')\n model = new Object3D()\n break\n }\n }\n\n return model\n }\n\n // Create a DirectionalLight, PointLight or SpotLight\n createLight(relationships) {\n let model\n let lightAttribute\n\n relationships.children.forEach(function (child) {\n const attr = fbxTree.Objects.NodeAttribute[child.ID]\n\n if (attr !== undefined) {\n lightAttribute = attr\n }\n })\n\n if (lightAttribute === undefined) {\n model = new Object3D()\n } else {\n let type\n\n // LightType can be undefined for Point lights\n if (lightAttribute.LightType === undefined) {\n type = 0\n } else {\n type = lightAttribute.LightType.value\n }\n\n let color = 0xffffff\n\n if (lightAttribute.Color !== undefined) {\n color = new Color().fromArray(lightAttribute.Color.value)\n }\n\n let intensity = lightAttribute.Intensity === undefined ? 1 : lightAttribute.Intensity.value / 100\n\n // light disabled\n if (lightAttribute.CastLightOnObject !== undefined && lightAttribute.CastLightOnObject.value === 0) {\n intensity = 0\n }\n\n let distance = 0\n if (lightAttribute.FarAttenuationEnd !== undefined) {\n if (lightAttribute.EnableFarAttenuation !== undefined && lightAttribute.EnableFarAttenuation.value === 0) {\n distance = 0\n } else {\n distance = lightAttribute.FarAttenuationEnd.value\n }\n }\n\n // TODO: could this be calculated linearly from FarAttenuationStart to FarAttenuationEnd?\n const decay = 1\n\n switch (type) {\n case 0: // Point\n model = new PointLight(color, intensity, distance, decay)\n break\n\n case 1: // Directional\n model = new DirectionalLight(color, intensity)\n break\n\n case 2: // Spot\n let angle = Math.PI / 3\n\n if (lightAttribute.InnerAngle !== undefined) {\n angle = MathUtils.degToRad(lightAttribute.InnerAngle.value)\n }\n\n let penumbra = 0\n if (lightAttribute.OuterAngle !== undefined) {\n // TODO: this is not correct - FBX calculates outer and inner angle in degrees\n // with OuterAngle > InnerAngle && OuterAngle <= Math.PI\n // while three.js uses a penumbra between (0, 1) to attenuate the inner angle\n penumbra = MathUtils.degToRad(lightAttribute.OuterAngle.value)\n penumbra = Math.max(penumbra, 1)\n }\n\n model = new SpotLight(color, intensity, distance, angle, penumbra, decay)\n break\n\n default:\n console.warn(\n 'THREE.FBXLoader: Unknown light type ' + lightAttribute.LightType.value + ', defaulting to a PointLight.',\n )\n model = new PointLight(color, intensity)\n break\n }\n\n if (lightAttribute.CastShadows !== undefined && lightAttribute.CastShadows.value === 1) {\n model.castShadow = true\n }\n }\n\n return model\n }\n\n createMesh(relationships, geometryMap, materialMap) {\n let model\n let geometry = null\n let material = null\n const materials = []\n\n // get geometry and materials(s) from connections\n relationships.children.forEach(function (child) {\n if (geometryMap.has(child.ID)) {\n geometry = geometryMap.get(child.ID)\n }\n\n if (materialMap.has(child.ID)) {\n materials.push(materialMap.get(child.ID))\n }\n })\n\n if (materials.length > 1) {\n material = materials\n } else if (materials.length > 0) {\n material = materials[0]\n } else {\n material = new MeshPhongMaterial({ color: 0xcccccc })\n materials.push(material)\n }\n\n if ('color' in geometry.attributes) {\n materials.forEach(function (material) {\n material.vertexColors = true\n })\n }\n\n if (geometry.FBX_Deformer) {\n model = new SkinnedMesh(geometry, material)\n model.normalizeSkinWeights()\n } else {\n model = new Mesh(geometry, material)\n }\n\n return model\n }\n\n createCurve(relationships, geometryMap) {\n const geometry = relationships.children.reduce(function (geo, child) {\n if (geometryMap.has(child.ID)) geo = geometryMap.get(child.ID)\n\n return geo\n }, null)\n\n // FBX does not list materials for Nurbs lines, so we'll just put our own in here.\n const material = new LineBasicMaterial({ color: 0x3300ff, linewidth: 1 })\n return new Line(geometry, material)\n }\n\n // parse the model node for transform data\n getTransformData(model, modelNode) {\n const transformData = {}\n\n if ('InheritType' in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value)\n\n if ('RotationOrder' in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value)\n else transformData.eulerOrder = 'ZYX'\n\n if ('Lcl_Translation' in modelNode) transformData.translation = modelNode.Lcl_Translation.value\n\n if ('PreRotation' in modelNode) transformData.preRotation = modelNode.PreRotation.value\n if ('Lcl_Rotation' in modelNode) transformData.rotation = modelNode.Lcl_Rotation.value\n if ('PostRotation' in modelNode) transformData.postRotation = modelNode.PostRotation.value\n\n if ('Lcl_Scaling' in modelNode) transformData.scale = modelNode.Lcl_Scaling.value\n\n if ('ScalingOffset' in modelNode) transformData.scalingOffset = modelNode.ScalingOffset.value\n if ('ScalingPivot' in modelNode) transformData.scalingPivot = modelNode.ScalingPivot.value\n\n if ('RotationOffset' in modelNode) transformData.rotationOffset = modelNode.RotationOffset.value\n if ('RotationPivot' in modelNode) transformData.rotationPivot = modelNode.RotationPivot.value\n\n model.userData.transformData = transformData\n }\n\n setLookAtProperties(model, modelNode) {\n if ('LookAtProperty' in modelNode) {\n const children = connections.get(model.ID).children\n\n children.forEach(function (child) {\n if (child.relationship === 'LookAtProperty') {\n const lookAtTarget = fbxTree.Objects.Model[child.ID]\n\n if ('Lcl_Translation' in lookAtTarget) {\n const pos = lookAtTarget.Lcl_Translation.value\n\n // DirectionalLight, SpotLight\n if (model.target !== undefined) {\n model.target.position.fromArray(pos)\n sceneGraph.add(model.target)\n } else {\n // Cameras and other Object3Ds\n\n model.lookAt(new Vector3().fromArray(pos))\n }\n }\n }\n })\n }\n }\n\n bindSkeleton(skeletons, geometryMap, modelMap) {\n const bindMatrices = this.parsePoseNodes()\n\n for (const ID in skeletons) {\n const skeleton = skeletons[ID]\n\n const parents = connections.get(parseInt(skeleton.ID)).parents\n\n parents.forEach(function (parent) {\n if (geometryMap.has(parent.ID)) {\n const geoID = parent.ID\n const geoRelationships = connections.get(geoID)\n\n geoRelationships.parents.forEach(function (geoConnParent) {\n if (modelMap.has(geoConnParent.ID)) {\n const model = modelMap.get(geoConnParent.ID)\n\n model.bind(new Skeleton(skeleton.bones), bindMatrices[geoConnParent.ID])\n }\n })\n }\n })\n }\n }\n\n parsePoseNodes() {\n const bindMatrices = {}\n\n if ('Pose' in fbxTree.Objects) {\n const BindPoseNode = fbxTree.Objects.Pose\n\n for (const nodeID in BindPoseNode) {\n if (BindPoseNode[nodeID].attrType === 'BindPose' && BindPoseNode[nodeID].NbPoseNodes > 0) {\n const poseNodes = BindPoseNode[nodeID].PoseNode\n\n if (Array.isArray(poseNodes)) {\n poseNodes.forEach(function (poseNode) {\n bindMatrices[poseNode.Node] = new Matrix4().fromArray(poseNode.Matrix.a)\n })\n } else {\n bindMatrices[poseNodes.Node] = new Matrix4().fromArray(poseNodes.Matrix.a)\n }\n }\n }\n }\n\n return bindMatrices\n }\n\n // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light\n createAmbientLight() {\n if ('GlobalSettings' in fbxTree && 'AmbientColor' in fbxTree.GlobalSettings) {\n const ambientColor = fbxTree.GlobalSettings.AmbientColor.value\n const r = ambientColor[0]\n const g = ambientColor[1]\n const b = ambientColor[2]\n\n if (r !== 0 || g !== 0 || b !== 0) {\n const color = new Color(r, g, b)\n sceneGraph.add(new AmbientLight(color, 1))\n }\n }\n }\n}\n\n// parse Geometry data from FBXTree and return map of BufferGeometries\nclass GeometryParser {\n // Parse nodes in FBXTree.Objects.Geometry\n parse(deformers) {\n const geometryMap = new Map()\n\n if ('Geometry' in fbxTree.Objects) {\n const geoNodes = fbxTree.Objects.Geometry\n\n for (const nodeID in geoNodes) {\n const relationships = connections.get(parseInt(nodeID))\n const geo = this.parseGeometry(relationships, geoNodes[nodeID], deformers)\n\n geometryMap.set(parseInt(nodeID), geo)\n }\n }\n\n return geometryMap\n }\n\n // Parse single node in FBXTree.Objects.Geometry\n parseGeometry(relationships, geoNode, deformers) {\n switch (geoNode.attrType) {\n case 'Mesh':\n return this.parseMeshGeometry(relationships, geoNode, deformers)\n break\n\n case 'NurbsCurve':\n return this.parseNurbsGeometry(geoNode)\n break\n }\n }\n\n // Parse single node mesh geometry in FBXTree.Objects.Geometry\n parseMeshGeometry(relationships, geoNode, deformers) {\n const skeletons = deformers.skeletons\n const morphTargets = []\n\n const modelNodes = relationships.parents.map(function (parent) {\n return fbxTree.Objects.Model[parent.ID]\n })\n\n // don't create geometry if it is not associated with any models\n if (modelNodes.length === 0) return\n\n const skeleton = relationships.children.reduce(function (skeleton, child) {\n if (skeletons[child.ID] !== undefined) skeleton = skeletons[child.ID]\n\n return skeleton\n }, null)\n\n relationships.children.forEach(function (child) {\n if (deformers.morphTargets[child.ID] !== undefined) {\n morphTargets.push(deformers.morphTargets[child.ID])\n }\n })\n\n // Assume one model and get the preRotation from that\n // if there is more than one model associated with the geometry this may cause problems\n const modelNode = modelNodes[0]\n\n const transformData = {}\n\n if ('RotationOrder' in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value)\n if ('InheritType' in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value)\n\n if ('GeometricTranslation' in modelNode) transformData.translation = modelNode.GeometricTranslation.value\n if ('GeometricRotation' in modelNode) transformData.rotation = modelNode.GeometricRotation.value\n if ('GeometricScaling' in modelNode) transformData.scale = modelNode.GeometricScaling.value\n\n const transform = generateTransform(transformData)\n\n return this.genGeometry(geoNode, skeleton, morphTargets, transform)\n }\n\n // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry\n genGeometry(geoNode, skeleton, morphTargets, preTransform) {\n const geo = new BufferGeometry()\n if (geoNode.attrName) geo.name = geoNode.attrName\n\n const geoInfo = this.parseGeoNode(geoNode, skeleton)\n const buffers = this.genBuffers(geoInfo)\n\n const positionAttribute = new Float32BufferAttribute(buffers.vertex, 3)\n\n positionAttribute.applyMatrix4(preTransform)\n\n geo.setAttribute('position', positionAttribute)\n\n if (buffers.colors.length > 0) {\n geo.setAttribute('color', new Float32BufferAttribute(buffers.colors, 3))\n }\n\n if (skeleton) {\n geo.setAttribute('skinIndex', new Uint16BufferAttribute(buffers.weightsIndices, 4))\n\n geo.setAttribute('skinWeight', new Float32BufferAttribute(buffers.vertexWeights, 4))\n\n // used later to bind the skeleton to the model\n geo.FBX_Deformer = skeleton\n }\n\n if (buffers.normal.length > 0) {\n const normalMatrix = new Matrix3().getNormalMatrix(preTransform)\n\n const normalAttribute = new Float32BufferAttribute(buffers.normal, 3)\n normalAttribute.applyNormalMatrix(normalMatrix)\n\n geo.setAttribute('normal', normalAttribute)\n }\n\n buffers.uvs.forEach(function (uvBuffer, i) {\n // subsequent uv buffers are called 'uv1', 'uv2', ...\n let name = 'uv' + (i + 1).toString()\n\n // the first uv buffer is just called 'uv'\n if (i === 0) {\n name = 'uv'\n }\n\n geo.setAttribute(name, new Float32BufferAttribute(buffers.uvs[i], 2))\n })\n\n if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {\n // Convert the material indices of each vertex into rendering groups on the geometry.\n let prevMaterialIndex = buffers.materialIndex[0]\n let startIndex = 0\n\n buffers.materialIndex.forEach(function (currentIndex, i) {\n if (currentIndex !== prevMaterialIndex) {\n geo.addGroup(startIndex, i - startIndex, prevMaterialIndex)\n\n prevMaterialIndex = currentIndex\n startIndex = i\n }\n })\n\n // the loop above doesn't add the last group, do that here.\n if (geo.groups.length > 0) {\n const lastGroup = geo.groups[geo.groups.length - 1]\n const lastIndex = lastGroup.start + lastGroup.count\n\n if (lastIndex !== buffers.materialIndex.length) {\n geo.addGroup(lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex)\n }\n }\n\n // case where there are multiple materials but the whole geometry is only\n // using one of them\n if (geo.groups.length === 0) {\n geo.addGroup(0, buffers.materialIndex.length, buffers.materialIndex[0])\n }\n }\n\n this.addMorphTargets(geo, geoNode, morphTargets, preTransform)\n\n return geo\n }\n\n parseGeoNode(geoNode, skeleton) {\n const geoInfo = {}\n\n geoInfo.vertexPositions = geoNode.Vertices !== undefined ? geoNode.Vertices.a : []\n geoInfo.vertexIndices = geoNode.PolygonVertexIndex !== undefined ? geoNode.PolygonVertexIndex.a : []\n\n if (geoNode.LayerElementColor) {\n geoInfo.color = this.parseVertexColors(geoNode.LayerElementColor[0])\n }\n\n if (geoNode.LayerElementMaterial) {\n geoInfo.material = this.parseMaterialIndices(geoNode.LayerElementMaterial[0])\n }\n\n if (geoNode.LayerElementNormal) {\n geoInfo.normal = this.parseNormals(geoNode.LayerElementNormal[0])\n }\n\n if (geoNode.LayerElementUV) {\n geoInfo.uv = []\n\n let i = 0\n while (geoNode.LayerElementUV[i]) {\n if (geoNode.LayerElementUV[i].UV) {\n geoInfo.uv.push(this.parseUVs(geoNode.LayerElementUV[i]))\n }\n\n i++\n }\n }\n\n geoInfo.weightTable = {}\n\n if (skeleton !== null) {\n geoInfo.skeleton = skeleton\n\n skeleton.rawBones.forEach(function (rawBone, i) {\n // loop over the bone's vertex indices and weights\n rawBone.indices.forEach(function (index, j) {\n if (geoInfo.weightTable[index] === undefined) geoInfo.weightTable[index] = []\n\n geoInfo.weightTable[index].push({\n id: i,\n weight: rawBone.weights[j],\n })\n })\n })\n }\n\n return geoInfo\n }\n\n genBuffers(geoInfo) {\n const buffers = {\n vertex: [],\n normal: [],\n colors: [],\n uvs: [],\n materialIndex: [],\n vertexWeights: [],\n weightsIndices: [],\n }\n\n let polygonIndex = 0\n let faceLength = 0\n let displayedWeightsWarning = false\n\n // these will hold data for a single face\n let facePositionIndexes = []\n let faceNormals = []\n let faceColors = []\n let faceUVs = []\n let faceWeights = []\n let faceWeightIndices = []\n\n const scope = this\n geoInfo.vertexIndices.forEach(function (vertexIndex, polygonVertexIndex) {\n let materialIndex\n let endOfFace = false\n\n // Face index and vertex index arrays are combined in a single array\n // A cube with quad faces looks like this:\n // PolygonVertexIndex: *24 {\n // a: 0, 1, 3, -3, 2, 3, 5, -5, 4, 5, 7, -7, 6, 7, 1, -1, 1, 7, 5, -4, 6, 0, 2, -5\n // }\n // Negative numbers mark the end of a face - first face here is 0, 1, 3, -3\n // to find index of last vertex bit shift the index: ^ - 1\n if (vertexIndex < 0) {\n vertexIndex = vertexIndex ^ -1 // equivalent to ( x * -1 ) - 1\n endOfFace = true\n }\n\n let weightIndices = []\n let weights = []\n\n facePositionIndexes.push(vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2)\n\n if (geoInfo.color) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color)\n\n faceColors.push(data[0], data[1], data[2])\n }\n\n if (geoInfo.skeleton) {\n if (geoInfo.weightTable[vertexIndex] !== undefined) {\n geoInfo.weightTable[vertexIndex].forEach(function (wt) {\n weights.push(wt.weight)\n weightIndices.push(wt.id)\n })\n }\n\n if (weights.length > 4) {\n if (!displayedWeightsWarning) {\n console.warn(\n 'THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.',\n )\n displayedWeightsWarning = true\n }\n\n const wIndex = [0, 0, 0, 0]\n const Weight = [0, 0, 0, 0]\n\n weights.forEach(function (weight, weightIndex) {\n let currentWeight = weight\n let currentIndex = weightIndices[weightIndex]\n\n Weight.forEach(function (comparedWeight, comparedWeightIndex, comparedWeightArray) {\n if (currentWeight > comparedWeight) {\n comparedWeightArray[comparedWeightIndex] = currentWeight\n currentWeight = comparedWeight\n\n const tmp = wIndex[comparedWeightIndex]\n wIndex[comparedWeightIndex] = currentIndex\n currentIndex = tmp\n }\n })\n })\n\n weightIndices = wIndex\n weights = Weight\n }\n\n // if the weight array is shorter than 4 pad with 0s\n while (weights.length < 4) {\n weights.push(0)\n weightIndices.push(0)\n }\n\n for (let i = 0; i < 4; ++i) {\n faceWeights.push(weights[i])\n faceWeightIndices.push(weightIndices[i])\n }\n }\n\n if (geoInfo.normal) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal)\n\n faceNormals.push(data[0], data[1], data[2])\n }\n\n if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {\n materialIndex = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material)[0]\n }\n\n if (geoInfo.uv) {\n geoInfo.uv.forEach(function (uv, i) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, uv)\n\n if (faceUVs[i] === undefined) {\n faceUVs[i] = []\n }\n\n faceUVs[i].push(data[0])\n faceUVs[i].push(data[1])\n })\n }\n\n faceLength++\n\n if (endOfFace) {\n scope.genFace(\n buffers,\n geoInfo,\n facePositionIndexes,\n materialIndex,\n faceNormals,\n faceColors,\n faceUVs,\n faceWeights,\n faceWeightIndices,\n faceLength,\n )\n\n polygonIndex++\n faceLength = 0\n\n // reset arrays for the next face\n facePositionIndexes = []\n faceNormals = []\n faceColors = []\n faceUVs = []\n faceWeights = []\n faceWeightIndices = []\n }\n })\n\n return buffers\n }\n\n // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris\n genFace(\n buffers,\n geoInfo,\n facePositionIndexes,\n materialIndex,\n faceNormals,\n faceColors,\n faceUVs,\n faceWeights,\n faceWeightIndices,\n faceLength,\n ) {\n for (let i = 2; i < faceLength; i++) {\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[0]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[1]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[2]])\n\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3 + 1]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3 + 2]])\n\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3 + 1]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3 + 2]])\n\n if (geoInfo.skeleton) {\n buffers.vertexWeights.push(faceWeights[0])\n buffers.vertexWeights.push(faceWeights[1])\n buffers.vertexWeights.push(faceWeights[2])\n buffers.vertexWeights.push(faceWeights[3])\n\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4])\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 1])\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 2])\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 3])\n\n buffers.vertexWeights.push(faceWeights[i * 4])\n buffers.vertexWeights.push(faceWeights[i * 4 + 1])\n buffers.vertexWeights.push(faceWeights[i * 4 + 2])\n buffers.vertexWeights.push(faceWeights[i * 4 + 3])\n\n buffers.weightsIndices.push(faceWeightIndices[0])\n buffers.weightsIndices.push(faceWeightIndices[1])\n buffers.weightsIndices.push(faceWeightIndices[2])\n buffers.weightsIndices.push(faceWeightIndices[3])\n\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4])\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 1])\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 2])\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 3])\n\n buffers.weightsIndices.push(faceWeightIndices[i * 4])\n buffers.weightsIndices.push(faceWeightIndices[i * 4 + 1])\n buffers.weightsIndices.push(faceWeightIndices[i * 4 + 2])\n buffers.weightsIndices.push(faceWeightIndices[i * 4 + 3])\n }\n\n if (geoInfo.color) {\n buffers.colors.push(faceColors[0])\n buffers.colors.push(faceColors[1])\n buffers.colors.push(faceColors[2])\n\n buffers.colors.push(faceColors[(i - 1) * 3])\n buffers.colors.push(faceColors[(i - 1) * 3 + 1])\n buffers.colors.push(faceColors[(i - 1) * 3 + 2])\n\n buffers.colors.push(faceColors[i * 3])\n buffers.colors.push(faceColors[i * 3 + 1])\n buffers.colors.push(faceColors[i * 3 + 2])\n }\n\n if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {\n buffers.materialIndex.push(materialIndex)\n buffers.materialIndex.push(materialIndex)\n buffers.materialIndex.push(materialIndex)\n }\n\n if (geoInfo.normal) {\n buffers.normal.push(faceNormals[0])\n buffers.normal.push(faceNormals[1])\n buffers.normal.push(faceNormals[2])\n\n buffers.normal.push(faceNormals[(i - 1) * 3])\n buffers.normal.push(faceNormals[(i - 1) * 3 + 1])\n buffers.normal.push(faceNormals[(i - 1) * 3 + 2])\n\n buffers.normal.push(faceNormals[i * 3])\n buffers.normal.push(faceNormals[i * 3 + 1])\n buffers.normal.push(faceNormals[i * 3 + 2])\n }\n\n if (geoInfo.uv) {\n geoInfo.uv.forEach(function (uv, j) {\n if (buffers.uvs[j] === undefined) buffers.uvs[j] = []\n\n buffers.uvs[j].push(faceUVs[j][0])\n buffers.uvs[j].push(faceUVs[j][1])\n\n buffers.uvs[j].push(faceUVs[j][(i - 1) * 2])\n buffers.uvs[j].push(faceUVs[j][(i - 1) * 2 + 1])\n\n buffers.uvs[j].push(faceUVs[j][i * 2])\n buffers.uvs[j].push(faceUVs[j][i * 2 + 1])\n })\n }\n }\n }\n\n addMorphTargets(parentGeo, parentGeoNode, morphTargets, preTransform) {\n if (morphTargets.length === 0) return\n\n parentGeo.morphTargetsRelative = true\n\n parentGeo.morphAttributes.position = []\n // parentGeo.morphAttributes.normal = []; // not implemented\n\n const scope = this\n morphTargets.forEach(function (morphTarget) {\n morphTarget.rawTargets.forEach(function (rawTarget) {\n const morphGeoNode = fbxTree.Objects.Geometry[rawTarget.geoID]\n\n if (morphGeoNode !== undefined) {\n scope.genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name)\n }\n })\n })\n }\n\n // a morph geometry node is similar to a standard node, and the node is also contained\n // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal\n // and a special attribute Index defining which vertices of the original geometry are affected\n // Normal and position attributes only have data for the vertices that are affected by the morph\n genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, name) {\n const vertexIndices = parentGeoNode.PolygonVertexIndex !== undefined ? parentGeoNode.PolygonVertexIndex.a : []\n\n const morphPositionsSparse = morphGeoNode.Vertices !== undefined ? morphGeoNode.Vertices.a : []\n const indices = morphGeoNode.Indexes !== undefined ? morphGeoNode.Indexes.a : []\n\n const length = parentGeo.attributes.position.count * 3\n const morphPositions = new Float32Array(length)\n\n for (let i = 0; i < indices.length; i++) {\n const morphIndex = indices[i] * 3\n\n morphPositions[morphIndex] = morphPositionsSparse[i * 3]\n morphPositions[morphIndex + 1] = morphPositionsSparse[i * 3 + 1]\n morphPositions[morphIndex + 2] = morphPositionsSparse[i * 3 + 2]\n }\n\n // TODO: add morph normal support\n const morphGeoInfo = {\n vertexIndices: vertexIndices,\n vertexPositions: morphPositions,\n }\n\n const morphBuffers = this.genBuffers(morphGeoInfo)\n\n const positionAttribute = new Float32BufferAttribute(morphBuffers.vertex, 3)\n positionAttribute.name = name || morphGeoNode.attrName\n\n positionAttribute.applyMatrix4(preTransform)\n\n parentGeo.morphAttributes.position.push(positionAttribute)\n }\n\n // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists\n parseNormals(NormalNode) {\n const mappingType = NormalNode.MappingInformationType\n const referenceType = NormalNode.ReferenceInformationType\n const buffer = NormalNode.Normals.a\n let indexBuffer = []\n if (referenceType === 'IndexToDirect') {\n if ('NormalIndex' in NormalNode) {\n indexBuffer = NormalNode.NormalIndex.a\n } else if ('NormalsIndex' in NormalNode) {\n indexBuffer = NormalNode.NormalsIndex.a\n }\n }\n\n return {\n dataSize: 3,\n buffer: buffer,\n indices: indexBuffer,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists\n parseUVs(UVNode) {\n const mappingType = UVNode.MappingInformationType\n const referenceType = UVNode.ReferenceInformationType\n const buffer = UVNode.UV.a\n let indexBuffer = []\n if (referenceType === 'IndexToDirect') {\n indexBuffer = UVNode.UVIndex.a\n }\n\n return {\n dataSize: 2,\n buffer: buffer,\n indices: indexBuffer,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists\n parseVertexColors(ColorNode) {\n const mappingType = ColorNode.MappingInformationType\n const referenceType = ColorNode.ReferenceInformationType\n const buffer = ColorNode.Colors.a\n let indexBuffer = []\n if (referenceType === 'IndexToDirect') {\n indexBuffer = ColorNode.ColorIndex.a\n }\n\n return {\n dataSize: 4,\n buffer: buffer,\n indices: indexBuffer,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists\n parseMaterialIndices(MaterialNode) {\n const mappingType = MaterialNode.MappingInformationType\n const referenceType = MaterialNode.ReferenceInformationType\n\n if (mappingType === 'NoMappingInformation') {\n return {\n dataSize: 1,\n buffer: [0],\n indices: [0],\n mappingType: 'AllSame',\n referenceType: referenceType,\n }\n }\n\n const materialIndexBuffer = MaterialNode.Materials.a\n\n // Since materials are stored as indices, there's a bit of a mismatch between FBX and what\n // we expect.So we create an intermediate buffer that points to the index in the buffer,\n // for conforming with the other functions we've written for other data.\n const materialIndices = []\n\n for (let i = 0; i < materialIndexBuffer.length; ++i) {\n materialIndices.push(i)\n }\n\n return {\n dataSize: 1,\n buffer: materialIndexBuffer,\n indices: materialIndices,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry\n parseNurbsGeometry(geoNode) {\n if (NURBSCurve === undefined) {\n console.error(\n 'THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.',\n )\n return new BufferGeometry()\n }\n\n const order = parseInt(geoNode.Order)\n\n if (isNaN(order)) {\n console.error('THREE.FBXLoader: Invalid Order %s given for geometry ID: %s', geoNode.Order, geoNode.id)\n return new BufferGeometry()\n }\n\n const degree = order - 1\n\n const knots = geoNode.KnotVector.a\n const controlPoints = []\n const pointsValues = geoNode.Points.a\n\n for (let i = 0, l = pointsValues.length; i < l; i += 4) {\n controlPoints.push(new Vector4().fromArray(pointsValues, i))\n }\n\n let startKnot, endKnot\n\n if (geoNode.Form === 'Closed') {\n controlPoints.push(controlPoints[0])\n } else if (geoNode.Form === 'Periodic') {\n startKnot = degree\n endKnot = knots.length - 1 - startKnot\n\n for (let i = 0; i < degree; ++i) {\n controlPoints.push(controlPoints[i])\n }\n }\n\n const curve = new NURBSCurve(degree, knots, controlPoints, startKnot, endKnot)\n const points = curve.getPoints(controlPoints.length * 12)\n\n return new BufferGeometry().setFromPoints(points)\n }\n}\n\n// parse animation data from FBXTree\nclass AnimationParser {\n // take raw animation clips and turn them into three.js animation clips\n parse() {\n const animationClips = []\n\n const rawClips = this.parseClips()\n\n if (rawClips !== undefined) {\n for (const key in rawClips) {\n const rawClip = rawClips[key]\n\n const clip = this.addClip(rawClip)\n\n animationClips.push(clip)\n }\n }\n\n return animationClips\n }\n\n parseClips() {\n // since the actual transformation data is stored in FBXTree.Objects.AnimationCurve,\n // if this is undefined we can safely assume there are no animations\n if (fbxTree.Objects.AnimationCurve === undefined) return undefined\n\n const curveNodesMap = this.parseAnimationCurveNodes()\n\n this.parseAnimationCurves(curveNodesMap)\n\n const layersMap = this.parseAnimationLayers(curveNodesMap)\n const rawClips = this.parseAnimStacks(layersMap)\n\n return rawClips\n }\n\n // parse nodes in FBXTree.Objects.AnimationCurveNode\n // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )\n // and is referenced by an AnimationLayer\n parseAnimationCurveNodes() {\n const rawCurveNodes = fbxTree.Objects.AnimationCurveNode\n\n const curveNodesMap = new Map()\n\n for (const nodeID in rawCurveNodes) {\n const rawCurveNode = rawCurveNodes[nodeID]\n\n if (rawCurveNode.attrName.match(/S|R|T|DeformPercent/) !== null) {\n const curveNode = {\n id: rawCurveNode.id,\n attr: rawCurveNode.attrName,\n curves: {},\n }\n\n curveNodesMap.set(curveNode.id, curveNode)\n }\n }\n\n return curveNodesMap\n }\n\n // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to\n // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated\n // axis ( e.g. times and values of x rotation)\n parseAnimationCurves(curveNodesMap) {\n const rawCurves = fbxTree.Objects.AnimationCurve\n\n // TODO: Many values are identical up to roundoff error, but won't be optimised\n // e.g. position times: [0, 0.4, 0. 8]\n // position values: [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.235384487103147e-7, 93.67520904541016, -0.9982695579528809]\n // clearly, this should be optimised to\n // times: [0], positions [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809]\n // this shows up in nearly every FBX file, and generally time array is length > 100\n\n for (const nodeID in rawCurves) {\n const animationCurve = {\n id: rawCurves[nodeID].id,\n times: rawCurves[nodeID].KeyTime.a.map(convertFBXTimeToSeconds),\n values: rawCurves[nodeID].KeyValueFloat.a,\n }\n\n const relationships = connections.get(animationCurve.id)\n\n if (relationships !== undefined) {\n const animationCurveID = relationships.parents[0].ID\n const animationCurveRelationship = relationships.parents[0].relationship\n\n if (animationCurveRelationship.match(/X/)) {\n curveNodesMap.get(animationCurveID).curves['x'] = animationCurve\n } else if (animationCurveRelationship.match(/Y/)) {\n curveNodesMap.get(animationCurveID).curves['y'] = animationCurve\n } else if (animationCurveRelationship.match(/Z/)) {\n curveNodesMap.get(animationCurveID).curves['z'] = animationCurve\n } else if (animationCurveRelationship.match(/d|DeformPercent/) && curveNodesMap.has(animationCurveID)) {\n curveNodesMap.get(animationCurveID).curves['morph'] = animationCurve\n }\n }\n }\n }\n\n // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references\n // to various AnimationCurveNodes and is referenced by an AnimationStack node\n // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack\n parseAnimationLayers(curveNodesMap) {\n const rawLayers = fbxTree.Objects.AnimationLayer\n\n const layersMap = new Map()\n\n for (const nodeID in rawLayers) {\n const layerCurveNodes = []\n\n const connection = connections.get(parseInt(nodeID))\n\n if (connection !== undefined) {\n // all the animationCurveNodes used in the layer\n const children = connection.children\n\n children.forEach(function (child, i) {\n if (curveNodesMap.has(child.ID)) {\n const curveNode = curveNodesMap.get(child.ID)\n\n // check that the curves are defined for at least one axis, otherwise ignore the curveNode\n if (\n curveNode.curves.x !== undefined ||\n curveNode.curves.y !== undefined ||\n curveNode.curves.z !== undefined\n ) {\n if (layerCurveNodes[i] === undefined) {\n const modelID = connections.get(child.ID).parents.filter(function (parent) {\n return parent.relationship !== undefined\n })[0].ID\n\n if (modelID !== undefined) {\n const rawModel = fbxTree.Objects.Model[modelID.toString()]\n\n if (rawModel === undefined) {\n console.warn('THREE.FBXLoader: Encountered a unused curve.', child)\n return\n }\n\n const node = {\n modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : '',\n ID: rawModel.id,\n initialPosition: [0, 0, 0],\n initialRotation: [0, 0, 0],\n initialScale: [1, 1, 1],\n }\n\n sceneGraph.traverse(function (child) {\n if (child.ID === rawModel.id) {\n node.transform = child.matrix\n\n if (child.userData.transformData) node.eulerOrder = child.userData.transformData.eulerOrder\n }\n })\n\n if (!node.transform) node.transform = new Matrix4()\n\n // if the animated model is pre rotated, we'll have to apply the pre rotations to every\n // animation value as well\n if ('PreRotation' in rawModel) node.preRotation = rawModel.PreRotation.value\n if ('PostRotation' in rawModel) node.postRotation = rawModel.PostRotation.value\n\n layerCurveNodes[i] = node\n }\n }\n\n if (layerCurveNodes[i]) layerCurveNodes[i][curveNode.attr] = curveNode\n } else if (curveNode.curves.morph !== undefined) {\n if (layerCurveNodes[i] === undefined) {\n const deformerID = connections.get(child.ID).parents.filter(function (parent) {\n return parent.relationship !== undefined\n })[0].ID\n\n const morpherID = connections.get(deformerID).parents[0].ID\n const geoID = connections.get(morpherID).parents[0].ID\n\n // assuming geometry is not used in more than one model\n const modelID = connections.get(geoID).parents[0].ID\n\n const rawModel = fbxTree.Objects.Model[modelID]\n\n const node = {\n modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : '',\n morphName: fbxTree.Objects.Deformer[deformerID].attrName,\n }\n\n layerCurveNodes[i] = node\n }\n\n layerCurveNodes[i][curveNode.attr] = curveNode\n }\n }\n })\n\n layersMap.set(parseInt(nodeID), layerCurveNodes)\n }\n }\n\n return layersMap\n }\n\n // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation\n // hierarchy. Each Stack node will be used to create a AnimationClip\n parseAnimStacks(layersMap) {\n const rawStacks = fbxTree.Objects.AnimationStack\n\n // connect the stacks (clips) up to the layers\n const rawClips = {}\n\n for (const nodeID in rawStacks) {\n const children = connections.get(parseInt(nodeID)).children\n\n if (children.length > 1) {\n // it seems like stacks will always be associated with a single layer. But just in case there are files\n // where there are multiple layers per stack, we'll display a warning\n console.warn(\n 'THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.',\n )\n }\n\n const layer = layersMap.get(children[0].ID)\n\n rawClips[nodeID] = {\n name: rawStacks[nodeID].attrName,\n layer: layer,\n }\n }\n\n return rawClips\n }\n\n addClip(rawClip) {\n let tracks = []\n\n const scope = this\n rawClip.layer.forEach(function (rawTracks) {\n tracks = tracks.concat(scope.generateTracks(rawTracks))\n })\n\n return new AnimationClip(rawClip.name, -1, tracks)\n }\n\n generateTracks(rawTracks) {\n const tracks = []\n\n let initialPosition = new Vector3()\n let initialRotation = new Quaternion()\n let initialScale = new Vector3()\n\n if (rawTracks.transform) rawTracks.transform.decompose(initialPosition, initialRotation, initialScale)\n\n initialPosition = initialPosition.toArray()\n initialRotation = new Euler().setFromQuaternion(initialRotation, rawTracks.eulerOrder).toArray()\n initialScale = initialScale.toArray()\n\n if (rawTracks.T !== undefined && Object.keys(rawTracks.T.curves).length > 0) {\n const positionTrack = this.generateVectorTrack(\n rawTracks.modelName,\n rawTracks.T.curves,\n initialPosition,\n 'position',\n )\n if (positionTrack !== undefined) tracks.push(positionTrack)\n }\n\n if (rawTracks.R !== undefined && Object.keys(rawTracks.R.curves).length > 0) {\n const rotationTrack = this.generateRotationTrack(\n rawTracks.modelName,\n rawTracks.R.curves,\n initialRotation,\n rawTracks.preRotation,\n rawTracks.postRotation,\n rawTracks.eulerOrder,\n )\n if (rotationTrack !== undefined) tracks.push(rotationTrack)\n }\n\n if (rawTracks.S !== undefined && Object.keys(rawTracks.S.curves).length > 0) {\n const scaleTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.S.curves, initialScale, 'scale')\n if (scaleTrack !== undefined) tracks.push(scaleTrack)\n }\n\n if (rawTracks.DeformPercent !== undefined) {\n const morphTrack = this.generateMorphTrack(rawTracks)\n if (morphTrack !== undefined) tracks.push(morphTrack)\n }\n\n return tracks\n }\n\n generateVectorTrack(modelName, curves, initialValue, type) {\n const times = this.getTimesForAllAxes(curves)\n const values = this.getKeyframeTrackValues(times, curves, initialValue)\n\n return new VectorKeyframeTrack(modelName + '.' + type, times, values)\n }\n\n generateRotationTrack(modelName, curves, initialValue, preRotation, postRotation, eulerOrder) {\n if (curves.x !== undefined) {\n this.interpolateRotations(curves.x)\n curves.x.values = curves.x.values.map(MathUtils.degToRad)\n }\n\n if (curves.y !== undefined) {\n this.interpolateRotations(curves.y)\n curves.y.values = curves.y.values.map(MathUtils.degToRad)\n }\n\n if (curves.z !== undefined) {\n this.interpolateRotations(curves.z)\n curves.z.values = curves.z.values.map(MathUtils.degToRad)\n }\n\n const times = this.getTimesForAllAxes(curves)\n const values = this.getKeyframeTrackValues(times, curves, initialValue)\n\n if (preRotation !== undefined) {\n preRotation = preRotation.map(MathUtils.degToRad)\n preRotation.push(eulerOrder)\n\n preRotation = new Euler().fromArray(preRotation)\n preRotation = new Quaternion().setFromEuler(preRotation)\n }\n\n if (postRotation !== undefined) {\n postRotation = postRotation.map(MathUtils.degToRad)\n postRotation.push(eulerOrder)\n\n postRotation = new Euler().fromArray(postRotation)\n postRotation = new Quaternion().setFromEuler(postRotation).invert()\n }\n\n const quaternion = new Quaternion()\n const euler = new Euler()\n\n const quaternionValues = []\n\n for (let i = 0; i < values.length; i += 3) {\n euler.set(values[i], values[i + 1], values[i + 2], eulerOrder)\n\n quaternion.setFromEuler(euler)\n\n if (preRotation !== undefined) quaternion.premultiply(preRotation)\n if (postRotation !== undefined) quaternion.multiply(postRotation)\n\n quaternion.toArray(quaternionValues, (i / 3) * 4)\n }\n\n return new QuaternionKeyframeTrack(modelName + '.quaternion', times, quaternionValues)\n }\n\n generateMorphTrack(rawTracks) {\n const curves = rawTracks.DeformPercent.curves.morph\n const values = curves.values.map(function (val) {\n return val / 100\n })\n\n const morphNum = sceneGraph.getObjectByName(rawTracks.modelName).morphTargetDictionary[rawTracks.morphName]\n\n return new NumberKeyframeTrack(\n rawTracks.modelName + '.morphTargetInfluences[' + morphNum + ']',\n curves.times,\n values,\n )\n }\n\n // For all animated objects, times are defined separately for each axis\n // Here we'll combine the times into one sorted array without duplicates\n getTimesForAllAxes(curves) {\n let times = []\n\n // first join together the times for each axis, if defined\n if (curves.x !== undefined) times = times.concat(curves.x.times)\n if (curves.y !== undefined) times = times.concat(curves.y.times)\n if (curves.z !== undefined) times = times.concat(curves.z.times)\n\n // then sort them\n times = times.sort(function (a, b) {\n return a - b\n })\n\n // and remove duplicates\n if (times.length > 1) {\n let targetIndex = 1\n let lastValue = times[0]\n for (let i = 1; i < times.length; i++) {\n const currentValue = times[i]\n if (currentValue !== lastValue) {\n times[targetIndex] = currentValue\n lastValue = currentValue\n targetIndex++\n }\n }\n\n times = times.slice(0, targetIndex)\n }\n\n return times\n }\n\n getKeyframeTrackValues(times, curves, initialValue) {\n const prevValue = initialValue\n\n const values = []\n\n let xIndex = -1\n let yIndex = -1\n let zIndex = -1\n\n times.forEach(function (time) {\n if (curves.x) xIndex = curves.x.times.indexOf(time)\n if (curves.y) yIndex = curves.y.times.indexOf(time)\n if (curves.z) zIndex = curves.z.times.indexOf(time)\n\n // if there is an x value defined for this frame, use that\n if (xIndex !== -1) {\n const xValue = curves.x.values[xIndex]\n values.push(xValue)\n prevValue[0] = xValue\n } else {\n // otherwise use the x value from the previous frame\n values.push(prevValue[0])\n }\n\n if (yIndex !== -1) {\n const yValue = curves.y.values[yIndex]\n values.push(yValue)\n prevValue[1] = yValue\n } else {\n values.push(prevValue[1])\n }\n\n if (zIndex !== -1) {\n const zValue = curves.z.values[zIndex]\n values.push(zValue)\n prevValue[2] = zValue\n } else {\n values.push(prevValue[2])\n }\n })\n\n return values\n }\n\n // Rotations are defined as Euler angles which can have values of any size\n // These will be converted to quaternions which don't support values greater than\n // PI, so we'll interpolate large rotations\n interpolateRotations(curve) {\n for (let i = 1; i < curve.values.length; i++) {\n const initialValue = curve.values[i - 1]\n const valuesSpan = curve.values[i] - initialValue\n\n const absoluteSpan = Math.abs(valuesSpan)\n\n if (absoluteSpan >= 180) {\n const numSubIntervals = absoluteSpan / 180\n\n const step = valuesSpan / numSubIntervals\n let nextValue = initialValue + step\n\n const initialTime = curve.times[i - 1]\n const timeSpan = curve.times[i] - initialTime\n const interval = timeSpan / numSubIntervals\n let nextTime = initialTime + interval\n\n const interpolatedTimes = []\n const interpolatedValues = []\n\n while (nextTime < curve.times[i]) {\n interpolatedTimes.push(nextTime)\n nextTime += interval\n\n interpolatedValues.push(nextValue)\n nextValue += step\n }\n\n curve.times = inject(curve.times, i, interpolatedTimes)\n curve.values = inject(curve.values, i, interpolatedValues)\n }\n }\n }\n}\n\n// parse an FBX file in ASCII format\nclass TextParser {\n getPrevNode() {\n return this.nodeStack[this.currentIndent - 2]\n }\n\n getCurrentNode() {\n return this.nodeStack[this.currentIndent - 1]\n }\n\n getCurrentProp() {\n return this.currentProp\n }\n\n pushStack(node) {\n this.nodeStack.push(node)\n this.currentIndent += 1\n }\n\n popStack() {\n this.nodeStack.pop()\n this.currentIndent -= 1\n }\n\n setCurrentProp(val, name) {\n this.currentProp = val\n this.currentPropName = name\n }\n\n parse(text) {\n this.currentIndent = 0\n\n this.allNodes = new FBXTree()\n this.nodeStack = []\n this.currentProp = []\n this.currentPropName = ''\n\n const scope = this\n\n const split = text.split(/[\\r\\n]+/)\n\n split.forEach(function (line, i) {\n const matchComment = line.match(/^[\\s\\t]*;/)\n const matchEmpty = line.match(/^[\\s\\t]*$/)\n\n if (matchComment || matchEmpty) return\n\n const matchBeginning = line.match('^\\\\t{' + scope.currentIndent + '}(\\\\w+):(.*){', '')\n const matchProperty = line.match('^\\\\t{' + scope.currentIndent + '}(\\\\w+):[\\\\s\\\\t\\\\r\\\\n](.*)')\n const matchEnd = line.match('^\\\\t{' + (scope.currentIndent - 1) + '}}')\n\n if (matchBeginning) {\n scope.parseNodeBegin(line, matchBeginning)\n } else if (matchProperty) {\n scope.parseNodeProperty(line, matchProperty, split[++i])\n } else if (matchEnd) {\n scope.popStack()\n } else if (line.match(/^[^\\s\\t}]/)) {\n // large arrays are split over multiple lines terminated with a ',' character\n // if this is encountered the line needs to be joined to the previous line\n scope.parseNodePropertyContinued(line)\n }\n })\n\n return this.allNodes\n }\n\n parseNodeBegin(line, property) {\n const nodeName = property[1].trim().replace(/^\"/, '').replace(/\"$/, '')\n\n const nodeAttrs = property[2].split(',').map(function (attr) {\n return attr.trim().replace(/^\"/, '').replace(/\"$/, '')\n })\n\n const node = { name: nodeName }\n const attrs = this.parseNodeAttr(nodeAttrs)\n\n const currentNode = this.getCurrentNode()\n\n // a top node\n if (this.currentIndent === 0) {\n this.allNodes.add(nodeName, node)\n } else {\n // a subnode\n\n // if the subnode already exists, append it\n if (nodeName in currentNode) {\n // special case Pose needs PoseNodes as an array\n if (nodeName === 'PoseNode') {\n currentNode.PoseNode.push(node)\n } else if (currentNode[nodeName].id !== undefined) {\n currentNode[nodeName] = {}\n currentNode[nodeName][currentNode[nodeName].id] = currentNode[nodeName]\n }\n\n if (attrs.id !== '') currentNode[nodeName][attrs.id] = node\n } else if (typeof attrs.id === 'number') {\n currentNode[nodeName] = {}\n currentNode[nodeName][attrs.id] = node\n } else if (nodeName !== 'Properties70') {\n if (nodeName === 'PoseNode') currentNode[nodeName] = [node]\n else currentNode[nodeName] = node\n }\n }\n\n if (typeof attrs.id === 'number') node.id = attrs.id\n if (attrs.name !== '') node.attrName = attrs.name\n if (attrs.type !== '') node.attrType = attrs.type\n\n this.pushStack(node)\n }\n\n parseNodeAttr(attrs) {\n let id = attrs[0]\n\n if (attrs[0] !== '') {\n id = parseInt(attrs[0])\n\n if (isNaN(id)) {\n id = attrs[0]\n }\n }\n\n let name = '',\n type = ''\n\n if (attrs.length > 1) {\n name = attrs[1].replace(/^(\\w+)::/, '')\n type = attrs[2]\n }\n\n return { id: id, name: name, type: type }\n }\n\n parseNodeProperty(line, property, contentLine) {\n let propName = property[1].replace(/^\"/, '').replace(/\"$/, '').trim()\n let propValue = property[2].replace(/^\"/, '').replace(/\"$/, '').trim()\n\n // for special case: base64 image data follows \"Content: ,\" line\n //\tContent: ,\n //\t \"/9j/4RDaRXhpZgAATU0A...\"\n if (propName === 'Content' && propValue === ',') {\n propValue = contentLine.replace(/\"/g, '').replace(/,$/, '').trim()\n }\n\n const currentNode = this.getCurrentNode()\n const parentName = currentNode.name\n\n if (parentName === 'Properties70') {\n this.parseNodeSpecialProperty(line, propName, propValue)\n return\n }\n\n // Connections\n if (propName === 'C') {\n const connProps = propValue.split(',').slice(1)\n const from = parseInt(connProps[0])\n const to = parseInt(connProps[1])\n\n let rest = propValue.split(',').slice(3)\n\n rest = rest.map(function (elem) {\n return elem.trim().replace(/^\"/, '')\n })\n\n propName = 'connections'\n propValue = [from, to]\n append(propValue, rest)\n\n if (currentNode[propName] === undefined) {\n currentNode[propName] = []\n }\n }\n\n // Node\n if (propName === 'Node') currentNode.id = propValue\n\n // connections\n if (propName in currentNode && Array.isArray(currentNode[propName])) {\n currentNode[propName].push(propValue)\n } else {\n if (propName !== 'a') currentNode[propName] = propValue\n else currentNode.a = propValue\n }\n\n this.setCurrentProp(currentNode, propName)\n\n // convert string to array, unless it ends in ',' in which case more will be added to it\n if (propName === 'a' && propValue.slice(-1) !== ',') {\n currentNode.a = parseNumberArray(propValue)\n }\n }\n\n parseNodePropertyContinued(line) {\n const currentNode = this.getCurrentNode()\n\n currentNode.a += line\n\n // if the line doesn't end in ',' we have reached the end of the property value\n // so convert the string to an array\n if (line.slice(-1) !== ',') {\n currentNode.a = parseNumberArray(currentNode.a)\n }\n }\n\n // parse \"Property70\"\n parseNodeSpecialProperty(line, propName, propValue) {\n // split this\n // P: \"Lcl Scaling\", \"Lcl Scaling\", \"\", \"A\",1,1,1\n // into array like below\n // [\"Lcl Scaling\", \"Lcl Scaling\", \"\", \"A\", \"1,1,1\" ]\n const props = propValue.split('\",').map(function (prop) {\n return prop.trim().replace(/^\\\"/, '').replace(/\\s/, '_')\n })\n\n const innerPropName = props[0]\n const innerPropType1 = props[1]\n const innerPropType2 = props[2]\n const innerPropFlag = props[3]\n let innerPropValue = props[4]\n\n // cast values where needed, otherwise leave as strings\n switch (innerPropType1) {\n case 'int':\n case 'enum':\n case 'bool':\n case 'ULongLong':\n case 'double':\n case 'Number':\n case 'FieldOfView':\n innerPropValue = parseFloat(innerPropValue)\n break\n\n case 'Color':\n case 'ColorRGB':\n case 'Vector3D':\n case 'Lcl_Translation':\n case 'Lcl_Rotation':\n case 'Lcl_Scaling':\n innerPropValue = parseNumberArray(innerPropValue)\n break\n }\n\n // CAUTION: these props must append to parent's parent\n this.getPrevNode()[innerPropName] = {\n type: innerPropType1,\n type2: innerPropType2,\n flag: innerPropFlag,\n value: innerPropValue,\n }\n\n this.setCurrentProp(this.getPrevNode(), innerPropName)\n }\n}\n\n// Parse an FBX file in Binary format\nclass BinaryParser {\n parse(buffer) {\n const reader = new BinaryReader(buffer)\n reader.skip(23) // skip magic 23 bytes\n\n const version = reader.getUint32()\n\n if (version < 6400) {\n throw new Error('THREE.FBXLoader: FBX version not supported, FileVersion: ' + version)\n }\n\n const allNodes = new FBXTree()\n\n while (!this.endOfContent(reader)) {\n const node = this.parseNode(reader, version)\n if (node !== null) allNodes.add(node.name, node)\n }\n\n return allNodes\n }\n\n // Check if reader has reached the end of content.\n endOfContent(reader) {\n // footer size: 160bytes + 16-byte alignment padding\n // - 16bytes: magic\n // - padding til 16-byte alignment (at least 1byte?)\n //\t(seems like some exporters embed fixed 15 or 16bytes?)\n // - 4bytes: magic\n // - 4bytes: version\n // - 120bytes: zero\n // - 16bytes: magic\n if (reader.size() % 16 === 0) {\n return ((reader.getOffset() + 160 + 16) & ~0xf) >= reader.size()\n } else {\n return reader.getOffset() + 160 + 16 >= reader.size()\n }\n }\n\n // recursively parse nodes until the end of the file is reached\n parseNode(reader, version) {\n const node = {}\n\n // The first three data sizes depends on version.\n const endOffset = version >= 7500 ? reader.getUint64() : reader.getUint32()\n const numProperties = version >= 7500 ? reader.getUint64() : reader.getUint32()\n\n version >= 7500 ? reader.getUint64() : reader.getUint32() // the returned propertyListLen is not used\n\n const nameLen = reader.getUint8()\n const name = reader.getString(nameLen)\n\n // Regards this node as NULL-record if endOffset is zero\n if (endOffset === 0) return null\n\n const propertyList = []\n\n for (let i = 0; i < numProperties; i++) {\n propertyList.push(this.parseProperty(reader))\n }\n\n // Regards the first three elements in propertyList as id, attrName, and attrType\n const id = propertyList.length > 0 ? propertyList[0] : ''\n const attrName = propertyList.length > 1 ? propertyList[1] : ''\n const attrType = propertyList.length > 2 ? propertyList[2] : ''\n\n // check if this node represents just a single property\n // like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]}\n node.singleProperty = numProperties === 1 && reader.getOffset() === endOffset ? true : false\n\n while (endOffset > reader.getOffset()) {\n const subNode = this.parseNode(reader, version)\n\n if (subNode !== null) this.parseSubNode(name, node, subNode)\n }\n\n node.propertyList = propertyList // raw property list used by parent\n\n if (typeof id === 'number') node.id = id\n if (attrName !== '') node.attrName = attrName\n if (attrType !== '') node.attrType = attrType\n if (name !== '') node.name = name\n\n return node\n }\n\n parseSubNode(name, node, subNode) {\n // special case: child node is single property\n if (subNode.singleProperty === true) {\n const value = subNode.propertyList[0]\n\n if (Array.isArray(value)) {\n node[subNode.name] = subNode\n\n subNode.a = value\n } else {\n node[subNode.name] = value\n }\n } else if (name === 'Connections' && subNode.name === 'C') {\n const array = []\n\n subNode.propertyList.forEach(function (property, i) {\n // first Connection is FBX type (OO, OP, etc.). We'll discard these\n if (i !== 0) array.push(property)\n })\n\n if (node.connections === undefined) {\n node.connections = []\n }\n\n node.connections.push(array)\n } else if (subNode.name === 'Properties70') {\n const keys = Object.keys(subNode)\n\n keys.forEach(function (key) {\n node[key] = subNode[key]\n })\n } else if (name === 'Properties70' && subNode.name === 'P') {\n let innerPropName = subNode.propertyList[0]\n let innerPropType1 = subNode.propertyList[1]\n const innerPropType2 = subNode.propertyList[2]\n const innerPropFlag = subNode.propertyList[3]\n let innerPropValue\n\n if (innerPropName.indexOf('Lcl ') === 0) innerPropName = innerPropName.replace('Lcl ', 'Lcl_')\n if (innerPropType1.indexOf('Lcl ') === 0) innerPropType1 = innerPropType1.replace('Lcl ', 'Lcl_')\n\n if (\n innerPropType1 === 'Color' ||\n innerPropType1 === 'ColorRGB' ||\n innerPropType1 === 'Vector' ||\n innerPropType1 === 'Vector3D' ||\n innerPropType1.indexOf('Lcl_') === 0\n ) {\n innerPropValue = [subNode.propertyList[4], subNode.propertyList[5], subNode.propertyList[6]]\n } else {\n innerPropValue = subNode.propertyList[4]\n }\n\n // this will be copied to parent, see above\n node[innerPropName] = {\n type: innerPropType1,\n type2: innerPropType2,\n flag: innerPropFlag,\n value: innerPropValue,\n }\n } else if (node[subNode.name] === undefined) {\n if (typeof subNode.id === 'number') {\n node[subNode.name] = {}\n node[subNode.name][subNode.id] = subNode\n } else {\n node[subNode.name] = subNode\n }\n } else {\n if (subNode.name === 'PoseNode') {\n if (!Array.isArray(node[subNode.name])) {\n node[subNode.name] = [node[subNode.name]]\n }\n\n node[subNode.name].push(subNode)\n } else if (node[subNode.name][subNode.id] === undefined) {\n node[subNode.name][subNode.id] = subNode\n }\n }\n }\n\n parseProperty(reader) {\n const type = reader.getString(1)\n let length\n\n switch (type) {\n case 'C':\n return reader.getBoolean()\n\n case 'D':\n return reader.getFloat64()\n\n case 'F':\n return reader.getFloat32()\n\n case 'I':\n return reader.getInt32()\n\n case 'L':\n return reader.getInt64()\n\n case 'R':\n length = reader.getUint32()\n return reader.getArrayBuffer(length)\n\n case 'S':\n length = reader.getUint32()\n return reader.getString(length)\n\n case 'Y':\n return reader.getInt16()\n\n case 'b':\n case 'c':\n case 'd':\n case 'f':\n case 'i':\n case 'l':\n const arrayLength = reader.getUint32()\n const encoding = reader.getUint32() // 0: non-compressed, 1: compressed\n const compressedLength = reader.getUint32()\n\n if (encoding === 0) {\n switch (type) {\n case 'b':\n case 'c':\n return reader.getBooleanArray(arrayLength)\n\n case 'd':\n return reader.getFloat64Array(arrayLength)\n\n case 'f':\n return reader.getFloat32Array(arrayLength)\n\n case 'i':\n return reader.getInt32Array(arrayLength)\n\n case 'l':\n return reader.getInt64Array(arrayLength)\n }\n }\n\n const data = unzlibSync(new Uint8Array(reader.getArrayBuffer(compressedLength)))\n const reader2 = new BinaryReader(data.buffer)\n\n switch (type) {\n case 'b':\n case 'c':\n return reader2.getBooleanArray(arrayLength)\n\n case 'd':\n return reader2.getFloat64Array(arrayLength)\n\n case 'f':\n return reader2.getFloat32Array(arrayLength)\n\n case 'i':\n return reader2.getInt32Array(arrayLength)\n\n case 'l':\n return reader2.getInt64Array(arrayLength)\n }\n\n default:\n throw new Error('THREE.FBXLoader: Unknown property type ' + type)\n }\n }\n}\n\nclass BinaryReader {\n constructor(buffer, littleEndian) {\n this.dv = new DataView(buffer)\n this.offset = 0\n this.littleEndian = littleEndian !== undefined ? littleEndian : true\n }\n\n getOffset() {\n return this.offset\n }\n\n size() {\n return this.dv.buffer.byteLength\n }\n\n skip(length) {\n this.offset += length\n }\n\n // seems like true/false representation depends on exporter.\n // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)\n // then sees LSB.\n getBoolean() {\n return (this.getUint8() & 1) === 1\n }\n\n getBooleanArray(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getBoolean())\n }\n\n return a\n }\n\n getUint8() {\n const value = this.dv.getUint8(this.offset)\n this.offset += 1\n return value\n }\n\n getInt16() {\n const value = this.dv.getInt16(this.offset, this.littleEndian)\n this.offset += 2\n return value\n }\n\n getInt32() {\n const value = this.dv.getInt32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n\n getInt32Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getInt32())\n }\n\n return a\n }\n\n getUint32() {\n const value = this.dv.getUint32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n\n // JavaScript doesn't support 64-bit integer so calculate this here\n // 1 << 32 will return 1 so using multiply operation instead here.\n // There's a possibility that this method returns wrong value if the value\n // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.\n // TODO: safely handle 64-bit integer\n getInt64() {\n let low, high\n\n if (this.littleEndian) {\n low = this.getUint32()\n high = this.getUint32()\n } else {\n high = this.getUint32()\n low = this.getUint32()\n }\n\n // calculate negative value\n if (high & 0x80000000) {\n high = ~high & 0xffffffff\n low = ~low & 0xffffffff\n\n if (low === 0xffffffff) high = (high + 1) & 0xffffffff\n\n low = (low + 1) & 0xffffffff\n\n return -(high * 0x100000000 + low)\n }\n\n return high * 0x100000000 + low\n }\n\n getInt64Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getInt64())\n }\n\n return a\n }\n\n // Note: see getInt64() comment\n getUint64() {\n let low, high\n\n if (this.littleEndian) {\n low = this.getUint32()\n high = this.getUint32()\n } else {\n high = this.getUint32()\n low = this.getUint32()\n }\n\n return high * 0x100000000 + low\n }\n\n getFloat32() {\n const value = this.dv.getFloat32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n\n getFloat32Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getFloat32())\n }\n\n return a\n }\n\n getFloat64() {\n const value = this.dv.getFloat64(this.offset, this.littleEndian)\n this.offset += 8\n return value\n }\n\n getFloat64Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getFloat64())\n }\n\n return a\n }\n\n getArrayBuffer(size) {\n const value = this.dv.buffer.slice(this.offset, this.offset + size)\n this.offset += size\n return value\n }\n\n getString(size) {\n // note: safari 9 doesn't support Uint8Array.indexOf; create intermediate array instead\n let a = []\n\n for (let i = 0; i < size; i++) {\n a[i] = this.getUint8()\n }\n\n const nullByte = a.indexOf(0)\n if (nullByte >= 0) a = a.slice(0, nullByte)\n\n return decodeText(new Uint8Array(a))\n }\n}\n\n// FBXTree holds a representation of the FBX data, returned by the TextParser ( FBX ASCII format)\n// and BinaryParser( FBX Binary format)\nclass FBXTree {\n add(key, val) {\n this[key] = val\n }\n}\n\n// ************** UTILITY FUNCTIONS **************\n\nfunction isFbxFormatBinary(buffer) {\n const CORRECT = 'Kaydara\\u0020FBX\\u0020Binary\\u0020\\u0020\\0'\n\n return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString(buffer, 0, CORRECT.length)\n}\n\nfunction isFbxFormatASCII(text) {\n const CORRECT = [\n 'K',\n 'a',\n 'y',\n 'd',\n 'a',\n 'r',\n 'a',\n '\\\\',\n 'F',\n 'B',\n 'X',\n '\\\\',\n 'B',\n 'i',\n 'n',\n 'a',\n 'r',\n 'y',\n '\\\\',\n '\\\\',\n ]\n\n let cursor = 0\n\n function read(offset) {\n const result = text[offset - 1]\n text = text.slice(cursor + offset)\n cursor++\n return result\n }\n\n for (let i = 0; i < CORRECT.length; ++i) {\n const num = read(1)\n if (num === CORRECT[i]) {\n return false\n }\n }\n\n return true\n}\n\nfunction getFbxVersion(text) {\n const versionRegExp = /FBXVersion: (\\d+)/\n const match = text.match(versionRegExp)\n\n if (match) {\n const version = parseInt(match[1])\n return version\n }\n\n throw new Error('THREE.FBXLoader: Cannot find the version number for the file given.')\n}\n\n// Converts FBX ticks into real time seconds.\nfunction convertFBXTimeToSeconds(time) {\n return time / 46186158000\n}\n\nconst dataArray = []\n\n// extracts the data from the correct position in the FBX array based on indexing type\nfunction getData(polygonVertexIndex, polygonIndex, vertexIndex, infoObject) {\n let index\n\n switch (infoObject.mappingType) {\n case 'ByPolygonVertex':\n index = polygonVertexIndex\n break\n case 'ByPolygon':\n index = polygonIndex\n break\n case 'ByVertice':\n index = vertexIndex\n break\n case 'AllSame':\n index = infoObject.indices[0]\n break\n default:\n console.warn('THREE.FBXLoader: unknown attribute mapping type ' + infoObject.mappingType)\n }\n\n if (infoObject.referenceType === 'IndexToDirect') index = infoObject.indices[index]\n\n const from = index * infoObject.dataSize\n const to = from + infoObject.dataSize\n\n return slice(dataArray, infoObject.buffer, from, to)\n}\n\nconst tempEuler = new Euler()\nconst tempVec = new Vector3()\n\n// generate transformation from FBX transform data\n// ref: https://help.autodesk.com/view/FBX/2017/ENU/?guid=__files_GUID_10CDD63C_79C1_4F2D_BB28_AD2BE65A02ED_htm\n// ref: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=cpp_ref/_transformations_2main_8cxx-example.html,topicNumber=cpp_ref__transformations_2main_8cxx_example_htmlfc10a1e1-b18d-4e72-9dc0-70d0f1959f5e\nfunction generateTransform(transformData) {\n const lTranslationM = new Matrix4()\n const lPreRotationM = new Matrix4()\n const lRotationM = new Matrix4()\n const lPostRotationM = new Matrix4()\n\n const lScalingM = new Matrix4()\n const lScalingPivotM = new Matrix4()\n const lScalingOffsetM = new Matrix4()\n const lRotationOffsetM = new Matrix4()\n const lRotationPivotM = new Matrix4()\n\n const lParentGX = new Matrix4()\n const lParentLX = new Matrix4()\n const lGlobalT = new Matrix4()\n\n const inheritType = transformData.inheritType ? transformData.inheritType : 0\n\n if (transformData.translation) lTranslationM.setPosition(tempVec.fromArray(transformData.translation))\n\n if (transformData.preRotation) {\n const array = transformData.preRotation.map(MathUtils.degToRad)\n array.push(transformData.eulerOrder)\n lPreRotationM.makeRotationFromEuler(tempEuler.fromArray(array))\n }\n\n if (transformData.rotation) {\n const array = transformData.rotation.map(MathUtils.degToRad)\n array.push(transformData.eulerOrder)\n lRotationM.makeRotationFromEuler(tempEuler.fromArray(array))\n }\n\n if (transformData.postRotation) {\n const array = transformData.postRotation.map(MathUtils.degToRad)\n array.push(transformData.eulerOrder)\n lPostRotationM.makeRotationFromEuler(tempEuler.fromArray(array))\n lPostRotationM.invert()\n }\n\n if (transformData.scale) lScalingM.scale(tempVec.fromArray(transformData.scale))\n\n // Pivots and offsets\n if (transformData.scalingOffset) lScalingOffsetM.setPosition(tempVec.fromArray(transformData.scalingOffset))\n if (transformData.scalingPivot) lScalingPivotM.setPosition(tempVec.fromArray(transformData.scalingPivot))\n if (transformData.rotationOffset) lRotationOffsetM.setPosition(tempVec.fromArray(transformData.rotationOffset))\n if (transformData.rotationPivot) lRotationPivotM.setPosition(tempVec.fromArray(transformData.rotationPivot))\n\n // parent transform\n if (transformData.parentMatrixWorld) {\n lParentLX.copy(transformData.parentMatrix)\n lParentGX.copy(transformData.parentMatrixWorld)\n }\n\n const lLRM = lPreRotationM.clone().multiply(lRotationM).multiply(lPostRotationM)\n // Global Rotation\n const lParentGRM = new Matrix4()\n lParentGRM.extractRotation(lParentGX)\n\n // Global Shear*Scaling\n const lParentTM = new Matrix4()\n lParentTM.copyPosition(lParentGX)\n\n const lParentGRSM = lParentTM.clone().invert().multiply(lParentGX)\n const lParentGSM = lParentGRM.clone().invert().multiply(lParentGRSM)\n const lLSM = lScalingM\n\n const lGlobalRS = new Matrix4()\n\n if (inheritType === 0) {\n lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM).multiply(lLSM)\n } else if (inheritType === 1) {\n lGlobalRS.copy(lParentGRM).multiply(lParentGSM).multiply(lLRM).multiply(lLSM)\n } else {\n const lParentLSM = new Matrix4().scale(new Vector3().setFromMatrixScale(lParentLX))\n const lParentLSM_inv = lParentLSM.clone().invert()\n const lParentGSM_noLocal = lParentGSM.clone().multiply(lParentLSM_inv)\n\n lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM_noLocal).multiply(lLSM)\n }\n\n const lRotationPivotM_inv = lRotationPivotM.clone().invert()\n const lScalingPivotM_inv = lScalingPivotM.clone().invert()\n // Calculate the local transform matrix\n let lTransform = lTranslationM\n .clone()\n .multiply(lRotationOffsetM)\n .multiply(lRotationPivotM)\n .multiply(lPreRotationM)\n .multiply(lRotationM)\n .multiply(lPostRotationM)\n .multiply(lRotationPivotM_inv)\n .multiply(lScalingOffsetM)\n .multiply(lScalingPivotM)\n .multiply(lScalingM)\n .multiply(lScalingPivotM_inv)\n\n const lLocalTWithAllPivotAndOffsetInfo = new Matrix4().copyPosition(lTransform)\n\n const lGlobalTranslation = lParentGX.clone().multiply(lLocalTWithAllPivotAndOffsetInfo)\n lGlobalT.copyPosition(lGlobalTranslation)\n\n lTransform = lGlobalT.clone().multiply(lGlobalRS)\n\n // from global to local\n lTransform.premultiply(lParentGX.invert())\n\n return lTransform\n}\n\n// Returns the three.js intrinsic Euler order corresponding to FBX extrinsic Euler order\n// ref: http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html\nfunction getEulerOrder(order) {\n order = order || 0\n\n const enums = [\n 'ZYX', // -> XYZ extrinsic\n 'YZX', // -> XZY extrinsic\n 'XZY', // -> YZX extrinsic\n 'ZXY', // -> YXZ extrinsic\n 'YXZ', // -> ZXY extrinsic\n 'XYZ', // -> ZYX extrinsic\n //'SphericXYZ', // not possible to support\n ]\n\n if (order === 6) {\n console.warn('THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.')\n return enums[0]\n }\n\n return enums[order]\n}\n\n// Parses comma separated list of numbers and returns them an array.\n// Used internally by the TextParser\nfunction parseNumberArray(value) {\n const array = value.split(',').map(function (val) {\n return parseFloat(val)\n })\n\n return array\n}\n\nfunction convertArrayBufferToString(buffer, from, to) {\n if (from === undefined) from = 0\n if (to === undefined) to = buffer.byteLength\n\n return decodeText(new Uint8Array(buffer, from, to))\n}\n\nfunction append(a, b) {\n for (let i = 0, j = a.length, l = b.length; i < l; i++, j++) {\n a[j] = b[i]\n }\n}\n\nfunction slice(a, b, from, to) {\n for (let i = from, j = 0; i < to; i++, j++) {\n a[j] = b[i]\n }\n\n return a\n}\n\n// inject array a2 into array a1 at index\nfunction inject(a1, index, a2) {\n return a1.slice(0, index).concat(a2).concat(a1.slice(index))\n}\n\nexport { FBXLoader }\n", "import { Loader, FileLoader, ShapePath } from 'three'\n\nimport type { LoadingManager, Shape } from 'three'\n\ntype Options = {\n lineHeight: number\n letterSpacing: number\n}\n\nexport class FontLoader extends Loader {\n constructor(manager?: LoadingManager) {\n super(manager)\n }\n\n public load(\n url: string,\n onLoad?: (responseFont: Font) => void,\n onProgress?: (event: ProgressEvent) => void,\n onError?: (event: ErrorEvent) => void,\n ): void {\n const loader = new FileLoader(this.manager)\n\n loader.setPath(this.path)\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n (response) => {\n if (typeof response !== 'string') throw new Error('unsupported data type')\n\n const json = JSON.parse(response)\n\n const font = this.parse(json)\n\n if (onLoad) onLoad(font)\n },\n onProgress,\n onError as (event: unknown) => void,\n )\n }\n\n loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise {\n // @ts-ignore\n return super.loadAsync(url, onProgress)\n }\n\n public parse(json: FontData): Font {\n return new Font(json)\n }\n}\n\ntype Glyph = {\n _cachedOutline: string[]\n ha: number\n o: string\n}\n\ntype FontData = {\n boundingBox: { yMax: number; yMin: number }\n familyName: string\n glyphs: { [k: string]: Glyph }\n resolution: number\n underlineThickness: number\n}\n\nexport class Font {\n public data: FontData\n public static isFont: true\n public static type: 'Font'\n\n constructor(data: FontData) {\n this.data = data\n }\n\n public generateShapes(text: string, size = 100, _options?: Partial): Shape[] {\n const shapes: Shape[] = []\n const options = { letterSpacing: 0, lineHeight: 1, ..._options }\n const paths = createPaths(text, size, this.data, options)\n for (let p = 0, pl = paths.length; p < pl; p++) {\n Array.prototype.push.apply(shapes, paths[p].toShapes(false))\n }\n return shapes\n }\n}\n\nfunction createPaths(text: string, size: number, data: FontData, options: Options): ShapePath[] {\n const chars = Array.from(text)\n const scale = size / data.resolution\n const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale\n\n const paths: ShapePath[] = []\n\n let offsetX = 0,\n offsetY = 0\n\n for (let i = 0; i < chars.length; i++) {\n const char = chars[i]\n\n if (char === '\\n') {\n offsetX = 0\n offsetY -= line_height * options.lineHeight\n } else {\n const ret = createPath(char, scale, offsetX, offsetY, data)\n if (ret) {\n offsetX += ret.offsetX + options.letterSpacing\n paths.push(ret.path)\n }\n }\n }\n\n return paths\n}\n\nfunction createPath(\n char: string,\n scale: number,\n offsetX: number,\n offsetY: number,\n data: FontData,\n): { offsetX: number; path: ShapePath } | undefined {\n const glyph = data.glyphs[char] || data.glyphs['?']\n\n if (!glyph) {\n console.error('THREE.Font: character \"' + char + '\" does not exists in font family ' + data.familyName + '.')\n return\n }\n\n const path = new ShapePath()\n\n let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2\n\n if (glyph.o) {\n const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' '))\n\n for (let i = 0, l = outline.length; i < l; ) {\n const action = outline[i++]\n\n switch (action) {\n case 'm': // moveTo\n x = parseInt(outline[i++]) * scale + offsetX\n y = parseInt(outline[i++]) * scale + offsetY\n\n path.moveTo(x, y)\n\n break\n\n case 'l': // lineTo\n x = parseInt(outline[i++]) * scale + offsetX\n y = parseInt(outline[i++]) * scale + offsetY\n\n path.lineTo(x, y)\n\n break\n\n case 'q': // quadraticCurveTo\n cpx = parseInt(outline[i++]) * scale + offsetX\n cpy = parseInt(outline[i++]) * scale + offsetY\n cpx1 = parseInt(outline[i++]) * scale + offsetX\n cpy1 = parseInt(outline[i++]) * scale + offsetY\n\n path.quadraticCurveTo(cpx1, cpy1, cpx, cpy)\n\n break\n\n case 'b': // bezierCurveTo\n cpx = parseInt(outline[i++]) * scale + offsetX\n cpy = parseInt(outline[i++]) * scale + offsetY\n cpx1 = parseInt(outline[i++]) * scale + offsetX\n cpy1 = parseInt(outline[i++]) * scale + offsetY\n cpx2 = parseInt(outline[i++]) * scale + offsetX\n cpy2 = parseInt(outline[i++]) * scale + offsetY\n\n path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy)\n\n break\n }\n }\n }\n\n return { offsetX: glyph.ha * scale, path }\n}\n", "import { Texture, ClampToEdgeWrapping, NearestFilter } from 'three'\n\nclass Data3DTexture extends Texture {\n constructor(data = null, width = 1, height = 1, depth = 1) {\n super(null)\n\n this.isData3DTexture = true\n\n this.image = { data, width, height, depth }\n\n this.magFilter = NearestFilter\n this.minFilter = NearestFilter\n\n this.wrapR = ClampToEdgeWrapping\n\n this.generateMipmaps = false\n this.flipY = false\n this.unpackAlignment = 1\n }\n}\n\nexport { Data3DTexture }\n", "import {\n AnimationClip,\n AnimationMixer,\n Bone,\n BufferGeometry,\n FileLoader,\n Float32BufferAttribute,\n FrontSide,\n Loader,\n LoaderUtils,\n Matrix4,\n Mesh,\n MeshPhongMaterial,\n Quaternion,\n Skeleton,\n SkinnedMesh,\n TextureLoader,\n Uint16BufferAttribute,\n Vector2,\n Vector3,\n} from 'three'\nimport { decodeText } from '../_polyfill/LoaderUtils'\n\nvar XLoader = (function () {\n var classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError('Cannot call a class as a function')\n }\n }\n\n var createClass = (function () {\n function defineProperties(target, props) {\n for (let i = 0; i < props.length; i++) {\n var descriptor = props[i]\n descriptor.enumerable = descriptor.enumerable || false\n descriptor.configurable = true\n if ('value' in descriptor) descriptor.writable = true\n Object.defineProperty(target, descriptor.key, descriptor)\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps)\n if (staticProps) defineProperties(Constructor, staticProps)\n return Constructor\n }\n })()\n\n var XboneInf = function XboneInf() {\n classCallCheck(this, XboneInf)\n\n this.boneName = ''\n this.BoneIndex = 0\n this.Indeces = []\n this.Weights = []\n this.initMatrix = null\n this.OffsetMatrix = null\n }\n\n var XAnimationInfo = function XAnimationInfo() {\n classCallCheck(this, XAnimationInfo)\n\n this.animeName = ''\n this.boneName = ''\n this.targetBone = null\n this.keyType = 4\n this.frameStartLv = 0\n this.keyFrames = []\n this.InverseMx = null\n }\n\n var XAnimationObj = (function () {\n function XAnimationObj(_flags) {\n classCallCheck(this, XAnimationObj)\n\n this.fps = 30\n this.name = 'xanimation'\n this.length = 0\n this.hierarchy = []\n this.putFlags = _flags\n if (this.putFlags.putPos === undefined) {\n this.putFlags.putPos = true\n }\n\n if (this.putFlags.putRot === undefined) {\n this.putFlags.putRot = true\n }\n\n if (this.putFlags.putScl === undefined) {\n this.putFlags.putScl = true\n }\n }\n\n createClass(XAnimationObj, [\n {\n key: 'make',\n value: function make(XAnimationInfoArray) {\n for (let i = 0; i < XAnimationInfoArray.length; i++) {\n this.hierarchy.push(this.makeBonekeys(XAnimationInfoArray[i]))\n }\n\n this.length = this.hierarchy[0].keys[this.hierarchy[0].keys.length - 1].time\n },\n },\n {\n key: 'clone',\n value: function clone() {\n return Object.assign({}, this)\n },\n },\n {\n key: 'makeBonekeys',\n value: function makeBonekeys(XAnimationInfo) {\n var refObj = {}\n refObj.name = XAnimationInfo.boneName\n refObj.parent = ''\n refObj.keys = this.keyFrameRefactor(XAnimationInfo)\n refObj.copy = function () {\n return Object.assign({}, this)\n }\n\n return refObj\n },\n },\n {\n key: 'keyFrameRefactor',\n value: function keyFrameRefactor(XAnimationInfo) {\n var keys = []\n for (let i = 0; i < XAnimationInfo.keyFrames.length; i++) {\n var keyframe = {}\n keyframe.time = XAnimationInfo.keyFrames[i].time * this.fps\n if (XAnimationInfo.keyFrames[i].pos && this.putFlags.putPos) {\n keyframe.pos = XAnimationInfo.keyFrames[i].pos\n }\n\n if (XAnimationInfo.keyFrames[i].rot && this.putFlags.putRot) {\n keyframe.rot = XAnimationInfo.keyFrames[i].rot\n }\n\n if (XAnimationInfo.keyFrames[i].scl && this.putFlags.putScl) {\n keyframe.scl = XAnimationInfo.keyFrames[i].scl\n }\n\n if (XAnimationInfo.keyFrames[i].matrix) {\n keyframe.matrix = XAnimationInfo.keyFrames[i].matrix\n if (this.putFlags.putPos) {\n keyframe.pos = new Vector3().setFromMatrixPosition(keyframe.matrix)\n }\n\n if (this.putFlags.putRot) {\n keyframe.rot = new Quaternion().setFromRotationMatrix(keyframe.matrix)\n }\n\n if (this.putFlags.putScl) {\n keyframe.scl = new Vector3().setFromMatrixScale(keyframe.matrix)\n }\n }\n\n keys.push(keyframe)\n }\n\n return keys\n },\n },\n ])\n return XAnimationObj\n })()\n\n var XKeyFrameInfo = function XKeyFrameInfo() {\n classCallCheck(this, XKeyFrameInfo)\n\n this.index = 0\n this.Frame = 0\n this.time = 0.0\n this.matrix = null\n }\n\n var XLoader = (function () {\n function XLoader(manager) {\n Loader.call(this, manager)\n\n classCallCheck(this, XLoader)\n\n this.debug = false\n this.texloader = new TextureLoader(this.manager)\n this.url = ''\n this._putMatLength = 0\n this._nowMat = null\n this._nowFrameName = ''\n this.frameHierarchie = []\n this.Hierarchies = {}\n this.HieStack = []\n this._currentObject = {}\n this._currentFrame = {}\n this._data = null\n this.onLoad = null\n this.IsUvYReverse = true\n this.Meshes = []\n this.animations = []\n this.animTicksPerSecond = 30\n this._currentGeo = null\n this._currentAnime = null\n this._currentAnimeFrames = null\n }\n\n createClass(XLoader, [\n {\n key: '_setArgOption',\n value: function _setArgOption(_arg) {\n var _start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0\n\n if (!_arg) {\n return\n }\n\n for (let i = _start; i < _arg.length; i++) {\n switch (i) {\n case 0:\n this.url = _arg[i]\n break\n case 1:\n this.options = _arg[i]\n break\n }\n }\n\n if (this.options === undefined) {\n this.options = {}\n }\n },\n },\n {\n key: 'load',\n value: function load(_arg, onLoad, onProgress, onError) {\n var _this = this\n\n this._setArgOption(_arg)\n var loader = new 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(\n this.url,\n function (response) {\n try {\n _this.parse(response, onLoad)\n } catch (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n _this.manager.itemError(_this.url)\n }\n },\n onProgress,\n onError,\n )\n },\n },\n {\n key: '_readLine',\n value: function _readLine(line) {\n var readed = 0\n while (true) {\n var find = -1\n find = line.indexOf('//', readed)\n if (find === -1) {\n find = line.indexOf('#', readed)\n }\n\n if (find > -1 && find < 2) {\n var foundNewLine = -1\n foundNewLine = line.indexOf('\\r\\n', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 2\n } else {\n foundNewLine = line.indexOf('\\r', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 1\n } else {\n readed = line.indexOf('\\n', readed) + 1\n }\n }\n } else {\n break\n }\n }\n\n return line.substr(readed)\n },\n },\n {\n key: '_readLine',\n value: function _readLine(line) {\n var readed = 0\n while (true) {\n var find = -1\n find = line.indexOf('//', readed)\n if (find === -1) {\n find = line.indexOf('#', readed)\n }\n\n if (find > -1 && find < 2) {\n var foundNewLine = -1\n foundNewLine = line.indexOf('\\r\\n', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 2\n } else {\n foundNewLine = line.indexOf('\\r', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 1\n } else {\n readed = line.indexOf('\\n', readed) + 1\n }\n }\n } else {\n break\n }\n }\n\n return line.substr(readed)\n },\n },\n {\n key: '_isBinary',\n value: function _isBinary(binData) {\n var reader = new DataView(binData)\n var face_size = (32 / 8) * 3 + (32 / 8) * 3 * 3 + 16 / 8\n var n_faces = reader.getUint32(80, true)\n var expect = 80 + 32 / 8 + n_faces * face_size\n if (expect === reader.byteLength) {\n return true\n }\n\n var fileLength = reader.byteLength\n for (let index = 0; index < fileLength; index++) {\n if (reader.getUint8(index, false) > 127) {\n return true\n }\n }\n\n return false\n },\n },\n {\n key: '_ensureBinary',\n value: function _ensureBinary(buf) {\n if (typeof buf === 'string') {\n var array_buffer = new Uint8Array(buf.length)\n for (let i = 0; i < buf.length; i++) {\n array_buffer[i] = buf.charCodeAt(i) & 0xff\n }\n\n return array_buffer.buffer || array_buffer\n } else {\n return buf\n }\n },\n },\n {\n key: '_ensureString',\n value: function _ensureString(buf) {\n if (typeof buf !== 'string') {\n return decodeText(new Uint8Array(buf))\n } else {\n return buf\n }\n },\n },\n {\n key: 'parse',\n value: function _parse(data, onLoad) {\n var binData = this._ensureBinary(data)\n this._data = this._ensureString(data)\n this.onLoad = onLoad\n return this._isBinary(binData) ? this._parseBinary(binData) : this._parseASCII()\n },\n },\n {\n key: '_parseBinary',\n value: function _parseBinary(data) {\n return this._parseASCII(decodeText(new Uint8Array(data)))\n },\n },\n {\n key: '_parseASCII',\n value: function _parseASCII() {\n var path\n\n if (this.resourcePath !== '') {\n path = this.resourcePath\n } else if (this.path !== '') {\n path = this.path\n } else {\n path = LoaderUtils.extractUrlBase(this.url)\n }\n\n this.texloader.setPath(path).setCrossOrigin(this.crossOrigin)\n\n var endRead = 16\n this.Hierarchies.children = []\n this._hierarchieParse(this.Hierarchies, endRead)\n this._changeRoot()\n this._currentObject = this.Hierarchies.children.shift()\n this._mainloop()\n },\n },\n {\n key: '_hierarchieParse',\n value: function _hierarchieParse(_parent, _end) {\n var endRead = _end\n while (true) {\n var find1 = this._data.indexOf('{', endRead) + 1\n var findEnd = this._data.indexOf('}', endRead)\n var findNext = this._data.indexOf('{', find1) + 1\n if (find1 > 0 && findEnd > find1) {\n var _currentObject = {}\n _currentObject.children = []\n var nameData = this._readLine(this._data.substr(endRead, find1 - endRead - 1)).trim()\n var word = nameData.split(/ /g)\n if (word.length > 0) {\n _currentObject.type = word[0]\n if (word.length >= 2) {\n _currentObject.name = word[1]\n } else {\n _currentObject.name = word[0] + this.Hierarchies.children.length\n }\n } else {\n _currentObject.name = nameData\n _currentObject.type = ''\n }\n\n if (_currentObject.type === 'Animation') {\n _currentObject.data = this._data.substr(findNext, findEnd - findNext).trim()\n var refs = this._hierarchieParse(_currentObject, findEnd + 1)\n endRead = refs.end\n _currentObject.children = refs.parent.children\n } else {\n var DataEnder = this._data.lastIndexOf(';', findNext > 0 ? Math.min(findNext, findEnd) : findEnd)\n _currentObject.data = this._data.substr(find1, DataEnder - find1).trim()\n if (findNext <= 0 || findEnd < findNext) {\n endRead = findEnd + 1\n } else {\n var nextStart = Math.max(DataEnder + 1, find1)\n var _refs = this._hierarchieParse(_currentObject, nextStart)\n endRead = _refs.end\n _currentObject.children = _refs.parent.children\n }\n }\n\n _currentObject.parent = _parent\n if (_currentObject.type != 'template') {\n _parent.children.push(_currentObject)\n }\n } else {\n endRead = find1 === -1 ? this._data.length : findEnd + 1\n break\n }\n }\n\n return {\n parent: _parent,\n end: endRead,\n }\n },\n },\n {\n key: '_mainloop',\n value: function _mainloop() {\n var _this2 = this\n\n this._mainProc()\n if (this._currentObject.parent || this._currentObject.children.length > 0 || !this._currentObject.worked) {\n setTimeout(function () {\n _this2._mainloop()\n }, 1)\n } else {\n setTimeout(function () {\n _this2.onLoad({\n models: _this2.Meshes,\n animations: _this2.animations,\n })\n }, 1)\n }\n },\n },\n {\n key: '_mainProc',\n value: function _mainProc() {\n var breakFlag = false\n while (true) {\n if (!this._currentObject.worked) {\n switch (this._currentObject.type) {\n case 'template':\n break\n case 'AnimTicksPerSecond':\n this.animTicksPerSecond = parseInt(this._currentObject.data)\n break\n case 'Frame':\n this._setFrame()\n break\n case 'FrameTransformMatrix':\n this._setFrameTransformMatrix()\n break\n case 'Mesh':\n this._changeRoot()\n this._currentGeo = {}\n this._currentGeo.name = this._currentObject.name.trim()\n this._currentGeo.parentName = this._getParentName(this._currentObject).trim()\n this._currentGeo.VertexSetedBoneCount = []\n this._currentGeo.GeometryData = {\n vertices: [],\n normals: [],\n uvs: [],\n skinIndices: [],\n skinWeights: [],\n indices: [],\n materialIndices: [],\n }\n this._currentGeo.Materials = []\n this._currentGeo.normalVectors = []\n this._currentGeo.BoneInfs = []\n this._currentGeo.baseFrame = this._currentFrame\n this._makeBoneFrom_CurrentFrame()\n this._readVertexDatas()\n breakFlag = true\n break\n case 'MeshNormals':\n this._readVertexDatas()\n break\n case 'MeshTextureCoords':\n this._setMeshTextureCoords()\n break\n case 'VertexDuplicationIndices':\n break\n case 'MeshMaterialList':\n this._setMeshMaterialList()\n break\n case 'Material':\n this._setMaterial()\n break\n case 'SkinWeights':\n this._setSkinWeights()\n break\n case 'AnimationSet':\n this._changeRoot()\n this._currentAnime = {}\n this._currentAnime.name = this._currentObject.name.trim()\n this._currentAnime.AnimeFrames = []\n break\n case 'Animation':\n if (this._currentAnimeFrames) {\n this._currentAnime.AnimeFrames.push(this._currentAnimeFrames)\n }\n\n this._currentAnimeFrames = new XAnimationInfo()\n this._currentAnimeFrames.boneName = this._currentObject.data.trim()\n break\n case 'AnimationKey':\n this._readAnimationKey()\n breakFlag = true\n break\n }\n\n this._currentObject.worked = true\n }\n\n if (this._currentObject.children.length > 0) {\n this._currentObject = this._currentObject.children.shift()\n if (this.debug) {\n console.log('processing ' + this._currentObject.name)\n }\n\n if (breakFlag) break\n } else {\n if (this._currentObject.worked) {\n if (this._currentObject.parent && !this._currentObject.parent.parent) {\n this._changeRoot()\n }\n }\n\n if (this._currentObject.parent) {\n this._currentObject = this._currentObject.parent\n } else {\n breakFlag = true\n }\n\n if (breakFlag) break\n }\n }\n\n return\n },\n },\n {\n key: '_changeRoot',\n value: function _changeRoot() {\n if (this._currentGeo != null && this._currentGeo.name) {\n this._makeOutputGeometry()\n }\n\n this._currentGeo = {}\n if (this._currentAnime != null && this._currentAnime.name) {\n if (this._currentAnimeFrames) {\n this._currentAnime.AnimeFrames.push(this._currentAnimeFrames)\n this._currentAnimeFrames = null\n }\n\n this._makeOutputAnimation()\n }\n\n this._currentAnime = {}\n },\n },\n {\n key: '_getParentName',\n value: function _getParentName(_obj) {\n if (_obj.parent) {\n if (_obj.parent.name) {\n return _obj.parent.name\n } else {\n return this._getParentName(_obj.parent)\n }\n } else {\n return ''\n }\n },\n },\n {\n key: '_setFrame',\n value: function _setFrame() {\n this._nowFrameName = this._currentObject.name.trim()\n this._currentFrame = {}\n this._currentFrame.name = this._nowFrameName\n this._currentFrame.children = []\n if (this._currentObject.parent && this._currentObject.parent.name) {\n this._currentFrame.parentName = this._currentObject.parent.name\n }\n\n this.frameHierarchie.push(this._nowFrameName)\n this.HieStack[this._nowFrameName] = this._currentFrame\n },\n },\n {\n key: '_setFrameTransformMatrix',\n value: function _setFrameTransformMatrix() {\n this._currentFrame.FrameTransformMatrix = new Matrix4()\n var data = this._currentObject.data.split(',')\n this._ParseMatrixData(this._currentFrame.FrameTransformMatrix, data)\n this._makeBoneFrom_CurrentFrame()\n },\n },\n {\n key: '_makeBoneFrom_CurrentFrame',\n value: function _makeBoneFrom_CurrentFrame() {\n if (!this._currentFrame.FrameTransformMatrix) {\n return\n }\n\n var b = new Bone()\n b.name = this._currentFrame.name\n b.applyMatrix4(this._currentFrame.FrameTransformMatrix)\n b.matrixWorld = b.matrix\n b.FrameTransformMatrix = this._currentFrame.FrameTransformMatrix\n this._currentFrame.putBone = b\n if (this._currentFrame.parentName) {\n for (let frame in this.HieStack) {\n if (this.HieStack[frame].name === this._currentFrame.parentName) {\n this.HieStack[frame].putBone.add(this._currentFrame.putBone)\n }\n }\n }\n },\n },\n {\n key: '_readVertexDatas',\n value: function _readVertexDatas() {\n var endRead = 0\n var mode = 0\n var mode_local = 0\n var maxLength = 0\n while (true) {\n var changeMode = false\n if (mode_local === 0) {\n var refO = this._readInt1(endRead)\n endRead = refO.endRead\n mode_local = 1\n maxLength = this._currentObject.data.indexOf(';;', endRead) + 1\n if (maxLength <= 0) {\n maxLength = this._currentObject.data.length\n }\n } else {\n var find = 0\n switch (mode) {\n case 0:\n find = this._currentObject.data.indexOf(',', endRead) + 1\n break\n case 1:\n find = this._currentObject.data.indexOf(';,', endRead) + 1\n break\n }\n\n if (find === 0 || find > maxLength) {\n find = maxLength\n mode_local = 0\n changeMode = true\n }\n\n switch (this._currentObject.type) {\n case 'Mesh':\n switch (mode) {\n case 0:\n this._readVertex1(this._currentObject.data.substr(endRead, find - endRead))\n break\n case 1:\n this._readFace1(this._currentObject.data.substr(endRead, find - endRead))\n break\n }\n\n break\n case 'MeshNormals':\n switch (mode) {\n case 0:\n this._readNormalVector1(this._currentObject.data.substr(endRead, find - endRead))\n break\n }\n\n break\n }\n\n endRead = find + 1\n if (changeMode) {\n mode++\n }\n }\n\n if (endRead >= this._currentObject.data.length) {\n break\n }\n }\n },\n },\n {\n key: '_readInt1',\n value: function _readInt1(start) {\n var find = this._currentObject.data.indexOf(';', start)\n return {\n refI: parseInt(this._currentObject.data.substr(start, find - start)),\n endRead: find + 1,\n }\n },\n },\n {\n key: '_readVertex1',\n value: function _readVertex1(line) {\n var data = this._readLine(line.trim())\n .substr(0, line.length - 2)\n .split(';')\n this._currentGeo.GeometryData.vertices.push(parseFloat(data[0]), parseFloat(data[1]), parseFloat(data[2]))\n this._currentGeo.GeometryData.skinIndices.push(0, 0, 0, 0)\n this._currentGeo.GeometryData.skinWeights.push(1, 0, 0, 0)\n this._currentGeo.VertexSetedBoneCount.push(0)\n },\n },\n {\n key: '_readFace1',\n value: function _readFace1(line) {\n var data = this._readLine(line.trim())\n .substr(2, line.length - 4)\n .split(',')\n this._currentGeo.GeometryData.indices.push(\n parseInt(data[0], 10),\n parseInt(data[1], 10),\n parseInt(data[2], 10),\n )\n },\n },\n {\n key: '_readNormalVector1',\n value: function _readNormalVector1(line) {\n var data = this._readLine(line.trim())\n .substr(0, line.length - 2)\n .split(';')\n this._currentGeo.GeometryData.normals.push(parseFloat(data[0]), parseFloat(data[1]), parseFloat(data[2]))\n },\n },\n {\n key: '_buildGeometry',\n value: function _buildGeometry() {\n var bufferGeometry = new BufferGeometry()\n var position = []\n var normals = []\n var uvs = []\n var skinIndices = []\n var skinWeights = []\n\n //\n\n var data = this._currentGeo.GeometryData\n\n for (let i = 0, l = data.indices.length; i < l; i++) {\n var stride2 = data.indices[i] * 2\n var stride3 = data.indices[i] * 3\n var stride4 = data.indices[i] * 4\n\n position.push(data.vertices[stride3], data.vertices[stride3 + 1], data.vertices[stride3 + 2])\n normals.push(data.normals[stride3], data.normals[stride3 + 1], data.normals[stride3 + 2])\n skinIndices.push(\n data.skinIndices[stride4],\n data.skinIndices[stride4 + 1],\n data.skinIndices[stride4 + 2],\n data.skinIndices[stride4 + 3],\n )\n skinWeights.push(\n data.skinWeights[stride4],\n data.skinWeights[stride4 + 1],\n data.skinWeights[stride4 + 2],\n data.skinWeights[stride4 + 3],\n )\n uvs.push(data.uvs[stride2], data.uvs[stride2 + 1])\n }\n\n //\n\n bufferGeometry.setAttribute('position', new Float32BufferAttribute(position, 3))\n bufferGeometry.setAttribute('normal', new Float32BufferAttribute(normals, 3))\n bufferGeometry.setAttribute('uv', new Float32BufferAttribute(uvs, 2))\n bufferGeometry.setAttribute('skinIndex', new Uint16BufferAttribute(skinIndices, 4))\n bufferGeometry.setAttribute('skinWeight', new Float32BufferAttribute(skinWeights, 4))\n\n this._computeGroups(bufferGeometry, data.materialIndices)\n\n return bufferGeometry\n },\n },\n {\n key: '_computeGroups',\n value: function _computeGroups(bufferGeometry, materialIndices) {\n var group\n var groups = []\n var materialIndex = undefined\n\n for (let i = 0; i < materialIndices.length; i++) {\n var currentMaterialIndex = materialIndices[i]\n\n if (currentMaterialIndex !== materialIndex) {\n materialIndex = currentMaterialIndex\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n group = {\n start: i * 3,\n materialIndex: materialIndex,\n }\n }\n }\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n bufferGeometry.groups = groups\n },\n },\n {\n key: '_setMeshTextureCoords',\n value: function _setMeshTextureCoords() {\n var endRead = 0\n var mode = 0\n var mode_local = 0\n while (true) {\n switch (mode) {\n case 0:\n if (mode_local === 0) {\n var refO = this._readInt1(0)\n endRead = refO.endRead\n mode_local = 1\n } else {\n var find = this._currentObject.data.indexOf(',', endRead) + 1\n if (find === 0) {\n find = this._currentObject.data.length\n mode = 2\n mode_local = 0\n }\n\n var line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(';')\n if (this.IsUvYReverse) {\n this._currentGeo.GeometryData.uvs.push(parseFloat(data[0]), 1 - parseFloat(data[1]))\n } else {\n this._currentGeo.GeometryData.uvs.push(parseFloat(data[0]), parseFloat(data[1]))\n }\n\n endRead = find + 1\n }\n\n break\n }\n\n if (endRead >= this._currentObject.data.length) {\n break\n }\n }\n },\n },\n {\n key: '_setMeshMaterialList',\n value: function _setMeshMaterialList() {\n var endRead = 0\n var mode = 0\n var mode_local = 0\n while (true) {\n if (mode_local < 2) {\n var refO = this._readInt1(endRead)\n endRead = refO.endRead\n mode_local++\n } else {\n var find = this._currentObject.data.indexOf(';', endRead)\n if (find === -1) {\n find = this._currentObject.data.length\n mode = 3\n mode_local = 0\n }\n\n var line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(',')\n for (let i = 0; i < data.length; i++) {\n this._currentGeo.GeometryData.materialIndices[i] = parseInt(data[i])\n }\n\n endRead = this._currentObject.data.length\n }\n\n if (endRead >= this._currentObject.data.length || mode >= 3) {\n break\n }\n }\n },\n },\n {\n key: '_setMaterial',\n value: function _setMaterial() {\n var _nowMat = new MeshPhongMaterial({\n color: Math.random() * 0xffffff,\n })\n _nowMat.side = FrontSide\n _nowMat.name = this._currentObject.name\n var endRead = 0\n var find = this._currentObject.data.indexOf(';;', endRead)\n var line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(';')\n _nowMat.color.r = parseFloat(data[0])\n _nowMat.color.g = parseFloat(data[1])\n _nowMat.color.b = parseFloat(data[2])\n endRead = find + 2\n find = this._currentObject.data.indexOf(';', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n _nowMat.shininess = parseFloat(this._readLine(line))\n endRead = find + 1\n find = this._currentObject.data.indexOf(';;', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data2 = this._readLine(line.trim()).split(';')\n _nowMat.specular.r = parseFloat(data2[0])\n _nowMat.specular.g = parseFloat(data2[1])\n _nowMat.specular.b = parseFloat(data2[2])\n endRead = find + 2\n find = this._currentObject.data.indexOf(';;', endRead)\n if (find === -1) {\n find = this._currentObject.data.length\n }\n\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data3 = this._readLine(line.trim()).split(';')\n _nowMat.emissive.r = parseFloat(data3[0])\n _nowMat.emissive.g = parseFloat(data3[1])\n _nowMat.emissive.b = parseFloat(data3[2])\n var localObject = null\n while (true) {\n if (this._currentObject.children.length > 0) {\n localObject = this._currentObject.children.shift()\n if (this.debug) {\n console.log('processing ' + localObject.name)\n }\n\n var fileName = localObject.data.substr(1, localObject.data.length - 2)\n switch (localObject.type) {\n case 'TextureFilename':\n _nowMat.map = this.texloader.load(fileName)\n break\n case 'BumpMapFilename':\n _nowMat.bumpMap = this.texloader.load(fileName)\n _nowMat.bumpScale = 0.05\n break\n case 'NormalMapFilename':\n _nowMat.normalMap = this.texloader.load(fileName)\n _nowMat.normalScale = new Vector2(2, 2)\n break\n case 'EmissiveMapFilename':\n _nowMat.emissiveMap = this.texloader.load(fileName)\n break\n case 'LightMapFilename':\n _nowMat.lightMap = this.texloader.load(fileName)\n break\n }\n } else {\n break\n }\n }\n\n this._currentGeo.Materials.push(_nowMat)\n },\n },\n {\n key: '_setSkinWeights',\n value: function _setSkinWeights() {\n var boneInf = new XboneInf()\n var endRead = 0\n var find = this._currentObject.data.indexOf(';', endRead)\n var line = this._currentObject.data.substr(endRead, find - endRead)\n endRead = find + 1\n boneInf.boneName = line.substr(1, line.length - 2)\n boneInf.BoneIndex = this._currentGeo.BoneInfs.length\n find = this._currentObject.data.indexOf(';', endRead)\n endRead = find + 1\n find = this._currentObject.data.indexOf(';', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(',')\n for (let i = 0; i < data.length; i++) {\n boneInf.Indeces.push(parseInt(data[i]))\n }\n\n endRead = find + 1\n find = this._currentObject.data.indexOf(';', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data2 = this._readLine(line.trim()).split(',')\n for (let _i = 0; _i < data2.length; _i++) {\n boneInf.Weights.push(parseFloat(data2[_i]))\n }\n\n endRead = find + 1\n find = this._currentObject.data.indexOf(';', endRead)\n if (find <= 0) {\n find = this._currentObject.data.length\n }\n\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data3 = this._readLine(line.trim()).split(',')\n boneInf.OffsetMatrix = new Matrix4()\n this._ParseMatrixData(boneInf.OffsetMatrix, data3)\n this._currentGeo.BoneInfs.push(boneInf)\n },\n },\n {\n key: '_makePutBoneList',\n value: function _makePutBoneList(_RootName, _bones) {\n var putting = false\n for (let frame in this.HieStack) {\n if (this.HieStack[frame].name === _RootName || putting) {\n putting = true\n var b = new Bone()\n b.name = this.HieStack[frame].name\n b.applyMatrix4(this.HieStack[frame].FrameTransformMatrix)\n b.matrixWorld = b.matrix\n b.FrameTransformMatrix = this.HieStack[frame].FrameTransformMatrix\n b.pos = new Vector3().setFromMatrixPosition(b.FrameTransformMatrix).toArray()\n b.rotq = new Quaternion().setFromRotationMatrix(b.FrameTransformMatrix).toArray()\n b.scl = new Vector3().setFromMatrixScale(b.FrameTransformMatrix).toArray()\n if (this.HieStack[frame].parentName && this.HieStack[frame].parentName.length > 0) {\n for (let i = 0; i < _bones.length; i++) {\n if (this.HieStack[frame].parentName === _bones[i].name) {\n _bones[i].add(b)\n b.parent = i\n break\n }\n }\n }\n\n _bones.push(b)\n }\n }\n },\n },\n {\n key: '_makeOutputGeometry',\n value: function _makeOutputGeometry() {\n var mesh = null\n if (this._currentGeo.BoneInfs.length > 0) {\n var putBones = []\n this._makePutBoneList(this._currentGeo.baseFrame.parentName, putBones)\n for (let bi = 0; bi < this._currentGeo.BoneInfs.length; bi++) {\n var boneIndex = 0\n for (let bb = 0; bb < putBones.length; bb++) {\n if (putBones[bb].name === this._currentGeo.BoneInfs[bi].boneName) {\n boneIndex = bb\n putBones[bb].OffsetMatrix = new Matrix4()\n putBones[bb].OffsetMatrix.copy(this._currentGeo.BoneInfs[bi].OffsetMatrix)\n break\n }\n }\n\n for (let vi = 0; vi < this._currentGeo.BoneInfs[bi].Indeces.length; vi++) {\n var nowVertexID = this._currentGeo.BoneInfs[bi].Indeces[vi]\n var nowVal = this._currentGeo.BoneInfs[bi].Weights[vi]\n\n var stride = nowVertexID * 4\n\n switch (this._currentGeo.VertexSetedBoneCount[nowVertexID]) {\n case 0:\n this._currentGeo.GeometryData.skinIndices[stride] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride] = nowVal\n break\n case 1:\n this._currentGeo.GeometryData.skinIndices[stride + 1] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride + 1] = nowVal\n break\n case 2:\n this._currentGeo.GeometryData.skinIndices[stride + 2] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride + 2] = nowVal\n break\n case 3:\n this._currentGeo.GeometryData.skinIndices[stride + 3] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride + 3] = nowVal\n break\n }\n\n this._currentGeo.VertexSetedBoneCount[nowVertexID]++\n if (this._currentGeo.VertexSetedBoneCount[nowVertexID] > 4) {\n console.log('warn! over 4 bone weight! :' + nowVertexID)\n }\n }\n }\n\n for (let sk = 0; sk < this._currentGeo.Materials.length; sk++) {\n this._currentGeo.Materials[sk].skinning = true\n }\n\n var offsetList = []\n for (let _bi = 0; _bi < putBones.length; _bi++) {\n if (putBones[_bi].OffsetMatrix) {\n offsetList.push(putBones[_bi].OffsetMatrix)\n } else {\n offsetList.push(new Matrix4())\n }\n }\n\n var bufferGeometry = this._buildGeometry()\n mesh = new SkinnedMesh(\n bufferGeometry,\n this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[0] : this._currentGeo.Materials,\n )\n\n this._initSkeleton(mesh, putBones, offsetList)\n } else {\n var _bufferGeometry = this._buildGeometry()\n mesh = new Mesh(\n _bufferGeometry,\n this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[0] : this._currentGeo.Materials,\n )\n }\n\n mesh.name = this._currentGeo.name\n var worldBaseMx = new Matrix4()\n var currentMxFrame = this._currentGeo.baseFrame.putBone\n if (currentMxFrame && currentMxFrame.parent) {\n while (true) {\n currentMxFrame = currentMxFrame.parent\n if (currentMxFrame) {\n worldBaseMx.multiply(currentMxFrame.FrameTransformMatrix)\n } else {\n break\n }\n }\n\n mesh.applyMatrix4(worldBaseMx)\n }\n\n this.Meshes.push(mesh)\n },\n },\n {\n key: '_initSkeleton',\n value: function _initSkeleton(mesh, boneList, boneInverses) {\n var bones = [],\n bone,\n gbone\n var i, il\n\n for (i = 0, il = boneList.length; i < il; i++) {\n gbone = boneList[i]\n\n bone = new Bone()\n bones.push(bone)\n\n bone.name = gbone.name\n bone.position.fromArray(gbone.pos)\n bone.quaternion.fromArray(gbone.rotq)\n if (gbone.scl !== undefined) bone.scale.fromArray(gbone.scl)\n }\n\n for (i = 0, il = boneList.length; i < il; i++) {\n gbone = boneList[i]\n\n if (gbone.parent !== -1 && gbone.parent !== null && bones[gbone.parent] !== undefined) {\n bones[gbone.parent].add(bones[i])\n } else {\n mesh.add(bones[i])\n }\n }\n\n mesh.updateMatrixWorld(true)\n\n var skeleton = new Skeleton(bones, boneInverses)\n mesh.bind(skeleton, mesh.matrixWorld)\n },\n },\n {\n key: '_readAnimationKey',\n value: function _readAnimationKey() {\n var endRead = 0\n var find = this._currentObject.data.indexOf(';', endRead)\n var line = this._currentObject.data.substr(endRead, find - endRead)\n endRead = find + 1\n var nowKeyType = parseInt(this._readLine(line))\n find = this._currentObject.data.indexOf(';', endRead)\n endRead = find + 1\n line = this._currentObject.data.substr(endRead)\n var data = this._readLine(line.trim()).split(';;,')\n for (let i = 0; i < data.length; i++) {\n var data2 = data[i].split(';')\n var keyInfo = new XKeyFrameInfo()\n keyInfo.type = nowKeyType\n keyInfo.Frame = parseInt(data2[0])\n keyInfo.index = this._currentAnimeFrames.keyFrames.length\n keyInfo.time = keyInfo.Frame\n if (nowKeyType != 4) {\n var frameFound = false\n for (let mm = 0; mm < this._currentAnimeFrames.keyFrames.length; mm++) {\n if (this._currentAnimeFrames.keyFrames[mm].Frame === keyInfo.Frame) {\n keyInfo = this._currentAnimeFrames.keyFrames[mm]\n frameFound = true\n break\n }\n }\n\n var frameValue = data2[2].split(',')\n switch (nowKeyType) {\n case 0:\n keyInfo.rot = new Quaternion(\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2]),\n parseFloat(frameValue[3]),\n parseFloat(frameValue[0]) * -1,\n )\n break\n case 1:\n keyInfo.scl = new Vector3(\n parseFloat(frameValue[0]),\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2]),\n )\n break\n case 2:\n keyInfo.pos = new Vector3(\n parseFloat(frameValue[0]),\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2]),\n )\n break\n }\n\n if (!frameFound) {\n this._currentAnimeFrames.keyFrames.push(keyInfo)\n }\n } else {\n keyInfo.matrix = new Matrix4()\n this._ParseMatrixData(keyInfo.matrix, data2[2].split(','))\n this._currentAnimeFrames.keyFrames.push(keyInfo)\n }\n }\n },\n },\n {\n key: '_makeOutputAnimation',\n value: function _makeOutputAnimation() {\n var animationObj = new XAnimationObj(this.options)\n animationObj.fps = this.animTicksPerSecond\n animationObj.name = this._currentAnime.name\n animationObj.make(this._currentAnime.AnimeFrames)\n this.animations.push(animationObj)\n },\n },\n {\n key: 'assignAnimation',\n value: function assignAnimation(_model, _animation) {\n var model = _model\n var animation = _animation\n if (!model) {\n model = this.Meshes[0]\n }\n\n if (!animation) {\n animation = this.animations[0]\n }\n\n if (!model || !animation) {\n return null\n }\n\n var put = {}\n put.fps = animation.fps\n put.name = animation.name\n put.length = animation.length\n put.hierarchy = []\n for (let b = 0; b < model.skeleton.bones.length; b++) {\n var findAnimation = false\n for (let i = 0; i < animation.hierarchy.length; i++) {\n if (model.skeleton.bones[b].name === animation.hierarchy[i].name) {\n findAnimation = true\n var c_key = animation.hierarchy[i].copy()\n c_key.parent = -1\n if (model.skeleton.bones[b].parent && model.skeleton.bones[b].parent.type === 'Bone') {\n for (let bb = 0; bb < put.hierarchy.length; bb++) {\n if (put.hierarchy[bb].name === model.skeleton.bones[b].parent.name) {\n c_key.parent = bb\n c_key.parentName = model.skeleton.bones[b].parent.name\n }\n }\n }\n\n put.hierarchy.push(c_key)\n break\n }\n }\n\n if (!findAnimation) {\n var _c_key = animation.hierarchy[0].copy()\n _c_key.name = model.skeleton.bones[b].name\n _c_key.parent = -1\n for (let k = 0; k < _c_key.keys.length; k++) {\n if (_c_key.keys[k].pos) {\n _c_key.keys[k].pos.set(0, 0, 0)\n }\n\n if (_c_key.keys[k].scl) {\n _c_key.keys[k].scl.set(1, 1, 1)\n }\n\n if (_c_key.keys[k].rot) {\n _c_key.keys[k].rot.set(0, 0, 0, 1)\n }\n }\n\n put.hierarchy.push(_c_key)\n }\n }\n\n if (!model.geometry.animations) {\n model.geometry.animations = []\n }\n\n model.geometry.animations.push(AnimationClip.parseAnimation(put, model.skeleton.bones))\n if (!model.animationMixer) {\n model.animationMixer = new AnimationMixer(model)\n }\n\n return put\n },\n },\n {\n key: '_ParseMatrixData',\n value: function _ParseMatrixData(targetMatrix, data) {\n targetMatrix.set(\n parseFloat(data[0]),\n parseFloat(data[4]),\n parseFloat(data[8]),\n parseFloat(data[12]),\n parseFloat(data[1]),\n parseFloat(data[5]),\n parseFloat(data[9]),\n parseFloat(data[13]),\n parseFloat(data[2]),\n parseFloat(data[6]),\n parseFloat(data[10]),\n parseFloat(data[14]),\n parseFloat(data[3]),\n parseFloat(data[7]),\n parseFloat(data[11]),\n parseFloat(data[15]),\n )\n },\n },\n ])\n return XLoader\n })()\n\n return XLoader\n})()\n\nexport { XLoader }\n", "const { CstParser, Lexer, createToken } = (() => {\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = typeof global == 'object' && global && global.Object === Object && global\n\n const freeGlobal$1 = freeGlobal\n\n /** Detect free variable `self`. */\n var freeSelf = typeof self == 'object' && self && self.Object === Object && self\n\n /** Used as a reference to the global object. */\n var root = freeGlobal$1 || freeSelf || Function('return this')()\n\n const root$1 = root\n\n /** Built-in value references. */\n var Symbol$1 = root$1.Symbol\n\n const Symbol$2 = Symbol$1\n\n /** Used for built-in method references. */\n var objectProto$j = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$g = objectProto$j.hasOwnProperty\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString$1 = objectProto$j.toString\n\n /** Built-in value references. */\n var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined\n\n /**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\n function getRawTag(value) {\n var isOwn = hasOwnProperty$g.call(value, symToStringTag$1),\n tag = value[symToStringTag$1]\n\n try {\n value[symToStringTag$1] = undefined\n var unmasked = true\n } catch (e) {}\n\n var result = nativeObjectToString$1.call(value)\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag$1] = tag\n } else {\n delete value[symToStringTag$1]\n }\n }\n return result\n }\n\n /** Used for built-in method references. */\n var objectProto$i = Object.prototype\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString = objectProto$i.toString\n\n /**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\n function objectToString(value) {\n return nativeObjectToString.call(value)\n }\n\n /** `Object#toString` result references. */\n var nullTag = '[object Null]',\n undefinedTag = '[object Undefined]'\n\n /** Built-in value references. */\n var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined\n\n /**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n function baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag\n }\n return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value)\n }\n\n /**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\n function isObjectLike(value) {\n return value != null && typeof value == 'object'\n }\n\n /** `Object#toString` result references. */\n var symbolTag$3 = '[object Symbol]'\n\n /**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\n function isSymbol(value) {\n return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag$3)\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length)\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array)\n }\n return result\n }\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\n var isArray = Array.isArray\n\n const isArray$1 = isArray\n\n /** Used as references for various `Number` constants. */\n var INFINITY$3 = 1 / 0\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : undefined,\n symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined\n\n /**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value\n }\n if (isArray$1(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + ''\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : ''\n }\n var result = value + ''\n return result == '0' && 1 / value == -INFINITY$3 ? '-0' : result\n }\n\n /** Used to match a single whitespace character. */\n var reWhitespace = /\\s/\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\n function trimmedEndIndex(string) {\n var index = string.length\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index\n }\n\n /** Used to match leading whitespace. */\n var reTrimStart = /^\\s+/\n\n /**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\n function baseTrim(string) {\n return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string\n }\n\n /**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\n function isObject(value) {\n var type = typeof value\n return value != null && (type == 'object' || type == 'function')\n }\n\n /** Used as references for various `Number` constants. */\n var NAN = 0 / 0\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseInt = parseInt\n\n /**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\n function toNumber(value) {\n if (typeof value == 'number') {\n return value\n }\n if (isSymbol(value)) {\n return NAN\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value\n value = isObject(other) ? other + '' : other\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value\n }\n value = baseTrim(value)\n var isBinary = reIsBinary.test(value)\n return isBinary || reIsOctal.test(value)\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : reIsBadHex.test(value)\n ? NAN\n : +value\n }\n\n /** Used as references for various `Number` constants. */\n var INFINITY$2 = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e308\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0\n }\n value = toNumber(value)\n if (value === INFINITY$2 || value === -INFINITY$2) {\n var sign = value < 0 ? -1 : 1\n return sign * MAX_INTEGER\n }\n return value === value ? value : 0\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1\n\n return result === result ? (remainder ? result - remainder : result) : 0\n }\n\n /**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\n function identity(value) {\n return value\n }\n\n /** `Object#toString` result references. */\n var asyncTag = '[object AsyncFunction]',\n funcTag$2 = '[object Function]',\n genTag$1 = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]'\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n if (!isObject(value)) {\n return false\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value)\n return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag\n }\n\n /** Used to detect overreaching core-js shims. */\n var coreJsData = root$1['__core-js_shared__']\n\n const coreJsData$1 = coreJsData\n\n /** Used to detect methods masquerading as native. */\n var maskSrcKey = (function () {\n var uid = /[^.]+$/.exec((coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO) || '')\n return uid ? 'Symbol(src)_1.' + uid : ''\n })()\n\n /**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\n function isMasked(func) {\n return !!maskSrcKey && maskSrcKey in func\n }\n\n /** Used for built-in method references. */\n var funcProto$1 = Function.prototype\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString$1 = funcProto$1.toString\n\n /**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\n function toSource(func) {\n if (func != null) {\n try {\n return funcToString$1.call(func)\n } catch (e) {}\n try {\n return func + ''\n } catch (e) {}\n }\n return ''\n }\n\n /**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\n var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g\n\n /** Used to detect host constructors (Safari). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/\n\n /** Used for built-in method references. */\n var funcProto = Function.prototype,\n objectProto$h = Object.prototype\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString = funcProto.toString\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$f = objectProto$h.hasOwnProperty\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp(\n '^' +\n funcToString\n .call(hasOwnProperty$f)\n .replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') +\n '$',\n )\n\n /**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\n function baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor\n return pattern.test(toSource(value))\n }\n\n /**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function getValue(object, key) {\n return object == null ? undefined : object[key]\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = getValue(object, key)\n return baseIsNative(value) ? value : undefined\n }\n\n /* Built-in method references that are verified to be native. */\n var WeakMap = getNative(root$1, 'WeakMap')\n\n const WeakMap$1 = WeakMap\n\n /** Built-in value references. */\n var objectCreate = Object.create\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function () {\n function object() {}\n return function (proto) {\n if (!isObject(proto)) {\n return {}\n }\n if (objectCreate) {\n return objectCreate(proto)\n }\n object.prototype = proto\n var result = new object()\n object.prototype = undefined\n return result\n }\n })()\n\n const baseCreate$1 = baseCreate\n\n /**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\n function apply(func, thisArg, args) {\n switch (args.length) {\n case 0:\n return func.call(thisArg)\n case 1:\n return func.call(thisArg, args[0])\n case 2:\n return func.call(thisArg, args[0], args[1])\n case 3:\n return func.call(thisArg, args[0], args[1], args[2])\n }\n return func.apply(thisArg, args)\n }\n\n /**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\n function noop() {\n // No operation performed.\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function copyArray(source, array) {\n var index = -1,\n length = source.length\n\n array || (array = Array(length))\n while (++index < length) {\n array[index] = source[index]\n }\n return array\n }\n\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\n var HOT_COUNT = 800,\n HOT_SPAN = 16\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeNow = Date.now\n\n /**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\n function shortOut(func) {\n var count = 0,\n lastCalled = 0\n\n return function () {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled)\n\n lastCalled = stamp\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0]\n }\n } else {\n count = 0\n }\n return func.apply(undefined, arguments)\n }\n }\n\n /**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\n function constant(value) {\n return function () {\n return value\n }\n }\n\n var defineProperty = (function () {\n try {\n var func = getNative(Object, 'defineProperty')\n func({}, '', {})\n return func\n } catch (e) {}\n })()\n\n const defineProperty$1 = defineProperty\n\n /**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var baseSetToString = !defineProperty$1\n ? identity\n : function (func, string) {\n return defineProperty$1(func, 'toString', {\n configurable: true,\n enumerable: false,\n value: constant(string),\n writable: true,\n })\n }\n\n const baseSetToString$1 = baseSetToString\n\n /**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var setToString = shortOut(baseSetToString$1)\n\n const setToString$1 = setToString\n\n /**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break\n }\n }\n return array\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1)\n\n while (fromRight ? index-- : ++index < length) {\n if (predicate(array[index], index, array)) {\n return index\n }\n }\n return -1\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value\n }\n\n /**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length\n\n while (++index < length) {\n if (array[index] === value) {\n return index\n }\n }\n return -1\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex)\n }\n\n /**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length\n return !!length && baseIndexOf(array, value, 0) > -1\n }\n\n /** Used as references for various `Number` constants. */\n var MAX_SAFE_INTEGER$1 = 9007199254740991\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^(?:0|[1-9]\\d*)$/\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n var type = typeof value\n length = length == null ? MAX_SAFE_INTEGER$1 : length\n\n return (\n !!length &&\n (type == 'number' || (type != 'symbol' && reIsUint.test(value))) &&\n value > -1 &&\n value % 1 == 0 &&\n value < length\n )\n }\n\n /**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty$1) {\n defineProperty$1(object, key, {\n configurable: true,\n enumerable: true,\n value: value,\n writable: true,\n })\n } else {\n object[key] = value\n }\n }\n\n /**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other)\n }\n\n /** Used for built-in method references. */\n var objectProto$g = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$e = objectProto$g.hasOwnProperty\n\n /**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignValue(object, key, value) {\n var objValue = object[key]\n if (!(hasOwnProperty$e.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value)\n }\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\n function copyObject(source, props, object, customizer) {\n var isNew = !object\n object || (object = {})\n\n var index = -1,\n length = props.length\n\n while (++index < length) {\n var key = props[index]\n\n var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined\n\n if (newValue === undefined) {\n newValue = source[key]\n }\n if (isNew) {\n baseAssignValue(object, key, newValue)\n } else {\n assignValue(object, key, newValue)\n }\n }\n return object\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax$3 = Math.max\n\n /**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\n function overRest(func, start, transform) {\n start = nativeMax$3(start === undefined ? func.length - 1 : start, 0)\n return function () {\n var args = arguments,\n index = -1,\n length = nativeMax$3(args.length - start, 0),\n array = Array(length)\n\n while (++index < length) {\n array[index] = args[start + index]\n }\n index = -1\n var otherArgs = Array(start + 1)\n while (++index < start) {\n otherArgs[index] = args[index]\n }\n otherArgs[start] = transform(array)\n return apply(func, this, otherArgs)\n }\n }\n\n /**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\n function baseRest(func, start) {\n return setToString$1(overRest(func, start, identity), func + '')\n }\n\n /** Used as references for various `Number` constants. */\n var MAX_SAFE_INTEGER = 9007199254740991\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\n function isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER\n }\n\n /**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\n function isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value)\n }\n\n /**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false\n }\n var type = typeof index\n if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) {\n return eq(object[index], value)\n }\n return false\n }\n\n /**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return baseRest(function (object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined\n\n customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer\n length = 1\n }\n object = Object(object)\n while (++index < length) {\n var source = sources[index]\n if (source) {\n assigner(object, source, index, customizer)\n }\n }\n return object\n })\n }\n\n /** Used for built-in method references. */\n var objectProto$f = Object.prototype\n\n /**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\n function isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$f\n\n return value === proto\n }\n\n /**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\n function baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n)\n\n while (++index < n) {\n result[index] = iteratee(index)\n }\n return result\n }\n\n /** `Object#toString` result references. */\n var argsTag$3 = '[object Arguments]'\n\n /**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\n function baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag$3\n }\n\n /** Used for built-in method references. */\n var objectProto$e = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$d = objectProto$e.hasOwnProperty\n\n /** Built-in value references. */\n var propertyIsEnumerable$1 = objectProto$e.propertyIsEnumerable\n\n /**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n var isArguments = baseIsArguments(\n (function () {\n return arguments\n })(),\n )\n ? baseIsArguments\n : function (value) {\n return (\n isObjectLike(value) && hasOwnProperty$d.call(value, 'callee') && !propertyIsEnumerable$1.call(value, 'callee')\n )\n }\n\n const isArguments$1 = isArguments\n\n /**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\n function stubFalse() {\n return false\n }\n\n /** Detect free variable `exports`. */\n var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports\n\n /** Detect free variable `module`. */\n var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2\n\n /** Built-in value references. */\n var Buffer$1 = moduleExports$2 ? root$1.Buffer : undefined\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined\n\n /**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\n var isBuffer = nativeIsBuffer || stubFalse\n\n const isBuffer$1 = isBuffer\n\n /** `Object#toString` result references. */\n var argsTag$2 = '[object Arguments]',\n arrayTag$2 = '[object Array]',\n boolTag$3 = '[object Boolean]',\n dateTag$3 = '[object Date]',\n errorTag$2 = '[object Error]',\n funcTag$1 = '[object Function]',\n mapTag$6 = '[object Map]',\n numberTag$3 = '[object Number]',\n objectTag$3 = '[object Object]',\n regexpTag$4 = '[object RegExp]',\n setTag$6 = '[object Set]',\n stringTag$4 = '[object String]',\n weakMapTag$2 = '[object WeakMap]'\n\n var arrayBufferTag$3 = '[object ArrayBuffer]',\n dataViewTag$4 = '[object DataView]',\n float32Tag$2 = '[object Float32Array]',\n float64Tag$2 = '[object Float64Array]',\n int8Tag$2 = '[object Int8Array]',\n int16Tag$2 = '[object Int16Array]',\n int32Tag$2 = '[object Int32Array]',\n uint8Tag$2 = '[object Uint8Array]',\n uint8ClampedTag$2 = '[object Uint8ClampedArray]',\n uint16Tag$2 = '[object Uint16Array]',\n uint32Tag$2 = '[object Uint32Array]'\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {}\n typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[\n int16Tag$2\n ] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[\n uint16Tag$2\n ] = typedArrayTags[uint32Tag$2] = true\n typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[\n boolTag$3\n ] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[\n funcTag$1\n ] = typedArrayTags[mapTag$6] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[\n regexpTag$4\n ] = typedArrayTags[setTag$6] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$2] = false\n\n /**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\n function baseIsTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]\n }\n\n /**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\n function baseUnary(func) {\n return function (value) {\n return func(value)\n }\n }\n\n /** Detect free variable `exports`. */\n var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports\n\n /** Detect free variable `module`. */\n var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1\n\n /** Detect free variable `process` from Node.js. */\n var freeProcess = moduleExports$1 && freeGlobal$1.process\n\n /** Used to access faster Node.js helpers. */\n var nodeUtil = (function () {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types\n\n if (types) {\n return types\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util')\n } catch (e) {}\n })()\n\n const nodeUtil$1 = nodeUtil\n\n /* Node.js helper references. */\n var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray\n\n const isTypedArray$1 = isTypedArray\n\n /** Used for built-in method references. */\n var objectProto$d = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$c = objectProto$d.hasOwnProperty\n\n /**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\n function arrayLikeKeys(value, inherited) {\n var isArr = isArray$1(value),\n isArg = !isArr && isArguments$1(value),\n isBuff = !isArr && !isArg && isBuffer$1(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length\n\n for (var key in value) {\n if (\n (inherited || hasOwnProperty$c.call(value, key)) &&\n !(\n skipIndexes &&\n // Safari 9 has enumerable `arguments.length` in strict mode.\n (key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length))\n )\n ) {\n result.push(key)\n }\n }\n return result\n }\n\n /**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\n function overArg(func, transform) {\n return function (arg) {\n return func(transform(arg))\n }\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeKeys = overArg(Object.keys, Object)\n\n const nativeKeys$1 = nativeKeys\n\n /** Used for built-in method references. */\n var objectProto$c = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$b = objectProto$c.hasOwnProperty\n\n /**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys$1(object)\n }\n var result = []\n for (var key in Object(object)) {\n if (hasOwnProperty$b.call(object, key) && key != 'constructor') {\n result.push(key)\n }\n }\n return result\n }\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n function keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object)\n }\n\n /** Used for built-in method references. */\n var objectProto$b = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$a = objectProto$b.hasOwnProperty\n\n /**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\n var assign = createAssigner(function (object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object)\n return\n }\n for (var key in source) {\n if (hasOwnProperty$a.call(source, key)) {\n assignValue(object, key, source[key])\n }\n }\n })\n\n const assign$1 = assign\n\n /**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function nativeKeysIn(object) {\n var result = []\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key)\n }\n }\n return result\n }\n\n /** Used for built-in method references. */\n var objectProto$a = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$9 = objectProto$a.hasOwnProperty\n\n /**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object)\n }\n var isProto = isPrototype(object),\n result = []\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {\n result.push(key)\n }\n }\n return result\n }\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object)\n }\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n if (isArray$1(value)) {\n return false\n }\n var type = typeof value\n if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {\n return true\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))\n }\n\n /* Built-in method references that are verified to be native. */\n var nativeCreate = getNative(Object, 'create')\n\n const nativeCreate$1 = nativeCreate\n\n /**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\n function hashClear() {\n this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {}\n this.size = 0\n }\n\n /**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key]\n this.size -= result ? 1 : 0\n return result\n }\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'\n\n /** Used for built-in method references. */\n var objectProto$9 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$8 = objectProto$9.hasOwnProperty\n\n /**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function hashGet(key) {\n var data = this.__data__\n if (nativeCreate$1) {\n var result = data[key]\n return result === HASH_UNDEFINED$2 ? undefined : result\n }\n return hasOwnProperty$8.call(data, key) ? data[key] : undefined\n }\n\n /** Used for built-in method references. */\n var objectProto$8 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$7 = objectProto$8.hasOwnProperty\n\n /**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function hashHas(key) {\n var data = this.__data__\n return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty$7.call(data, key)\n }\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'\n\n /**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\n function hashSet(key, value) {\n var data = this.__data__\n this.size += this.has(key) ? 0 : 1\n data[key] = nativeCreate$1 && value === undefined ? HASH_UNDEFINED$1 : value\n return this\n }\n\n /**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length\n\n this.clear()\n while (++index < length) {\n var entry = entries[index]\n this.set(entry[0], entry[1])\n }\n }\n\n // Add methods to `Hash`.\n Hash.prototype.clear = hashClear\n Hash.prototype['delete'] = hashDelete\n Hash.prototype.get = hashGet\n Hash.prototype.has = hashHas\n Hash.prototype.set = hashSet\n\n /**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\n function listCacheClear() {\n this.__data__ = []\n this.size = 0\n }\n\n /**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function assocIndexOf(array, key) {\n var length = array.length\n while (length--) {\n if (eq(array[length][0], key)) {\n return length\n }\n }\n return -1\n }\n\n /** Used for built-in method references. */\n var arrayProto = Array.prototype\n\n /** Built-in value references. */\n var splice = arrayProto.splice\n\n /**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key)\n\n if (index < 0) {\n return false\n }\n var lastIndex = data.length - 1\n if (index == lastIndex) {\n data.pop()\n } else {\n splice.call(data, index, 1)\n }\n --this.size\n return true\n }\n\n /**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key)\n\n return index < 0 ? undefined : data[index][1]\n }\n\n /**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1\n }\n\n /**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\n function listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key)\n\n if (index < 0) {\n ++this.size\n data.push([key, value])\n } else {\n data[index][1] = value\n }\n return this\n }\n\n /**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length\n\n this.clear()\n while (++index < length) {\n var entry = entries[index]\n this.set(entry[0], entry[1])\n }\n }\n\n // Add methods to `ListCache`.\n ListCache.prototype.clear = listCacheClear\n ListCache.prototype['delete'] = listCacheDelete\n ListCache.prototype.get = listCacheGet\n ListCache.prototype.has = listCacheHas\n ListCache.prototype.set = listCacheSet\n\n /* Built-in method references that are verified to be native. */\n var Map$1 = getNative(root$1, 'Map')\n\n const Map$2 = Map$1\n\n /**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\n function mapCacheClear() {\n this.size = 0\n this.__data__ = {\n hash: new Hash(),\n map: new (Map$2 || ListCache)(),\n string: new Hash(),\n }\n }\n\n /**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\n function isKeyable(value) {\n var type = typeof value\n return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean'\n ? value !== '__proto__'\n : value === null\n }\n\n /**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\n function getMapData(map, key) {\n var data = map.__data__\n return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map\n }\n\n /**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key)\n this.size -= result ? 1 : 0\n return result\n }\n\n /**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function mapCacheGet(key) {\n return getMapData(this, key).get(key)\n }\n\n /**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapCacheHas(key) {\n return getMapData(this, key).has(key)\n }\n\n /**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\n function mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size\n\n data.set(key, value)\n this.size += data.size == size ? 0 : 1\n return this\n }\n\n /**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length\n\n this.clear()\n while (++index < length) {\n var entry = entries[index]\n this.set(entry[0], entry[1])\n }\n }\n\n // Add methods to `MapCache`.\n MapCache.prototype.clear = mapCacheClear\n MapCache.prototype['delete'] = mapCacheDelete\n MapCache.prototype.get = mapCacheGet\n MapCache.prototype.has = mapCacheHas\n MapCache.prototype.set = mapCacheSet\n\n /** Error message constants. */\n var FUNC_ERROR_TEXT$1 = 'Expected a function'\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT$1)\n }\n var memoized = function () {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache\n\n if (cache.has(key)) {\n return cache.get(key)\n }\n var result = func.apply(this, args)\n memoized.cache = cache.set(key, result) || cache\n return result\n }\n memoized.cache = new (memoize.Cache || MapCache)()\n return memoized\n }\n\n // Expose `MapCache`.\n memoize.Cache = MapCache\n\n /** Used as the maximum memoize cache size. */\n var MAX_MEMOIZE_SIZE = 500\n\n /**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\n function memoizeCapped(func) {\n var result = memoize(func, function (key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear()\n }\n return key\n })\n\n var cache = result.cache\n return result\n }\n\n /** Used to match property names within property paths. */\n var rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g\n\n /**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\n var stringToPath = memoizeCapped(function (string) {\n var result = []\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('')\n }\n string.replace(rePropName, function (match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : number || match)\n })\n return result\n })\n\n const stringToPath$1 = stringToPath\n\n /**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\n function toString(value) {\n return value == null ? '' : baseToString(value)\n }\n\n /**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\n function castPath(value, object) {\n if (isArray$1(value)) {\n return value\n }\n return isKey(value, object) ? [value] : stringToPath$1(toString(value))\n }\n\n /** Used as references for various `Number` constants. */\n var INFINITY$1 = 1 / 0\n\n /**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\n function toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value\n }\n var result = value + ''\n return result == '0' && 1 / value == -INFINITY$1 ? '-0' : result\n }\n\n /**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path) {\n path = castPath(path, object)\n\n var index = 0,\n length = path.length\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])]\n }\n return index && index == length ? object : undefined\n }\n\n /**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path)\n return result === undefined ? defaultValue : result\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length\n\n while (++index < length) {\n array[offset + index] = values[index]\n }\n return array\n }\n\n /** Built-in value references. */\n var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : undefined\n\n /**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\n function isFlattenable(value) {\n return isArray$1(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol])\n }\n\n /**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length\n\n predicate || (predicate = isFlattenable)\n result || (result = [])\n\n while (++index < length) {\n var value = array[index]\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result)\n } else {\n arrayPush(result, value)\n }\n } else if (!isStrict) {\n result[result.length] = value\n }\n }\n return result\n }\n\n /**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\n function flatten(array) {\n var length = array == null ? 0 : array.length\n return length ? baseFlatten(array, 1) : []\n }\n\n /** Built-in value references. */\n var getPrototype = overArg(Object.getPrototypeOf, Object)\n\n const getPrototype$1 = getPrototype\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length\n\n if (start < 0) {\n start = -start > length ? 0 : length + start\n }\n end = end > length ? length : end\n if (end < 0) {\n end += length\n }\n length = start > end ? 0 : (end - start) >>> 0\n start >>>= 0\n\n var result = Array(length)\n while (++index < length) {\n result[index] = array[index + start]\n }\n return result\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n if (initAccum && length) {\n accumulator = array[++index]\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array)\n }\n return accumulator\n }\n\n /**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\n function stackClear() {\n this.__data__ = new ListCache()\n this.size = 0\n }\n\n /**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key)\n\n this.size = data.size\n return result\n }\n\n /**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function stackGet(key) {\n return this.__data__.get(key)\n }\n\n /**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function stackHas(key) {\n return this.__data__.has(key)\n }\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE$2 = 200\n\n /**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\n function stackSet(key, value) {\n var data = this.__data__\n if (data instanceof ListCache) {\n var pairs = data.__data__\n if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {\n pairs.push([key, value])\n this.size = ++data.size\n return this\n }\n data = this.__data__ = new MapCache(pairs)\n }\n data.set(key, value)\n this.size = data.size\n return this\n }\n\n /**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Stack(entries) {\n var data = (this.__data__ = new ListCache(entries))\n this.size = data.size\n }\n\n // Add methods to `Stack`.\n Stack.prototype.clear = stackClear\n Stack.prototype['delete'] = stackDelete\n Stack.prototype.get = stackGet\n Stack.prototype.has = stackHas\n Stack.prototype.set = stackSet\n\n /**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return object && copyObject(source, keys(source), object)\n }\n\n /**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object)\n }\n\n /** Detect free variable `exports`. */\n var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports\n\n /** Detect free variable `module`. */\n var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports\n\n /** Built-in value references. */\n var Buffer = moduleExports ? root$1.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined\n\n /**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\n function cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice()\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length)\n\n buffer.copy(result)\n return result\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = []\n\n while (++index < length) {\n var value = array[index]\n if (predicate(value, index, array)) {\n result[resIndex++] = value\n }\n }\n return result\n }\n\n /**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\n function stubArray() {\n return []\n }\n\n /** Used for built-in method references. */\n var objectProto$7 = Object.prototype\n\n /** Built-in value references. */\n var propertyIsEnumerable = objectProto$7.propertyIsEnumerable\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeGetSymbols$1 = Object.getOwnPropertySymbols\n\n /**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbols = !nativeGetSymbols$1\n ? stubArray\n : function (object) {\n if (object == null) {\n return []\n }\n object = Object(object)\n return arrayFilter(nativeGetSymbols$1(object), function (symbol) {\n return propertyIsEnumerable.call(object, symbol)\n })\n }\n\n const getSymbols$1 = getSymbols\n\n /**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbols(source, object) {\n return copyObject(source, getSymbols$1(source), object)\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeGetSymbols = Object.getOwnPropertySymbols\n\n /**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbolsIn = !nativeGetSymbols\n ? stubArray\n : function (object) {\n var result = []\n while (object) {\n arrayPush(result, getSymbols$1(object))\n object = getPrototype$1(object)\n }\n return result\n }\n\n const getSymbolsIn$1 = getSymbolsIn\n\n /**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn$1(source), object)\n }\n\n /**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object)\n return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object))\n }\n\n /**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols$1)\n }\n\n /**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn$1)\n }\n\n /* Built-in method references that are verified to be native. */\n var DataView = getNative(root$1, 'DataView')\n\n const DataView$1 = DataView\n\n /* Built-in method references that are verified to be native. */\n var Promise$1 = getNative(root$1, 'Promise')\n\n const Promise$2 = Promise$1\n\n /* Built-in method references that are verified to be native. */\n var Set = getNative(root$1, 'Set')\n\n const Set$1 = Set\n\n /** `Object#toString` result references. */\n var mapTag$5 = '[object Map]',\n objectTag$2 = '[object Object]',\n promiseTag = '[object Promise]',\n setTag$5 = '[object Set]',\n weakMapTag$1 = '[object WeakMap]'\n\n var dataViewTag$3 = '[object DataView]'\n\n /** Used to detect maps, sets, and weakmaps. */\n var dataViewCtorString = toSource(DataView$1),\n mapCtorString = toSource(Map$2),\n promiseCtorString = toSource(Promise$2),\n setCtorString = toSource(Set$1),\n weakMapCtorString = toSource(WeakMap$1)\n\n /**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n var getTag = baseGetTag\n\n // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\n if (\n (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3) ||\n (Map$2 && getTag(new Map$2()) != mapTag$5) ||\n (Promise$2 && getTag(Promise$2.resolve()) != promiseTag) ||\n (Set$1 && getTag(new Set$1()) != setTag$5) ||\n (WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1)\n ) {\n getTag = function (value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag$2 ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : ''\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString:\n return dataViewTag$3\n case mapCtorString:\n return mapTag$5\n case promiseCtorString:\n return promiseTag\n case setCtorString:\n return setTag$5\n case weakMapCtorString:\n return weakMapTag$1\n }\n }\n return result\n }\n }\n\n const getTag$1 = getTag\n\n /** Used for built-in method references. */\n var objectProto$6 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$6 = objectProto$6.hasOwnProperty\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length)\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty$6.call(array, 'index')) {\n result.index = array.index\n result.input = array.input\n }\n return result\n }\n\n /** Built-in value references. */\n var Uint8Array = root$1.Uint8Array\n\n const Uint8Array$1 = Uint8Array\n\n /**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength)\n new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer))\n return result\n }\n\n /**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\n function cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength)\n }\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/\n\n /**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\n function cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp))\n result.lastIndex = regexp.lastIndex\n return result\n }\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : undefined,\n symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined\n\n /**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\n function cloneSymbol(symbol) {\n return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {}\n }\n\n /**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\n function cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length)\n }\n\n /** `Object#toString` result references. */\n var boolTag$2 = '[object Boolean]',\n dateTag$2 = '[object Date]',\n mapTag$4 = '[object Map]',\n numberTag$2 = '[object Number]',\n regexpTag$3 = '[object RegExp]',\n setTag$4 = '[object Set]',\n stringTag$3 = '[object String]',\n symbolTag$2 = '[object Symbol]'\n\n var arrayBufferTag$2 = '[object ArrayBuffer]',\n dataViewTag$2 = '[object DataView]',\n float32Tag$1 = '[object Float32Array]',\n float64Tag$1 = '[object Float64Array]',\n int8Tag$1 = '[object Int8Array]',\n int16Tag$1 = '[object Int16Array]',\n int32Tag$1 = '[object Int32Array]',\n uint8Tag$1 = '[object Uint8Array]',\n uint8ClampedTag$1 = '[object Uint8ClampedArray]',\n uint16Tag$1 = '[object Uint16Array]',\n uint32Tag$1 = '[object Uint32Array]'\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor\n switch (tag) {\n case arrayBufferTag$2:\n return cloneArrayBuffer(object)\n\n case boolTag$2:\n case dateTag$2:\n return new Ctor(+object)\n\n case dataViewTag$2:\n return cloneDataView(object, isDeep)\n\n case float32Tag$1:\n case float64Tag$1:\n case int8Tag$1:\n case int16Tag$1:\n case int32Tag$1:\n case uint8Tag$1:\n case uint8ClampedTag$1:\n case uint16Tag$1:\n case uint32Tag$1:\n return cloneTypedArray(object, isDeep)\n\n case mapTag$4:\n return new Ctor()\n\n case numberTag$2:\n case stringTag$3:\n return new Ctor(object)\n\n case regexpTag$3:\n return cloneRegExp(object)\n\n case setTag$4:\n return new Ctor()\n\n case symbolTag$2:\n return cloneSymbol(object)\n }\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate$1(getPrototype$1(object)) : {}\n }\n\n /** `Object#toString` result references. */\n var mapTag$3 = '[object Map]'\n\n /**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\n function baseIsMap(value) {\n return isObjectLike(value) && getTag$1(value) == mapTag$3\n }\n\n /* Node.js helper references. */\n var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap\n\n /**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\n var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap\n\n const isMap$1 = isMap\n\n /** `Object#toString` result references. */\n var setTag$3 = '[object Set]'\n\n /**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\n function baseIsSet(value) {\n return isObjectLike(value) && getTag$1(value) == setTag$3\n }\n\n /* Node.js helper references. */\n var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet\n\n /**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\n var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet\n\n const isSet$1 = isSet\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG$1 = 4\n\n /** `Object#toString` result references. */\n var argsTag$1 = '[object Arguments]',\n arrayTag$1 = '[object Array]',\n boolTag$1 = '[object Boolean]',\n dateTag$1 = '[object Date]',\n errorTag$1 = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag$2 = '[object Map]',\n numberTag$1 = '[object Number]',\n objectTag$1 = '[object Object]',\n regexpTag$2 = '[object RegExp]',\n setTag$2 = '[object Set]',\n stringTag$2 = '[object String]',\n symbolTag$1 = '[object Symbol]',\n weakMapTag = '[object WeakMap]'\n\n var arrayBufferTag$1 = '[object ArrayBuffer]',\n dataViewTag$1 = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]'\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {}\n cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[\n dataViewTag$1\n ] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[\n float64Tag\n ] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[\n mapTag$2\n ] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$2] = cloneableTags[\n setTag$2\n ] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[\n uint8ClampedTag\n ] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true\n cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false\n\n /**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG$1\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value)\n }\n if (result !== undefined) {\n return result\n }\n if (!isObject(value)) {\n return value\n }\n var isArr = isArray$1(value)\n if (isArr) {\n result = initCloneArray(value)\n if (!isDeep) {\n return copyArray(value, result)\n }\n } else {\n var tag = getTag$1(value),\n isFunc = tag == funcTag || tag == genTag\n\n if (isBuffer$1(value)) {\n return cloneBuffer(value, isDeep)\n }\n if (tag == objectTag$1 || tag == argsTag$1 || (isFunc && !object)) {\n result = isFlat || isFunc ? {} : initCloneObject(value)\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value))\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {}\n }\n result = initCloneByTag(value, tag, isDeep)\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack())\n var stacked = stack.get(value)\n if (stacked) {\n return stacked\n }\n stack.set(value, result)\n\n if (isSet$1(value)) {\n value.forEach(function (subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack))\n })\n } else if (isMap$1(value)) {\n value.forEach(function (subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack))\n })\n }\n\n var keysFunc = isFull ? (isFlat ? getAllKeysIn : getAllKeys) : isFlat ? keysIn : keys\n\n var props = isArr ? undefined : keysFunc(value)\n arrayEach(props || value, function (subValue, key) {\n if (props) {\n key = subValue\n subValue = value[key]\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack))\n })\n return result\n }\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_SYMBOLS_FLAG = 4\n\n /**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\n function clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG)\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = []\n\n while (++index < length) {\n var value = array[index]\n if (value) {\n result[resIndex++] = value\n }\n }\n return result\n }\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED = '__lodash_hash_undefined__'\n\n /**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\n function setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED)\n return this\n }\n\n /**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\n function setCacheHas(value) {\n return this.__data__.has(value)\n }\n\n /**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length\n\n this.__data__ = new MapCache()\n while (++index < length) {\n this.add(values[index])\n }\n }\n\n // Add methods to `SetCache`.\n SetCache.prototype.add = SetCache.prototype.push = setCacheAdd\n SetCache.prototype.has = setCacheHas\n\n /**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true\n }\n }\n return false\n }\n\n /**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function cacheHas(cache, key) {\n return cache.has(key)\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$5 = 1,\n COMPARE_UNORDERED_FLAG$3 = 2\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,\n arrLength = array.length,\n othLength = other.length\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array)\n var othStacked = stack.get(other)\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array\n }\n var index = -1,\n result = true,\n seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : undefined\n\n stack.set(array, other)\n stack.set(other, array)\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index]\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack)\n }\n if (compared !== undefined) {\n if (compared) {\n continue\n }\n result = false\n break\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (\n !arraySome(other, function (othValue, othIndex) {\n if (\n !cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))\n ) {\n return seen.push(othIndex)\n }\n })\n ) {\n result = false\n break\n }\n } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n result = false\n break\n }\n }\n stack['delete'](array)\n stack['delete'](other)\n return result\n }\n\n /**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\n function mapToArray(map) {\n var index = -1,\n result = Array(map.size)\n\n map.forEach(function (value, key) {\n result[++index] = [key, value]\n })\n return result\n }\n\n /**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\n function setToArray(set) {\n var index = -1,\n result = Array(set.size)\n\n set.forEach(function (value) {\n result[++index] = value\n })\n return result\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$4 = 1,\n COMPARE_UNORDERED_FLAG$2 = 2\n\n /** `Object#toString` result references. */\n var boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag$1 = '[object Map]',\n numberTag = '[object Number]',\n regexpTag$1 = '[object RegExp]',\n setTag$1 = '[object Set]',\n stringTag$1 = '[object String]',\n symbolTag = '[object Symbol]'\n\n var arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]'\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {\n return false\n }\n object = object.buffer\n other = other.buffer\n\n case arrayBufferTag:\n if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {\n return false\n }\n return true\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other)\n\n case errorTag:\n return object.name == other.name && object.message == other.message\n\n case regexpTag$1:\n case stringTag$1:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == other + ''\n\n case mapTag$1:\n var convert = mapToArray\n\n case setTag$1:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4\n convert || (convert = setToArray)\n\n if (object.size != other.size && !isPartial) {\n return false\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object)\n if (stacked) {\n return stacked == other\n }\n bitmask |= COMPARE_UNORDERED_FLAG$2\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other)\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack)\n stack['delete'](object)\n return result\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other)\n }\n }\n return false\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$3 = 1\n\n /** Used for built-in method references. */\n var objectProto$5 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$5 = objectProto$5.hasOwnProperty\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length\n\n if (objLength != othLength && !isPartial) {\n return false\n }\n var index = objLength\n while (index--) {\n var key = objProps[index]\n if (!(isPartial ? key in other : hasOwnProperty$5.call(other, key))) {\n return false\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object)\n var othStacked = stack.get(other)\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object\n }\n var result = true\n stack.set(object, other)\n stack.set(other, object)\n\n var skipCtor = isPartial\n while (++index < objLength) {\n key = objProps[index]\n var objValue = object[key],\n othValue = other[key]\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack)\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (\n !(compared === undefined\n ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)\n : compared)\n ) {\n result = false\n break\n }\n skipCtor || (skipCtor = key == 'constructor')\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor\n\n // Non `Object` object instances with different constructors are not equal.\n if (\n objCtor != othCtor &&\n 'constructor' in object &&\n 'constructor' in other &&\n !(\n typeof objCtor == 'function' &&\n objCtor instanceof objCtor &&\n typeof othCtor == 'function' &&\n othCtor instanceof othCtor\n )\n ) {\n result = false\n }\n }\n stack['delete'](object)\n stack['delete'](other)\n return result\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$2 = 1\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]'\n\n /** Used for built-in method references. */\n var objectProto$4 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$4 = objectProto$4.hasOwnProperty\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray$1(object),\n othIsArr = isArray$1(other),\n objTag = objIsArr ? arrayTag : getTag$1(object),\n othTag = othIsArr ? arrayTag : getTag$1(other)\n\n objTag = objTag == argsTag ? objectTag : objTag\n othTag = othTag == argsTag ? objectTag : othTag\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag\n\n if (isSameTag && isBuffer$1(object)) {\n if (!isBuffer$1(other)) {\n return false\n }\n objIsArr = true\n objIsObj = false\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack())\n return objIsArr || isTypedArray$1(object)\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack)\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {\n var objIsWrapped = objIsObj && hasOwnProperty$4.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty$4.call(other, '__wrapped__')\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other\n\n stack || (stack = new Stack())\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack)\n }\n }\n if (!isSameTag) {\n return false\n }\n stack || (stack = new Stack())\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack)\n }\n\n /**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack)\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$1 = 1,\n COMPARE_UNORDERED_FLAG$1 = 2\n\n /**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer\n\n if (object == null) {\n return !length\n }\n object = Object(object)\n while (index--) {\n var data = matchData[index]\n if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {\n return false\n }\n }\n while (++index < length) {\n data = matchData[index]\n var key = data[0],\n objValue = object[key],\n srcValue = data[1]\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false\n }\n } else {\n var stack = new Stack()\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack)\n }\n if (\n !(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)\n : result)\n ) {\n return false\n }\n }\n }\n return true\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value)\n }\n\n /**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = keys(object),\n length = result.length\n\n while (length--) {\n var key = result[length],\n value = object[key]\n\n result[length] = [key, value, isStrictComparable(value)]\n }\n return result\n }\n\n /**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function matchesStrictComparable(key, srcValue) {\n return function (object) {\n if (object == null) {\n return false\n }\n return object[key] === srcValue && (srcValue !== undefined || key in Object(object))\n }\n }\n\n /**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source)\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1])\n }\n return function (object) {\n return object === source || baseIsMatch(object, source, matchData)\n }\n }\n\n /**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHasIn(object, key) {\n return object != null && key in Object(object)\n }\n\n /**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\n function hasPath(object, path, hasFunc) {\n path = castPath(path, object)\n\n var index = -1,\n length = path.length,\n result = false\n\n while (++index < length) {\n var key = toKey(path[index])\n if (!(result = object != null && hasFunc(object, key))) {\n break\n }\n object = object[key]\n }\n if (result || ++index != length) {\n return result\n }\n length = object == null ? 0 : object.length\n return !!length && isLength(length) && isIndex(key, length) && (isArray$1(object) || isArguments$1(object))\n }\n\n /**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\n function hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn)\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2\n\n /**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue)\n }\n return function (object) {\n var objValue = get(object, path)\n return objValue === undefined && objValue === srcValue\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)\n }\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function baseProperty(key) {\n return function (object) {\n return object == null ? undefined : object[key]\n }\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyDeep(path) {\n return function (object) {\n return baseGet(object, path)\n }\n }\n\n /**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\n function property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path)\n }\n\n /**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\n function baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value\n }\n if (value == null) {\n return identity\n }\n if (typeof value == 'object') {\n return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value)\n }\n return property(value)\n }\n\n /**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n var value = array[index]\n setter(accumulator, value, iteratee(value), array)\n }\n return accumulator\n }\n\n /**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function (object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length\n\n while (length--) {\n var key = props[fromRight ? length : ++index]\n if (iteratee(iterable[key], key, iterable) === false) {\n break\n }\n }\n return object\n }\n }\n\n /**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor()\n\n const baseFor$1 = baseFor\n\n /**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return object && baseFor$1(object, iteratee, keys)\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function (collection, iteratee) {\n if (collection == null) {\n return collection\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee)\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection)\n\n while (fromRight ? index-- : ++index < length) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break\n }\n }\n return collection\n }\n }\n\n /**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn)\n\n const baseEach$1 = baseEach\n\n /**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach$1(collection, function (value, key, collection) {\n setter(accumulator, value, iteratee(value), collection)\n })\n return accumulator\n }\n\n /**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function (collection, iteratee) {\n var func = isArray$1(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {}\n\n return func(collection, setter, baseIteratee(iteratee), accumulator)\n }\n }\n\n /** Used for built-in method references. */\n var objectProto$3 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$3 = objectProto$3.hasOwnProperty\n\n /**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var defaults = baseRest(function (object, sources) {\n object = Object(object)\n\n var index = -1\n var length = sources.length\n var guard = length > 2 ? sources[2] : undefined\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1\n }\n\n while (++index < length) {\n var source = sources[index]\n var props = keysIn(source)\n var propsIndex = -1\n var propsLength = props.length\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex]\n var value = object[key]\n\n if (value === undefined || (eq(value, objectProto$3[key]) && !hasOwnProperty$3.call(object, key))) {\n object[key] = source[key]\n }\n }\n }\n\n return object\n })\n\n const defaults$1 = defaults\n\n /**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\n function isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value)\n }\n\n /**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true\n }\n }\n return false\n }\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE$1 = 200\n\n /**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length\n\n if (!length) {\n return result\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee))\n }\n if (comparator) {\n includes = arrayIncludesWith\n isCommon = false\n } else if (values.length >= LARGE_ARRAY_SIZE$1) {\n includes = cacheHas\n isCommon = false\n values = new SetCache(values)\n }\n outer: while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value)\n\n value = comparator || value !== 0 ? value : 0\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer\n }\n }\n result.push(value)\n } else if (!includes(values, computed, comparator)) {\n result.push(value)\n }\n }\n return result\n }\n\n /**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\n var difference = baseRest(function (array, values) {\n return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []\n })\n\n const difference$1 = difference\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array == null ? 0 : array.length\n return length ? array[length - 1] : undefined\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return []\n }\n n = guard || n === undefined ? 1 : toInteger(n)\n return baseSlice(array, n < 0 ? 0 : n, length)\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return []\n }\n n = guard || n === undefined ? 1 : toInteger(n)\n n = length - n\n return baseSlice(array, 0, n < 0 ? 0 : n)\n }\n\n /**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\n function castFunction(value) {\n return typeof value == 'function' ? value : identity\n }\n\n /**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forEach(collection, iteratee) {\n var func = isArray$1(collection) ? arrayEach : baseEach$1\n return func(collection, castFunction(iteratee))\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false\n }\n }\n return true\n }\n\n /**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true\n baseEach$1(collection, function (value, index, collection) {\n result = !!predicate(value, index, collection)\n return result\n })\n return result\n }\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, guard) {\n var func = isArray$1(collection) ? arrayEvery : baseEvery\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined\n }\n return func(collection, baseIteratee(predicate))\n }\n\n /**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = []\n baseEach$1(collection, function (value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value)\n }\n })\n return result\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\n function filter(collection, predicate) {\n var func = isArray$1(collection) ? arrayFilter : baseFilter\n return func(collection, baseIteratee(predicate))\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\n function createFind(findIndexFunc) {\n return function (collection, predicate, fromIndex) {\n var iterable = Object(collection)\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate)\n collection = keys(collection)\n predicate = function (key) {\n return iteratee(iterable[key], key, iterable)\n }\n }\n var index = findIndexFunc(collection, predicate, fromIndex)\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined\n }\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax$2 = Math.max\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\n function findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return -1\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex)\n if (index < 0) {\n index = nativeMax$2(length + index, 0)\n }\n return baseFindIndex(array, baseIteratee(predicate), index)\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\n var find = createFind(findIndex)\n\n const find$1 = find\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\n function head(array) {\n return array && array.length ? array[0] : undefined\n }\n\n /**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : []\n\n baseEach$1(collection, function (value, key, collection) {\n result[++index] = iteratee(value, key, collection)\n })\n return result\n }\n\n /**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee) {\n var func = isArray$1(collection) ? arrayMap : baseMap\n return func(collection, baseIteratee(iteratee))\n }\n\n /**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1)\n }\n\n /** Used for built-in method references. */\n var objectProto$2 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$2 = objectProto$2.hasOwnProperty\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function (result, value, key) {\n if (hasOwnProperty$2.call(result, key)) {\n result[key].push(value)\n } else {\n baseAssignValue(result, key, [value])\n }\n })\n\n const groupBy$1 = groupBy\n\n /** Used for built-in method references. */\n var objectProto$1 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$1 = objectProto$1.hasOwnProperty\n\n /**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHas(object, key) {\n return object != null && hasOwnProperty$1.call(object, key)\n }\n\n /**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\n function has(object, path) {\n return object != null && hasPath(object, path, baseHas)\n }\n\n /** `Object#toString` result references. */\n var stringTag = '[object String]'\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' || (!isArray$1(value) && isObjectLike(value) && baseGetTag(value) == stringTag)\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n return arrayMap(props, function (key) {\n return object[key]\n })\n }\n\n /**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return object == null ? [] : baseValues(object, keys(object))\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax$1 = Math.max\n\n /**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\n function includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection)\n fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0\n\n var length = collection.length\n if (fromIndex < 0) {\n fromIndex = nativeMax$1(length + fromIndex, 0)\n }\n return isString(collection)\n ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1\n : !!length && baseIndexOf(collection, value, fromIndex) > -1\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax = Math.max\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return -1\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex)\n if (index < 0) {\n index = nativeMax(length + index, 0)\n }\n return baseIndexOf(array, value, index)\n }\n\n /** `Object#toString` result references. */\n var mapTag = '[object Map]',\n setTag = '[object Set]'\n\n /** Used for built-in method references. */\n var objectProto = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty\n\n /**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true\n }\n if (\n isArrayLike(value) &&\n (isArray$1(value) ||\n typeof value == 'string' ||\n typeof value.splice == 'function' ||\n isBuffer$1(value) ||\n isTypedArray$1(value) ||\n isArguments$1(value))\n ) {\n return !value.length\n }\n var tag = getTag$1(value)\n if (tag == mapTag || tag == setTag) {\n return !value.size\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false\n }\n }\n return true\n }\n\n /** `Object#toString` result references. */\n var regexpTag = '[object RegExp]'\n\n /**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\n function baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag\n }\n\n /* Node.js helper references. */\n var nodeIsRegExp = nodeUtil$1 && nodeUtil$1.isRegExp\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp\n\n const isRegExp$1 = isRegExp\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined\n }\n\n /** Error message constants. */\n var FUNC_ERROR_TEXT = 'Expected a function'\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT)\n }\n return function () {\n var args = arguments\n switch (args.length) {\n case 0:\n return !predicate.call(this)\n case 1:\n return !predicate.call(this, args[0])\n case 2:\n return !predicate.call(this, args[0], args[1])\n case 3:\n return !predicate.call(this, args[0], args[1], args[2])\n }\n return !predicate.apply(this, args)\n }\n }\n\n /**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object\n }\n path = castPath(path, object)\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object\n }\n\n if (index != lastIndex) {\n var objValue = nested[key]\n newValue = customizer ? customizer(objValue, key, nested) : undefined\n if (newValue === undefined) {\n newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}\n }\n }\n assignValue(nested, key, newValue)\n nested = nested[key]\n }\n return object\n }\n\n /**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\n function basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {}\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path)\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value)\n }\n }\n return result\n }\n\n /**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\n function pickBy(object, predicate) {\n if (object == null) {\n return {}\n }\n var props = arrayMap(getAllKeysIn(object), function (prop) {\n return [prop]\n })\n predicate = baseIteratee(predicate)\n return basePickBy(object, props, function (value, path) {\n return predicate(value, path[0])\n })\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function (value, index, collection) {\n accumulator = initAccum ? ((initAccum = false), value) : iteratee(accumulator, value, index, collection)\n })\n return accumulator\n }\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\n function reduce(collection, iteratee, accumulator) {\n var func = isArray$1(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3\n\n return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1)\n }\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\n function reject(collection, predicate) {\n var func = isArray$1(collection) ? arrayFilter : baseFilter\n return func(collection, negate(baseIteratee(predicate)))\n }\n\n /**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result\n\n baseEach$1(collection, function (value, index, collection) {\n result = predicate(value, index, collection)\n return !result\n })\n return !!result\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, guard) {\n var func = isArray$1(collection) ? arraySome : baseSome\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined\n }\n return func(collection, baseIteratee(predicate))\n }\n\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0\n\n /**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\n var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY)\n ? noop\n : function (values) {\n return new Set$1(values)\n }\n\n const createSet$1 = createSet\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200\n\n /**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result\n\n if (comparator) {\n isCommon = false\n includes = arrayIncludesWith\n } else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet$1(array)\n if (set) {\n return setToArray(set)\n }\n isCommon = false\n includes = cacheHas\n seen = new SetCache()\n } else {\n seen = iteratee ? [] : result\n }\n outer: while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value\n\n value = comparator || value !== 0 ? value : 0\n if (isCommon && computed === computed) {\n var seenIndex = seen.length\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer\n }\n }\n if (iteratee) {\n seen.push(computed)\n }\n result.push(value)\n } else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed)\n }\n result.push(value)\n }\n }\n return result\n }\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\n function uniq(array) {\n return array && array.length ? baseUniq(array) : []\n }\n\n function PRINT_ERROR(msg) {\n /* istanbul ignore else - can't override global.console in node.js */\n if (console && console.error) {\n console.error(`Error: ${msg}`)\n }\n }\n function PRINT_WARNING(msg) {\n /* istanbul ignore else - can't override global.console in node.js*/\n if (console && console.warn) {\n // TODO: modify docs accordingly\n console.warn(`Warning: ${msg}`)\n }\n }\n\n function timer(func) {\n const start = new Date().getTime()\n const val = func()\n const end = new Date().getTime()\n const total = end - start\n return { time: total, value: val }\n }\n\n // based on: https://github.com/petkaantonov/bluebird/blob/b97c0d2d487e8c5076e8bd897e0dcd4622d31846/src/util.js#L201-L216\n function toFastProperties(toBecomeFast) {\n function FakeConstructor() {}\n // If our object is used as a constructor, it would receive\n FakeConstructor.prototype = toBecomeFast\n const fakeInstance = new FakeConstructor()\n function fakeAccess() {\n return typeof fakeInstance.bar\n }\n // help V8 understand this is a \"real\" prototype by actually using\n // the fake instance.\n fakeAccess()\n fakeAccess()\n // Always true condition to suppress the Firefox warning of unreachable\n // code after a return statement.\n return toBecomeFast\n }\n\n // TODO: duplicated code to avoid extracting another sub-package -- how to avoid?\n function tokenLabel$1(tokType) {\n if (hasTokenLabel$1(tokType)) {\n return tokType.LABEL\n } else {\n return tokType.name\n }\n }\n // TODO: duplicated code to avoid extracting another sub-package -- how to avoid?\n function hasTokenLabel$1(obj) {\n return isString(obj.LABEL) && obj.LABEL !== ''\n }\n class AbstractProduction {\n get definition() {\n return this._definition\n }\n set definition(value) {\n this._definition = value\n }\n constructor(_definition) {\n this._definition = _definition\n }\n accept(visitor) {\n visitor.visit(this)\n forEach(this.definition, (prod) => {\n prod.accept(visitor)\n })\n }\n }\n class NonTerminal extends AbstractProduction {\n constructor(options) {\n super([])\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n set definition(definition) {\n // immutable\n }\n get definition() {\n if (this.referencedRule !== undefined) {\n return this.referencedRule.definition\n }\n return []\n }\n accept(visitor) {\n visitor.visit(this)\n // don't visit children of a reference, we will get cyclic infinite loops if we do so\n }\n }\n class Rule extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.orgText = ''\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Alternative extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.ignoreAmbiguities = false\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Option extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class RepetitionMandatory extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class RepetitionMandatoryWithSeparator extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Repetition extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class RepetitionWithSeparator extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Alternation extends AbstractProduction {\n get definition() {\n return this._definition\n }\n set definition(value) {\n this._definition = value\n }\n constructor(options) {\n super(options.definition)\n this.idx = 1\n this.ignoreAmbiguities = false\n this.hasPredicates = false\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Terminal {\n constructor(options) {\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n accept(visitor) {\n visitor.visit(this)\n }\n }\n function serializeGrammar(topRules) {\n return map(topRules, serializeProduction)\n }\n function serializeProduction(node) {\n function convertDefinition(definition) {\n return map(definition, serializeProduction)\n }\n /* istanbul ignore else */\n if (node instanceof NonTerminal) {\n const serializedNonTerminal = {\n type: 'NonTerminal',\n name: node.nonTerminalName,\n idx: node.idx,\n }\n if (isString(node.label)) {\n serializedNonTerminal.label = node.label\n }\n return serializedNonTerminal\n } else if (node instanceof Alternative) {\n return {\n type: 'Alternative',\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Option) {\n return {\n type: 'Option',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof RepetitionMandatory) {\n return {\n type: 'RepetitionMandatory',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof RepetitionMandatoryWithSeparator) {\n return {\n type: 'RepetitionMandatoryWithSeparator',\n idx: node.idx,\n separator: serializeProduction(new Terminal({ terminalType: node.separator })),\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof RepetitionWithSeparator) {\n return {\n type: 'RepetitionWithSeparator',\n idx: node.idx,\n separator: serializeProduction(new Terminal({ terminalType: node.separator })),\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Repetition) {\n return {\n type: 'Repetition',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Alternation) {\n return {\n type: 'Alternation',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Terminal) {\n const serializedTerminal = {\n type: 'Terminal',\n name: node.terminalType.name,\n label: tokenLabel$1(node.terminalType),\n idx: node.idx,\n }\n if (isString(node.label)) {\n serializedTerminal.terminalLabel = node.label\n }\n const pattern = node.terminalType.PATTERN\n if (node.terminalType.PATTERN) {\n serializedTerminal.pattern = isRegExp$1(pattern) ? pattern.source : pattern\n }\n return serializedTerminal\n } else if (node instanceof Rule) {\n return {\n type: 'Rule',\n name: node.name,\n orgText: node.orgText,\n definition: convertDefinition(node.definition),\n }\n /* c8 ignore next 3 */\n } else {\n throw Error('non exhaustive match')\n }\n }\n\n class GAstVisitor {\n visit(node) {\n const nodeAny = node\n switch (nodeAny.constructor) {\n case NonTerminal:\n return this.visitNonTerminal(nodeAny)\n case Alternative:\n return this.visitAlternative(nodeAny)\n case Option:\n return this.visitOption(nodeAny)\n case RepetitionMandatory:\n return this.visitRepetitionMandatory(nodeAny)\n case RepetitionMandatoryWithSeparator:\n return this.visitRepetitionMandatoryWithSeparator(nodeAny)\n case RepetitionWithSeparator:\n return this.visitRepetitionWithSeparator(nodeAny)\n case Repetition:\n return this.visitRepetition(nodeAny)\n case Alternation:\n return this.visitAlternation(nodeAny)\n case Terminal:\n return this.visitTerminal(nodeAny)\n case Rule:\n return this.visitRule(nodeAny)\n /* c8 ignore next 2 */\n default:\n throw Error('non exhaustive match')\n }\n }\n /* c8 ignore next */\n visitNonTerminal(node) {}\n /* c8 ignore next */\n visitAlternative(node) {}\n /* c8 ignore next */\n visitOption(node) {}\n /* c8 ignore next */\n visitRepetition(node) {}\n /* c8 ignore next */\n visitRepetitionMandatory(node) {}\n /* c8 ignore next 3 */\n visitRepetitionMandatoryWithSeparator(node) {}\n /* c8 ignore next */\n visitRepetitionWithSeparator(node) {}\n /* c8 ignore next */\n visitAlternation(node) {}\n /* c8 ignore next */\n visitTerminal(node) {}\n /* c8 ignore next */\n visitRule(node) {}\n }\n\n function isSequenceProd(prod) {\n return (\n prod instanceof Alternative ||\n prod instanceof Option ||\n prod instanceof Repetition ||\n prod instanceof RepetitionMandatory ||\n prod instanceof RepetitionMandatoryWithSeparator ||\n prod instanceof RepetitionWithSeparator ||\n prod instanceof Terminal ||\n prod instanceof Rule\n )\n }\n function isOptionalProd(prod, alreadyVisited = []) {\n const isDirectlyOptional =\n prod instanceof Option || prod instanceof Repetition || prod instanceof RepetitionWithSeparator\n if (isDirectlyOptional) {\n return true\n }\n // note that this can cause infinite loop if one optional empty TOP production has a cyclic dependency with another\n // empty optional top rule\n // may be indirectly optional ((A?B?C?) | (D?E?F?))\n if (prod instanceof Alternation) {\n // for OR its enough for just one of the alternatives to be optional\n return some(prod.definition, (subProd) => {\n return isOptionalProd(subProd, alreadyVisited)\n })\n } else if (prod instanceof NonTerminal && includes(alreadyVisited, prod)) {\n // avoiding stack overflow due to infinite recursion\n return false\n } else if (prod instanceof AbstractProduction) {\n if (prod instanceof NonTerminal) {\n alreadyVisited.push(prod)\n }\n return every(prod.definition, (subProd) => {\n return isOptionalProd(subProd, alreadyVisited)\n })\n } else {\n return false\n }\n }\n function isBranchingProd(prod) {\n return prod instanceof Alternation\n }\n function getProductionDslName(prod) {\n /* istanbul ignore else */\n if (prod instanceof NonTerminal) {\n return 'SUBRULE'\n } else if (prod instanceof Option) {\n return 'OPTION'\n } else if (prod instanceof Alternation) {\n return 'OR'\n } else if (prod instanceof RepetitionMandatory) {\n return 'AT_LEAST_ONE'\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n return 'AT_LEAST_ONE_SEP'\n } else if (prod instanceof RepetitionWithSeparator) {\n return 'MANY_SEP'\n } else if (prod instanceof Repetition) {\n return 'MANY'\n } else if (prod instanceof Terminal) {\n return 'CONSUME'\n /* c8 ignore next 3 */\n } else {\n throw Error('non exhaustive match')\n }\n }\n\n /**\n * A Grammar Walker that computes the \"remaining\" grammar \"after\" a productions in the grammar.\n */\n class RestWalker {\n walk(prod, prevRest = []) {\n forEach(prod.definition, (subProd, index) => {\n const currRest = drop(prod.definition, index + 1)\n /* istanbul ignore else */\n if (subProd instanceof NonTerminal) {\n this.walkProdRef(subProd, currRest, prevRest)\n } else if (subProd instanceof Terminal) {\n this.walkTerminal(subProd, currRest, prevRest)\n } else if (subProd instanceof Alternative) {\n this.walkFlat(subProd, currRest, prevRest)\n } else if (subProd instanceof Option) {\n this.walkOption(subProd, currRest, prevRest)\n } else if (subProd instanceof RepetitionMandatory) {\n this.walkAtLeastOne(subProd, currRest, prevRest)\n } else if (subProd instanceof RepetitionMandatoryWithSeparator) {\n this.walkAtLeastOneSep(subProd, currRest, prevRest)\n } else if (subProd instanceof RepetitionWithSeparator) {\n this.walkManySep(subProd, currRest, prevRest)\n } else if (subProd instanceof Repetition) {\n this.walkMany(subProd, currRest, prevRest)\n } else if (subProd instanceof Alternation) {\n this.walkOr(subProd, currRest, prevRest)\n } else {\n throw Error('non exhaustive match')\n }\n })\n }\n walkTerminal(terminal, currRest, prevRest) {}\n walkProdRef(refProd, currRest, prevRest) {}\n walkFlat(flatProd, currRest, prevRest) {\n // ABCDEF => after the D the rest is EF\n const fullOrRest = currRest.concat(prevRest)\n this.walk(flatProd, fullOrRest)\n }\n walkOption(optionProd, currRest, prevRest) {\n // ABC(DE)?F => after the (DE)? the rest is F\n const fullOrRest = currRest.concat(prevRest)\n this.walk(optionProd, fullOrRest)\n }\n walkAtLeastOne(atLeastOneProd, currRest, prevRest) {\n // ABC(DE)+F => after the (DE)+ the rest is (DE)?F\n const fullAtLeastOneRest = [new Option({ definition: atLeastOneProd.definition })].concat(currRest, prevRest)\n this.walk(atLeastOneProd, fullAtLeastOneRest)\n }\n walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {\n // ABC DE(,DE)* F => after the (,DE)+ the rest is (,DE)?F\n const fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest)\n this.walk(atLeastOneSepProd, fullAtLeastOneSepRest)\n }\n walkMany(manyProd, currRest, prevRest) {\n // ABC(DE)*F => after the (DE)* the rest is (DE)?F\n const fullManyRest = [new Option({ definition: manyProd.definition })].concat(currRest, prevRest)\n this.walk(manyProd, fullManyRest)\n }\n walkManySep(manySepProd, currRest, prevRest) {\n // ABC (DE(,DE)*)? F => after the (,DE)* the rest is (,DE)?F\n const fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest)\n this.walk(manySepProd, fullManySepRest)\n }\n walkOr(orProd, currRest, prevRest) {\n // ABC(D|E|F)G => when finding the (D|E|F) the rest is G\n const fullOrRest = currRest.concat(prevRest)\n // walk all different alternatives\n forEach(orProd.definition, (alt) => {\n // wrapping each alternative in a single definition wrapper\n // to avoid errors in computing the rest of that alternative in the invocation to computeInProdFollows\n // (otherwise for OR([alt1,alt2]) alt2 will be considered in 'rest' of alt1\n const prodWrapper = new Alternative({ definition: [alt] })\n this.walk(prodWrapper, fullOrRest)\n })\n }\n }\n function restForRepetitionWithSeparator(repSepProd, currRest, prevRest) {\n const repSepRest = [\n new Option({\n definition: [new Terminal({ terminalType: repSepProd.separator })].concat(repSepProd.definition),\n }),\n ]\n const fullRepSepRest = repSepRest.concat(currRest, prevRest)\n return fullRepSepRest\n }\n\n function first(prod) {\n /* istanbul ignore else */\n if (prod instanceof NonTerminal) {\n // this could in theory cause infinite loops if\n // (1) prod A refs prod B.\n // (2) prod B refs prod A\n // (3) AB can match the empty set\n // in other words a cycle where everything is optional so the first will keep\n // looking ahead for the next optional part and will never exit\n // currently there is no safeguard for this unique edge case because\n // (1) not sure a grammar in which this can happen is useful for anything (productive)\n return first(prod.referencedRule)\n } else if (prod instanceof Terminal) {\n return firstForTerminal(prod)\n } else if (isSequenceProd(prod)) {\n return firstForSequence(prod)\n } else if (isBranchingProd(prod)) {\n return firstForBranching(prod)\n } else {\n throw Error('non exhaustive match')\n }\n }\n function firstForSequence(prod) {\n let firstSet = []\n const seq = prod.definition\n let nextSubProdIdx = 0\n let hasInnerProdsRemaining = seq.length > nextSubProdIdx\n let currSubProd\n // so we enter the loop at least once (if the definition is not empty\n let isLastInnerProdOptional = true\n // scan a sequence until it's end or until we have found a NONE optional production in it\n while (hasInnerProdsRemaining && isLastInnerProdOptional) {\n currSubProd = seq[nextSubProdIdx]\n isLastInnerProdOptional = isOptionalProd(currSubProd)\n firstSet = firstSet.concat(first(currSubProd))\n nextSubProdIdx = nextSubProdIdx + 1\n hasInnerProdsRemaining = seq.length > nextSubProdIdx\n }\n return uniq(firstSet)\n }\n function firstForBranching(prod) {\n const allAlternativesFirsts = map(prod.definition, (innerProd) => {\n return first(innerProd)\n })\n return uniq(flatten(allAlternativesFirsts))\n }\n function firstForTerminal(terminal) {\n return [terminal.terminalType]\n }\n\n // TODO: can this be removed? where is it used?\n const IN = '_~IN~_'\n\n // This ResyncFollowsWalker computes all of the follows required for RESYNC\n // (skipping reference production).\n class ResyncFollowsWalker extends RestWalker {\n constructor(topProd) {\n super()\n this.topProd = topProd\n this.follows = {}\n }\n startWalking() {\n this.walk(this.topProd)\n return this.follows\n }\n walkTerminal(terminal, currRest, prevRest) {\n // do nothing! just like in the public sector after 13:00\n }\n walkProdRef(refProd, currRest, prevRest) {\n const followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) + this.topProd.name\n const fullRest = currRest.concat(prevRest)\n const restProd = new Alternative({ definition: fullRest })\n const t_in_topProd_follows = first(restProd)\n this.follows[followName] = t_in_topProd_follows\n }\n }\n function computeAllProdsFollows(topProductions) {\n const reSyncFollows = {}\n forEach(topProductions, (topProd) => {\n const currRefsFollow = new ResyncFollowsWalker(topProd).startWalking()\n assign$1(reSyncFollows, currRefsFollow)\n })\n return reSyncFollows\n }\n function buildBetweenProdsFollowPrefix(inner, occurenceInParent) {\n return inner.name + occurenceInParent + IN\n }\n\n function cc(char) {\n return char.charCodeAt(0)\n }\n function insertToSet(item, set) {\n if (Array.isArray(item)) {\n item.forEach(function (subItem) {\n set.push(subItem)\n })\n } else {\n set.push(item)\n }\n }\n function addFlag(flagObj, flagKey) {\n if (flagObj[flagKey] === true) {\n throw 'duplicate flag ' + flagKey\n }\n flagObj[flagKey]\n flagObj[flagKey] = true\n }\n function ASSERT_EXISTS(obj) {\n // istanbul ignore next\n if (obj === undefined) {\n throw Error('Internal Error - Should never get here!')\n }\n return true\n }\n // istanbul ignore next\n function ASSERT_NEVER_REACH_HERE() {\n throw Error('Internal Error - Should never get here!')\n }\n function isCharacter(obj) {\n return obj['type'] === 'Character'\n }\n\n const digitsCharCodes = []\n for (let i = cc('0'); i <= cc('9'); i++) {\n digitsCharCodes.push(i)\n }\n const wordCharCodes = [cc('_')].concat(digitsCharCodes)\n for (let i = cc('a'); i <= cc('z'); i++) {\n wordCharCodes.push(i)\n }\n for (let i = cc('A'); i <= cc('Z'); i++) {\n wordCharCodes.push(i)\n }\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#character-classes\n const whitespaceCodes = [\n cc(' '),\n cc('\\f'),\n cc('\\n'),\n cc('\\r'),\n cc('\\t'),\n cc('\\v'),\n cc('\\t'),\n cc('\\u00a0'),\n cc('\\u1680'),\n cc('\\u2000'),\n cc('\\u2001'),\n cc('\\u2002'),\n cc('\\u2003'),\n cc('\\u2004'),\n cc('\\u2005'),\n cc('\\u2006'),\n cc('\\u2007'),\n cc('\\u2008'),\n cc('\\u2009'),\n cc('\\u200a'),\n cc('\\u2028'),\n cc('\\u2029'),\n cc('\\u202f'),\n cc('\\u205f'),\n cc('\\u3000'),\n cc('\\ufeff'),\n ]\n\n // consts and utilities\n const hexDigitPattern = /[0-9a-fA-F]/\n const decimalPattern = /[0-9]/\n const decimalPatternNoZero = /[1-9]/\n // https://hackernoon.com/the-madness-of-parsing-real-world-javascript-regexps-d9ee336df983\n // https://www.ecma-international.org/ecma-262/8.0/index.html#prod-Pattern\n class RegExpParser {\n constructor() {\n this.idx = 0\n this.input = ''\n this.groupIdx = 0\n }\n saveState() {\n return {\n idx: this.idx,\n input: this.input,\n groupIdx: this.groupIdx,\n }\n }\n restoreState(newState) {\n this.idx = newState.idx\n this.input = newState.input\n this.groupIdx = newState.groupIdx\n }\n pattern(input) {\n // parser state\n this.idx = 0\n this.input = input\n this.groupIdx = 0\n this.consumeChar('/')\n const value = this.disjunction()\n this.consumeChar('/')\n const flags = {\n type: 'Flags',\n loc: { begin: this.idx, end: input.length },\n global: false,\n ignoreCase: false,\n multiLine: false,\n unicode: false,\n sticky: false,\n }\n while (this.isRegExpFlag()) {\n switch (this.popChar()) {\n case 'g':\n addFlag(flags, 'global')\n break\n case 'i':\n addFlag(flags, 'ignoreCase')\n break\n case 'm':\n addFlag(flags, 'multiLine')\n break\n case 'u':\n addFlag(flags, 'unicode')\n break\n case 'y':\n addFlag(flags, 'sticky')\n break\n }\n }\n if (this.idx !== this.input.length) {\n throw Error('Redundant input: ' + this.input.substring(this.idx))\n }\n return {\n type: 'Pattern',\n flags: flags,\n value: value,\n loc: this.loc(0),\n }\n }\n disjunction() {\n const alts = []\n const begin = this.idx\n alts.push(this.alternative())\n while (this.peekChar() === '|') {\n this.consumeChar('|')\n alts.push(this.alternative())\n }\n return { type: 'Disjunction', value: alts, loc: this.loc(begin) }\n }\n alternative() {\n const terms = []\n const begin = this.idx\n while (this.isTerm()) {\n terms.push(this.term())\n }\n return { type: 'Alternative', value: terms, loc: this.loc(begin) }\n }\n term() {\n if (this.isAssertion()) {\n return this.assertion()\n } else {\n return this.atom()\n }\n }\n assertion() {\n const begin = this.idx\n switch (this.popChar()) {\n case '^':\n return {\n type: 'StartAnchor',\n loc: this.loc(begin),\n }\n case '$':\n return { type: 'EndAnchor', loc: this.loc(begin) }\n // '\\b' or '\\B'\n case '\\\\':\n switch (this.popChar()) {\n case 'b':\n return {\n type: 'WordBoundary',\n loc: this.loc(begin),\n }\n case 'B':\n return {\n type: 'NonWordBoundary',\n loc: this.loc(begin),\n }\n }\n // istanbul ignore next\n throw Error('Invalid Assertion Escape')\n // '(?=' or '(?!'\n case '(':\n this.consumeChar('?')\n let type\n switch (this.popChar()) {\n case '=':\n type = 'Lookahead'\n break\n case '!':\n type = 'NegativeLookahead'\n break\n }\n ASSERT_EXISTS(type)\n const disjunction = this.disjunction()\n this.consumeChar(')')\n return {\n type: type,\n value: disjunction,\n loc: this.loc(begin),\n }\n }\n // istanbul ignore next\n return ASSERT_NEVER_REACH_HERE()\n }\n quantifier(isBacktracking = false) {\n let range = undefined\n const begin = this.idx\n switch (this.popChar()) {\n case '*':\n range = {\n atLeast: 0,\n atMost: Infinity,\n }\n break\n case '+':\n range = {\n atLeast: 1,\n atMost: Infinity,\n }\n break\n case '?':\n range = {\n atLeast: 0,\n atMost: 1,\n }\n break\n case '{':\n const atLeast = this.integerIncludingZero()\n switch (this.popChar()) {\n case '}':\n range = {\n atLeast: atLeast,\n atMost: atLeast,\n }\n break\n case ',':\n let atMost\n if (this.isDigit()) {\n atMost = this.integerIncludingZero()\n range = {\n atLeast: atLeast,\n atMost: atMost,\n }\n } else {\n range = {\n atLeast: atLeast,\n atMost: Infinity,\n }\n }\n this.consumeChar('}')\n break\n }\n // throwing exceptions from \"ASSERT_EXISTS\" during backtracking\n // causes severe performance degradations\n if (isBacktracking === true && range === undefined) {\n return undefined\n }\n ASSERT_EXISTS(range)\n break\n }\n // throwing exceptions from \"ASSERT_EXISTS\" during backtracking\n // causes severe performance degradations\n if (isBacktracking === true && range === undefined) {\n return undefined\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(range)) {\n if (this.peekChar(0) === '?') {\n this.consumeChar('?')\n range.greedy = false\n } else {\n range.greedy = true\n }\n range.type = 'Quantifier'\n range.loc = this.loc(begin)\n return range\n }\n }\n atom() {\n let atom\n const begin = this.idx\n switch (this.peekChar()) {\n case '.':\n atom = this.dotAll()\n break\n case '\\\\':\n atom = this.atomEscape()\n break\n case '[':\n atom = this.characterClass()\n break\n case '(':\n atom = this.group()\n break\n }\n if (atom === undefined && this.isPatternCharacter()) {\n atom = this.patternCharacter()\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(atom)) {\n atom.loc = this.loc(begin)\n if (this.isQuantifier()) {\n atom.quantifier = this.quantifier()\n }\n return atom\n }\n }\n dotAll() {\n this.consumeChar('.')\n return {\n type: 'Set',\n complement: true,\n value: [cc('\\n'), cc('\\r'), cc('\\u2028'), cc('\\u2029')],\n }\n }\n atomEscape() {\n this.consumeChar('\\\\')\n switch (this.peekChar()) {\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n return this.decimalEscapeAtom()\n case 'd':\n case 'D':\n case 's':\n case 'S':\n case 'w':\n case 'W':\n return this.characterClassEscape()\n case 'f':\n case 'n':\n case 'r':\n case 't':\n case 'v':\n return this.controlEscapeAtom()\n case 'c':\n return this.controlLetterEscapeAtom()\n case '0':\n return this.nulCharacterAtom()\n case 'x':\n return this.hexEscapeSequenceAtom()\n case 'u':\n return this.regExpUnicodeEscapeSequenceAtom()\n default:\n return this.identityEscapeAtom()\n }\n }\n decimalEscapeAtom() {\n const value = this.positiveInteger()\n return { type: 'GroupBackReference', value: value }\n }\n characterClassEscape() {\n let set\n let complement = false\n switch (this.popChar()) {\n case 'd':\n set = digitsCharCodes\n break\n case 'D':\n set = digitsCharCodes\n complement = true\n break\n case 's':\n set = whitespaceCodes\n break\n case 'S':\n set = whitespaceCodes\n complement = true\n break\n case 'w':\n set = wordCharCodes\n break\n case 'W':\n set = wordCharCodes\n complement = true\n break\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(set)) {\n return { type: 'Set', value: set, complement: complement }\n }\n }\n controlEscapeAtom() {\n let escapeCode\n switch (this.popChar()) {\n case 'f':\n escapeCode = cc('\\f')\n break\n case 'n':\n escapeCode = cc('\\n')\n break\n case 'r':\n escapeCode = cc('\\r')\n break\n case 't':\n escapeCode = cc('\\t')\n break\n case 'v':\n escapeCode = cc('\\v')\n break\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(escapeCode)) {\n return { type: 'Character', value: escapeCode }\n }\n }\n controlLetterEscapeAtom() {\n this.consumeChar('c')\n const letter = this.popChar()\n if (/[a-zA-Z]/.test(letter) === false) {\n throw Error('Invalid ')\n }\n const letterCode = letter.toUpperCase().charCodeAt(0) - 64\n return { type: 'Character', value: letterCode }\n }\n nulCharacterAtom() {\n // TODO implement '[lookahead ∉ DecimalDigit]'\n // TODO: for the deprecated octal escape sequence\n this.consumeChar('0')\n return { type: 'Character', value: cc('\\0') }\n }\n hexEscapeSequenceAtom() {\n this.consumeChar('x')\n return this.parseHexDigits(2)\n }\n regExpUnicodeEscapeSequenceAtom() {\n this.consumeChar('u')\n return this.parseHexDigits(4)\n }\n identityEscapeAtom() {\n // TODO: implement \"SourceCharacter but not UnicodeIDContinue\"\n // // http://unicode.org/reports/tr31/#Specific_Character_Adjustments\n const escapedChar = this.popChar()\n return { type: 'Character', value: cc(escapedChar) }\n }\n classPatternCharacterAtom() {\n switch (this.peekChar()) {\n // istanbul ignore next\n case '\\n':\n // istanbul ignore next\n case '\\r':\n // istanbul ignore next\n case '\\u2028':\n // istanbul ignore next\n case '\\u2029':\n // istanbul ignore next\n case '\\\\':\n // istanbul ignore next\n case ']':\n throw Error('TBD')\n default:\n const nextChar = this.popChar()\n return { type: 'Character', value: cc(nextChar) }\n }\n }\n characterClass() {\n const set = []\n let complement = false\n this.consumeChar('[')\n if (this.peekChar(0) === '^') {\n this.consumeChar('^')\n complement = true\n }\n while (this.isClassAtom()) {\n const from = this.classAtom()\n from.type === 'Character'\n if (isCharacter(from) && this.isRangeDash()) {\n this.consumeChar('-')\n const to = this.classAtom()\n to.type === 'Character'\n // a range can only be used when both sides are single characters\n if (isCharacter(to)) {\n if (to.value < from.value) {\n throw Error('Range out of order in character class')\n }\n set.push({ from: from.value, to: to.value })\n } else {\n // literal dash\n insertToSet(from.value, set)\n set.push(cc('-'))\n insertToSet(to.value, set)\n }\n } else {\n insertToSet(from.value, set)\n }\n }\n this.consumeChar(']')\n return { type: 'Set', complement: complement, value: set }\n }\n classAtom() {\n switch (this.peekChar()) {\n // istanbul ignore next\n case ']':\n // istanbul ignore next\n case '\\n':\n // istanbul ignore next\n case '\\r':\n // istanbul ignore next\n case '\\u2028':\n // istanbul ignore next\n case '\\u2029':\n throw Error('TBD')\n case '\\\\':\n return this.classEscape()\n default:\n return this.classPatternCharacterAtom()\n }\n }\n classEscape() {\n this.consumeChar('\\\\')\n switch (this.peekChar()) {\n // Matches a backspace.\n // (Not to be confused with \\b word boundary outside characterClass)\n case 'b':\n this.consumeChar('b')\n return { type: 'Character', value: cc('\\u0008') }\n case 'd':\n case 'D':\n case 's':\n case 'S':\n case 'w':\n case 'W':\n return this.characterClassEscape()\n case 'f':\n case 'n':\n case 'r':\n case 't':\n case 'v':\n return this.controlEscapeAtom()\n case 'c':\n return this.controlLetterEscapeAtom()\n case '0':\n return this.nulCharacterAtom()\n case 'x':\n return this.hexEscapeSequenceAtom()\n case 'u':\n return this.regExpUnicodeEscapeSequenceAtom()\n default:\n return this.identityEscapeAtom()\n }\n }\n group() {\n let capturing = true\n this.consumeChar('(')\n switch (this.peekChar(0)) {\n case '?':\n this.consumeChar('?')\n this.consumeChar(':')\n capturing = false\n break\n default:\n this.groupIdx++\n break\n }\n const value = this.disjunction()\n this.consumeChar(')')\n const groupAst = {\n type: 'Group',\n capturing: capturing,\n value: value,\n }\n if (capturing) {\n groupAst['idx'] = this.groupIdx\n }\n return groupAst\n }\n positiveInteger() {\n let number = this.popChar()\n // istanbul ignore next - can't ever get here due to previous lookahead checks\n // still implementing this error checking in case this ever changes.\n if (decimalPatternNoZero.test(number) === false) {\n throw Error('Expecting a positive integer')\n }\n while (decimalPattern.test(this.peekChar(0))) {\n number += this.popChar()\n }\n return parseInt(number, 10)\n }\n integerIncludingZero() {\n let number = this.popChar()\n if (decimalPattern.test(number) === false) {\n throw Error('Expecting an integer')\n }\n while (decimalPattern.test(this.peekChar(0))) {\n number += this.popChar()\n }\n return parseInt(number, 10)\n }\n patternCharacter() {\n const nextChar = this.popChar()\n switch (nextChar) {\n // istanbul ignore next\n case '\\n':\n // istanbul ignore next\n case '\\r':\n // istanbul ignore next\n case '\\u2028':\n // istanbul ignore next\n case '\\u2029':\n // istanbul ignore next\n case '^':\n // istanbul ignore next\n case '$':\n // istanbul ignore next\n case '\\\\':\n // istanbul ignore next\n case '.':\n // istanbul ignore next\n case '*':\n // istanbul ignore next\n case '+':\n // istanbul ignore next\n case '?':\n // istanbul ignore next\n case '(':\n // istanbul ignore next\n case ')':\n // istanbul ignore next\n case '[':\n // istanbul ignore next\n case '|':\n // istanbul ignore next\n throw Error('TBD')\n default:\n return { type: 'Character', value: cc(nextChar) }\n }\n }\n isRegExpFlag() {\n switch (this.peekChar(0)) {\n case 'g':\n case 'i':\n case 'm':\n case 'u':\n case 'y':\n return true\n default:\n return false\n }\n }\n isRangeDash() {\n return this.peekChar() === '-' && this.isClassAtom(1)\n }\n isDigit() {\n return decimalPattern.test(this.peekChar(0))\n }\n isClassAtom(howMuch = 0) {\n switch (this.peekChar(howMuch)) {\n case ']':\n case '\\n':\n case '\\r':\n case '\\u2028':\n case '\\u2029':\n return false\n default:\n return true\n }\n }\n isTerm() {\n return this.isAtom() || this.isAssertion()\n }\n isAtom() {\n if (this.isPatternCharacter()) {\n return true\n }\n switch (this.peekChar(0)) {\n case '.':\n case '\\\\': // atomEscape\n case '[': // characterClass\n // TODO: isAtom must be called before isAssertion - disambiguate\n case '(': // group\n return true\n default:\n return false\n }\n }\n isAssertion() {\n switch (this.peekChar(0)) {\n case '^':\n case '$':\n return true\n // '\\b' or '\\B'\n case '\\\\':\n switch (this.peekChar(1)) {\n case 'b':\n case 'B':\n return true\n default:\n return false\n }\n // '(?=' or '(?!'\n case '(':\n return this.peekChar(1) === '?' && (this.peekChar(2) === '=' || this.peekChar(2) === '!')\n default:\n return false\n }\n }\n isQuantifier() {\n const prevState = this.saveState()\n try {\n return this.quantifier(true) !== undefined\n } catch (e) {\n return false\n } finally {\n this.restoreState(prevState)\n }\n }\n isPatternCharacter() {\n switch (this.peekChar()) {\n case '^':\n case '$':\n case '\\\\':\n case '.':\n case '*':\n case '+':\n case '?':\n case '(':\n case ')':\n case '[':\n case '|':\n case '/':\n case '\\n':\n case '\\r':\n case '\\u2028':\n case '\\u2029':\n return false\n default:\n return true\n }\n }\n parseHexDigits(howMany) {\n let hexString = ''\n for (let i = 0; i < howMany; i++) {\n const hexChar = this.popChar()\n if (hexDigitPattern.test(hexChar) === false) {\n throw Error('Expecting a HexDecimal digits')\n }\n hexString += hexChar\n }\n const charCode = parseInt(hexString, 16)\n return { type: 'Character', value: charCode }\n }\n peekChar(howMuch = 0) {\n return this.input[this.idx + howMuch]\n }\n popChar() {\n const nextChar = this.peekChar(0)\n this.consumeChar(undefined)\n return nextChar\n }\n consumeChar(char) {\n if (char !== undefined && this.input[this.idx] !== char) {\n throw Error(\"Expected: '\" + char + \"' but found: '\" + this.input[this.idx] + \"' at offset: \" + this.idx)\n }\n if (this.idx >= this.input.length) {\n throw Error('Unexpected end of input')\n }\n this.idx++\n }\n loc(begin) {\n return { begin: begin, end: this.idx }\n }\n }\n\n class BaseRegExpVisitor {\n visitChildren(node) {\n for (const key in node) {\n const child = node[key]\n /* istanbul ignore else */\n if (node.hasOwnProperty(key)) {\n if (child.type !== undefined) {\n this.visit(child)\n } else if (Array.isArray(child)) {\n child.forEach((subChild) => {\n this.visit(subChild)\n }, this)\n }\n }\n }\n }\n visit(node) {\n switch (node.type) {\n case 'Pattern':\n this.visitPattern(node)\n break\n case 'Flags':\n this.visitFlags(node)\n break\n case 'Disjunction':\n this.visitDisjunction(node)\n break\n case 'Alternative':\n this.visitAlternative(node)\n break\n case 'StartAnchor':\n this.visitStartAnchor(node)\n break\n case 'EndAnchor':\n this.visitEndAnchor(node)\n break\n case 'WordBoundary':\n this.visitWordBoundary(node)\n break\n case 'NonWordBoundary':\n this.visitNonWordBoundary(node)\n break\n case 'Lookahead':\n this.visitLookahead(node)\n break\n case 'NegativeLookahead':\n this.visitNegativeLookahead(node)\n break\n case 'Character':\n this.visitCharacter(node)\n break\n case 'Set':\n this.visitSet(node)\n break\n case 'Group':\n this.visitGroup(node)\n break\n case 'GroupBackReference':\n this.visitGroupBackReference(node)\n break\n case 'Quantifier':\n this.visitQuantifier(node)\n break\n }\n this.visitChildren(node)\n }\n visitPattern(node) {}\n visitFlags(node) {}\n visitDisjunction(node) {}\n visitAlternative(node) {}\n // Assertion\n visitStartAnchor(node) {}\n visitEndAnchor(node) {}\n visitWordBoundary(node) {}\n visitNonWordBoundary(node) {}\n visitLookahead(node) {}\n visitNegativeLookahead(node) {}\n // atoms\n visitCharacter(node) {}\n visitSet(node) {}\n visitGroup(node) {}\n visitGroupBackReference(node) {}\n visitQuantifier(node) {}\n }\n\n let regExpAstCache = {}\n const regExpParser = new RegExpParser()\n function getRegExpAst(regExp) {\n const regExpStr = regExp.toString()\n if (regExpAstCache.hasOwnProperty(regExpStr)) {\n return regExpAstCache[regExpStr]\n } else {\n const regExpAst = regExpParser.pattern(regExpStr)\n regExpAstCache[regExpStr] = regExpAst\n return regExpAst\n }\n }\n function clearRegExpParserCache() {\n regExpAstCache = {}\n }\n\n const complementErrorMessage = 'Complement Sets are not supported for first char optimization'\n const failedOptimizationPrefixMsg = 'Unable to use \"first char\" lexer optimizations:\\n'\n function getOptimizedStartCodesIndices(regExp, ensureOptimizations = false) {\n try {\n const ast = getRegExpAst(regExp)\n const firstChars = firstCharOptimizedIndices(ast.value, {}, ast.flags.ignoreCase)\n return firstChars\n } catch (e) {\n /* istanbul ignore next */\n // Testing this relies on the regexp-to-ast library having a bug... */\n // TODO: only the else branch needs to be ignored, try to fix with newer prettier / tsc\n if (e.message === complementErrorMessage) {\n if (ensureOptimizations) {\n PRINT_WARNING(\n `${failedOptimizationPrefixMsg}` +\n `\\tUnable to optimize: < ${regExp.toString()} >\\n` +\n '\\tComplement Sets cannot be automatically optimized.\\n' +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.',\n )\n }\n } else {\n let msgSuffix = ''\n if (ensureOptimizations) {\n msgSuffix =\n \"\\n\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.'\n }\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}\\n` +\n `\\tFailed parsing: < ${regExp.toString()} >\\n` +\n `\\tUsing the @chevrotain/regexp-to-ast library\\n` +\n '\\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues' +\n msgSuffix,\n )\n }\n }\n return []\n }\n function firstCharOptimizedIndices(ast, result, ignoreCase) {\n switch (ast.type) {\n case 'Disjunction':\n for (let i = 0; i < ast.value.length; i++) {\n firstCharOptimizedIndices(ast.value[i], result, ignoreCase)\n }\n break\n case 'Alternative':\n const terms = ast.value\n for (let i = 0; i < terms.length; i++) {\n const term = terms[i]\n // skip terms that cannot effect the first char results\n switch (term.type) {\n case 'EndAnchor':\n // A group back reference cannot affect potential starting char.\n // because if a back reference is the first production than automatically\n // the group being referenced has had to come BEFORE so its codes have already been added\n case 'GroupBackReference':\n // assertions do not affect potential starting codes\n case 'Lookahead':\n case 'NegativeLookahead':\n case 'StartAnchor':\n case 'WordBoundary':\n case 'NonWordBoundary':\n continue\n }\n const atom = term\n switch (atom.type) {\n case 'Character':\n addOptimizedIdxToResult(atom.value, result, ignoreCase)\n break\n case 'Set':\n if (atom.complement === true) {\n throw Error(complementErrorMessage)\n }\n forEach(atom.value, (code) => {\n if (typeof code === 'number') {\n addOptimizedIdxToResult(code, result, ignoreCase)\n } else {\n // range\n const range = code\n // cannot optimize when ignoreCase is\n if (ignoreCase === true) {\n for (let rangeCode = range.from; rangeCode <= range.to; rangeCode++) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase)\n }\n }\n // Optimization (2 orders of magnitude less work for very large ranges)\n else {\n // handle unoptimized values\n for (\n let rangeCode = range.from;\n rangeCode <= range.to && rangeCode < minOptimizationVal;\n rangeCode++\n ) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase)\n }\n // Less common charCode where we optimize for faster init time, by using larger \"buckets\"\n if (range.to >= minOptimizationVal) {\n const minUnOptVal = range.from >= minOptimizationVal ? range.from : minOptimizationVal\n const maxUnOptVal = range.to\n const minOptIdx = charCodeToOptimizedIndex(minUnOptVal)\n const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal)\n for (let currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) {\n result[currOptIdx] = currOptIdx\n }\n }\n }\n }\n })\n break\n case 'Group':\n firstCharOptimizedIndices(atom.value, result, ignoreCase)\n break\n /* istanbul ignore next */\n default:\n throw Error('Non Exhaustive Match')\n }\n // reached a mandatory production, no more **start** codes can be found on this alternative\n const isOptionalQuantifier = atom.quantifier !== undefined && atom.quantifier.atLeast === 0\n if (\n // A group may be optional due to empty contents /(?:)/\n // or if everything inside it is optional /((a)?)/\n (atom.type === 'Group' && isWholeOptional(atom) === false) ||\n // If this term is not a group it may only be optional if it has an optional quantifier\n (atom.type !== 'Group' && isOptionalQuantifier === false)\n ) {\n break\n }\n }\n break\n /* istanbul ignore next */\n default:\n throw Error('non exhaustive match!')\n }\n // console.log(Object.keys(result).length)\n return values(result)\n }\n function addOptimizedIdxToResult(code, result, ignoreCase) {\n const optimizedCharIdx = charCodeToOptimizedIndex(code)\n result[optimizedCharIdx] = optimizedCharIdx\n if (ignoreCase === true) {\n handleIgnoreCase(code, result)\n }\n }\n function handleIgnoreCase(code, result) {\n const char = String.fromCharCode(code)\n const upperChar = char.toUpperCase()\n /* istanbul ignore else */\n if (upperChar !== char) {\n const optimizedCharIdx = charCodeToOptimizedIndex(upperChar.charCodeAt(0))\n result[optimizedCharIdx] = optimizedCharIdx\n } else {\n const lowerChar = char.toLowerCase()\n if (lowerChar !== char) {\n const optimizedCharIdx = charCodeToOptimizedIndex(lowerChar.charCodeAt(0))\n result[optimizedCharIdx] = optimizedCharIdx\n }\n }\n }\n function findCode(setNode, targetCharCodes) {\n return find$1(setNode.value, (codeOrRange) => {\n if (typeof codeOrRange === 'number') {\n return includes(targetCharCodes, codeOrRange)\n } else {\n // range\n const range = codeOrRange\n return find$1(targetCharCodes, (targetCode) => range.from <= targetCode && targetCode <= range.to) !== undefined\n }\n })\n }\n function isWholeOptional(ast) {\n const quantifier = ast.quantifier\n if (quantifier && quantifier.atLeast === 0) {\n return true\n }\n if (!ast.value) {\n return false\n }\n return isArray$1(ast.value) ? every(ast.value, isWholeOptional) : isWholeOptional(ast.value)\n }\n class CharCodeFinder extends BaseRegExpVisitor {\n constructor(targetCharCodes) {\n super()\n this.targetCharCodes = targetCharCodes\n this.found = false\n }\n visitChildren(node) {\n // No need to keep looking...\n if (this.found === true) {\n return\n }\n // switch lookaheads as they do not actually consume any characters thus\n // finding a charCode at lookahead context does not mean that regexp can actually contain it in a match.\n switch (node.type) {\n case 'Lookahead':\n this.visitLookahead(node)\n return\n case 'NegativeLookahead':\n this.visitNegativeLookahead(node)\n return\n }\n super.visitChildren(node)\n }\n visitCharacter(node) {\n if (includes(this.targetCharCodes, node.value)) {\n this.found = true\n }\n }\n visitSet(node) {\n if (node.complement) {\n if (findCode(node, this.targetCharCodes) === undefined) {\n this.found = true\n }\n } else {\n if (findCode(node, this.targetCharCodes) !== undefined) {\n this.found = true\n }\n }\n }\n }\n function canMatchCharCode(charCodes, pattern) {\n if (pattern instanceof RegExp) {\n const ast = getRegExpAst(pattern)\n const charCodeFinder = new CharCodeFinder(charCodes)\n charCodeFinder.visit(ast)\n return charCodeFinder.found\n } else {\n return (\n find$1(pattern, (char) => {\n return includes(charCodes, char.charCodeAt(0))\n }) !== undefined\n )\n }\n }\n\n const PATTERN = 'PATTERN'\n const DEFAULT_MODE = 'defaultMode'\n const MODES = 'modes'\n let SUPPORT_STICKY = typeof new RegExp('(?:)').sticky === 'boolean'\n function analyzeTokenTypes(tokenTypes, options) {\n options = defaults$1(options, {\n useSticky: SUPPORT_STICKY,\n debug: false,\n safeMode: false,\n positionTracking: 'full',\n lineTerminatorCharacters: ['\\r', '\\n'],\n tracer: (msg, action) => action(),\n })\n const tracer = options.tracer\n tracer('initCharCodeToOptimizedIndexMap', () => {\n initCharCodeToOptimizedIndexMap()\n })\n let onlyRelevantTypes\n tracer('Reject Lexer.NA', () => {\n onlyRelevantTypes = reject(tokenTypes, (currType) => {\n return currType[PATTERN] === Lexer.NA\n })\n })\n let hasCustom = false\n let allTransformedPatterns\n tracer('Transform Patterns', () => {\n hasCustom = false\n allTransformedPatterns = map(onlyRelevantTypes, (currType) => {\n const currPattern = currType[PATTERN]\n /* istanbul ignore else */\n if (isRegExp$1(currPattern)) {\n const regExpSource = currPattern.source\n if (\n regExpSource.length === 1 &&\n // only these regExp meta characters which can appear in a length one regExp\n regExpSource !== '^' &&\n regExpSource !== '$' &&\n regExpSource !== '.' &&\n !currPattern.ignoreCase\n ) {\n return regExpSource\n } else if (\n regExpSource.length === 2 &&\n regExpSource[0] === '\\\\' &&\n // not a meta character\n !includes(['d', 'D', 's', 'S', 't', 'r', 'n', 't', '0', 'c', 'b', 'B', 'f', 'v', 'w', 'W'], regExpSource[1])\n ) {\n // escaped meta Characters: /\\+/ /\\[/\n // or redundant escaping: /\\a/\n // without the escaping \"\\\"\n return regExpSource[1]\n } else {\n return options.useSticky ? addStickyFlag(currPattern) : addStartOfInput(currPattern)\n }\n } else if (isFunction(currPattern)) {\n hasCustom = true\n // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object\n return { exec: currPattern }\n } else if (typeof currPattern === 'object') {\n hasCustom = true\n // ICustomPattern\n return currPattern\n } else if (typeof currPattern === 'string') {\n if (currPattern.length === 1) {\n return currPattern\n } else {\n const escapedRegExpString = currPattern.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n const wrappedRegExp = new RegExp(escapedRegExpString)\n return options.useSticky ? addStickyFlag(wrappedRegExp) : addStartOfInput(wrappedRegExp)\n }\n } else {\n throw Error('non exhaustive match')\n }\n })\n })\n let patternIdxToType\n let patternIdxToGroup\n let patternIdxToLongerAltIdxArr\n let patternIdxToPushMode\n let patternIdxToPopMode\n tracer('misc mapping', () => {\n patternIdxToType = map(onlyRelevantTypes, (currType) => currType.tokenTypeIdx)\n patternIdxToGroup = map(onlyRelevantTypes, (clazz) => {\n const groupName = clazz.GROUP\n /* istanbul ignore next */\n if (groupName === Lexer.SKIPPED) {\n return undefined\n } else if (isString(groupName)) {\n return groupName\n } else if (isUndefined(groupName)) {\n return false\n } else {\n throw Error('non exhaustive match')\n }\n })\n patternIdxToLongerAltIdxArr = map(onlyRelevantTypes, (clazz) => {\n const longerAltType = clazz.LONGER_ALT\n if (longerAltType) {\n const longerAltIdxArr = isArray$1(longerAltType)\n ? map(longerAltType, (type) => indexOf(onlyRelevantTypes, type))\n : [indexOf(onlyRelevantTypes, longerAltType)]\n return longerAltIdxArr\n }\n })\n patternIdxToPushMode = map(onlyRelevantTypes, (clazz) => clazz.PUSH_MODE)\n patternIdxToPopMode = map(onlyRelevantTypes, (clazz) => has(clazz, 'POP_MODE'))\n })\n let patternIdxToCanLineTerminator\n tracer('Line Terminator Handling', () => {\n const lineTerminatorCharCodes = getCharCodes(options.lineTerminatorCharacters)\n patternIdxToCanLineTerminator = map(onlyRelevantTypes, (tokType) => false)\n if (options.positionTracking !== 'onlyOffset') {\n patternIdxToCanLineTerminator = map(onlyRelevantTypes, (tokType) => {\n if (has(tokType, 'LINE_BREAKS')) {\n return !!tokType.LINE_BREAKS\n } else {\n return (\n checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false &&\n canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN)\n )\n }\n })\n }\n })\n let patternIdxToIsCustom\n let patternIdxToShort\n let emptyGroups\n let patternIdxToConfig\n tracer('Misc Mapping #2', () => {\n patternIdxToIsCustom = map(onlyRelevantTypes, isCustomPattern)\n patternIdxToShort = map(allTransformedPatterns, isShortPattern)\n emptyGroups = reduce(\n onlyRelevantTypes,\n (acc, clazz) => {\n const groupName = clazz.GROUP\n if (isString(groupName) && !(groupName === Lexer.SKIPPED)) {\n acc[groupName] = []\n }\n return acc\n },\n {},\n )\n patternIdxToConfig = map(allTransformedPatterns, (x, idx) => {\n return {\n pattern: allTransformedPatterns[idx],\n longerAlt: patternIdxToLongerAltIdxArr[idx],\n canLineTerminator: patternIdxToCanLineTerminator[idx],\n isCustom: patternIdxToIsCustom[idx],\n short: patternIdxToShort[idx],\n group: patternIdxToGroup[idx],\n push: patternIdxToPushMode[idx],\n pop: patternIdxToPopMode[idx],\n tokenTypeIdx: patternIdxToType[idx],\n tokenType: onlyRelevantTypes[idx],\n }\n })\n })\n let canBeOptimized = true\n let charCodeToPatternIdxToConfig = []\n if (!options.safeMode) {\n tracer('First Char Optimization', () => {\n charCodeToPatternIdxToConfig = reduce(\n onlyRelevantTypes,\n (result, currTokType, idx) => {\n if (typeof currTokType.PATTERN === 'string') {\n const charCode = currTokType.PATTERN.charCodeAt(0)\n const optimizedIdx = charCodeToOptimizedIndex(charCode)\n addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx])\n } else if (isArray$1(currTokType.START_CHARS_HINT)) {\n let lastOptimizedIdx\n forEach(currTokType.START_CHARS_HINT, (charOrInt) => {\n const charCode = typeof charOrInt === 'string' ? charOrInt.charCodeAt(0) : charOrInt\n const currOptimizedIdx = charCodeToOptimizedIndex(charCode)\n // Avoid adding the config multiple times\n /* istanbul ignore else */\n // - Difficult to check this scenario effects as it is only a performance\n // optimization that does not change correctness\n if (lastOptimizedIdx !== currOptimizedIdx) {\n lastOptimizedIdx = currOptimizedIdx\n addToMapOfArrays(result, currOptimizedIdx, patternIdxToConfig[idx])\n }\n })\n } else if (isRegExp$1(currTokType.PATTERN)) {\n if (currTokType.PATTERN.unicode) {\n canBeOptimized = false\n if (options.ensureOptimizations) {\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}` +\n `\\tUnable to analyze < ${currTokType.PATTERN.toString()} > pattern.\\n` +\n '\\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\\n' +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE',\n )\n }\n } else {\n const optimizedCodes = getOptimizedStartCodesIndices(currTokType.PATTERN, options.ensureOptimizations)\n /* istanbul ignore if */\n // start code will only be empty given an empty regExp or failure of regexp-to-ast library\n // the first should be a different validation and the second cannot be tested.\n if (isEmpty(optimizedCodes)) {\n // we cannot understand what codes may start possible matches\n // The optimization correctness requires knowing start codes for ALL patterns.\n // Not actually sure this is an error, no debug message\n canBeOptimized = false\n }\n forEach(optimizedCodes, (code) => {\n addToMapOfArrays(result, code, patternIdxToConfig[idx])\n })\n }\n } else {\n if (options.ensureOptimizations) {\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}` +\n `\\tTokenType: <${currTokType.name}> is using a custom token pattern without providing parameter.\\n` +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE',\n )\n }\n canBeOptimized = false\n }\n return result\n },\n [],\n )\n })\n }\n return {\n emptyGroups: emptyGroups,\n patternIdxToConfig: patternIdxToConfig,\n charCodeToPatternIdxToConfig: charCodeToPatternIdxToConfig,\n hasCustom: hasCustom,\n canBeOptimized: canBeOptimized,\n }\n }\n function validatePatterns(tokenTypes, validModesNames) {\n let errors = []\n const missingResult = findMissingPatterns(tokenTypes)\n errors = errors.concat(missingResult.errors)\n const invalidResult = findInvalidPatterns(missingResult.valid)\n const validTokenTypes = invalidResult.valid\n errors = errors.concat(invalidResult.errors)\n errors = errors.concat(validateRegExpPattern(validTokenTypes))\n errors = errors.concat(findInvalidGroupType(validTokenTypes))\n errors = errors.concat(findModesThatDoNotExist(validTokenTypes, validModesNames))\n errors = errors.concat(findUnreachablePatterns(validTokenTypes))\n return errors\n }\n function validateRegExpPattern(tokenTypes) {\n let errors = []\n const withRegExpPatterns = filter(tokenTypes, (currTokType) => isRegExp$1(currTokType[PATTERN]))\n errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns))\n errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns))\n errors = errors.concat(findUnsupportedFlags(withRegExpPatterns))\n errors = errors.concat(findDuplicatePatterns(withRegExpPatterns))\n errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns))\n return errors\n }\n function findMissingPatterns(tokenTypes) {\n const tokenTypesWithMissingPattern = filter(tokenTypes, (currType) => {\n return !has(currType, PATTERN)\n })\n const errors = map(tokenTypesWithMissingPattern, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- missing static 'PATTERN' property\",\n type: LexerDefinitionErrorType.MISSING_PATTERN,\n tokenTypes: [currType],\n }\n })\n const valid = difference$1(tokenTypes, tokenTypesWithMissingPattern)\n return { errors, valid }\n }\n function findInvalidPatterns(tokenTypes) {\n const tokenTypesWithInvalidPattern = filter(tokenTypes, (currType) => {\n const pattern = currType[PATTERN]\n return !isRegExp$1(pattern) && !isFunction(pattern) && !has(pattern, 'exec') && !isString(pattern)\n })\n const errors = map(tokenTypesWithInvalidPattern, (currType) => {\n return {\n message:\n 'Token Type: ->' +\n currType.name +\n \"<- static 'PATTERN' can only be a RegExp, a\" +\n ' Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.',\n type: LexerDefinitionErrorType.INVALID_PATTERN,\n tokenTypes: [currType],\n }\n })\n const valid = difference$1(tokenTypes, tokenTypesWithInvalidPattern)\n return { errors, valid }\n }\n const end_of_input = /[^\\\\][$]/\n function findEndOfInputAnchor(tokenTypes) {\n class EndAnchorFinder extends BaseRegExpVisitor {\n constructor() {\n super(...arguments)\n this.found = false\n }\n visitEndAnchor(node) {\n this.found = true\n }\n }\n const invalidRegex = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN\n try {\n const regexpAst = getRegExpAst(pattern)\n const endAnchorVisitor = new EndAnchorFinder()\n endAnchorVisitor.visit(regexpAst)\n return endAnchorVisitor.found\n } catch (e) {\n // old behavior in case of runtime exceptions with regexp-to-ast.\n /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/\n return end_of_input.test(pattern.source)\n }\n })\n const errors = map(invalidRegex, (currType) => {\n return {\n message:\n 'Unexpected RegExp Anchor Error:\\n' +\n '\\tToken Type: ->' +\n currType.name +\n \"<- static 'PATTERN' cannot contain end of input anchor '$'\\n\" +\n '\\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS' +\n '\\tfor details.',\n type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n function findEmptyMatchRegExps(tokenTypes) {\n const matchesEmptyString = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN\n return pattern.test('')\n })\n const errors = map(matchesEmptyString, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- static 'PATTERN' must not match an empty string\",\n type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n const start_of_input = /[^\\\\[][\\^]|^\\^/\n function findStartOfInputAnchor(tokenTypes) {\n class StartAnchorFinder extends BaseRegExpVisitor {\n constructor() {\n super(...arguments)\n this.found = false\n }\n visitStartAnchor(node) {\n this.found = true\n }\n }\n const invalidRegex = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN\n try {\n const regexpAst = getRegExpAst(pattern)\n const startAnchorVisitor = new StartAnchorFinder()\n startAnchorVisitor.visit(regexpAst)\n return startAnchorVisitor.found\n } catch (e) {\n // old behavior in case of runtime exceptions with regexp-to-ast.\n /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/\n return start_of_input.test(pattern.source)\n }\n })\n const errors = map(invalidRegex, (currType) => {\n return {\n message:\n 'Unexpected RegExp Anchor Error:\\n' +\n '\\tToken Type: ->' +\n currType.name +\n \"<- static 'PATTERN' cannot contain start of input anchor '^'\\n\" +\n '\\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS' +\n '\\tfor details.',\n type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n function findUnsupportedFlags(tokenTypes) {\n const invalidFlags = filter(tokenTypes, (currType) => {\n const pattern = currType[PATTERN]\n return pattern instanceof RegExp && (pattern.multiline || pattern.global)\n })\n const errors = map(invalidFlags, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- static 'PATTERN' may NOT contain global('g') or multiline('m')\",\n type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n // This can only test for identical duplicate RegExps, not semantically equivalent ones.\n function findDuplicatePatterns(tokenTypes) {\n const found = []\n let identicalPatterns = map(tokenTypes, (outerType) => {\n return reduce(\n tokenTypes,\n (result, innerType) => {\n if (\n outerType.PATTERN.source === innerType.PATTERN.source &&\n !includes(found, innerType) &&\n innerType.PATTERN !== Lexer.NA\n ) {\n // this avoids duplicates in the result, each Token Type may only appear in one \"set\"\n // in essence we are creating Equivalence classes on equality relation.\n found.push(innerType)\n result.push(innerType)\n return result\n }\n return result\n },\n [],\n )\n })\n identicalPatterns = compact(identicalPatterns)\n const duplicatePatterns = filter(identicalPatterns, (currIdenticalSet) => {\n return currIdenticalSet.length > 1\n })\n const errors = map(duplicatePatterns, (setOfIdentical) => {\n const tokenTypeNames = map(setOfIdentical, (currType) => {\n return currType.name\n })\n const dupPatternSrc = head(setOfIdentical).PATTERN\n return {\n message:\n `The same RegExp pattern ->${dupPatternSrc}<-` +\n `has been used in all of the following Token Types: ${tokenTypeNames.join(', ')} <-`,\n type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,\n tokenTypes: setOfIdentical,\n }\n })\n return errors\n }\n function findInvalidGroupType(tokenTypes) {\n const invalidTypes = filter(tokenTypes, (clazz) => {\n if (!has(clazz, 'GROUP')) {\n return false\n }\n const group = clazz.GROUP\n return group !== Lexer.SKIPPED && group !== Lexer.NA && !isString(group)\n })\n const errors = map(invalidTypes, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String\",\n type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n function findModesThatDoNotExist(tokenTypes, validModes) {\n const invalidModes = filter(tokenTypes, (clazz) => {\n return clazz.PUSH_MODE !== undefined && !includes(validModes, clazz.PUSH_MODE)\n })\n const errors = map(invalidModes, (tokType) => {\n const msg =\n `Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-` +\n `which does not exist`\n return {\n message: msg,\n type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,\n tokenTypes: [tokType],\n }\n })\n return errors\n }\n function findUnreachablePatterns(tokenTypes) {\n const errors = []\n const canBeTested = reduce(\n tokenTypes,\n (result, tokType, idx) => {\n const pattern = tokType.PATTERN\n if (pattern === Lexer.NA) {\n return result\n }\n // a more comprehensive validation for all forms of regExps would require\n // deeper regExp analysis capabilities\n if (isString(pattern)) {\n result.push({ str: pattern, idx, tokenType: tokType })\n } else if (isRegExp$1(pattern) && noMetaChar(pattern)) {\n result.push({ str: pattern.source, idx, tokenType: tokType })\n }\n return result\n },\n [],\n )\n forEach(tokenTypes, (tokType, testIdx) => {\n forEach(canBeTested, ({ str, idx, tokenType }) => {\n if (testIdx < idx && testTokenType(str, tokType.PATTERN)) {\n const msg =\n `Token: ->${tokenType.name}<- can never be matched.\\n` +\n `Because it appears AFTER the Token Type ->${tokType.name}<-` +\n `in the lexer's definition.\\n` +\n `See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`\n errors.push({\n message: msg,\n type: LexerDefinitionErrorType.UNREACHABLE_PATTERN,\n tokenTypes: [tokType, tokenType],\n })\n }\n })\n })\n return errors\n }\n function testTokenType(str, pattern) {\n /* istanbul ignore else */\n if (isRegExp$1(pattern)) {\n const regExpArray = pattern.exec(str)\n return regExpArray !== null && regExpArray.index === 0\n } else if (isFunction(pattern)) {\n // maintain the API of custom patterns\n return pattern(str, 0, [], {})\n } else if (has(pattern, 'exec')) {\n // maintain the API of custom patterns\n return pattern.exec(str, 0, [], {})\n } else if (typeof pattern === 'string') {\n return pattern === str\n } else {\n throw Error('non exhaustive match')\n }\n }\n function noMetaChar(regExp) {\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n const metaChars = ['.', '\\\\', '[', ']', '|', '^', '$', '(', ')', '?', '*', '+', '{']\n return find$1(metaChars, (char) => regExp.source.indexOf(char) !== -1) === undefined\n }\n function addStartOfInput(pattern) {\n const flags = pattern.ignoreCase ? 'i' : ''\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(`^(?:${pattern.source})`, flags)\n }\n function addStickyFlag(pattern) {\n const flags = pattern.ignoreCase ? 'iy' : 'y'\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(`${pattern.source}`, flags)\n }\n function performRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {\n const errors = []\n // some run time checks to help the end users.\n if (!has(lexerDefinition, DEFAULT_MODE)) {\n errors.push({\n message:\n 'A MultiMode Lexer cannot be initialized without a <' + DEFAULT_MODE + '> property in its definition\\n',\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE,\n })\n }\n if (!has(lexerDefinition, MODES)) {\n errors.push({\n message: 'A MultiMode Lexer cannot be initialized without a <' + MODES + '> property in its definition\\n',\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY,\n })\n }\n if (\n has(lexerDefinition, MODES) &&\n has(lexerDefinition, DEFAULT_MODE) &&\n !has(lexerDefinition.modes, lexerDefinition.defaultMode)\n ) {\n errors.push({\n message:\n `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${lexerDefinition.defaultMode}>` +\n `which does not exist\\n`,\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST,\n })\n }\n if (has(lexerDefinition, MODES)) {\n forEach(lexerDefinition.modes, (currModeValue, currModeName) => {\n forEach(currModeValue, (currTokType, currIdx) => {\n if (isUndefined(currTokType)) {\n errors.push({\n message:\n `A Lexer cannot be initialized using an undefined Token Type. Mode:` +\n `<${currModeName}> at index: <${currIdx}>\\n`,\n type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED,\n })\n } else if (has(currTokType, 'LONGER_ALT')) {\n const longerAlt = isArray$1(currTokType.LONGER_ALT) ? currTokType.LONGER_ALT : [currTokType.LONGER_ALT]\n forEach(longerAlt, (currLongerAlt) => {\n if (!isUndefined(currLongerAlt) && !includes(currModeValue, currLongerAlt)) {\n errors.push({\n message: `A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}>\\n`,\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE,\n })\n }\n })\n }\n })\n })\n }\n return errors\n }\n function performWarningRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {\n const warnings = []\n let hasAnyLineBreak = false\n const allTokenTypes = compact(flatten(values(lexerDefinition.modes)))\n const concreteTokenTypes = reject(allTokenTypes, (currType) => currType[PATTERN] === Lexer.NA)\n const terminatorCharCodes = getCharCodes(lineTerminatorCharacters)\n if (trackLines) {\n forEach(concreteTokenTypes, (tokType) => {\n const currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes)\n if (currIssue !== false) {\n const message = buildLineBreakIssueMessage(tokType, currIssue)\n const warningDescriptor = {\n message,\n type: currIssue.issue,\n tokenType: tokType,\n }\n warnings.push(warningDescriptor)\n } else {\n // we don't want to attempt to scan if the user explicitly specified the line_breaks option.\n if (has(tokType, 'LINE_BREAKS')) {\n if (tokType.LINE_BREAKS === true) {\n hasAnyLineBreak = true\n }\n } else {\n if (canMatchCharCode(terminatorCharCodes, tokType.PATTERN)) {\n hasAnyLineBreak = true\n }\n }\n }\n })\n }\n if (trackLines && !hasAnyLineBreak) {\n warnings.push({\n message:\n 'Warning: No LINE_BREAKS Found.\\n' +\n '\\tThis Lexer has been defined to track line and column information,\\n' +\n '\\tBut none of the Token Types can be identified as matching a line terminator.\\n' +\n '\\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \\n' +\n '\\tfor details.',\n type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS,\n })\n }\n return warnings\n }\n function cloneEmptyGroups(emptyGroups) {\n const clonedResult = {}\n const groupKeys = keys(emptyGroups)\n forEach(groupKeys, (currKey) => {\n const currGroupValue = emptyGroups[currKey]\n /* istanbul ignore else */\n if (isArray$1(currGroupValue)) {\n clonedResult[currKey] = []\n } else {\n throw Error('non exhaustive match')\n }\n })\n return clonedResult\n }\n // TODO: refactor to avoid duplication\n function isCustomPattern(tokenType) {\n const pattern = tokenType.PATTERN\n /* istanbul ignore else */\n if (isRegExp$1(pattern)) {\n return false\n } else if (isFunction(pattern)) {\n // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object\n return true\n } else if (has(pattern, 'exec')) {\n // ICustomPattern\n return true\n } else if (isString(pattern)) {\n return false\n } else {\n throw Error('non exhaustive match')\n }\n }\n function isShortPattern(pattern) {\n if (isString(pattern) && pattern.length === 1) {\n return pattern.charCodeAt(0)\n } else {\n return false\n }\n }\n /**\n * Faster than using a RegExp for default newline detection during lexing.\n */\n const LineTerminatorOptimizedTester = {\n // implements /\\n|\\r\\n?/g.test\n test: function (text) {\n const len = text.length\n for (let i = this.lastIndex; i < len; i++) {\n const c = text.charCodeAt(i)\n if (c === 10) {\n this.lastIndex = i + 1\n return true\n } else if (c === 13) {\n if (text.charCodeAt(i + 1) === 10) {\n this.lastIndex = i + 2\n } else {\n this.lastIndex = i + 1\n }\n return true\n }\n }\n return false\n },\n lastIndex: 0,\n }\n function checkLineBreaksIssues(tokType, lineTerminatorCharCodes) {\n if (has(tokType, 'LINE_BREAKS')) {\n // if the user explicitly declared the line_breaks option we will respect their choice\n // and assume it is correct.\n return false\n } else {\n /* istanbul ignore else */\n if (isRegExp$1(tokType.PATTERN)) {\n try {\n // TODO: why is the casting suddenly needed?\n canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN)\n } catch (e) {\n /* istanbul ignore next - to test this we would have to mock to throw an error */\n return {\n issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR,\n errMsg: e.message,\n }\n }\n return false\n } else if (isString(tokType.PATTERN)) {\n // string literal patterns can always be analyzed to detect line terminator usage\n return false\n } else if (isCustomPattern(tokType)) {\n // custom token types\n return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK }\n } else {\n throw Error('non exhaustive match')\n }\n }\n }\n function buildLineBreakIssueMessage(tokType, details) {\n /* istanbul ignore else */\n if (details.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) {\n return (\n 'Warning: unable to identify line terminator usage in pattern.\\n' +\n `\\tThe problem is in the <${tokType.name}> Token Type\\n` +\n `\\t Root cause: ${details.errMsg}.\\n` +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR'\n )\n } else if (details.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) {\n return (\n 'Warning: A Custom Token Pattern should specify the option.\\n' +\n `\\tThe problem is in the <${tokType.name}> Token Type\\n` +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK'\n )\n } else {\n throw Error('non exhaustive match')\n }\n }\n function getCharCodes(charsOrCodes) {\n const charCodes = map(charsOrCodes, (numOrString) => {\n if (isString(numOrString)) {\n return numOrString.charCodeAt(0)\n } else {\n return numOrString\n }\n })\n return charCodes\n }\n function addToMapOfArrays(map, key, value) {\n if (map[key] === undefined) {\n map[key] = [value]\n } else {\n map[key].push(value)\n }\n }\n const minOptimizationVal = 256\n /**\n * We are mapping charCode above ASCI (256) into buckets each in the size of 256.\n * This is because ASCI are the most common start chars so each one of those will get its own\n * possible token configs vector.\n *\n * Tokens starting with charCodes \"above\" ASCI are uncommon, so we can \"afford\"\n * to place these into buckets of possible token configs, What we gain from\n * this is avoiding the case of creating an optimization 'charCodeToPatternIdxToConfig'\n * which would contain 10,000+ arrays of small size (e.g unicode Identifiers scenario).\n * Our 'charCodeToPatternIdxToConfig' max size will now be:\n * 256 + (2^16 / 2^8) - 1 === 511\n *\n * note the hack for fast division integer part extraction\n * See: https://stackoverflow.com/a/4228528\n */\n let charCodeToOptimizedIdxMap = []\n function charCodeToOptimizedIndex(charCode) {\n return charCode < minOptimizationVal ? charCode : charCodeToOptimizedIdxMap[charCode]\n }\n /**\n * This is a compromise between cold start / hot running performance\n * Creating this array takes ~3ms on a modern machine,\n * But if we perform the computation at runtime as needed the CSS Lexer benchmark\n * performance degrades by ~10%\n *\n * TODO: Perhaps it should be lazy initialized only if a charCode > 255 is used.\n */\n function initCharCodeToOptimizedIndexMap() {\n if (isEmpty(charCodeToOptimizedIdxMap)) {\n charCodeToOptimizedIdxMap = new Array(65536)\n for (let i = 0; i < 65536; i++) {\n charCodeToOptimizedIdxMap[i] = i > 255 ? 255 + ~~(i / 255) : i\n }\n }\n }\n\n function tokenStructuredMatcher(tokInstance, tokConstructor) {\n const instanceType = tokInstance.tokenTypeIdx\n if (instanceType === tokConstructor.tokenTypeIdx) {\n return true\n } else {\n return tokConstructor.isParent === true && tokConstructor.categoryMatchesMap[instanceType] === true\n }\n }\n // Optimized tokenMatcher in case our grammar does not use token categories\n // Being so tiny it is much more likely to be in-lined and this avoid the function call overhead\n function tokenStructuredMatcherNoCategories(token, tokType) {\n return token.tokenTypeIdx === tokType.tokenTypeIdx\n }\n let tokenShortNameIdx = 1\n const tokenIdxToClass = {}\n function augmentTokenTypes(tokenTypes) {\n // collect the parent Token Types as well.\n const tokenTypesAndParents = expandCategories(tokenTypes)\n // add required tokenType and categoryMatches properties\n assignTokenDefaultProps(tokenTypesAndParents)\n // fill up the categoryMatches\n assignCategoriesMapProp(tokenTypesAndParents)\n assignCategoriesTokensProp(tokenTypesAndParents)\n forEach(tokenTypesAndParents, (tokType) => {\n tokType.isParent = tokType.categoryMatches.length > 0\n })\n }\n function expandCategories(tokenTypes) {\n let result = clone(tokenTypes)\n let categories = tokenTypes\n let searching = true\n while (searching) {\n categories = compact(flatten(map(categories, (currTokType) => currTokType.CATEGORIES)))\n const newCategories = difference$1(categories, result)\n result = result.concat(newCategories)\n if (isEmpty(newCategories)) {\n searching = false\n } else {\n categories = newCategories\n }\n }\n return result\n }\n function assignTokenDefaultProps(tokenTypes) {\n forEach(tokenTypes, (currTokType) => {\n if (!hasShortKeyProperty(currTokType)) {\n tokenIdxToClass[tokenShortNameIdx] = currTokType\n currTokType.tokenTypeIdx = tokenShortNameIdx++\n }\n // CATEGORIES? : TokenType | TokenType[]\n if (\n hasCategoriesProperty(currTokType) &&\n !isArray$1(currTokType.CATEGORIES)\n // &&\n // !isUndefined(currTokType.CATEGORIES.PATTERN)\n ) {\n currTokType.CATEGORIES = [currTokType.CATEGORIES]\n }\n if (!hasCategoriesProperty(currTokType)) {\n currTokType.CATEGORIES = []\n }\n if (!hasExtendingTokensTypesProperty(currTokType)) {\n currTokType.categoryMatches = []\n }\n if (!hasExtendingTokensTypesMapProperty(currTokType)) {\n currTokType.categoryMatchesMap = {}\n }\n })\n }\n function assignCategoriesTokensProp(tokenTypes) {\n forEach(tokenTypes, (currTokType) => {\n // avoid duplications\n currTokType.categoryMatches = []\n forEach(currTokType.categoryMatchesMap, (val, key) => {\n currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx)\n })\n })\n }\n function assignCategoriesMapProp(tokenTypes) {\n forEach(tokenTypes, (currTokType) => {\n singleAssignCategoriesToksMap([], currTokType)\n })\n }\n function singleAssignCategoriesToksMap(path, nextNode) {\n forEach(path, (pathNode) => {\n nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true\n })\n forEach(nextNode.CATEGORIES, (nextCategory) => {\n const newPath = path.concat(nextNode)\n // avoids infinite loops due to cyclic categories.\n if (!includes(newPath, nextCategory)) {\n singleAssignCategoriesToksMap(newPath, nextCategory)\n }\n })\n }\n function hasShortKeyProperty(tokType) {\n return has(tokType, 'tokenTypeIdx')\n }\n function hasCategoriesProperty(tokType) {\n return has(tokType, 'CATEGORIES')\n }\n function hasExtendingTokensTypesProperty(tokType) {\n return has(tokType, 'categoryMatches')\n }\n function hasExtendingTokensTypesMapProperty(tokType) {\n return has(tokType, 'categoryMatchesMap')\n }\n function isTokenType(tokType) {\n return has(tokType, 'tokenTypeIdx')\n }\n\n const defaultLexerErrorProvider = {\n buildUnableToPopLexerModeMessage(token) {\n return `Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`\n },\n buildUnexpectedCharactersMessage(fullText, startOffset, length, line, column) {\n return (\n `unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset},` +\n ` skipped ${length} characters.`\n )\n },\n }\n\n var LexerDefinitionErrorType\n ;(function (LexerDefinitionErrorType) {\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MISSING_PATTERN'] = 0)] = 'MISSING_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['INVALID_PATTERN'] = 1)] = 'INVALID_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['EOI_ANCHOR_FOUND'] = 2)] = 'EOI_ANCHOR_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['UNSUPPORTED_FLAGS_FOUND'] = 3)] = 'UNSUPPORTED_FLAGS_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['DUPLICATE_PATTERNS_FOUND'] = 4)] = 'DUPLICATE_PATTERNS_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['INVALID_GROUP_TYPE_FOUND'] = 5)] = 'INVALID_GROUP_TYPE_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['PUSH_MODE_DOES_NOT_EXIST'] = 6)] = 'PUSH_MODE_DOES_NOT_EXIST'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE'] = 7)] =\n 'MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY'] = 8)] =\n 'MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST'] = 9)] =\n 'MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED'] = 10)] =\n 'LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['SOI_ANCHOR_FOUND'] = 11)] = 'SOI_ANCHOR_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['EMPTY_MATCH_PATTERN'] = 12)] = 'EMPTY_MATCH_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['NO_LINE_BREAKS_FLAGS'] = 13)] = 'NO_LINE_BREAKS_FLAGS'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['UNREACHABLE_PATTERN'] = 14)] = 'UNREACHABLE_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['IDENTIFY_TERMINATOR'] = 15)] = 'IDENTIFY_TERMINATOR'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['CUSTOM_LINE_BREAK'] = 16)] = 'CUSTOM_LINE_BREAK'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE'] = 17)] =\n 'MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE'\n })(LexerDefinitionErrorType || (LexerDefinitionErrorType = {}))\n const DEFAULT_LEXER_CONFIG = {\n deferDefinitionErrorsHandling: false,\n positionTracking: 'full',\n lineTerminatorsPattern: /\\n|\\r\\n?/g,\n lineTerminatorCharacters: ['\\n', '\\r'],\n ensureOptimizations: false,\n safeMode: false,\n errorMessageProvider: defaultLexerErrorProvider,\n traceInitPerf: false,\n skipValidations: false,\n recoveryEnabled: true,\n }\n Object.freeze(DEFAULT_LEXER_CONFIG)\n class Lexer {\n constructor(lexerDefinition, config = DEFAULT_LEXER_CONFIG) {\n this.lexerDefinition = lexerDefinition\n this.lexerDefinitionErrors = []\n this.lexerDefinitionWarning = []\n this.patternIdxToConfig = {}\n this.charCodeToPatternIdxToConfig = {}\n this.modes = []\n this.emptyGroups = {}\n this.trackStartLines = true\n this.trackEndLines = true\n this.hasCustom = false\n this.canModeBeOptimized = {}\n // Duplicated from the parser's perf trace trait to allow future extraction\n // of the lexer to a separate package.\n this.TRACE_INIT = (phaseDesc, phaseImpl) => {\n // No need to optimize this using NOOP pattern because\n // It is not called in a hot spot...\n if (this.traceInitPerf === true) {\n this.traceInitIndent++\n const indent = new Array(this.traceInitIndent + 1).join('\\t')\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n console.log(`${indent}--> <${phaseDesc}>`)\n }\n const { time, value } = timer(phaseImpl)\n /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */\n const traceMethod = time > 10 ? console.warn : console.log\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`)\n }\n this.traceInitIndent--\n return value\n } else {\n return phaseImpl()\n }\n }\n if (typeof config === 'boolean') {\n throw Error(\n 'The second argument to the Lexer constructor is now an ILexerConfig Object.\\n' +\n 'a boolean 2nd argument is no longer supported',\n )\n }\n // todo: defaults func?\n this.config = assign$1({}, DEFAULT_LEXER_CONFIG, config)\n const traceInitVal = this.config.traceInitPerf\n if (traceInitVal === true) {\n this.traceInitMaxIdent = Infinity\n this.traceInitPerf = true\n } else if (typeof traceInitVal === 'number') {\n this.traceInitMaxIdent = traceInitVal\n this.traceInitPerf = true\n }\n this.traceInitIndent = -1\n this.TRACE_INIT('Lexer Constructor', () => {\n let actualDefinition\n let hasOnlySingleMode = true\n this.TRACE_INIT('Lexer Config handling', () => {\n if (this.config.lineTerminatorsPattern === DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) {\n // optimized built-in implementation for the defaults definition of lineTerminators\n this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester\n } else {\n if (this.config.lineTerminatorCharacters === DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) {\n throw Error(\n 'Error: Missing property on the Lexer config.\\n' +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS',\n )\n }\n }\n if (config.safeMode && config.ensureOptimizations) {\n throw Error('\"safeMode\" and \"ensureOptimizations\" flags are mutually exclusive.')\n }\n this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking)\n this.trackEndLines = /full/i.test(this.config.positionTracking)\n // Convert SingleModeLexerDefinition into a IMultiModeLexerDefinition.\n if (isArray$1(lexerDefinition)) {\n actualDefinition = {\n modes: { defaultMode: clone(lexerDefinition) },\n defaultMode: DEFAULT_MODE,\n }\n } else {\n // no conversion needed, input should already be a IMultiModeLexerDefinition\n hasOnlySingleMode = false\n actualDefinition = clone(lexerDefinition)\n }\n })\n if (this.config.skipValidations === false) {\n this.TRACE_INIT('performRuntimeChecks', () => {\n this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(\n performRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters),\n )\n })\n this.TRACE_INIT('performWarningRuntimeChecks', () => {\n this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(\n performWarningRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters),\n )\n })\n }\n // for extra robustness to avoid throwing an none informative error message\n actualDefinition.modes = actualDefinition.modes ? actualDefinition.modes : {}\n // an error of undefined TokenTypes will be detected in \"performRuntimeChecks\" above.\n // this transformation is to increase robustness in the case of partially invalid lexer definition.\n forEach(actualDefinition.modes, (currModeValue, currModeName) => {\n actualDefinition.modes[currModeName] = reject(currModeValue, (currTokType) => isUndefined(currTokType))\n })\n const allModeNames = keys(actualDefinition.modes)\n forEach(actualDefinition.modes, (currModDef, currModName) => {\n this.TRACE_INIT(`Mode: <${currModName}> processing`, () => {\n this.modes.push(currModName)\n if (this.config.skipValidations === false) {\n this.TRACE_INIT(`validatePatterns`, () => {\n this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(\n validatePatterns(currModDef, allModeNames),\n )\n })\n }\n // If definition errors were encountered, the analysis phase may fail unexpectedly/\n // Considering a lexer with definition errors may never be used, there is no point\n // to performing the analysis anyhow...\n if (isEmpty(this.lexerDefinitionErrors)) {\n augmentTokenTypes(currModDef)\n let currAnalyzeResult\n this.TRACE_INIT(`analyzeTokenTypes`, () => {\n currAnalyzeResult = analyzeTokenTypes(currModDef, {\n lineTerminatorCharacters: this.config.lineTerminatorCharacters,\n positionTracking: config.positionTracking,\n ensureOptimizations: config.ensureOptimizations,\n safeMode: config.safeMode,\n tracer: this.TRACE_INIT,\n })\n })\n this.patternIdxToConfig[currModName] = currAnalyzeResult.patternIdxToConfig\n this.charCodeToPatternIdxToConfig[currModName] = currAnalyzeResult.charCodeToPatternIdxToConfig\n this.emptyGroups = assign$1({}, this.emptyGroups, currAnalyzeResult.emptyGroups)\n this.hasCustom = currAnalyzeResult.hasCustom || this.hasCustom\n this.canModeBeOptimized[currModName] = currAnalyzeResult.canBeOptimized\n }\n })\n })\n this.defaultMode = actualDefinition.defaultMode\n if (!isEmpty(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) {\n const allErrMessages = map(this.lexerDefinitionErrors, (error) => {\n return error.message\n })\n const allErrMessagesString = allErrMessages.join('-----------------------\\n')\n throw new Error('Errors detected in definition of Lexer:\\n' + allErrMessagesString)\n }\n // Only print warning if there are no errors, This will avoid pl\n forEach(this.lexerDefinitionWarning, (warningDescriptor) => {\n PRINT_WARNING(warningDescriptor.message)\n })\n this.TRACE_INIT('Choosing sub-methods implementations', () => {\n // Choose the relevant internal implementations for this specific parser.\n // These implementations should be in-lined by the JavaScript engine\n // to provide optimal performance in each scenario.\n if (SUPPORT_STICKY) {\n this.chopInput = identity\n this.match = this.matchWithTest\n } else {\n this.updateLastIndex = noop\n this.match = this.matchWithExec\n }\n if (hasOnlySingleMode) {\n this.handleModes = noop\n }\n if (this.trackStartLines === false) {\n this.computeNewColumn = identity\n }\n if (this.trackEndLines === false) {\n this.updateTokenEndLineColumnLocation = noop\n }\n if (/full/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createFullToken\n } else if (/onlyStart/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createStartOnlyToken\n } else if (/onlyOffset/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createOffsetOnlyToken\n } else {\n throw Error(`Invalid config option: \"${this.config.positionTracking}\"`)\n }\n if (this.hasCustom) {\n this.addToken = this.addTokenUsingPush\n this.handlePayload = this.handlePayloadWithCustom\n } else {\n this.addToken = this.addTokenUsingMemberAccess\n this.handlePayload = this.handlePayloadNoCustom\n }\n })\n this.TRACE_INIT('Failed Optimization Warnings', () => {\n const unOptimizedModes = reduce(\n this.canModeBeOptimized,\n (cannotBeOptimized, canBeOptimized, modeName) => {\n if (canBeOptimized === false) {\n cannotBeOptimized.push(modeName)\n }\n return cannotBeOptimized\n },\n [],\n )\n if (config.ensureOptimizations && !isEmpty(unOptimizedModes)) {\n throw Error(\n `Lexer Modes: < ${unOptimizedModes.join(', ')} > cannot be optimized.\\n` +\n '\\t Disable the \"ensureOptimizations\" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\\n' +\n '\\t Or inspect the console log for details on how to resolve these issues.',\n )\n }\n })\n this.TRACE_INIT('clearRegExpParserCache', () => {\n clearRegExpParserCache()\n })\n this.TRACE_INIT('toFastProperties', () => {\n toFastProperties(this)\n })\n })\n }\n tokenize(text, initialMode = this.defaultMode) {\n if (!isEmpty(this.lexerDefinitionErrors)) {\n const allErrMessages = map(this.lexerDefinitionErrors, (error) => {\n return error.message\n })\n const allErrMessagesString = allErrMessages.join('-----------------------\\n')\n throw new Error('Unable to Tokenize because Errors detected in definition of Lexer:\\n' + allErrMessagesString)\n }\n return this.tokenizeInternal(text, initialMode)\n }\n // There is quite a bit of duplication between this and \"tokenizeInternalLazy\"\n // This is intentional due to performance considerations.\n // this method also used quite a bit of `!` none null assertions because it is too optimized\n // for `tsc` to always understand it is \"safe\"\n tokenizeInternal(text, initialMode) {\n let i,\n j,\n k,\n matchAltImage,\n longerAlt,\n matchedImage,\n payload,\n altPayload,\n imageLength,\n group,\n tokType,\n newToken,\n errLength,\n msg,\n match\n const orgText = text\n const orgLength = orgText.length\n let offset = 0\n let matchedTokensIndex = 0\n // initializing the tokensArray to the \"guessed\" size.\n // guessing too little will still reduce the number of array re-sizes on pushes.\n // guessing too large (Tested by guessing x4 too large) may cost a bit more of memory\n // but would still have a faster runtime by avoiding (All but one) array resizing.\n const guessedNumberOfTokens = this.hasCustom\n ? 0 // will break custom token pattern APIs the matchedTokens array will contain undefined elements.\n : Math.floor(text.length / 10)\n const matchedTokens = new Array(guessedNumberOfTokens)\n const errors = []\n let line = this.trackStartLines ? 1 : undefined\n let column = this.trackStartLines ? 1 : undefined\n const groups = cloneEmptyGroups(this.emptyGroups)\n const trackLines = this.trackStartLines\n const lineTerminatorPattern = this.config.lineTerminatorsPattern\n let currModePatternsLength = 0\n let patternIdxToConfig = []\n let currCharCodeToPatternIdxToConfig = []\n const modeStack = []\n const emptyArray = []\n Object.freeze(emptyArray)\n let getPossiblePatterns\n function getPossiblePatternsSlow() {\n return patternIdxToConfig\n }\n function getPossiblePatternsOptimized(charCode) {\n const optimizedCharIdx = charCodeToOptimizedIndex(charCode)\n const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx]\n if (possiblePatterns === undefined) {\n return emptyArray\n } else {\n return possiblePatterns\n }\n }\n const pop_mode = (popToken) => {\n // TODO: perhaps avoid this error in the edge case there is no more input?\n if (\n modeStack.length === 1 &&\n // if we have both a POP_MODE and a PUSH_MODE this is in-fact a \"transition\"\n // So no error should occur.\n popToken.tokenType.PUSH_MODE === undefined\n ) {\n // if we try to pop the last mode there lexer will no longer have ANY mode.\n // thus the pop is ignored, an error will be created and the lexer will continue parsing in the previous mode.\n const msg = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken)\n errors.push({\n offset: popToken.startOffset,\n line: popToken.startLine,\n column: popToken.startColumn,\n length: popToken.image.length,\n message: msg,\n })\n } else {\n modeStack.pop()\n const newMode = last(modeStack)\n patternIdxToConfig = this.patternIdxToConfig[newMode]\n currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]\n currModePatternsLength = patternIdxToConfig.length\n const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized\n } else {\n getPossiblePatterns = getPossiblePatternsSlow\n }\n }\n }\n function push_mode(newMode) {\n modeStack.push(newMode)\n currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]\n patternIdxToConfig = this.patternIdxToConfig[newMode]\n currModePatternsLength = patternIdxToConfig.length\n currModePatternsLength = patternIdxToConfig.length\n const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized\n } else {\n getPossiblePatterns = getPossiblePatternsSlow\n }\n }\n // this pattern seems to avoid a V8 de-optimization, although that de-optimization does not\n // seem to matter performance wise.\n push_mode.call(this, initialMode)\n let currConfig\n const recoveryEnabled = this.config.recoveryEnabled\n while (offset < orgLength) {\n matchedImage = null\n const nextCharCode = orgText.charCodeAt(offset)\n const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode)\n const chosenPatternsLength = chosenPatternIdxToConfig.length\n for (i = 0; i < chosenPatternsLength; i++) {\n currConfig = chosenPatternIdxToConfig[i]\n const currPattern = currConfig.pattern\n payload = null\n // manually in-lined because > 600 chars won't be in-lined in V8\n const singleCharCode = currConfig.short\n if (singleCharCode !== false) {\n if (nextCharCode === singleCharCode) {\n // single character string\n matchedImage = currPattern\n }\n } else if (currConfig.isCustom === true) {\n match = currPattern.exec(orgText, offset, matchedTokens, groups)\n if (match !== null) {\n matchedImage = match[0]\n if (match.payload !== undefined) {\n payload = match.payload\n }\n } else {\n matchedImage = null\n }\n } else {\n this.updateLastIndex(currPattern, offset)\n matchedImage = this.match(currPattern, text, offset)\n }\n if (matchedImage !== null) {\n // even though this pattern matched we must try a another longer alternative.\n // this can be used to prioritize keywords over identifiers\n longerAlt = currConfig.longerAlt\n if (longerAlt !== undefined) {\n // TODO: micro optimize, avoid extra prop access\n // by saving/linking longerAlt on the original config?\n const longerAltLength = longerAlt.length\n for (k = 0; k < longerAltLength; k++) {\n const longerAltConfig = patternIdxToConfig[longerAlt[k]]\n const longerAltPattern = longerAltConfig.pattern\n altPayload = null\n // single Char can never be a longer alt so no need to test it.\n // manually in-lined because > 600 chars won't be in-lined in V8\n if (longerAltConfig.isCustom === true) {\n match = longerAltPattern.exec(orgText, offset, matchedTokens, groups)\n if (match !== null) {\n matchAltImage = match[0]\n if (match.payload !== undefined) {\n altPayload = match.payload\n }\n } else {\n matchAltImage = null\n }\n } else {\n this.updateLastIndex(longerAltPattern, offset)\n matchAltImage = this.match(longerAltPattern, text, offset)\n }\n if (matchAltImage && matchAltImage.length > matchedImage.length) {\n matchedImage = matchAltImage\n payload = altPayload\n currConfig = longerAltConfig\n // Exit the loop early after matching one of the longer alternatives\n // The first matched alternative takes precedence\n break\n }\n }\n }\n break\n }\n }\n // successful match\n if (matchedImage !== null) {\n imageLength = matchedImage.length\n group = currConfig.group\n if (group !== undefined) {\n tokType = currConfig.tokenTypeIdx\n // TODO: \"offset + imageLength\" and the new column may be computed twice in case of \"full\" location information inside\n // createFullToken method\n newToken = this.createTokenInstance(\n matchedImage,\n offset,\n tokType,\n currConfig.tokenType,\n line,\n column,\n imageLength,\n )\n this.handlePayload(newToken, payload)\n // TODO: optimize NOOP in case there are no special groups?\n if (group === false) {\n matchedTokensIndex = this.addToken(matchedTokens, matchedTokensIndex, newToken)\n } else {\n groups[group].push(newToken)\n }\n }\n text = this.chopInput(text, imageLength)\n offset = offset + imageLength\n // TODO: with newlines the column may be assigned twice\n column = this.computeNewColumn(column, imageLength)\n if (trackLines === true && currConfig.canLineTerminator === true) {\n let numOfLTsInMatch = 0\n let foundTerminator\n let lastLTEndOffset\n lineTerminatorPattern.lastIndex = 0\n do {\n foundTerminator = lineTerminatorPattern.test(matchedImage)\n if (foundTerminator === true) {\n lastLTEndOffset = lineTerminatorPattern.lastIndex - 1\n numOfLTsInMatch++\n }\n } while (foundTerminator === true)\n if (numOfLTsInMatch !== 0) {\n line = line + numOfLTsInMatch\n column = imageLength - lastLTEndOffset\n this.updateTokenEndLineColumnLocation(\n newToken,\n group,\n lastLTEndOffset,\n numOfLTsInMatch,\n line,\n column,\n imageLength,\n )\n }\n }\n // will be NOOP if no modes present\n this.handleModes(currConfig, pop_mode, push_mode, newToken)\n } else {\n // error recovery, drop characters until we identify a valid token's start point\n const errorStartOffset = offset\n const errorLine = line\n const errorColumn = column\n let foundResyncPoint = recoveryEnabled === false\n while (foundResyncPoint === false && offset < orgLength) {\n // Identity Func (when sticky flag is enabled)\n text = this.chopInput(text, 1)\n offset++\n for (j = 0; j < currModePatternsLength; j++) {\n const currConfig = patternIdxToConfig[j]\n const currPattern = currConfig.pattern\n // manually in-lined because > 600 chars won't be in-lined in V8\n const singleCharCode = currConfig.short\n if (singleCharCode !== false) {\n if (orgText.charCodeAt(offset) === singleCharCode) {\n // single character string\n foundResyncPoint = true\n }\n } else if (currConfig.isCustom === true) {\n foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null\n } else {\n this.updateLastIndex(currPattern, offset)\n foundResyncPoint = currPattern.exec(text) !== null\n }\n if (foundResyncPoint === true) {\n break\n }\n }\n }\n errLength = offset - errorStartOffset\n column = this.computeNewColumn(column, errLength)\n // at this point we either re-synced or reached the end of the input text\n msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(\n orgText,\n errorStartOffset,\n errLength,\n errorLine,\n errorColumn,\n )\n errors.push({\n offset: errorStartOffset,\n line: errorLine,\n column: errorColumn,\n length: errLength,\n message: msg,\n })\n if (recoveryEnabled === false) {\n break\n }\n }\n }\n // if we do have custom patterns which push directly into the\n // TODO: custom tokens should not push directly??\n if (!this.hasCustom) {\n // if we guessed a too large size for the tokens array this will shrink it to the right size.\n matchedTokens.length = matchedTokensIndex\n }\n return {\n tokens: matchedTokens,\n groups: groups,\n errors: errors,\n }\n }\n handleModes(config, pop_mode, push_mode, newToken) {\n if (config.pop === true) {\n // need to save the PUSH_MODE property as if the mode is popped\n // patternIdxToPopMode is updated to reflect the new mode after popping the stack\n const pushMode = config.push\n pop_mode(newToken)\n if (pushMode !== undefined) {\n push_mode.call(this, pushMode)\n }\n } else if (config.push !== undefined) {\n push_mode.call(this, config.push)\n }\n }\n chopInput(text, length) {\n return text.substring(length)\n }\n updateLastIndex(regExp, newLastIndex) {\n regExp.lastIndex = newLastIndex\n }\n // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler\n updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {\n let lastCharIsLT, fixForEndingInLT\n if (group !== undefined) {\n // a none skipped multi line Token, need to update endLine/endColumn\n lastCharIsLT = lastLTIdx === imageLength - 1\n fixForEndingInLT = lastCharIsLT ? -1 : 0\n if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) {\n // if a token ends in a LT that last LT only affects the line numbering of following Tokens\n newToken.endLine = line + fixForEndingInLT\n // the last LT in a token does not affect the endColumn either as the [columnStart ... columnEnd)\n // inclusive to exclusive range.\n newToken.endColumn = column - 1 + -fixForEndingInLT\n }\n // else single LT in the last character of a token, no need to modify the endLine/EndColumn\n }\n }\n computeNewColumn(oldColumn, imageLength) {\n return oldColumn + imageLength\n }\n createOffsetOnlyToken(image, startOffset, tokenTypeIdx, tokenType) {\n return {\n image,\n startOffset,\n tokenTypeIdx,\n tokenType,\n }\n }\n createStartOnlyToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn) {\n return {\n image,\n startOffset,\n startLine,\n startColumn,\n tokenTypeIdx,\n tokenType,\n }\n }\n createFullToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn, imageLength) {\n return {\n image,\n startOffset,\n endOffset: startOffset + imageLength - 1,\n startLine,\n endLine: startLine,\n startColumn,\n endColumn: startColumn + imageLength - 1,\n tokenTypeIdx,\n tokenType,\n }\n }\n addTokenUsingPush(tokenVector, index, tokenToAdd) {\n tokenVector.push(tokenToAdd)\n return index\n }\n addTokenUsingMemberAccess(tokenVector, index, tokenToAdd) {\n tokenVector[index] = tokenToAdd\n index++\n return index\n }\n handlePayloadNoCustom(token, payload) {}\n handlePayloadWithCustom(token, payload) {\n if (payload !== null) {\n token.payload = payload\n }\n }\n matchWithTest(pattern, text, offset) {\n const found = pattern.test(text)\n if (found === true) {\n return text.substring(offset, pattern.lastIndex)\n }\n return null\n }\n matchWithExec(pattern, text) {\n const regExpArray = pattern.exec(text)\n return regExpArray !== null ? regExpArray[0] : null\n }\n }\n Lexer.SKIPPED =\n 'This marks a skipped Token pattern, this means each token identified by it will' +\n 'be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.'\n Lexer.NA = /NOT_APPLICABLE/\n\n function tokenLabel(tokType) {\n if (hasTokenLabel(tokType)) {\n return tokType.LABEL\n } else {\n return tokType.name\n }\n }\n function hasTokenLabel(obj) {\n return isString(obj.LABEL) && obj.LABEL !== ''\n }\n const PARENT = 'parent'\n const CATEGORIES = 'categories'\n const LABEL = 'label'\n const GROUP = 'group'\n const PUSH_MODE = 'push_mode'\n const POP_MODE = 'pop_mode'\n const LONGER_ALT = 'longer_alt'\n const LINE_BREAKS = 'line_breaks'\n const START_CHARS_HINT = 'start_chars_hint'\n function createToken(config) {\n return createTokenInternal(config)\n }\n function createTokenInternal(config) {\n const pattern = config.pattern\n const tokenType = {}\n tokenType.name = config.name\n if (!isUndefined(pattern)) {\n tokenType.PATTERN = pattern\n }\n if (has(config, PARENT)) {\n throw (\n 'The parent property is no longer supported.\\n' +\n 'See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.'\n )\n }\n if (has(config, CATEGORIES)) {\n // casting to ANY as this will be fixed inside `augmentTokenTypes``\n tokenType.CATEGORIES = config[CATEGORIES]\n }\n augmentTokenTypes([tokenType])\n if (has(config, LABEL)) {\n tokenType.LABEL = config[LABEL]\n }\n if (has(config, GROUP)) {\n tokenType.GROUP = config[GROUP]\n }\n if (has(config, POP_MODE)) {\n tokenType.POP_MODE = config[POP_MODE]\n }\n if (has(config, PUSH_MODE)) {\n tokenType.PUSH_MODE = config[PUSH_MODE]\n }\n if (has(config, LONGER_ALT)) {\n tokenType.LONGER_ALT = config[LONGER_ALT]\n }\n if (has(config, LINE_BREAKS)) {\n tokenType.LINE_BREAKS = config[LINE_BREAKS]\n }\n if (has(config, START_CHARS_HINT)) {\n tokenType.START_CHARS_HINT = config[START_CHARS_HINT]\n }\n return tokenType\n }\n const EOF = createToken({ name: 'EOF', pattern: Lexer.NA })\n augmentTokenTypes([EOF])\n function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) {\n return {\n image,\n startOffset,\n endOffset,\n startLine,\n endLine,\n startColumn,\n endColumn,\n tokenTypeIdx: tokType.tokenTypeIdx,\n tokenType: tokType,\n }\n }\n function tokenMatcher(token, tokType) {\n return tokenStructuredMatcher(token, tokType)\n }\n\n const defaultParserErrorProvider = {\n buildMismatchTokenMessage({ expected, actual, previous, ruleName }) {\n const hasLabel = hasTokenLabel(expected)\n const expectedMsg = hasLabel ? `--> ${tokenLabel(expected)} <--` : `token of type --> ${expected.name} <--`\n const msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`\n return msg\n },\n buildNotAllInputParsedMessage({ firstRedundant, ruleName }) {\n return 'Redundant input, expecting EOF but found: ' + firstRedundant.image\n },\n buildNoViableAltMessage({ expectedPathsPerAlt, actual, previous, customUserDescription, ruleName }) {\n const errPrefix = 'Expecting: '\n // TODO: issue: No Viable Alternative Error may have incomplete details. #502\n const actualText = head(actual).image\n const errSuffix = \"\\nbut found: '\" + actualText + \"'\"\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix\n } else {\n const allLookAheadPaths = reduce(expectedPathsPerAlt, (result, currAltPaths) => result.concat(currAltPaths), [])\n const nextValidTokenSequences = map(\n allLookAheadPaths,\n (currPath) => `[${map(currPath, (currTokenType) => tokenLabel(currTokenType)).join(', ')}]`,\n )\n const nextValidSequenceItems = map(nextValidTokenSequences, (itemMsg, idx) => ` ${idx + 1}. ${itemMsg}`)\n const calculatedDescription = `one of these possible Token sequences:\\n${nextValidSequenceItems.join('\\n')}`\n return errPrefix + calculatedDescription + errSuffix\n }\n },\n buildEarlyExitMessage({ expectedIterationPaths, actual, customUserDescription, ruleName }) {\n const errPrefix = 'Expecting: '\n // TODO: issue: No Viable Alternative Error may have incomplete details. #502\n const actualText = head(actual).image\n const errSuffix = \"\\nbut found: '\" + actualText + \"'\"\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix\n } else {\n const nextValidTokenSequences = map(\n expectedIterationPaths,\n (currPath) => `[${map(currPath, (currTokenType) => tokenLabel(currTokenType)).join(',')}]`,\n )\n const calculatedDescription =\n `expecting at least one iteration which starts with one of these possible Token sequences::\\n ` +\n `<${nextValidTokenSequences.join(' ,')}>`\n return errPrefix + calculatedDescription + errSuffix\n }\n },\n }\n Object.freeze(defaultParserErrorProvider)\n const defaultGrammarResolverErrorProvider = {\n buildRuleNotFoundError(topLevelRule, undefinedRule) {\n const msg =\n 'Invalid grammar, reference to a rule which is not defined: ->' +\n undefinedRule.nonTerminalName +\n '<-\\n' +\n 'inside top level rule: ->' +\n topLevelRule.name +\n '<-'\n return msg\n },\n }\n const defaultGrammarValidatorErrorProvider = {\n buildDuplicateFoundError(topLevelRule, duplicateProds) {\n function getExtraProductionArgument(prod) {\n if (prod instanceof Terminal) {\n return prod.terminalType.name\n } else if (prod instanceof NonTerminal) {\n return prod.nonTerminalName\n } else {\n return ''\n }\n }\n const topLevelName = topLevelRule.name\n const duplicateProd = head(duplicateProds)\n const index = duplicateProd.idx\n const dslName = getProductionDslName(duplicateProd)\n const extraArgument = getExtraProductionArgument(duplicateProd)\n const hasExplicitIndex = index > 0\n let msg = `->${dslName}${hasExplicitIndex ? index : ''}<- ${\n extraArgument ? `with argument: ->${extraArgument}<-` : ''\n }\n appears more than once (${\n duplicateProds.length\n } times) in the top level rule: ->${topLevelName}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `\n // white space trimming time! better to trim afterwards as it allows to use WELL formatted multi line template strings...\n msg = msg.replace(/[ \\t]+/g, ' ')\n msg = msg.replace(/\\s\\s+/g, '\\n')\n return msg\n },\n buildNamespaceConflictError(rule) {\n const errMsg =\n `Namespace conflict found in grammar.\\n` +\n `The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.name}>.\\n` +\n `To resolve this make sure each Terminal and Non-Terminal names are unique\\n` +\n `This is easy to accomplish by using the convention that Terminal names start with an uppercase letter\\n` +\n `and Non-Terminal names start with a lower case letter.`\n return errMsg\n },\n buildAlternationPrefixAmbiguityError(options) {\n const pathMsg = map(options.prefixPath, (currTok) => tokenLabel(currTok)).join(', ')\n const occurrence = options.alternation.idx === 0 ? '' : options.alternation.idx\n const errMsg =\n `Ambiguous alternatives: <${options.ambiguityIndices.join(' ,')}> due to common lookahead prefix\\n` +\n `in inside <${options.topLevelRule.name}> Rule,\\n` +\n `<${pathMsg}> may appears as a prefix path in all these alternatives.\\n` +\n `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\\n` +\n `For Further details.`\n return errMsg\n },\n buildAlternationAmbiguityError(options) {\n const pathMsg = map(options.prefixPath, (currtok) => tokenLabel(currtok)).join(', ')\n const occurrence = options.alternation.idx === 0 ? '' : options.alternation.idx\n let currMessage =\n `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(' ,')}> in ` +\n ` inside <${options.topLevelRule.name}> Rule,\\n` +\n `<${pathMsg}> may appears as a prefix path in all these alternatives.\\n`\n currMessage =\n currMessage +\n `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\\n` +\n `For Further details.`\n return currMessage\n },\n buildEmptyRepetitionError(options) {\n let dslName = getProductionDslName(options.repetition)\n if (options.repetition.idx !== 0) {\n dslName += options.repetition.idx\n }\n const errMsg =\n `The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens.\\n` +\n `This could lead to an infinite loop.`\n return errMsg\n },\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildTokenNameError(options) {\n /* istanbul ignore next */\n return 'deprecated'\n },\n buildEmptyAlternationError(options) {\n const errMsg =\n `Ambiguous empty alternative: <${options.emptyChoiceIdx + 1}>` +\n ` in inside <${options.topLevelRule.name}> Rule.\\n` +\n `Only the last alternative may be an empty alternative.`\n return errMsg\n },\n buildTooManyAlternativesError(options) {\n const errMsg =\n `An Alternation cannot have more than 256 alternatives:\\n` +\n ` inside <${options.topLevelRule.name}> Rule.\\n has ${\n options.alternation.definition.length + 1\n } alternatives.`\n return errMsg\n },\n buildLeftRecursionError(options) {\n const ruleName = options.topLevelRule.name\n const pathNames = map(options.leftRecursionPath, (currRule) => currRule.name)\n const leftRecursivePath = `${ruleName} --> ${pathNames.concat([ruleName]).join(' --> ')}`\n const errMsg =\n `Left Recursion found in grammar.\\n` +\n `rule: <${ruleName}> can be invoked from itself (directly or indirectly)\\n` +\n `without consuming any Tokens. The grammar path that causes this is: \\n ${leftRecursivePath}\\n` +\n ` To fix this refactor your grammar to remove the left recursion.\\n` +\n `see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`\n return errMsg\n },\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildInvalidRuleNameError(options) {\n /* istanbul ignore next */\n return 'deprecated'\n },\n buildDuplicateRuleNameError(options) {\n let ruleName\n if (options.topLevelRule instanceof Rule) {\n ruleName = options.topLevelRule.name\n } else {\n ruleName = options.topLevelRule\n }\n const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`\n return errMsg\n },\n }\n\n function resolveGrammar$1(topLevels, errMsgProvider) {\n const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider)\n refResolver.resolveRefs()\n return refResolver.errors\n }\n class GastRefResolverVisitor extends GAstVisitor {\n constructor(nameToTopRule, errMsgProvider) {\n super()\n this.nameToTopRule = nameToTopRule\n this.errMsgProvider = errMsgProvider\n this.errors = []\n }\n resolveRefs() {\n forEach(values(this.nameToTopRule), (prod) => {\n this.currTopLevel = prod\n prod.accept(this)\n })\n }\n visitNonTerminal(node) {\n const ref = this.nameToTopRule[node.nonTerminalName]\n if (!ref) {\n const msg = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, node)\n this.errors.push({\n message: msg,\n type: ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,\n ruleName: this.currTopLevel.name,\n unresolvedRefName: node.nonTerminalName,\n })\n } else {\n node.referencedRule = ref\n }\n }\n }\n\n class AbstractNextPossibleTokensWalker extends RestWalker {\n constructor(topProd, path) {\n super()\n this.topProd = topProd\n this.path = path\n this.possibleTokTypes = []\n this.nextProductionName = ''\n this.nextProductionOccurrence = 0\n this.found = false\n this.isAtEndOfPath = false\n }\n startWalking() {\n this.found = false\n if (this.path.ruleStack[0] !== this.topProd.name) {\n throw Error(\"The path does not start with the walker's top Rule!\")\n }\n // immutable for the win\n this.ruleStack = clone(this.path.ruleStack).reverse() // intelij bug requires assertion\n this.occurrenceStack = clone(this.path.occurrenceStack).reverse() // intelij bug requires assertion\n // already verified that the first production is valid, we now seek the 2nd production\n this.ruleStack.pop()\n this.occurrenceStack.pop()\n this.updateExpectedNext()\n this.walk(this.topProd)\n return this.possibleTokTypes\n }\n walk(prod, prevRest = []) {\n // stop scanning once we found the path\n if (!this.found) {\n super.walk(prod, prevRest)\n }\n }\n walkProdRef(refProd, currRest, prevRest) {\n // found the next production, need to keep walking in it\n if (refProd.referencedRule.name === this.nextProductionName && refProd.idx === this.nextProductionOccurrence) {\n const fullRest = currRest.concat(prevRest)\n this.updateExpectedNext()\n this.walk(refProd.referencedRule, fullRest)\n }\n }\n updateExpectedNext() {\n // need to consume the Terminal\n if (isEmpty(this.ruleStack)) {\n // must reset nextProductionXXX to avoid walking down another Top Level production while what we are\n // really seeking is the last Terminal...\n this.nextProductionName = ''\n this.nextProductionOccurrence = 0\n this.isAtEndOfPath = true\n } else {\n this.nextProductionName = this.ruleStack.pop()\n this.nextProductionOccurrence = this.occurrenceStack.pop()\n }\n }\n }\n class NextAfterTokenWalker extends AbstractNextPossibleTokensWalker {\n constructor(topProd, path) {\n super(topProd, path)\n this.path = path\n this.nextTerminalName = ''\n this.nextTerminalOccurrence = 0\n this.nextTerminalName = this.path.lastTok.name\n this.nextTerminalOccurrence = this.path.lastTokOccurrence\n }\n walkTerminal(terminal, currRest, prevRest) {\n if (\n this.isAtEndOfPath &&\n terminal.terminalType.name === this.nextTerminalName &&\n terminal.idx === this.nextTerminalOccurrence &&\n !this.found\n ) {\n const fullRest = currRest.concat(prevRest)\n const restProd = new Alternative({ definition: fullRest })\n this.possibleTokTypes = first(restProd)\n this.found = true\n }\n }\n }\n /**\n * This walker only \"walks\" a single \"TOP\" level in the Grammar Ast, this means\n * it never \"follows\" production refs\n */\n class AbstractNextTerminalAfterProductionWalker extends RestWalker {\n constructor(topRule, occurrence) {\n super()\n this.topRule = topRule\n this.occurrence = occurrence\n this.result = {\n token: undefined,\n occurrence: undefined,\n isEndOfRule: undefined,\n }\n }\n startWalking() {\n this.walk(this.topRule)\n return this.result\n }\n }\n class NextTerminalAfterManyWalker extends AbstractNextTerminalAfterProductionWalker {\n walkMany(manyProd, currRest, prevRest) {\n if (manyProd.idx === this.occurrence) {\n const firstAfterMany = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterMany === undefined\n if (firstAfterMany instanceof Terminal) {\n this.result.token = firstAfterMany.terminalType\n this.result.occurrence = firstAfterMany.idx\n }\n } else {\n super.walkMany(manyProd, currRest, prevRest)\n }\n }\n }\n class NextTerminalAfterManySepWalker extends AbstractNextTerminalAfterProductionWalker {\n walkManySep(manySepProd, currRest, prevRest) {\n if (manySepProd.idx === this.occurrence) {\n const firstAfterManySep = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterManySep === undefined\n if (firstAfterManySep instanceof Terminal) {\n this.result.token = firstAfterManySep.terminalType\n this.result.occurrence = firstAfterManySep.idx\n }\n } else {\n super.walkManySep(manySepProd, currRest, prevRest)\n }\n }\n }\n class NextTerminalAfterAtLeastOneWalker extends AbstractNextTerminalAfterProductionWalker {\n walkAtLeastOne(atLeastOneProd, currRest, prevRest) {\n if (atLeastOneProd.idx === this.occurrence) {\n const firstAfterAtLeastOne = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterAtLeastOne === undefined\n if (firstAfterAtLeastOne instanceof Terminal) {\n this.result.token = firstAfterAtLeastOne.terminalType\n this.result.occurrence = firstAfterAtLeastOne.idx\n }\n } else {\n super.walkAtLeastOne(atLeastOneProd, currRest, prevRest)\n }\n }\n }\n // TODO: reduce code duplication in the AfterWalkers\n class NextTerminalAfterAtLeastOneSepWalker extends AbstractNextTerminalAfterProductionWalker {\n walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest) {\n if (atleastOneSepProd.idx === this.occurrence) {\n const firstAfterfirstAfterAtLeastOneSep = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === undefined\n if (firstAfterfirstAfterAtLeastOneSep instanceof Terminal) {\n this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType\n this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx\n }\n } else {\n super.walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest)\n }\n }\n }\n function possiblePathsFrom(targetDef, maxLength, currPath = []) {\n // avoid side effects\n currPath = clone(currPath)\n let result = []\n let i = 0\n // TODO: avoid inner funcs\n function remainingPathWith(nextDef) {\n return nextDef.concat(drop(targetDef, i + 1))\n }\n // TODO: avoid inner funcs\n function getAlternativesForProd(definition) {\n const alternatives = possiblePathsFrom(remainingPathWith(definition), maxLength, currPath)\n return result.concat(alternatives)\n }\n /**\n * Mandatory productions will halt the loop as the paths computed from their recursive calls will already contain the\n * following (rest) of the targetDef.\n *\n * For optional productions (Option/Repetition/...) the loop will continue to represent the paths that do not include the\n * the optional production.\n */\n while (currPath.length < maxLength && i < targetDef.length) {\n const prod = targetDef[i]\n /* istanbul ignore else */\n if (prod instanceof Alternative) {\n return getAlternativesForProd(prod.definition)\n } else if (prod instanceof NonTerminal) {\n return getAlternativesForProd(prod.definition)\n } else if (prod instanceof Option) {\n result = getAlternativesForProd(prod.definition)\n } else if (prod instanceof RepetitionMandatory) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: prod.definition,\n }),\n ])\n return getAlternativesForProd(newDef)\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n const newDef = [\n new Alternative({ definition: prod.definition }),\n new Repetition({\n definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition),\n }),\n ]\n return getAlternativesForProd(newDef)\n } else if (prod instanceof RepetitionWithSeparator) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition),\n }),\n ])\n result = getAlternativesForProd(newDef)\n } else if (prod instanceof Repetition) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: prod.definition,\n }),\n ])\n result = getAlternativesForProd(newDef)\n } else if (prod instanceof Alternation) {\n forEach(prod.definition, (currAlt) => {\n // TODO: this is a limited check for empty alternatives\n // It would prevent a common case of infinite loops during parser initialization.\n // However **in-directly** empty alternatives may still cause issues.\n if (isEmpty(currAlt.definition) === false) {\n result = getAlternativesForProd(currAlt.definition)\n }\n })\n return result\n } else if (prod instanceof Terminal) {\n currPath.push(prod.terminalType)\n } else {\n throw Error('non exhaustive match')\n }\n i++\n }\n result.push({\n partialPath: currPath,\n suffixDef: drop(targetDef, i),\n })\n return result\n }\n function nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) {\n const EXIT_NON_TERMINAL = 'EXIT_NONE_TERMINAL'\n // to avoid creating a new Array each time.\n const EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL]\n const EXIT_ALTERNATIVE = 'EXIT_ALTERNATIVE'\n let foundCompletePath = false\n const tokenVectorLength = tokenVector.length\n const minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1\n const result = []\n const possiblePaths = []\n possiblePaths.push({\n idx: -1,\n def: initialDef,\n ruleStack: [],\n occurrenceStack: [],\n })\n while (!isEmpty(possiblePaths)) {\n const currPath = possiblePaths.pop()\n // skip alternatives if no more results can be found (assuming deterministic grammar with fixed lookahead)\n if (currPath === EXIT_ALTERNATIVE) {\n if (foundCompletePath && last(possiblePaths).idx <= minimalAlternativesIndex) {\n // remove irrelevant alternative\n possiblePaths.pop()\n }\n continue\n }\n const currDef = currPath.def\n const currIdx = currPath.idx\n const currRuleStack = currPath.ruleStack\n const currOccurrenceStack = currPath.occurrenceStack\n // For Example: an empty path could exist in a valid grammar in the case of an EMPTY_ALT\n if (isEmpty(currDef)) {\n continue\n }\n const prod = currDef[0]\n /* istanbul ignore else */\n if (prod === EXIT_NON_TERMINAL) {\n const nextPath = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: dropRight(currRuleStack),\n occurrenceStack: dropRight(currOccurrenceStack),\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof Terminal) {\n /* istanbul ignore else */\n if (currIdx < tokenVectorLength - 1) {\n const nextIdx = currIdx + 1\n const actualToken = tokenVector[nextIdx]\n if (tokMatcher(actualToken, prod.terminalType)) {\n const nextPath = {\n idx: nextIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n }\n // end of the line\n } else if (currIdx === tokenVectorLength - 1) {\n // IGNORE ABOVE ELSE\n result.push({\n nextTokenType: prod.terminalType,\n nextTokenOccurrence: prod.idx,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n })\n foundCompletePath = true\n } else {\n throw Error('non exhaustive match')\n }\n } else if (prod instanceof NonTerminal) {\n const newRuleStack = clone(currRuleStack)\n newRuleStack.push(prod.nonTerminalName)\n const newOccurrenceStack = clone(currOccurrenceStack)\n newOccurrenceStack.push(prod.idx)\n const nextPath = {\n idx: currIdx,\n def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, drop(currDef)),\n ruleStack: newRuleStack,\n occurrenceStack: newOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof Option) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWithout)\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE)\n const nextPathWith = {\n idx: currIdx,\n def: prod.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWith)\n } else if (prod instanceof RepetitionMandatory) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n const secondIteration = new Repetition({\n definition: prod.definition,\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([secondIteration], drop(currDef))\n const nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n const separatorGast = new Terminal({\n terminalType: prod.separator,\n })\n const secondIteration = new Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([secondIteration], drop(currDef))\n const nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof RepetitionWithSeparator) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWithout)\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE)\n const separatorGast = new Terminal({\n terminalType: prod.separator,\n })\n const nthRepetition = new Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([nthRepetition], drop(currDef))\n const nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWith)\n } else if (prod instanceof Repetition) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWithout)\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE)\n // TODO: an empty repetition will cause infinite loops here, will the parser detect this in selfAnalysis?\n const nthRepetition = new Repetition({\n definition: prod.definition,\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([nthRepetition], drop(currDef))\n const nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWith)\n } else if (prod instanceof Alternation) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n for (let i = prod.definition.length - 1; i >= 0; i--) {\n const currAlt = prod.definition[i]\n const currAltPath = {\n idx: currIdx,\n def: currAlt.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(currAltPath)\n possiblePaths.push(EXIT_ALTERNATIVE)\n }\n } else if (prod instanceof Alternative) {\n possiblePaths.push({\n idx: currIdx,\n def: prod.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n })\n } else if (prod instanceof Rule) {\n // last because we should only encounter at most a single one of these per invocation.\n possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack))\n } else {\n throw Error('non exhaustive match')\n }\n }\n return result\n }\n function expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) {\n const newRuleStack = clone(currRuleStack)\n newRuleStack.push(topRule.name)\n const newCurrOccurrenceStack = clone(currOccurrenceStack)\n // top rule is always assumed to have been called with occurrence index 1\n newCurrOccurrenceStack.push(1)\n return {\n idx: currIdx,\n def: topRule.definition,\n ruleStack: newRuleStack,\n occurrenceStack: newCurrOccurrenceStack,\n }\n }\n\n var PROD_TYPE\n ;(function (PROD_TYPE) {\n PROD_TYPE[(PROD_TYPE['OPTION'] = 0)] = 'OPTION'\n PROD_TYPE[(PROD_TYPE['REPETITION'] = 1)] = 'REPETITION'\n PROD_TYPE[(PROD_TYPE['REPETITION_MANDATORY'] = 2)] = 'REPETITION_MANDATORY'\n PROD_TYPE[(PROD_TYPE['REPETITION_MANDATORY_WITH_SEPARATOR'] = 3)] = 'REPETITION_MANDATORY_WITH_SEPARATOR'\n PROD_TYPE[(PROD_TYPE['REPETITION_WITH_SEPARATOR'] = 4)] = 'REPETITION_WITH_SEPARATOR'\n PROD_TYPE[(PROD_TYPE['ALTERNATION'] = 5)] = 'ALTERNATION'\n })(PROD_TYPE || (PROD_TYPE = {}))\n function getProdType(prod) {\n /* istanbul ignore else */\n if (prod instanceof Option || prod === 'Option') {\n return PROD_TYPE.OPTION\n } else if (prod instanceof Repetition || prod === 'Repetition') {\n return PROD_TYPE.REPETITION\n } else if (prod instanceof RepetitionMandatory || prod === 'RepetitionMandatory') {\n return PROD_TYPE.REPETITION_MANDATORY\n } else if (prod instanceof RepetitionMandatoryWithSeparator || prod === 'RepetitionMandatoryWithSeparator') {\n return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR\n } else if (prod instanceof RepetitionWithSeparator || prod === 'RepetitionWithSeparator') {\n return PROD_TYPE.REPETITION_WITH_SEPARATOR\n } else if (prod instanceof Alternation || prod === 'Alternation') {\n return PROD_TYPE.ALTERNATION\n } else {\n throw Error('non exhaustive match')\n }\n }\n function buildLookaheadFuncForOr(\n occurrence,\n ruleGrammar,\n maxLookahead,\n hasPredicates,\n dynamicTokensEnabled,\n laFuncBuilder,\n ) {\n const lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, maxLookahead)\n const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)\n ? tokenStructuredMatcherNoCategories\n : tokenStructuredMatcher\n return laFuncBuilder(lookAheadPaths, hasPredicates, tokenMatcher, dynamicTokensEnabled)\n }\n /**\n * When dealing with an Optional production (OPTION/MANY/2nd iteration of AT_LEAST_ONE/...) we need to compare\n * the lookahead \"inside\" the production and the lookahead immediately \"after\" it in the same top level rule (context free).\n *\n * Example: given a production:\n * ABC(DE)?DF\n *\n * The optional '(DE)?' should only be entered if we see 'DE'. a single Token 'D' is not sufficient to distinguish between the two\n * alternatives.\n *\n * @returns A Lookahead function which will return true IFF the parser should parse the Optional production.\n */\n function buildLookaheadFuncForOptionalProd(\n occurrence,\n ruleGrammar,\n k,\n dynamicTokensEnabled,\n prodType,\n lookaheadBuilder,\n ) {\n const lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k)\n const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)\n ? tokenStructuredMatcherNoCategories\n : tokenStructuredMatcher\n return lookaheadBuilder(lookAheadPaths[0], tokenMatcher, dynamicTokensEnabled)\n }\n function buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher, dynamicTokensEnabled) {\n const numOfAlts = alts.length\n const areAllOneTokenLookahead = every(alts, (currAlt) => {\n return every(currAlt, (currPath) => {\n return currPath.length === 1\n })\n })\n // This version takes into account the predicates as well.\n if (hasPredicates) {\n /**\n * @returns {number} - The chosen alternative index\n */\n return function (orAlts) {\n // unfortunately the predicates must be extracted every single time\n // as they cannot be cached due to references to parameters(vars) which are no longer valid.\n // note that in the common case of no predicates, no cpu time will be wasted on this (see else block)\n const predicates = map(orAlts, (currAlt) => currAlt.GATE)\n for (let t = 0; t < numOfAlts; t++) {\n const currAlt = alts[t]\n const currNumOfPaths = currAlt.length\n const currPredicate = predicates[t]\n if (currPredicate !== undefined && currPredicate.call(this) === false) {\n // if the predicate does not match there is no point in checking the paths\n continue\n }\n nextPath: for (let j = 0; j < currNumOfPaths; j++) {\n const currPath = currAlt[j]\n const currPathLength = currPath.length\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1)\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined\n }\n } else if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n // optimized (common) case of all the lookaheads paths requiring only\n // a single token lookahead. These Optimizations cannot work if dynamically defined Tokens are used.\n const singleTokenAlts = map(alts, (currAlt) => {\n return flatten(currAlt)\n })\n const choiceToAlt = reduce(\n singleTokenAlts,\n (result, currAlt, idx) => {\n forEach(currAlt, (currTokType) => {\n if (!has(result, currTokType.tokenTypeIdx)) {\n result[currTokType.tokenTypeIdx] = idx\n }\n forEach(currTokType.categoryMatches, (currExtendingType) => {\n if (!has(result, currExtendingType)) {\n result[currExtendingType] = idx\n }\n })\n })\n return result\n },\n {},\n )\n /**\n * @returns {number} - The chosen alternative index\n */\n return function () {\n const nextToken = this.LA(1)\n return choiceToAlt[nextToken.tokenTypeIdx]\n }\n } else {\n // optimized lookahead without needing to check the predicates at all.\n // this causes code duplication which is intentional to improve performance.\n /**\n * @returns {number} - The chosen alternative index\n */\n return function () {\n for (let t = 0; t < numOfAlts; t++) {\n const currAlt = alts[t]\n const currNumOfPaths = currAlt.length\n nextPath: for (let j = 0; j < currNumOfPaths; j++) {\n const currPath = currAlt[j]\n const currPathLength = currPath.length\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1)\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined\n }\n }\n }\n function buildSingleAlternativeLookaheadFunction(alt, tokenMatcher, dynamicTokensEnabled) {\n const areAllOneTokenLookahead = every(alt, (currPath) => {\n return currPath.length === 1\n })\n const numOfPaths = alt.length\n // optimized (common) case of all the lookaheads paths requiring only\n // a single token lookahead.\n if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n const singleTokensTypes = flatten(alt)\n if (singleTokensTypes.length === 1 && isEmpty(singleTokensTypes[0].categoryMatches)) {\n const expectedTokenType = singleTokensTypes[0]\n const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx\n return function () {\n return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey\n }\n } else {\n const choiceToAlt = reduce(\n singleTokensTypes,\n (result, currTokType, idx) => {\n result[currTokType.tokenTypeIdx] = true\n forEach(currTokType.categoryMatches, (currExtendingType) => {\n result[currExtendingType] = true\n })\n return result\n },\n [],\n )\n return function () {\n const nextToken = this.LA(1)\n return choiceToAlt[nextToken.tokenTypeIdx] === true\n }\n }\n } else {\n return function () {\n nextPath: for (let j = 0; j < numOfPaths; j++) {\n const currPath = alt[j]\n const currPathLength = currPath.length\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1)\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath\n }\n }\n // found a full path that matches.\n return true\n }\n // none of the paths matched\n return false\n }\n }\n }\n class RestDefinitionFinderWalker extends RestWalker {\n constructor(topProd, targetOccurrence, targetProdType) {\n super()\n this.topProd = topProd\n this.targetOccurrence = targetOccurrence\n this.targetProdType = targetProdType\n }\n startWalking() {\n this.walk(this.topProd)\n return this.restDef\n }\n checkIsTarget(node, expectedProdType, currRest, prevRest) {\n if (node.idx === this.targetOccurrence && this.targetProdType === expectedProdType) {\n this.restDef = currRest.concat(prevRest)\n return true\n }\n // performance optimization, do not iterate over the entire Grammar ast after we have found the target\n return false\n }\n walkOption(optionProd, currRest, prevRest) {\n if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) {\n super.walkOption(optionProd, currRest, prevRest)\n }\n }\n walkAtLeastOne(atLeastOneProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) {\n super.walkOption(atLeastOneProd, currRest, prevRest)\n }\n }\n walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) {\n super.walkOption(atLeastOneSepProd, currRest, prevRest)\n }\n }\n walkMany(manyProd, currRest, prevRest) {\n if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) {\n super.walkOption(manyProd, currRest, prevRest)\n }\n }\n walkManySep(manySepProd, currRest, prevRest) {\n if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) {\n super.walkOption(manySepProd, currRest, prevRest)\n }\n }\n }\n /**\n * Returns the definition of a target production in a top level level rule.\n */\n class InsideDefinitionFinderVisitor extends GAstVisitor {\n constructor(targetOccurrence, targetProdType, targetRef) {\n super()\n this.targetOccurrence = targetOccurrence\n this.targetProdType = targetProdType\n this.targetRef = targetRef\n this.result = []\n }\n checkIsTarget(node, expectedProdName) {\n if (\n node.idx === this.targetOccurrence &&\n this.targetProdType === expectedProdName &&\n (this.targetRef === undefined || node === this.targetRef)\n ) {\n this.result = node.definition\n }\n }\n visitOption(node) {\n this.checkIsTarget(node, PROD_TYPE.OPTION)\n }\n visitRepetition(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION)\n }\n visitRepetitionMandatory(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY)\n }\n visitRepetitionMandatoryWithSeparator(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR)\n }\n visitRepetitionWithSeparator(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_WITH_SEPARATOR)\n }\n visitAlternation(node) {\n this.checkIsTarget(node, PROD_TYPE.ALTERNATION)\n }\n }\n function initializeArrayOfArrays(size) {\n const result = new Array(size)\n for (let i = 0; i < size; i++) {\n result[i] = []\n }\n return result\n }\n /**\n * A sort of hash function between a Path in the grammar and a string.\n * Note that this returns multiple \"hashes\" to support the scenario of token categories.\n * - A single path with categories may match multiple **actual** paths.\n */\n function pathToHashKeys(path) {\n let keys = ['']\n for (let i = 0; i < path.length; i++) {\n const tokType = path[i]\n const longerKeys = []\n for (let j = 0; j < keys.length; j++) {\n const currShorterKey = keys[j]\n longerKeys.push(currShorterKey + '_' + tokType.tokenTypeIdx)\n for (let t = 0; t < tokType.categoryMatches.length; t++) {\n const categoriesKeySuffix = '_' + tokType.categoryMatches[t]\n longerKeys.push(currShorterKey + categoriesKeySuffix)\n }\n }\n keys = longerKeys\n }\n return keys\n }\n /**\n * Imperative style due to being called from a hot spot\n */\n function isUniquePrefixHash(altKnownPathsKeys, searchPathKeys, idx) {\n for (let currAltIdx = 0; currAltIdx < altKnownPathsKeys.length; currAltIdx++) {\n // We only want to test vs the other alternatives\n if (currAltIdx === idx) {\n continue\n }\n const otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx]\n for (let searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) {\n const searchKey = searchPathKeys[searchIdx]\n if (otherAltKnownPathsKeys[searchKey] === true) {\n return false\n }\n }\n }\n // None of the SearchPathKeys were found in any of the other alternatives\n return true\n }\n function lookAheadSequenceFromAlternatives(altsDefs, k) {\n const partialAlts = map(altsDefs, (currAlt) => possiblePathsFrom([currAlt], 1))\n const finalResult = initializeArrayOfArrays(partialAlts.length)\n const altsHashes = map(partialAlts, (currAltPaths) => {\n const dict = {}\n forEach(currAltPaths, (item) => {\n const keys = pathToHashKeys(item.partialPath)\n forEach(keys, (currKey) => {\n dict[currKey] = true\n })\n })\n return dict\n })\n let newData = partialAlts\n // maxLookahead loop\n for (let pathLength = 1; pathLength <= k; pathLength++) {\n const currDataset = newData\n newData = initializeArrayOfArrays(currDataset.length)\n // alternatives loop\n for (let altIdx = 0; altIdx < currDataset.length; altIdx++) {\n const currAltPathsAndSuffixes = currDataset[altIdx]\n // paths in current alternative loop\n for (let currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) {\n const currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath\n const suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef\n const prefixKeys = pathToHashKeys(currPathPrefix)\n const isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx)\n // End of the line for this path.\n if (isUnique || isEmpty(suffixDef) || currPathPrefix.length === k) {\n const currAltResult = finalResult[altIdx]\n // TODO: Can we implement a containsPath using Maps/Dictionaries?\n if (containsPath(currAltResult, currPathPrefix) === false) {\n currAltResult.push(currPathPrefix)\n // Update all new keys for the current path.\n for (let j = 0; j < prefixKeys.length; j++) {\n const currKey = prefixKeys[j]\n altsHashes[altIdx][currKey] = true\n }\n }\n }\n // Expand longer paths\n else {\n const newPartialPathsAndSuffixes = possiblePathsFrom(suffixDef, pathLength + 1, currPathPrefix)\n newData[altIdx] = newData[altIdx].concat(newPartialPathsAndSuffixes)\n // Update keys for new known paths\n forEach(newPartialPathsAndSuffixes, (item) => {\n const prefixKeys = pathToHashKeys(item.partialPath)\n forEach(prefixKeys, (key) => {\n altsHashes[altIdx][key] = true\n })\n })\n }\n }\n }\n }\n return finalResult\n }\n function getLookaheadPathsForOr(occurrence, ruleGrammar, k, orProd) {\n const visitor = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION, orProd)\n ruleGrammar.accept(visitor)\n return lookAheadSequenceFromAlternatives(visitor.result, k)\n }\n function getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k) {\n const insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType)\n ruleGrammar.accept(insideDefVisitor)\n const insideDef = insideDefVisitor.result\n const afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType)\n const afterDef = afterDefWalker.startWalking()\n const insideFlat = new Alternative({ definition: insideDef })\n const afterFlat = new Alternative({ definition: afterDef })\n return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k)\n }\n function containsPath(alternative, searchPath) {\n compareOtherPath: for (let i = 0; i < alternative.length; i++) {\n const otherPath = alternative[i]\n if (otherPath.length !== searchPath.length) {\n continue\n }\n for (let j = 0; j < otherPath.length; j++) {\n const searchTok = searchPath[j]\n const otherTok = otherPath[j]\n const matchingTokens =\n searchTok === otherTok || otherTok.categoryMatchesMap[searchTok.tokenTypeIdx] !== undefined\n if (matchingTokens === false) {\n continue compareOtherPath\n }\n }\n return true\n }\n return false\n }\n function isStrictPrefixOfPath(prefix, other) {\n return (\n prefix.length < other.length &&\n every(prefix, (tokType, idx) => {\n const otherTokType = other[idx]\n return tokType === otherTokType || otherTokType.categoryMatchesMap[tokType.tokenTypeIdx]\n })\n )\n }\n function areTokenCategoriesNotUsed(lookAheadPaths) {\n return every(lookAheadPaths, (singleAltPaths) =>\n every(singleAltPaths, (singlePath) => every(singlePath, (token) => isEmpty(token.categoryMatches))),\n )\n }\n\n function validateLookahead(options) {\n const lookaheadValidationErrorMessages = options.lookaheadStrategy.validate({\n rules: options.rules,\n tokenTypes: options.tokenTypes,\n grammarName: options.grammarName,\n })\n return map(lookaheadValidationErrorMessages, (errorMessage) =>\n Object.assign({ type: ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION }, errorMessage),\n )\n }\n function validateGrammar$1(topLevels, tokenTypes, errMsgProvider, grammarName) {\n const duplicateErrors = flatMap(topLevels, (currTopLevel) =>\n validateDuplicateProductions(currTopLevel, errMsgProvider),\n )\n const termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider)\n const tooManyAltsErrors = flatMap(topLevels, (curRule) => validateTooManyAlts(curRule, errMsgProvider))\n const duplicateRulesError = flatMap(topLevels, (curRule) =>\n validateRuleDoesNotAlreadyExist(curRule, topLevels, grammarName, errMsgProvider),\n )\n return duplicateErrors.concat(termsNamespaceConflictErrors, tooManyAltsErrors, duplicateRulesError)\n }\n function validateDuplicateProductions(topLevelRule, errMsgProvider) {\n const collectorVisitor = new OccurrenceValidationCollector()\n topLevelRule.accept(collectorVisitor)\n const allRuleProductions = collectorVisitor.allProductions\n const productionGroups = groupBy$1(allRuleProductions, identifyProductionForDuplicates)\n const duplicates = pickBy(productionGroups, (currGroup) => {\n return currGroup.length > 1\n })\n const errors = map(values(duplicates), (currDuplicates) => {\n const firstProd = head(currDuplicates)\n const msg = errMsgProvider.buildDuplicateFoundError(topLevelRule, currDuplicates)\n const dslName = getProductionDslName(firstProd)\n const defError = {\n message: msg,\n type: ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,\n ruleName: topLevelRule.name,\n dslName: dslName,\n occurrence: firstProd.idx,\n }\n const param = getExtraProductionArgument(firstProd)\n if (param) {\n defError.parameter = param\n }\n return defError\n })\n return errors\n }\n function identifyProductionForDuplicates(prod) {\n return `${getProductionDslName(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`\n }\n function getExtraProductionArgument(prod) {\n if (prod instanceof Terminal) {\n return prod.terminalType.name\n } else if (prod instanceof NonTerminal) {\n return prod.nonTerminalName\n } else {\n return ''\n }\n }\n class OccurrenceValidationCollector extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.allProductions = []\n }\n visitNonTerminal(subrule) {\n this.allProductions.push(subrule)\n }\n visitOption(option) {\n this.allProductions.push(option)\n }\n visitRepetitionWithSeparator(manySep) {\n this.allProductions.push(manySep)\n }\n visitRepetitionMandatory(atLeastOne) {\n this.allProductions.push(atLeastOne)\n }\n visitRepetitionMandatoryWithSeparator(atLeastOneSep) {\n this.allProductions.push(atLeastOneSep)\n }\n visitRepetition(many) {\n this.allProductions.push(many)\n }\n visitAlternation(or) {\n this.allProductions.push(or)\n }\n visitTerminal(terminal) {\n this.allProductions.push(terminal)\n }\n }\n function validateRuleDoesNotAlreadyExist(rule, allRules, className, errMsgProvider) {\n const errors = []\n const occurrences = reduce(\n allRules,\n (result, curRule) => {\n if (curRule.name === rule.name) {\n return result + 1\n }\n return result\n },\n 0,\n )\n if (occurrences > 1) {\n const errMsg = errMsgProvider.buildDuplicateRuleNameError({\n topLevelRule: rule,\n grammarName: className,\n })\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: rule.name,\n })\n }\n return errors\n }\n // TODO: is there anyway to get only the rule names of rules inherited from the super grammars?\n // This is not part of the IGrammarErrorProvider because the validation cannot be performed on\n // The grammar structure, only at runtime.\n function validateRuleIsOverridden(ruleName, definedRulesNames, className) {\n const errors = []\n let errMsg\n if (!includes(definedRulesNames, ruleName)) {\n errMsg =\n `Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-` +\n `as it is not defined in any of the super grammars `\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,\n ruleName: ruleName,\n })\n }\n return errors\n }\n function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path = []) {\n const errors = []\n const nextNonTerminals = getFirstNoneTerminal(currRule.definition)\n if (isEmpty(nextNonTerminals)) {\n return []\n } else {\n const ruleName = topRule.name\n const foundLeftRecursion = includes(nextNonTerminals, topRule)\n if (foundLeftRecursion) {\n errors.push({\n message: errMsgProvider.buildLeftRecursionError({\n topLevelRule: topRule,\n leftRecursionPath: path,\n }),\n type: ParserDefinitionErrorType.LEFT_RECURSION,\n ruleName: ruleName,\n })\n }\n // we are only looking for cyclic paths leading back to the specific topRule\n // other cyclic paths are ignored, we still need this difference to avoid infinite loops...\n const validNextSteps = difference$1(nextNonTerminals, path.concat([topRule]))\n const errorsFromNextSteps = flatMap(validNextSteps, (currRefRule) => {\n const newPath = clone(path)\n newPath.push(currRefRule)\n return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath)\n })\n return errors.concat(errorsFromNextSteps)\n }\n }\n function getFirstNoneTerminal(definition) {\n let result = []\n if (isEmpty(definition)) {\n return result\n }\n const firstProd = head(definition)\n /* istanbul ignore else */\n if (firstProd instanceof NonTerminal) {\n result.push(firstProd.referencedRule)\n } else if (\n firstProd instanceof Alternative ||\n firstProd instanceof Option ||\n firstProd instanceof RepetitionMandatory ||\n firstProd instanceof RepetitionMandatoryWithSeparator ||\n firstProd instanceof RepetitionWithSeparator ||\n firstProd instanceof Repetition\n ) {\n result = result.concat(getFirstNoneTerminal(firstProd.definition))\n } else if (firstProd instanceof Alternation) {\n // each sub definition in alternation is a FLAT\n result = flatten(map(firstProd.definition, (currSubDef) => getFirstNoneTerminal(currSubDef.definition)))\n } else if (firstProd instanceof Terminal);\n else {\n throw Error('non exhaustive match')\n }\n const isFirstOptional = isOptionalProd(firstProd)\n const hasMore = definition.length > 1\n if (isFirstOptional && hasMore) {\n const rest = drop(definition)\n return result.concat(getFirstNoneTerminal(rest))\n } else {\n return result\n }\n }\n class OrCollector extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.alternations = []\n }\n visitAlternation(node) {\n this.alternations.push(node)\n }\n }\n function validateEmptyOrAlternative(topLevelRule, errMsgProvider) {\n const orCollector = new OrCollector()\n topLevelRule.accept(orCollector)\n const ors = orCollector.alternations\n const errors = flatMap(ors, (currOr) => {\n const exceptLast = dropRight(currOr.definition)\n return flatMap(exceptLast, (currAlternative, currAltIdx) => {\n const possibleFirstInAlt = nextPossibleTokensAfter([currAlternative], [], tokenStructuredMatcher, 1)\n if (isEmpty(possibleFirstInAlt)) {\n return [\n {\n message: errMsgProvider.buildEmptyAlternationError({\n topLevelRule: topLevelRule,\n alternation: currOr,\n emptyChoiceIdx: currAltIdx,\n }),\n type: ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx,\n alternative: currAltIdx + 1,\n },\n ]\n } else {\n return []\n }\n })\n })\n return errors\n }\n function validateAmbiguousAlternationAlternatives(topLevelRule, globalMaxLookahead, errMsgProvider) {\n const orCollector = new OrCollector()\n topLevelRule.accept(orCollector)\n let ors = orCollector.alternations\n // New Handling of ignoring ambiguities\n // - https://github.com/chevrotain/chevrotain/issues/869\n ors = reject(ors, (currOr) => currOr.ignoreAmbiguities === true)\n const errors = flatMap(ors, (currOr) => {\n const currOccurrence = currOr.idx\n const actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead\n const alternatives = getLookaheadPathsForOr(currOccurrence, topLevelRule, actualMaxLookahead, currOr)\n const altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider)\n const altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(\n alternatives,\n currOr,\n topLevelRule,\n errMsgProvider,\n )\n return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors)\n })\n return errors\n }\n class RepetitionCollector extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.allProductions = []\n }\n visitRepetitionWithSeparator(manySep) {\n this.allProductions.push(manySep)\n }\n visitRepetitionMandatory(atLeastOne) {\n this.allProductions.push(atLeastOne)\n }\n visitRepetitionMandatoryWithSeparator(atLeastOneSep) {\n this.allProductions.push(atLeastOneSep)\n }\n visitRepetition(many) {\n this.allProductions.push(many)\n }\n }\n function validateTooManyAlts(topLevelRule, errMsgProvider) {\n const orCollector = new OrCollector()\n topLevelRule.accept(orCollector)\n const ors = orCollector.alternations\n const errors = flatMap(ors, (currOr) => {\n if (currOr.definition.length > 255) {\n return [\n {\n message: errMsgProvider.buildTooManyAlternativesError({\n topLevelRule: topLevelRule,\n alternation: currOr,\n }),\n type: ParserDefinitionErrorType.TOO_MANY_ALTS,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx,\n },\n ]\n } else {\n return []\n }\n })\n return errors\n }\n function validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead, errMsgProvider) {\n const errors = []\n forEach(topLevelRules, (currTopRule) => {\n const collectorVisitor = new RepetitionCollector()\n currTopRule.accept(collectorVisitor)\n const allRuleProductions = collectorVisitor.allProductions\n forEach(allRuleProductions, (currProd) => {\n const prodType = getProdType(currProd)\n const actualMaxLookahead = currProd.maxLookahead || maxLookahead\n const currOccurrence = currProd.idx\n const paths = getLookaheadPathsForOptionalProd(currOccurrence, currTopRule, prodType, actualMaxLookahead)\n const pathsInsideProduction = paths[0]\n if (isEmpty(flatten(pathsInsideProduction))) {\n const errMsg = errMsgProvider.buildEmptyRepetitionError({\n topLevelRule: currTopRule,\n repetition: currProd,\n })\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,\n ruleName: currTopRule.name,\n })\n }\n })\n })\n return errors\n }\n function checkAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {\n const foundAmbiguousPaths = []\n const identicalAmbiguities = reduce(\n alternatives,\n (result, currAlt, currAltIdx) => {\n // ignore (skip) ambiguities with this alternative\n if (alternation.definition[currAltIdx].ignoreAmbiguities === true) {\n return result\n }\n forEach(currAlt, (currPath) => {\n const altsCurrPathAppearsIn = [currAltIdx]\n forEach(alternatives, (currOtherAlt, currOtherAltIdx) => {\n if (\n currAltIdx !== currOtherAltIdx &&\n containsPath(currOtherAlt, currPath) &&\n // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[currOtherAltIdx].ignoreAmbiguities !== true\n ) {\n altsCurrPathAppearsIn.push(currOtherAltIdx)\n }\n })\n if (altsCurrPathAppearsIn.length > 1 && !containsPath(foundAmbiguousPaths, currPath)) {\n foundAmbiguousPaths.push(currPath)\n result.push({\n alts: altsCurrPathAppearsIn,\n path: currPath,\n })\n }\n })\n return result\n },\n [],\n )\n const currErrors = map(identicalAmbiguities, (currAmbDescriptor) => {\n const ambgIndices = map(currAmbDescriptor.alts, (currAltIdx) => currAltIdx + 1)\n const currMessage = errMsgProvider.buildAlternationAmbiguityError({\n topLevelRule: rule,\n alternation: alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbDescriptor.path,\n })\n return {\n message: currMessage,\n type: ParserDefinitionErrorType.AMBIGUOUS_ALTS,\n ruleName: rule.name,\n occurrence: alternation.idx,\n alternatives: currAmbDescriptor.alts,\n }\n })\n return currErrors\n }\n function checkPrefixAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {\n // flatten\n const pathsAndIndices = reduce(\n alternatives,\n (result, currAlt, idx) => {\n const currPathsAndIdx = map(currAlt, (currPath) => {\n return { idx: idx, path: currPath }\n })\n return result.concat(currPathsAndIdx)\n },\n [],\n )\n const errors = compact(\n flatMap(pathsAndIndices, (currPathAndIdx) => {\n const alternativeGast = alternation.definition[currPathAndIdx.idx]\n // ignore (skip) ambiguities with this alternative\n if (alternativeGast.ignoreAmbiguities === true) {\n return []\n }\n const targetIdx = currPathAndIdx.idx\n const targetPath = currPathAndIdx.path\n const prefixAmbiguitiesPathsAndIndices = filter(pathsAndIndices, (searchPathAndIdx) => {\n // prefix ambiguity can only be created from lower idx (higher priority) path\n return (\n // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[searchPathAndIdx.idx].ignoreAmbiguities !== true &&\n searchPathAndIdx.idx < targetIdx &&\n // checking for strict prefix because identical lookaheads\n // will be be detected using a different validation.\n isStrictPrefixOfPath(searchPathAndIdx.path, targetPath)\n )\n })\n const currPathPrefixErrors = map(prefixAmbiguitiesPathsAndIndices, (currAmbPathAndIdx) => {\n const ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1]\n const occurrence = alternation.idx === 0 ? '' : alternation.idx\n const message = errMsgProvider.buildAlternationPrefixAmbiguityError({\n topLevelRule: rule,\n alternation: alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbPathAndIdx.path,\n })\n return {\n message: message,\n type: ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,\n ruleName: rule.name,\n occurrence: occurrence,\n alternatives: ambgIndices,\n }\n })\n return currPathPrefixErrors\n }),\n )\n return errors\n }\n function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider) {\n const errors = []\n const tokenNames = map(tokenTypes, (currToken) => currToken.name)\n forEach(topLevels, (currRule) => {\n const currRuleName = currRule.name\n if (includes(tokenNames, currRuleName)) {\n const errMsg = errMsgProvider.buildNamespaceConflictError(currRule)\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,\n ruleName: currRuleName,\n })\n }\n })\n return errors\n }\n\n function resolveGrammar(options) {\n const actualOptions = defaults$1(options, {\n errMsgProvider: defaultGrammarResolverErrorProvider,\n })\n const topRulesTable = {}\n forEach(options.rules, (rule) => {\n topRulesTable[rule.name] = rule\n })\n return resolveGrammar$1(topRulesTable, actualOptions.errMsgProvider)\n }\n function validateGrammar(options) {\n options = defaults$1(options, {\n errMsgProvider: defaultGrammarValidatorErrorProvider,\n })\n return validateGrammar$1(options.rules, options.tokenTypes, options.errMsgProvider, options.grammarName)\n }\n\n const MISMATCHED_TOKEN_EXCEPTION = 'MismatchedTokenException'\n const NO_VIABLE_ALT_EXCEPTION = 'NoViableAltException'\n const EARLY_EXIT_EXCEPTION = 'EarlyExitException'\n const NOT_ALL_INPUT_PARSED_EXCEPTION = 'NotAllInputParsedException'\n const RECOGNITION_EXCEPTION_NAMES = [\n MISMATCHED_TOKEN_EXCEPTION,\n NO_VIABLE_ALT_EXCEPTION,\n EARLY_EXIT_EXCEPTION,\n NOT_ALL_INPUT_PARSED_EXCEPTION,\n ]\n Object.freeze(RECOGNITION_EXCEPTION_NAMES)\n // hacks to bypass no support for custom Errors in javascript/typescript\n function isRecognitionException(error) {\n // can't do instanceof on hacked custom js exceptions\n return includes(RECOGNITION_EXCEPTION_NAMES, error.name)\n }\n class RecognitionException extends Error {\n constructor(message, token) {\n super(message)\n this.token = token\n this.resyncedTokens = []\n // fix prototype chain when typescript target is ES5\n Object.setPrototypeOf(this, new.target.prototype)\n /* istanbul ignore next - V8 workaround to remove constructor from stacktrace when typescript target is ES5 */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor)\n }\n }\n }\n class MismatchedTokenException extends RecognitionException {\n constructor(message, token, previousToken) {\n super(message, token)\n this.previousToken = previousToken\n this.name = MISMATCHED_TOKEN_EXCEPTION\n }\n }\n class NoViableAltException extends RecognitionException {\n constructor(message, token, previousToken) {\n super(message, token)\n this.previousToken = previousToken\n this.name = NO_VIABLE_ALT_EXCEPTION\n }\n }\n class NotAllInputParsedException extends RecognitionException {\n constructor(message, token) {\n super(message, token)\n this.name = NOT_ALL_INPUT_PARSED_EXCEPTION\n }\n }\n class EarlyExitException extends RecognitionException {\n constructor(message, token, previousToken) {\n super(message, token)\n this.previousToken = previousToken\n this.name = EARLY_EXIT_EXCEPTION\n }\n }\n\n const EOF_FOLLOW_KEY = {}\n const IN_RULE_RECOVERY_EXCEPTION = 'InRuleRecoveryException'\n class InRuleRecoveryException extends Error {\n constructor(message) {\n super(message)\n this.name = IN_RULE_RECOVERY_EXCEPTION\n }\n }\n /**\n * This trait is responsible for the error recovery and fault tolerant logic\n */\n class Recoverable {\n initRecoverable(config) {\n this.firstAfterRepMap = {}\n this.resyncFollows = {}\n this.recoveryEnabled = has(config, 'recoveryEnabled')\n ? config.recoveryEnabled // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.recoveryEnabled\n // performance optimization, NOOP will be inlined which\n // effectively means that this optional feature does not exist\n // when not used.\n if (this.recoveryEnabled) {\n this.attemptInRepetitionRecovery = attemptInRepetitionRecovery\n }\n }\n getTokenToInsert(tokType) {\n const tokToInsert = createTokenInstance(tokType, '', NaN, NaN, NaN, NaN, NaN, NaN)\n tokToInsert.isInsertedInRecovery = true\n return tokToInsert\n }\n canTokenTypeBeInsertedInRecovery(tokType) {\n return true\n }\n canTokenTypeBeDeletedInRecovery(tokType) {\n return true\n }\n tryInRepetitionRecovery(grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) {\n // TODO: can the resyncTokenType be cached?\n const reSyncTokType = this.findReSyncTokenType()\n const savedLexerState = this.exportLexerState()\n const resyncedTokens = []\n let passedResyncPoint = false\n const nextTokenWithoutResync = this.LA(1)\n let currToken = this.LA(1)\n const generateErrorMessage = () => {\n const previousToken = this.LA(0)\n // we are preemptively re-syncing before an error has been detected, therefor we must reproduce\n // the error that would have been thrown\n const msg = this.errorMessageProvider.buildMismatchTokenMessage({\n expected: expectedTokType,\n actual: nextTokenWithoutResync,\n previous: previousToken,\n ruleName: this.getCurrRuleFullName(),\n })\n const error = new MismatchedTokenException(msg, nextTokenWithoutResync, this.LA(0))\n // the first token here will be the original cause of the error, this is not part of the resyncedTokens property.\n error.resyncedTokens = dropRight(resyncedTokens)\n this.SAVE_ERROR(error)\n }\n while (!passedResyncPoint) {\n // re-synced to a point where we can safely exit the repetition/\n if (this.tokenMatcher(currToken, expectedTokType)) {\n generateErrorMessage()\n return // must return here to avoid reverting the inputIdx\n } else if (lookAheadFunc.call(this)) {\n // we skipped enough tokens so we can resync right back into another iteration of the repetition grammar rule\n generateErrorMessage()\n // recursive invocation in other to support multiple re-syncs in the same top level repetition grammar rule\n grammarRule.apply(this, grammarRuleArgs)\n return // must return here to avoid reverting the inputIdx\n } else if (this.tokenMatcher(currToken, reSyncTokType)) {\n passedResyncPoint = true\n } else {\n currToken = this.SKIP_TOKEN()\n this.addToResyncTokens(currToken, resyncedTokens)\n }\n }\n // we were unable to find a CLOSER point to resync inside the Repetition, reset the state.\n // The parsing exception we were trying to prevent will happen in the NEXT parsing step. it may be handled by\n // \"between rules\" resync recovery later in the flow.\n this.importLexerState(savedLexerState)\n }\n shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck) {\n // Edge case of arriving from a MANY repetition which is stuck\n // Attempting recovery in this case could cause an infinite loop\n if (notStuck === false) {\n return false\n }\n // no need to recover, next token is what we expect...\n if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) {\n return false\n }\n // error recovery is disabled during backtracking as it can make the parser ignore a valid grammar path\n // and prefer some backtracking path that includes recovered errors.\n if (this.isBackTracking()) {\n return false\n }\n // if we can perform inRule recovery (single token insertion or deletion) we always prefer that recovery algorithm\n // because if it works, it makes the least amount of changes to the input stream (greedy algorithm)\n //noinspection RedundantIfStatementJS\n if (\n this.canPerformInRuleRecovery(\n expectTokAfterLastMatch,\n this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx),\n )\n ) {\n return false\n }\n return true\n }\n // Error Recovery functionality\n getFollowsForInRuleRecovery(tokType, tokIdxInRule) {\n const grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule)\n const follows = this.getNextPossibleTokenTypes(grammarPath)\n return follows\n }\n tryInRuleRecovery(expectedTokType, follows) {\n if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) {\n const tokToInsert = this.getTokenToInsert(expectedTokType)\n return tokToInsert\n }\n if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) {\n const nextTok = this.SKIP_TOKEN()\n this.consumeToken()\n return nextTok\n }\n throw new InRuleRecoveryException('sad sad panda')\n }\n canPerformInRuleRecovery(expectedToken, follows) {\n return (\n this.canRecoverWithSingleTokenInsertion(expectedToken, follows) ||\n this.canRecoverWithSingleTokenDeletion(expectedToken)\n )\n }\n canRecoverWithSingleTokenInsertion(expectedTokType, follows) {\n if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) {\n return false\n }\n // must know the possible following tokens to perform single token insertion\n if (isEmpty(follows)) {\n return false\n }\n const mismatchedTok = this.LA(1)\n const isMisMatchedTokInFollows =\n find$1(follows, (possibleFollowsTokType) => {\n return this.tokenMatcher(mismatchedTok, possibleFollowsTokType)\n }) !== undefined\n return isMisMatchedTokInFollows\n }\n canRecoverWithSingleTokenDeletion(expectedTokType) {\n if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) {\n return false\n }\n const isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType)\n return isNextTokenWhatIsExpected\n }\n isInCurrentRuleReSyncSet(tokenTypeIdx) {\n const followKey = this.getCurrFollowKey()\n const currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey)\n return includes(currentRuleReSyncSet, tokenTypeIdx)\n }\n findReSyncTokenType() {\n const allPossibleReSyncTokTypes = this.flattenFollowSet()\n // this loop will always terminate as EOF is always in the follow stack and also always (virtually) in the input\n let nextToken = this.LA(1)\n let k = 2\n while (true) {\n const foundMatch = find$1(allPossibleReSyncTokTypes, (resyncTokType) => {\n const canMatch = tokenMatcher(nextToken, resyncTokType)\n return canMatch\n })\n if (foundMatch !== undefined) {\n return foundMatch\n }\n nextToken = this.LA(k)\n k++\n }\n }\n getCurrFollowKey() {\n // the length is at least one as we always add the ruleName to the stack before invoking the rule.\n if (this.RULE_STACK.length === 1) {\n return EOF_FOLLOW_KEY\n }\n const currRuleShortName = this.getLastExplicitRuleShortName()\n const currRuleIdx = this.getLastExplicitRuleOccurrenceIndex()\n const prevRuleShortName = this.getPreviousExplicitRuleShortName()\n return {\n ruleName: this.shortRuleNameToFullName(currRuleShortName),\n idxInCallingRule: currRuleIdx,\n inRule: this.shortRuleNameToFullName(prevRuleShortName),\n }\n }\n buildFullFollowKeyStack() {\n const explicitRuleStack = this.RULE_STACK\n const explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK\n return map(explicitRuleStack, (ruleName, idx) => {\n if (idx === 0) {\n return EOF_FOLLOW_KEY\n }\n return {\n ruleName: this.shortRuleNameToFullName(ruleName),\n idxInCallingRule: explicitOccurrenceStack[idx],\n inRule: this.shortRuleNameToFullName(explicitRuleStack[idx - 1]),\n }\n })\n }\n flattenFollowSet() {\n const followStack = map(this.buildFullFollowKeyStack(), (currKey) => {\n return this.getFollowSetFromFollowKey(currKey)\n })\n return flatten(followStack)\n }\n getFollowSetFromFollowKey(followKey) {\n if (followKey === EOF_FOLLOW_KEY) {\n return [EOF]\n }\n const followName = followKey.ruleName + followKey.idxInCallingRule + IN + followKey.inRule\n return this.resyncFollows[followName]\n }\n // It does not make any sense to include a virtual EOF token in the list of resynced tokens\n // as EOF does not really exist and thus does not contain any useful information (line/column numbers)\n addToResyncTokens(token, resyncTokens) {\n if (!this.tokenMatcher(token, EOF)) {\n resyncTokens.push(token)\n }\n return resyncTokens\n }\n reSyncTo(tokType) {\n const resyncedTokens = []\n let nextTok = this.LA(1)\n while (this.tokenMatcher(nextTok, tokType) === false) {\n nextTok = this.SKIP_TOKEN()\n this.addToResyncTokens(nextTok, resyncedTokens)\n }\n // the last token is not part of the error.\n return dropRight(resyncedTokens)\n }\n attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {\n // by default this is a NO-OP\n // The actual implementation is with the function(not method) below\n }\n getCurrentGrammarPath(tokType, tokIdxInRule) {\n const pathRuleStack = this.getHumanReadableRuleStack()\n const pathOccurrenceStack = clone(this.RULE_OCCURRENCE_STACK)\n const grammarPath = {\n ruleStack: pathRuleStack,\n occurrenceStack: pathOccurrenceStack,\n lastTok: tokType,\n lastTokOccurrence: tokIdxInRule,\n }\n return grammarPath\n }\n getHumanReadableRuleStack() {\n return map(this.RULE_STACK, (currShortName) => this.shortRuleNameToFullName(currShortName))\n }\n }\n function attemptInRepetitionRecovery(\n prodFunc,\n args,\n lookaheadFunc,\n dslMethodIdx,\n prodOccurrence,\n nextToksWalker,\n notStuck,\n ) {\n const key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence)\n let firstAfterRepInfo = this.firstAfterRepMap[key]\n if (firstAfterRepInfo === undefined) {\n const currRuleName = this.getCurrRuleFullName()\n const ruleGrammar = this.getGAstProductions()[currRuleName]\n const walker = new nextToksWalker(ruleGrammar, prodOccurrence)\n firstAfterRepInfo = walker.startWalking()\n this.firstAfterRepMap[key] = firstAfterRepInfo\n }\n let expectTokAfterLastMatch = firstAfterRepInfo.token\n let nextTokIdx = firstAfterRepInfo.occurrence\n const isEndOfRule = firstAfterRepInfo.isEndOfRule\n // special edge case of a TOP most repetition after which the input should END.\n // this will force an attempt for inRule recovery in that scenario.\n if (this.RULE_STACK.length === 1 && isEndOfRule && expectTokAfterLastMatch === undefined) {\n expectTokAfterLastMatch = EOF\n nextTokIdx = 1\n }\n // We don't have anything to re-sync to...\n // this condition was extracted from `shouldInRepetitionRecoveryBeTried` to act as a type-guard\n if (expectTokAfterLastMatch === undefined || nextTokIdx === undefined) {\n return\n }\n if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck)) {\n // TODO: performance optimization: instead of passing the original args here, we modify\n // the args param (or create a new one) and make sure the lookahead func is explicitly provided\n // to avoid searching the cache for it once more.\n this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch)\n }\n }\n\n // Lookahead keys are 32Bit integers in the form\n // TTTTTTTT-ZZZZZZZZZZZZ-YYYY-XXXXXXXX\n // XXXX -> Occurrence Index bitmap.\n // YYYY -> DSL Method Type bitmap.\n // ZZZZZZZZZZZZZZZ -> Rule short Index bitmap.\n // TTTTTTTTT -> alternation alternative index bitmap\n const BITS_FOR_METHOD_TYPE = 4\n const BITS_FOR_OCCURRENCE_IDX = 8\n // short string used as part of mapping keys.\n // being short improves the performance when composing KEYS for maps out of these\n // The 5 - 8 bits (16 possible values, are reserved for the DSL method indices)\n const OR_IDX = 1 << BITS_FOR_OCCURRENCE_IDX\n const OPTION_IDX = 2 << BITS_FOR_OCCURRENCE_IDX\n const MANY_IDX = 3 << BITS_FOR_OCCURRENCE_IDX\n const AT_LEAST_ONE_IDX = 4 << BITS_FOR_OCCURRENCE_IDX\n const MANY_SEP_IDX = 5 << BITS_FOR_OCCURRENCE_IDX\n const AT_LEAST_ONE_SEP_IDX = 6 << BITS_FOR_OCCURRENCE_IDX\n // this actually returns a number, but it is always used as a string (object prop key)\n function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) {\n return occurrence | dslMethodIdx | ruleIdx\n }\n\n class LLkLookaheadStrategy {\n constructor(options) {\n var _a\n this.maxLookahead =\n (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0\n ? _a\n : DEFAULT_PARSER_CONFIG.maxLookahead\n }\n validate(options) {\n const leftRecursionErrors = this.validateNoLeftRecursion(options.rules)\n if (isEmpty(leftRecursionErrors)) {\n const emptyAltErrors = this.validateEmptyOrAlternatives(options.rules)\n const ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(options.rules, this.maxLookahead)\n const emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(options.rules, this.maxLookahead)\n const allErrors = [...leftRecursionErrors, ...emptyAltErrors, ...ambiguousAltsErrors, ...emptyRepetitionErrors]\n return allErrors\n }\n return leftRecursionErrors\n }\n validateNoLeftRecursion(rules) {\n return flatMap(rules, (currTopRule) =>\n validateNoLeftRecursion(currTopRule, currTopRule, defaultGrammarValidatorErrorProvider),\n )\n }\n validateEmptyOrAlternatives(rules) {\n return flatMap(rules, (currTopRule) =>\n validateEmptyOrAlternative(currTopRule, defaultGrammarValidatorErrorProvider),\n )\n }\n validateAmbiguousAlternationAlternatives(rules, maxLookahead) {\n return flatMap(rules, (currTopRule) =>\n validateAmbiguousAlternationAlternatives(currTopRule, maxLookahead, defaultGrammarValidatorErrorProvider),\n )\n }\n validateSomeNonEmptyLookaheadPath(rules, maxLookahead) {\n return validateSomeNonEmptyLookaheadPath(rules, maxLookahead, defaultGrammarValidatorErrorProvider)\n }\n buildLookaheadForAlternation(options) {\n return buildLookaheadFuncForOr(\n options.prodOccurrence,\n options.rule,\n options.maxLookahead,\n options.hasPredicates,\n options.dynamicTokensEnabled,\n buildAlternativesLookAheadFunc,\n )\n }\n buildLookaheadForOptional(options) {\n return buildLookaheadFuncForOptionalProd(\n options.prodOccurrence,\n options.rule,\n options.maxLookahead,\n options.dynamicTokensEnabled,\n getProdType(options.prodType),\n buildSingleAlternativeLookaheadFunction,\n )\n }\n }\n\n /**\n * Trait responsible for the lookahead related utilities and optimizations.\n */\n class LooksAhead {\n initLooksAhead(config) {\n this.dynamicTokensEnabled = has(config, 'dynamicTokensEnabled')\n ? config.dynamicTokensEnabled // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled\n this.maxLookahead = has(config, 'maxLookahead')\n ? config.maxLookahead // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.maxLookahead\n this.lookaheadStrategy = has(config, 'lookaheadStrategy')\n ? config.lookaheadStrategy // assumes end user provides the correct config value/type\n : new LLkLookaheadStrategy({ maxLookahead: this.maxLookahead })\n this.lookAheadFuncsCache = new Map()\n }\n preComputeLookaheadFunctions(rules) {\n forEach(rules, (currRule) => {\n this.TRACE_INIT(`${currRule.name} Rule Lookahead`, () => {\n const {\n alternation,\n repetition,\n option,\n repetitionMandatory,\n repetitionMandatoryWithSeparator,\n repetitionWithSeparator,\n } = collectMethods(currRule)\n forEach(alternation, (currProd) => {\n const prodIdx = currProd.idx === 0 ? '' : currProd.idx\n this.TRACE_INIT(`${getProductionDslName(currProd)}${prodIdx}`, () => {\n const laFunc = this.lookaheadStrategy.buildLookaheadForAlternation({\n prodOccurrence: currProd.idx,\n rule: currRule,\n maxLookahead: currProd.maxLookahead || this.maxLookahead,\n hasPredicates: currProd.hasPredicates,\n dynamicTokensEnabled: this.dynamicTokensEnabled,\n })\n const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name], OR_IDX, currProd.idx)\n this.setLaFuncCache(key, laFunc)\n })\n })\n forEach(repetition, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n MANY_IDX,\n 'Repetition',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(option, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n OPTION_IDX,\n 'Option',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(repetitionMandatory, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n AT_LEAST_ONE_IDX,\n 'RepetitionMandatory',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(repetitionMandatoryWithSeparator, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n AT_LEAST_ONE_SEP_IDX,\n 'RepetitionMandatoryWithSeparator',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(repetitionWithSeparator, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n MANY_SEP_IDX,\n 'RepetitionWithSeparator',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n })\n })\n }\n computeLookaheadFunc(rule, prodOccurrence, prodKey, prodType, prodMaxLookahead, dslMethodName) {\n this.TRACE_INIT(`${dslMethodName}${prodOccurrence === 0 ? '' : prodOccurrence}`, () => {\n const laFunc = this.lookaheadStrategy.buildLookaheadForOptional({\n prodOccurrence,\n rule,\n maxLookahead: prodMaxLookahead || this.maxLookahead,\n dynamicTokensEnabled: this.dynamicTokensEnabled,\n prodType,\n })\n const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name], prodKey, prodOccurrence)\n this.setLaFuncCache(key, laFunc)\n })\n }\n // this actually returns a number, but it is always used as a string (object prop key)\n getKeyForAutomaticLookahead(dslMethodIdx, occurrence) {\n const currRuleShortName = this.getLastExplicitRuleShortName()\n return getKeyForAutomaticLookahead(currRuleShortName, dslMethodIdx, occurrence)\n }\n getLaFuncFromCache(key) {\n return this.lookAheadFuncsCache.get(key)\n }\n /* istanbul ignore next */\n setLaFuncCache(key, value) {\n this.lookAheadFuncsCache.set(key, value)\n }\n }\n class DslMethodsCollectorVisitor extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.dslMethods = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: [],\n }\n }\n reset() {\n this.dslMethods = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: [],\n }\n }\n visitOption(option) {\n this.dslMethods.option.push(option)\n }\n visitRepetitionWithSeparator(manySep) {\n this.dslMethods.repetitionWithSeparator.push(manySep)\n }\n visitRepetitionMandatory(atLeastOne) {\n this.dslMethods.repetitionMandatory.push(atLeastOne)\n }\n visitRepetitionMandatoryWithSeparator(atLeastOneSep) {\n this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep)\n }\n visitRepetition(many) {\n this.dslMethods.repetition.push(many)\n }\n visitAlternation(or) {\n this.dslMethods.alternation.push(or)\n }\n }\n const collectorVisitor = new DslMethodsCollectorVisitor()\n function collectMethods(rule) {\n collectorVisitor.reset()\n rule.accept(collectorVisitor)\n const dslMethods = collectorVisitor.dslMethods\n // avoid uncleaned references\n collectorVisitor.reset()\n return dslMethods\n }\n\n /**\n * This nodeLocation tracking is not efficient and should only be used\n * when error recovery is enabled or the Token Vector contains virtual Tokens\n * (e.g, Python Indent/Outdent)\n * As it executes the calculation for every single terminal/nonTerminal\n * and does not rely on the fact the token vector is **sorted**\n */\n function setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) {\n // First (valid) update for this cst node\n if (isNaN(currNodeLocation.startOffset) === true) {\n // assumption1: Token location information is either NaN or a valid number\n // assumption2: Token location information is fully valid if it exist\n // (both start/end offsets exist and are numbers).\n currNodeLocation.startOffset = newLocationInfo.startOffset\n currNodeLocation.endOffset = newLocationInfo.endOffset\n }\n // Once the startOffset has been updated with a valid number it should never receive\n // any farther updates as the Token vector is sorted.\n // We still have to check this this condition for every new possible location info\n // because with error recovery enabled we may encounter invalid tokens (NaN location props)\n else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset\n }\n }\n /**\n * This nodeLocation tracking is not efficient and should only be used\n * when error recovery is enabled or the Token Vector contains virtual Tokens\n * (e.g, Python Indent/Outdent)\n * As it executes the calculation for every single terminal/nonTerminal\n * and does not rely on the fact the token vector is **sorted**\n */\n function setNodeLocationFull(currNodeLocation, newLocationInfo) {\n // First (valid) update for this cst node\n if (isNaN(currNodeLocation.startOffset) === true) {\n // assumption1: Token location information is either NaN or a valid number\n // assumption2: Token location information is fully valid if it exist\n // (all start/end props exist and are numbers).\n currNodeLocation.startOffset = newLocationInfo.startOffset\n currNodeLocation.startColumn = newLocationInfo.startColumn\n currNodeLocation.startLine = newLocationInfo.startLine\n currNodeLocation.endOffset = newLocationInfo.endOffset\n currNodeLocation.endColumn = newLocationInfo.endColumn\n currNodeLocation.endLine = newLocationInfo.endLine\n }\n // Once the start props has been updated with a valid number it should never receive\n // any farther updates as the Token vector is sorted.\n // We still have to check this this condition for every new possible location info\n // because with error recovery enabled we may encounter invalid tokens (NaN location props)\n else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset\n currNodeLocation.endColumn = newLocationInfo.endColumn\n currNodeLocation.endLine = newLocationInfo.endLine\n }\n }\n function addTerminalToCst(node, token, tokenTypeName) {\n if (node.children[tokenTypeName] === undefined) {\n node.children[tokenTypeName] = [token]\n } else {\n node.children[tokenTypeName].push(token)\n }\n }\n function addNoneTerminalToCst(node, ruleName, ruleResult) {\n if (node.children[ruleName] === undefined) {\n node.children[ruleName] = [ruleResult]\n } else {\n node.children[ruleName].push(ruleResult)\n }\n }\n\n const NAME = 'name'\n function defineNameProp(obj, nameValue) {\n Object.defineProperty(obj, NAME, {\n enumerable: false,\n configurable: true,\n writable: false,\n value: nameValue,\n })\n }\n\n function defaultVisit(ctx, param) {\n const childrenNames = keys(ctx)\n const childrenNamesLength = childrenNames.length\n for (let i = 0; i < childrenNamesLength; i++) {\n const currChildName = childrenNames[i]\n const currChildArray = ctx[currChildName]\n const currChildArrayLength = currChildArray.length\n for (let j = 0; j < currChildArrayLength; j++) {\n const currChild = currChildArray[j]\n // distinction between Tokens Children and CstNode children\n if (currChild.tokenTypeIdx === undefined) {\n this[currChild.name](currChild.children, param)\n }\n }\n }\n // defaultVisit does not support generic out param\n }\n function createBaseSemanticVisitorConstructor(grammarName, ruleNames) {\n const derivedConstructor = function () {}\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n defineNameProp(derivedConstructor, grammarName + 'BaseSemantics')\n const semanticProto = {\n visit: function (cstNode, param) {\n // enables writing more concise visitor methods when CstNode has only a single child\n if (isArray$1(cstNode)) {\n // A CST Node's children dictionary can never have empty arrays as values\n // If a key is defined there will be at least one element in the corresponding value array.\n cstNode = cstNode[0]\n }\n // enables passing optional CstNodes concisely.\n if (isUndefined(cstNode)) {\n return undefined\n }\n return this[cstNode.name](cstNode.children, param)\n },\n validateVisitor: function () {\n const semanticDefinitionErrors = validateVisitor(this, ruleNames)\n if (!isEmpty(semanticDefinitionErrors)) {\n const errorMessages = map(semanticDefinitionErrors, (currDefError) => currDefError.msg)\n throw Error(\n `Errors Detected in CST Visitor <${this.constructor.name}>:\\n\\t` +\n `${errorMessages.join('\\n\\n').replace(/\\n/g, '\\n\\t')}`,\n )\n }\n },\n }\n derivedConstructor.prototype = semanticProto\n derivedConstructor.prototype.constructor = derivedConstructor\n derivedConstructor._RULE_NAMES = ruleNames\n return derivedConstructor\n }\n function createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) {\n const derivedConstructor = function () {}\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n defineNameProp(derivedConstructor, grammarName + 'BaseSemanticsWithDefaults')\n const withDefaultsProto = Object.create(baseConstructor.prototype)\n forEach(ruleNames, (ruleName) => {\n withDefaultsProto[ruleName] = defaultVisit\n })\n derivedConstructor.prototype = withDefaultsProto\n derivedConstructor.prototype.constructor = derivedConstructor\n return derivedConstructor\n }\n var CstVisitorDefinitionError\n ;(function (CstVisitorDefinitionError) {\n CstVisitorDefinitionError[(CstVisitorDefinitionError['REDUNDANT_METHOD'] = 0)] = 'REDUNDANT_METHOD'\n CstVisitorDefinitionError[(CstVisitorDefinitionError['MISSING_METHOD'] = 1)] = 'MISSING_METHOD'\n })(CstVisitorDefinitionError || (CstVisitorDefinitionError = {}))\n function validateVisitor(visitorInstance, ruleNames) {\n const missingErrors = validateMissingCstMethods(visitorInstance, ruleNames)\n return missingErrors\n }\n function validateMissingCstMethods(visitorInstance, ruleNames) {\n const missingRuleNames = filter(ruleNames, (currRuleName) => {\n return isFunction(visitorInstance[currRuleName]) === false\n })\n const errors = map(missingRuleNames, (currRuleName) => {\n return {\n msg: `Missing visitor method: <${currRuleName}> on ${visitorInstance.constructor.name} CST Visitor.`,\n type: CstVisitorDefinitionError.MISSING_METHOD,\n methodName: currRuleName,\n }\n })\n return compact(errors)\n }\n\n /**\n * This trait is responsible for the CST building logic.\n */\n class TreeBuilder {\n initTreeBuilder(config) {\n this.CST_STACK = []\n // outputCst is no longer exposed/defined in the pubic API\n this.outputCst = config.outputCst\n this.nodeLocationTracking = has(config, 'nodeLocationTracking')\n ? config.nodeLocationTracking // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.nodeLocationTracking\n if (!this.outputCst) {\n this.cstInvocationStateUpdate = noop\n this.cstFinallyStateUpdate = noop\n this.cstPostTerminal = noop\n this.cstPostNonTerminal = noop\n this.cstPostRule = noop\n } else {\n if (/full/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = setNodeLocationFull\n this.setNodeLocationFromNode = setNodeLocationFull\n this.cstPostRule = noop\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery\n } else {\n this.setNodeLocationFromToken = noop\n this.setNodeLocationFromNode = noop\n this.cstPostRule = this.cstPostRuleFull\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular\n }\n } else if (/onlyOffset/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = setNodeLocationOnlyOffset\n this.setNodeLocationFromNode = setNodeLocationOnlyOffset\n this.cstPostRule = noop\n this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery\n } else {\n this.setNodeLocationFromToken = noop\n this.setNodeLocationFromNode = noop\n this.cstPostRule = this.cstPostRuleOnlyOffset\n this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular\n }\n } else if (/none/i.test(this.nodeLocationTracking)) {\n this.setNodeLocationFromToken = noop\n this.setNodeLocationFromNode = noop\n this.cstPostRule = noop\n this.setInitialNodeLocation = noop\n } else {\n throw Error(`Invalid config option: \"${config.nodeLocationTracking}\"`)\n }\n }\n }\n setInitialNodeLocationOnlyOffsetRecovery(cstNode) {\n cstNode.location = {\n startOffset: NaN,\n endOffset: NaN,\n }\n }\n setInitialNodeLocationOnlyOffsetRegular(cstNode) {\n cstNode.location = {\n // without error recovery the starting Location of a new CstNode is guaranteed\n // To be the next Token's startOffset (for valid inputs).\n // For invalid inputs there won't be any CSTOutput so this potential\n // inaccuracy does not matter\n startOffset: this.LA(1).startOffset,\n endOffset: NaN,\n }\n }\n setInitialNodeLocationFullRecovery(cstNode) {\n cstNode.location = {\n startOffset: NaN,\n startLine: NaN,\n startColumn: NaN,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN,\n }\n }\n /**\n * @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work\n \n * @param cstNode\n */\n setInitialNodeLocationFullRegular(cstNode) {\n const nextToken = this.LA(1)\n cstNode.location = {\n startOffset: nextToken.startOffset,\n startLine: nextToken.startLine,\n startColumn: nextToken.startColumn,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN,\n }\n }\n cstInvocationStateUpdate(fullRuleName) {\n const cstNode = {\n name: fullRuleName,\n children: Object.create(null),\n }\n this.setInitialNodeLocation(cstNode)\n this.CST_STACK.push(cstNode)\n }\n cstFinallyStateUpdate() {\n this.CST_STACK.pop()\n }\n cstPostRuleFull(ruleCstNode) {\n // casts to `required` are safe because `cstPostRuleFull` should only be invoked when full location is enabled\n const prevToken = this.LA(0)\n const loc = ruleCstNode.location\n // If this condition is true it means we consumed at least one Token\n // In this CstNode.\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset\n loc.endLine = prevToken.endLine\n loc.endColumn = prevToken.endColumn\n }\n // \"empty\" CstNode edge case\n else {\n loc.startOffset = NaN\n loc.startLine = NaN\n loc.startColumn = NaN\n }\n }\n cstPostRuleOnlyOffset(ruleCstNode) {\n const prevToken = this.LA(0)\n // `location' is not null because `cstPostRuleOnlyOffset` will only be invoked when location tracking is enabled.\n const loc = ruleCstNode.location\n // If this condition is true it means we consumed at least one Token\n // In this CstNode.\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset\n }\n // \"empty\" CstNode edge case\n else {\n loc.startOffset = NaN\n }\n }\n cstPostTerminal(key, consumedToken) {\n const rootCst = this.CST_STACK[this.CST_STACK.length - 1]\n addTerminalToCst(rootCst, consumedToken, key)\n // This is only used when **both** error recovery and CST Output are enabled.\n this.setNodeLocationFromToken(rootCst.location, consumedToken)\n }\n cstPostNonTerminal(ruleCstResult, ruleName) {\n const preCstNode = this.CST_STACK[this.CST_STACK.length - 1]\n addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult)\n // This is only used when **both** error recovery and CST Output are enabled.\n this.setNodeLocationFromNode(preCstNode.location, ruleCstResult.location)\n }\n getBaseCstVisitorConstructor() {\n if (isUndefined(this.baseCstVisitorConstructor)) {\n const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(\n this.className,\n keys(this.gastProductionsCache),\n )\n this.baseCstVisitorConstructor = newBaseCstVisitorConstructor\n return newBaseCstVisitorConstructor\n }\n return this.baseCstVisitorConstructor\n }\n getBaseCstVisitorConstructorWithDefaults() {\n if (isUndefined(this.baseCstVisitorWithDefaultsConstructor)) {\n const newConstructor = createBaseVisitorConstructorWithDefaults(\n this.className,\n keys(this.gastProductionsCache),\n this.getBaseCstVisitorConstructor(),\n )\n this.baseCstVisitorWithDefaultsConstructor = newConstructor\n return newConstructor\n }\n return this.baseCstVisitorWithDefaultsConstructor\n }\n getLastExplicitRuleShortName() {\n const ruleStack = this.RULE_STACK\n return ruleStack[ruleStack.length - 1]\n }\n getPreviousExplicitRuleShortName() {\n const ruleStack = this.RULE_STACK\n return ruleStack[ruleStack.length - 2]\n }\n getLastExplicitRuleOccurrenceIndex() {\n const occurrenceStack = this.RULE_OCCURRENCE_STACK\n return occurrenceStack[occurrenceStack.length - 1]\n }\n }\n\n /**\n * Trait responsible abstracting over the interaction with Lexer output (Token vector).\n *\n * This could be generalized to support other kinds of lexers, e.g.\n * - Just in Time Lexing / Lexer-Less parsing.\n * - Streaming Lexer.\n */\n class LexerAdapter {\n initLexerAdapter() {\n this.tokVector = []\n this.tokVectorLength = 0\n this.currIdx = -1\n }\n set input(newInput) {\n // @ts-ignore - `this parameter` not supported in setters/getters\n // - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters\n if (this.selfAnalysisDone !== true) {\n throw Error(`Missing invocation at the end of the Parser's constructor.`)\n }\n // @ts-ignore - `this parameter` not supported in setters/getters\n // - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters\n this.reset()\n this.tokVector = newInput\n this.tokVectorLength = newInput.length\n }\n get input() {\n return this.tokVector\n }\n // skips a token and returns the next token\n SKIP_TOKEN() {\n if (this.currIdx <= this.tokVector.length - 2) {\n this.consumeToken()\n return this.LA(1)\n } else {\n return END_OF_FILE\n }\n }\n // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers\n // or lexers dependent on parser context.\n LA(howMuch) {\n const soughtIdx = this.currIdx + howMuch\n if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) {\n return END_OF_FILE\n } else {\n return this.tokVector[soughtIdx]\n }\n }\n consumeToken() {\n this.currIdx++\n }\n exportLexerState() {\n return this.currIdx\n }\n importLexerState(newState) {\n this.currIdx = newState\n }\n resetLexerState() {\n this.currIdx = -1\n }\n moveToTerminatedState() {\n this.currIdx = this.tokVector.length - 1\n }\n getLexerPosition() {\n return this.exportLexerState()\n }\n }\n\n /**\n * This trait is responsible for implementing the public API\n * for defining Chevrotain parsers, i.e:\n * - CONSUME\n * - RULE\n * - OPTION\n * - ...\n */\n class RecognizerApi {\n ACTION(impl) {\n return impl.call(this)\n }\n consume(idx, tokType, options) {\n return this.consumeInternal(tokType, idx, options)\n }\n subrule(idx, ruleToCall, options) {\n return this.subruleInternal(ruleToCall, idx, options)\n }\n option(idx, actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, idx)\n }\n or(idx, altsOrOpts) {\n return this.orInternal(altsOrOpts, idx)\n }\n many(idx, actionORMethodDef) {\n return this.manyInternal(idx, actionORMethodDef)\n }\n atLeastOne(idx, actionORMethodDef) {\n return this.atLeastOneInternal(idx, actionORMethodDef)\n }\n CONSUME(tokType, options) {\n return this.consumeInternal(tokType, 0, options)\n }\n CONSUME1(tokType, options) {\n return this.consumeInternal(tokType, 1, options)\n }\n CONSUME2(tokType, options) {\n return this.consumeInternal(tokType, 2, options)\n }\n CONSUME3(tokType, options) {\n return this.consumeInternal(tokType, 3, options)\n }\n CONSUME4(tokType, options) {\n return this.consumeInternal(tokType, 4, options)\n }\n CONSUME5(tokType, options) {\n return this.consumeInternal(tokType, 5, options)\n }\n CONSUME6(tokType, options) {\n return this.consumeInternal(tokType, 6, options)\n }\n CONSUME7(tokType, options) {\n return this.consumeInternal(tokType, 7, options)\n }\n CONSUME8(tokType, options) {\n return this.consumeInternal(tokType, 8, options)\n }\n CONSUME9(tokType, options) {\n return this.consumeInternal(tokType, 9, options)\n }\n SUBRULE(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 0, options)\n }\n SUBRULE1(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 1, options)\n }\n SUBRULE2(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 2, options)\n }\n SUBRULE3(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 3, options)\n }\n SUBRULE4(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 4, options)\n }\n SUBRULE5(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 5, options)\n }\n SUBRULE6(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 6, options)\n }\n SUBRULE7(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 7, options)\n }\n SUBRULE8(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 8, options)\n }\n SUBRULE9(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 9, options)\n }\n OPTION(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 0)\n }\n OPTION1(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 1)\n }\n OPTION2(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 2)\n }\n OPTION3(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 3)\n }\n OPTION4(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 4)\n }\n OPTION5(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 5)\n }\n OPTION6(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 6)\n }\n OPTION7(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 7)\n }\n OPTION8(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 8)\n }\n OPTION9(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 9)\n }\n OR(altsOrOpts) {\n return this.orInternal(altsOrOpts, 0)\n }\n OR1(altsOrOpts) {\n return this.orInternal(altsOrOpts, 1)\n }\n OR2(altsOrOpts) {\n return this.orInternal(altsOrOpts, 2)\n }\n OR3(altsOrOpts) {\n return this.orInternal(altsOrOpts, 3)\n }\n OR4(altsOrOpts) {\n return this.orInternal(altsOrOpts, 4)\n }\n OR5(altsOrOpts) {\n return this.orInternal(altsOrOpts, 5)\n }\n OR6(altsOrOpts) {\n return this.orInternal(altsOrOpts, 6)\n }\n OR7(altsOrOpts) {\n return this.orInternal(altsOrOpts, 7)\n }\n OR8(altsOrOpts) {\n return this.orInternal(altsOrOpts, 8)\n }\n OR9(altsOrOpts) {\n return this.orInternal(altsOrOpts, 9)\n }\n MANY(actionORMethodDef) {\n this.manyInternal(0, actionORMethodDef)\n }\n MANY1(actionORMethodDef) {\n this.manyInternal(1, actionORMethodDef)\n }\n MANY2(actionORMethodDef) {\n this.manyInternal(2, actionORMethodDef)\n }\n MANY3(actionORMethodDef) {\n this.manyInternal(3, actionORMethodDef)\n }\n MANY4(actionORMethodDef) {\n this.manyInternal(4, actionORMethodDef)\n }\n MANY5(actionORMethodDef) {\n this.manyInternal(5, actionORMethodDef)\n }\n MANY6(actionORMethodDef) {\n this.manyInternal(6, actionORMethodDef)\n }\n MANY7(actionORMethodDef) {\n this.manyInternal(7, actionORMethodDef)\n }\n MANY8(actionORMethodDef) {\n this.manyInternal(8, actionORMethodDef)\n }\n MANY9(actionORMethodDef) {\n this.manyInternal(9, actionORMethodDef)\n }\n MANY_SEP(options) {\n this.manySepFirstInternal(0, options)\n }\n MANY_SEP1(options) {\n this.manySepFirstInternal(1, options)\n }\n MANY_SEP2(options) {\n this.manySepFirstInternal(2, options)\n }\n MANY_SEP3(options) {\n this.manySepFirstInternal(3, options)\n }\n MANY_SEP4(options) {\n this.manySepFirstInternal(4, options)\n }\n MANY_SEP5(options) {\n this.manySepFirstInternal(5, options)\n }\n MANY_SEP6(options) {\n this.manySepFirstInternal(6, options)\n }\n MANY_SEP7(options) {\n this.manySepFirstInternal(7, options)\n }\n MANY_SEP8(options) {\n this.manySepFirstInternal(8, options)\n }\n MANY_SEP9(options) {\n this.manySepFirstInternal(9, options)\n }\n AT_LEAST_ONE(actionORMethodDef) {\n this.atLeastOneInternal(0, actionORMethodDef)\n }\n AT_LEAST_ONE1(actionORMethodDef) {\n return this.atLeastOneInternal(1, actionORMethodDef)\n }\n AT_LEAST_ONE2(actionORMethodDef) {\n this.atLeastOneInternal(2, actionORMethodDef)\n }\n AT_LEAST_ONE3(actionORMethodDef) {\n this.atLeastOneInternal(3, actionORMethodDef)\n }\n AT_LEAST_ONE4(actionORMethodDef) {\n this.atLeastOneInternal(4, actionORMethodDef)\n }\n AT_LEAST_ONE5(actionORMethodDef) {\n this.atLeastOneInternal(5, actionORMethodDef)\n }\n AT_LEAST_ONE6(actionORMethodDef) {\n this.atLeastOneInternal(6, actionORMethodDef)\n }\n AT_LEAST_ONE7(actionORMethodDef) {\n this.atLeastOneInternal(7, actionORMethodDef)\n }\n AT_LEAST_ONE8(actionORMethodDef) {\n this.atLeastOneInternal(8, actionORMethodDef)\n }\n AT_LEAST_ONE9(actionORMethodDef) {\n this.atLeastOneInternal(9, actionORMethodDef)\n }\n AT_LEAST_ONE_SEP(options) {\n this.atLeastOneSepFirstInternal(0, options)\n }\n AT_LEAST_ONE_SEP1(options) {\n this.atLeastOneSepFirstInternal(1, options)\n }\n AT_LEAST_ONE_SEP2(options) {\n this.atLeastOneSepFirstInternal(2, options)\n }\n AT_LEAST_ONE_SEP3(options) {\n this.atLeastOneSepFirstInternal(3, options)\n }\n AT_LEAST_ONE_SEP4(options) {\n this.atLeastOneSepFirstInternal(4, options)\n }\n AT_LEAST_ONE_SEP5(options) {\n this.atLeastOneSepFirstInternal(5, options)\n }\n AT_LEAST_ONE_SEP6(options) {\n this.atLeastOneSepFirstInternal(6, options)\n }\n AT_LEAST_ONE_SEP7(options) {\n this.atLeastOneSepFirstInternal(7, options)\n }\n AT_LEAST_ONE_SEP8(options) {\n this.atLeastOneSepFirstInternal(8, options)\n }\n AT_LEAST_ONE_SEP9(options) {\n this.atLeastOneSepFirstInternal(9, options)\n }\n RULE(name, implementation, config = DEFAULT_RULE_CONFIG) {\n if (includes(this.definedRulesNames, name)) {\n const errMsg = defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({\n topLevelRule: name,\n grammarName: this.className,\n })\n const error = {\n message: errMsg,\n type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: name,\n }\n this.definitionErrors.push(error)\n }\n this.definedRulesNames.push(name)\n const ruleImplementation = this.defineRule(name, implementation, config)\n this[name] = ruleImplementation\n return ruleImplementation\n }\n OVERRIDE_RULE(name, impl, config = DEFAULT_RULE_CONFIG) {\n const ruleErrors = validateRuleIsOverridden(name, this.definedRulesNames, this.className)\n this.definitionErrors = this.definitionErrors.concat(ruleErrors)\n const ruleImplementation = this.defineRule(name, impl, config)\n this[name] = ruleImplementation\n return ruleImplementation\n }\n BACKTRACK(grammarRule, args) {\n return function () {\n // save org state\n this.isBackTrackingStack.push(1)\n const orgState = this.saveRecogState()\n try {\n grammarRule.apply(this, args)\n // if no exception was thrown we have succeed parsing the rule.\n return true\n } catch (e) {\n if (isRecognitionException(e)) {\n return false\n } else {\n throw e\n }\n } finally {\n this.reloadRecogState(orgState)\n this.isBackTrackingStack.pop()\n }\n }\n }\n // GAST export APIs\n getGAstProductions() {\n return this.gastProductionsCache\n }\n getSerializedGastProductions() {\n return serializeGrammar(values(this.gastProductionsCache))\n }\n }\n\n /**\n * This trait is responsible for the runtime parsing engine\n * Used by the official API (recognizer_api.ts)\n */\n class RecognizerEngine {\n initRecognizerEngine(tokenVocabulary, config) {\n this.className = this.constructor.name\n // TODO: would using an ES6 Map or plain object be faster (CST building scenario)\n this.shortRuleNameToFull = {}\n this.fullRuleNameToShort = {}\n this.ruleShortNameIdx = 256\n this.tokenMatcher = tokenStructuredMatcherNoCategories\n this.subruleIdx = 0\n this.definedRulesNames = []\n this.tokensMap = {}\n this.isBackTrackingStack = []\n this.RULE_STACK = []\n this.RULE_OCCURRENCE_STACK = []\n this.gastProductionsCache = {}\n if (has(config, 'serializedGrammar')) {\n throw Error(\n \"The Parser's configuration can no longer contain a property.\\n\" +\n '\\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\\n' +\n '\\tFor Further details.',\n )\n }\n if (isArray$1(tokenVocabulary)) {\n // This only checks for Token vocabularies provided as arrays.\n // That is good enough because the main objective is to detect users of pre-V4.0 APIs\n // rather than all edge cases of empty Token vocabularies.\n if (isEmpty(tokenVocabulary)) {\n throw Error(\n 'A Token Vocabulary cannot be empty.\\n' +\n '\\tNote that the first argument for the parser constructor\\n' +\n '\\tis no longer a Token vector (since v4.0).',\n )\n }\n if (typeof tokenVocabulary[0].startOffset === 'number') {\n throw Error(\n 'The Parser constructor no longer accepts a token vector as the first argument.\\n' +\n '\\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\\n' +\n '\\tFor Further details.',\n )\n }\n }\n if (isArray$1(tokenVocabulary)) {\n this.tokensMap = reduce(\n tokenVocabulary,\n (acc, tokType) => {\n acc[tokType.name] = tokType\n return acc\n },\n {},\n )\n } else if (has(tokenVocabulary, 'modes') && every(flatten(values(tokenVocabulary.modes)), isTokenType)) {\n const allTokenTypes = flatten(values(tokenVocabulary.modes))\n const uniqueTokens = uniq(allTokenTypes)\n this.tokensMap = reduce(\n uniqueTokens,\n (acc, tokType) => {\n acc[tokType.name] = tokType\n return acc\n },\n {},\n )\n } else if (isObject(tokenVocabulary)) {\n this.tokensMap = clone(tokenVocabulary)\n } else {\n throw new Error(\n ' argument must be An Array of Token constructors,' +\n ' A dictionary of Token constructors or an IMultiModeLexerDefinition',\n )\n }\n // always add EOF to the tokenNames -> constructors map. it is useful to assure all the input has been\n // parsed with a clear error message (\"expecting EOF but found ...\")\n this.tokensMap['EOF'] = EOF\n const allTokenTypes = has(tokenVocabulary, 'modes')\n ? flatten(values(tokenVocabulary.modes))\n : values(tokenVocabulary)\n const noTokenCategoriesUsed = every(allTokenTypes, (tokenConstructor) =>\n isEmpty(tokenConstructor.categoryMatches),\n )\n this.tokenMatcher = noTokenCategoriesUsed ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher\n // Because ES2015+ syntax should be supported for creating Token classes\n // We cannot assume that the Token classes were created using the \"extendToken\" utilities\n // Therefore we must augment the Token classes both on Lexer initialization and on Parser initialization\n augmentTokenTypes(values(this.tokensMap))\n }\n defineRule(ruleName, impl, config) {\n if (this.selfAnalysisDone) {\n throw Error(\n `Grammar rule <${ruleName}> may not be defined after the 'performSelfAnalysis' method has been called'\\n` +\n `Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`,\n )\n }\n const resyncEnabled = has(config, 'resyncEnabled')\n ? config.resyncEnabled // assumes end user provides the correct config value/type\n : DEFAULT_RULE_CONFIG.resyncEnabled\n const recoveryValueFunc = has(config, 'recoveryValueFunc')\n ? config.recoveryValueFunc // assumes end user provides the correct config value/type\n : DEFAULT_RULE_CONFIG.recoveryValueFunc\n // performance optimization: Use small integers as keys for the longer human readable \"full\" rule names.\n // this greatly improves Map access time (as much as 8% for some performance benchmarks).\n const shortName = this.ruleShortNameIdx << (BITS_FOR_METHOD_TYPE + BITS_FOR_OCCURRENCE_IDX)\n this.ruleShortNameIdx++\n this.shortRuleNameToFull[shortName] = ruleName\n this.fullRuleNameToShort[ruleName] = shortName\n let invokeRuleWithTry\n // Micro optimization, only check the condition **once** on rule definition\n // instead of **every single** rule invocation.\n if (this.outputCst === true) {\n invokeRuleWithTry = function invokeRuleWithTry(...args) {\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx)\n impl.apply(this, args)\n const cst = this.CST_STACK[this.CST_STACK.length - 1]\n this.cstPostRule(cst)\n return cst\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc)\n } finally {\n this.ruleFinallyStateUpdate()\n }\n }\n } else {\n invokeRuleWithTry = function invokeRuleWithTryCst(...args) {\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx)\n return impl.apply(this, args)\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc)\n } finally {\n this.ruleFinallyStateUpdate()\n }\n }\n }\n const wrappedGrammarRule = Object.assign(invokeRuleWithTry, { ruleName, originalGrammarAction: impl })\n return wrappedGrammarRule\n }\n invokeRuleCatch(e, resyncEnabledConfig, recoveryValueFunc) {\n const isFirstInvokedRule = this.RULE_STACK.length === 1\n // note the reSync is always enabled for the first rule invocation, because we must always be able to\n // reSync with EOF and just output some INVALID ParseTree\n // during backtracking reSync recovery is disabled, otherwise we can't be certain the backtracking\n // path is really the most valid one\n const reSyncEnabled = resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled\n if (isRecognitionException(e)) {\n const recogError = e\n if (reSyncEnabled) {\n const reSyncTokType = this.findReSyncTokenType()\n if (this.isInCurrentRuleReSyncSet(reSyncTokType)) {\n recogError.resyncedTokens = this.reSyncTo(reSyncTokType)\n if (this.outputCst) {\n const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]\n partialCstResult.recoveredNode = true\n return partialCstResult\n } else {\n return recoveryValueFunc(e)\n }\n } else {\n if (this.outputCst) {\n const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]\n partialCstResult.recoveredNode = true\n recogError.partialCstResult = partialCstResult\n }\n // to be handled Further up the call stack\n throw recogError\n }\n } else if (isFirstInvokedRule) {\n // otherwise a Redundant input error will be created as well and we cannot guarantee that this is indeed the case\n this.moveToTerminatedState()\n // the parser should never throw one of its own errors outside its flow.\n // even if error recovery is disabled\n return recoveryValueFunc(e)\n } else {\n // to be recovered Further up the call stack\n throw recogError\n }\n } else {\n // some other Error type which we don't know how to handle (for example a built in JavaScript Error)\n throw e\n }\n }\n // Implementation of parsing DSL\n optionInternal(actionORMethodDef, occurrence) {\n const key = this.getKeyForAutomaticLookahead(OPTION_IDX, occurrence)\n return this.optionInternalLogic(actionORMethodDef, occurrence, key)\n }\n optionInternalLogic(actionORMethodDef, occurrence, key) {\n let lookAheadFunc = this.getLaFuncFromCache(key)\n let action\n if (typeof actionORMethodDef !== 'function') {\n action = actionORMethodDef.DEF\n const predicate = actionORMethodDef.GATE\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookAheadFunc\n lookAheadFunc = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this)\n }\n }\n } else {\n action = actionORMethodDef\n }\n if (lookAheadFunc.call(this) === true) {\n return action.call(this)\n }\n return undefined\n }\n atLeastOneInternal(prodOccurrence, actionORMethodDef) {\n const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_IDX, prodOccurrence)\n return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, laKey)\n }\n atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, key) {\n let lookAheadFunc = this.getLaFuncFromCache(key)\n let action\n if (typeof actionORMethodDef !== 'function') {\n action = actionORMethodDef.DEF\n const predicate = actionORMethodDef.GATE\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookAheadFunc\n lookAheadFunc = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this)\n }\n }\n } else {\n action = actionORMethodDef\n }\n if (lookAheadFunc.call(this) === true) {\n let notStuck = this.doSingleRepetition(action)\n while (lookAheadFunc.call(this) === true && notStuck === true) {\n notStuck = this.doSingleRepetition(action)\n }\n } else {\n throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG)\n }\n // note that while it may seem that this can cause an error because by using a recursive call to\n // AT_LEAST_ONE we change the grammar to AT_LEAST_TWO, AT_LEAST_THREE ... , the possible recursive call\n // from the tryInRepetitionRecovery(...) will only happen IFF there really are TWO/THREE/.... items.\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.atLeastOneInternal,\n [prodOccurrence, actionORMethodDef],\n lookAheadFunc,\n AT_LEAST_ONE_IDX,\n prodOccurrence,\n NextTerminalAfterAtLeastOneWalker,\n )\n }\n atLeastOneSepFirstInternal(prodOccurrence, options) {\n const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_SEP_IDX, prodOccurrence)\n this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, laKey)\n }\n atLeastOneSepFirstInternalLogic(prodOccurrence, options, key) {\n const action = options.DEF\n const separator = options.SEP\n const firstIterationLookaheadFunc = this.getLaFuncFromCache(key)\n // 1st iteration\n if (firstIterationLookaheadFunc.call(this) === true) {\n action.call(this)\n // TODO: Optimization can move this function construction into \"attemptInRepetitionRecovery\"\n // because it is only needed in error recovery scenarios.\n const separatorLookAheadFunc = () => {\n return this.tokenMatcher(this.LA(1), separator)\n }\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator)\n // No need for checking infinite loop here due to consuming the separator.\n action.call(this)\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [prodOccurrence, separator, separatorLookAheadFunc, action, NextTerminalAfterAtLeastOneSepWalker],\n separatorLookAheadFunc,\n AT_LEAST_ONE_SEP_IDX,\n prodOccurrence,\n NextTerminalAfterAtLeastOneSepWalker,\n )\n } else {\n throw this.raiseEarlyExitException(\n prodOccurrence,\n PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,\n options.ERR_MSG,\n )\n }\n }\n manyInternal(prodOccurrence, actionORMethodDef) {\n const laKey = this.getKeyForAutomaticLookahead(MANY_IDX, prodOccurrence)\n return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey)\n }\n manyInternalLogic(prodOccurrence, actionORMethodDef, key) {\n let lookaheadFunction = this.getLaFuncFromCache(key)\n let action\n if (typeof actionORMethodDef !== 'function') {\n action = actionORMethodDef.DEF\n const predicate = actionORMethodDef.GATE\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookaheadFunction\n lookaheadFunction = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this)\n }\n }\n } else {\n action = actionORMethodDef\n }\n let notStuck = true\n while (lookaheadFunction.call(this) === true && notStuck === true) {\n notStuck = this.doSingleRepetition(action)\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.manyInternal,\n [prodOccurrence, actionORMethodDef],\n lookaheadFunction,\n MANY_IDX,\n prodOccurrence,\n NextTerminalAfterManyWalker,\n // The notStuck parameter is only relevant when \"attemptInRepetitionRecovery\"\n // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP]\n // An infinite loop cannot occur as:\n // - Either the lookahead is guaranteed to consume something (Single Token Separator)\n // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out).\n notStuck,\n )\n }\n manySepFirstInternal(prodOccurrence, options) {\n const laKey = this.getKeyForAutomaticLookahead(MANY_SEP_IDX, prodOccurrence)\n this.manySepFirstInternalLogic(prodOccurrence, options, laKey)\n }\n manySepFirstInternalLogic(prodOccurrence, options, key) {\n const action = options.DEF\n const separator = options.SEP\n const firstIterationLaFunc = this.getLaFuncFromCache(key)\n // 1st iteration\n if (firstIterationLaFunc.call(this) === true) {\n action.call(this)\n const separatorLookAheadFunc = () => {\n return this.tokenMatcher(this.LA(1), separator)\n }\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator)\n // No need for checking infinite loop here due to consuming the separator.\n action.call(this)\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [prodOccurrence, separator, separatorLookAheadFunc, action, NextTerminalAfterManySepWalker],\n separatorLookAheadFunc,\n MANY_SEP_IDX,\n prodOccurrence,\n NextTerminalAfterManySepWalker,\n )\n }\n }\n repetitionSepSecondInternal(prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker) {\n while (separatorLookAheadFunc()) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator)\n action.call(this)\n }\n // we can only arrive to this function after an error\n // has occurred (hence the name 'second') so the following\n // IF will always be entered, its possible to remove it...\n // however it is kept to avoid confusion and be consistent.\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n /* istanbul ignore else */\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker],\n separatorLookAheadFunc,\n AT_LEAST_ONE_SEP_IDX,\n prodOccurrence,\n nextTerminalAfterWalker,\n )\n }\n doSingleRepetition(action) {\n const beforeIteration = this.getLexerPosition()\n action.call(this)\n const afterIteration = this.getLexerPosition()\n // This boolean will indicate if this repetition progressed\n // or if we are \"stuck\" (potential infinite loop in the repetition).\n return afterIteration > beforeIteration\n }\n orInternal(altsOrOpts, occurrence) {\n const laKey = this.getKeyForAutomaticLookahead(OR_IDX, occurrence)\n const alts = isArray$1(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF\n const laFunc = this.getLaFuncFromCache(laKey)\n const altIdxToTake = laFunc.call(this, alts)\n if (altIdxToTake !== undefined) {\n const chosenAlternative = alts[altIdxToTake]\n return chosenAlternative.ALT.call(this)\n }\n this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG)\n }\n ruleFinallyStateUpdate() {\n this.RULE_STACK.pop()\n this.RULE_OCCURRENCE_STACK.pop()\n // NOOP when cst is disabled\n this.cstFinallyStateUpdate()\n if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) {\n const firstRedundantTok = this.LA(1)\n const errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({\n firstRedundant: firstRedundantTok,\n ruleName: this.getCurrRuleFullName(),\n })\n this.SAVE_ERROR(new NotAllInputParsedException(errMsg, firstRedundantTok))\n }\n }\n subruleInternal(ruleToCall, idx, options) {\n let ruleResult\n try {\n const args = options !== undefined ? options.ARGS : undefined\n this.subruleIdx = idx\n ruleResult = ruleToCall.apply(this, args)\n this.cstPostNonTerminal(\n ruleResult,\n options !== undefined && options.LABEL !== undefined ? options.LABEL : ruleToCall.ruleName,\n )\n return ruleResult\n } catch (e) {\n throw this.subruleInternalError(e, options, ruleToCall.ruleName)\n }\n }\n subruleInternalError(e, options, ruleName) {\n if (isRecognitionException(e) && e.partialCstResult !== undefined) {\n this.cstPostNonTerminal(\n e.partialCstResult,\n options !== undefined && options.LABEL !== undefined ? options.LABEL : ruleName,\n )\n delete e.partialCstResult\n }\n throw e\n }\n consumeInternal(tokType, idx, options) {\n let consumedToken\n try {\n const nextToken = this.LA(1)\n if (this.tokenMatcher(nextToken, tokType) === true) {\n this.consumeToken()\n consumedToken = nextToken\n } else {\n this.consumeInternalError(tokType, nextToken, options)\n }\n } catch (eFromConsumption) {\n consumedToken = this.consumeInternalRecovery(tokType, idx, eFromConsumption)\n }\n this.cstPostTerminal(\n options !== undefined && options.LABEL !== undefined ? options.LABEL : tokType.name,\n consumedToken,\n )\n return consumedToken\n }\n consumeInternalError(tokType, nextToken, options) {\n let msg\n const previousToken = this.LA(0)\n if (options !== undefined && options.ERR_MSG) {\n msg = options.ERR_MSG\n } else {\n msg = this.errorMessageProvider.buildMismatchTokenMessage({\n expected: tokType,\n actual: nextToken,\n previous: previousToken,\n ruleName: this.getCurrRuleFullName(),\n })\n }\n throw this.SAVE_ERROR(new MismatchedTokenException(msg, nextToken, previousToken))\n }\n consumeInternalRecovery(tokType, idx, eFromConsumption) {\n // no recovery allowed during backtracking, otherwise backtracking may recover invalid syntax and accept it\n // but the original syntax could have been parsed successfully without any backtracking + recovery\n if (\n this.recoveryEnabled &&\n // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?\n eFromConsumption.name === 'MismatchedTokenException' &&\n !this.isBackTracking()\n ) {\n const follows = this.getFollowsForInRuleRecovery(tokType, idx)\n try {\n return this.tryInRuleRecovery(tokType, follows)\n } catch (eFromInRuleRecovery) {\n if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) {\n // failed in RuleRecovery.\n // throw the original error in order to trigger reSync error recovery\n throw eFromConsumption\n } else {\n throw eFromInRuleRecovery\n }\n }\n } else {\n throw eFromConsumption\n }\n }\n saveRecogState() {\n // errors is a getter which will clone the errors array\n const savedErrors = this.errors\n const savedRuleStack = clone(this.RULE_STACK)\n return {\n errors: savedErrors,\n lexerState: this.exportLexerState(),\n RULE_STACK: savedRuleStack,\n CST_STACK: this.CST_STACK,\n }\n }\n reloadRecogState(newState) {\n this.errors = newState.errors\n this.importLexerState(newState.lexerState)\n this.RULE_STACK = newState.RULE_STACK\n }\n ruleInvocationStateUpdate(shortName, fullName, idxInCallingRule) {\n this.RULE_OCCURRENCE_STACK.push(idxInCallingRule)\n this.RULE_STACK.push(shortName)\n // NOOP when cst is disabled\n this.cstInvocationStateUpdate(fullName)\n }\n isBackTracking() {\n return this.isBackTrackingStack.length !== 0\n }\n getCurrRuleFullName() {\n const shortName = this.getLastExplicitRuleShortName()\n return this.shortRuleNameToFull[shortName]\n }\n shortRuleNameToFullName(shortName) {\n return this.shortRuleNameToFull[shortName]\n }\n isAtEndOfInput() {\n return this.tokenMatcher(this.LA(1), EOF)\n }\n reset() {\n this.resetLexerState()\n this.subruleIdx = 0\n this.isBackTrackingStack = []\n this.errors = []\n this.RULE_STACK = []\n // TODO: extract a specific reset for TreeBuilder trait\n this.CST_STACK = []\n this.RULE_OCCURRENCE_STACK = []\n }\n }\n\n /**\n * Trait responsible for runtime parsing errors.\n */\n class ErrorHandler {\n initErrorHandler(config) {\n this._errors = []\n this.errorMessageProvider = has(config, 'errorMessageProvider')\n ? config.errorMessageProvider // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.errorMessageProvider\n }\n SAVE_ERROR(error) {\n if (isRecognitionException(error)) {\n error.context = {\n ruleStack: this.getHumanReadableRuleStack(),\n ruleOccurrenceStack: clone(this.RULE_OCCURRENCE_STACK),\n }\n this._errors.push(error)\n return error\n } else {\n throw Error('Trying to save an Error which is not a RecognitionException')\n }\n }\n get errors() {\n return clone(this._errors)\n }\n set errors(newErrors) {\n this._errors = newErrors\n }\n // TODO: consider caching the error message computed information\n raiseEarlyExitException(occurrence, prodType, userDefinedErrMsg) {\n const ruleName = this.getCurrRuleFullName()\n const ruleGrammar = this.getGAstProductions()[ruleName]\n const lookAheadPathsPerAlternative = getLookaheadPathsForOptionalProd(\n occurrence,\n ruleGrammar,\n prodType,\n this.maxLookahead,\n )\n const insideProdPaths = lookAheadPathsPerAlternative[0]\n const actualTokens = []\n for (let i = 1; i <= this.maxLookahead; i++) {\n actualTokens.push(this.LA(i))\n }\n const msg = this.errorMessageProvider.buildEarlyExitMessage({\n expectedIterationPaths: insideProdPaths,\n actual: actualTokens,\n previous: this.LA(0),\n customUserDescription: userDefinedErrMsg,\n ruleName: ruleName,\n })\n throw this.SAVE_ERROR(new EarlyExitException(msg, this.LA(1), this.LA(0)))\n }\n // TODO: consider caching the error message computed information\n raiseNoAltException(occurrence, errMsgTypes) {\n const ruleName = this.getCurrRuleFullName()\n const ruleGrammar = this.getGAstProductions()[ruleName]\n // TODO: getLookaheadPathsForOr can be slow for large enough maxLookahead and certain grammars, consider caching ?\n const lookAheadPathsPerAlternative = getLookaheadPathsForOr(occurrence, ruleGrammar, this.maxLookahead)\n const actualTokens = []\n for (let i = 1; i <= this.maxLookahead; i++) {\n actualTokens.push(this.LA(i))\n }\n const previousToken = this.LA(0)\n const errMsg = this.errorMessageProvider.buildNoViableAltMessage({\n expectedPathsPerAlt: lookAheadPathsPerAlternative,\n actual: actualTokens,\n previous: previousToken,\n customUserDescription: errMsgTypes,\n ruleName: this.getCurrRuleFullName(),\n })\n throw this.SAVE_ERROR(new NoViableAltException(errMsg, this.LA(1), previousToken))\n }\n }\n\n class ContentAssist {\n initContentAssist() {}\n computeContentAssist(startRuleName, precedingInput) {\n const startRuleGast = this.gastProductionsCache[startRuleName]\n if (isUndefined(startRuleGast)) {\n throw Error(`Rule ->${startRuleName}<- does not exist in this grammar.`)\n }\n return nextPossibleTokensAfter([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead)\n }\n // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'...\n // TODO: should this be more explicitly part of the public API?\n getNextPossibleTokenTypes(grammarPath) {\n const topRuleName = head(grammarPath.ruleStack)\n const gastProductions = this.getGAstProductions()\n const topProduction = gastProductions[topRuleName]\n const nextPossibleTokenTypes = new NextAfterTokenWalker(topProduction, grammarPath).startWalking()\n return nextPossibleTokenTypes\n }\n }\n\n const RECORDING_NULL_OBJECT = {\n description: 'This Object indicates the Parser is during Recording Phase',\n }\n Object.freeze(RECORDING_NULL_OBJECT)\n const HANDLE_SEPARATOR = true\n const MAX_METHOD_IDX = Math.pow(2, BITS_FOR_OCCURRENCE_IDX) - 1\n const RFT = createToken({ name: 'RECORDING_PHASE_TOKEN', pattern: Lexer.NA })\n augmentTokenTypes([RFT])\n const RECORDING_PHASE_TOKEN = createTokenInstance(\n RFT,\n 'This IToken indicates the Parser is in Recording Phase\\n\\t' +\n '' +\n 'See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details',\n // Using \"-1\" instead of NaN (as in EOF) because an actual number is less likely to\n // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase.\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n )\n Object.freeze(RECORDING_PHASE_TOKEN)\n const RECORDING_PHASE_CSTNODE = {\n name:\n 'This CSTNode indicates the Parser is in Recording Phase\\n\\t' +\n 'See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details',\n children: {},\n }\n /**\n * This trait handles the creation of the GAST structure for Chevrotain Grammars\n */\n class GastRecorder {\n initGastRecorder(config) {\n this.recordingProdStack = []\n this.RECORDING_PHASE = false\n }\n enableRecording() {\n this.RECORDING_PHASE = true\n this.TRACE_INIT('Enable Recording', () => {\n /**\n * Warning Dark Voodoo Magic upcoming!\n * We are \"replacing\" the public parsing DSL methods API\n * With **new** alternative implementations on the Parser **instance**\n *\n * So far this is the only way I've found to avoid performance regressions during parsing time.\n * - Approx 30% performance regression was measured on Chrome 75 Canary when attempting to replace the \"internal\"\n * implementations directly instead.\n */\n for (let i = 0; i < 10; i++) {\n const idx = i > 0 ? i : ''\n this[`CONSUME${idx}`] = function (arg1, arg2) {\n return this.consumeInternalRecord(arg1, i, arg2)\n }\n this[`SUBRULE${idx}`] = function (arg1, arg2) {\n return this.subruleInternalRecord(arg1, i, arg2)\n }\n this[`OPTION${idx}`] = function (arg1) {\n return this.optionInternalRecord(arg1, i)\n }\n this[`OR${idx}`] = function (arg1) {\n return this.orInternalRecord(arg1, i)\n }\n this[`MANY${idx}`] = function (arg1) {\n this.manyInternalRecord(i, arg1)\n }\n this[`MANY_SEP${idx}`] = function (arg1) {\n this.manySepFirstInternalRecord(i, arg1)\n }\n this[`AT_LEAST_ONE${idx}`] = function (arg1) {\n this.atLeastOneInternalRecord(i, arg1)\n }\n this[`AT_LEAST_ONE_SEP${idx}`] = function (arg1) {\n this.atLeastOneSepFirstInternalRecord(i, arg1)\n }\n }\n // DSL methods with the idx(suffix) as an argument\n this[`consume`] = function (idx, arg1, arg2) {\n return this.consumeInternalRecord(arg1, idx, arg2)\n }\n this[`subrule`] = function (idx, arg1, arg2) {\n return this.subruleInternalRecord(arg1, idx, arg2)\n }\n this[`option`] = function (idx, arg1) {\n return this.optionInternalRecord(arg1, idx)\n }\n this[`or`] = function (idx, arg1) {\n return this.orInternalRecord(arg1, idx)\n }\n this[`many`] = function (idx, arg1) {\n this.manyInternalRecord(idx, arg1)\n }\n this[`atLeastOne`] = function (idx, arg1) {\n this.atLeastOneInternalRecord(idx, arg1)\n }\n this.ACTION = this.ACTION_RECORD\n this.BACKTRACK = this.BACKTRACK_RECORD\n this.LA = this.LA_RECORD\n })\n }\n disableRecording() {\n this.RECORDING_PHASE = false\n // By deleting these **instance** properties, any future invocation\n // will be deferred to the original methods on the **prototype** object\n // This seems to get rid of any incorrect optimizations that V8 may\n // do during the recording phase.\n this.TRACE_INIT('Deleting Recording methods', () => {\n const that = this\n for (let i = 0; i < 10; i++) {\n const idx = i > 0 ? i : ''\n delete that[`CONSUME${idx}`]\n delete that[`SUBRULE${idx}`]\n delete that[`OPTION${idx}`]\n delete that[`OR${idx}`]\n delete that[`MANY${idx}`]\n delete that[`MANY_SEP${idx}`]\n delete that[`AT_LEAST_ONE${idx}`]\n delete that[`AT_LEAST_ONE_SEP${idx}`]\n }\n delete that[`consume`]\n delete that[`subrule`]\n delete that[`option`]\n delete that[`or`]\n delete that[`many`]\n delete that[`atLeastOne`]\n delete that.ACTION\n delete that.BACKTRACK\n delete that.LA\n })\n }\n // Parser methods are called inside an ACTION?\n // Maybe try/catch/finally on ACTIONS while disabling the recorders state changes?\n // @ts-expect-error -- noop place holder\n ACTION_RECORD(impl) {\n // NO-OP during recording\n }\n // Executing backtracking logic will break our recording logic assumptions\n BACKTRACK_RECORD(grammarRule, args) {\n return () => true\n }\n // LA is part of the official API and may be used for custom lookahead logic\n // by end users who may forget to wrap it in ACTION or inside a GATE\n LA_RECORD(howMuch) {\n // We cannot use the RECORD_PHASE_TOKEN here because someone may depend\n // On LA return EOF at the end of the input so an infinite loop may occur.\n return END_OF_FILE\n }\n topLevelRuleRecord(name, def) {\n try {\n const newTopLevelRule = new Rule({ definition: [], name: name })\n newTopLevelRule.name = name\n this.recordingProdStack.push(newTopLevelRule)\n def.call(this)\n this.recordingProdStack.pop()\n return newTopLevelRule\n } catch (originalError) {\n if (originalError.KNOWN_RECORDER_ERROR !== true) {\n try {\n originalError.message =\n originalError.message +\n '\\n\\t This error was thrown during the \"grammar recording phase\" For more info see:\\n\\t' +\n 'https://chevrotain.io/docs/guide/internals.html#grammar-recording'\n } catch (mutabilityError) {\n // We may not be able to modify the original error object\n throw originalError\n }\n }\n throw originalError\n }\n }\n // Implementation of parsing DSL\n optionInternalRecord(actionORMethodDef, occurrence) {\n return recordProd.call(this, Option, actionORMethodDef, occurrence)\n }\n atLeastOneInternalRecord(occurrence, actionORMethodDef) {\n recordProd.call(this, RepetitionMandatory, actionORMethodDef, occurrence)\n }\n atLeastOneSepFirstInternalRecord(occurrence, options) {\n recordProd.call(this, RepetitionMandatoryWithSeparator, options, occurrence, HANDLE_SEPARATOR)\n }\n manyInternalRecord(occurrence, actionORMethodDef) {\n recordProd.call(this, Repetition, actionORMethodDef, occurrence)\n }\n manySepFirstInternalRecord(occurrence, options) {\n recordProd.call(this, RepetitionWithSeparator, options, occurrence, HANDLE_SEPARATOR)\n }\n orInternalRecord(altsOrOpts, occurrence) {\n return recordOrProd.call(this, altsOrOpts, occurrence)\n }\n subruleInternalRecord(ruleToCall, occurrence, options) {\n assertMethodIdxIsValid(occurrence)\n if (!ruleToCall || has(ruleToCall, 'ruleName') === false) {\n const error = new Error(\n ` argument is invalid` +\n ` expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}>` +\n `\\n inside top level rule: <${this.recordingProdStack[0].name}>`,\n )\n error.KNOWN_RECORDER_ERROR = true\n throw error\n }\n const prevProd = last(this.recordingProdStack)\n const ruleName = ruleToCall.ruleName\n const newNoneTerminal = new NonTerminal({\n idx: occurrence,\n nonTerminalName: ruleName,\n label: options === null || options === void 0 ? void 0 : options.LABEL,\n // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created\n referencedRule: undefined,\n })\n prevProd.definition.push(newNoneTerminal)\n return this.outputCst ? RECORDING_PHASE_CSTNODE : RECORDING_NULL_OBJECT\n }\n consumeInternalRecord(tokType, occurrence, options) {\n assertMethodIdxIsValid(occurrence)\n if (!hasShortKeyProperty(tokType)) {\n const error = new Error(\n ` argument is invalid` +\n ` expecting a TokenType reference but got: <${JSON.stringify(tokType)}>` +\n `\\n inside top level rule: <${this.recordingProdStack[0].name}>`,\n )\n error.KNOWN_RECORDER_ERROR = true\n throw error\n }\n const prevProd = last(this.recordingProdStack)\n const newNoneTerminal = new Terminal({\n idx: occurrence,\n terminalType: tokType,\n label: options === null || options === void 0 ? void 0 : options.LABEL,\n })\n prevProd.definition.push(newNoneTerminal)\n return RECORDING_PHASE_TOKEN\n }\n }\n function recordProd(prodConstructor, mainProdArg, occurrence, handleSep = false) {\n assertMethodIdxIsValid(occurrence)\n const prevProd = last(this.recordingProdStack)\n const grammarAction = isFunction(mainProdArg) ? mainProdArg : mainProdArg.DEF\n const newProd = new prodConstructor({ definition: [], idx: occurrence })\n if (handleSep) {\n newProd.separator = mainProdArg.SEP\n }\n if (has(mainProdArg, 'MAX_LOOKAHEAD')) {\n newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD\n }\n this.recordingProdStack.push(newProd)\n grammarAction.call(this)\n prevProd.definition.push(newProd)\n this.recordingProdStack.pop()\n return RECORDING_NULL_OBJECT\n }\n function recordOrProd(mainProdArg, occurrence) {\n assertMethodIdxIsValid(occurrence)\n const prevProd = last(this.recordingProdStack)\n // Only an array of alternatives\n const hasOptions = isArray$1(mainProdArg) === false\n const alts = hasOptions === false ? mainProdArg : mainProdArg.DEF\n const newOrProd = new Alternation({\n definition: [],\n idx: occurrence,\n ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true,\n })\n if (has(mainProdArg, 'MAX_LOOKAHEAD')) {\n newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD\n }\n const hasPredicates = some(alts, (currAlt) => isFunction(currAlt.GATE))\n newOrProd.hasPredicates = hasPredicates\n prevProd.definition.push(newOrProd)\n forEach(alts, (currAlt) => {\n const currAltFlat = new Alternative({ definition: [] })\n newOrProd.definition.push(currAltFlat)\n if (has(currAlt, 'IGNORE_AMBIGUITIES')) {\n currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES // assumes end user provides the correct config value/type\n }\n // **implicit** ignoreAmbiguities due to usage of gate\n else if (has(currAlt, 'GATE')) {\n currAltFlat.ignoreAmbiguities = true\n }\n this.recordingProdStack.push(currAltFlat)\n currAlt.ALT.call(this)\n this.recordingProdStack.pop()\n })\n return RECORDING_NULL_OBJECT\n }\n function getIdxSuffix(idx) {\n return idx === 0 ? '' : `${idx}`\n }\n function assertMethodIdxIsValid(idx) {\n if (idx < 0 || idx > MAX_METHOD_IDX) {\n const error = new Error(\n // The stack trace will contain all the needed details\n `Invalid DSL Method idx value: <${idx}>\\n\\t` +\n `Idx value must be a none negative value smaller than ${MAX_METHOD_IDX + 1}`,\n )\n error.KNOWN_RECORDER_ERROR = true\n throw error\n }\n }\n\n /**\n * Trait responsible for runtime parsing errors.\n */\n class PerformanceTracer {\n initPerformanceTracer(config) {\n if (has(config, 'traceInitPerf')) {\n const userTraceInitPerf = config.traceInitPerf\n const traceIsNumber = typeof userTraceInitPerf === 'number'\n this.traceInitMaxIdent = traceIsNumber ? userTraceInitPerf : Infinity\n this.traceInitPerf = traceIsNumber ? userTraceInitPerf > 0 : userTraceInitPerf // assumes end user provides the correct config value/type\n } else {\n this.traceInitMaxIdent = 0\n this.traceInitPerf = DEFAULT_PARSER_CONFIG.traceInitPerf\n }\n this.traceInitIndent = -1\n }\n TRACE_INIT(phaseDesc, phaseImpl) {\n // No need to optimize this using NOOP pattern because\n // It is not called in a hot spot...\n if (this.traceInitPerf === true) {\n this.traceInitIndent++\n const indent = new Array(this.traceInitIndent + 1).join('\\t')\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n console.log(`${indent}--> <${phaseDesc}>`)\n }\n const { time, value } = timer(phaseImpl)\n /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */\n const traceMethod = time > 10 ? console.warn : console.log\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`)\n }\n this.traceInitIndent--\n return value\n } else {\n return phaseImpl()\n }\n }\n }\n\n function applyMixins(derivedCtor, baseCtors) {\n baseCtors.forEach((baseCtor) => {\n const baseProto = baseCtor.prototype\n Object.getOwnPropertyNames(baseProto).forEach((propName) => {\n if (propName === 'constructor') {\n return\n }\n const basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName)\n // Handle Accessors\n if (basePropDescriptor && (basePropDescriptor.get || basePropDescriptor.set)) {\n Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor)\n } else {\n derivedCtor.prototype[propName] = baseCtor.prototype[propName]\n }\n })\n })\n }\n\n const END_OF_FILE = createTokenInstance(EOF, '', NaN, NaN, NaN, NaN, NaN, NaN)\n Object.freeze(END_OF_FILE)\n const DEFAULT_PARSER_CONFIG = Object.freeze({\n recoveryEnabled: false,\n maxLookahead: 3,\n dynamicTokensEnabled: false,\n outputCst: true,\n errorMessageProvider: defaultParserErrorProvider,\n nodeLocationTracking: 'none',\n traceInitPerf: false,\n skipValidations: false,\n })\n const DEFAULT_RULE_CONFIG = Object.freeze({\n recoveryValueFunc: () => undefined,\n resyncEnabled: true,\n })\n var ParserDefinitionErrorType\n ;(function (ParserDefinitionErrorType) {\n ParserDefinitionErrorType[(ParserDefinitionErrorType['INVALID_RULE_NAME'] = 0)] = 'INVALID_RULE_NAME'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['DUPLICATE_RULE_NAME'] = 1)] = 'DUPLICATE_RULE_NAME'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['INVALID_RULE_OVERRIDE'] = 2)] = 'INVALID_RULE_OVERRIDE'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['DUPLICATE_PRODUCTIONS'] = 3)] = 'DUPLICATE_PRODUCTIONS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['UNRESOLVED_SUBRULE_REF'] = 4)] = 'UNRESOLVED_SUBRULE_REF'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['LEFT_RECURSION'] = 5)] = 'LEFT_RECURSION'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['NONE_LAST_EMPTY_ALT'] = 6)] = 'NONE_LAST_EMPTY_ALT'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['AMBIGUOUS_ALTS'] = 7)] = 'AMBIGUOUS_ALTS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['CONFLICT_TOKENS_RULES_NAMESPACE'] = 8)] =\n 'CONFLICT_TOKENS_RULES_NAMESPACE'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['INVALID_TOKEN_NAME'] = 9)] = 'INVALID_TOKEN_NAME'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['NO_NON_EMPTY_LOOKAHEAD'] = 10)] = 'NO_NON_EMPTY_LOOKAHEAD'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['AMBIGUOUS_PREFIX_ALTS'] = 11)] = 'AMBIGUOUS_PREFIX_ALTS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['TOO_MANY_ALTS'] = 12)] = 'TOO_MANY_ALTS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['CUSTOM_LOOKAHEAD_VALIDATION'] = 13)] =\n 'CUSTOM_LOOKAHEAD_VALIDATION'\n })(ParserDefinitionErrorType || (ParserDefinitionErrorType = {}))\n class Parser {\n /**\n * @deprecated use the **instance** method with the same name instead\n */\n static performSelfAnalysis(parserInstance) {\n throw Error(\n 'The **static** `performSelfAnalysis` method has been deprecated.' +\n '\\t\\nUse the **instance** method with the same name instead.',\n )\n }\n performSelfAnalysis() {\n this.TRACE_INIT('performSelfAnalysis', () => {\n let defErrorsMsgs\n this.selfAnalysisDone = true\n const className = this.className\n this.TRACE_INIT('toFastProps', () => {\n // Without this voodoo magic the parser would be x3-x4 slower\n // It seems it is better to invoke `toFastProperties` **before**\n // Any manipulations of the `this` object done during the recording phase.\n toFastProperties(this)\n })\n this.TRACE_INIT('Grammar Recording', () => {\n try {\n this.enableRecording()\n // Building the GAST\n forEach(this.definedRulesNames, (currRuleName) => {\n const wrappedRule = this[currRuleName]\n const originalGrammarAction = wrappedRule['originalGrammarAction']\n let recordedRuleGast\n this.TRACE_INIT(`${currRuleName} Rule`, () => {\n recordedRuleGast = this.topLevelRuleRecord(currRuleName, originalGrammarAction)\n })\n this.gastProductionsCache[currRuleName] = recordedRuleGast\n })\n } finally {\n this.disableRecording()\n }\n })\n let resolverErrors = []\n this.TRACE_INIT('Grammar Resolving', () => {\n resolverErrors = resolveGrammar({\n rules: values(this.gastProductionsCache),\n })\n this.definitionErrors = this.definitionErrors.concat(resolverErrors)\n })\n this.TRACE_INIT('Grammar Validations', () => {\n // only perform additional grammar validations IFF no resolving errors have occurred.\n // as unresolved grammar may lead to unhandled runtime exceptions in the follow up validations.\n if (isEmpty(resolverErrors) && this.skipValidations === false) {\n const validationErrors = validateGrammar({\n rules: values(this.gastProductionsCache),\n tokenTypes: values(this.tokensMap),\n errMsgProvider: defaultGrammarValidatorErrorProvider,\n grammarName: className,\n })\n const lookaheadValidationErrors = validateLookahead({\n lookaheadStrategy: this.lookaheadStrategy,\n rules: values(this.gastProductionsCache),\n tokenTypes: values(this.tokensMap),\n grammarName: className,\n })\n this.definitionErrors = this.definitionErrors.concat(validationErrors, lookaheadValidationErrors)\n }\n })\n // this analysis may fail if the grammar is not perfectly valid\n if (isEmpty(this.definitionErrors)) {\n // The results of these computations are not needed unless error recovery is enabled.\n if (this.recoveryEnabled) {\n this.TRACE_INIT('computeAllProdsFollows', () => {\n const allFollows = computeAllProdsFollows(values(this.gastProductionsCache))\n this.resyncFollows = allFollows\n })\n }\n this.TRACE_INIT('ComputeLookaheadFunctions', () => {\n var _a, _b\n ;(_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0\n ? void 0\n : _b.call(_a, {\n rules: values(this.gastProductionsCache),\n })\n this.preComputeLookaheadFunctions(values(this.gastProductionsCache))\n })\n }\n if (!Parser.DEFER_DEFINITION_ERRORS_HANDLING && !isEmpty(this.definitionErrors)) {\n defErrorsMsgs = map(this.definitionErrors, (defError) => defError.message)\n throw new Error(\n `Parser Definition Errors detected:\\n ${defErrorsMsgs.join('\\n-------------------------------\\n')}`,\n )\n }\n })\n }\n constructor(tokenVocabulary, config) {\n this.definitionErrors = []\n this.selfAnalysisDone = false\n const that = this\n that.initErrorHandler(config)\n that.initLexerAdapter()\n that.initLooksAhead(config)\n that.initRecognizerEngine(tokenVocabulary, config)\n that.initRecoverable(config)\n that.initTreeBuilder(config)\n that.initContentAssist()\n that.initGastRecorder(config)\n that.initPerformanceTracer(config)\n if (has(config, 'ignoredIssues')) {\n throw new Error(\n 'The IParserConfig property has been deprecated.\\n\\t' +\n 'Please use the flag on the relevant DSL method instead.\\n\\t' +\n 'See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\\n\\t' +\n 'For further details.',\n )\n }\n this.skipValidations = has(config, 'skipValidations')\n ? config.skipValidations // casting assumes the end user passing the correct type\n : DEFAULT_PARSER_CONFIG.skipValidations\n }\n }\n // Set this flag to true if you don't want the Parser to throw error when problems in it's definition are detected.\n // (normally during the parser's constructor).\n // This is a design time flag, it will not affect the runtime error handling of the parser, just design time errors,\n // for example: duplicate rule names, referencing an unresolved subrule, ect...\n // This flag should not be enabled during normal usage, it is used in special situations, for example when\n // needing to display the parser definition errors in some GUI(online playground).\n Parser.DEFER_DEFINITION_ERRORS_HANDLING = false\n applyMixins(Parser, [\n Recoverable,\n LooksAhead,\n TreeBuilder,\n LexerAdapter,\n RecognizerEngine,\n RecognizerApi,\n ErrorHandler,\n ContentAssist,\n GastRecorder,\n PerformanceTracer,\n ])\n class CstParser extends Parser {\n constructor(tokenVocabulary, config = DEFAULT_PARSER_CONFIG) {\n const configClone = clone(config)\n configClone.outputCst = true\n super(tokenVocabulary, configClone)\n }\n }\n\n return { CstParser, Lexer, createToken }\n})()\n\nexport { CstParser, Lexer, createToken }\n", "/**\n * @author Deepkolos / https://github.com/deepkolos\n */\n\nexport class WorkerPool {\n constructor(pool = 4) {\n this.pool = pool\n this.queue = []\n this.workers = []\n this.workersResolve = []\n this.workerStatus = 0\n }\n\n _initWorker(workerId) {\n if (!this.workers[workerId]) {\n const worker = this.workerCreator()\n worker.addEventListener('message', this._onMessage.bind(this, workerId))\n this.workers[workerId] = worker\n }\n }\n\n _getIdleWorker() {\n for (let i = 0; i < this.pool; i++) if (!(this.workerStatus & (1 << i))) return i\n\n return -1\n }\n\n _onMessage(workerId, msg) {\n const resolve = this.workersResolve[workerId]\n resolve && resolve(msg)\n\n if (this.queue.length) {\n const { resolve, msg, transfer } = this.queue.shift()\n this.workersResolve[workerId] = resolve\n this.workers[workerId].postMessage(msg, transfer)\n } else {\n this.workerStatus ^= 1 << workerId\n }\n }\n\n setWorkerCreator(workerCreator) {\n this.workerCreator = workerCreator\n }\n\n setWorkerLimit(pool) {\n this.pool = pool\n }\n\n postMessage(msg, transfer) {\n return new Promise((resolve) => {\n const workerId = this._getIdleWorker()\n\n if (workerId !== -1) {\n this._initWorker(workerId)\n this.workerStatus |= 1 << workerId\n this.workersResolve[workerId] = resolve\n this.workers[workerId].postMessage(msg, transfer)\n } else {\n this.queue.push({ resolve, msg, transfer })\n }\n })\n }\n\n dispose() {\n this.workers.forEach((worker) => worker.terminate())\n this.workersResolve.length = 0\n this.workers.length = 0\n this.queue.length = 0\n this.workerStatus = 0\n }\n}\n", "///////////////////////////////////////////////////\n// KTX2 Header.\n///////////////////////////////////////////////////\nconst KHR_SUPERCOMPRESSION_NONE = 0\nconst KHR_SUPERCOMPRESSION_BASISLZ = 1\nconst KHR_SUPERCOMPRESSION_ZSTD = 2\nconst KHR_SUPERCOMPRESSION_ZLIB = 3 ///////////////////////////////////////////////////\n// Data Format Descriptor (DFD).\n///////////////////////////////////////////////////\n\nconst KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = 0\nconst KHR_DF_VENDORID_KHRONOS = 0\nconst KHR_DF_VERSION = 2\nconst KHR_DF_MODEL_UNSPECIFIED = 0\nconst KHR_DF_MODEL_RGBSDA = 1 // ...\n\nconst KHR_DF_MODEL_ETC1 = 160\nconst KHR_DF_MODEL_ETC2 = 161\nconst KHR_DF_MODEL_ASTC = 162\nconst KHR_DF_MODEL_ETC1S = 163\nconst KHR_DF_MODEL_UASTC = 166\nconst KHR_DF_FLAG_ALPHA_STRAIGHT = 0\nconst KHR_DF_FLAG_ALPHA_PREMULTIPLIED = 1\nconst KHR_DF_TRANSFER_UNSPECIFIED = 0\nconst KHR_DF_TRANSFER_LINEAR = 1\nconst KHR_DF_TRANSFER_SRGB = 2\nconst KHR_DF_TRANSFER_ITU = 3\nconst KHR_DF_TRANSFER_NTSC = 4\nconst KHR_DF_TRANSFER_SLOG = 5\nconst KHR_DF_TRANSFER_SLOG2 = 6\nconst KHR_DF_TRANSFER_BT1886 = 7\nconst KHR_DF_TRANSFER_HLG_OETF = 8\nconst KHR_DF_TRANSFER_HLG_EOTF = 9\nconst KHR_DF_TRANSFER_PQ_EOTF = 10\nconst KHR_DF_TRANSFER_PQ_OETF = 11\nconst KHR_DF_TRANSFER_DCIP3 = 12\nconst KHR_DF_TRANSFER_PAL_OETF = 13\nconst KHR_DF_TRANSFER_PAL625_EOTF = 14\nconst KHR_DF_TRANSFER_ST240 = 15\nconst KHR_DF_TRANSFER_ACESCC = 16\nconst KHR_DF_TRANSFER_ACESCCT = 17\nconst KHR_DF_TRANSFER_ADOBERGB = 18\nconst KHR_DF_PRIMARIES_UNSPECIFIED = 0\nconst KHR_DF_PRIMARIES_BT709 = 1\nconst KHR_DF_PRIMARIES_BT601_EBU = 2\nconst KHR_DF_PRIMARIES_BT601_SMPTE = 3\nconst KHR_DF_PRIMARIES_BT2020 = 4\nconst KHR_DF_PRIMARIES_CIEXYZ = 5\nconst KHR_DF_PRIMARIES_ACES = 6\nconst KHR_DF_PRIMARIES_ACESCC = 7\nconst KHR_DF_PRIMARIES_NTSC1953 = 8\nconst KHR_DF_PRIMARIES_PAL525 = 9\nconst KHR_DF_PRIMARIES_DISPLAYP3 = 10\nconst KHR_DF_PRIMARIES_ADOBERGB = 11\nconst KHR_DF_CHANNEL_RGBSDA_RED = 0\nconst KHR_DF_CHANNEL_RGBSDA_GREEN = 1\nconst KHR_DF_CHANNEL_RGBSDA_BLUE = 2\nconst KHR_DF_CHANNEL_RGBSDA_STENCIL = 13\nconst KHR_DF_CHANNEL_RGBSDA_DEPTH = 14\nconst KHR_DF_CHANNEL_RGBSDA_ALPHA = 15\nconst KHR_DF_SAMPLE_DATATYPE_FLOAT = 0x80\nconst KHR_DF_SAMPLE_DATATYPE_SIGNED = 0x40\nconst KHR_DF_SAMPLE_DATATYPE_EXPONENT = 0x20\nconst KHR_DF_SAMPLE_DATATYPE_LINEAR = 0x10 ///////////////////////////////////////////////////\n// VK FORMAT.\n///////////////////////////////////////////////////\n\nconst VK_FORMAT_UNDEFINED = 0\nconst VK_FORMAT_R4G4_UNORM_PACK8 = 1\nconst VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2\nconst VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3\nconst VK_FORMAT_R5G6B5_UNORM_PACK16 = 4\nconst VK_FORMAT_B5G6R5_UNORM_PACK16 = 5\nconst VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6\nconst VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7\nconst VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8\nconst VK_FORMAT_R8_UNORM = 9\nconst VK_FORMAT_R8_SNORM = 10\nconst VK_FORMAT_R8_UINT = 13\nconst VK_FORMAT_R8_SINT = 14\nconst VK_FORMAT_R8_SRGB = 15\nconst VK_FORMAT_R8G8_UNORM = 16\nconst VK_FORMAT_R8G8_SNORM = 17\nconst VK_FORMAT_R8G8_UINT = 20\nconst VK_FORMAT_R8G8_SINT = 21\nconst VK_FORMAT_R8G8_SRGB = 22\nconst VK_FORMAT_R8G8B8_UNORM = 23\nconst VK_FORMAT_R8G8B8_SNORM = 24\nconst VK_FORMAT_R8G8B8_UINT = 27\nconst VK_FORMAT_R8G8B8_SINT = 28\nconst VK_FORMAT_R8G8B8_SRGB = 29\nconst VK_FORMAT_B8G8R8_UNORM = 30\nconst VK_FORMAT_B8G8R8_SNORM = 31\nconst VK_FORMAT_B8G8R8_UINT = 34\nconst VK_FORMAT_B8G8R8_SINT = 35\nconst VK_FORMAT_B8G8R8_SRGB = 36\nconst VK_FORMAT_R8G8B8A8_UNORM = 37\nconst VK_FORMAT_R8G8B8A8_SNORM = 38\nconst VK_FORMAT_R8G8B8A8_UINT = 41\nconst VK_FORMAT_R8G8B8A8_SINT = 42\nconst VK_FORMAT_R8G8B8A8_SRGB = 43\nconst VK_FORMAT_B8G8R8A8_UNORM = 44\nconst VK_FORMAT_B8G8R8A8_SNORM = 45\nconst VK_FORMAT_B8G8R8A8_UINT = 48\nconst VK_FORMAT_B8G8R8A8_SINT = 49\nconst VK_FORMAT_B8G8R8A8_SRGB = 50\nconst VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58\nconst VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59\nconst VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62\nconst VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63\nconst VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64\nconst VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65\nconst VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68\nconst VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69\nconst VK_FORMAT_R16_UNORM = 70\nconst VK_FORMAT_R16_SNORM = 71\nconst VK_FORMAT_R16_UINT = 74\nconst VK_FORMAT_R16_SINT = 75\nconst VK_FORMAT_R16_SFLOAT = 76\nconst VK_FORMAT_R16G16_UNORM = 77\nconst VK_FORMAT_R16G16_SNORM = 78\nconst VK_FORMAT_R16G16_UINT = 81\nconst VK_FORMAT_R16G16_SINT = 82\nconst VK_FORMAT_R16G16_SFLOAT = 83\nconst VK_FORMAT_R16G16B16_UNORM = 84\nconst VK_FORMAT_R16G16B16_SNORM = 85\nconst VK_FORMAT_R16G16B16_UINT = 88\nconst VK_FORMAT_R16G16B16_SINT = 89\nconst VK_FORMAT_R16G16B16_SFLOAT = 90\nconst VK_FORMAT_R16G16B16A16_UNORM = 91\nconst VK_FORMAT_R16G16B16A16_SNORM = 92\nconst VK_FORMAT_R16G16B16A16_UINT = 95\nconst VK_FORMAT_R16G16B16A16_SINT = 96\nconst VK_FORMAT_R16G16B16A16_SFLOAT = 97\nconst VK_FORMAT_R32_UINT = 98\nconst VK_FORMAT_R32_SINT = 99\nconst VK_FORMAT_R32_SFLOAT = 100\nconst VK_FORMAT_R32G32_UINT = 101\nconst VK_FORMAT_R32G32_SINT = 102\nconst VK_FORMAT_R32G32_SFLOAT = 103\nconst VK_FORMAT_R32G32B32_UINT = 104\nconst VK_FORMAT_R32G32B32_SINT = 105\nconst VK_FORMAT_R32G32B32_SFLOAT = 106\nconst VK_FORMAT_R32G32B32A32_UINT = 107\nconst VK_FORMAT_R32G32B32A32_SINT = 108\nconst VK_FORMAT_R32G32B32A32_SFLOAT = 109\nconst VK_FORMAT_R64_UINT = 110\nconst VK_FORMAT_R64_SINT = 111\nconst VK_FORMAT_R64_SFLOAT = 112\nconst VK_FORMAT_R64G64_UINT = 113\nconst VK_FORMAT_R64G64_SINT = 114\nconst VK_FORMAT_R64G64_SFLOAT = 115\nconst VK_FORMAT_R64G64B64_UINT = 116\nconst VK_FORMAT_R64G64B64_SINT = 117\nconst VK_FORMAT_R64G64B64_SFLOAT = 118\nconst VK_FORMAT_R64G64B64A64_UINT = 119\nconst VK_FORMAT_R64G64B64A64_SINT = 120\nconst VK_FORMAT_R64G64B64A64_SFLOAT = 121\nconst VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122\nconst VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123\nconst VK_FORMAT_D16_UNORM = 124\nconst VK_FORMAT_X8_D24_UNORM_PACK32 = 125\nconst VK_FORMAT_D32_SFLOAT = 126\nconst VK_FORMAT_S8_UINT = 127\nconst VK_FORMAT_D16_UNORM_S8_UINT = 128\nconst VK_FORMAT_D24_UNORM_S8_UINT = 129\nconst VK_FORMAT_D32_SFLOAT_S8_UINT = 130\nconst VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131\nconst VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132\nconst VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133\nconst VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134\nconst VK_FORMAT_BC2_UNORM_BLOCK = 135\nconst VK_FORMAT_BC2_SRGB_BLOCK = 136\nconst VK_FORMAT_BC3_UNORM_BLOCK = 137\nconst VK_FORMAT_BC3_SRGB_BLOCK = 138\nconst VK_FORMAT_BC4_UNORM_BLOCK = 139\nconst VK_FORMAT_BC4_SNORM_BLOCK = 140\nconst VK_FORMAT_BC5_UNORM_BLOCK = 141\nconst VK_FORMAT_BC5_SNORM_BLOCK = 142\nconst VK_FORMAT_BC6H_UFLOAT_BLOCK = 143\nconst VK_FORMAT_BC6H_SFLOAT_BLOCK = 144\nconst VK_FORMAT_BC7_UNORM_BLOCK = 145\nconst VK_FORMAT_BC7_SRGB_BLOCK = 146\nconst VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147\nconst VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148\nconst VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149\nconst VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150\nconst VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151\nconst VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152\nconst VK_FORMAT_EAC_R11_UNORM_BLOCK = 153\nconst VK_FORMAT_EAC_R11_SNORM_BLOCK = 154\nconst VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155\nconst VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156\nconst VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157\nconst VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158\nconst VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159\nconst VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160\nconst VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161\nconst VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162\nconst VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163\nconst VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164\nconst VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165\nconst VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166\nconst VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167\nconst VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168\nconst VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169\nconst VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170\nconst VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171\nconst VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172\nconst VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173\nconst VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174\nconst VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175\nconst VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176\nconst VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177\nconst VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178\nconst VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179\nconst VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180\nconst VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181\nconst VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182\nconst VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183\nconst VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184\nconst VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007\nconst VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008\nconst VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009\nconst VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010\nconst VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011\nconst VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017\nconst VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018\nconst VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019\nconst VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020\nconst VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021\nconst VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000\nconst VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001\nconst VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002\nconst VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003\nconst VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004\nconst VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005\nconst VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006\nconst VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007\nconst VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = 1000066000\nconst VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = 1000066001\nconst VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = 1000066002\nconst VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = 1000066003\nconst VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = 1000066004\nconst VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = 1000066005\nconst VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = 1000066006\nconst VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = 1000066007\nconst VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = 1000066008\nconst VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = 1000066009\nconst VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = 1000066010\nconst VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = 1000066011\nconst VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = 1000066012\nconst VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = 1000066013\nconst VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = 1000340000\nconst VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = 1000340001\n\n/**\n * Represents an unpacked KTX 2.0 texture container. Data for individual mip levels are stored in\n * the `.levels` array, typically compressed in Basis Universal formats. Additional properties\n * provide metadata required to process, transcode, and upload these textures.\n */\n\nclass KTX2Container {\n constructor() {\n this.vkFormat = VK_FORMAT_UNDEFINED\n this.typeSize = 1\n this.pixelWidth = 0\n this.pixelHeight = 0\n this.pixelDepth = 0\n this.layerCount = 0\n this.faceCount = 1\n this.supercompressionScheme = KHR_SUPERCOMPRESSION_NONE\n this.levels = []\n this.dataFormatDescriptor = [\n {\n vendorId: KHR_DF_VENDORID_KHRONOS,\n descriptorType: KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,\n descriptorBlockSize: 0,\n versionNumber: KHR_DF_VERSION,\n colorModel: KHR_DF_MODEL_UNSPECIFIED,\n colorPrimaries: KHR_DF_PRIMARIES_BT709,\n transferFunction: KHR_DF_TRANSFER_SRGB,\n flags: KHR_DF_FLAG_ALPHA_STRAIGHT,\n texelBlockDimension: [0, 0, 0, 0],\n bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0],\n samples: [],\n },\n ]\n this.keyValue = {}\n this.globalData = null\n }\n}\n\nclass BufferReader {\n constructor(data, byteOffset, byteLength, littleEndian) {\n this._dataView = void 0\n this._littleEndian = void 0\n this._offset = void 0\n this._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength)\n this._littleEndian = littleEndian\n this._offset = 0\n }\n\n _nextUint8() {\n const value = this._dataView.getUint8(this._offset)\n\n this._offset += 1\n return value\n }\n\n _nextUint16() {\n const value = this._dataView.getUint16(this._offset, this._littleEndian)\n\n this._offset += 2\n return value\n }\n\n _nextUint32() {\n const value = this._dataView.getUint32(this._offset, this._littleEndian)\n\n this._offset += 4\n return value\n }\n\n _nextUint64() {\n const left = this._dataView.getUint32(this._offset, this._littleEndian)\n\n const right = this._dataView.getUint32(this._offset + 4, this._littleEndian) // TODO(cleanup): Just test this...\n // const value = this._littleEndian ? left + (2 ** 32 * right) : (2 ** 32 * left) + right;\n\n const value = left + 2 ** 32 * right\n this._offset += 8\n return value\n }\n\n _nextInt32() {\n const value = this._dataView.getInt32(this._offset, this._littleEndian)\n\n this._offset += 4\n return value\n }\n\n _nextUint8Array(len) {\n const value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._offset, len)\n this._offset += len\n return value\n }\n\n _skip(bytes) {\n this._offset += bytes\n return this\n }\n\n _scan(maxByteLength, term) {\n if (term === void 0) {\n term = 0x00\n }\n\n const byteOffset = this._offset\n let byteLength = 0\n\n while (this._dataView.getUint8(this._offset) !== term && byteLength < maxByteLength) {\n byteLength++\n this._offset++\n }\n\n if (byteLength < maxByteLength) this._offset++\n return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength)\n }\n}\n\n///////////////////////////////////////////////////\n// Common.\n///////////////////////////////////////////////////\nconst KTX_WRITER = 'KTX-Parse v' + '0.6.0'\nconst NUL = new Uint8Array([0x00]) ///////////////////////////////////////////////////\n// KTX2 Header.\n///////////////////////////////////////////////////\n\nconst KTX2_ID = [\n // '´', 'K', 'T', 'X', '2', '0', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n 0xab,\n 0x4b,\n 0x54,\n 0x58,\n 0x20,\n 0x32,\n 0x30,\n 0xbb,\n 0x0d,\n 0x0a,\n 0x1a,\n 0x0a,\n]\nconst HEADER_BYTE_LENGTH = 68 // 13 * 4 + 2 * 8\n\n/** Encodes text to an ArrayBuffer. */\nfunction encodeText(text) {\n if (typeof TextEncoder !== 'undefined') {\n return new TextEncoder().encode(text)\n }\n\n return Buffer.from(text)\n}\n/** Decodes an ArrayBuffer to text. */\n\nfunction decodeText(buffer) {\n if (typeof TextDecoder !== 'undefined') {\n return new TextDecoder().decode(buffer)\n }\n\n return Buffer.from(buffer).toString('utf8')\n}\n/** Concatenates N ArrayBuffers. */\n\nfunction concat(buffers) {\n let totalByteLength = 0\n\n for (const buffer of buffers) {\n totalByteLength += buffer.byteLength\n }\n\n const result = new Uint8Array(totalByteLength)\n let byteOffset = 0\n\n for (const buffer of buffers) {\n result.set(new Uint8Array(buffer), byteOffset)\n byteOffset += buffer.byteLength\n }\n\n return result\n}\n\n/**\n * Parses a KTX 2.0 file, returning an unpacked {@link KTX2Container} instance with all associated\n * data. The container's mip levels and other binary data are pointers into the original file, not\n * copies, so the original file should not be overwritten after reading.\n *\n * @param data Bytes of KTX 2.0 file, as Uint8Array or Buffer.\n */\n\nfunction read(data) {\n ///////////////////////////////////////////////////\n // KTX 2.0 Identifier.\n ///////////////////////////////////////////////////\n const id = new Uint8Array(data.buffer, data.byteOffset, KTX2_ID.length)\n\n if (\n id[0] !== KTX2_ID[0] || // '´'\n id[1] !== KTX2_ID[1] || // 'K'\n id[2] !== KTX2_ID[2] || // 'T'\n id[3] !== KTX2_ID[3] || // 'X'\n id[4] !== KTX2_ID[4] || // ' '\n id[5] !== KTX2_ID[5] || // '2'\n id[6] !== KTX2_ID[6] || // '0'\n id[7] !== KTX2_ID[7] || // 'ª'\n id[8] !== KTX2_ID[8] || // '\\r'\n id[9] !== KTX2_ID[9] || // '\\n'\n id[10] !== KTX2_ID[10] || // '\\x1A'\n id[11] !== KTX2_ID[11] // '\\n'\n ) {\n throw new Error('Missing KTX 2.0 identifier.')\n }\n\n const container = new KTX2Container() ///////////////////////////////////////////////////\n // Header.\n ///////////////////////////////////////////////////\n\n const headerByteLength = 17 * Uint32Array.BYTES_PER_ELEMENT\n const headerReader = new BufferReader(data, KTX2_ID.length, headerByteLength, true)\n container.vkFormat = headerReader._nextUint32()\n container.typeSize = headerReader._nextUint32()\n container.pixelWidth = headerReader._nextUint32()\n container.pixelHeight = headerReader._nextUint32()\n container.pixelDepth = headerReader._nextUint32()\n container.layerCount = headerReader._nextUint32()\n container.faceCount = headerReader._nextUint32()\n\n const levelCount = headerReader._nextUint32()\n\n container.supercompressionScheme = headerReader._nextUint32()\n\n const dfdByteOffset = headerReader._nextUint32()\n\n const dfdByteLength = headerReader._nextUint32()\n\n const kvdByteOffset = headerReader._nextUint32()\n\n const kvdByteLength = headerReader._nextUint32()\n\n const sgdByteOffset = headerReader._nextUint64()\n\n const sgdByteLength = headerReader._nextUint64() ///////////////////////////////////////////////////\n // Level Index.\n ///////////////////////////////////////////////////\n\n const levelByteLength = levelCount * 3 * 8\n const levelReader = new BufferReader(data, KTX2_ID.length + headerByteLength, levelByteLength, true)\n\n for (let i = 0; i < levelCount; i++) {\n container.levels.push({\n levelData: new Uint8Array(data.buffer, data.byteOffset + levelReader._nextUint64(), levelReader._nextUint64()),\n uncompressedByteLength: levelReader._nextUint64(),\n })\n } ///////////////////////////////////////////////////\n // Data Format Descriptor (DFD).\n ///////////////////////////////////////////////////\n\n const dfdReader = new BufferReader(data, dfdByteOffset, dfdByteLength, true)\n const dfd = {\n vendorId: dfdReader\n ._skip(\n 4,\n /* totalSize */\n )\n ._nextUint16(),\n descriptorType: dfdReader._nextUint16(),\n versionNumber: dfdReader._nextUint16(),\n descriptorBlockSize: dfdReader._nextUint16(),\n colorModel: dfdReader._nextUint8(),\n colorPrimaries: dfdReader._nextUint8(),\n transferFunction: dfdReader._nextUint8(),\n flags: dfdReader._nextUint8(),\n texelBlockDimension: [\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n ],\n bytesPlane: [\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n ],\n samples: [],\n }\n const sampleStart = 6\n const sampleWords = 4\n const numSamples = (dfd.descriptorBlockSize / 4 - sampleStart) / sampleWords\n\n for (let i = 0; i < numSamples; i++) {\n const sample = {\n bitOffset: dfdReader._nextUint16(),\n bitLength: dfdReader._nextUint8(),\n channelType: dfdReader._nextUint8(),\n samplePosition: [dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8()],\n sampleLower: -Infinity,\n sampleUpper: Infinity,\n }\n\n if (sample.channelType & KHR_DF_SAMPLE_DATATYPE_SIGNED) {\n sample.sampleLower = dfdReader._nextInt32()\n sample.sampleUpper = dfdReader._nextInt32()\n } else {\n sample.sampleLower = dfdReader._nextUint32()\n sample.sampleUpper = dfdReader._nextUint32()\n }\n\n dfd.samples[i] = sample\n }\n\n container.dataFormatDescriptor.length = 0\n container.dataFormatDescriptor.push(dfd) ///////////////////////////////////////////////////\n // Key/Value Data (KVD).\n ///////////////////////////////////////////////////\n\n const kvdReader = new BufferReader(data, kvdByteOffset, kvdByteLength, true)\n\n while (kvdReader._offset < kvdByteLength) {\n const keyValueByteLength = kvdReader._nextUint32()\n\n const keyData = kvdReader._scan(keyValueByteLength)\n\n const key = decodeText(keyData)\n container.keyValue[key] = kvdReader._nextUint8Array(keyValueByteLength - keyData.byteLength - 1)\n\n if (key.match(/^ktx/i)) {\n const text = decodeText(container.keyValue[key])\n container.keyValue[key] = text.substring(0, text.lastIndexOf('\\x00'))\n }\n\n const kvPadding = keyValueByteLength % 4 ? 4 - (keyValueByteLength % 4) : 0 // align(4)\n // 4-byte alignment.\n\n kvdReader._skip(kvPadding)\n } ///////////////////////////////////////////////////\n // Supercompression Global Data (SGD).\n ///////////////////////////////////////////////////\n\n if (sgdByteLength <= 0) return container\n const sgdReader = new BufferReader(data, sgdByteOffset, sgdByteLength, true)\n\n const endpointCount = sgdReader._nextUint16()\n\n const selectorCount = sgdReader._nextUint16()\n\n const endpointsByteLength = sgdReader._nextUint32()\n\n const selectorsByteLength = sgdReader._nextUint32()\n\n const tablesByteLength = sgdReader._nextUint32()\n\n const extendedByteLength = sgdReader._nextUint32()\n\n const imageDescs = []\n\n for (let i = 0; i < levelCount; i++) {\n imageDescs.push({\n imageFlags: sgdReader._nextUint32(),\n rgbSliceByteOffset: sgdReader._nextUint32(),\n rgbSliceByteLength: sgdReader._nextUint32(),\n alphaSliceByteOffset: sgdReader._nextUint32(),\n alphaSliceByteLength: sgdReader._nextUint32(),\n })\n }\n\n const endpointsByteOffset = sgdByteOffset + sgdReader._offset\n const selectorsByteOffset = endpointsByteOffset + endpointsByteLength\n const tablesByteOffset = selectorsByteOffset + selectorsByteLength\n const extendedByteOffset = tablesByteOffset + tablesByteLength\n const endpointsData = new Uint8Array(data.buffer, data.byteOffset + endpointsByteOffset, endpointsByteLength)\n const selectorsData = new Uint8Array(data.buffer, data.byteOffset + selectorsByteOffset, selectorsByteLength)\n const tablesData = new Uint8Array(data.buffer, data.byteOffset + tablesByteOffset, tablesByteLength)\n const extendedData = new Uint8Array(data.buffer, data.byteOffset + extendedByteOffset, extendedByteLength)\n container.globalData = {\n endpointCount,\n selectorCount,\n imageDescs,\n endpointsData,\n selectorsData,\n tablesData,\n extendedData,\n }\n return container\n}\n\nconst DEFAULT_OPTIONS = {\n keepWriter: false,\n}\n/**\n * Serializes a {@link KTX2Container} instance to a KTX 2.0 file. Mip levels and other binary data\n * are copied into the resulting Uint8Array, so the original container can safely be edited or\n * destroyed after it is serialized.\n *\n * Options:\n * - keepWriter: If true, 'KTXWriter' key/value field is written as provided by the container.\n * \t\tOtherwise, a string for the current ktx-parse version is generated. Default: false.\n *\n * @param container\n * @param options\n */\n\nfunction write(container, options) {\n if (options === void 0) {\n options = {}\n }\n\n options = { ...DEFAULT_OPTIONS, ...options } ///////////////////////////////////////////////////\n // Supercompression Global Data (SGD).\n ///////////////////////////////////////////////////\n\n let sgdBuffer = new ArrayBuffer(0)\n\n if (container.globalData) {\n const sgdHeaderBuffer = new ArrayBuffer(20 + container.globalData.imageDescs.length * 5 * 4)\n const sgdHeaderView = new DataView(sgdHeaderBuffer)\n sgdHeaderView.setUint16(0, container.globalData.endpointCount, true)\n sgdHeaderView.setUint16(2, container.globalData.selectorCount, true)\n sgdHeaderView.setUint32(4, container.globalData.endpointsData.byteLength, true)\n sgdHeaderView.setUint32(8, container.globalData.selectorsData.byteLength, true)\n sgdHeaderView.setUint32(12, container.globalData.tablesData.byteLength, true)\n sgdHeaderView.setUint32(16, container.globalData.extendedData.byteLength, true)\n\n for (let i = 0; i < container.globalData.imageDescs.length; i++) {\n const imageDesc = container.globalData.imageDescs[i]\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 0, imageDesc.imageFlags, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 4, imageDesc.rgbSliceByteOffset, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 8, imageDesc.rgbSliceByteLength, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 12, imageDesc.alphaSliceByteOffset, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 16, imageDesc.alphaSliceByteLength, true)\n }\n\n sgdBuffer = concat([\n sgdHeaderBuffer,\n container.globalData.endpointsData,\n container.globalData.selectorsData,\n container.globalData.tablesData,\n container.globalData.extendedData,\n ])\n } ///////////////////////////////////////////////////\n // Key/Value Data (KVD).\n ///////////////////////////////////////////////////\n\n const keyValueData = []\n let keyValue = container.keyValue\n\n if (!options.keepWriter) {\n keyValue = { ...container.keyValue, KTXwriter: KTX_WRITER }\n }\n\n for (const key in keyValue) {\n const value = keyValue[key]\n const keyData = encodeText(key)\n const valueData = typeof value === 'string' ? concat([encodeText(value), NUL]) : value\n const kvByteLength = keyData.byteLength + 1 + valueData.byteLength\n const kvPadding = kvByteLength % 4 ? 4 - (kvByteLength % 4) : 0 // align(4)\n\n keyValueData.push(\n concat([\n new Uint32Array([kvByteLength]),\n keyData,\n NUL,\n valueData,\n new Uint8Array(kvPadding).fill(0x00), // align(4)\n ]),\n )\n }\n\n const kvdBuffer = concat(keyValueData) ///////////////////////////////////////////////////\n // Data Format Descriptor (DFD).\n ///////////////////////////////////////////////////\n\n if (\n container.dataFormatDescriptor.length !== 1 ||\n container.dataFormatDescriptor[0].descriptorType !== KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT\n ) {\n throw new Error('Only BASICFORMAT Data Format Descriptor output supported.')\n }\n\n const dfd = container.dataFormatDescriptor[0]\n const dfdBuffer = new ArrayBuffer(28 + dfd.samples.length * 16)\n const dfdView = new DataView(dfdBuffer)\n const descriptorBlockSize = 24 + dfd.samples.length * 16\n dfdView.setUint32(0, dfdBuffer.byteLength, true)\n dfdView.setUint16(4, dfd.vendorId, true)\n dfdView.setUint16(6, dfd.descriptorType, true)\n dfdView.setUint16(8, dfd.versionNumber, true)\n dfdView.setUint16(10, descriptorBlockSize, true)\n dfdView.setUint8(12, dfd.colorModel)\n dfdView.setUint8(13, dfd.colorPrimaries)\n dfdView.setUint8(14, dfd.transferFunction)\n dfdView.setUint8(15, dfd.flags)\n\n if (!Array.isArray(dfd.texelBlockDimension)) {\n throw new Error('texelBlockDimension is now an array. For dimensionality `d`, set `d - 1`.')\n }\n\n dfdView.setUint8(16, dfd.texelBlockDimension[0])\n dfdView.setUint8(17, dfd.texelBlockDimension[1])\n dfdView.setUint8(18, dfd.texelBlockDimension[2])\n dfdView.setUint8(19, dfd.texelBlockDimension[3])\n\n for (let i = 0; i < 8; i++) dfdView.setUint8(20 + i, dfd.bytesPlane[i])\n\n for (let i = 0; i < dfd.samples.length; i++) {\n const sample = dfd.samples[i]\n const sampleByteOffset = 28 + i * 16\n\n if (sample.channelID) {\n throw new Error('channelID has been renamed to channelType.')\n }\n\n dfdView.setUint16(sampleByteOffset + 0, sample.bitOffset, true)\n dfdView.setUint8(sampleByteOffset + 2, sample.bitLength)\n dfdView.setUint8(sampleByteOffset + 3, sample.channelType)\n dfdView.setUint8(sampleByteOffset + 4, sample.samplePosition[0])\n dfdView.setUint8(sampleByteOffset + 5, sample.samplePosition[1])\n dfdView.setUint8(sampleByteOffset + 6, sample.samplePosition[2])\n dfdView.setUint8(sampleByteOffset + 7, sample.samplePosition[3])\n\n if (sample.channelType & KHR_DF_SAMPLE_DATATYPE_SIGNED) {\n dfdView.setInt32(sampleByteOffset + 8, sample.sampleLower, true)\n dfdView.setInt32(sampleByteOffset + 12, sample.sampleUpper, true)\n } else {\n dfdView.setUint32(sampleByteOffset + 8, sample.sampleLower, true)\n dfdView.setUint32(sampleByteOffset + 12, sample.sampleUpper, true)\n }\n } ///////////////////////////////////////////////////\n // Data alignment.\n ///////////////////////////////////////////////////\n\n const dfdByteOffset = KTX2_ID.length + HEADER_BYTE_LENGTH + container.levels.length * 3 * 8\n const kvdByteOffset = dfdByteOffset + dfdBuffer.byteLength\n let sgdByteOffset = sgdBuffer.byteLength > 0 ? kvdByteOffset + kvdBuffer.byteLength : 0\n if (sgdByteOffset % 8) sgdByteOffset += 8 - (sgdByteOffset % 8) // align(8)\n ///////////////////////////////////////////////////\n // Level Index.\n ///////////////////////////////////////////////////\n\n const levelData = []\n const levelIndex = new DataView(new ArrayBuffer(container.levels.length * 3 * 8))\n let levelDataByteOffset = (sgdByteOffset || kvdByteOffset + kvdBuffer.byteLength) + sgdBuffer.byteLength\n\n for (let i = 0; i < container.levels.length; i++) {\n const level = container.levels[i]\n levelData.push(level.levelData)\n levelIndex.setBigUint64(i * 24 + 0, BigInt(levelDataByteOffset), true)\n levelIndex.setBigUint64(i * 24 + 8, BigInt(level.levelData.byteLength), true)\n levelIndex.setBigUint64(i * 24 + 16, BigInt(level.uncompressedByteLength), true)\n levelDataByteOffset += level.levelData.byteLength\n } ///////////////////////////////////////////////////\n // Header.\n ///////////////////////////////////////////////////\n\n const headerBuffer = new ArrayBuffer(HEADER_BYTE_LENGTH)\n const headerView = new DataView(headerBuffer)\n headerView.setUint32(0, container.vkFormat, true)\n headerView.setUint32(4, container.typeSize, true)\n headerView.setUint32(8, container.pixelWidth, true)\n headerView.setUint32(12, container.pixelHeight, true)\n headerView.setUint32(16, container.pixelDepth, true)\n headerView.setUint32(20, container.layerCount, true)\n headerView.setUint32(24, container.faceCount, true)\n headerView.setUint32(28, container.levels.length, true)\n headerView.setUint32(32, container.supercompressionScheme, true)\n headerView.setUint32(36, dfdByteOffset, true)\n headerView.setUint32(40, dfdBuffer.byteLength, true)\n headerView.setUint32(44, kvdByteOffset, true)\n headerView.setUint32(48, kvdBuffer.byteLength, true)\n headerView.setBigUint64(52, BigInt(sgdBuffer.byteLength > 0 ? sgdByteOffset : 0), true)\n headerView.setBigUint64(60, BigInt(sgdBuffer.byteLength), true) ///////////////////////////////////////////////////\n // Compose.\n ///////////////////////////////////////////////////\n\n return new Uint8Array(\n concat([\n new Uint8Array(KTX2_ID).buffer,\n headerBuffer,\n levelIndex.buffer,\n dfdBuffer,\n kvdBuffer,\n sgdByteOffset > 0\n ? new ArrayBuffer(sgdByteOffset - (kvdByteOffset + kvdBuffer.byteLength)) // align(8)\n : new ArrayBuffer(0),\n sgdBuffer,\n ...levelData,\n ]),\n )\n}\n\nexport {\n KHR_DF_CHANNEL_RGBSDA_ALPHA,\n KHR_DF_CHANNEL_RGBSDA_BLUE,\n KHR_DF_CHANNEL_RGBSDA_DEPTH,\n KHR_DF_CHANNEL_RGBSDA_GREEN,\n KHR_DF_CHANNEL_RGBSDA_RED,\n KHR_DF_CHANNEL_RGBSDA_STENCIL,\n KHR_DF_FLAG_ALPHA_PREMULTIPLIED,\n KHR_DF_FLAG_ALPHA_STRAIGHT,\n KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,\n KHR_DF_MODEL_ASTC,\n KHR_DF_MODEL_ETC1,\n KHR_DF_MODEL_ETC1S,\n KHR_DF_MODEL_ETC2,\n KHR_DF_MODEL_RGBSDA,\n KHR_DF_MODEL_UASTC,\n KHR_DF_MODEL_UNSPECIFIED,\n KHR_DF_PRIMARIES_ACES,\n KHR_DF_PRIMARIES_ACESCC,\n KHR_DF_PRIMARIES_ADOBERGB,\n KHR_DF_PRIMARIES_BT2020,\n KHR_DF_PRIMARIES_BT601_EBU,\n KHR_DF_PRIMARIES_BT601_SMPTE,\n KHR_DF_PRIMARIES_BT709,\n KHR_DF_PRIMARIES_CIEXYZ,\n KHR_DF_PRIMARIES_DISPLAYP3,\n KHR_DF_PRIMARIES_NTSC1953,\n KHR_DF_PRIMARIES_PAL525,\n KHR_DF_PRIMARIES_UNSPECIFIED,\n KHR_DF_SAMPLE_DATATYPE_EXPONENT,\n KHR_DF_SAMPLE_DATATYPE_FLOAT,\n KHR_DF_SAMPLE_DATATYPE_LINEAR,\n KHR_DF_SAMPLE_DATATYPE_SIGNED,\n KHR_DF_TRANSFER_ACESCC,\n KHR_DF_TRANSFER_ACESCCT,\n KHR_DF_TRANSFER_ADOBERGB,\n KHR_DF_TRANSFER_BT1886,\n KHR_DF_TRANSFER_DCIP3,\n KHR_DF_TRANSFER_HLG_EOTF,\n KHR_DF_TRANSFER_HLG_OETF,\n KHR_DF_TRANSFER_ITU,\n KHR_DF_TRANSFER_LINEAR,\n KHR_DF_TRANSFER_NTSC,\n KHR_DF_TRANSFER_PAL625_EOTF,\n KHR_DF_TRANSFER_PAL_OETF,\n KHR_DF_TRANSFER_PQ_EOTF,\n KHR_DF_TRANSFER_PQ_OETF,\n KHR_DF_TRANSFER_SLOG,\n KHR_DF_TRANSFER_SLOG2,\n KHR_DF_TRANSFER_SRGB,\n KHR_DF_TRANSFER_ST240,\n KHR_DF_TRANSFER_UNSPECIFIED,\n KHR_DF_VENDORID_KHRONOS,\n KHR_DF_VERSION,\n KHR_SUPERCOMPRESSION_BASISLZ,\n KHR_SUPERCOMPRESSION_NONE,\n KHR_SUPERCOMPRESSION_ZLIB,\n KHR_SUPERCOMPRESSION_ZSTD,\n KTX2Container,\n VK_FORMAT_A1R5G5B5_UNORM_PACK16,\n VK_FORMAT_A2B10G10R10_SINT_PACK32,\n VK_FORMAT_A2B10G10R10_SNORM_PACK32,\n VK_FORMAT_A2B10G10R10_UINT_PACK32,\n VK_FORMAT_A2B10G10R10_UNORM_PACK32,\n VK_FORMAT_A2R10G10B10_SINT_PACK32,\n VK_FORMAT_A2R10G10B10_SNORM_PACK32,\n VK_FORMAT_A2R10G10B10_UINT_PACK32,\n VK_FORMAT_A2R10G10B10_UNORM_PACK32,\n VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT,\n VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT,\n VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x10_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x10_UNORM_BLOCK,\n VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x6_UNORM_BLOCK,\n VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x8_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x8_UNORM_BLOCK,\n VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_12x10_SRGB_BLOCK,\n VK_FORMAT_ASTC_12x10_UNORM_BLOCK,\n VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_12x12_SRGB_BLOCK,\n VK_FORMAT_ASTC_12x12_UNORM_BLOCK,\n VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_4x4_SRGB_BLOCK,\n VK_FORMAT_ASTC_4x4_UNORM_BLOCK,\n VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_5x4_SRGB_BLOCK,\n VK_FORMAT_ASTC_5x4_UNORM_BLOCK,\n VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_5x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_5x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_6x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_6x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_6x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_6x6_UNORM_BLOCK,\n VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_8x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_8x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_8x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_8x6_UNORM_BLOCK,\n VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_8x8_SRGB_BLOCK,\n VK_FORMAT_ASTC_8x8_UNORM_BLOCK,\n VK_FORMAT_B10G11R11_UFLOAT_PACK32,\n VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16,\n VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16,\n VK_FORMAT_B4G4R4A4_UNORM_PACK16,\n VK_FORMAT_B5G5R5A1_UNORM_PACK16,\n VK_FORMAT_B5G6R5_UNORM_PACK16,\n VK_FORMAT_B8G8R8A8_SINT,\n VK_FORMAT_B8G8R8A8_SNORM,\n VK_FORMAT_B8G8R8A8_SRGB,\n VK_FORMAT_B8G8R8A8_UINT,\n VK_FORMAT_B8G8R8A8_UNORM,\n VK_FORMAT_B8G8R8_SINT,\n VK_FORMAT_B8G8R8_SNORM,\n VK_FORMAT_B8G8R8_SRGB,\n VK_FORMAT_B8G8R8_UINT,\n VK_FORMAT_B8G8R8_UNORM,\n VK_FORMAT_BC1_RGBA_SRGB_BLOCK,\n VK_FORMAT_BC1_RGBA_UNORM_BLOCK,\n VK_FORMAT_BC1_RGB_SRGB_BLOCK,\n VK_FORMAT_BC1_RGB_UNORM_BLOCK,\n VK_FORMAT_BC2_SRGB_BLOCK,\n VK_FORMAT_BC2_UNORM_BLOCK,\n VK_FORMAT_BC3_SRGB_BLOCK,\n VK_FORMAT_BC3_UNORM_BLOCK,\n VK_FORMAT_BC4_SNORM_BLOCK,\n VK_FORMAT_BC4_UNORM_BLOCK,\n VK_FORMAT_BC5_SNORM_BLOCK,\n VK_FORMAT_BC5_UNORM_BLOCK,\n VK_FORMAT_BC6H_SFLOAT_BLOCK,\n VK_FORMAT_BC6H_UFLOAT_BLOCK,\n VK_FORMAT_BC7_SRGB_BLOCK,\n VK_FORMAT_BC7_UNORM_BLOCK,\n VK_FORMAT_D16_UNORM,\n VK_FORMAT_D16_UNORM_S8_UINT,\n VK_FORMAT_D24_UNORM_S8_UINT,\n VK_FORMAT_D32_SFLOAT,\n VK_FORMAT_D32_SFLOAT_S8_UINT,\n VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,\n VK_FORMAT_EAC_R11G11_SNORM_BLOCK,\n VK_FORMAT_EAC_R11G11_UNORM_BLOCK,\n VK_FORMAT_EAC_R11_SNORM_BLOCK,\n VK_FORMAT_EAC_R11_UNORM_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,\n VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,\n VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,\n VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16,\n VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16,\n VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16,\n VK_FORMAT_R10X6G10X6_UNORM_2PACK16,\n VK_FORMAT_R10X6_UNORM_PACK16,\n VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16,\n VK_FORMAT_R12X4G12X4_UNORM_2PACK16,\n VK_FORMAT_R12X4_UNORM_PACK16,\n VK_FORMAT_R16G16B16A16_SFLOAT,\n VK_FORMAT_R16G16B16A16_SINT,\n VK_FORMAT_R16G16B16A16_SNORM,\n VK_FORMAT_R16G16B16A16_UINT,\n VK_FORMAT_R16G16B16A16_UNORM,\n VK_FORMAT_R16G16B16_SFLOAT,\n VK_FORMAT_R16G16B16_SINT,\n VK_FORMAT_R16G16B16_SNORM,\n VK_FORMAT_R16G16B16_UINT,\n VK_FORMAT_R16G16B16_UNORM,\n VK_FORMAT_R16G16_SFLOAT,\n VK_FORMAT_R16G16_SINT,\n VK_FORMAT_R16G16_SNORM,\n VK_FORMAT_R16G16_UINT,\n VK_FORMAT_R16G16_UNORM,\n VK_FORMAT_R16_SFLOAT,\n VK_FORMAT_R16_SINT,\n VK_FORMAT_R16_SNORM,\n VK_FORMAT_R16_UINT,\n VK_FORMAT_R16_UNORM,\n VK_FORMAT_R32G32B32A32_SFLOAT,\n VK_FORMAT_R32G32B32A32_SINT,\n VK_FORMAT_R32G32B32A32_UINT,\n VK_FORMAT_R32G32B32_SFLOAT,\n VK_FORMAT_R32G32B32_SINT,\n VK_FORMAT_R32G32B32_UINT,\n VK_FORMAT_R32G32_SFLOAT,\n VK_FORMAT_R32G32_SINT,\n VK_FORMAT_R32G32_UINT,\n VK_FORMAT_R32_SFLOAT,\n VK_FORMAT_R32_SINT,\n VK_FORMAT_R32_UINT,\n VK_FORMAT_R4G4B4A4_UNORM_PACK16,\n VK_FORMAT_R4G4_UNORM_PACK8,\n VK_FORMAT_R5G5B5A1_UNORM_PACK16,\n VK_FORMAT_R5G6B5_UNORM_PACK16,\n VK_FORMAT_R64G64B64A64_SFLOAT,\n VK_FORMAT_R64G64B64A64_SINT,\n VK_FORMAT_R64G64B64A64_UINT,\n VK_FORMAT_R64G64B64_SFLOAT,\n VK_FORMAT_R64G64B64_SINT,\n VK_FORMAT_R64G64B64_UINT,\n VK_FORMAT_R64G64_SFLOAT,\n VK_FORMAT_R64G64_SINT,\n VK_FORMAT_R64G64_UINT,\n VK_FORMAT_R64_SFLOAT,\n VK_FORMAT_R64_SINT,\n VK_FORMAT_R64_UINT,\n VK_FORMAT_R8G8B8A8_SINT,\n VK_FORMAT_R8G8B8A8_SNORM,\n VK_FORMAT_R8G8B8A8_SRGB,\n VK_FORMAT_R8G8B8A8_UINT,\n VK_FORMAT_R8G8B8A8_UNORM,\n VK_FORMAT_R8G8B8_SINT,\n VK_FORMAT_R8G8B8_SNORM,\n VK_FORMAT_R8G8B8_SRGB,\n VK_FORMAT_R8G8B8_UINT,\n VK_FORMAT_R8G8B8_UNORM,\n VK_FORMAT_R8G8_SINT,\n VK_FORMAT_R8G8_SNORM,\n VK_FORMAT_R8G8_SRGB,\n VK_FORMAT_R8G8_UINT,\n VK_FORMAT_R8G8_UNORM,\n VK_FORMAT_R8_SINT,\n VK_FORMAT_R8_SNORM,\n VK_FORMAT_R8_SRGB,\n VK_FORMAT_R8_UINT,\n VK_FORMAT_R8_UNORM,\n VK_FORMAT_S8_UINT,\n VK_FORMAT_UNDEFINED,\n VK_FORMAT_X8_D24_UNORM_PACK32,\n read,\n write,\n}\n//# sourceMappingURL=ktx-parse.esm.js.map\n", "interface DecoderExports {\n memory: Uint8Array\n\n ZSTD_findDecompressedSize: (compressedPtr: number, compressedSize: number) => BigInt\n ZSTD_decompress: (\n uncompressedPtr: number,\n uncompressedSize: number,\n compressedPtr: number,\n compressedSize: number,\n ) => number\n malloc: (ptr: number) => number\n free: (ptr: number) => void\n}\n\nlet init: Promise\nlet instance: { exports: DecoderExports }\nlet heap: Uint8Array\n\nconst IMPORT_OBJECT = {\n env: {\n emscripten_notify_memory_growth: function (index: number): void {\n heap = new Uint8Array(instance.exports.memory.buffer)\n },\n },\n}\n\n/**\n * ZSTD (Zstandard) decoder.\n */\nexport class ZSTDDecoder {\n init(): Promise {\n if (init) return init\n\n if (typeof fetch !== 'undefined') {\n // Web.\n\n init = fetch('data:application/wasm;base64,' + wasm)\n .then((response) => response.arrayBuffer())\n .then((arrayBuffer) => WebAssembly.instantiate(arrayBuffer, IMPORT_OBJECT))\n .then(this._init)\n } else {\n // Node.js.\n\n init = WebAssembly.instantiate(Buffer.from(wasm, 'base64'), IMPORT_OBJECT).then(this._init)\n }\n\n return init\n }\n\n _init(result: WebAssembly.WebAssemblyInstantiatedSource): void {\n instance = (result.instance as unknown) as { exports: DecoderExports }\n\n IMPORT_OBJECT.env.emscripten_notify_memory_growth(0) // initialize heap.\n }\n\n decode(array: Uint8Array, uncompressedSize = 0): Uint8Array {\n if (!instance) throw new Error(`ZSTDDecoder: Await .init() before decoding.`)\n\n // Write compressed data into WASM memory.\n const compressedSize = array.byteLength\n const compressedPtr = instance.exports.malloc(compressedSize)\n heap.set(array, compressedPtr)\n\n // Decompress into WASM memory.\n uncompressedSize =\n uncompressedSize || Number(instance.exports.ZSTD_findDecompressedSize(compressedPtr, compressedSize))\n const uncompressedPtr = instance.exports.malloc(uncompressedSize)\n const actualSize = instance.exports.ZSTD_decompress(\n uncompressedPtr,\n uncompressedSize,\n compressedPtr,\n compressedSize,\n )\n\n // Read decompressed data and free WASM memory.\n const dec = heap.slice(uncompressedPtr, uncompressedPtr + actualSize)\n instance.exports.free(compressedPtr)\n instance.exports.free(uncompressedPtr)\n\n return dec\n }\n}\n\n/**\n * BSD License\n *\n * For Zstandard software\n *\n * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * * Neither the name Facebook nor the names of its contributors may be used to\n * endorse or promote products derived from this software without specific\n * prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n// wasm:begin\nconst wasm =\n 'AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAA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kEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJA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DRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIAN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AgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGA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P//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ'\n// wasm:end\n", "import { CompressedTexture, CubeReflectionMapping } from 'three'\n\nclass CompressedCubeTexture extends CompressedTexture {\n constructor(images, format, type) {\n super(undefined, images[0].width, images[0].height, format, type, CubeReflectionMapping)\n\n this.isCompressedCubeTexture = true\n this.isCubeTexture = true\n\n this.image = images\n }\n}\n\nexport { CompressedCubeTexture }\n", "import { CompressedTexture, ClampToEdgeWrapping } from 'three'\n\nclass CompressedArrayTexture extends CompressedTexture {\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 = ClampToEdgeWrapping\n }\n}\n\nexport { CompressedArrayTexture }\n", "/**\n * Loader for KTX 2.0 GPU Texture containers.\n *\n * KTX 2.0 is a container format for various GPU texture formats. The loader\n * supports Basis Universal GPU textures, which can be quickly transcoded to\n * a wide variety of GPU texture compression formats, as well as some\n * uncompressed DataTexture and Data3DTexture formats.\n *\n * References:\n * - KTX: http://github.khronos.org/KTX-Specification/\n * - DFD: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor\n */\n\nimport {\n CompressedTexture,\n DataTexture,\n FileLoader,\n FloatType,\n HalfFloatType,\n LinearFilter,\n LinearMipmapLinearFilter,\n Loader,\n RedFormat,\n RGB_ETC1_Format,\n RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format,\n RGBA_ASTC_4x4_Format,\n RGBA_ASTC_6x6_Format,\n RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format,\n RGBAFormat,\n RGFormat,\n UnsignedByteType,\n} from 'three'\nimport { WorkerPool } from '../utils/WorkerPool'\nimport {\n read,\n KHR_DF_FLAG_ALPHA_PREMULTIPLIED,\n KHR_DF_TRANSFER_SRGB,\n KHR_SUPERCOMPRESSION_NONE,\n KHR_SUPERCOMPRESSION_ZSTD,\n VK_FORMAT_UNDEFINED,\n VK_FORMAT_R16_SFLOAT,\n VK_FORMAT_R16G16_SFLOAT,\n VK_FORMAT_R16G16B16A16_SFLOAT,\n VK_FORMAT_R32_SFLOAT,\n VK_FORMAT_R32G32_SFLOAT,\n VK_FORMAT_R32G32B32A32_SFLOAT,\n VK_FORMAT_R8_SRGB,\n VK_FORMAT_R8_UNORM,\n VK_FORMAT_R8G8_SRGB,\n VK_FORMAT_R8G8_UNORM,\n VK_FORMAT_R8G8B8A8_SRGB,\n VK_FORMAT_R8G8B8A8_UNORM,\n VK_FORMAT_ASTC_6x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_6x6_UNORM_BLOCK,\n KHR_DF_PRIMARIES_UNSPECIFIED,\n KHR_DF_PRIMARIES_BT709,\n KHR_DF_PRIMARIES_DISPLAYP3,\n} from '../libs/ktx-parse'\nimport { ZSTDDecoder } from '../libs/zstddec'\nimport { CompressedCubeTexture } from '../_polyfill/CompressedCubeTexture'\nimport { CompressedArrayTexture } from '../_polyfill/CompressedArrayTexture'\nimport { Data3DTexture } from '../_polyfill/Data3DTexture'\n\nconst LinearEncoding = 3000\nconst sRGBEncoding = 3001\n\nconst NoColorSpace = ''\nconst DisplayP3ColorSpace = 'display-p3'\nconst LinearDisplayP3ColorSpace = 'display-p3-linear'\nconst LinearSRGBColorSpace = 'srgb-linear'\nconst SRGBColorSpace = 'srgb'\n\nconst _taskCache = new WeakMap()\n\nlet _activeLoaders = 0\n\nlet _zstd\n\nclass KTX2Loader extends Loader {\n /* CONSTANTS */\n\n static BasisFormat = {\n ETC1S: 0,\n UASTC_4x4: 1,\n }\n\n static TranscoderFormat = {\n ETC1: 0,\n ETC2: 1,\n BC1: 2,\n BC3: 3,\n BC4: 4,\n BC5: 5,\n BC7_M6_OPAQUE_ONLY: 6,\n BC7_M5: 7,\n PVRTC1_4_RGB: 8,\n PVRTC1_4_RGBA: 9,\n ASTC_4x4: 10,\n ATC_RGB: 11,\n ATC_RGBA_INTERPOLATED_ALPHA: 12,\n RGBA32: 13,\n RGB565: 14,\n BGR565: 15,\n RGBA4444: 16,\n }\n\n static EngineFormat = {\n RGBAFormat: RGBAFormat,\n RGBA_ASTC_4x4_Format: RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format: RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format: RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format: RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format: RGBA_S3TC_DXT5_Format,\n RGB_ETC1_Format: RGB_ETC1_Format,\n RGB_ETC2_Format: RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format: RGB_S3TC_DXT1_Format,\n }\n\n /* WEB WORKER */\n\n static BasisWorker = function () {\n let config\n let transcoderPending\n let BasisModule\n\n /** @type KTX2Loader.EngineFormat */\n const EngineFormat = _EngineFormat\n /** @type KTX2Loader.TranscoderFormat */\n const TranscoderFormat = _TranscoderFormat\n /** @type KTX2Loader.BasisFormat */\n const BasisFormat = _BasisFormat\n\n self.addEventListener('message', function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'init':\n config = message.config\n init(message.transcoderBinary)\n break\n\n case 'transcode':\n transcoderPending.then(() => {\n try {\n const { faces, buffers, width, height, hasAlpha, format, dfdFlags } = transcode(message.buffer)\n\n self.postMessage(\n { type: 'transcode', id: message.id, faces, width, height, hasAlpha, format, dfdFlags },\n buffers,\n )\n } catch (error) {\n console.error(error)\n\n self.postMessage({ type: 'error', id: message.id, error: error.message })\n }\n })\n break\n }\n })\n\n function init(wasmBinary) {\n transcoderPending = new Promise((resolve) => {\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve }\n BASIS(BasisModule)\n }).then(() => {\n BasisModule.initializeBasis()\n\n if (BasisModule.KTX2File === undefined) {\n console.warn('THREE.KTX2Loader: Please update Basis Universal transcoder.')\n }\n })\n }\n\n function transcode(buffer) {\n const ktx2File = new BasisModule.KTX2File(new Uint8Array(buffer))\n\n function cleanup() {\n ktx2File.close()\n ktx2File.delete()\n }\n\n if (!ktx2File.isValid()) {\n cleanup()\n throw new Error('THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file')\n }\n\n const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S\n const width = ktx2File.getWidth()\n const height = ktx2File.getHeight()\n const layerCount = ktx2File.getLayers() || 1\n const levelCount = ktx2File.getLevels()\n const faceCount = ktx2File.getFaces()\n const hasAlpha = ktx2File.getHasAlpha()\n const dfdFlags = ktx2File.getDFDFlags()\n\n const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha)\n\n if (!width || !height || !levelCount) {\n cleanup()\n throw new Error('THREE.KTX2Loader:\tInvalid texture')\n }\n\n if (!ktx2File.startTranscoding()) {\n cleanup()\n throw new Error('THREE.KTX2Loader: .startTranscoding failed')\n }\n\n const faces = []\n const buffers = []\n\n for (let face = 0; face < faceCount; face++) {\n const mipmaps = []\n\n for (let mip = 0; mip < levelCount; mip++) {\n const layerMips = []\n\n let mipWidth, mipHeight\n\n for (let layer = 0; layer < layerCount; layer++) {\n const levelInfo = ktx2File.getImageLevelInfo(mip, layer, face)\n\n if (\n face === 0 &&\n mip === 0 &&\n layer === 0 &&\n (levelInfo.origWidth % 4 !== 0 || levelInfo.origHeight % 4 !== 0)\n ) {\n console.warn('THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions.')\n }\n\n if (levelCount > 1) {\n mipWidth = levelInfo.origWidth\n mipHeight = levelInfo.origHeight\n } else {\n // Handles non-multiple-of-four dimensions in textures without mipmaps. Textures with\n // mipmaps must use multiple-of-four dimensions, for some texture formats and APIs.\n // See mrdoob/three.js#25908.\n mipWidth = levelInfo.width\n mipHeight = levelInfo.height\n }\n\n const dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, transcoderFormat))\n const status = ktx2File.transcodeImage(dst, mip, layer, face, transcoderFormat, 0, -1, -1)\n\n if (!status) {\n cleanup()\n throw new Error('THREE.KTX2Loader: .transcodeImage failed.')\n }\n\n layerMips.push(dst)\n }\n\n const mipData = concat(layerMips)\n\n mipmaps.push({ data: mipData, width: mipWidth, height: mipHeight })\n buffers.push(mipData.buffer)\n }\n\n faces.push({ mipmaps, width, height, format: engineFormat })\n }\n\n cleanup()\n\n return { faces, buffers, width, height, hasAlpha, format: engineFormat, dfdFlags }\n }\n\n //\n\n // Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC),\n // device capabilities, and texture dimensions. The list below ranks the formats separately\n // for ETC1S and UASTC.\n //\n // In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at\n // significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently\n // chooses RGBA32 only as a last resort and does not expose that option to the caller.\n const FORMAT_OPTIONS = [\n {\n if: 'astcSupported',\n basisFormat: [BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],\n engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],\n priorityETC1S: Infinity,\n priorityUASTC: 1,\n needsPowerOfTwo: false,\n },\n {\n if: 'bptcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],\n engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],\n priorityETC1S: 3,\n priorityUASTC: 2,\n needsPowerOfTwo: false,\n },\n {\n if: 'dxtSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],\n engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],\n priorityETC1S: 4,\n priorityUASTC: 5,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc2Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],\n engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],\n priorityETC1S: 1,\n priorityUASTC: 3,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc1Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1],\n engineFormat: [EngineFormat.RGB_ETC1_Format],\n priorityETC1S: 2,\n priorityUASTC: 4,\n needsPowerOfTwo: false,\n },\n {\n if: 'pvrtcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],\n engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],\n priorityETC1S: 5,\n priorityUASTC: 6,\n needsPowerOfTwo: true,\n },\n ]\n\n const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityETC1S - b.priorityETC1S\n })\n const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityUASTC - b.priorityUASTC\n })\n\n function getTranscoderFormat(basisFormat, width, height, hasAlpha) {\n let transcoderFormat\n let engineFormat\n\n const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS\n\n for (let i = 0; i < options.length; i++) {\n const opt = options[i]\n\n if (!config[opt.if]) continue\n if (!opt.basisFormat.includes(basisFormat)) continue\n if (hasAlpha && opt.transcoderFormat.length < 2) continue\n if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height))) continue\n\n transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0]\n engineFormat = opt.engineFormat[hasAlpha ? 1 : 0]\n\n return { transcoderFormat, engineFormat }\n }\n\n console.warn('THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32.')\n\n transcoderFormat = TranscoderFormat.RGBA32\n engineFormat = EngineFormat.RGBAFormat\n\n return { transcoderFormat, engineFormat }\n }\n\n function isPowerOfTwo(value) {\n if (value <= 2) return true\n\n return (value & (value - 1)) === 0 && value !== 0\n }\n\n /** Concatenates N byte arrays. */\n function concat(arrays) {\n if (arrays.length === 1) return arrays[0]\n\n let totalByteLength = 0\n\n for (let i = 0; i < arrays.length; i++) {\n const array = arrays[i]\n totalByteLength += array.byteLength\n }\n\n const result = new Uint8Array(totalByteLength)\n\n let byteOffset = 0\n\n for (let i = 0; i < arrays.length; i++) {\n const array = arrays[i]\n result.set(array, byteOffset)\n\n byteOffset += array.byteLength\n }\n\n return result\n }\n }\n\n constructor(manager) {\n super(manager)\n\n this.transcoderPath = ''\n this.transcoderBinary = null\n this.transcoderPending = null\n\n this.workerPool = new WorkerPool()\n this.workerSourceURL = ''\n this.workerConfig = null\n\n if (typeof MSC_TRANSCODER !== 'undefined') {\n console.warn(\n 'THREE.KTX2Loader: Please update to latest \"basis_transcoder\".' +\n ' \"msc_basis_transcoder\" is no longer supported in three.js r125+.',\n )\n }\n }\n\n setTranscoderPath(path) {\n this.transcoderPath = path\n\n return this\n }\n\n setWorkerLimit(num) {\n this.workerPool.setWorkerLimit(num)\n\n return this\n }\n\n detectSupport(renderer) {\n this.workerConfig = {\n astcSupported: renderer.extensions.has('WEBGL_compressed_texture_astc'),\n etc1Supported: renderer.extensions.has('WEBGL_compressed_texture_etc1'),\n etc2Supported: renderer.extensions.has('WEBGL_compressed_texture_etc'),\n dxtSupported: renderer.extensions.has('WEBGL_compressed_texture_s3tc'),\n bptcSupported: renderer.extensions.has('EXT_texture_compression_bptc'),\n pvrtcSupported:\n renderer.extensions.has('WEBGL_compressed_texture_pvrtc') ||\n renderer.extensions.has('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n }\n\n if (renderer.capabilities.isWebGL2) {\n // https://github.com/mrdoob/three.js/pull/22928\n this.workerConfig.etc1Supported = false\n }\n\n return this\n }\n\n init() {\n if (!this.transcoderPending) {\n // Load transcoder wrapper.\n const jsLoader = new FileLoader(this.manager)\n jsLoader.setPath(this.transcoderPath)\n jsLoader.setWithCredentials(this.withCredentials)\n const jsContent = jsLoader.loadAsync('basis_transcoder.js')\n\n // Load transcoder WASM binary.\n const binaryLoader = new FileLoader(this.manager)\n binaryLoader.setPath(this.transcoderPath)\n binaryLoader.setResponseType('arraybuffer')\n binaryLoader.setWithCredentials(this.withCredentials)\n const binaryContent = binaryLoader.loadAsync('basis_transcoder.wasm')\n\n this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent, binaryContent]) => {\n const fn = KTX2Loader.BasisWorker.toString()\n\n const body = [\n '/* constants */',\n 'let _EngineFormat = ' + JSON.stringify(KTX2Loader.EngineFormat),\n 'let _TranscoderFormat = ' + JSON.stringify(KTX2Loader.TranscoderFormat),\n 'let _BasisFormat = ' + JSON.stringify(KTX2Loader.BasisFormat),\n '/* basis_transcoder.js */',\n jsContent,\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}')),\n ].join('\\n')\n\n this.workerSourceURL = URL.createObjectURL(new Blob([body]))\n this.transcoderBinary = binaryContent\n\n this.workerPool.setWorkerCreator(() => {\n const worker = new Worker(this.workerSourceURL)\n const transcoderBinary = this.transcoderBinary.slice(0)\n\n worker.postMessage({ type: 'init', config: this.workerConfig, transcoderBinary }, [transcoderBinary])\n\n return worker\n })\n })\n\n if (_activeLoaders > 0) {\n // Each instance loads a transcoder and allocates workers, increasing network and memory cost.\n\n console.warn(\n 'THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues.' +\n ' Use a single KTX2Loader instance, or call .dispose() on old instances.',\n )\n }\n\n _activeLoaders++\n }\n\n return this.transcoderPending\n }\n\n load(url, onLoad, onProgress, onError) {\n if (this.workerConfig === null) {\n throw new Error('THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.')\n }\n\n const loader = new FileLoader(this.manager)\n\n loader.setResponseType('arraybuffer')\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n (buffer) => {\n // Check for an existing task using this buffer. A transferred buffer cannot be transferred\n // again from this thread.\n if (_taskCache.has(buffer)) {\n const cachedTask = _taskCache.get(buffer)\n\n return cachedTask.promise.then(onLoad).catch(onError)\n }\n\n this._createTexture(buffer)\n .then((texture) => (onLoad ? onLoad(texture) : null))\n .catch(onError)\n },\n onProgress,\n onError,\n )\n }\n\n _createTextureFrom(transcodeResult, container) {\n const { faces, width, height, format, type, error, dfdFlags } = transcodeResult\n\n if (type === 'error') return Promise.reject(error)\n\n let texture\n\n if (container.faceCount === 6) {\n texture = new CompressedCubeTexture(faces, format, UnsignedByteType)\n } else {\n const mipmaps = faces[0].mipmaps\n\n texture =\n container.layerCount > 1\n ? new CompressedArrayTexture(mipmaps, width, height, container.layerCount, format, UnsignedByteType)\n : new CompressedTexture(mipmaps, width, height, format, UnsignedByteType)\n }\n\n texture.minFilter = faces[0].mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter\n texture.magFilter = LinearFilter\n texture.generateMipmaps = false\n texture.needsUpdate = true\n\n const colorSpace = parseColorSpace(container)\n if ('colorSpace' in texture) texture.colorSpace = colorSpace\n else texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding\n\n texture.premultiplyAlpha = !!(dfdFlags & KHR_DF_FLAG_ALPHA_PREMULTIPLIED)\n\n return texture\n }\n\n /**\n * @param {ArrayBuffer} buffer\n * @param {object?} config\n * @return {Promise}\n */\n async _createTexture(buffer, config = {}) {\n const container = read(new Uint8Array(buffer))\n\n if (container.vkFormat !== VK_FORMAT_UNDEFINED) {\n return createRawTexture(container)\n }\n\n //\n\n const taskConfig = config\n const texturePending = this.init()\n .then(() => {\n return this.workerPool.postMessage({ type: 'transcode', buffer, taskConfig: taskConfig }, [buffer])\n })\n .then((e) => this._createTextureFrom(e.data, container))\n\n // Cache the task result.\n _taskCache.set(buffer, { promise: texturePending })\n\n return texturePending\n }\n\n dispose() {\n this.workerPool.dispose()\n if (this.workerSourceURL) URL.revokeObjectURL(this.workerSourceURL)\n\n _activeLoaders--\n\n return this\n }\n}\n\n//\n// Parsing for non-Basis textures. These textures are may have supercompression\n// like Zstd, but they do not require transcoding.\n\nconst UNCOMPRESSED_FORMATS = new Set([RGBAFormat, RGFormat, RedFormat])\n\nconst FORMAT_MAP = {\n [VK_FORMAT_R32G32B32A32_SFLOAT]: RGBAFormat,\n [VK_FORMAT_R16G16B16A16_SFLOAT]: RGBAFormat,\n [VK_FORMAT_R8G8B8A8_UNORM]: RGBAFormat,\n [VK_FORMAT_R8G8B8A8_SRGB]: RGBAFormat,\n\n [VK_FORMAT_R32G32_SFLOAT]: RGFormat,\n [VK_FORMAT_R16G16_SFLOAT]: RGFormat,\n [VK_FORMAT_R8G8_UNORM]: RGFormat,\n [VK_FORMAT_R8G8_SRGB]: RGFormat,\n\n [VK_FORMAT_R32_SFLOAT]: RedFormat,\n [VK_FORMAT_R16_SFLOAT]: RedFormat,\n [VK_FORMAT_R8_SRGB]: RedFormat,\n [VK_FORMAT_R8_UNORM]: RedFormat,\n\n [VK_FORMAT_ASTC_6x6_SRGB_BLOCK]: RGBA_ASTC_6x6_Format,\n [VK_FORMAT_ASTC_6x6_UNORM_BLOCK]: RGBA_ASTC_6x6_Format,\n}\n\nconst TYPE_MAP = {\n [VK_FORMAT_R32G32B32A32_SFLOAT]: FloatType,\n [VK_FORMAT_R16G16B16A16_SFLOAT]: HalfFloatType,\n [VK_FORMAT_R8G8B8A8_UNORM]: UnsignedByteType,\n [VK_FORMAT_R8G8B8A8_SRGB]: UnsignedByteType,\n\n [VK_FORMAT_R32G32_SFLOAT]: FloatType,\n [VK_FORMAT_R16G16_SFLOAT]: HalfFloatType,\n [VK_FORMAT_R8G8_UNORM]: UnsignedByteType,\n [VK_FORMAT_R8G8_SRGB]: UnsignedByteType,\n\n [VK_FORMAT_R32_SFLOAT]: FloatType,\n [VK_FORMAT_R16_SFLOAT]: HalfFloatType,\n [VK_FORMAT_R8_SRGB]: UnsignedByteType,\n [VK_FORMAT_R8_UNORM]: UnsignedByteType,\n\n [VK_FORMAT_ASTC_6x6_SRGB_BLOCK]: UnsignedByteType,\n [VK_FORMAT_ASTC_6x6_UNORM_BLOCK]: UnsignedByteType,\n}\n\nasync function createRawTexture(container) {\n const { vkFormat } = container\n\n if (FORMAT_MAP[vkFormat] === undefined) {\n throw new Error('THREE.KTX2Loader: Unsupported vkFormat.')\n }\n\n //\n\n let zstd\n\n if (container.supercompressionScheme === KHR_SUPERCOMPRESSION_ZSTD) {\n if (!_zstd) {\n _zstd = new Promise(async (resolve) => {\n const zstd = new ZSTDDecoder()\n await zstd.init()\n resolve(zstd)\n })\n }\n\n zstd = await _zstd\n }\n\n //\n\n const mipmaps = []\n\n for (let levelIndex = 0; levelIndex < container.levels.length; levelIndex++) {\n const levelWidth = Math.max(1, container.pixelWidth >> levelIndex)\n const levelHeight = Math.max(1, container.pixelHeight >> levelIndex)\n const levelDepth = container.pixelDepth ? Math.max(1, container.pixelDepth >> levelIndex) : 0\n\n const level = container.levels[levelIndex]\n\n let levelData\n\n if (container.supercompressionScheme === KHR_SUPERCOMPRESSION_NONE) {\n levelData = level.levelData\n } else if (container.supercompressionScheme === KHR_SUPERCOMPRESSION_ZSTD) {\n levelData = zstd.decode(level.levelData, level.uncompressedByteLength)\n } else {\n throw new Error('THREE.KTX2Loader: Unsupported supercompressionScheme.')\n }\n\n let data\n\n if (TYPE_MAP[vkFormat] === FloatType) {\n data = new Float32Array(\n levelData.buffer,\n levelData.byteOffset,\n levelData.byteLength / Float32Array.BYTES_PER_ELEMENT,\n )\n } else if (TYPE_MAP[vkFormat] === HalfFloatType) {\n data = new Uint16Array(\n levelData.buffer,\n levelData.byteOffset,\n levelData.byteLength / Uint16Array.BYTES_PER_ELEMENT,\n )\n } else {\n data = levelData\n }\n\n mipmaps.push({\n data: data,\n width: levelWidth,\n height: levelHeight,\n depth: levelDepth,\n })\n }\n\n let texture\n\n if (UNCOMPRESSED_FORMATS.has(FORMAT_MAP[vkFormat])) {\n texture =\n container.pixelDepth === 0\n ? new DataTexture(mipmaps[0].data, container.pixelWidth, container.pixelHeight)\n : new Data3DTexture(mipmaps[0].data, container.pixelWidth, container.pixelHeight, container.pixelDepth)\n } else {\n if (container.pixelDepth > 0) throw new Error('THREE.KTX2Loader: Unsupported pixelDepth.')\n\n texture = new CompressedTexture(mipmaps, container.pixelWidth, container.pixelHeight)\n }\n\n texture.mipmaps = mipmaps\n\n texture.type = TYPE_MAP[vkFormat]\n texture.format = FORMAT_MAP[vkFormat]\n texture.needsUpdate = true\n\n const colorSpace = parseColorSpace(container)\n if ('colorSpace' in texture) texture.colorSpace = colorSpace\n else texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding\n\n //\n\n return Promise.resolve(texture)\n}\n\nfunction parseColorSpace(container) {\n const dfd = container.dataFormatDescriptor[0]\n\n if (dfd.colorPrimaries === KHR_DF_PRIMARIES_BT709) {\n return dfd.transferFunction === KHR_DF_TRANSFER_SRGB ? SRGBColorSpace : LinearSRGBColorSpace\n } else if (dfd.colorPrimaries === KHR_DF_PRIMARIES_DISPLAYP3) {\n return dfd.transferFunction === KHR_DF_TRANSFER_SRGB ? DisplayP3ColorSpace : LinearDisplayP3ColorSpace\n } else if (dfd.colorPrimaries === KHR_DF_PRIMARIES_UNSPECIFIED) {\n return NoColorSpace\n } else {\n console.warn(`THREE.KTX2Loader: Unsupported color primaries, \"${dfd.colorPrimaries}\"`)\n return NoColorSpace\n }\n}\n\nexport { KTX2Loader }\n", "const lottie = (() => {\n if (typeof navigator === 'undefined' || typeof document === 'undefined') return {}\n\n const svgNS = 'http://www.w3.org/2000/svg'\n\n let locationHref = ''\n let _useWebWorker = false\n\n const initialDefaultFrame = -999999\n\n const setWebWorker = (flag) => {\n _useWebWorker = !!flag\n }\n const getWebWorker = () => _useWebWorker\n\n const setLocationHref = (value) => {\n locationHref = value\n }\n const getLocationHref = () => locationHref\n\n function createTag(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElement(type)\n }\n\n function extendPrototype(sources, destination) {\n var i\n var len = sources.length\n var sourcePrototype\n for (i = 0; i < len; i += 1) {\n sourcePrototype = sources[i].prototype\n for (var attr in sourcePrototype) {\n if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr))\n destination.prototype[attr] = sourcePrototype[attr]\n }\n }\n }\n\n function getDescriptor(object, prop) {\n return Object.getOwnPropertyDescriptor(object, prop)\n }\n\n function createProxyFunction(prototype) {\n function ProxyFunction() {}\n ProxyFunction.prototype = prototype\n return ProxyFunction\n }\n\n // import Howl from '../../3rd_party/howler';\n\n const audioControllerFactory = (function () {\n function AudioController(audioFactory) {\n this.audios = []\n this.audioFactory = audioFactory\n this._volume = 1\n this._isMuted = false\n }\n\n AudioController.prototype = {\n addAudio: function (audio) {\n this.audios.push(audio)\n },\n pause: function () {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].pause()\n }\n },\n resume: function () {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].resume()\n }\n },\n setRate: function (rateValue) {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].setRate(rateValue)\n }\n },\n createAudio: function (assetPath) {\n if (this.audioFactory) {\n return this.audioFactory(assetPath)\n }\n if (window.Howl) {\n return new window.Howl({\n src: [assetPath],\n })\n }\n return {\n isPlaying: false,\n play: function () {\n this.isPlaying = true\n },\n seek: function () {\n this.isPlaying = false\n },\n playing: function () {},\n rate: function () {},\n setVolume: function () {},\n }\n },\n setAudioFactory: function (audioFactory) {\n this.audioFactory = audioFactory\n },\n setVolume: function (value) {\n this._volume = value\n this._updateVolume()\n },\n mute: function () {\n this._isMuted = true\n this._updateVolume()\n },\n unmute: function () {\n this._isMuted = false\n this._updateVolume()\n },\n getVolume: function () {\n return this._volume\n },\n _updateVolume: function () {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1))\n }\n },\n }\n\n return function () {\n return new AudioController()\n }\n })()\n\n const createTypedArray = (function () {\n function createRegularArray(type, len) {\n var i = 0\n var arr = []\n var value\n switch (type) {\n case 'int16':\n case 'uint8c':\n value = 1\n break\n default:\n value = 1.1\n break\n }\n for (i = 0; i < len; i += 1) {\n arr.push(value)\n }\n return arr\n }\n function createTypedArrayFactory(type, len) {\n if (type === 'float32') {\n return new Float32Array(len)\n }\n if (type === 'int16') {\n return new Int16Array(len)\n }\n if (type === 'uint8c') {\n return new Uint8ClampedArray(len)\n }\n return createRegularArray(type, len)\n }\n if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {\n return createTypedArrayFactory\n }\n return createRegularArray\n })()\n\n function createSizedArray(len) {\n return Array.apply(null, { length: len })\n }\n\n let subframeEnabled = true\n let expressionsPlugin = null\n let idPrefix$1 = ''\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)\n let _shouldRoundValues = false\n const bmPow = Math.pow\n const bmSqrt = Math.sqrt\n const bmFloor = Math.floor\n const bmMax = Math.max\n const bmMin = Math.min\n\n const BMMath = {}\n ;(function () {\n var propertyNames = [\n 'abs',\n 'acos',\n 'acosh',\n 'asin',\n 'asinh',\n 'atan',\n 'atanh',\n 'atan2',\n 'ceil',\n 'cbrt',\n 'expm1',\n 'clz32',\n 'cos',\n 'cosh',\n 'exp',\n 'floor',\n 'fround',\n 'hypot',\n 'imul',\n 'log',\n 'log1p',\n 'log2',\n 'log10',\n 'max',\n 'min',\n 'pow',\n 'random',\n 'round',\n 'sign',\n 'sin',\n 'sinh',\n 'sqrt',\n 'tan',\n 'tanh',\n 'trunc',\n 'E',\n 'LN10',\n 'LN2',\n 'LOG10E',\n 'LOG2E',\n 'PI',\n 'SQRT1_2',\n 'SQRT2',\n ]\n var i\n var len = propertyNames.length\n for (i = 0; i < len; i += 1) {\n BMMath[propertyNames[i]] = Math[propertyNames[i]]\n }\n })()\n\n function ProjectInterface$1() {\n return {}\n }\n BMMath.random = Math.random\n BMMath.abs = function (val) {\n var tOfVal = typeof val\n if (tOfVal === 'object' && val.length) {\n var absArr = createSizedArray(val.length)\n var i\n var len = val.length\n for (i = 0; i < len; i += 1) {\n absArr[i] = Math.abs(val[i])\n }\n return absArr\n }\n return Math.abs(val)\n }\n let defaultCurveSegments = 150\n const degToRads = Math.PI / 180\n const roundCorner = 0.5519\n\n function roundValues(flag) {\n _shouldRoundValues = !!flag\n }\n\n function bmRnd(value) {\n if (_shouldRoundValues) {\n return Math.round(value)\n }\n return value\n }\n\n function styleDiv(element) {\n element.style.position = 'absolute'\n element.style.top = 0\n element.style.left = 0\n element.style.display = 'block'\n element.style.transformOrigin = '0 0'\n element.style.webkitTransformOrigin = '0 0'\n element.style.backfaceVisibility = 'visible'\n element.style.webkitBackfaceVisibility = 'visible'\n element.style.transformStyle = 'preserve-3d'\n element.style.webkitTransformStyle = 'preserve-3d'\n element.style.mozTransformStyle = 'preserve-3d'\n }\n\n function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {\n this.type = type\n this.currentTime = currentTime\n this.totalTime = totalTime\n this.direction = frameMultiplier < 0 ? -1 : 1\n }\n\n function BMCompleteEvent(type, frameMultiplier) {\n this.type = type\n this.direction = frameMultiplier < 0 ? -1 : 1\n }\n\n function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {\n this.type = type\n this.currentLoop = currentLoop\n this.totalLoops = totalLoops\n this.direction = frameMultiplier < 0 ? -1 : 1\n }\n\n function BMSegmentStartEvent(type, firstFrame, totalFrames) {\n this.type = type\n this.firstFrame = firstFrame\n this.totalFrames = totalFrames\n }\n\n function BMDestroyEvent(type, target) {\n this.type = type\n this.target = target\n }\n\n function BMRenderFrameErrorEvent(nativeError, currentTime) {\n this.type = 'renderFrameError'\n this.nativeError = nativeError\n this.currentTime = currentTime\n }\n\n function BMConfigErrorEvent(nativeError) {\n this.type = 'configError'\n this.nativeError = nativeError\n }\n\n function BMAnimationConfigErrorEvent(type, nativeError) {\n this.type = type\n this.nativeError = nativeError\n }\n\n const createElementID = (function () {\n var _count = 0\n return function createID() {\n _count += 1\n return idPrefix$1 + '__lottie_element_' + _count\n }\n })()\n\n function HSVtoRGB(h, s, v) {\n var r\n var g\n var b\n var i\n var f\n var p\n var q\n var t\n i = Math.floor(h * 6)\n f = h * 6 - i\n p = v * (1 - s)\n q = v * (1 - f * s)\n t = v * (1 - (1 - f) * s)\n switch (i % 6) {\n case 0:\n r = v\n g = t\n b = p\n break\n case 1:\n r = q\n g = v\n b = p\n break\n case 2:\n r = p\n g = v\n b = t\n break\n case 3:\n r = p\n g = q\n b = v\n break\n case 4:\n r = t\n g = p\n b = v\n break\n case 5:\n r = v\n g = p\n b = q\n break\n default:\n break\n }\n return [r, g, b]\n }\n\n function RGBtoHSV(r, g, b) {\n var max = Math.max(r, g, b)\n var min = Math.min(r, g, b)\n var d = max - min\n var h\n var s = max === 0 ? 0 : d / max\n var v = max / 255\n\n switch (max) {\n case min:\n h = 0\n break\n case r:\n h = g - b + d * (g < b ? 6 : 0)\n h /= 6 * d\n break\n case g:\n h = b - r + d * 2\n h /= 6 * d\n break\n case b:\n h = r - g + d * 4\n h /= 6 * d\n break\n default:\n break\n }\n\n return [h, s, v]\n }\n\n function addSaturationToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255)\n hsv[1] += offset\n if (hsv[1] > 1) {\n hsv[1] = 1\n } else if (hsv[1] <= 0) {\n hsv[1] = 0\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2])\n }\n\n function addBrightnessToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255)\n hsv[2] += offset\n if (hsv[2] > 1) {\n hsv[2] = 1\n } else if (hsv[2] < 0) {\n hsv[2] = 0\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2])\n }\n\n function addHueToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255)\n hsv[0] += offset / 360\n if (hsv[0] > 1) {\n hsv[0] -= 1\n } else if (hsv[0] < 0) {\n hsv[0] += 1\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2])\n }\n\n const rgbToHex = (function () {\n var colorMap = []\n var i\n var hex\n for (i = 0; i < 256; i += 1) {\n hex = i.toString(16)\n colorMap[i] = hex.length === 1 ? '0' + hex : hex\n }\n\n return function (r, g, b) {\n if (r < 0) {\n r = 0\n }\n if (g < 0) {\n g = 0\n }\n if (b < 0) {\n b = 0\n }\n return '#' + colorMap[r] + colorMap[g] + colorMap[b]\n }\n })()\n\n const setSubframeEnabled = (flag) => {\n subframeEnabled = !!flag\n }\n const getSubframeEnabled = () => subframeEnabled\n const setExpressionsPlugin = (value) => {\n expressionsPlugin = value\n }\n const getExpressionsPlugin = () => expressionsPlugin\n const setDefaultCurveSegments = (value) => {\n defaultCurveSegments = value\n }\n const getDefaultCurveSegments = () => defaultCurveSegments\n const setIdPrefix = (value) => {\n idPrefix$1 = value\n }\n const getIdPrefix = () => idPrefix$1\n\n function createNS(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElementNS(svgNS, type)\n }\n\n const dataManager = (function () {\n var _counterId = 1\n var processes = []\n var workerFn\n var workerInstance\n var workerProxy = {\n onmessage: function () {},\n postMessage: function (path) {\n workerFn({\n data: path,\n })\n },\n }\n var _workerSelf = {\n postMessage: function (data) {\n workerProxy.onmessage({\n data: data,\n })\n },\n }\n function createWorker(fn) {\n if (window.Worker && window.Blob && getWebWorker()) {\n var blob = new Blob(['var _workerSelf = self; self.onmessage = ', fn.toString()], { type: 'text/javascript' })\n // var blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' });\n var url = URL.createObjectURL(blob)\n return new Worker(url)\n }\n workerFn = fn\n return workerProxy\n }\n\n function setupWorker() {\n if (!workerInstance) {\n workerInstance = createWorker(function workerStart(e) {\n function dataFunctionManager() {\n function completeLayers(layers, comps) {\n var layerData\n var i\n var len = layers.length\n var j\n var jLen\n var k\n var kLen\n for (i = 0; i < len; i += 1) {\n layerData = layers[i]\n if ('ks' in layerData && !layerData.completed) {\n layerData.completed = true\n if (layerData.tt) {\n layers[i - 1].td = layerData.tt\n }\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties\n jLen = maskProps.length\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k)\n } else {\n kLen = maskProps[j].pt.k.length\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0])\n }\n if (maskProps[j].pt.k[k].e) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0])\n }\n }\n }\n }\n }\n if (layerData.ty === 0) {\n layerData.layers = findCompLayers(layerData.refId, comps)\n completeLayers(layerData.layers, comps)\n } else if (layerData.ty === 4) {\n completeShapes(layerData.shapes)\n } else if (layerData.ty === 5) {\n completeText(layerData)\n }\n }\n }\n }\n\n function completeChars(chars, assets) {\n if (chars) {\n var i = 0\n var len = chars.length\n for (i = 0; i < len; i += 1) {\n if (chars[i].t === 1) {\n // var compData = findComp(chars[i].data.refId, assets);\n chars[i].data.layers = findCompLayers(chars[i].data.refId, assets)\n // chars[i].data.ip = 0;\n // chars[i].data.op = 99999;\n // chars[i].data.st = 0;\n // chars[i].data.sr = 1;\n // chars[i].w = compData.w;\n // chars[i].data.ks = {\n // a: { k: [0, 0, 0], a: 0 },\n // p: { k: [0, -compData.h, 0], a: 0 },\n // r: { k: 0, a: 0 },\n // s: { k: [100, 100], a: 0 },\n // o: { k: 100, a: 0 },\n // };\n completeLayers(chars[i].data.layers, assets)\n }\n }\n }\n }\n\n function findComp(id, comps) {\n var i = 0\n var len = comps.length\n while (i < len) {\n if (comps[i].id === id) {\n return comps[i]\n }\n i += 1\n }\n return null\n }\n\n function findCompLayers(id, comps) {\n var comp = findComp(id, comps)\n if (comp) {\n if (!comp.layers.__used) {\n comp.layers.__used = true\n return comp.layers\n }\n return JSON.parse(JSON.stringify(comp.layers))\n }\n return null\n }\n\n function completeShapes(arr) {\n var i\n var len = arr.length\n var j\n var jLen\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n convertPathsToAbsoluteValues(arr[i].ks.k)\n } else {\n jLen = arr[i].ks.k.length\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0])\n }\n if (arr[i].ks.k[j].e) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0])\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeShapes(arr[i].it)\n }\n }\n }\n\n function convertPathsToAbsoluteValues(path) {\n var i\n var len = path.i.length\n for (i = 0; i < len; i += 1) {\n path.i[i][0] += path.v[i][0]\n path.i[i][1] += path.v[i][1]\n path.o[i][0] += path.v[i][0]\n path.o[i][1] += path.v[i][1]\n }\n }\n\n function checkVersion(minimum, animVersionString) {\n var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100]\n if (minimum[0] > animVersion[0]) {\n return true\n }\n if (animVersion[0] > minimum[0]) {\n return false\n }\n if (minimum[1] > animVersion[1]) {\n return true\n }\n if (animVersion[1] > minimum[1]) {\n return false\n }\n if (minimum[2] > animVersion[2]) {\n return true\n }\n if (animVersion[2] > minimum[2]) {\n return false\n }\n return null\n }\n\n var checkText = (function () {\n var minimumVersion = [4, 4, 14]\n\n function updateTextLayer(textLayer) {\n var documentData = textLayer.t.d\n textLayer.t.d = {\n k: [\n {\n s: documentData,\n t: 0,\n },\n ],\n }\n }\n\n function iterateLayers(layers) {\n var i\n var len = layers.length\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i])\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n var checkChars = (function () {\n var minimumVersion = [4, 7, 99]\n return function (animationData) {\n if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {\n var i\n var len = animationData.chars.length\n for (i = 0; i < len; i += 1) {\n var charData = animationData.chars[i]\n if (charData.data && charData.data.shapes) {\n completeShapes(charData.data.shapes)\n charData.data.ip = 0\n charData.data.op = 99999\n charData.data.st = 0\n charData.data.sr = 1\n charData.data.ks = {\n p: { k: [0, 0], a: 0 },\n s: { k: [100, 100], a: 0 },\n a: { k: [0, 0], a: 0 },\n r: { k: 0, a: 0 },\n o: { k: 100, a: 0 },\n }\n if (!animationData.chars[i].t) {\n charData.data.shapes.push({\n ty: 'no',\n })\n charData.data.shapes[0].it.push({\n p: { k: [0, 0], a: 0 },\n s: { k: [100, 100], a: 0 },\n a: { k: [0, 0], a: 0 },\n r: { k: 0, a: 0 },\n o: { k: 100, a: 0 },\n sk: { k: 0, a: 0 },\n sa: { k: 0, a: 0 },\n ty: 'tr',\n })\n }\n }\n }\n }\n }\n })()\n\n var checkPathProperties = (function () {\n var minimumVersion = [5, 7, 15]\n\n function updateTextLayer(textLayer) {\n var pathData = textLayer.t.p\n if (typeof pathData.a === 'number') {\n pathData.a = {\n a: 0,\n k: pathData.a,\n }\n }\n if (typeof pathData.p === 'number') {\n pathData.p = {\n a: 0,\n k: pathData.p,\n }\n }\n if (typeof pathData.r === 'number') {\n pathData.r = {\n a: 0,\n k: pathData.r,\n }\n }\n }\n\n function iterateLayers(layers) {\n var i\n var len = layers.length\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i])\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n var checkColors = (function () {\n var minimumVersion = [4, 1, 9]\n\n function iterateShapes(shapes) {\n var i\n var len = shapes.length\n var j\n var jLen\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n iterateShapes(shapes[i].it)\n } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {\n if (shapes[i].c.k && shapes[i].c.k[0].i) {\n jLen = shapes[i].c.k.length\n for (j = 0; j < jLen; j += 1) {\n if (shapes[i].c.k[j].s) {\n shapes[i].c.k[j].s[0] /= 255\n shapes[i].c.k[j].s[1] /= 255\n shapes[i].c.k[j].s[2] /= 255\n shapes[i].c.k[j].s[3] /= 255\n }\n if (shapes[i].c.k[j].e) {\n shapes[i].c.k[j].e[0] /= 255\n shapes[i].c.k[j].e[1] /= 255\n shapes[i].c.k[j].e[2] /= 255\n shapes[i].c.k[j].e[3] /= 255\n }\n }\n } else {\n shapes[i].c.k[0] /= 255\n shapes[i].c.k[1] /= 255\n shapes[i].c.k[2] /= 255\n shapes[i].c.k[3] /= 255\n }\n }\n }\n }\n\n function iterateLayers(layers) {\n var i\n var len = layers.length\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 4) {\n iterateShapes(layers[i].shapes)\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n var checkShapes = (function () {\n var minimumVersion = [4, 4, 18]\n\n function completeClosingShapes(arr) {\n var i\n var len = arr.length\n var j\n var jLen\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n arr[i].ks.k.c = arr[i].closed\n } else {\n jLen = arr[i].ks.k.length\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n arr[i].ks.k[j].s[0].c = arr[i].closed\n }\n if (arr[i].ks.k[j].e) {\n arr[i].ks.k[j].e[0].c = arr[i].closed\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeClosingShapes(arr[i].it)\n }\n }\n }\n\n function iterateLayers(layers) {\n var layerData\n var i\n var len = layers.length\n var j\n var jLen\n var k\n var kLen\n for (i = 0; i < len; i += 1) {\n layerData = layers[i]\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties\n jLen = maskProps.length\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n maskProps[j].pt.k.c = maskProps[j].cl\n } else {\n kLen = maskProps[j].pt.k.length\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n maskProps[j].pt.k[k].s[0].c = maskProps[j].cl\n }\n if (maskProps[j].pt.k[k].e) {\n maskProps[j].pt.k[k].e[0].c = maskProps[j].cl\n }\n }\n }\n }\n }\n if (layerData.ty === 4) {\n completeClosingShapes(layerData.shapes)\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n function completeData(animationData) {\n if (animationData.__complete) {\n return\n }\n checkColors(animationData)\n checkText(animationData)\n checkChars(animationData)\n checkPathProperties(animationData)\n checkShapes(animationData)\n completeLayers(animationData.layers, animationData.assets)\n completeChars(animationData.chars, animationData.assets)\n animationData.__complete = true\n }\n\n function completeText(data) {\n if (data.t.a.length === 0 && !('m' in data.t.p)) {\n // data.singleShape = true;\n }\n }\n\n var moduleOb = {}\n moduleOb.completeData = completeData\n moduleOb.checkColors = checkColors\n moduleOb.checkChars = checkChars\n moduleOb.checkPathProperties = checkPathProperties\n moduleOb.checkShapes = checkShapes\n moduleOb.completeLayers = completeLayers\n\n return moduleOb\n }\n if (!_workerSelf.dataManager) {\n _workerSelf.dataManager = dataFunctionManager()\n }\n\n if (!_workerSelf.assetLoader) {\n _workerSelf.assetLoader = (function () {\n function formatResponse(xhr) {\n // using typeof doubles the time of execution of this method,\n // so if available, it's better to use the header to validate the type\n var contentTypeHeader = xhr.getResponseHeader('content-type')\n if (contentTypeHeader && xhr.responseType === 'json' && contentTypeHeader.indexOf('json') !== -1) {\n return xhr.response\n }\n if (xhr.response && typeof xhr.response === 'object') {\n return xhr.response\n }\n if (xhr.response && typeof xhr.response === 'string') {\n return JSON.parse(xhr.response)\n }\n if (xhr.responseText) {\n return JSON.parse(xhr.responseText)\n }\n return null\n }\n\n function loadAsset(path, fullPath, callback, errorCallback) {\n var response\n var xhr = new XMLHttpRequest()\n // set responseType after calling open or IE will break.\n try {\n // This crashes on Android WebView prior to KitKat\n xhr.responseType = 'json'\n } catch (err) {} // eslint-disable-line no-empty\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n response = formatResponse(xhr)\n callback(response)\n } else {\n try {\n response = formatResponse(xhr)\n callback(response)\n } catch (err) {\n if (errorCallback) {\n errorCallback(err)\n }\n }\n }\n }\n }\n try {\n xhr.open('GET', path, true)\n } catch (error) {\n xhr.open('GET', fullPath + '/' + path, true)\n }\n xhr.send()\n }\n return {\n load: loadAsset,\n }\n })()\n }\n\n if (e.data.type === 'loadAnimation') {\n _workerSelf.assetLoader.load(\n e.data.path,\n e.data.fullPath,\n function (data) {\n _workerSelf.dataManager.completeData(data)\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success',\n })\n },\n function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error',\n })\n },\n )\n } else if (e.data.type === 'complete') {\n var animation = e.data.animation\n _workerSelf.dataManager.completeData(animation)\n _workerSelf.postMessage({\n id: e.data.id,\n payload: animation,\n status: 'success',\n })\n } else if (e.data.type === 'loadData') {\n _workerSelf.assetLoader.load(\n e.data.path,\n e.data.fullPath,\n function (data) {\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success',\n })\n },\n function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error',\n })\n },\n )\n }\n })\n\n workerInstance.onmessage = function (event) {\n var data = event.data\n var id = data.id\n var process = processes[id]\n processes[id] = null\n if (data.status === 'success') {\n process.onComplete(data.payload)\n } else if (process.onError) {\n process.onError()\n }\n }\n }\n }\n\n function createProcess(onComplete, onError) {\n _counterId += 1\n var id = 'processId_' + _counterId\n processes[id] = {\n onComplete: onComplete,\n onError: onError,\n }\n return id\n }\n\n function loadAnimation(path, onComplete, onError) {\n setupWorker()\n var processId = createProcess(onComplete, onError)\n workerInstance.postMessage({\n type: 'loadAnimation',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId,\n })\n }\n\n function loadData(path, onComplete, onError) {\n setupWorker()\n var processId = createProcess(onComplete, onError)\n workerInstance.postMessage({\n type: 'loadData',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId,\n })\n }\n\n function completeAnimation(anim, onComplete, onError) {\n setupWorker()\n var processId = createProcess(onComplete, onError)\n workerInstance.postMessage({\n type: 'complete',\n animation: anim,\n id: processId,\n })\n }\n\n return {\n loadAnimation: loadAnimation,\n loadData: loadData,\n completeAnimation: completeAnimation,\n }\n })()\n\n const ImagePreloader = (function () {\n var proxyImage = (function () {\n var canvas = createTag('canvas')\n canvas.width = 1\n canvas.height = 1\n var ctx = canvas.getContext('2d')\n ctx.fillStyle = 'rgba(0,0,0,0)'\n ctx.fillRect(0, 0, 1, 1)\n return canvas\n })()\n\n function imageLoaded() {\n this.loadedAssets += 1\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null)\n }\n }\n }\n function footageLoaded() {\n this.loadedFootagesCount += 1\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null)\n }\n }\n }\n\n function getAssetsPath(assetData, assetsPath, originalPath) {\n var path = ''\n if (assetData.e) {\n path = assetData.p\n } else if (assetsPath) {\n var imagePath = assetData.p\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1]\n }\n path = assetsPath + imagePath\n } else {\n path = originalPath\n path += assetData.u ? assetData.u : ''\n path += assetData.p\n }\n return path\n }\n\n function testImageLoaded(img) {\n var _count = 0\n var intervalId = setInterval(\n function () {\n var box = img.getBBox()\n if (box.width || _count > 500) {\n this._imageLoaded()\n clearInterval(intervalId)\n }\n _count += 1\n }.bind(this),\n 50,\n )\n }\n\n function createImageData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path)\n var img = createNS('image')\n if (isSafari) {\n this.testImageLoaded(img)\n } else {\n img.addEventListener('load', this._imageLoaded, false)\n }\n img.addEventListener(\n 'error',\n function () {\n ob.img = proxyImage\n this._imageLoaded()\n }.bind(this),\n false,\n )\n img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path)\n if (this._elementHelper.append) {\n this._elementHelper.append(img)\n } else {\n this._elementHelper.appendChild(img)\n }\n var ob = {\n img: img,\n assetData: assetData,\n }\n return ob\n }\n\n function createImgData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path)\n var img = createTag('img')\n img.crossOrigin = 'anonymous'\n img.addEventListener('load', this._imageLoaded, false)\n img.addEventListener(\n 'error',\n function () {\n ob.img = proxyImage\n this._imageLoaded()\n }.bind(this),\n false,\n )\n img.src = path\n var ob = {\n img: img,\n assetData: assetData,\n }\n return ob\n }\n\n function createFootageData(data) {\n var ob = {\n assetData: data,\n }\n var path = getAssetsPath(data, this.assetsPath, this.path)\n dataManager.loadData(\n path,\n function (footageData) {\n ob.img = footageData\n this._footageLoaded()\n }.bind(this),\n function () {\n ob.img = {}\n this._footageLoaded()\n }.bind(this),\n )\n return ob\n }\n\n function loadAssets(assets, cb) {\n this.imagesLoadedCb = cb\n var i\n var len = assets.length\n for (i = 0; i < len; i += 1) {\n if (!assets[i].layers) {\n if (!assets[i].t || assets[i].t === 'seq') {\n this.totalImages += 1\n this.images.push(this._createImageData(assets[i]))\n } else if (assets[i].t === 3) {\n this.totalFootages += 1\n this.images.push(this.createFootageData(assets[i]))\n }\n }\n }\n }\n\n function setPath(path) {\n this.path = path || ''\n }\n\n function setAssetsPath(path) {\n this.assetsPath = path || ''\n }\n\n function getAsset(assetData) {\n var i = 0\n var len = this.images.length\n while (i < len) {\n if (this.images[i].assetData === assetData) {\n return this.images[i].img\n }\n i += 1\n }\n return null\n }\n\n function destroy() {\n this.imagesLoadedCb = null\n this.images.length = 0\n }\n\n function loadedImages() {\n return this.totalImages === this.loadedAssets\n }\n\n function loadedFootages() {\n return this.totalFootages === this.loadedFootagesCount\n }\n\n function setCacheType(type, elementHelper) {\n if (type === 'svg') {\n this._elementHelper = elementHelper\n this._createImageData = this.createImageData.bind(this)\n } else {\n this._createImageData = this.createImgData.bind(this)\n }\n }\n\n function ImagePreloaderFactory() {\n this._imageLoaded = imageLoaded.bind(this)\n this._footageLoaded = footageLoaded.bind(this)\n this.testImageLoaded = testImageLoaded.bind(this)\n this.createFootageData = createFootageData.bind(this)\n this.assetsPath = ''\n this.path = ''\n this.totalImages = 0\n this.totalFootages = 0\n this.loadedAssets = 0\n this.loadedFootagesCount = 0\n this.imagesLoadedCb = null\n this.images = []\n }\n\n ImagePreloaderFactory.prototype = {\n loadAssets: loadAssets,\n setAssetsPath: setAssetsPath,\n setPath: setPath,\n loadedImages: loadedImages,\n loadedFootages: loadedFootages,\n destroy: destroy,\n getAsset: getAsset,\n createImgData: createImgData,\n createImageData: createImageData,\n imageLoaded: imageLoaded,\n footageLoaded: footageLoaded,\n setCacheType: setCacheType,\n }\n\n return ImagePreloaderFactory\n })()\n\n function BaseEvent() {}\n BaseEvent.prototype = {\n triggerEvent: function (eventName, args) {\n if (this._cbs[eventName]) {\n var callbacks = this._cbs[eventName]\n for (var i = 0; i < callbacks.length; i += 1) {\n callbacks[i](args)\n }\n }\n },\n addEventListener: function (eventName, callback) {\n if (!this._cbs[eventName]) {\n this._cbs[eventName] = []\n }\n this._cbs[eventName].push(callback)\n\n return function () {\n this.removeEventListener(eventName, callback)\n }.bind(this)\n },\n removeEventListener: function (eventName, callback) {\n if (!callback) {\n this._cbs[eventName] = null\n } else if (this._cbs[eventName]) {\n var i = 0\n var len = this._cbs[eventName].length\n while (i < len) {\n if (this._cbs[eventName][i] === callback) {\n this._cbs[eventName].splice(i, 1)\n i -= 1\n len -= 1\n }\n i += 1\n }\n if (!this._cbs[eventName].length) {\n this._cbs[eventName] = null\n }\n }\n },\n }\n\n const markerParser = (function () {\n function parsePayloadLines(payload) {\n var lines = payload.split('\\r\\n')\n var keys = {}\n var line\n var keysCount = 0\n for (var i = 0; i < lines.length; i += 1) {\n line = lines[i].split(':')\n if (line.length === 2) {\n keys[line[0]] = line[1].trim()\n keysCount += 1\n }\n }\n if (keysCount === 0) {\n throw new Error()\n }\n return keys\n }\n\n return function (_markers) {\n var markers = []\n for (var i = 0; i < _markers.length; i += 1) {\n var _marker = _markers[i]\n var markerData = {\n time: _marker.tm,\n duration: _marker.dr,\n }\n try {\n markerData.payload = JSON.parse(_markers[i].cm)\n } catch (_) {\n try {\n markerData.payload = parsePayloadLines(_markers[i].cm)\n } catch (__) {\n markerData.payload = {\n name: _markers[i].cm,\n }\n }\n }\n markers.push(markerData)\n }\n return markers\n }\n })()\n\n const ProjectInterface = (function () {\n function registerComposition(comp) {\n this.compositions.push(comp)\n }\n\n return function () {\n function _thisProjectFunction(name) {\n var i = 0\n var len = this.compositions.length\n while (i < len) {\n if (this.compositions[i].data && this.compositions[i].data.nm === name) {\n if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {\n this.compositions[i].prepareFrame(this.currentFrame)\n }\n return this.compositions[i].compInterface\n }\n i += 1\n }\n return null\n }\n\n _thisProjectFunction.compositions = []\n _thisProjectFunction.currentFrame = 0\n\n _thisProjectFunction.registerComposition = registerComposition\n\n return _thisProjectFunction\n }\n })()\n\n const renderers = {}\n\n const registerRenderer = (key, value) => {\n renderers[key] = value\n }\n\n function getRenderer(key) {\n return renderers[key]\n }\n\n const AnimationItem = function () {\n this._cbs = []\n this.name = ''\n this.path = ''\n this.isLoaded = false\n this.currentFrame = 0\n this.currentRawFrame = 0\n this.firstFrame = 0\n this.totalFrames = 0\n this.frameRate = 0\n this.frameMult = 0\n this.playSpeed = 1\n this.playDirection = 1\n this.playCount = 0\n this.animationData = {}\n this.assets = []\n this.isPaused = true\n this.autoplay = false\n this.loop = true\n this.renderer = null\n this.animationID = createElementID()\n this.assetsPath = ''\n this.timeCompleted = 0\n this.segmentPos = 0\n this.isSubframeEnabled = getSubframeEnabled()\n this.segments = []\n this._idle = true\n this._completedLoop = false\n this.projectInterface = ProjectInterface()\n this.imagePreloader = new ImagePreloader()\n this.audioController = audioControllerFactory()\n this.markers = []\n this.configAnimation = this.configAnimation.bind(this)\n this.onSetupError = this.onSetupError.bind(this)\n this.onSegmentComplete = this.onSegmentComplete.bind(this)\n this.drawnFrameEvent = new BMEnterFrameEvent('drawnFrame', 0, 0, 0)\n }\n\n extendPrototype([BaseEvent], AnimationItem)\n\n AnimationItem.prototype.setParams = function (params) {\n if (params.wrapper || params.container) {\n this.wrapper = params.wrapper || params.container\n }\n var animType = 'svg'\n if (params.animType) {\n animType = params.animType\n } else if (params.renderer) {\n animType = params.renderer\n }\n const RendererClass = getRenderer(animType)\n this.renderer = new RendererClass(this, params.rendererSettings)\n this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs)\n this.renderer.setProjectInterface(this.projectInterface)\n this.animType = animType\n if (params.loop === '' || params.loop === null || params.loop === undefined || params.loop === true) {\n this.loop = true\n } else if (params.loop === false) {\n this.loop = false\n } else {\n this.loop = parseInt(params.loop, 10)\n }\n this.autoplay = 'autoplay' in params ? params.autoplay : true\n this.name = params.name ? params.name : ''\n this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments')\n ? params.autoloadSegments\n : true\n this.assetsPath = params.assetsPath\n this.initialSegment = params.initialSegment\n if (params.audioFactory) {\n this.audioController.setAudioFactory(params.audioFactory)\n }\n if (params.animationData) {\n this.setupAnimation(params.animationData)\n } else if (params.path) {\n if (params.path.lastIndexOf('\\\\') !== -1) {\n this.path = params.path.substr(0, params.path.lastIndexOf('\\\\') + 1)\n } else {\n this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1)\n }\n this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1)\n this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'))\n dataManager.loadAnimation(params.path, this.configAnimation, this.onSetupError)\n }\n }\n\n AnimationItem.prototype.onSetupError = function () {\n this.trigger('data_failed')\n }\n\n AnimationItem.prototype.setupAnimation = function (data) {\n dataManager.completeAnimation(data, this.configAnimation)\n }\n\n AnimationItem.prototype.setData = function (wrapper, animationData) {\n if (animationData) {\n if (typeof animationData !== 'object') {\n animationData = JSON.parse(animationData)\n }\n }\n var params = {\n wrapper: wrapper,\n animationData: animationData,\n }\n var wrapperAttributes = wrapper.attributes\n\n params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-animation-path').value\n : wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-path').value\n : wrapperAttributes.getNamedItem('bm-path')\n ? wrapperAttributes.getNamedItem('bm-path').value\n : ''\n params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-type').value\n : wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-type').value\n : wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('bm-type').value\n : wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-renderer').value\n : wrapperAttributes.getNamedItem('bm-renderer')\n ? wrapperAttributes.getNamedItem('bm-renderer').value\n : 'canvas'\n\n var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-loop').value\n : wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-loop').value\n : wrapperAttributes.getNamedItem('bm-loop')\n ? wrapperAttributes.getNamedItem('bm-loop').value\n : ''\n if (loop === 'false') {\n params.loop = false\n } else if (loop === 'true') {\n params.loop = true\n } else if (loop !== '') {\n params.loop = parseInt(loop, 10)\n }\n var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-autoplay').value\n : wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-autoplay').value\n : wrapperAttributes.getNamedItem('bm-autoplay')\n ? wrapperAttributes.getNamedItem('bm-autoplay').value\n : true\n params.autoplay = autoplay !== 'false'\n\n params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-name').value\n : wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-name').value\n : wrapperAttributes.getNamedItem('bm-name')\n ? wrapperAttributes.getNamedItem('bm-name').value\n : ''\n var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-prerender').value\n : wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-prerender').value\n : wrapperAttributes.getNamedItem('bm-prerender')\n ? wrapperAttributes.getNamedItem('bm-prerender').value\n : ''\n\n if (prerender === 'false') {\n params.prerender = false\n }\n this.setParams(params)\n }\n\n AnimationItem.prototype.includeLayers = function (data) {\n if (data.op > this.animationData.op) {\n this.animationData.op = data.op\n this.totalFrames = Math.floor(data.op - this.animationData.ip)\n }\n var layers = this.animationData.layers\n var i\n var len = layers.length\n var newLayers = data.layers\n var j\n var jLen = newLayers.length\n for (j = 0; j < jLen; j += 1) {\n i = 0\n while (i < len) {\n if (layers[i].id === newLayers[j].id) {\n layers[i] = newLayers[j]\n break\n }\n i += 1\n }\n }\n if (data.chars || data.fonts) {\n this.renderer.globalData.fontManager.addChars(data.chars)\n this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs)\n }\n if (data.assets) {\n len = data.assets.length\n for (i = 0; i < len; i += 1) {\n this.animationData.assets.push(data.assets[i])\n }\n }\n this.animationData.__complete = false\n dataManager.completeAnimation(this.animationData, this.onSegmentComplete)\n }\n\n AnimationItem.prototype.onSegmentComplete = function (data) {\n this.animationData = data\n var expressionsPlugin = getExpressionsPlugin()\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this)\n }\n this.loadNextSegment()\n }\n\n AnimationItem.prototype.loadNextSegment = function () {\n var segments = this.animationData.segments\n if (!segments || segments.length === 0 || !this.autoloadSegments) {\n this.trigger('data_ready')\n this.timeCompleted = this.totalFrames\n return\n }\n var segment = segments.shift()\n this.timeCompleted = segment.time * this.frameRate\n var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json'\n this.segmentPos += 1\n dataManager.loadData(\n segmentPath,\n this.includeLayers.bind(this),\n function () {\n this.trigger('data_failed')\n }.bind(this),\n )\n }\n\n AnimationItem.prototype.loadSegments = function () {\n var segments = this.animationData.segments\n if (!segments) {\n this.timeCompleted = this.totalFrames\n }\n this.loadNextSegment()\n }\n\n AnimationItem.prototype.imagesLoaded = function () {\n this.trigger('loaded_images')\n this.checkLoaded()\n }\n\n AnimationItem.prototype.preloadImages = function () {\n this.imagePreloader.setAssetsPath(this.assetsPath)\n this.imagePreloader.setPath(this.path)\n this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this))\n }\n\n AnimationItem.prototype.configAnimation = function (animData) {\n if (!this.renderer) {\n return\n }\n try {\n this.animationData = animData\n if (this.initialSegment) {\n this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0])\n this.firstFrame = Math.round(this.initialSegment[0])\n } else {\n this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip)\n this.firstFrame = Math.round(this.animationData.ip)\n }\n this.renderer.configAnimation(animData)\n if (!animData.assets) {\n animData.assets = []\n }\n\n this.assets = this.animationData.assets\n this.frameRate = this.animationData.fr\n this.frameMult = this.animationData.fr / 1000\n this.renderer.searchExtraCompositions(animData.assets)\n this.markers = markerParser(animData.markers || [])\n this.trigger('config_ready')\n this.preloadImages()\n this.loadSegments()\n this.updaFrameModifier()\n this.waitForFontsLoaded()\n if (this.isPaused) {\n this.audioController.pause()\n }\n } catch (error) {\n this.triggerConfigError(error)\n }\n }\n\n AnimationItem.prototype.waitForFontsLoaded = function () {\n if (!this.renderer) {\n return\n }\n if (this.renderer.globalData.fontManager.isLoaded) {\n this.checkLoaded()\n } else {\n setTimeout(this.waitForFontsLoaded.bind(this), 20)\n }\n }\n\n AnimationItem.prototype.checkLoaded = function () {\n if (\n !this.isLoaded &&\n this.renderer.globalData.fontManager.isLoaded &&\n (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas') &&\n this.imagePreloader.loadedFootages()\n ) {\n this.isLoaded = true\n var expressionsPlugin = getExpressionsPlugin()\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this)\n }\n this.renderer.initItems()\n setTimeout(\n function () {\n this.trigger('DOMLoaded')\n }.bind(this),\n 0,\n )\n this.gotoFrame()\n if (this.autoplay) {\n this.play()\n }\n }\n }\n\n AnimationItem.prototype.resize = function () {\n this.renderer.updateContainerSize()\n }\n\n AnimationItem.prototype.setSubframe = function (flag) {\n this.isSubframeEnabled = !!flag\n }\n\n AnimationItem.prototype.gotoFrame = function () {\n this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame // eslint-disable-line no-bitwise\n\n if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {\n this.currentFrame = this.timeCompleted\n }\n this.trigger('enterFrame')\n this.renderFrame()\n this.trigger('drawnFrame')\n }\n\n AnimationItem.prototype.renderFrame = function () {\n if (this.isLoaded === false || !this.renderer) {\n return\n }\n try {\n this.renderer.renderFrame(this.currentFrame + this.firstFrame)\n } catch (error) {\n this.triggerRenderFrameError(error)\n }\n }\n\n AnimationItem.prototype.play = function (name) {\n if (name && this.name !== name) {\n return\n }\n if (this.isPaused === true) {\n this.isPaused = false\n this.trigger('_pause')\n this.audioController.resume()\n if (this._idle) {\n this._idle = false\n this.trigger('_active')\n }\n }\n }\n\n AnimationItem.prototype.pause = function (name) {\n if (name && this.name !== name) {\n return\n }\n if (this.isPaused === false) {\n this.isPaused = true\n this.trigger('_play')\n this._idle = true\n this.trigger('_idle')\n this.audioController.pause()\n }\n }\n\n AnimationItem.prototype.togglePause = function (name) {\n if (name && this.name !== name) {\n return\n }\n if (this.isPaused === true) {\n this.play()\n } else {\n this.pause()\n }\n }\n\n AnimationItem.prototype.stop = function (name) {\n if (name && this.name !== name) {\n return\n }\n this.pause()\n this.playCount = 0\n this._completedLoop = false\n this.setCurrentRawFrameValue(0)\n }\n\n AnimationItem.prototype.getMarkerData = function (markerName) {\n var marker\n for (var i = 0; i < this.markers.length; i += 1) {\n marker = this.markers[i]\n if (marker.payload && marker.payload.name === markerName) {\n return marker\n }\n }\n return null\n }\n\n AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return\n }\n var numValue = Number(value)\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value)\n if (marker) {\n this.goToAndStop(marker.time, true)\n }\n } else if (isFrame) {\n this.setCurrentRawFrameValue(value)\n } else {\n this.setCurrentRawFrameValue(value * this.frameModifier)\n }\n this.pause()\n }\n\n AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return\n }\n var numValue = Number(value)\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value)\n if (marker) {\n if (!marker.duration) {\n this.goToAndStop(marker.time, true)\n } else {\n this.playSegments([marker.time, marker.time + marker.duration], true)\n }\n }\n } else {\n this.goToAndStop(numValue, isFrame, name)\n }\n this.play()\n }\n\n AnimationItem.prototype.advanceTime = function (value) {\n if (this.isPaused === true || this.isLoaded === false) {\n return\n }\n var nextValue = this.currentRawFrame + value * this.frameModifier\n var _isComplete = false\n // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.\n // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.\n if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {\n if (!this.loop || this.playCount === this.loop) {\n if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {\n _isComplete = true\n nextValue = this.totalFrames - 1\n }\n } else if (nextValue >= this.totalFrames) {\n this.playCount += 1\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n this.setCurrentRawFrameValue(nextValue % this.totalFrames)\n this._completedLoop = true\n this.trigger('loopComplete')\n }\n } else {\n this.setCurrentRawFrameValue(nextValue)\n }\n } else if (nextValue < 0) {\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {\n // eslint-disable-line no-plusplus\n this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames))\n if (!this._completedLoop) {\n this._completedLoop = true\n } else {\n this.trigger('loopComplete')\n }\n } else {\n _isComplete = true\n nextValue = 0\n }\n }\n } else {\n this.setCurrentRawFrameValue(nextValue)\n }\n if (_isComplete) {\n this.setCurrentRawFrameValue(nextValue)\n this.pause()\n this.trigger('complete')\n }\n }\n\n AnimationItem.prototype.adjustSegment = function (arr, offset) {\n this.playCount = 0\n if (arr[1] < arr[0]) {\n if (this.frameModifier > 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed)\n } else {\n this.setDirection(-1)\n }\n }\n this.totalFrames = arr[0] - arr[1]\n this.timeCompleted = this.totalFrames\n this.firstFrame = arr[1]\n this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset)\n } else if (arr[1] > arr[0]) {\n if (this.frameModifier < 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed)\n } else {\n this.setDirection(1)\n }\n }\n this.totalFrames = arr[1] - arr[0]\n this.timeCompleted = this.totalFrames\n this.firstFrame = arr[0]\n this.setCurrentRawFrameValue(0.001 + offset)\n }\n this.trigger('segmentStart')\n }\n AnimationItem.prototype.setSegment = function (init, end) {\n var pendingFrame = -1\n if (this.isPaused) {\n if (this.currentRawFrame + this.firstFrame < init) {\n pendingFrame = init\n } else if (this.currentRawFrame + this.firstFrame > end) {\n pendingFrame = end - init\n }\n }\n\n this.firstFrame = init\n this.totalFrames = end - init\n this.timeCompleted = this.totalFrames\n if (pendingFrame !== -1) {\n this.goToAndStop(pendingFrame, true)\n }\n }\n\n AnimationItem.prototype.playSegments = function (arr, forceFlag) {\n if (forceFlag) {\n this.segments.length = 0\n }\n if (typeof arr[0] === 'object') {\n var i\n var len = arr.length\n for (i = 0; i < len; i += 1) {\n this.segments.push(arr[i])\n }\n } else {\n this.segments.push(arr)\n }\n if (this.segments.length && forceFlag) {\n this.adjustSegment(this.segments.shift(), 0)\n }\n if (this.isPaused) {\n this.play()\n }\n }\n\n AnimationItem.prototype.resetSegments = function (forceFlag) {\n this.segments.length = 0\n this.segments.push([this.animationData.ip, this.animationData.op])\n if (forceFlag) {\n this.checkSegments(0)\n }\n }\n AnimationItem.prototype.checkSegments = function (offset) {\n if (this.segments.length) {\n this.adjustSegment(this.segments.shift(), offset)\n return true\n }\n return false\n }\n\n AnimationItem.prototype.destroy = function (name) {\n if ((name && this.name !== name) || !this.renderer) {\n return\n }\n this.renderer.destroy()\n this.imagePreloader.destroy()\n this.trigger('destroy')\n this._cbs = null\n this.onEnterFrame = null\n this.onLoopComplete = null\n this.onComplete = null\n this.onSegmentStart = null\n this.onDestroy = null\n this.renderer = null\n this.renderer = null\n this.imagePreloader = null\n this.projectInterface = null\n }\n\n AnimationItem.prototype.setCurrentRawFrameValue = function (value) {\n this.currentRawFrame = value\n this.gotoFrame()\n }\n\n AnimationItem.prototype.setSpeed = function (val) {\n this.playSpeed = val\n this.updaFrameModifier()\n }\n\n AnimationItem.prototype.setDirection = function (val) {\n this.playDirection = val < 0 ? -1 : 1\n this.updaFrameModifier()\n }\n\n AnimationItem.prototype.setVolume = function (val, name) {\n if (name && this.name !== name) {\n return\n }\n this.audioController.setVolume(val)\n }\n\n AnimationItem.prototype.getVolume = function () {\n return this.audioController.getVolume()\n }\n\n AnimationItem.prototype.mute = function (name) {\n if (name && this.name !== name) {\n return\n }\n this.audioController.mute()\n }\n\n AnimationItem.prototype.unmute = function (name) {\n if (name && this.name !== name) {\n return\n }\n this.audioController.unmute()\n }\n\n AnimationItem.prototype.updaFrameModifier = function () {\n this.frameModifier = this.frameMult * this.playSpeed * this.playDirection\n this.audioController.setRate(this.playSpeed * this.playDirection)\n }\n\n AnimationItem.prototype.getPath = function () {\n return this.path\n }\n\n AnimationItem.prototype.getAssetsPath = function (assetData) {\n var path = ''\n if (assetData.e) {\n path = assetData.p\n } else if (this.assetsPath) {\n var imagePath = assetData.p\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1]\n }\n path = this.assetsPath + imagePath\n } else {\n path = this.path\n path += assetData.u ? assetData.u : ''\n path += assetData.p\n }\n return path\n }\n\n AnimationItem.prototype.getAssetData = function (id) {\n var i = 0\n var len = this.assets.length\n while (i < len) {\n if (id === this.assets[i].id) {\n return this.assets[i]\n }\n i += 1\n }\n return null\n }\n\n AnimationItem.prototype.hide = function () {\n this.renderer.hide()\n }\n\n AnimationItem.prototype.show = function () {\n this.renderer.show()\n }\n\n AnimationItem.prototype.getDuration = function (isFrame) {\n return isFrame ? this.totalFrames : this.totalFrames / this.frameRate\n }\n\n AnimationItem.prototype.updateDocumentData = function (path, documentData, index) {\n try {\n var element = this.renderer.getElementByPath(path)\n element.updateDocumentData(documentData, index)\n } catch (error) {\n // TODO: decide how to handle catch case\n }\n }\n\n AnimationItem.prototype.trigger = function (name) {\n if (this._cbs && this._cbs[name]) {\n switch (name) {\n case 'enterFrame':\n this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier))\n break\n case 'drawnFrame':\n this.drawnFrameEvent.currentTime = this.currentFrame\n this.drawnFrameEvent.totalTime = this.totalFrames\n this.drawnFrameEvent.direction = this.frameModifier\n this.triggerEvent(name, this.drawnFrameEvent)\n break\n case 'loopComplete':\n this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult))\n break\n case 'complete':\n this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult))\n break\n case 'segmentStart':\n this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames))\n break\n case 'destroy':\n this.triggerEvent(name, new BMDestroyEvent(name, this))\n break\n default:\n this.triggerEvent(name)\n }\n }\n if (name === 'enterFrame' && this.onEnterFrame) {\n this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult))\n }\n if (name === 'loopComplete' && this.onLoopComplete) {\n this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult))\n }\n if (name === 'complete' && this.onComplete) {\n this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult))\n }\n if (name === 'segmentStart' && this.onSegmentStart) {\n this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames))\n }\n if (name === 'destroy' && this.onDestroy) {\n this.onDestroy.call(this, new BMDestroyEvent(name, this))\n }\n }\n\n AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {\n var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame)\n this.triggerEvent('error', error)\n\n if (this.onError) {\n this.onError.call(this, error)\n }\n }\n\n AnimationItem.prototype.triggerConfigError = function (nativeError) {\n var error = new BMConfigErrorEvent(nativeError, this.currentFrame)\n this.triggerEvent('error', error)\n\n if (this.onError) {\n this.onError.call(this, error)\n }\n }\n\n const animationManager = (function () {\n var moduleOb = {}\n var registeredAnimations = []\n var initTime = 0\n var len = 0\n var playingAnimationsNum = 0\n var _stopped = true\n var _isFrozen = false\n\n function removeElement(ev) {\n var i = 0\n var animItem = ev.target\n while (i < len) {\n if (registeredAnimations[i].animation === animItem) {\n registeredAnimations.splice(i, 1)\n i -= 1\n len -= 1\n if (!animItem.isPaused) {\n subtractPlayingCount()\n }\n }\n i += 1\n }\n }\n\n function registerAnimation(element, animationData) {\n if (!element) {\n return null\n }\n var i = 0\n while (i < len) {\n if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) {\n return registeredAnimations[i].animation\n }\n i += 1\n }\n var animItem = new AnimationItem()\n setupAnimation(animItem, element)\n animItem.setData(element, animationData)\n return animItem\n }\n\n function getRegisteredAnimations() {\n var i\n var lenAnims = registeredAnimations.length\n var animations = []\n for (i = 0; i < lenAnims; i += 1) {\n animations.push(registeredAnimations[i].animation)\n }\n return animations\n }\n\n function addPlayingCount() {\n playingAnimationsNum += 1\n activate()\n }\n\n function subtractPlayingCount() {\n playingAnimationsNum -= 1\n }\n\n function setupAnimation(animItem, element) {\n animItem.addEventListener('destroy', removeElement)\n animItem.addEventListener('_active', addPlayingCount)\n animItem.addEventListener('_idle', subtractPlayingCount)\n registeredAnimations.push({ elem: element, animation: animItem })\n len += 1\n }\n\n function loadAnimation(params) {\n var animItem = new AnimationItem()\n setupAnimation(animItem, null)\n animItem.setParams(params)\n return animItem\n }\n\n function setSpeed(val, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setSpeed(val, animation)\n }\n }\n\n function setDirection(val, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setDirection(val, animation)\n }\n }\n\n function play(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.play(animation)\n }\n }\n function resume(nowTime) {\n var elapsedTime = nowTime - initTime\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.advanceTime(elapsedTime)\n }\n initTime = nowTime\n if (playingAnimationsNum && !_isFrozen) {\n window.requestAnimationFrame(resume)\n } else {\n _stopped = true\n }\n }\n\n function first(nowTime) {\n initTime = nowTime\n window.requestAnimationFrame(resume)\n }\n\n function pause(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.pause(animation)\n }\n }\n\n function goToAndStop(value, isFrame, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.goToAndStop(value, isFrame, animation)\n }\n }\n\n function stop(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.stop(animation)\n }\n }\n\n function togglePause(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.togglePause(animation)\n }\n }\n\n function destroy(animation) {\n var i\n for (i = len - 1; i >= 0; i -= 1) {\n registeredAnimations[i].animation.destroy(animation)\n }\n }\n\n function searchAnimations(animationData, standalone, renderer) {\n var animElements = [].concat(\n [].slice.call(document.getElementsByClassName('lottie')),\n [].slice.call(document.getElementsByClassName('bodymovin')),\n )\n var i\n var lenAnims = animElements.length\n for (i = 0; i < lenAnims; i += 1) {\n if (renderer) {\n animElements[i].setAttribute('data-bm-type', renderer)\n }\n registerAnimation(animElements[i], animationData)\n }\n if (standalone && lenAnims === 0) {\n if (!renderer) {\n renderer = 'svg'\n }\n var body = document.getElementsByTagName('body')[0]\n body.innerText = ''\n var div = createTag('div')\n div.style.width = '100%'\n div.style.height = '100%'\n div.setAttribute('data-bm-type', renderer)\n body.appendChild(div)\n registerAnimation(div, animationData)\n }\n }\n\n function resize() {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.resize()\n }\n }\n\n function activate() {\n if (!_isFrozen && playingAnimationsNum) {\n if (_stopped) {\n window.requestAnimationFrame(first)\n _stopped = false\n }\n }\n }\n\n function freeze() {\n _isFrozen = true\n }\n\n function unfreeze() {\n _isFrozen = false\n activate()\n }\n\n function setVolume(val, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setVolume(val, animation)\n }\n }\n\n function mute(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.mute(animation)\n }\n }\n\n function unmute(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.unmute(animation)\n }\n }\n\n moduleOb.registerAnimation = registerAnimation\n moduleOb.loadAnimation = loadAnimation\n moduleOb.setSpeed = setSpeed\n moduleOb.setDirection = setDirection\n moduleOb.play = play\n moduleOb.pause = pause\n moduleOb.stop = stop\n moduleOb.togglePause = togglePause\n moduleOb.searchAnimations = searchAnimations\n moduleOb.resize = resize\n // moduleOb.start = start;\n moduleOb.goToAndStop = goToAndStop\n moduleOb.destroy = destroy\n moduleOb.freeze = freeze\n moduleOb.unfreeze = unfreeze\n moduleOb.setVolume = setVolume\n moduleOb.mute = mute\n moduleOb.unmute = unmute\n moduleOb.getRegisteredAnimations = getRegisteredAnimations\n return moduleOb\n })()\n\n /* eslint-disable */\n const BezierFactory = (function () {\n /**\n * BezierEasing - use bezier curve for transition easing function\n * by Gaëtan Renaudeau 2014 - 2015 – MIT License\n *\n * Credits: is based on Firefox's nsSMILKeySpline.cpp\n * Usage:\n * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])\n * spline.get(x) => returns the easing value | x must be in [0, 1] range\n *\n */\n\n var ob = {}\n ob.getBezierEasing = getBezierEasing\n var beziers = {}\n\n function getBezierEasing(a, b, c, d, nm) {\n var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\\./g, 'p')\n if (beziers[str]) {\n return beziers[str]\n }\n var bezEasing = new BezierEasing([a, b, c, d])\n beziers[str] = bezEasing\n return bezEasing\n }\n\n // These values are established by empiricism with tests (tradeoff: performance VS precision)\n var NEWTON_ITERATIONS = 4\n var NEWTON_MIN_SLOPE = 0.001\n var SUBDIVISION_PRECISION = 0.0000001\n var SUBDIVISION_MAX_ITERATIONS = 10\n\n var kSplineTableSize = 11\n var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0)\n\n var float32ArraySupported = typeof Float32Array === 'function'\n\n function A(aA1, aA2) {\n return 1.0 - 3.0 * aA2 + 3.0 * aA1\n }\n function B(aA1, aA2) {\n return 3.0 * aA2 - 6.0 * aA1\n }\n function C(aA1) {\n return 3.0 * aA1\n }\n\n // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\n function calcBezier(aT, aA1, aA2) {\n return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT\n }\n\n // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\n function getSlope(aT, aA1, aA2) {\n return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1)\n }\n\n function binarySubdivide(aX, aA, aB, mX1, mX2) {\n var currentX,\n currentT,\n i = 0\n do {\n currentT = aA + (aB - aA) / 2.0\n currentX = calcBezier(currentT, mX1, mX2) - aX\n if (currentX > 0.0) {\n aB = currentT\n } else {\n aA = currentT\n }\n } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS)\n return currentT\n }\n\n function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\n for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\n var currentSlope = getSlope(aGuessT, mX1, mX2)\n if (currentSlope === 0.0) return aGuessT\n var currentX = calcBezier(aGuessT, mX1, mX2) - aX\n aGuessT -= currentX / currentSlope\n }\n return aGuessT\n }\n\n /**\n * points is an array of [ mX1, mY1, mX2, mY2 ]\n */\n function BezierEasing(points) {\n this._p = points\n this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize)\n this._precomputed = false\n\n this.get = this.get.bind(this)\n }\n\n BezierEasing.prototype = {\n get: function (x) {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3]\n if (!this._precomputed) this._precompute()\n if (mX1 === mY1 && mX2 === mY2) return x // linear\n // Because JavaScript number are imprecise, we should guarantee the extremes are right.\n if (x === 0) return 0\n if (x === 1) return 1\n return calcBezier(this._getTForX(x), mY1, mY2)\n },\n\n // Private part\n\n _precompute: function () {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3]\n this._precomputed = true\n if (mX1 !== mY1 || mX2 !== mY2) {\n this._calcSampleValues()\n }\n },\n\n _calcSampleValues: function () {\n var mX1 = this._p[0],\n mX2 = this._p[2]\n for (var i = 0; i < kSplineTableSize; ++i) {\n this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2)\n }\n },\n\n /**\n * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.\n */\n _getTForX: function (aX) {\n var mX1 = this._p[0],\n mX2 = this._p[2],\n mSampleValues = this._mSampleValues\n\n var intervalStart = 0.0\n var currentSample = 1\n var lastSample = kSplineTableSize - 1\n\n for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {\n intervalStart += kSampleStepSize\n }\n --currentSample\n\n // Interpolate to provide an initial guess for t\n var dist =\n (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample])\n var guessForT = intervalStart + dist * kSampleStepSize\n\n var initialSlope = getSlope(guessForT, mX1, mX2)\n if (initialSlope >= NEWTON_MIN_SLOPE) {\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2)\n }\n if (initialSlope === 0.0) {\n return guessForT\n }\n return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2)\n },\n }\n\n return ob\n })()\n\n const pooling = (function () {\n function double(arr) {\n return arr.concat(createSizedArray(arr.length))\n }\n\n return {\n double: double,\n }\n })()\n\n const poolFactory = (function () {\n return function (initialLength, _create, _release) {\n var _length = 0\n var _maxLength = initialLength\n var pool = createSizedArray(_maxLength)\n\n var ob = {\n newElement: newElement,\n release: release,\n }\n\n function newElement() {\n var element\n if (_length) {\n _length -= 1\n element = pool[_length]\n } else {\n element = _create()\n }\n return element\n }\n\n function release(element) {\n if (_length === _maxLength) {\n pool = pooling.double(pool)\n _maxLength *= 2\n }\n if (_release) {\n _release(element)\n }\n pool[_length] = element\n _length += 1\n }\n\n return ob\n }\n })()\n\n const bezierLengthPool = (function () {\n function create() {\n return {\n addedLength: 0,\n percents: createTypedArray('float32', getDefaultCurveSegments()),\n lengths: createTypedArray('float32', getDefaultCurveSegments()),\n }\n }\n return poolFactory(8, create)\n })()\n\n const segmentsLengthPool = (function () {\n function create() {\n return {\n lengths: [],\n totalLength: 0,\n }\n }\n\n function release(element) {\n var i\n var len = element.lengths.length\n for (i = 0; i < len; i += 1) {\n bezierLengthPool.release(element.lengths[i])\n }\n element.lengths.length = 0\n }\n\n return poolFactory(8, create, release)\n })()\n\n function bezFunction() {\n var math = Math\n\n function pointOnLine2D(x1, y1, x2, y2, x3, y3) {\n var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1\n return det1 > -0.001 && det1 < 0.001\n }\n\n function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {\n if (z1 === 0 && z2 === 0 && z3 === 0) {\n return pointOnLine2D(x1, y1, x2, y2, x3, y3)\n }\n var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2))\n var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2))\n var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2))\n var diffDist\n if (dist1 > dist2) {\n if (dist1 > dist3) {\n diffDist = dist1 - dist2 - dist3\n } else {\n diffDist = dist3 - dist2 - dist1\n }\n } else if (dist3 > dist2) {\n diffDist = dist3 - dist2 - dist1\n } else {\n diffDist = dist2 - dist1 - dist3\n }\n return diffDist > -0.0001 && diffDist < 0.0001\n }\n\n var getBezierLength = (function () {\n return function (pt1, pt2, pt3, pt4) {\n var curveSegments = getDefaultCurveSegments()\n var k\n var i\n var len\n var ptCoord\n var perc\n var addedLength = 0\n var ptDistance\n var point = []\n var lastPoint = []\n var lengthData = bezierLengthPool.newElement()\n len = pt3.length\n for (k = 0; k < curveSegments; k += 1) {\n perc = k / (curveSegments - 1)\n ptDistance = 0\n for (i = 0; i < len; i += 1) {\n ptCoord =\n bmPow(1 - perc, 3) * pt1[i] +\n 3 * bmPow(1 - perc, 2) * perc * pt3[i] +\n 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] +\n bmPow(perc, 3) * pt2[i]\n point[i] = ptCoord\n if (lastPoint[i] !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2)\n }\n lastPoint[i] = point[i]\n }\n if (ptDistance) {\n ptDistance = bmSqrt(ptDistance)\n addedLength += ptDistance\n }\n lengthData.percents[k] = perc\n lengthData.lengths[k] = addedLength\n }\n lengthData.addedLength = addedLength\n return lengthData\n }\n })()\n\n function getSegmentsLength(shapeData) {\n var segmentsLength = segmentsLengthPool.newElement()\n var closed = shapeData.c\n var pathV = shapeData.v\n var pathO = shapeData.o\n var pathI = shapeData.i\n var i\n var len = shapeData._length\n var lengths = segmentsLength.lengths\n var totalLength = 0\n for (i = 0; i < len - 1; i += 1) {\n lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1])\n totalLength += lengths[i].addedLength\n }\n if (closed && len) {\n lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0])\n totalLength += lengths[i].addedLength\n }\n segmentsLength.totalLength = totalLength\n return segmentsLength\n }\n\n function BezierData(length) {\n this.segmentLength = 0\n this.points = new Array(length)\n }\n\n function PointData(partial, point) {\n this.partialLength = partial\n this.point = point\n }\n\n var buildBezierData = (function () {\n var storedData = {}\n\n return function (pt1, pt2, pt3, pt4) {\n var bezierName = (\n pt1[0] +\n '_' +\n pt1[1] +\n '_' +\n pt2[0] +\n '_' +\n pt2[1] +\n '_' +\n pt3[0] +\n '_' +\n pt3[1] +\n '_' +\n pt4[0] +\n '_' +\n pt4[1]\n ).replace(/\\./g, 'p')\n if (!storedData[bezierName]) {\n var curveSegments = getDefaultCurveSegments()\n var k\n var i\n var len\n var ptCoord\n var perc\n var addedLength = 0\n var ptDistance\n var point\n var lastPoint = null\n if (\n pt1.length === 2 &&\n (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) &&\n pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) &&\n pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])\n ) {\n curveSegments = 2\n }\n var bezierData = new BezierData(curveSegments)\n len = pt3.length\n for (k = 0; k < curveSegments; k += 1) {\n point = createSizedArray(len)\n perc = k / (curveSegments - 1)\n ptDistance = 0\n for (i = 0; i < len; i += 1) {\n ptCoord =\n bmPow(1 - perc, 3) * pt1[i] +\n 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) +\n 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) +\n bmPow(perc, 3) * pt2[i]\n point[i] = ptCoord\n if (lastPoint !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2)\n }\n }\n ptDistance = bmSqrt(ptDistance)\n addedLength += ptDistance\n bezierData.points[k] = new PointData(ptDistance, point)\n lastPoint = point\n }\n bezierData.segmentLength = addedLength\n storedData[bezierName] = bezierData\n }\n return storedData[bezierName]\n }\n })()\n\n function getDistancePerc(perc, bezierData) {\n var percents = bezierData.percents\n var lengths = bezierData.lengths\n var len = percents.length\n var initPos = bmFloor((len - 1) * perc)\n var lengthPos = perc * bezierData.addedLength\n var lPerc = 0\n if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {\n return percents[initPos]\n }\n var dir = lengths[initPos] > lengthPos ? -1 : 1\n var flag = true\n while (flag) {\n if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {\n lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos])\n flag = false\n } else {\n initPos += dir\n }\n if (initPos < 0 || initPos >= len - 1) {\n // FIX for TypedArrays that don't store floating point values with enough accuracy\n if (initPos === len - 1) {\n return percents[initPos]\n }\n flag = false\n }\n }\n return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc\n }\n\n function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {\n var t1 = getDistancePerc(percent, bezierData)\n var u1 = 1 - t1\n var ptX =\n math.round(\n (u1 * u1 * u1 * pt1[0] +\n (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] +\n (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] +\n t1 * t1 * t1 * pt2[0]) *\n 1000,\n ) / 1000\n var ptY =\n math.round(\n (u1 * u1 * u1 * pt1[1] +\n (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] +\n (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] +\n t1 * t1 * t1 * pt2[1]) *\n 1000,\n ) / 1000\n return [ptX, ptY]\n }\n\n var bezierSegmentPoints = createTypedArray('float32', 8)\n\n function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {\n if (startPerc < 0) {\n startPerc = 0\n } else if (startPerc > 1) {\n startPerc = 1\n }\n var t0 = getDistancePerc(startPerc, bezierData)\n endPerc = endPerc > 1 ? 1 : endPerc\n var t1 = getDistancePerc(endPerc, bezierData)\n var i\n var len = pt1.length\n var u0 = 1 - t0\n var u1 = 1 - t1\n var u0u0u0 = u0 * u0 * u0\n var t0u0u0_3 = t0 * u0 * u0 * 3 // eslint-disable-line camelcase\n var t0t0u0_3 = t0 * t0 * u0 * 3 // eslint-disable-line camelcase\n var t0t0t0 = t0 * t0 * t0\n //\n var u0u0u1 = u0 * u0 * u1\n var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1 // eslint-disable-line camelcase\n var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1 // eslint-disable-line camelcase\n var t0t0t1 = t0 * t0 * t1\n //\n var u0u1u1 = u0 * u1 * u1\n var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1 // eslint-disable-line camelcase\n var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1 // eslint-disable-line camelcase\n var t0t1t1 = t0 * t1 * t1\n //\n var u1u1u1 = u1 * u1 * u1\n var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1 // eslint-disable-line camelcase\n var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1 // eslint-disable-line camelcase\n var t1t1t1 = t1 * t1 * t1\n for (i = 0; i < len; i += 1) {\n bezierSegmentPoints[i * 4] =\n math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 1] =\n math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 2] =\n math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 3] =\n math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n }\n\n return bezierSegmentPoints\n }\n\n return {\n getSegmentsLength: getSegmentsLength,\n getNewSegment: getNewSegment,\n getPointInSegment: getPointInSegment,\n buildBezierData: buildBezierData,\n pointOnLine2D: pointOnLine2D,\n pointOnLine3D: pointOnLine3D,\n }\n }\n\n const bez = bezFunction()\n\n const PropertyFactory = (function () {\n var initFrame = initialDefaultFrame\n var mathAbs = Math.abs\n\n function interpolateValue(frameNum, caching) {\n var offsetTime = this.offsetTime\n var newValue\n if (this.propType === 'multidimensional') {\n newValue = createTypedArray('float32', this.pv.length)\n }\n var iterationIndex = caching.lastIndex\n var i = iterationIndex\n var len = this.keyframes.length - 1\n var flag = true\n var keyData\n var nextKeyData\n var keyframeMetadata\n\n while (flag) {\n keyData = this.keyframes[i]\n nextKeyData = this.keyframes[i + 1]\n if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {\n if (keyData.h) {\n keyData = nextKeyData\n }\n iterationIndex = 0\n break\n }\n if (nextKeyData.t - offsetTime > frameNum) {\n iterationIndex = i\n break\n }\n if (i < len - 1) {\n i += 1\n } else {\n iterationIndex = 0\n flag = false\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {}\n\n var k\n var kLen\n var perc\n var jLen\n var j\n var fnc\n var nextKeyTime = nextKeyData.t - offsetTime\n var keyTime = keyData.t - offsetTime\n var endValue\n if (keyData.to) {\n if (!keyframeMetadata.bezierData) {\n keyframeMetadata.bezierData = bez.buildBezierData(\n keyData.s,\n nextKeyData.s || keyData.e,\n keyData.to,\n keyData.ti,\n )\n }\n var bezierData = keyframeMetadata.bezierData\n if (frameNum >= nextKeyTime || frameNum < keyTime) {\n var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0\n kLen = bezierData.points[ind].point.length\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[ind].point[k]\n }\n // caching._lastKeyframeIndex = -1;\n } else {\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get\n keyframeMetadata.__fnct = fnc\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime))\n var distanceInLine = bezierData.segmentLength * perc\n\n var segmentPerc\n var addedLength =\n caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastAddedLength : 0\n j = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastPoint : 0\n flag = true\n jLen = bezierData.points.length\n while (flag) {\n addedLength += bezierData.points[j].partialLength\n if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {\n kLen = bezierData.points[j].point.length\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[j].point[k]\n }\n break\n } else if (\n distanceInLine >= addedLength &&\n distanceInLine < addedLength + bezierData.points[j + 1].partialLength\n ) {\n segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength\n kLen = bezierData.points[j].point.length\n for (k = 0; k < kLen; k += 1) {\n newValue[k] =\n bezierData.points[j].point[k] +\n (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc\n }\n break\n }\n if (j < jLen - 1) {\n j += 1\n } else {\n flag = false\n }\n }\n caching._lastPoint = j\n caching._lastAddedLength = addedLength - bezierData.points[j].partialLength\n caching._lastKeyframeIndex = i\n }\n } else {\n var outX\n var outY\n var inX\n var inY\n var keyValue\n len = keyData.s.length\n endValue = nextKeyData.s || keyData.e\n if (this.sh && keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n newValue[0] = endValue[0]\n newValue[1] = endValue[1]\n newValue[2] = endValue[2]\n } else if (frameNum <= keyTime) {\n newValue[0] = keyData.s[0]\n newValue[1] = keyData.s[1]\n newValue[2] = keyData.s[2]\n } else {\n var quatStart = createQuaternion(keyData.s)\n var quatEnd = createQuaternion(endValue)\n var time = (frameNum - keyTime) / (nextKeyTime - keyTime)\n quaternionToEuler(newValue, slerp(quatStart, quatEnd, time))\n }\n } else {\n for (i = 0; i < len; i += 1) {\n if (keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n perc = 1\n } else if (frameNum < keyTime) {\n perc = 0\n } else {\n if (keyData.o.x.constructor === Array) {\n if (!keyframeMetadata.__fnct) {\n keyframeMetadata.__fnct = []\n }\n if (!keyframeMetadata.__fnct[i]) {\n outX = keyData.o.x[i] === undefined ? keyData.o.x[0] : keyData.o.x[i]\n outY = keyData.o.y[i] === undefined ? keyData.o.y[0] : keyData.o.y[i]\n inX = keyData.i.x[i] === undefined ? keyData.i.x[0] : keyData.i.x[i]\n inY = keyData.i.y[i] === undefined ? keyData.i.y[0] : keyData.i.y[i]\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get\n keyframeMetadata.__fnct[i] = fnc\n } else {\n fnc = keyframeMetadata.__fnct[i]\n }\n } else if (!keyframeMetadata.__fnct) {\n outX = keyData.o.x\n outY = keyData.o.y\n inX = keyData.i.x\n inY = keyData.i.y\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get\n keyData.keyframeMetadata = fnc\n } else {\n fnc = keyframeMetadata.__fnct\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime))\n }\n }\n\n endValue = nextKeyData.s || keyData.e\n keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc\n\n if (this.propType === 'multidimensional') {\n newValue[i] = keyValue\n } else {\n newValue = keyValue\n }\n }\n }\n }\n caching.lastIndex = iterationIndex\n return newValue\n }\n\n // based on @Toji's https://github.com/toji/gl-matrix/\n function slerp(a, b, t) {\n var out = []\n var ax = a[0]\n var ay = a[1]\n var az = a[2]\n var aw = a[3]\n var bx = b[0]\n var by = b[1]\n var bz = b[2]\n var bw = b[3]\n\n var omega\n var cosom\n var sinom\n var scale0\n var scale1\n\n cosom = ax * bx + ay * by + az * bz + aw * bw\n if (cosom < 0.0) {\n cosom = -cosom\n bx = -bx\n by = -by\n bz = -bz\n bw = -bw\n }\n if (1.0 - cosom > 0.000001) {\n omega = Math.acos(cosom)\n sinom = Math.sin(omega)\n scale0 = Math.sin((1.0 - t) * omega) / sinom\n scale1 = Math.sin(t * omega) / sinom\n } else {\n scale0 = 1.0 - t\n scale1 = t\n }\n out[0] = scale0 * ax + scale1 * bx\n out[1] = scale0 * ay + scale1 * by\n out[2] = scale0 * az + scale1 * bz\n out[3] = scale0 * aw + scale1 * bw\n\n return out\n }\n\n function quaternionToEuler(out, quat) {\n var qx = quat[0]\n var qy = quat[1]\n var qz = quat[2]\n var qw = quat[3]\n var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz)\n var attitude = Math.asin(2 * qx * qy + 2 * qz * qw)\n var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz)\n out[0] = heading / degToRads\n out[1] = attitude / degToRads\n out[2] = bank / degToRads\n }\n\n function createQuaternion(values) {\n var heading = values[0] * degToRads\n var attitude = values[1] * degToRads\n var bank = values[2] * degToRads\n var c1 = Math.cos(heading / 2)\n var c2 = Math.cos(attitude / 2)\n var c3 = Math.cos(bank / 2)\n var s1 = Math.sin(heading / 2)\n var s2 = Math.sin(attitude / 2)\n var s3 = Math.sin(bank / 2)\n var w = c1 * c2 * c3 - s1 * s2 * s3\n var x = s1 * s2 * c3 + c1 * c2 * s3\n var y = s1 * c2 * c3 + c1 * s2 * s3\n var z = c1 * s2 * c3 - s1 * c2 * s3\n\n return [x, y, z, w]\n }\n\n function getValueAtCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime\n var initTime = this.keyframes[0].t - this.offsetTime\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime\n if (\n !(\n frameNum === this._caching.lastFrame ||\n (this._caching.lastFrame !== initFrame &&\n ((this._caching.lastFrame >= endTime && frameNum >= endTime) ||\n (this._caching.lastFrame < initTime && frameNum < initTime)))\n )\n ) {\n if (this._caching.lastFrame >= frameNum) {\n this._caching._lastKeyframeIndex = -1\n this._caching.lastIndex = 0\n }\n\n var renderResult = this.interpolateValue(frameNum, this._caching)\n this.pv = renderResult\n }\n this._caching.lastFrame = frameNum\n return this.pv\n }\n\n function setVValue(val) {\n var multipliedValue\n if (this.propType === 'unidimensional') {\n multipliedValue = val * this.mult\n if (mathAbs(this.v - multipliedValue) > 0.00001) {\n this.v = multipliedValue\n this._mdf = true\n }\n } else {\n var i = 0\n var len = this.v.length\n while (i < len) {\n multipliedValue = val[i] * this.mult\n if (mathAbs(this.v[i] - multipliedValue) > 0.00001) {\n this.v[i] = multipliedValue\n this._mdf = true\n }\n i += 1\n }\n }\n }\n\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {\n return\n }\n if (this.lock) {\n this.setVValue(this.pv)\n return\n }\n this.lock = true\n this._mdf = this._isFirstFrame\n var i\n var len = this.effectsSequence.length\n var finalValue = this.kf ? this.pv : this.data.k\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue)\n }\n this.setVValue(finalValue)\n this._isFirstFrame = false\n this.lock = false\n this.frameId = this.elem.globalData.frameId\n }\n\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction)\n this.container.addDynamicProperty(this)\n }\n\n function ValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional'\n this.mult = mult || 1\n this.data = data\n this.v = mult ? data.k * mult : data.k\n this.pv = data.k\n this._mdf = false\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.k = false\n this.kf = false\n this.vel = 0\n this.effectsSequence = []\n this._isFirstFrame = true\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.addEffect = addEffect\n }\n\n function MultiDimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional'\n this.mult = mult || 1\n this.data = data\n this._mdf = false\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.k = false\n this.kf = false\n this.frameId = -1\n var i\n var len = data.k.length\n this.v = createTypedArray('float32', len)\n this.pv = createTypedArray('float32', len)\n this.vel = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n this.v[i] = data.k[i] * this.mult\n this.pv[i] = data.k[i]\n }\n this._isFirstFrame = true\n this.effectsSequence = []\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.addEffect = addEffect\n }\n\n function KeyframedValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional'\n this.keyframes = data.k\n this.keyframesMetadata = []\n this.offsetTime = elem.data.st\n this.frameId = -1\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0,\n value: 0,\n _lastKeyframeIndex: -1,\n }\n this.k = true\n this.kf = true\n this.data = data\n this.mult = mult || 1\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.v = initFrame\n this.pv = initFrame\n this._isFirstFrame = true\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.interpolateValue = interpolateValue\n this.effectsSequence = [getValueAtCurrentTime.bind(this)]\n this.addEffect = addEffect\n }\n\n function KeyframedMultidimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional'\n var i\n var len = data.k.length\n var s\n var e\n var to\n var ti\n for (i = 0; i < len - 1; i += 1) {\n if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {\n s = data.k[i].s\n e = data.k[i + 1].s\n to = data.k[i].to\n ti = data.k[i].ti\n if (\n (s.length === 2 &&\n !(s[0] === e[0] && s[1] === e[1]) &&\n bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) &&\n bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1])) ||\n (s.length === 3 &&\n !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) &&\n bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) &&\n bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2]))\n ) {\n data.k[i].to = null\n data.k[i].ti = null\n }\n if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {\n if (s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {\n data.k[i].to = null\n data.k[i].ti = null\n }\n }\n }\n }\n this.effectsSequence = [getValueAtCurrentTime.bind(this)]\n this.data = data\n this.keyframes = data.k\n this.keyframesMetadata = []\n this.offsetTime = elem.data.st\n this.k = true\n this.kf = true\n this._isFirstFrame = true\n this.mult = mult || 1\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.interpolateValue = interpolateValue\n this.frameId = -1\n var arrLen = data.k[0].s.length\n this.v = createTypedArray('float32', arrLen)\n this.pv = createTypedArray('float32', arrLen)\n for (i = 0; i < arrLen; i += 1) {\n this.v[i] = initFrame\n this.pv[i] = initFrame\n }\n this._caching = { lastFrame: initFrame, lastIndex: 0, value: createTypedArray('float32', arrLen) }\n this.addEffect = addEffect\n }\n\n function getProp(elem, data, type, mult, container) {\n var p\n if (!data.k.length) {\n p = new ValueProperty(elem, data, mult, container)\n } else if (typeof data.k[0] === 'number') {\n p = new MultiDimensionalProperty(elem, data, mult, container)\n } else {\n switch (type) {\n case 0:\n p = new KeyframedValueProperty(elem, data, mult, container)\n break\n case 1:\n p = new KeyframedMultidimensionalProperty(elem, data, mult, container)\n break\n default:\n break\n }\n }\n if (p.effectsSequence.length) {\n container.addDynamicProperty(p)\n }\n return p\n }\n\n var ob = {\n getProp: getProp,\n }\n return ob\n })()\n\n function DynamicPropertyContainer() {}\n DynamicPropertyContainer.prototype = {\n addDynamicProperty: function (prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop)\n this.container.addDynamicProperty(this)\n this._isAnimated = true\n }\n },\n iterateDynamicProperties: function () {\n this._mdf = false\n var i\n var len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue()\n if (this.dynamicProperties[i]._mdf) {\n this._mdf = true\n }\n }\n },\n initDynamicPropertyContainer: function (container) {\n this.container = container\n this.dynamicProperties = []\n this._mdf = false\n this._isAnimated = false\n },\n }\n\n const pointPool = (function () {\n function create() {\n return createTypedArray('float32', 2)\n }\n return poolFactory(8, create)\n })()\n\n function ShapePath() {\n this.c = false\n this._length = 0\n this._maxLength = 8\n this.v = createSizedArray(this._maxLength)\n this.o = createSizedArray(this._maxLength)\n this.i = createSizedArray(this._maxLength)\n }\n\n ShapePath.prototype.setPathData = function (closed, len) {\n this.c = closed\n this.setLength(len)\n var i = 0\n while (i < len) {\n this.v[i] = pointPool.newElement()\n this.o[i] = pointPool.newElement()\n this.i[i] = pointPool.newElement()\n i += 1\n }\n }\n\n ShapePath.prototype.setLength = function (len) {\n while (this._maxLength < len) {\n this.doubleArrayLength()\n }\n this._length = len\n }\n\n ShapePath.prototype.doubleArrayLength = function () {\n this.v = this.v.concat(createSizedArray(this._maxLength))\n this.i = this.i.concat(createSizedArray(this._maxLength))\n this.o = this.o.concat(createSizedArray(this._maxLength))\n this._maxLength *= 2\n }\n\n ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {\n var arr\n this._length = Math.max(this._length, pos + 1)\n if (this._length >= this._maxLength) {\n this.doubleArrayLength()\n }\n switch (type) {\n case 'v':\n arr = this.v\n break\n case 'i':\n arr = this.i\n break\n case 'o':\n arr = this.o\n break\n default:\n arr = []\n break\n }\n if (!arr[pos] || (arr[pos] && !replace)) {\n arr[pos] = pointPool.newElement()\n }\n arr[pos][0] = x\n arr[pos][1] = y\n }\n\n ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {\n this.setXYAt(vX, vY, 'v', pos, replace)\n this.setXYAt(oX, oY, 'o', pos, replace)\n this.setXYAt(iX, iY, 'i', pos, replace)\n }\n\n ShapePath.prototype.reverse = function () {\n var newPath = new ShapePath()\n newPath.setPathData(this.c, this._length)\n var vertices = this.v\n var outPoints = this.o\n var inPoints = this.i\n var init = 0\n if (this.c) {\n newPath.setTripleAt(\n vertices[0][0],\n vertices[0][1],\n inPoints[0][0],\n inPoints[0][1],\n outPoints[0][0],\n outPoints[0][1],\n 0,\n false,\n )\n init = 1\n }\n var cnt = this._length - 1\n var len = this._length\n\n var i\n for (i = init; i < len; i += 1) {\n newPath.setTripleAt(\n vertices[cnt][0],\n vertices[cnt][1],\n inPoints[cnt][0],\n inPoints[cnt][1],\n outPoints[cnt][0],\n outPoints[cnt][1],\n i,\n false,\n )\n cnt -= 1\n }\n return newPath\n }\n\n const shapePool = (function () {\n function create() {\n return new ShapePath()\n }\n\n function release(shapePath) {\n var len = shapePath._length\n var i\n for (i = 0; i < len; i += 1) {\n pointPool.release(shapePath.v[i])\n pointPool.release(shapePath.i[i])\n pointPool.release(shapePath.o[i])\n shapePath.v[i] = null\n shapePath.i[i] = null\n shapePath.o[i] = null\n }\n shapePath._length = 0\n shapePath.c = false\n }\n\n function clone(shape) {\n var cloned = factory.newElement()\n var i\n var len = shape._length === undefined ? shape.v.length : shape._length\n cloned.setLength(len)\n cloned.c = shape.c\n\n for (i = 0; i < len; i += 1) {\n cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i)\n }\n return cloned\n }\n\n var factory = poolFactory(4, create, release)\n factory.clone = clone\n\n return factory\n })()\n\n function ShapeCollection() {\n this._length = 0\n this._maxLength = 4\n this.shapes = createSizedArray(this._maxLength)\n }\n\n ShapeCollection.prototype.addShape = function (shapeData) {\n if (this._length === this._maxLength) {\n this.shapes = this.shapes.concat(createSizedArray(this._maxLength))\n this._maxLength *= 2\n }\n this.shapes[this._length] = shapeData\n this._length += 1\n }\n\n ShapeCollection.prototype.releaseShapes = function () {\n var i\n for (i = 0; i < this._length; i += 1) {\n shapePool.release(this.shapes[i])\n }\n this._length = 0\n }\n\n const shapeCollectionPool = (function () {\n var ob = {\n newShapeCollection: newShapeCollection,\n release: release,\n }\n\n var _length = 0\n var _maxLength = 4\n var pool = createSizedArray(_maxLength)\n\n function newShapeCollection() {\n var shapeCollection\n if (_length) {\n _length -= 1\n shapeCollection = pool[_length]\n } else {\n shapeCollection = new ShapeCollection()\n }\n return shapeCollection\n }\n\n function release(shapeCollection) {\n var i\n var len = shapeCollection._length\n for (i = 0; i < len; i += 1) {\n shapePool.release(shapeCollection.shapes[i])\n }\n shapeCollection._length = 0\n\n if (_length === _maxLength) {\n pool = pooling.double(pool)\n _maxLength *= 2\n }\n pool[_length] = shapeCollection\n _length += 1\n }\n\n return ob\n })()\n\n const ShapePropertyFactory = (function () {\n var initFrame = -999999\n\n function interpolateShape(frameNum, previousValue, caching) {\n var iterationIndex = caching.lastIndex\n var keyPropS\n var keyPropE\n var isHold\n var j\n var k\n var jLen\n var kLen\n var perc\n var vertexValue\n var kf = this.keyframes\n if (frameNum < kf[0].t - this.offsetTime) {\n keyPropS = kf[0].s[0]\n isHold = true\n iterationIndex = 0\n } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {\n keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0]\n /* if(kf[kf.length - 1].s){\n keyPropS = kf[kf.length - 1].s[0];\n }else{\n keyPropS = kf[kf.length - 2].e[0];\n } */\n isHold = true\n } else {\n var i = iterationIndex\n var len = kf.length - 1\n var flag = true\n var keyData\n var nextKeyData\n var keyframeMetadata\n while (flag) {\n keyData = kf[i]\n nextKeyData = kf[i + 1]\n if (nextKeyData.t - this.offsetTime > frameNum) {\n break\n }\n if (i < len - 1) {\n i += 1\n } else {\n flag = false\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {}\n isHold = keyData.h === 1\n iterationIndex = i\n if (!isHold) {\n if (frameNum >= nextKeyData.t - this.offsetTime) {\n perc = 1\n } else if (frameNum < keyData.t - this.offsetTime) {\n perc = 0\n } else {\n var fnc\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get\n keyframeMetadata.__fnct = fnc\n }\n perc = fnc(\n (frameNum - (keyData.t - this.offsetTime)) /\n (nextKeyData.t - this.offsetTime - (keyData.t - this.offsetTime)),\n )\n }\n keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0]\n }\n keyPropS = keyData.s[0]\n }\n jLen = previousValue._length\n kLen = keyPropS.i[0].length\n caching.lastIndex = iterationIndex\n\n for (j = 0; j < jLen; j += 1) {\n for (k = 0; k < kLen; k += 1) {\n vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc\n previousValue.i[j][k] = vertexValue\n vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc\n previousValue.o[j][k] = vertexValue\n vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc\n previousValue.v[j][k] = vertexValue\n }\n }\n }\n\n function interpolateShapeCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime\n var initTime = this.keyframes[0].t - this.offsetTime\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime\n var lastFrame = this._caching.lastFrame\n if (\n !(\n lastFrame !== initFrame &&\n ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime))\n )\n ) {\n /// /\n this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0\n this.interpolateShape(frameNum, this.pv, this._caching)\n /// /\n }\n this._caching.lastFrame = frameNum\n return this.pv\n }\n\n function resetShape() {\n this.paths = this.localShapeCollection\n }\n\n function shapesEqual(shape1, shape2) {\n if (shape1._length !== shape2._length || shape1.c !== shape2.c) {\n return false\n }\n var i\n var len = shape1._length\n for (i = 0; i < len; i += 1) {\n if (\n shape1.v[i][0] !== shape2.v[i][0] ||\n shape1.v[i][1] !== shape2.v[i][1] ||\n shape1.o[i][0] !== shape2.o[i][0] ||\n shape1.o[i][1] !== shape2.o[i][1] ||\n shape1.i[i][0] !== shape2.i[i][0] ||\n shape1.i[i][1] !== shape2.i[i][1]\n ) {\n return false\n }\n }\n return true\n }\n\n function setVValue(newPath) {\n if (!shapesEqual(this.v, newPath)) {\n this.v = shapePool.clone(newPath)\n this.localShapeCollection.releaseShapes()\n this.localShapeCollection.addShape(this.v)\n this._mdf = true\n this.paths = this.localShapeCollection\n }\n }\n\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n if (!this.effectsSequence.length) {\n this._mdf = false\n return\n }\n if (this.lock) {\n this.setVValue(this.pv)\n return\n }\n this.lock = true\n this._mdf = false\n var finalValue\n if (this.kf) {\n finalValue = this.pv\n } else if (this.data.ks) {\n finalValue = this.data.ks.k\n } else {\n finalValue = this.data.pt.k\n }\n var i\n var len = this.effectsSequence.length\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue)\n }\n this.setVValue(finalValue)\n this.lock = false\n this.frameId = this.elem.globalData.frameId\n }\n\n function ShapeProperty(elem, data, type) {\n this.propType = 'shape'\n this.comp = elem.comp\n this.container = elem\n this.elem = elem\n this.data = data\n this.k = false\n this.kf = false\n this._mdf = false\n var pathData = type === 3 ? data.pt.k : data.ks.k\n this.v = shapePool.clone(pathData)\n this.pv = shapePool.clone(this.v)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.paths = this.localShapeCollection\n this.paths.addShape(this.v)\n this.reset = resetShape\n this.effectsSequence = []\n }\n\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction)\n this.container.addDynamicProperty(this)\n }\n\n ShapeProperty.prototype.interpolateShape = interpolateShape\n ShapeProperty.prototype.getValue = processEffectsSequence\n ShapeProperty.prototype.setVValue = setVValue\n ShapeProperty.prototype.addEffect = addEffect\n\n function KeyframedShapeProperty(elem, data, type) {\n this.propType = 'shape'\n this.comp = elem.comp\n this.elem = elem\n this.container = elem\n this.offsetTime = elem.data.st\n this.keyframes = type === 3 ? data.pt.k : data.ks.k\n this.keyframesMetadata = []\n this.k = true\n this.kf = true\n var len = this.keyframes[0].s[0].i.length\n this.v = shapePool.newElement()\n this.v.setPathData(this.keyframes[0].s[0].c, len)\n this.pv = shapePool.clone(this.v)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.paths = this.localShapeCollection\n this.paths.addShape(this.v)\n this.lastFrame = initFrame\n this.reset = resetShape\n this._caching = { lastFrame: initFrame, lastIndex: 0 }\n this.effectsSequence = [interpolateShapeCurrentTime.bind(this)]\n }\n KeyframedShapeProperty.prototype.getValue = processEffectsSequence\n KeyframedShapeProperty.prototype.interpolateShape = interpolateShape\n KeyframedShapeProperty.prototype.setVValue = setVValue\n KeyframedShapeProperty.prototype.addEffect = addEffect\n\n var EllShapeProperty = (function () {\n var cPoint = roundCorner\n\n function EllShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement()\n this.v.setPathData(true, 4)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.paths = this.localShapeCollection\n this.localShapeCollection.addShape(this.v)\n this.d = data.d\n this.elem = elem\n this.comp = elem.comp\n this.frameId = -1\n this.initDynamicPropertyContainer(elem)\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this)\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this)\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.k = false\n this.convertEllToPath()\n }\n }\n\n EllShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n\n if (this._mdf) {\n this.convertEllToPath()\n }\n },\n convertEllToPath: function () {\n var p0 = this.p.v[0]\n var p1 = this.p.v[1]\n var s0 = this.s.v[0] / 2\n var s1 = this.s.v[1] / 2\n var _cw = this.d !== 3\n var _v = this.v\n _v.v[0][0] = p0\n _v.v[0][1] = p1 - s1\n _v.v[1][0] = _cw ? p0 + s0 : p0 - s0\n _v.v[1][1] = p1\n _v.v[2][0] = p0\n _v.v[2][1] = p1 + s1\n _v.v[3][0] = _cw ? p0 - s0 : p0 + s0\n _v.v[3][1] = p1\n _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint\n _v.i[0][1] = p1 - s1\n _v.i[1][0] = _cw ? p0 + s0 : p0 - s0\n _v.i[1][1] = p1 - s1 * cPoint\n _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint\n _v.i[2][1] = p1 + s1\n _v.i[3][0] = _cw ? p0 - s0 : p0 + s0\n _v.i[3][1] = p1 + s1 * cPoint\n _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint\n _v.o[0][1] = p1 - s1\n _v.o[1][0] = _cw ? p0 + s0 : p0 - s0\n _v.o[1][1] = p1 + s1 * cPoint\n _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint\n _v.o[2][1] = p1 + s1\n _v.o[3][0] = _cw ? p0 - s0 : p0 + s0\n _v.o[3][1] = p1 - s1 * cPoint\n },\n }\n\n extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory)\n\n return EllShapePropertyFactory\n })()\n\n var StarShapeProperty = (function () {\n function StarShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement()\n this.v.setPathData(true, 0)\n this.elem = elem\n this.comp = elem.comp\n this.data = data\n this.frameId = -1\n this.d = data.d\n this.initDynamicPropertyContainer(elem)\n if (data.sy === 1) {\n this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this)\n this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this)\n this.convertToPath = this.convertStarToPath\n } else {\n this.convertToPath = this.convertPolygonToPath\n }\n this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this)\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this)\n this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this)\n this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this)\n this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.localShapeCollection.addShape(this.v)\n this.paths = this.localShapeCollection\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.k = false\n this.convertToPath()\n }\n }\n\n StarShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n if (this._mdf) {\n this.convertToPath()\n }\n },\n convertStarToPath: function () {\n var numPts = Math.floor(this.pt.v) * 2\n var angle = (Math.PI * 2) / numPts\n /* this.v.v.length = numPts;\n this.v.i.length = numPts;\n this.v.o.length = numPts; */\n var longFlag = true\n var longRad = this.or.v\n var shortRad = this.ir.v\n var longRound = this.os.v\n var shortRound = this.is.v\n var longPerimSegment = (2 * Math.PI * longRad) / (numPts * 2)\n var shortPerimSegment = (2 * Math.PI * shortRad) / (numPts * 2)\n var i\n var rad\n var roundness\n var perimSegment\n var currentAng = -Math.PI / 2\n currentAng += this.r.v\n var dir = this.data.d === 3 ? -1 : 1\n this.v._length = 0\n for (i = 0; i < numPts; i += 1) {\n rad = longFlag ? longRad : shortRad\n roundness = longFlag ? longRound : shortRound\n perimSegment = longFlag ? longPerimSegment : shortPerimSegment\n var x = rad * Math.cos(currentAng)\n var y = rad * Math.sin(currentAng)\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y)\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y)\n x += +this.p.v[0]\n y += +this.p.v[1]\n this.v.setTripleAt(\n x,\n y,\n x - ox * perimSegment * roundness * dir,\n y - oy * perimSegment * roundness * dir,\n x + ox * perimSegment * roundness * dir,\n y + oy * perimSegment * roundness * dir,\n i,\n true,\n )\n\n /* this.v.v[i] = [x,y];\n this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];\n this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];\n this.v._length = numPts; */\n longFlag = !longFlag\n currentAng += angle * dir\n }\n },\n convertPolygonToPath: function () {\n var numPts = Math.floor(this.pt.v)\n var angle = (Math.PI * 2) / numPts\n var rad = this.or.v\n var roundness = this.os.v\n var perimSegment = (2 * Math.PI * rad) / (numPts * 4)\n var i\n var currentAng = -Math.PI * 0.5\n var dir = this.data.d === 3 ? -1 : 1\n currentAng += this.r.v\n this.v._length = 0\n for (i = 0; i < numPts; i += 1) {\n var x = rad * Math.cos(currentAng)\n var y = rad * Math.sin(currentAng)\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y)\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y)\n x += +this.p.v[0]\n y += +this.p.v[1]\n this.v.setTripleAt(\n x,\n y,\n x - ox * perimSegment * roundness * dir,\n y - oy * perimSegment * roundness * dir,\n x + ox * perimSegment * roundness * dir,\n y + oy * perimSegment * roundness * dir,\n i,\n true,\n )\n currentAng += angle * dir\n }\n this.paths.length = 0\n this.paths[0] = this.v\n },\n }\n extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory)\n\n return StarShapePropertyFactory\n })()\n\n var RectShapeProperty = (function () {\n function RectShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement()\n this.v.c = true\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.localShapeCollection.addShape(this.v)\n this.paths = this.localShapeCollection\n this.elem = elem\n this.comp = elem.comp\n this.frameId = -1\n this.d = data.d\n this.initDynamicPropertyContainer(elem)\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this)\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this)\n this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this)\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.k = false\n this.convertRectToPath()\n }\n }\n\n RectShapePropertyFactory.prototype = {\n convertRectToPath: function () {\n var p0 = this.p.v[0]\n var p1 = this.p.v[1]\n var v0 = this.s.v[0] / 2\n var v1 = this.s.v[1] / 2\n var round = bmMin(v0, v1, this.r.v)\n var cPoint = round * (1 - roundCorner)\n this.v._length = 0\n\n if (this.d === 2 || this.d === 1) {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true)\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true)\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true)\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true)\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true)\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true)\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true)\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true)\n } else {\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2)\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3)\n }\n } else {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true)\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true)\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true)\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true)\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true)\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true)\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true)\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true)\n } else {\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true)\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true)\n this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true)\n }\n }\n },\n getValue: function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n if (this._mdf) {\n this.convertRectToPath()\n }\n },\n reset: resetShape,\n }\n extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory)\n\n return RectShapePropertyFactory\n })()\n\n function getShapeProp(elem, data, type) {\n var prop\n if (type === 3 || type === 4) {\n var dataProp = type === 3 ? data.pt : data.ks\n var keys = dataProp.k\n if (keys.length) {\n prop = new KeyframedShapeProperty(elem, data, type)\n } else {\n prop = new ShapeProperty(elem, data, type)\n }\n } else if (type === 5) {\n prop = new RectShapeProperty(elem, data)\n } else if (type === 6) {\n prop = new EllShapeProperty(elem, data)\n } else if (type === 7) {\n prop = new StarShapeProperty(elem, data)\n }\n if (prop.k) {\n elem.addDynamicProperty(prop)\n }\n return prop\n }\n\n function getConstructorFunction() {\n return ShapeProperty\n }\n\n function getKeyframedConstructorFunction() {\n return KeyframedShapeProperty\n }\n\n var ob = {}\n ob.getShapeProp = getShapeProp\n ob.getConstructorFunction = getConstructorFunction\n ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction\n return ob\n })()\n\n /*!\n Transformation Matrix v2.0\n (c) Epistemex 2014-2015\n www.epistemex.com\n By Ken Fyrstenberg\n Contributions by leeoniya.\n License: MIT, header required.\n */\n\n /**\n * 2D transformation matrix object initialized with identity matrix.\n *\n * The matrix can synchronize a canvas context by supplying the context\n * as an argument, or later apply current absolute transform to an\n * existing context.\n *\n * All values are handled as floating point values.\n *\n * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix\n * @prop {number} a - scale x\n * @prop {number} b - shear y\n * @prop {number} c - shear x\n * @prop {number} d - scale y\n * @prop {number} e - translate x\n * @prop {number} f - translate y\n * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context\n * @constructor\n */\n\n const Matrix = (function () {\n var _cos = Math.cos\n var _sin = Math.sin\n var _tan = Math.tan\n var _rnd = Math.round\n\n function reset() {\n this.props[0] = 1\n this.props[1] = 0\n this.props[2] = 0\n this.props[3] = 0\n this.props[4] = 0\n this.props[5] = 1\n this.props[6] = 0\n this.props[7] = 0\n this.props[8] = 0\n this.props[9] = 0\n this.props[10] = 1\n this.props[11] = 0\n this.props[12] = 0\n this.props[13] = 0\n this.props[14] = 0\n this.props[15] = 1\n return this\n }\n\n function rotate(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n }\n\n function rotateX(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1)\n }\n\n function rotateY(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1)\n }\n\n function rotateZ(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n }\n\n function shear(sx, sy) {\n return this._t(1, sy, sx, 1, 0, 0)\n }\n\n function skew(ax, ay) {\n return this.shear(_tan(ax), _tan(ay))\n }\n\n function skewFromAxis(ax, angle) {\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n // return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);\n }\n\n function scale(sx, sy, sz) {\n if (!sz && sz !== 0) {\n sz = 1\n }\n if (sx === 1 && sy === 1 && sz === 1) {\n return this\n }\n return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1)\n }\n\n function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {\n this.props[0] = a\n this.props[1] = b\n this.props[2] = c\n this.props[3] = d\n this.props[4] = e\n this.props[5] = f\n this.props[6] = g\n this.props[7] = h\n this.props[8] = i\n this.props[9] = j\n this.props[10] = k\n this.props[11] = l\n this.props[12] = m\n this.props[13] = n\n this.props[14] = o\n this.props[15] = p\n return this\n }\n\n function translate(tx, ty, tz) {\n tz = tz || 0\n if (tx !== 0 || ty !== 0 || tz !== 0) {\n return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1)\n }\n return this\n }\n\n function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {\n var _p = this.props\n\n if (\n a2 === 1 &&\n b2 === 0 &&\n c2 === 0 &&\n d2 === 0 &&\n e2 === 0 &&\n f2 === 1 &&\n g2 === 0 &&\n h2 === 0 &&\n i2 === 0 &&\n j2 === 0 &&\n k2 === 1 &&\n l2 === 0\n ) {\n // NOTE: commenting this condition because TurboFan deoptimizes code when present\n // if(m2 !== 0 || n2 !== 0 || o2 !== 0){\n _p[12] = _p[12] * a2 + _p[15] * m2\n _p[13] = _p[13] * f2 + _p[15] * n2\n _p[14] = _p[14] * k2 + _p[15] * o2\n _p[15] *= p2\n // }\n this._identityCalculated = false\n return this\n }\n\n var a1 = _p[0]\n var b1 = _p[1]\n var c1 = _p[2]\n var d1 = _p[3]\n var e1 = _p[4]\n var f1 = _p[5]\n var g1 = _p[6]\n var h1 = _p[7]\n var i1 = _p[8]\n var j1 = _p[9]\n var k1 = _p[10]\n var l1 = _p[11]\n var m1 = _p[12]\n var n1 = _p[13]\n var o1 = _p[14]\n var p1 = _p[15]\n\n /* matrix order (canvas compatible):\n * ace\n * bdf\n * 001\n */\n _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2\n _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2\n _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2\n _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2\n\n _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2\n _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2\n _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2\n _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2\n\n _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2\n _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2\n _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2\n _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2\n\n _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2\n _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2\n _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2\n _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2\n\n this._identityCalculated = false\n return this\n }\n\n function isIdentity() {\n if (!this._identityCalculated) {\n this._identity = !(\n this.props[0] !== 1 ||\n this.props[1] !== 0 ||\n this.props[2] !== 0 ||\n this.props[3] !== 0 ||\n this.props[4] !== 0 ||\n this.props[5] !== 1 ||\n this.props[6] !== 0 ||\n this.props[7] !== 0 ||\n this.props[8] !== 0 ||\n this.props[9] !== 0 ||\n this.props[10] !== 1 ||\n this.props[11] !== 0 ||\n this.props[12] !== 0 ||\n this.props[13] !== 0 ||\n this.props[14] !== 0 ||\n this.props[15] !== 1\n )\n this._identityCalculated = true\n }\n return this._identity\n }\n\n function equals(matr) {\n var i = 0\n while (i < 16) {\n if (matr.props[i] !== this.props[i]) {\n return false\n }\n i += 1\n }\n return true\n }\n\n function clone(matr) {\n var i\n for (i = 0; i < 16; i += 1) {\n matr.props[i] = this.props[i]\n }\n return matr\n }\n\n function cloneFromProps(props) {\n var i\n for (i = 0; i < 16; i += 1) {\n this.props[i] = props[i]\n }\n }\n\n function applyToPoint(x, y, z) {\n return {\n x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\n y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\n z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],\n }\n /* return {\n x: x * me.a + y * me.c + me.e,\n y: x * me.b + y * me.d + me.f\n }; */\n }\n function applyToX(x, y, z) {\n return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12]\n }\n function applyToY(x, y, z) {\n return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13]\n }\n function applyToZ(x, y, z) {\n return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]\n }\n\n function getInverseMatrix() {\n var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4]\n var a = this.props[5] / determinant\n var b = -this.props[1] / determinant\n var c = -this.props[4] / determinant\n var d = this.props[0] / determinant\n var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant\n var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant\n var inverseMatrix = new Matrix()\n inverseMatrix.props[0] = a\n inverseMatrix.props[1] = b\n inverseMatrix.props[4] = c\n inverseMatrix.props[5] = d\n inverseMatrix.props[12] = e\n inverseMatrix.props[13] = f\n return inverseMatrix\n }\n\n function inversePoint(pt) {\n var inverseMatrix = this.getInverseMatrix()\n return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0)\n }\n\n function inversePoints(pts) {\n var i\n var len = pts.length\n var retPts = []\n for (i = 0; i < len; i += 1) {\n retPts[i] = inversePoint(pts[i])\n }\n return retPts\n }\n\n function applyToTriplePoints(pt1, pt2, pt3) {\n var arr = createTypedArray('float32', 6)\n if (this.isIdentity()) {\n arr[0] = pt1[0]\n arr[1] = pt1[1]\n arr[2] = pt2[0]\n arr[3] = pt2[1]\n arr[4] = pt3[0]\n arr[5] = pt3[1]\n } else {\n var p0 = this.props[0]\n var p1 = this.props[1]\n var p4 = this.props[4]\n var p5 = this.props[5]\n var p12 = this.props[12]\n var p13 = this.props[13]\n arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12\n arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13\n arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12\n arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13\n arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12\n arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13\n }\n return arr\n }\n\n function applyToPointArray(x, y, z) {\n var arr\n if (this.isIdentity()) {\n arr = [x, y, z]\n } else {\n arr = [\n x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\n x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\n x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],\n ]\n }\n return arr\n }\n\n function applyToPointStringified(x, y) {\n if (this.isIdentity()) {\n return x + ',' + y\n }\n var _p = this.props\n return (\n Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 +\n ',' +\n Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100\n )\n }\n\n function toCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n /* if(this.isIdentity()) {\n return '';\n } */\n var i = 0\n var props = this.props\n var cssValue = 'matrix3d('\n var v = 10000\n while (i < 16) {\n cssValue += _rnd(props[i] * v) / v\n cssValue += i === 15 ? ')' : ','\n i += 1\n }\n return cssValue\n }\n\n function roundMatrixProperty(val) {\n var v = 10000\n if ((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {\n return _rnd(val * v) / v\n }\n return val\n }\n\n function to2dCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n /* if(this.isIdentity()) {\n return '';\n } */\n var props = this.props\n var _a = roundMatrixProperty(props[0])\n var _b = roundMatrixProperty(props[1])\n var _c = roundMatrixProperty(props[4])\n var _d = roundMatrixProperty(props[5])\n var _e = roundMatrixProperty(props[12])\n var _f = roundMatrixProperty(props[13])\n return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')'\n }\n\n return function () {\n this.reset = reset\n this.rotate = rotate\n this.rotateX = rotateX\n this.rotateY = rotateY\n this.rotateZ = rotateZ\n this.skew = skew\n this.skewFromAxis = skewFromAxis\n this.shear = shear\n this.scale = scale\n this.setTransform = setTransform\n this.translate = translate\n this.transform = transform\n this.applyToPoint = applyToPoint\n this.applyToX = applyToX\n this.applyToY = applyToY\n this.applyToZ = applyToZ\n this.applyToPointArray = applyToPointArray\n this.applyToTriplePoints = applyToTriplePoints\n this.applyToPointStringified = applyToPointStringified\n this.toCSS = toCSS\n this.to2dCSS = to2dCSS\n this.clone = clone\n this.cloneFromProps = cloneFromProps\n this.equals = equals\n this.inversePoints = inversePoints\n this.inversePoint = inversePoint\n this.getInverseMatrix = getInverseMatrix\n this._t = this.transform\n this.isIdentity = isIdentity\n this._identity = true\n this._identityCalculated = false\n\n this.props = createTypedArray('float32', 16)\n this.reset()\n }\n })()\n\n const lottie = {}\n var standalone = '__[STANDALONE]__'\n var animationData = '__[ANIMATIONDATA]__'\n var renderer = ''\n\n function setLocation(href) {\n setLocationHref(href)\n }\n\n function searchAnimations() {\n if (standalone === true) {\n animationManager.searchAnimations(animationData, standalone, renderer)\n } else {\n animationManager.searchAnimations()\n }\n }\n\n function setSubframeRendering(flag) {\n setSubframeEnabled(flag)\n }\n\n function setPrefix(prefix) {\n setIdPrefix(prefix)\n }\n\n function loadAnimation(params) {\n if (standalone === true) {\n params.animationData = JSON.parse(animationData)\n }\n return animationManager.loadAnimation(params)\n }\n\n function setQuality(value) {\n if (typeof value === 'string') {\n switch (value) {\n case 'high':\n setDefaultCurveSegments(200)\n break\n default:\n case 'medium':\n setDefaultCurveSegments(50)\n break\n case 'low':\n setDefaultCurveSegments(10)\n break\n }\n } else if (!isNaN(value) && value > 1) {\n setDefaultCurveSegments(value)\n }\n if (getDefaultCurveSegments() >= 50) {\n roundValues(false)\n } else {\n roundValues(true)\n }\n }\n\n function inBrowser() {\n return typeof navigator !== 'undefined'\n }\n\n function installPlugin(type, plugin) {\n if (type === 'expressions') {\n setExpressionsPlugin(plugin)\n }\n }\n\n function getFactory(name) {\n switch (name) {\n case 'propertyFactory':\n return PropertyFactory\n case 'shapePropertyFactory':\n return ShapePropertyFactory\n case 'matrix':\n return Matrix\n default:\n return null\n }\n }\n\n lottie.play = animationManager.play\n lottie.pause = animationManager.pause\n lottie.setLocationHref = setLocation\n lottie.togglePause = animationManager.togglePause\n lottie.setSpeed = animationManager.setSpeed\n lottie.setDirection = animationManager.setDirection\n lottie.stop = animationManager.stop\n lottie.searchAnimations = searchAnimations\n lottie.registerAnimation = animationManager.registerAnimation\n lottie.loadAnimation = loadAnimation\n lottie.setSubframeRendering = setSubframeRendering\n lottie.resize = animationManager.resize\n // lottie.start = start;\n lottie.goToAndStop = animationManager.goToAndStop\n lottie.destroy = animationManager.destroy\n lottie.setQuality = setQuality\n lottie.inBrowser = inBrowser\n lottie.installPlugin = installPlugin\n lottie.freeze = animationManager.freeze\n lottie.unfreeze = animationManager.unfreeze\n lottie.setVolume = animationManager.setVolume\n lottie.mute = animationManager.mute\n lottie.unmute = animationManager.unmute\n lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations\n lottie.useWebWorker = setWebWorker\n lottie.setIDPrefix = setPrefix\n lottie.__getFactory = getFactory\n lottie.version = '[[BM_VERSION]]'\n\n function checkReady() {\n if (document.readyState === 'complete') {\n clearInterval(readyStateCheckInterval)\n searchAnimations()\n }\n }\n\n function getQueryVariable(variable) {\n var vars = queryString.split('&')\n for (var i = 0; i < vars.length; i += 1) {\n var pair = vars[i].split('=')\n if (decodeURIComponent(pair[0]) == variable) {\n // eslint-disable-line eqeqeq\n return decodeURIComponent(pair[1])\n }\n }\n return null\n }\n var queryString = ''\n if (standalone) {\n var scripts = document.getElementsByTagName('script')\n var index = scripts.length - 1\n var myScript = scripts[index] || {\n src: '',\n }\n queryString = myScript.src ? myScript.src.replace(/^[^\\?]+\\??/, '') : '' // eslint-disable-line no-useless-escape\n renderer = getQueryVariable('renderer')\n }\n var readyStateCheckInterval = setInterval(checkReady, 100)\n\n // this adds bodymovin to the window object for backwards compatibility\n try {\n if (\n !(typeof exports === 'object' && typeof module !== 'undefined') &&\n !(typeof define === 'function' && define.amd) // eslint-disable-line no-undef\n ) {\n window.bodymovin = lottie\n }\n } catch (err) {\n //\n }\n\n const ShapeModifiers = (function () {\n var ob = {}\n var modifiers = {}\n ob.registerModifier = registerModifier\n ob.getModifier = getModifier\n\n function registerModifier(nm, factory) {\n if (!modifiers[nm]) {\n modifiers[nm] = factory\n }\n }\n\n function getModifier(nm, elem, data) {\n return new modifiers[nm](elem, data)\n }\n\n return ob\n })()\n\n function ShapeModifier() {}\n ShapeModifier.prototype.initModifierProperties = function () {}\n ShapeModifier.prototype.addShapeToModifier = function () {}\n ShapeModifier.prototype.addShape = function (data) {\n if (!this.closed) {\n // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.\n data.sh.container.addDynamicProperty(data.sh)\n var shapeData = { shape: data.sh, data: data, localShapeCollection: shapeCollectionPool.newShapeCollection() }\n this.shapes.push(shapeData)\n this.addShapeToModifier(shapeData)\n if (this._isAnimated) {\n data.setAsAnimated()\n }\n }\n }\n ShapeModifier.prototype.init = function (elem, data) {\n this.shapes = []\n this.elem = elem\n this.initDynamicPropertyContainer(elem)\n this.initModifierProperties(elem, data)\n this.frameId = initialDefaultFrame\n this.closed = false\n this.k = false\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.getValue(true)\n }\n }\n ShapeModifier.prototype.processKeys = function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n }\n\n extendPrototype([DynamicPropertyContainer], ShapeModifier)\n\n function TrimModifier() {}\n extendPrototype([ShapeModifier], TrimModifier)\n TrimModifier.prototype.initModifierProperties = function (elem, data) {\n this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this)\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this)\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this)\n this.sValue = 0\n this.eValue = 0\n this.getValue = this.processKeys\n this.m = data.m\n this._isAnimated =\n !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length\n }\n\n TrimModifier.prototype.addShapeToModifier = function (shapeData) {\n shapeData.pathsData = []\n }\n\n TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {\n var segments = []\n if (e <= 1) {\n segments.push({\n s: s,\n e: e,\n })\n } else if (s >= 1) {\n segments.push({\n s: s - 1,\n e: e - 1,\n })\n } else {\n segments.push({\n s: s,\n e: 1,\n })\n segments.push({\n s: 0,\n e: e - 1,\n })\n }\n var shapeSegments = []\n var i\n var len = segments.length\n var segmentOb\n for (i = 0; i < len; i += 1) {\n segmentOb = segments[i]\n if (\n !(\n segmentOb.e * totalModifierLength < addedLength ||\n segmentOb.s * totalModifierLength > addedLength + shapeLength\n )\n ) {\n var shapeS\n var shapeE\n if (segmentOb.s * totalModifierLength <= addedLength) {\n shapeS = 0\n } else {\n shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength\n }\n if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {\n shapeE = 1\n } else {\n shapeE = (segmentOb.e * totalModifierLength - addedLength) / shapeLength\n }\n shapeSegments.push([shapeS, shapeE])\n }\n }\n if (!shapeSegments.length) {\n shapeSegments.push([0, 0])\n }\n return shapeSegments\n }\n\n TrimModifier.prototype.releasePathsData = function (pathsData) {\n var i\n var len = pathsData.length\n for (i = 0; i < len; i += 1) {\n segmentsLengthPool.release(pathsData[i])\n }\n pathsData.length = 0\n return pathsData\n }\n\n TrimModifier.prototype.processShapes = function (_isFirstFrame) {\n var s\n var e\n if (this._mdf || _isFirstFrame) {\n var o = (this.o.v % 360) / 360\n if (o < 0) {\n o += 1\n }\n if (this.s.v > 1) {\n s = 1 + o\n } else if (this.s.v < 0) {\n s = 0 + o\n } else {\n s = this.s.v + o\n }\n if (this.e.v > 1) {\n e = 1 + o\n } else if (this.e.v < 0) {\n e = 0 + o\n } else {\n e = this.e.v + o\n }\n\n if (s > e) {\n var _s = s\n s = e\n e = _s\n }\n s = Math.round(s * 10000) * 0.0001\n e = Math.round(e * 10000) * 0.0001\n this.sValue = s\n this.eValue = e\n } else {\n s = this.sValue\n e = this.eValue\n }\n var shapePaths\n var i\n var len = this.shapes.length\n var j\n var jLen\n var pathsData\n var pathData\n var totalShapeLength\n var totalModifierLength = 0\n\n if (e === s) {\n for (i = 0; i < len; i += 1) {\n this.shapes[i].localShapeCollection.releaseShapes()\n this.shapes[i].shape._mdf = true\n this.shapes[i].shape.paths = this.shapes[i].localShapeCollection\n if (this._mdf) {\n this.shapes[i].pathsData.length = 0\n }\n }\n } else if (!((e === 1 && s === 0) || (e === 0 && s === 1))) {\n var segments = []\n var shapeData\n var localShapeCollection\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i]\n // if shape hasn't changed and trim properties haven't changed, cached previous path can be used\n if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {\n shapeData.shape.paths = shapeData.localShapeCollection\n } else {\n shapePaths = shapeData.shape.paths\n jLen = shapePaths._length\n totalShapeLength = 0\n if (!shapeData.shape._mdf && shapeData.pathsData.length) {\n totalShapeLength = shapeData.totalShapeLength\n } else {\n pathsData = this.releasePathsData(shapeData.pathsData)\n for (j = 0; j < jLen; j += 1) {\n pathData = bez.getSegmentsLength(shapePaths.shapes[j])\n pathsData.push(pathData)\n totalShapeLength += pathData.totalLength\n }\n shapeData.totalShapeLength = totalShapeLength\n shapeData.pathsData = pathsData\n }\n\n totalModifierLength += totalShapeLength\n shapeData.shape._mdf = true\n }\n }\n var shapeS = s\n var shapeE = e\n var addedLength = 0\n var edges\n for (i = len - 1; i >= 0; i -= 1) {\n shapeData = this.shapes[i]\n if (shapeData.shape._mdf) {\n localShapeCollection = shapeData.localShapeCollection\n localShapeCollection.releaseShapes()\n // if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group\n if (this.m === 2 && len > 1) {\n edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength)\n addedLength += shapeData.totalShapeLength\n } else {\n edges = [[shapeS, shapeE]]\n }\n jLen = edges.length\n for (j = 0; j < jLen; j += 1) {\n shapeS = edges[j][0]\n shapeE = edges[j][1]\n segments.length = 0\n if (shapeE <= 1) {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength * shapeE,\n })\n } else if (shapeS >= 1) {\n segments.push({\n s: shapeData.totalShapeLength * (shapeS - 1),\n e: shapeData.totalShapeLength * (shapeE - 1),\n })\n } else {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength,\n })\n segments.push({\n s: 0,\n e: shapeData.totalShapeLength * (shapeE - 1),\n })\n }\n var newShapesData = this.addShapes(shapeData, segments[0])\n if (segments[0].s !== segments[0].e) {\n if (segments.length > 1) {\n var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1]\n if (lastShapeInCollection.c) {\n var lastShape = newShapesData.pop()\n this.addPaths(newShapesData, localShapeCollection)\n newShapesData = this.addShapes(shapeData, segments[1], lastShape)\n } else {\n this.addPaths(newShapesData, localShapeCollection)\n newShapesData = this.addShapes(shapeData, segments[1])\n }\n }\n this.addPaths(newShapesData, localShapeCollection)\n }\n }\n shapeData.shape.paths = localShapeCollection\n }\n }\n } else if (this._mdf) {\n for (i = 0; i < len; i += 1) {\n // Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.\n // Don't remove this even if it's losing cached info.\n this.shapes[i].pathsData.length = 0\n this.shapes[i].shape._mdf = true\n }\n }\n }\n\n TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {\n var i\n var len = newPaths.length\n for (i = 0; i < len; i += 1) {\n localShapeCollection.addShape(newPaths[i])\n }\n }\n\n TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {\n shapePath.setXYAt(pt2[0], pt2[1], 'o', pos)\n shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1)\n if (newShape) {\n shapePath.setXYAt(pt1[0], pt1[1], 'v', pos)\n }\n shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1)\n }\n\n TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {\n shapePath.setXYAt(points[1], points[5], 'o', pos)\n shapePath.setXYAt(points[2], points[6], 'i', pos + 1)\n if (newShape) {\n shapePath.setXYAt(points[0], points[4], 'v', pos)\n }\n shapePath.setXYAt(points[3], points[7], 'v', pos + 1)\n }\n\n TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {\n var pathsData = shapeData.pathsData\n var shapePaths = shapeData.shape.paths.shapes\n var i\n var len = shapeData.shape.paths._length\n var j\n var jLen\n var addedLength = 0\n var currentLengthData\n var segmentCount\n var lengths\n var segment\n var shapes = []\n var initPos\n var newShape = true\n if (!shapePath) {\n shapePath = shapePool.newElement()\n segmentCount = 0\n initPos = 0\n } else {\n segmentCount = shapePath._length\n initPos = shapePath._length\n }\n shapes.push(shapePath)\n for (i = 0; i < len; i += 1) {\n lengths = pathsData[i].lengths\n shapePath.c = shapePaths[i].c\n jLen = shapePaths[i].c ? lengths.length : lengths.length + 1\n for (j = 1; j < jLen; j += 1) {\n currentLengthData = lengths[j - 1]\n if (addedLength + currentLengthData.addedLength < shapeSegment.s) {\n addedLength += currentLengthData.addedLength\n shapePath.c = false\n } else if (addedLength > shapeSegment.e) {\n shapePath.c = false\n break\n } else {\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {\n this.addSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[j],\n shapePaths[i].v[j],\n shapePath,\n segmentCount,\n newShape,\n )\n newShape = false\n } else {\n segment = bez.getNewSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].v[j],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[j],\n (shapeSegment.s - addedLength) / currentLengthData.addedLength,\n (shapeSegment.e - addedLength) / currentLengthData.addedLength,\n lengths[j - 1],\n )\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape)\n // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n newShape = false\n shapePath.c = false\n }\n addedLength += currentLengthData.addedLength\n segmentCount += 1\n }\n }\n if (shapePaths[i].c && lengths.length) {\n currentLengthData = lengths[j - 1]\n if (addedLength <= shapeSegment.e) {\n var segmentLength = lengths[j - 1].addedLength\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {\n this.addSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[0],\n shapePaths[i].v[0],\n shapePath,\n segmentCount,\n newShape,\n )\n newShape = false\n } else {\n segment = bez.getNewSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].v[0],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[0],\n (shapeSegment.s - addedLength) / segmentLength,\n (shapeSegment.e - addedLength) / segmentLength,\n lengths[j - 1],\n )\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape)\n // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n newShape = false\n shapePath.c = false\n }\n } else {\n shapePath.c = false\n }\n addedLength += currentLengthData.addedLength\n segmentCount += 1\n }\n if (shapePath._length) {\n shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos)\n shapePath.setXYAt(\n shapePath.v[shapePath._length - 1][0],\n shapePath.v[shapePath._length - 1][1],\n 'o',\n shapePath._length - 1,\n )\n }\n if (addedLength > shapeSegment.e) {\n break\n }\n if (i < len - 1) {\n shapePath = shapePool.newElement()\n newShape = true\n shapes.push(shapePath)\n segmentCount = 0\n }\n }\n return shapes\n }\n\n function PuckerAndBloatModifier() {}\n extendPrototype([ShapeModifier], PuckerAndBloatModifier)\n PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this)\n this._isAnimated = !!this.amount.effectsSequence.length\n }\n\n PuckerAndBloatModifier.prototype.processPath = function (path, amount) {\n var percent = amount / 100\n var centerPoint = [0, 0]\n var pathLength = path._length\n var i = 0\n for (i = 0; i < pathLength; i += 1) {\n centerPoint[0] += path.v[i][0]\n centerPoint[1] += path.v[i][1]\n }\n centerPoint[0] /= pathLength\n centerPoint[1] /= pathLength\n var clonedPath = shapePool.newElement()\n clonedPath.c = path.c\n var vX\n var vY\n var oX\n var oY\n var iX\n var iY\n for (i = 0; i < pathLength; i += 1) {\n vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent\n vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent\n oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent\n oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent\n iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent\n iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i)\n }\n return clonedPath\n }\n\n PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths\n var i\n var len = this.shapes.length\n var j\n var jLen\n var amount = this.amount.v\n\n if (amount !== 0) {\n var shapeData\n var localShapeCollection\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i]\n localShapeCollection = shapeData.localShapeCollection\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes()\n shapeData.shape._mdf = true\n shapePaths = shapeData.shape.paths.shapes\n jLen = shapeData.shape.paths._length\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount))\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false\n }\n }\n\n const TransformPropertyFactory = (function () {\n var defaultVector = [0, 0]\n\n function applyToMatrix(mat) {\n var _mdf = this._mdf\n this.iterateDynamicProperties()\n this._mdf = this._mdf || _mdf\n if (this.a) {\n mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2])\n }\n if (this.s) {\n mat.scale(this.s.v[0], this.s.v[1], this.s.v[2])\n }\n if (this.sk) {\n mat.skewFromAxis(-this.sk.v, this.sa.v)\n }\n if (this.r) {\n mat.rotate(-this.r.v)\n } else {\n mat\n .rotateZ(-this.rz.v)\n .rotateY(this.ry.v)\n .rotateX(this.rx.v)\n .rotateZ(-this.or.v[2])\n .rotateY(this.or.v[1])\n .rotateX(this.or.v[0])\n }\n if (this.data.p.s) {\n if (this.data.p.z) {\n mat.translate(this.px.v, this.py.v, -this.pz.v)\n } else {\n mat.translate(this.px.v, this.py.v, 0)\n }\n } else {\n mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2])\n }\n }\n function processKeys(forceRender) {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n if (this._isDirty) {\n this.precalculateMatrix()\n this._isDirty = false\n }\n\n this.iterateDynamicProperties()\n\n if (this._mdf || forceRender) {\n var frameRate\n this.v.cloneFromProps(this.pre.props)\n if (this.appliedTransformations < 1) {\n this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2])\n }\n if (this.appliedTransformations < 2) {\n this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2])\n }\n if (this.sk && this.appliedTransformations < 3) {\n this.v.skewFromAxis(-this.sk.v, this.sa.v)\n }\n if (this.r && this.appliedTransformations < 4) {\n this.v.rotate(-this.r.v)\n } else if (!this.r && this.appliedTransformations < 4) {\n this.v\n .rotateZ(-this.rz.v)\n .rotateY(this.ry.v)\n .rotateX(this.rx.v)\n .rotateZ(-this.or.v[2])\n .rotateY(this.or.v[1])\n .rotateX(this.or.v[0])\n }\n if (this.autoOriented) {\n var v1\n var v2\n frameRate = this.elem.globalData.frameRate\n if (this.p && this.p.keyframes && this.p.getValueAtTime) {\n if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {\n v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0)\n v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0)\n } else if (\n this.p._caching.lastFrame + this.p.offsetTime >=\n this.p.keyframes[this.p.keyframes.length - 1].t\n ) {\n v1 = this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length - 1].t / frameRate, 0)\n v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0)\n } else {\n v1 = this.p.pv\n v2 = this.p.getValueAtTime(\n (this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate,\n this.p.offsetTime,\n )\n }\n } else if (\n this.px &&\n this.px.keyframes &&\n this.py.keyframes &&\n this.px.getValueAtTime &&\n this.py.getValueAtTime\n ) {\n v1 = []\n v2 = []\n var px = this.px\n var py = this.py\n if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {\n v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0)\n v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0)\n v2[0] = px.getValueAtTime(px.keyframes[0].t / frameRate, 0)\n v2[1] = py.getValueAtTime(py.keyframes[0].t / frameRate, 0)\n } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {\n v1[0] = px.getValueAtTime(px.keyframes[px.keyframes.length - 1].t / frameRate, 0)\n v1[1] = py.getValueAtTime(py.keyframes[py.keyframes.length - 1].t / frameRate, 0)\n v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0)\n v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0)\n } else {\n v1 = [px.pv, py.pv]\n v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime)\n v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime)\n }\n } else {\n v2 = defaultVector\n v1 = v2\n }\n this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]))\n }\n if (this.data.p && this.data.p.s) {\n if (this.data.p.z) {\n this.v.translate(this.px.v, this.py.v, -this.pz.v)\n } else {\n this.v.translate(this.px.v, this.py.v, 0)\n }\n } else {\n this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2])\n }\n }\n this.frameId = this.elem.globalData.frameId\n }\n\n function precalculateMatrix() {\n if (!this.a.k) {\n this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2])\n this.appliedTransformations = 1\n } else {\n return\n }\n if (!this.s.effectsSequence.length) {\n this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2])\n this.appliedTransformations = 2\n } else {\n return\n }\n if (this.sk) {\n if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {\n this.pre.skewFromAxis(-this.sk.v, this.sa.v)\n this.appliedTransformations = 3\n } else {\n return\n }\n }\n if (this.r) {\n if (!this.r.effectsSequence.length) {\n this.pre.rotate(-this.r.v)\n this.appliedTransformations = 4\n }\n } else if (\n !this.rz.effectsSequence.length &&\n !this.ry.effectsSequence.length &&\n !this.rx.effectsSequence.length &&\n !this.or.effectsSequence.length\n ) {\n this.pre\n .rotateZ(-this.rz.v)\n .rotateY(this.ry.v)\n .rotateX(this.rx.v)\n .rotateZ(-this.or.v[2])\n .rotateY(this.or.v[1])\n .rotateX(this.or.v[0])\n this.appliedTransformations = 4\n }\n }\n\n function autoOrient() {\n //\n // var prevP = this.getValueAtTime();\n }\n\n function addDynamicProperty(prop) {\n this._addDynamicProperty(prop)\n this.elem.addDynamicProperty(prop)\n this._isDirty = true\n }\n\n function TransformProperty(elem, data, container) {\n this.elem = elem\n this.frameId = -1\n this.propType = 'transform'\n this.data = data\n this.v = new Matrix()\n // Precalculated matrix with non animated properties\n this.pre = new Matrix()\n this.appliedTransformations = 0\n this.initDynamicPropertyContainer(container || elem)\n if (data.p && data.p.s) {\n this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this)\n this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this)\n if (data.p.z) {\n this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this)\n }\n } else {\n this.p = PropertyFactory.getProp(elem, data.p || { k: [0, 0, 0] }, 1, 0, this)\n }\n if (data.rx) {\n this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this)\n this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this)\n this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this)\n if (data.or.k[0].ti) {\n var i\n var len = data.or.k.length\n for (i = 0; i < len; i += 1) {\n data.or.k[i].to = null\n data.or.k[i].ti = null\n }\n }\n this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this)\n // sh Indicates it needs to be capped between -180 and 180\n this.or.sh = true\n } else {\n this.r = PropertyFactory.getProp(elem, data.r || { k: 0 }, 0, degToRads, this)\n }\n if (data.sk) {\n this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this)\n this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this)\n }\n this.a = PropertyFactory.getProp(elem, data.a || { k: [0, 0, 0] }, 1, 0, this)\n this.s = PropertyFactory.getProp(elem, data.s || { k: [100, 100, 100] }, 1, 0.01, this)\n // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.\n if (data.o) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem)\n } else {\n this.o = { _mdf: false, v: 1 }\n }\n this._isDirty = true\n if (!this.dynamicProperties.length) {\n this.getValue(true)\n }\n }\n\n TransformProperty.prototype = {\n applyToMatrix: applyToMatrix,\n getValue: processKeys,\n precalculateMatrix: precalculateMatrix,\n autoOrient: autoOrient,\n }\n\n extendPrototype([DynamicPropertyContainer], TransformProperty)\n TransformProperty.prototype.addDynamicProperty = addDynamicProperty\n TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty\n\n function getTransformProperty(elem, data, container) {\n return new TransformProperty(elem, data, container)\n }\n\n return {\n getTransformProperty: getTransformProperty,\n }\n })()\n\n function RepeaterModifier() {}\n extendPrototype([ShapeModifier], RepeaterModifier)\n\n RepeaterModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys\n this.c = PropertyFactory.getProp(elem, data.c, 0, null, this)\n this.o = PropertyFactory.getProp(elem, data.o, 0, null, this)\n this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this)\n this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this)\n this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this)\n this.data = data\n if (!this.dynamicProperties.length) {\n this.getValue(true)\n }\n this._isAnimated = !!this.dynamicProperties.length\n this.pMatrix = new Matrix()\n this.rMatrix = new Matrix()\n this.sMatrix = new Matrix()\n this.tMatrix = new Matrix()\n this.matrix = new Matrix()\n }\n\n RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {\n var dir = inv ? -1 : 1\n var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc)\n var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc)\n pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2])\n rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2])\n rMatrix.rotate(-transform.r.v * dir * perc)\n rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2])\n sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2])\n sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY)\n sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2])\n }\n\n RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {\n this.elem = elem\n this.arr = arr\n this.pos = pos\n this.elemsData = elemsData\n this._currentCopies = 0\n this._elements = []\n this._groups = []\n this.frameId = -1\n this.initDynamicPropertyContainer(elem)\n this.initModifierProperties(elem, arr[pos])\n while (pos > 0) {\n pos -= 1\n // this._elements.unshift(arr.splice(pos,1)[0]);\n this._elements.unshift(arr[pos])\n }\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.getValue(true)\n }\n }\n\n RepeaterModifier.prototype.resetElements = function (elements) {\n var i\n var len = elements.length\n for (i = 0; i < len; i += 1) {\n elements[i]._processed = false\n if (elements[i].ty === 'gr') {\n this.resetElements(elements[i].it)\n }\n }\n }\n\n RepeaterModifier.prototype.cloneElements = function (elements) {\n var newElements = JSON.parse(JSON.stringify(elements))\n this.resetElements(newElements)\n return newElements\n }\n\n RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {\n var i\n var len = elements.length\n for (i = 0; i < len; i += 1) {\n elements[i]._render = renderFlag\n if (elements[i].ty === 'gr') {\n this.changeGroupRender(elements[i].it, renderFlag)\n }\n }\n }\n\n RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {\n var items\n var itemsTransform\n var i\n var dir\n var cont\n var hasReloaded = false\n if (this._mdf || _isFirstFrame) {\n var copies = Math.ceil(this.c.v)\n if (this._groups.length < copies) {\n while (this._groups.length < copies) {\n var group = {\n it: this.cloneElements(this._elements),\n ty: 'gr',\n }\n group.it.push({\n a: { a: 0, ix: 1, k: [0, 0] },\n nm: 'Transform',\n o: { a: 0, ix: 7, k: 100 },\n p: { a: 0, ix: 2, k: [0, 0] },\n r: {\n a: 1,\n ix: 6,\n k: [\n { s: 0, e: 0, t: 0 },\n { s: 0, e: 0, t: 1 },\n ],\n },\n s: { a: 0, ix: 3, k: [100, 100] },\n sa: { a: 0, ix: 5, k: 0 },\n sk: { a: 0, ix: 4, k: 0 },\n ty: 'tr',\n })\n\n this.arr.splice(0, 0, group)\n this._groups.splice(0, 0, group)\n this._currentCopies += 1\n }\n this.elem.reloadShapes()\n hasReloaded = true\n }\n cont = 0\n var renderFlag\n for (i = 0; i <= this._groups.length - 1; i += 1) {\n renderFlag = cont < copies\n this._groups[i]._render = renderFlag\n this.changeGroupRender(this._groups[i].it, renderFlag)\n if (!renderFlag) {\n var elems = this.elemsData[i].it\n var transformData = elems[elems.length - 1]\n if (transformData.transform.op.v !== 0) {\n transformData.transform.op._mdf = true\n transformData.transform.op.v = 0\n } else {\n transformData.transform.op._mdf = false\n }\n }\n cont += 1\n }\n\n this._currentCopies = copies\n /// /\n\n var offset = this.o.v\n var offsetModulo = offset % 1\n var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset)\n var pProps = this.pMatrix.props\n var rProps = this.rMatrix.props\n var sProps = this.sMatrix.props\n this.pMatrix.reset()\n this.rMatrix.reset()\n this.sMatrix.reset()\n this.tMatrix.reset()\n this.matrix.reset()\n var iteration = 0\n\n if (offset > 0) {\n while (iteration < roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false)\n iteration += 1\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false)\n iteration += offsetModulo\n }\n } else if (offset < 0) {\n while (iteration > roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true)\n iteration -= 1\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true)\n iteration -= offsetModulo\n }\n }\n i = this.data.m === 1 ? 0 : this._currentCopies - 1\n dir = this.data.m === 1 ? 1 : -1\n cont = this._currentCopies\n var j\n var jLen\n while (cont) {\n items = this.elemsData[i].it\n itemsTransform = items[items.length - 1].transform.mProps.v.props\n jLen = itemsTransform.length\n items[items.length - 1].transform.mProps._mdf = true\n items[items.length - 1].transform.op._mdf = true\n items[items.length - 1].transform.op.v =\n this._currentCopies === 1 ? this.so.v : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1))\n\n if (iteration !== 0) {\n if ((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false)\n }\n this.matrix.transform(\n rProps[0],\n rProps[1],\n rProps[2],\n rProps[3],\n rProps[4],\n rProps[5],\n rProps[6],\n rProps[7],\n rProps[8],\n rProps[9],\n rProps[10],\n rProps[11],\n rProps[12],\n rProps[13],\n rProps[14],\n rProps[15],\n )\n this.matrix.transform(\n sProps[0],\n sProps[1],\n sProps[2],\n sProps[3],\n sProps[4],\n sProps[5],\n sProps[6],\n sProps[7],\n sProps[8],\n sProps[9],\n sProps[10],\n sProps[11],\n sProps[12],\n sProps[13],\n sProps[14],\n sProps[15],\n )\n this.matrix.transform(\n pProps[0],\n pProps[1],\n pProps[2],\n pProps[3],\n pProps[4],\n pProps[5],\n pProps[6],\n pProps[7],\n pProps[8],\n pProps[9],\n pProps[10],\n pProps[11],\n pProps[12],\n pProps[13],\n pProps[14],\n pProps[15],\n )\n\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j]\n }\n this.matrix.reset()\n } else {\n this.matrix.reset()\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j]\n }\n }\n iteration += 1\n cont -= 1\n i += dir\n }\n } else {\n cont = this._currentCopies\n i = 0\n dir = 1\n while (cont) {\n items = this.elemsData[i].it\n itemsTransform = items[items.length - 1].transform.mProps.v.props\n items[items.length - 1].transform.mProps._mdf = false\n items[items.length - 1].transform.op._mdf = false\n cont -= 1\n i += dir\n }\n }\n return hasReloaded\n }\n\n RepeaterModifier.prototype.addShape = function () {}\n\n function RoundCornersModifier() {}\n extendPrototype([ShapeModifier], RoundCornersModifier)\n RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys\n this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this)\n this._isAnimated = !!this.rd.effectsSequence.length\n }\n\n RoundCornersModifier.prototype.processPath = function (path, round) {\n var clonedPath = shapePool.newElement()\n clonedPath.c = path.c\n var i\n var len = path._length\n var currentV\n var currentI\n var currentO\n var closerV\n var distance\n var newPosPerc\n var index = 0\n var vX\n var vY\n var oX\n var oY\n var iX\n var iY\n for (i = 0; i < len; i += 1) {\n currentV = path.v[i]\n currentO = path.o[i]\n currentI = path.i[i]\n if (\n currentV[0] === currentO[0] &&\n currentV[1] === currentO[1] &&\n currentV[0] === currentI[0] &&\n currentV[1] === currentI[1]\n ) {\n if ((i === 0 || i === len - 1) && !path.c) {\n clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index)\n /* clonedPath.v[index] = currentV;\n clonedPath.o[index] = currentO;\n clonedPath.i[index] = currentI; */\n index += 1\n } else {\n if (i === 0) {\n closerV = path.v[len - 1]\n } else {\n closerV = path.v[i - 1]\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2))\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0\n iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc\n vX = iX\n iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc\n vY = iY\n oX = vX - (vX - currentV[0]) * roundCorner\n oY = vY - (vY - currentV[1]) * roundCorner\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index)\n index += 1\n\n if (i === len - 1) {\n closerV = path.v[0]\n } else {\n closerV = path.v[i + 1]\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2))\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0\n oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc\n vX = oX\n oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc\n vY = oY\n iX = vX - (vX - currentV[0]) * roundCorner\n iY = vY - (vY - currentV[1]) * roundCorner\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index)\n index += 1\n }\n } else {\n clonedPath.setTripleAt(\n path.v[i][0],\n path.v[i][1],\n path.o[i][0],\n path.o[i][1],\n path.i[i][0],\n path.i[i][1],\n index,\n )\n index += 1\n }\n }\n return clonedPath\n }\n\n RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths\n var i\n var len = this.shapes.length\n var j\n var jLen\n var rd = this.rd.v\n\n if (rd !== 0) {\n var shapeData\n var localShapeCollection\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i]\n localShapeCollection = shapeData.localShapeCollection\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes()\n shapeData.shape._mdf = true\n shapePaths = shapeData.shape.paths.shapes\n jLen = shapeData.shape.paths._length\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], rd))\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false\n }\n }\n\n function getFontProperties(fontData) {\n var styles = fontData.fStyle ? fontData.fStyle.split(' ') : []\n\n var fWeight = 'normal'\n var fStyle = 'normal'\n var len = styles.length\n var styleName\n for (var i = 0; i < len; i += 1) {\n styleName = styles[i].toLowerCase()\n switch (styleName) {\n case 'italic':\n fStyle = 'italic'\n break\n case 'bold':\n fWeight = '700'\n break\n case 'black':\n fWeight = '900'\n break\n case 'medium':\n fWeight = '500'\n break\n case 'regular':\n case 'normal':\n fWeight = '400'\n break\n case 'light':\n case 'thin':\n fWeight = '200'\n break\n default:\n break\n }\n }\n\n return {\n style: fStyle,\n weight: fontData.fWeight || fWeight,\n }\n }\n\n const FontManager = (function () {\n var maxWaitingTime = 5000\n var emptyChar = {\n w: 0,\n size: 0,\n shapes: [],\n data: {\n shapes: [],\n },\n }\n var combinedCharacters = []\n // Hindi characters\n combinedCharacters = combinedCharacters.concat([\n 2304,\n 2305,\n 2306,\n 2307,\n 2362,\n 2363,\n 2364,\n 2364,\n 2366,\n 2367,\n 2368,\n 2369,\n 2370,\n 2371,\n 2372,\n 2373,\n 2374,\n 2375,\n 2376,\n 2377,\n 2378,\n 2379,\n 2380,\n 2381,\n 2382,\n 2383,\n 2387,\n 2388,\n 2389,\n 2390,\n 2391,\n 2402,\n 2403,\n ])\n\n var surrogateModifiers = ['d83cdffb', 'd83cdffc', 'd83cdffd', 'd83cdffe', 'd83cdfff']\n\n var zeroWidthJoiner = [65039, 8205]\n\n function trimFontOptions(font) {\n var familyArray = font.split(',')\n var i\n var len = familyArray.length\n var enabledFamilies = []\n for (i = 0; i < len; i += 1) {\n if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {\n enabledFamilies.push(familyArray[i])\n }\n }\n return enabledFamilies.join(',')\n }\n\n function setUpNode(font, family) {\n var parentNode = createTag('span')\n // Node is invisible to screen readers.\n parentNode.setAttribute('aria-hidden', true)\n parentNode.style.fontFamily = family\n var node = createTag('span')\n // Characters that vary significantly among different fonts\n node.innerText = 'giItT1WQy@!-/#'\n // Visible - so we can measure it - but not on the screen\n parentNode.style.position = 'absolute'\n parentNode.style.left = '-10000px'\n parentNode.style.top = '-10000px'\n // Large font size makes even subtle changes obvious\n parentNode.style.fontSize = '300px'\n // Reset any font properties\n parentNode.style.fontVariant = 'normal'\n parentNode.style.fontStyle = 'normal'\n parentNode.style.fontWeight = 'normal'\n parentNode.style.letterSpacing = '0'\n parentNode.appendChild(node)\n document.body.appendChild(parentNode)\n\n // Remember width with no applied web font\n var width = node.offsetWidth\n node.style.fontFamily = trimFontOptions(font) + ', ' + family\n return { node: node, w: width, parent: parentNode }\n }\n\n function checkLoadedFonts() {\n var i\n var len = this.fonts.length\n var node\n var w\n var loadedCount = len\n for (i = 0; i < len; i += 1) {\n if (this.fonts[i].loaded) {\n loadedCount -= 1\n } else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {\n this.fonts[i].loaded = true\n } else {\n node = this.fonts[i].monoCase.node\n w = this.fonts[i].monoCase.w\n if (node.offsetWidth !== w) {\n loadedCount -= 1\n this.fonts[i].loaded = true\n } else {\n node = this.fonts[i].sansCase.node\n w = this.fonts[i].sansCase.w\n if (node.offsetWidth !== w) {\n loadedCount -= 1\n this.fonts[i].loaded = true\n }\n }\n if (this.fonts[i].loaded) {\n this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent)\n this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent)\n }\n }\n }\n\n if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {\n setTimeout(this.checkLoadedFontsBinded, 20)\n } else {\n setTimeout(this.setIsLoadedBinded, 10)\n }\n }\n\n function createHelper(fontData, def) {\n var engine = document.body && def ? 'svg' : 'canvas'\n var helper\n var fontProps = getFontProperties(fontData)\n if (engine === 'svg') {\n var tHelper = createNS('text')\n tHelper.style.fontSize = '100px'\n // tHelper.style.fontFamily = fontData.fFamily;\n tHelper.setAttribute('font-family', fontData.fFamily)\n tHelper.setAttribute('font-style', fontProps.style)\n tHelper.setAttribute('font-weight', fontProps.weight)\n tHelper.textContent = '1'\n if (fontData.fClass) {\n tHelper.style.fontFamily = 'inherit'\n tHelper.setAttribute('class', fontData.fClass)\n } else {\n tHelper.style.fontFamily = fontData.fFamily\n }\n def.appendChild(tHelper)\n helper = tHelper\n } else {\n var tCanvasHelper = new OffscreenCanvas(500, 500).getContext('2d')\n tCanvasHelper.font = fontProps.style + ' ' + fontProps.weight + ' 100px ' + fontData.fFamily\n helper = tCanvasHelper\n }\n function measure(text) {\n if (engine === 'svg') {\n helper.textContent = text\n return helper.getComputedTextLength()\n }\n return helper.measureText(text).width\n }\n return {\n measureText: measure,\n }\n }\n\n function addFonts(fontData, defs) {\n if (!fontData) {\n this.isLoaded = true\n return\n }\n if (this.chars) {\n this.isLoaded = true\n this.fonts = fontData.list\n return\n }\n if (!document.body) {\n this.isLoaded = true\n fontData.list.forEach((data) => {\n data.helper = createHelper(data)\n data.cache = {}\n })\n this.fonts = fontData.list\n return\n }\n\n var fontArr = fontData.list\n var i\n var len = fontArr.length\n var _pendingFonts = len\n for (i = 0; i < len; i += 1) {\n var shouldLoadFont = true\n var loadedSelector\n var j\n fontArr[i].loaded = false\n fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace')\n fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif')\n if (!fontArr[i].fPath) {\n fontArr[i].loaded = true\n _pendingFonts -= 1\n } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {\n loadedSelector = document.querySelectorAll(\n 'style[f-forigin=\"p\"][f-family=\"' +\n fontArr[i].fFamily +\n '\"], style[f-origin=\"3\"][f-family=\"' +\n fontArr[i].fFamily +\n '\"]',\n )\n\n if (loadedSelector.length > 0) {\n shouldLoadFont = false\n }\n\n if (shouldLoadFont) {\n var s = createTag('style')\n s.setAttribute('f-forigin', fontArr[i].fOrigin)\n s.setAttribute('f-origin', fontArr[i].origin)\n s.setAttribute('f-family', fontArr[i].fFamily)\n s.type = 'text/css'\n s.innerText =\n '@font-face {font-family: ' +\n fontArr[i].fFamily +\n \"; font-style: normal; src: url('\" +\n fontArr[i].fPath +\n \"');}\"\n defs.appendChild(s)\n }\n } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {\n loadedSelector = document.querySelectorAll('link[f-forigin=\"g\"], link[f-origin=\"1\"]')\n\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {\n // Font is already loaded\n shouldLoadFont = false\n }\n }\n\n if (shouldLoadFont) {\n var l = createTag('link')\n l.setAttribute('f-forigin', fontArr[i].fOrigin)\n l.setAttribute('f-origin', fontArr[i].origin)\n l.type = 'text/css'\n l.rel = 'stylesheet'\n l.href = fontArr[i].fPath\n document.body.appendChild(l)\n }\n } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {\n loadedSelector = document.querySelectorAll('script[f-forigin=\"t\"], script[f-origin=\"2\"]')\n\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (fontArr[i].fPath === loadedSelector[j].src) {\n // Font is already loaded\n shouldLoadFont = false\n }\n }\n\n if (shouldLoadFont) {\n var sc = createTag('link')\n sc.setAttribute('f-forigin', fontArr[i].fOrigin)\n sc.setAttribute('f-origin', fontArr[i].origin)\n sc.setAttribute('rel', 'stylesheet')\n sc.setAttribute('href', fontArr[i].fPath)\n defs.appendChild(sc)\n }\n }\n fontArr[i].helper = createHelper(fontArr[i], defs)\n fontArr[i].cache = {}\n this.fonts.push(fontArr[i])\n }\n if (_pendingFonts === 0) {\n this.isLoaded = true\n } else {\n // On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.\n // Adding this timeout seems to fix it\n setTimeout(this.checkLoadedFonts.bind(this), 100)\n }\n }\n\n function addChars(chars) {\n if (!chars) {\n return\n }\n if (!this.chars) {\n this.chars = []\n }\n var i\n var len = chars.length\n var j\n var jLen = this.chars.length\n var found\n for (i = 0; i < len; i += 1) {\n j = 0\n found = false\n while (j < jLen) {\n if (\n this.chars[j].style === chars[i].style &&\n this.chars[j].fFamily === chars[i].fFamily &&\n this.chars[j].ch === chars[i].ch\n ) {\n found = true\n }\n j += 1\n }\n if (!found) {\n this.chars.push(chars[i])\n jLen += 1\n }\n }\n }\n\n function getCharData(char, style, font) {\n var i = 0\n var len = this.chars.length\n while (i < len) {\n if (this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font) {\n return this.chars[i]\n }\n i += 1\n }\n if (\n ((typeof char === 'string' && char.charCodeAt(0) !== 13) || !char) &&\n console &&\n console.warn && // eslint-disable-line no-console\n !this._warned\n ) {\n this._warned = true\n console.warn('Missing character from exported characters list: ', char, style, font) // eslint-disable-line no-console\n }\n return emptyChar\n }\n\n function measureText(char, fontName, size) {\n var fontData = this.getFontByName(fontName)\n var index = char.charCodeAt(0)\n if (!fontData.cache[index + 1]) {\n var tHelper = fontData.helper\n if (char === ' ') {\n var doubleSize = tHelper.measureText('|' + char + '|')\n var singleSize = tHelper.measureText('||')\n fontData.cache[index + 1] = (doubleSize - singleSize) / 100\n } else {\n fontData.cache[index + 1] = tHelper.measureText(char) / 100\n }\n }\n return fontData.cache[index + 1] * size\n }\n\n function getFontByName(name) {\n var i = 0\n var len = this.fonts.length\n while (i < len) {\n if (this.fonts[i].fName === name) {\n return this.fonts[i]\n }\n i += 1\n }\n return this.fonts[0]\n }\n\n function isModifier(firstCharCode, secondCharCode) {\n var sum = firstCharCode.toString(16) + secondCharCode.toString(16)\n return surrogateModifiers.indexOf(sum) !== -1\n }\n\n function isZeroWidthJoiner(firstCharCode, secondCharCode) {\n if (!secondCharCode) {\n return firstCharCode === zeroWidthJoiner[1]\n }\n return firstCharCode === zeroWidthJoiner[0] && secondCharCode === zeroWidthJoiner[1]\n }\n\n function isCombinedCharacter(char) {\n return combinedCharacters.indexOf(char) !== -1\n }\n\n function setIsLoaded() {\n this.isLoaded = true\n }\n\n var Font = function () {\n this.fonts = []\n this.chars = null\n this.typekitLoaded = 0\n this.isLoaded = false\n this._warned = false\n this.initTime = Date.now()\n this.setIsLoadedBinded = this.setIsLoaded.bind(this)\n this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this)\n }\n Font.isModifier = isModifier\n Font.isZeroWidthJoiner = isZeroWidthJoiner\n Font.isCombinedCharacter = isCombinedCharacter\n\n var fontPrototype = {\n addChars: addChars,\n addFonts: addFonts,\n getCharData: getCharData,\n getFontByName: getFontByName,\n measureText: measureText,\n checkLoadedFonts: checkLoadedFonts,\n setIsLoaded: setIsLoaded,\n }\n\n Font.prototype = fontPrototype\n\n return Font\n })()\n\n function RenderableElement() {}\n\n RenderableElement.prototype = {\n initRenderable: function () {\n // layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange\n this.isInRange = false\n // layer's display state\n this.hidden = false\n // If layer's transparency equals 0, it can be hidden\n this.isTransparent = false\n // list of animated components\n this.renderableComponents = []\n },\n addRenderableComponent: function (component) {\n if (this.renderableComponents.indexOf(component) === -1) {\n this.renderableComponents.push(component)\n }\n },\n removeRenderableComponent: function (component) {\n if (this.renderableComponents.indexOf(component) !== -1) {\n this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1)\n }\n },\n prepareRenderableFrame: function (num) {\n this.checkLayerLimits(num)\n },\n checkTransparency: function () {\n if (this.finalTransform.mProp.o.v <= 0) {\n if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {\n this.isTransparent = true\n this.hide()\n }\n } else if (this.isTransparent) {\n this.isTransparent = false\n this.show()\n }\n },\n /**\n * @function\n * Initializes frame related properties.\n *\n * @param {number} num\n * current frame number in Layer's time\n *\n */\n checkLayerLimits: function (num) {\n if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {\n if (this.isInRange !== true) {\n this.globalData._mdf = true\n this._mdf = true\n this.isInRange = true\n this.show()\n }\n } else if (this.isInRange !== false) {\n this.globalData._mdf = true\n this.isInRange = false\n this.hide()\n }\n },\n renderRenderable: function () {\n var i\n var len = this.renderableComponents.length\n for (i = 0; i < len; i += 1) {\n this.renderableComponents[i].renderFrame(this._isFirstFrame)\n }\n /* this.maskManager.renderFrame(this.finalTransform.mat);\n this.renderableEffectsManager.renderFrame(this._isFirstFrame); */\n },\n sourceRectAtTime: function () {\n return {\n top: 0,\n left: 0,\n width: 100,\n height: 100,\n }\n },\n getLayerSize: function () {\n if (this.data.ty === 5) {\n return { w: this.data.textData.width, h: this.data.textData.height }\n }\n return { w: this.data.width, h: this.data.height }\n },\n }\n\n const MaskManagerInterface = (function () {\n function MaskInterface(mask, data) {\n this._mask = mask\n this._data = data\n }\n Object.defineProperty(MaskInterface.prototype, 'maskPath', {\n get: function () {\n if (this._mask.prop.k) {\n this._mask.prop.getValue()\n }\n return this._mask.prop\n },\n })\n Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {\n get: function () {\n if (this._mask.op.k) {\n this._mask.op.getValue()\n }\n return this._mask.op.v * 100\n },\n })\n\n var MaskManager = function (maskManager) {\n var _masksInterfaces = createSizedArray(maskManager.viewData.length)\n var i\n var len = maskManager.viewData.length\n for (i = 0; i < len; i += 1) {\n _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i])\n }\n\n var maskFunction = function (name) {\n i = 0\n while (i < len) {\n if (maskManager.masksProperties[i].nm === name) {\n return _masksInterfaces[i]\n }\n i += 1\n }\n return null\n }\n return maskFunction\n }\n return MaskManager\n })()\n\n const ExpressionPropertyInterface = (function () {\n var defaultUnidimensionalValue = { pv: 0, v: 0, mult: 1 }\n var defaultMultidimensionalValue = { pv: [0, 0, 0], v: [0, 0, 0], mult: 1 }\n\n function completeProperty(expressionValue, property, type) {\n Object.defineProperty(expressionValue, 'velocity', {\n get: function () {\n return property.getVelocityAtTime(property.comp.currentFrame)\n },\n })\n expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0\n expressionValue.key = function (pos) {\n if (!expressionValue.numKeys) {\n return 0\n }\n var value = ''\n if ('s' in property.keyframes[pos - 1]) {\n value = property.keyframes[pos - 1].s\n } else if ('e' in property.keyframes[pos - 2]) {\n value = property.keyframes[pos - 2].e\n } else {\n value = property.keyframes[pos - 2].s\n }\n var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value) // eslint-disable-line no-new-wrappers\n valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate\n valueProp.value = type === 'unidimensional' ? value[0] : value\n return valueProp\n }\n expressionValue.valueAtTime = property.getValueAtTime\n expressionValue.speedAtTime = property.getSpeedAtTime\n expressionValue.velocityAtTime = property.getVelocityAtTime\n expressionValue.propertyGroup = property.propertyGroup\n }\n\n function UnidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultUnidimensionalValue\n }\n var mult = 1 / property.mult\n var val = property.pv * mult\n var expressionValue = new Number(val) // eslint-disable-line no-new-wrappers\n expressionValue.value = val\n completeProperty(expressionValue, property, 'unidimensional')\n\n return function () {\n if (property.k) {\n property.getValue()\n }\n val = property.v * mult\n if (expressionValue.value !== val) {\n expressionValue = new Number(val) // eslint-disable-line no-new-wrappers\n expressionValue.value = val\n completeProperty(expressionValue, property, 'unidimensional')\n }\n return expressionValue\n }\n }\n\n function MultidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultMultidimensionalValue\n }\n var mult = 1 / property.mult\n var len = (property.data && property.data.l) || property.pv.length\n var expressionValue = createTypedArray('float32', len)\n var arrValue = createTypedArray('float32', len)\n expressionValue.value = arrValue\n completeProperty(expressionValue, property, 'multidimensional')\n\n return function () {\n if (property.k) {\n property.getValue()\n }\n for (var i = 0; i < len; i += 1) {\n arrValue[i] = property.v[i] * mult\n expressionValue[i] = arrValue[i]\n }\n return expressionValue\n }\n }\n\n // TODO: try to avoid using this getter\n function defaultGetter() {\n return defaultUnidimensionalValue\n }\n\n return function (property) {\n if (!property) {\n return defaultGetter\n }\n if (property.propType === 'unidimensional') {\n return UnidimensionalPropertyInterface(property)\n }\n return MultidimensionalPropertyInterface(property)\n }\n })()\n\n const TransformExpressionInterface = (function () {\n return function (transform) {\n function _thisFunction(name) {\n switch (name) {\n case 'scale':\n case 'Scale':\n case 'ADBE Scale':\n case 6:\n return _thisFunction.scale\n case 'rotation':\n case 'Rotation':\n case 'ADBE Rotation':\n case 'ADBE Rotate Z':\n case 10:\n return _thisFunction.rotation\n case 'ADBE Rotate X':\n return _thisFunction.xRotation\n case 'ADBE Rotate Y':\n return _thisFunction.yRotation\n case 'position':\n case 'Position':\n case 'ADBE Position':\n case 2:\n return _thisFunction.position\n case 'ADBE Position_0':\n return _thisFunction.xPosition\n case 'ADBE Position_1':\n return _thisFunction.yPosition\n case 'ADBE Position_2':\n return _thisFunction.zPosition\n case 'anchorPoint':\n case 'AnchorPoint':\n case 'Anchor Point':\n case 'ADBE AnchorPoint':\n case 1:\n return _thisFunction.anchorPoint\n case 'opacity':\n case 'Opacity':\n case 11:\n return _thisFunction.opacity\n default:\n return null\n }\n }\n Object.defineProperty(_thisFunction, 'rotation', {\n get: ExpressionPropertyInterface(transform.r || transform.rz),\n })\n\n Object.defineProperty(_thisFunction, 'zRotation', {\n get: ExpressionPropertyInterface(transform.rz || transform.r),\n })\n\n Object.defineProperty(_thisFunction, 'xRotation', {\n get: ExpressionPropertyInterface(transform.rx),\n })\n\n Object.defineProperty(_thisFunction, 'yRotation', {\n get: ExpressionPropertyInterface(transform.ry),\n })\n Object.defineProperty(_thisFunction, 'scale', {\n get: ExpressionPropertyInterface(transform.s),\n })\n var _px\n var _py\n var _pz\n var _transformFactory\n if (transform.p) {\n _transformFactory = ExpressionPropertyInterface(transform.p)\n } else {\n _px = ExpressionPropertyInterface(transform.px)\n _py = ExpressionPropertyInterface(transform.py)\n if (transform.pz) {\n _pz = ExpressionPropertyInterface(transform.pz)\n }\n }\n Object.defineProperty(_thisFunction, 'position', {\n get: function () {\n if (transform.p) {\n return _transformFactory()\n }\n return [_px(), _py(), _pz ? _pz() : 0]\n },\n })\n\n Object.defineProperty(_thisFunction, 'xPosition', {\n get: ExpressionPropertyInterface(transform.px),\n })\n\n Object.defineProperty(_thisFunction, 'yPosition', {\n get: ExpressionPropertyInterface(transform.py),\n })\n\n Object.defineProperty(_thisFunction, 'zPosition', {\n get: ExpressionPropertyInterface(transform.pz),\n })\n\n Object.defineProperty(_thisFunction, 'anchorPoint', {\n get: ExpressionPropertyInterface(transform.a),\n })\n\n Object.defineProperty(_thisFunction, 'opacity', {\n get: ExpressionPropertyInterface(transform.o),\n })\n\n Object.defineProperty(_thisFunction, 'skew', {\n get: ExpressionPropertyInterface(transform.sk),\n })\n\n Object.defineProperty(_thisFunction, 'skewAxis', {\n get: ExpressionPropertyInterface(transform.sa),\n })\n\n Object.defineProperty(_thisFunction, 'orientation', {\n get: ExpressionPropertyInterface(transform.or),\n })\n\n return _thisFunction\n }\n })()\n\n const LayerExpressionInterface = (function () {\n function getMatrix(time) {\n var toWorldMat = new Matrix()\n if (time !== undefined) {\n var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time)\n propMatrix.clone(toWorldMat)\n } else {\n var transformMat = this._elem.finalTransform.mProp\n transformMat.applyToMatrix(toWorldMat)\n }\n return toWorldMat\n }\n\n function toWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time)\n toWorldMat.props[12] = 0\n toWorldMat.props[13] = 0\n toWorldMat.props[14] = 0\n return this.applyPoint(toWorldMat, arr)\n }\n\n function toWorld(arr, time) {\n var toWorldMat = this.getMatrix(time)\n return this.applyPoint(toWorldMat, arr)\n }\n\n function fromWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time)\n toWorldMat.props[12] = 0\n toWorldMat.props[13] = 0\n toWorldMat.props[14] = 0\n return this.invertPoint(toWorldMat, arr)\n }\n\n function fromWorld(arr, time) {\n var toWorldMat = this.getMatrix(time)\n return this.invertPoint(toWorldMat, arr)\n }\n\n function applyPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i\n var len = this._elem.hierarchy.length\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix)\n }\n }\n return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0)\n }\n\n function invertPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i\n var len = this._elem.hierarchy.length\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix)\n }\n }\n return matrix.inversePoint(arr)\n }\n\n function fromComp(arr) {\n var toWorldMat = new Matrix()\n toWorldMat.reset()\n this._elem.finalTransform.mProp.applyToMatrix(toWorldMat)\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i\n var len = this._elem.hierarchy.length\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat)\n }\n return toWorldMat.inversePoint(arr)\n }\n return toWorldMat.inversePoint(arr)\n }\n\n function sampleImage() {\n return [1, 1, 1, 1]\n }\n\n return function (elem) {\n var transformInterface\n\n function _registerMaskInterface(maskManager) {\n _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem)\n }\n function _registerEffectsInterface(effects) {\n _thisLayerFunction.effect = effects\n }\n\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Root Vectors Group':\n case 'Contents':\n case 2:\n return _thisLayerFunction.shapeInterface\n case 1:\n case 6:\n case 'Transform':\n case 'transform':\n case 'ADBE Transform Group':\n return transformInterface\n case 4:\n case 'ADBE Effect Parade':\n case 'effects':\n case 'Effects':\n return _thisLayerFunction.effect\n case 'ADBE Text Properties':\n return _thisLayerFunction.textInterface\n default:\n return null\n }\n }\n _thisLayerFunction.getMatrix = getMatrix\n _thisLayerFunction.invertPoint = invertPoint\n _thisLayerFunction.applyPoint = applyPoint\n _thisLayerFunction.toWorld = toWorld\n _thisLayerFunction.toWorldVec = toWorldVec\n _thisLayerFunction.fromWorld = fromWorld\n _thisLayerFunction.fromWorldVec = fromWorldVec\n _thisLayerFunction.toComp = toWorld\n _thisLayerFunction.fromComp = fromComp\n _thisLayerFunction.sampleImage = sampleImage\n _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem)\n _thisLayerFunction._elem = elem\n transformInterface = TransformExpressionInterface(elem.finalTransform.mProp)\n var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint')\n Object.defineProperties(_thisLayerFunction, {\n hasParent: {\n get: function () {\n return elem.hierarchy.length\n },\n },\n parent: {\n get: function () {\n return elem.hierarchy[0].layerInterface\n },\n },\n rotation: getDescriptor(transformInterface, 'rotation'),\n scale: getDescriptor(transformInterface, 'scale'),\n position: getDescriptor(transformInterface, 'position'),\n opacity: getDescriptor(transformInterface, 'opacity'),\n anchorPoint: anchorPointDescriptor,\n anchor_point: anchorPointDescriptor,\n transform: {\n get: function () {\n return transformInterface\n },\n },\n active: {\n get: function () {\n return elem.isInRange\n },\n },\n })\n\n _thisLayerFunction.startTime = elem.data.st\n _thisLayerFunction.index = elem.data.ind\n _thisLayerFunction.source = elem.data.refId\n _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100\n _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100\n _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate\n _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate\n _thisLayerFunction._name = elem.data.nm\n\n _thisLayerFunction.registerMaskInterface = _registerMaskInterface\n _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface\n return _thisLayerFunction\n }\n })()\n\n const propertyGroupFactory = (function () {\n return function (interfaceFunction, parentPropertyGroup) {\n return function (val) {\n val = val === undefined ? 1 : val\n if (val <= 0) {\n return interfaceFunction\n }\n return parentPropertyGroup(val - 1)\n }\n }\n })()\n\n const PropertyInterface = (function () {\n return function (propertyName, propertyGroup) {\n var interfaceFunction = {\n _name: propertyName,\n }\n\n function _propertyGroup(val) {\n val = val === undefined ? 1 : val\n if (val <= 0) {\n return interfaceFunction\n }\n return propertyGroup(val - 1)\n }\n\n return _propertyGroup\n }\n })()\n\n const EffectsExpressionInterface = (function () {\n var ob = {\n createEffectsInterface: createEffectsInterface,\n }\n\n function createEffectsInterface(elem, propertyGroup) {\n if (elem.effectsManager) {\n var effectElements = []\n var effectsData = elem.data.ef\n var i\n var len = elem.effectsManager.effectElements.length\n for (i = 0; i < len; i += 1) {\n effectElements.push(\n createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem),\n )\n }\n\n var effects = elem.data.ef || []\n var groupInterface = function (name) {\n i = 0\n len = effects.length\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n return effectElements[i]\n }\n i += 1\n }\n return null\n }\n Object.defineProperty(groupInterface, 'numProperties', {\n get: function () {\n return effects.length\n },\n })\n return groupInterface\n }\n return null\n }\n\n function createGroupInterface(data, elements, propertyGroup, elem) {\n function groupInterface(name) {\n var effects = data.ef\n var i = 0\n var len = effects.length\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n if (effects[i].ty === 5) {\n return effectElements[i]\n }\n return effectElements[i]()\n }\n i += 1\n }\n throw new Error()\n }\n var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup)\n\n var effectElements = []\n var i\n var len = data.ef.length\n for (i = 0; i < len; i += 1) {\n if (data.ef[i].ty === 5) {\n effectElements.push(\n createGroupInterface(\n data.ef[i],\n elements.effectElements[i],\n elements.effectElements[i].propertyGroup,\n elem,\n ),\n )\n } else {\n effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup))\n }\n }\n\n if (data.mn === 'ADBE Color Control') {\n Object.defineProperty(groupInterface, 'color', {\n get: function () {\n return effectElements[0]()\n },\n })\n }\n Object.defineProperties(groupInterface, {\n numProperties: {\n get: function () {\n return data.np\n },\n },\n _name: { value: data.nm },\n propertyGroup: { value: _propertyGroup },\n })\n groupInterface.enabled = data.en !== 0\n groupInterface.active = groupInterface.enabled\n return groupInterface\n }\n\n function createValueInterface(element, type, elem, propertyGroup) {\n var expressionProperty = ExpressionPropertyInterface(element.p)\n function interfaceFunction() {\n if (type === 10) {\n return elem.comp.compInterface(element.p.v)\n }\n return expressionProperty()\n }\n\n if (element.p.setGroupProperty) {\n element.p.setGroupProperty(PropertyInterface('', propertyGroup))\n }\n\n return interfaceFunction\n }\n\n return ob\n })()\n\n const CompExpressionInterface = (function () {\n return function (comp) {\n function _thisLayerFunction(name) {\n var i = 0\n var len = comp.layers.length\n while (i < len) {\n if (comp.layers[i].nm === name || comp.layers[i].ind === name) {\n return comp.elements[i].layerInterface\n }\n i += 1\n }\n return null\n // return {active:false};\n }\n Object.defineProperty(_thisLayerFunction, '_name', { value: comp.data.nm })\n _thisLayerFunction.layer = _thisLayerFunction\n _thisLayerFunction.pixelAspect = 1\n _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h\n _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w\n _thisLayerFunction.pixelAspect = 1\n _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate\n _thisLayerFunction.displayStartTime = 0\n _thisLayerFunction.numLayers = comp.layers.length\n return _thisLayerFunction\n }\n })()\n\n const ShapePathInterface = (function () {\n return function pathInterfaceFactory(shape, view, propertyGroup) {\n var prop = view.sh\n\n function interfaceFunction(val) {\n if (\n val === 'Shape' ||\n val === 'shape' ||\n val === 'Path' ||\n val === 'path' ||\n val === 'ADBE Vector Shape' ||\n val === 2\n ) {\n return interfaceFunction.path\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n prop.setGroupProperty(PropertyInterface('Path', _propertyGroup))\n Object.defineProperties(interfaceFunction, {\n path: {\n get: function () {\n if (prop.k) {\n prop.getValue()\n }\n return prop\n },\n },\n shape: {\n get: function () {\n if (prop.k) {\n prop.getValue()\n }\n return prop\n },\n },\n _name: { value: shape.nm },\n ix: { value: shape.ix },\n propertyIndex: { value: shape.ix },\n mn: { value: shape.mn },\n propertyGroup: { value: propertyGroup },\n })\n return interfaceFunction\n }\n })()\n\n const ShapeExpressionInterface = (function () {\n function iterateElements(shapes, view, propertyGroup) {\n var arr = []\n var i\n var len = shapes ? shapes.length : 0\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'fl') {\n arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'st') {\n arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'tm') {\n arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'tr') {\n // arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));\n } else if (shapes[i].ty === 'el') {\n arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'sr') {\n arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'sh') {\n arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'rc') {\n arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'rd') {\n arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'rp') {\n arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'gf') {\n arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else {\n arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup))\n }\n }\n return arr\n }\n\n function contentsInterfaceFactory(shape, view, propertyGroup) {\n var interfaces\n var interfaceFunction = function _interfaceFunction(value) {\n var i = 0\n var len = interfaces.length\n while (i < len) {\n if (\n interfaces[i]._name === value ||\n interfaces[i].mn === value ||\n interfaces[i].propertyIndex === value ||\n interfaces[i].ix === value ||\n interfaces[i].ind === value\n ) {\n return interfaces[i]\n }\n i += 1\n }\n if (typeof value === 'number') {\n return interfaces[value - 1]\n }\n return null\n }\n\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup)\n interfaceFunction.numProperties = interfaces.length\n var transformInterface = transformInterfaceFactory(\n shape.it[shape.it.length - 1],\n view.it[view.it.length - 1],\n interfaceFunction.propertyGroup,\n )\n interfaceFunction.transform = transformInterface\n interfaceFunction.propertyIndex = shape.cix\n interfaceFunction._name = shape.nm\n\n return interfaceFunction\n }\n\n function groupInterfaceFactory(shape, view, propertyGroup) {\n var interfaceFunction = function _interfaceFunction(value) {\n switch (value) {\n case 'ADBE Vectors Group':\n case 'Contents':\n case 2:\n return interfaceFunction.content\n // Not necessary for now. Keeping them here in case a new case appears\n // case 'ADBE Vector Transform Group':\n // case 3:\n default:\n return interfaceFunction.transform\n }\n }\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup)\n var transformInterface = transformInterfaceFactory(\n shape.it[shape.it.length - 1],\n view.it[view.it.length - 1],\n interfaceFunction.propertyGroup,\n )\n interfaceFunction.content = content\n interfaceFunction.transform = transformInterface\n Object.defineProperty(interfaceFunction, '_name', {\n get: function () {\n return shape.nm\n },\n })\n // interfaceFunction.content = interfaceFunction;\n interfaceFunction.numProperties = shape.np\n interfaceFunction.propertyIndex = shape.ix\n interfaceFunction.nm = shape.nm\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function fillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity\n }\n return null\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c),\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o),\n },\n _name: { value: shape.nm },\n mn: { value: shape.mn },\n })\n\n view.c.setGroupProperty(PropertyInterface('Color', propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup))\n return interfaceFunction\n }\n\n function gradientFillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Start Point' || val === 'start point') {\n return interfaceFunction.startPoint\n }\n if (val === 'End Point' || val === 'end point') {\n return interfaceFunction.endPoint\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity\n }\n return null\n }\n Object.defineProperties(interfaceFunction, {\n startPoint: {\n get: ExpressionPropertyInterface(view.s),\n },\n endPoint: {\n get: ExpressionPropertyInterface(view.e),\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o),\n },\n type: {\n get: function () {\n return 'a'\n },\n },\n _name: { value: shape.nm },\n mn: { value: shape.mn },\n })\n\n view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup))\n view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup))\n return interfaceFunction\n }\n function defaultInterfaceFactory() {\n function interfaceFunction() {\n return null\n }\n return interfaceFunction\n }\n\n function strokeInterfaceFactory(shape, view, propertyGroup) {\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup)\n function addPropertyToDashOb(i) {\n Object.defineProperty(dashOb, shape.d[i].nm, {\n get: ExpressionPropertyInterface(view.d.dataProps[i].p),\n })\n }\n var i\n var len = shape.d ? shape.d.length : 0\n var dashOb = {}\n for (i = 0; i < len; i += 1) {\n addPropertyToDashOb(i)\n view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup)\n }\n\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity\n }\n if (val === 'Stroke Width' || val === 'stroke width') {\n return interfaceFunction.strokeWidth\n }\n return null\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c),\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o),\n },\n strokeWidth: {\n get: ExpressionPropertyInterface(view.w),\n },\n dash: {\n get: function () {\n return dashOb\n },\n },\n _name: { value: shape.nm },\n mn: { value: shape.mn },\n })\n\n view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup))\n view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup))\n return interfaceFunction\n }\n\n function trimInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === shape.e.ix || val === 'End' || val === 'end') {\n return interfaceFunction.end\n }\n if (val === shape.s.ix) {\n return interfaceFunction.start\n }\n if (val === shape.o.ix) {\n return interfaceFunction.offset\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n interfaceFunction.propertyIndex = shape.ix\n\n view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup))\n view.e.setGroupProperty(PropertyInterface('End', _propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup))\n interfaceFunction.propertyIndex = shape.ix\n interfaceFunction.propertyGroup = propertyGroup\n\n Object.defineProperties(interfaceFunction, {\n start: {\n get: ExpressionPropertyInterface(view.s),\n },\n end: {\n get: ExpressionPropertyInterface(view.e),\n },\n offset: {\n get: ExpressionPropertyInterface(view.o),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function transformInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.a.ix === value || value === 'Anchor Point') {\n return interfaceFunction.anchorPoint\n }\n if (shape.o.ix === value || value === 'Opacity') {\n return interfaceFunction.opacity\n }\n if (shape.p.ix === value || value === 'Position') {\n return interfaceFunction.position\n }\n if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {\n return interfaceFunction.rotation\n }\n if (shape.s.ix === value || value === 'Scale') {\n return interfaceFunction.scale\n }\n if ((shape.sk && shape.sk.ix === value) || value === 'Skew') {\n return interfaceFunction.skew\n }\n if ((shape.sa && shape.sa.ix === value) || value === 'Skew Axis') {\n return interfaceFunction.skewAxis\n }\n return null\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup))\n view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup))\n view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup))\n view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup))\n if (view.transform.mProps.sk) {\n view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup))\n view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup))\n }\n view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup))\n Object.defineProperties(interfaceFunction, {\n opacity: {\n get: ExpressionPropertyInterface(view.transform.mProps.o),\n },\n position: {\n get: ExpressionPropertyInterface(view.transform.mProps.p),\n },\n anchorPoint: {\n get: ExpressionPropertyInterface(view.transform.mProps.a),\n },\n scale: {\n get: ExpressionPropertyInterface(view.transform.mProps.s),\n },\n rotation: {\n get: ExpressionPropertyInterface(view.transform.mProps.r),\n },\n skew: {\n get: ExpressionPropertyInterface(view.transform.mProps.sk),\n },\n skewAxis: {\n get: ExpressionPropertyInterface(view.transform.mProps.sa),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.ty = 'tr'\n interfaceFunction.mn = shape.mn\n interfaceFunction.propertyGroup = propertyGroup\n return interfaceFunction\n }\n\n function ellipseInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position\n }\n if (shape.s.ix === value) {\n return interfaceFunction.size\n }\n return null\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n interfaceFunction.propertyIndex = shape.ix\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup))\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n\n Object.defineProperties(interfaceFunction, {\n size: {\n get: ExpressionPropertyInterface(prop.s),\n },\n position: {\n get: ExpressionPropertyInterface(prop.p),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function starInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position\n }\n if (shape.r.ix === value) {\n return interfaceFunction.rotation\n }\n if (shape.pt.ix === value) {\n return interfaceFunction.points\n }\n if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') {\n return interfaceFunction.outerRadius\n }\n if (shape.os.ix === value) {\n return interfaceFunction.outerRoundness\n }\n if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) {\n return interfaceFunction.innerRadius\n }\n if (shape.is && shape.is.ix === value) {\n return interfaceFunction.innerRoundness\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh\n interfaceFunction.propertyIndex = shape.ix\n prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup))\n prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup))\n prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup))\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup))\n if (shape.ir) {\n prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup))\n prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup))\n }\n\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p),\n },\n rotation: {\n get: ExpressionPropertyInterface(prop.r),\n },\n points: {\n get: ExpressionPropertyInterface(prop.pt),\n },\n outerRadius: {\n get: ExpressionPropertyInterface(prop.or),\n },\n outerRoundness: {\n get: ExpressionPropertyInterface(prop.os),\n },\n innerRadius: {\n get: ExpressionPropertyInterface(prop.ir),\n },\n innerRoundness: {\n get: ExpressionPropertyInterface(prop.is),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function rectInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position\n }\n if (shape.r.ix === value) {\n return interfaceFunction.roundness\n }\n if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {\n return interfaceFunction.size\n }\n return null\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh\n interfaceFunction.propertyIndex = shape.ix\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup))\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup))\n\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p),\n },\n roundness: {\n get: ExpressionPropertyInterface(prop.r),\n },\n size: {\n get: ExpressionPropertyInterface(prop.s),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function roundedInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.r.ix === value || value === 'Round Corners 1') {\n return interfaceFunction.radius\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var prop = view\n interfaceFunction.propertyIndex = shape.ix\n prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup))\n\n Object.defineProperties(interfaceFunction, {\n radius: {\n get: ExpressionPropertyInterface(prop.rd),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function repeaterInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.c.ix === value || value === 'Copies') {\n return interfaceFunction.copies\n }\n if (shape.o.ix === value || value === 'Offset') {\n return interfaceFunction.offset\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var prop = view\n interfaceFunction.propertyIndex = shape.ix\n prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup))\n prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup))\n Object.defineProperties(interfaceFunction, {\n copies: {\n get: ExpressionPropertyInterface(prop.c),\n },\n offset: {\n get: ExpressionPropertyInterface(prop.o),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n return function (shapes, view, propertyGroup) {\n var interfaces\n function _interfaceFunction(value) {\n if (typeof value === 'number') {\n value = value === undefined ? 1 : value\n if (value === 0) {\n return propertyGroup\n }\n return interfaces[value - 1]\n }\n var i = 0\n var len = interfaces.length\n while (i < len) {\n if (interfaces[i]._name === value) {\n return interfaces[i]\n }\n i += 1\n }\n return null\n }\n function parentGroupWrapper() {\n return propertyGroup\n }\n _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper)\n interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup)\n _interfaceFunction.numProperties = interfaces.length\n _interfaceFunction._name = 'Contents'\n return _interfaceFunction\n }\n })()\n\n const TextExpressionInterface = (function () {\n return function (elem) {\n var _prevValue\n var _sourceText\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Text Document':\n return _thisLayerFunction.sourceText\n default:\n return null\n }\n }\n Object.defineProperty(_thisLayerFunction, 'sourceText', {\n get: function () {\n elem.textProperty.getValue()\n var stringValue = elem.textProperty.currentData.t\n if (stringValue !== _prevValue) {\n elem.textProperty.currentData.t = _prevValue\n _sourceText = new String(stringValue) // eslint-disable-line no-new-wrappers\n // If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive\n _sourceText.value = stringValue || new String(stringValue) // eslint-disable-line no-new-wrappers\n }\n return _sourceText\n },\n })\n return _thisLayerFunction\n }\n })()\n\n const getBlendMode = (function () {\n var blendModeEnums = {\n 0: 'source-over',\n 1: 'multiply',\n 2: 'screen',\n 3: 'overlay',\n 4: 'darken',\n 5: 'lighten',\n 6: 'color-dodge',\n 7: 'color-burn',\n 8: 'hard-light',\n 9: 'soft-light',\n 10: 'difference',\n 11: 'exclusion',\n 12: 'hue',\n 13: 'saturation',\n 14: 'color',\n 15: 'luminosity',\n }\n\n return function (mode) {\n return blendModeEnums[mode] || ''\n }\n })()\n\n function SliderEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function AngleEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function ColorEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container)\n }\n function PointEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container)\n }\n function LayerIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function MaskIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function CheckboxEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function NoValueEffect() {\n this.p = {}\n }\n\n function EffectsManager(data, element) {\n var effects = data.ef || []\n this.effectElements = []\n var i\n var len = effects.length\n var effectItem\n for (i = 0; i < len; i += 1) {\n effectItem = new GroupEffect(effects[i], element)\n this.effectElements.push(effectItem)\n }\n }\n\n function GroupEffect(data, element) {\n this.init(data, element)\n }\n\n extendPrototype([DynamicPropertyContainer], GroupEffect)\n\n GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties\n\n GroupEffect.prototype.init = function (data, element) {\n this.data = data\n this.effectElements = []\n this.initDynamicPropertyContainer(element)\n var i\n var len = this.data.ef.length\n var eff\n var effects = this.data.ef\n for (i = 0; i < len; i += 1) {\n eff = null\n switch (effects[i].ty) {\n case 0:\n eff = new SliderEffect(effects[i], element, this)\n break\n case 1:\n eff = new AngleEffect(effects[i], element, this)\n break\n case 2:\n eff = new ColorEffect(effects[i], element, this)\n break\n case 3:\n eff = new PointEffect(effects[i], element, this)\n break\n case 4:\n case 7:\n eff = new CheckboxEffect(effects[i], element, this)\n break\n case 10:\n eff = new LayerIndexEffect(effects[i], element, this)\n break\n case 11:\n eff = new MaskIndexEffect(effects[i], element, this)\n break\n case 5:\n eff = new EffectsManager(effects[i], element, this)\n break\n // case 6:\n default:\n eff = new NoValueEffect(effects[i], element, this)\n break\n }\n if (eff) {\n this.effectElements.push(eff)\n }\n }\n }\n\n function BaseElement() {}\n\n BaseElement.prototype = {\n checkMasks: function () {\n if (!this.data.hasMask) {\n return false\n }\n var i = 0\n var len = this.data.masksProperties.length\n while (i < len) {\n if (this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false) {\n return true\n }\n i += 1\n }\n return false\n },\n initExpressions: function () {\n this.layerInterface = LayerExpressionInterface(this)\n if (this.data.hasMask && this.maskManager) {\n this.layerInterface.registerMaskInterface(this.maskManager)\n }\n var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface)\n this.layerInterface.registerEffectsInterface(effectsInterface)\n\n if (this.data.ty === 0 || this.data.xt) {\n this.compInterface = CompExpressionInterface(this)\n } else if (this.data.ty === 4) {\n this.layerInterface.shapeInterface = ShapeExpressionInterface(\n this.shapesData,\n this.itemsData,\n this.layerInterface,\n )\n this.layerInterface.content = this.layerInterface.shapeInterface\n } else if (this.data.ty === 5) {\n this.layerInterface.textInterface = TextExpressionInterface(this)\n this.layerInterface.text = this.layerInterface.textInterface\n }\n },\n setBlendMode: function () {\n var blendModeValue = getBlendMode(this.data.bm)\n var elem = this.baseElement || this.layerElement\n\n elem.style['mix-blend-mode'] = blendModeValue\n },\n initBaseData: function (data, globalData, comp) {\n this.globalData = globalData\n this.comp = comp\n this.data = data\n this.layerId = createElementID()\n\n // Stretch factor for old animations missing this property.\n if (!this.data.sr) {\n this.data.sr = 1\n }\n // effects manager\n this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties)\n },\n getType: function () {\n return this.type\n },\n sourceRectAtTime: function () {},\n }\n\n /**\n * @file\n * Handles element's layer frame update.\n * Checks layer in point and out point\n *\n */\n\n function FrameElement() {}\n\n FrameElement.prototype = {\n /**\n * @function\n * Initializes frame related properties.\n *\n */\n initFrame: function () {\n // set to true when inpoint is rendered\n this._isFirstFrame = false\n // list of animated properties\n this.dynamicProperties = []\n // If layer has been modified in current tick this will be true\n this._mdf = false\n },\n /**\n * @function\n * Calculates all dynamic values\n *\n * @param {number} num\n * current frame number in Layer's time\n * @param {boolean} isVisible\n * if layers is currently in range\n *\n */\n prepareProperties: function (num, isVisible) {\n var i\n var len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {\n this.dynamicProperties[i].getValue()\n if (this.dynamicProperties[i]._mdf) {\n this.globalData._mdf = true\n this._mdf = true\n }\n }\n }\n },\n addDynamicProperty: function (prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop)\n }\n },\n }\n\n const FootageInterface = (function () {\n var outlineInterfaceFactory = function (elem) {\n var currentPropertyName = ''\n var currentProperty = elem.getFootageData()\n function init() {\n currentPropertyName = ''\n currentProperty = elem.getFootageData()\n return searchProperty\n }\n function searchProperty(value) {\n if (currentProperty[value]) {\n currentPropertyName = value\n currentProperty = currentProperty[value]\n if (typeof currentProperty === 'object') {\n return searchProperty\n }\n return currentProperty\n }\n var propertyNameIndex = value.indexOf(currentPropertyName)\n if (propertyNameIndex !== -1) {\n var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10)\n currentProperty = currentProperty[index]\n if (typeof currentProperty === 'object') {\n return searchProperty\n }\n return currentProperty\n }\n return ''\n }\n return init\n }\n\n var dataInterfaceFactory = function (elem) {\n function interfaceFunction(value) {\n if (value === 'Outline') {\n return interfaceFunction.outlineInterface()\n }\n return null\n }\n\n interfaceFunction._name = 'Outline'\n interfaceFunction.outlineInterface = outlineInterfaceFactory(elem)\n return interfaceFunction\n }\n\n return function (elem) {\n function _interfaceFunction(value) {\n if (value === 'Data') {\n return _interfaceFunction.dataInterface\n }\n return null\n }\n\n _interfaceFunction._name = 'Data'\n _interfaceFunction.dataInterface = dataInterfaceFactory(elem)\n return _interfaceFunction\n }\n })()\n\n function FootageElement(data, globalData, comp) {\n this.initFrame()\n this.initRenderable()\n this.assetData = globalData.getAssetData(data.refId)\n this.footageData = globalData.imageLoader.getAsset(this.assetData)\n this.initBaseData(data, globalData, comp)\n }\n\n FootageElement.prototype.prepareFrame = function () {}\n\n extendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement)\n\n FootageElement.prototype.getBaseElement = function () {\n return null\n }\n\n FootageElement.prototype.renderFrame = function () {}\n\n FootageElement.prototype.destroy = function () {}\n\n FootageElement.prototype.initExpressions = function () {\n this.layerInterface = FootageInterface(this)\n }\n\n FootageElement.prototype.getFootageData = function () {\n return this.footageData\n }\n\n function AudioElement(data, globalData, comp) {\n this.initFrame()\n this.initRenderable()\n this.assetData = globalData.getAssetData(data.refId)\n this.initBaseData(data, globalData, comp)\n this._isPlaying = false\n this._canPlay = false\n var assetPath = this.globalData.getAssetsPath(this.assetData)\n this.audio = this.globalData.audioController.createAudio(assetPath)\n this._currentTime = 0\n this.globalData.audioController.addAudio(this)\n this._volumeMultiplier = 1\n this._volume = 1\n this._previousVolume = null\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }\n this.lv = PropertyFactory.getProp(this, data.au && data.au.lv ? data.au.lv : { k: [100] }, 1, 0.01, this)\n }\n\n AudioElement.prototype.prepareFrame = function (num) {\n this.prepareRenderableFrame(num, true)\n this.prepareProperties(num, true)\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v\n this._currentTime = timeRemapped\n } else {\n this._currentTime = num / this.data.sr\n }\n this._volume = this.lv.v[0]\n var totalVolume = this._volume * this._volumeMultiplier\n if (this._previousVolume !== totalVolume) {\n this._previousVolume = totalVolume\n this.audio.volume(totalVolume)\n }\n }\n\n extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement)\n\n AudioElement.prototype.renderFrame = function () {\n if (this.isInRange && this._canPlay) {\n if (!this._isPlaying) {\n this.audio.play()\n this.audio.seek(this._currentTime / this.globalData.frameRate)\n this._isPlaying = true\n } else if (\n !this.audio.playing() ||\n Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1\n ) {\n this.audio.seek(this._currentTime / this.globalData.frameRate)\n }\n }\n }\n\n AudioElement.prototype.show = function () {\n // this.audio.play()\n }\n\n AudioElement.prototype.hide = function () {\n this.audio.pause()\n this._isPlaying = false\n }\n\n AudioElement.prototype.pause = function () {\n this.audio.pause()\n this._isPlaying = false\n this._canPlay = false\n }\n\n AudioElement.prototype.resume = function () {\n this._canPlay = true\n }\n\n AudioElement.prototype.setRate = function (rateValue) {\n this.audio.rate(rateValue)\n }\n\n AudioElement.prototype.volume = function (volumeValue) {\n this._volumeMultiplier = volumeValue\n this._previousVolume = volumeValue * this._volume\n this.audio.volume(this._previousVolume)\n }\n\n AudioElement.prototype.getBaseElement = function () {\n return null\n }\n\n AudioElement.prototype.destroy = function () {}\n\n AudioElement.prototype.sourceRectAtTime = function () {}\n\n AudioElement.prototype.initExpressions = function () {}\n\n function BaseRenderer() {}\n BaseRenderer.prototype.checkLayers = function (num) {\n var i\n var len = this.layers.length\n var data\n this.completeLayers = true\n for (i = len - 1; i >= 0; i -= 1) {\n if (!this.elements[i]) {\n data = this.layers[i]\n if (data.ip - data.st <= num - this.layers[i].st && data.op - data.st > num - this.layers[i].st) {\n this.buildItem(i)\n }\n }\n this.completeLayers = this.elements[i] ? this.completeLayers : false\n }\n this.checkPendingElements()\n }\n\n BaseRenderer.prototype.createItem = function (layer) {\n switch (layer.ty) {\n case 2:\n return this.createImage(layer)\n case 0:\n return this.createComp(layer)\n case 1:\n return this.createSolid(layer)\n case 3:\n return this.createNull(layer)\n case 4:\n return this.createShape(layer)\n case 5:\n return this.createText(layer)\n case 6:\n return this.createAudio(layer)\n case 13:\n return this.createCamera(layer)\n case 15:\n return this.createFootage(layer)\n default:\n return this.createNull(layer)\n }\n }\n\n BaseRenderer.prototype.createCamera = function () {\n throw new Error(\"You're using a 3d camera. Try the html renderer.\")\n }\n\n BaseRenderer.prototype.createAudio = function (data) {\n return new AudioElement(data, this.globalData, this)\n }\n\n BaseRenderer.prototype.createFootage = function (data) {\n return new FootageElement(data, this.globalData, this)\n }\n\n BaseRenderer.prototype.buildAllItems = function () {\n var i\n var len = this.layers.length\n for (i = 0; i < len; i += 1) {\n this.buildItem(i)\n }\n this.checkPendingElements()\n }\n\n BaseRenderer.prototype.includeLayers = function (newLayers) {\n this.completeLayers = false\n var i\n var len = newLayers.length\n var j\n var jLen = this.layers.length\n for (i = 0; i < len; i += 1) {\n j = 0\n while (j < jLen) {\n if (this.layers[j].id === newLayers[i].id) {\n this.layers[j] = newLayers[i]\n break\n }\n j += 1\n }\n }\n }\n\n BaseRenderer.prototype.setProjectInterface = function (pInterface) {\n this.globalData.projectInterface = pInterface\n }\n\n BaseRenderer.prototype.initItems = function () {\n if (!this.globalData.progressiveLoad) {\n this.buildAllItems()\n }\n }\n BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {\n var elements = this.elements\n var layers = this.layers\n var i = 0\n var len = layers.length\n while (i < len) {\n if (layers[i].ind == parentName) {\n // eslint-disable-line eqeqeq\n if (!elements[i] || elements[i] === true) {\n this.buildItem(i)\n this.addPendingElement(element)\n } else {\n hierarchy.push(elements[i])\n elements[i].setAsParent()\n if (layers[i].parent !== undefined) {\n this.buildElementParenting(element, layers[i].parent, hierarchy)\n } else {\n element.setHierarchy(hierarchy)\n }\n }\n }\n i += 1\n }\n }\n\n BaseRenderer.prototype.addPendingElement = function (element) {\n this.pendingElements.push(element)\n }\n\n BaseRenderer.prototype.searchExtraCompositions = function (assets) {\n var i\n var len = assets.length\n for (i = 0; i < len; i += 1) {\n if (assets[i].xt) {\n var comp = this.createComp(assets[i])\n comp.initExpressions()\n this.globalData.projectInterface.registerComposition(comp)\n }\n }\n }\n\n BaseRenderer.prototype.getElementByPath = function (path) {\n var pathValue = path.shift()\n var element\n if (typeof pathValue === 'number') {\n element = this.elements[pathValue]\n } else {\n var i\n var len = this.elements.length\n for (i = 0; i < len; i += 1) {\n if (this.elements[i].data.nm === pathValue) {\n element = this.elements[i]\n break\n }\n }\n }\n if (path.length === 0) {\n return element\n }\n return element.getElementByPath(path)\n }\n\n BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {\n this.globalData.fontManager = new FontManager()\n this.globalData.fontManager.addChars(animData.chars)\n this.globalData.fontManager.addFonts(animData.fonts, fontsContainer)\n this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem)\n this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem)\n this.globalData.imageLoader = this.animationItem.imagePreloader\n this.globalData.audioController = this.animationItem.audioController\n this.globalData.frameId = 0\n this.globalData.frameRate = animData.fr\n this.globalData.nm = animData.nm\n this.globalData.compSize = {\n w: animData.w,\n h: animData.h,\n }\n }\n\n function TransformElement() {}\n\n TransformElement.prototype = {\n initTransform: function () {\n this.finalTransform = {\n mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { o: 0 },\n _matMdf: false,\n _opMdf: false,\n mat: new Matrix(),\n }\n if (this.data.ao) {\n this.finalTransform.mProp.autoOriented = true\n }\n\n // TODO: check TYPE 11: Guided elements\n if (this.data.ty !== 11) {\n // this.createElements();\n }\n },\n renderTransform: function () {\n this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame\n this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame\n\n if (this.hierarchy) {\n var mat\n var finalMat = this.finalTransform.mat\n var i = 0\n var len = this.hierarchy.length\n // Checking if any of the transformation matrices in the hierarchy chain has changed.\n if (!this.finalTransform._matMdf) {\n while (i < len) {\n if (this.hierarchy[i].finalTransform.mProp._mdf) {\n this.finalTransform._matMdf = true\n break\n }\n i += 1\n }\n }\n\n if (this.finalTransform._matMdf) {\n mat = this.finalTransform.mProp.v.props\n finalMat.cloneFromProps(mat)\n for (i = 0; i < len; i += 1) {\n mat = this.hierarchy[i].finalTransform.mProp.v.props\n finalMat.transform(\n mat[0],\n mat[1],\n mat[2],\n mat[3],\n mat[4],\n mat[5],\n mat[6],\n mat[7],\n mat[8],\n mat[9],\n mat[10],\n mat[11],\n mat[12],\n mat[13],\n mat[14],\n mat[15],\n )\n }\n }\n }\n },\n globalToLocal: function (pt) {\n var transforms = []\n transforms.push(this.finalTransform)\n var flag = true\n var comp = this.comp\n while (flag) {\n if (comp.finalTransform) {\n if (comp.data.hasMask) {\n transforms.splice(0, 0, comp.finalTransform)\n }\n comp = comp.comp\n } else {\n flag = false\n }\n }\n var i\n var len = transforms.length\n var ptNew\n for (i = 0; i < len; i += 1) {\n ptNew = transforms[i].mat.applyToPointArray(0, 0, 0)\n // ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);\n pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0]\n }\n return pt\n },\n mHelper: new Matrix(),\n }\n\n function MaskElement(data, element, globalData) {\n this.data = data\n this.element = element\n this.globalData = globalData\n this.storedData = []\n this.masksProperties = this.data.masksProperties || []\n this.maskElement = null\n var defs = this.globalData.defs\n var i\n var len = this.masksProperties ? this.masksProperties.length : 0\n this.viewData = createSizedArray(len)\n this.solidPath = ''\n\n var path\n var properties = this.masksProperties\n var count = 0\n var currentMasks = []\n var j\n var jLen\n var layerId = createElementID()\n var rect\n var expansor\n var feMorph\n var x\n var maskType = 'clipPath'\n var maskRef = 'clip-path'\n for (i = 0; i < len; i += 1) {\n if (\n (properties[i].mode !== 'a' && properties[i].mode !== 'n') ||\n properties[i].inv ||\n properties[i].o.k !== 100 ||\n properties[i].o.x\n ) {\n maskType = 'mask'\n maskRef = 'mask'\n }\n\n if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) {\n rect = createNS('rect')\n rect.setAttribute('fill', '#ffffff')\n rect.setAttribute('width', this.element.comp.data.w || 0)\n rect.setAttribute('height', this.element.comp.data.h || 0)\n currentMasks.push(rect)\n } else {\n rect = null\n }\n\n path = createNS('path')\n if (properties[i].mode === 'n') {\n // TODO move this to a factory or to a constructor\n this.viewData[i] = {\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n elem: path,\n lastPath: '',\n }\n defs.appendChild(path)\n } else {\n count += 1\n\n path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff')\n path.setAttribute('clip-rule', 'nonzero')\n var filterID\n\n if (properties[i].x.k !== 0) {\n maskType = 'mask'\n maskRef = 'mask'\n x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element)\n filterID = createElementID()\n expansor = createNS('filter')\n expansor.setAttribute('id', filterID)\n feMorph = createNS('feMorphology')\n feMorph.setAttribute('operator', 'erode')\n feMorph.setAttribute('in', 'SourceGraphic')\n feMorph.setAttribute('radius', '0')\n expansor.appendChild(feMorph)\n defs.appendChild(expansor)\n path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff')\n } else {\n feMorph = null\n x = null\n }\n\n // TODO move this to a factory or to a constructor\n this.storedData[i] = {\n elem: path,\n x: x,\n expan: feMorph,\n lastPath: '',\n lastOperator: '',\n filterId: filterID,\n lastRadius: 0,\n }\n if (properties[i].mode === 'i') {\n jLen = currentMasks.length\n var g = createNS('g')\n for (j = 0; j < jLen; j += 1) {\n g.appendChild(currentMasks[j])\n }\n var mask = createNS('mask')\n mask.setAttribute('mask-type', 'alpha')\n mask.setAttribute('id', layerId + '_' + count)\n mask.appendChild(path)\n defs.appendChild(mask)\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + layerId + '_' + count + ')')\n\n currentMasks.length = 0\n currentMasks.push(g)\n } else {\n currentMasks.push(path)\n }\n if (properties[i].inv && !this.solidPath) {\n this.solidPath = this.createLayerSolidPath()\n }\n // TODO move this to a factory or to a constructor\n this.viewData[i] = {\n elem: path,\n lastPath: '',\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n invRect: rect,\n }\n if (!this.viewData[i].prop.k) {\n this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i])\n }\n }\n }\n\n this.maskElement = createNS(maskType)\n\n len = currentMasks.length\n for (i = 0; i < len; i += 1) {\n this.maskElement.appendChild(currentMasks[i])\n }\n\n if (count > 0) {\n this.maskElement.setAttribute('id', layerId)\n this.element.maskedElement.setAttribute(maskRef, 'url(' + getLocationHref() + '#' + layerId + ')')\n defs.appendChild(this.maskElement)\n }\n if (this.viewData.length) {\n this.element.addRenderableComponent(this)\n }\n }\n\n MaskElement.prototype.getMaskProperty = function (pos) {\n return this.viewData[pos].prop\n }\n\n MaskElement.prototype.renderFrame = function (isFirstFrame) {\n var finalMat = this.element.finalTransform.mat\n var i\n var len = this.masksProperties.length\n for (i = 0; i < len; i += 1) {\n if (this.viewData[i].prop._mdf || isFirstFrame) {\n this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i])\n }\n if (this.viewData[i].op._mdf || isFirstFrame) {\n this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v)\n }\n if (this.masksProperties[i].mode !== 'n') {\n if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {\n this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS())\n }\n if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {\n var feMorph = this.storedData[i].expan\n if (this.storedData[i].x.v < 0) {\n if (this.storedData[i].lastOperator !== 'erode') {\n this.storedData[i].lastOperator = 'erode'\n this.storedData[i].elem.setAttribute(\n 'filter',\n 'url(' + getLocationHref() + '#' + this.storedData[i].filterId + ')',\n )\n }\n feMorph.setAttribute('radius', -this.storedData[i].x.v)\n } else {\n if (this.storedData[i].lastOperator !== 'dilate') {\n this.storedData[i].lastOperator = 'dilate'\n this.storedData[i].elem.setAttribute('filter', null)\n }\n this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2)\n }\n }\n }\n }\n }\n\n MaskElement.prototype.getMaskelement = function () {\n return this.maskElement\n }\n\n MaskElement.prototype.createLayerSolidPath = function () {\n var path = 'M0,0 '\n path += ' h' + this.globalData.compSize.w\n path += ' v' + this.globalData.compSize.h\n path += ' h-' + this.globalData.compSize.w\n path += ' v-' + this.globalData.compSize.h + ' '\n return path\n }\n\n MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {\n var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1]\n var i\n var len\n len = pathNodes._length\n for (i = 1; i < len; i += 1) {\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[i][0]+','+pathNodes.i[i][1] + \" \"+pathNodes.v[i][0]+','+pathNodes.v[i][1];\n pathString +=\n ' C' +\n pathNodes.o[i - 1][0] +\n ',' +\n pathNodes.o[i - 1][1] +\n ' ' +\n pathNodes.i[i][0] +\n ',' +\n pathNodes.i[i][1] +\n ' ' +\n pathNodes.v[i][0] +\n ',' +\n pathNodes.v[i][1]\n }\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[0][0]+','+pathNodes.i[0][1] + \" \"+pathNodes.v[0][0]+','+pathNodes.v[0][1];\n if (pathNodes.c && len > 1) {\n pathString +=\n ' C' +\n pathNodes.o[i - 1][0] +\n ',' +\n pathNodes.o[i - 1][1] +\n ' ' +\n pathNodes.i[0][0] +\n ',' +\n pathNodes.i[0][1] +\n ' ' +\n pathNodes.v[0][0] +\n ',' +\n pathNodes.v[0][1]\n }\n // pathNodes.__renderedString = pathString;\n\n if (viewData.lastPath !== pathString) {\n var pathShapeValue = ''\n if (viewData.elem) {\n if (pathNodes.c) {\n pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString\n }\n viewData.elem.setAttribute('d', pathShapeValue)\n }\n viewData.lastPath = pathString\n }\n }\n\n MaskElement.prototype.destroy = function () {\n this.element = null\n this.globalData = null\n this.maskElement = null\n this.data = null\n this.masksProperties = null\n }\n\n const filtersFactory = (function () {\n var ob = {}\n ob.createFilter = createFilter\n ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter\n\n function createFilter(filId, skipCoordinates) {\n var fil = createNS('filter')\n fil.setAttribute('id', filId)\n if (skipCoordinates !== true) {\n fil.setAttribute('filterUnits', 'objectBoundingBox')\n fil.setAttribute('x', '0%')\n fil.setAttribute('y', '0%')\n fil.setAttribute('width', '100%')\n fil.setAttribute('height', '100%')\n }\n return fil\n }\n\n function createAlphaToLuminanceFilter() {\n var feColorMatrix = createNS('feColorMatrix')\n feColorMatrix.setAttribute('type', 'matrix')\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB')\n feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1')\n return feColorMatrix\n }\n\n return ob\n })()\n\n const featureSupport = (function () {\n var ob = {\n maskType: true,\n }\n if (\n /MSIE 10/i.test(navigator.userAgent) ||\n /MSIE 9/i.test(navigator.userAgent) ||\n /rv:11.0/i.test(navigator.userAgent) ||\n /Edge\\/\\d./i.test(navigator.userAgent)\n ) {\n ob.maskType = false\n }\n return ob\n })()\n\n var registeredEffects = {}\n var idPrefix = 'filter_result_'\n\n function SVGEffects(elem) {\n var i\n var source = 'SourceGraphic'\n var len = elem.data.ef ? elem.data.ef.length : 0\n var filId = createElementID()\n var fil = filtersFactory.createFilter(filId, true)\n var count = 0\n this.filters = []\n var filterManager\n for (i = 0; i < len; i += 1) {\n filterManager = null\n var type = elem.data.ef[i].ty\n if (registeredEffects[type]) {\n var Effect = registeredEffects[type].effect\n filterManager = new Effect(fil, elem.effectsManager.effectElements[i], elem, idPrefix + count, source)\n source = idPrefix + count\n if (registeredEffects[type].countsAsEffect) {\n count += 1\n }\n }\n if (filterManager) {\n this.filters.push(filterManager)\n }\n }\n if (count) {\n elem.globalData.defs.appendChild(fil)\n elem.layerElement.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')')\n }\n if (this.filters.length) {\n elem.addRenderableComponent(this)\n }\n }\n\n SVGEffects.prototype.renderFrame = function (_isFirstFrame) {\n var i\n var len = this.filters.length\n for (i = 0; i < len; i += 1) {\n this.filters[i].renderFrame(_isFirstFrame)\n }\n }\n\n function registerEffect(id, effect, countsAsEffect) {\n registeredEffects[id] = {\n effect,\n countsAsEffect,\n }\n }\n\n function SVGBaseElement() {}\n\n SVGBaseElement.prototype = {\n initRendererElement: function () {\n this.layerElement = createNS('g')\n },\n createContainerElements: function () {\n this.matteElement = createNS('g')\n this.transformedElement = this.layerElement\n this.maskedElement = this.layerElement\n this._sizeChanged = false\n var layerElementParent = null\n // If this layer acts as a mask for the following layer\n var filId\n var fil\n var gg\n if (this.data.td) {\n if (this.data.td == 3 || this.data.td == 1) {\n // eslint-disable-line eqeqeq\n var masker = createNS('mask')\n masker.setAttribute('id', this.layerId)\n masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha') // eslint-disable-line eqeqeq\n masker.appendChild(this.layerElement)\n layerElementParent = masker\n this.globalData.defs.appendChild(masker)\n // This is only for IE and Edge when mask if of type alpha\n if (!featureSupport.maskType && this.data.td == 1) {\n // eslint-disable-line eqeqeq\n masker.setAttribute('mask-type', 'luminance')\n filId = createElementID()\n fil = filtersFactory.createFilter(filId)\n this.globalData.defs.appendChild(fil)\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter())\n gg = createNS('g')\n gg.appendChild(this.layerElement)\n layerElementParent = gg\n masker.appendChild(gg)\n gg.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')')\n }\n } else if (this.data.td == 2) {\n // eslint-disable-line eqeqeq\n var maskGroup = createNS('mask')\n maskGroup.setAttribute('id', this.layerId)\n maskGroup.setAttribute('mask-type', 'alpha')\n var maskGrouper = createNS('g')\n maskGroup.appendChild(maskGrouper)\n filId = createElementID()\n fil = filtersFactory.createFilter(filId)\n /// /\n\n // This solution doesn't work on Android when meta tag with viewport attribute is set\n /* var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');\n fil.appendChild(feColorMatrix); */\n /// /\n var feCTr = createNS('feComponentTransfer')\n feCTr.setAttribute('in', 'SourceGraphic')\n fil.appendChild(feCTr)\n var feFunc = createNS('feFuncA')\n feFunc.setAttribute('type', 'table')\n feFunc.setAttribute('tableValues', '1.0 0.0')\n feCTr.appendChild(feFunc)\n /// /\n this.globalData.defs.appendChild(fil)\n var alphaRect = createNS('rect')\n alphaRect.setAttribute('width', this.comp.data.w)\n alphaRect.setAttribute('height', this.comp.data.h)\n alphaRect.setAttribute('x', '0')\n alphaRect.setAttribute('y', '0')\n alphaRect.setAttribute('fill', '#ffffff')\n alphaRect.setAttribute('opacity', '0')\n maskGrouper.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')')\n maskGrouper.appendChild(alphaRect)\n maskGrouper.appendChild(this.layerElement)\n layerElementParent = maskGrouper\n if (!featureSupport.maskType) {\n maskGroup.setAttribute('mask-type', 'luminance')\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter())\n gg = createNS('g')\n maskGrouper.appendChild(alphaRect)\n gg.appendChild(this.layerElement)\n layerElementParent = gg\n maskGrouper.appendChild(gg)\n }\n this.globalData.defs.appendChild(maskGroup)\n }\n } else if (this.data.tt) {\n this.matteElement.appendChild(this.layerElement)\n layerElementParent = this.matteElement\n this.baseElement = this.matteElement\n } else {\n this.baseElement = this.layerElement\n }\n if (this.data.ln) {\n this.layerElement.setAttribute('id', this.data.ln)\n }\n if (this.data.cl) {\n this.layerElement.setAttribute('class', this.data.cl)\n }\n // Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped\n if (this.data.ty === 0 && !this.data.hd) {\n var cp = createNS('clipPath')\n var pt = createNS('path')\n pt.setAttribute(\n 'd',\n 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z',\n )\n var clipId = createElementID()\n cp.setAttribute('id', clipId)\n cp.appendChild(pt)\n this.globalData.defs.appendChild(cp)\n\n if (this.checkMasks()) {\n var cpGroup = createNS('g')\n cpGroup.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')')\n cpGroup.appendChild(this.layerElement)\n this.transformedElement = cpGroup\n if (layerElementParent) {\n layerElementParent.appendChild(this.transformedElement)\n } else {\n this.baseElement = this.transformedElement\n }\n } else {\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')')\n }\n }\n if (this.data.bm !== 0) {\n this.setBlendMode()\n }\n },\n renderElement: function () {\n if (this.finalTransform._matMdf) {\n this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS())\n }\n if (this.finalTransform._opMdf) {\n this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v)\n }\n },\n destroyBaseElement: function () {\n this.layerElement = null\n this.matteElement = null\n this.maskManager.destroy()\n },\n getBaseElement: function () {\n if (this.data.hd) {\n return null\n }\n return this.baseElement\n },\n createRenderableComponents: function () {\n this.maskManager = new MaskElement(this.data, this, this.globalData)\n this.renderableEffectsManager = new SVGEffects(this)\n },\n setMatte: function (id) {\n if (!this.matteElement) {\n return\n }\n this.matteElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')')\n },\n }\n\n /**\n * @file\n * Handles AE's layer parenting property.\n *\n */\n\n function HierarchyElement() {}\n\n HierarchyElement.prototype = {\n /**\n * @function\n * Initializes hierarchy properties\n *\n */\n initHierarchy: function () {\n // element's parent list\n this.hierarchy = []\n // if element is parent of another layer _isParent will be true\n this._isParent = false\n this.checkParenting()\n },\n /**\n * @function\n * Sets layer's hierarchy.\n * @param {array} hierarch\n * layer's parent list\n *\n */\n setHierarchy: function (hierarchy) {\n this.hierarchy = hierarchy\n },\n /**\n * @function\n * Sets layer as parent.\n *\n */\n setAsParent: function () {\n this._isParent = true\n },\n /**\n * @function\n * Searches layer's parenting chain\n *\n */\n checkParenting: function () {\n if (this.data.parent !== undefined) {\n this.comp.buildElementParenting(this, this.data.parent, [])\n }\n },\n }\n\n function RenderableDOMElement() {}\n\n ;(function () {\n var _prototype = {\n initElement: function (data, globalData, comp) {\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.initTransform(data, globalData, comp)\n this.initHierarchy()\n this.initRenderable()\n this.initRendererElement()\n this.createContainerElements()\n this.createRenderableComponents()\n this.createContent()\n this.hide()\n },\n hide: function () {\n // console.log('HIDE', this);\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n var elem = this.baseElement || this.layerElement\n elem.style.display = 'none'\n this.hidden = true\n }\n },\n show: function () {\n // console.log('SHOW', this);\n if (this.isInRange && !this.isTransparent) {\n if (!this.data.hd) {\n var elem = this.baseElement || this.layerElement\n elem.style.display = 'block'\n }\n this.hidden = false\n this._isFirstFrame = true\n }\n },\n renderFrame: function () {\n // If it is exported as hidden (data.hd === true) no need to render\n // If it is not visible no need to render\n if (this.data.hd || this.hidden) {\n return\n }\n this.renderTransform()\n this.renderRenderable()\n this.renderElement()\n this.renderInnerContent()\n if (this._isFirstFrame) {\n this._isFirstFrame = false\n }\n },\n renderInnerContent: function () {},\n prepareFrame: function (num) {\n this._mdf = false\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n this.checkTransparency()\n },\n destroy: function () {\n this.innerElem = null\n this.destroyBaseElement()\n },\n }\n extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement)\n })()\n\n function IImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId)\n this.initElement(data, globalData, comp)\n this.sourceRect = {\n top: 0,\n left: 0,\n width: this.assetData.w,\n height: this.assetData.h,\n }\n }\n\n extendPrototype(\n [BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement],\n IImageElement,\n )\n\n IImageElement.prototype.createContent = function () {\n var assetPath = this.globalData.getAssetsPath(this.assetData)\n\n this.innerElem = createNS('image')\n this.innerElem.setAttribute('width', this.assetData.w + 'px')\n this.innerElem.setAttribute('height', this.assetData.h + 'px')\n this.innerElem.setAttribute(\n 'preserveAspectRatio',\n this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio,\n )\n this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath)\n\n this.layerElement.appendChild(this.innerElem)\n }\n\n IImageElement.prototype.sourceRectAtTime = function () {\n return this.sourceRect\n }\n\n function ProcessedElement(element, position) {\n this.elem = element\n this.pos = position\n }\n\n function IShapeElement() {}\n\n IShapeElement.prototype = {\n addShapeToModifiers: function (data) {\n var i\n var len = this.shapeModifiers.length\n for (i = 0; i < len; i += 1) {\n this.shapeModifiers[i].addShape(data)\n }\n },\n isShapeInAnimatedModifiers: function (data) {\n var i = 0\n var len = this.shapeModifiers.length\n while (i < len) {\n if (this.shapeModifiers[i].isAnimatedWithShape(data)) {\n return true\n }\n }\n return false\n },\n renderModifiers: function () {\n if (!this.shapeModifiers.length) {\n return\n }\n var i\n var len = this.shapes.length\n for (i = 0; i < len; i += 1) {\n this.shapes[i].sh.reset()\n }\n\n len = this.shapeModifiers.length\n var shouldBreakProcess\n for (i = len - 1; i >= 0; i -= 1) {\n shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame)\n // workaround to fix cases where a repeater resets the shape so the following processes get called twice\n // TODO: find a better solution for this\n if (shouldBreakProcess) {\n break\n }\n }\n },\n\n searchProcessedElement: function (elem) {\n var elements = this.processedElements\n var i = 0\n var len = elements.length\n while (i < len) {\n if (elements[i].elem === elem) {\n return elements[i].pos\n }\n i += 1\n }\n return 0\n },\n addProcessedElement: function (elem, pos) {\n var elements = this.processedElements\n var i = elements.length\n while (i) {\n i -= 1\n if (elements[i].elem === elem) {\n elements[i].pos = pos\n return\n }\n }\n elements.push(new ProcessedElement(elem, pos))\n },\n prepareFrame: function (num) {\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n },\n }\n\n const lineCapEnum = {\n 1: 'butt',\n 2: 'round',\n 3: 'square',\n }\n\n const lineJoinEnum = {\n 1: 'miter',\n 2: 'round',\n 3: 'bevel',\n }\n\n function SVGShapeData(transformers, level, shape) {\n this.caches = []\n this.styles = []\n this.transformers = transformers\n this.lStr = ''\n this.sh = shape\n this.lvl = level\n // TODO find if there are some cases where _isAnimated can be false.\n // For now, since shapes add up with other shapes. They have to be calculated every time.\n // One way of finding out is checking if all styles associated to this shape depend only of this shape\n this._isAnimated = !!shape.k\n // TODO: commenting this for now since all shapes are animated\n var i = 0\n var len = transformers.length\n while (i < len) {\n if (transformers[i].mProps.dynamicProperties.length) {\n this._isAnimated = true\n break\n }\n i += 1\n }\n }\n\n SVGShapeData.prototype.setAsAnimated = function () {\n this._isAnimated = true\n }\n\n function SVGStyleData(data, level) {\n this.data = data\n this.type = data.ty\n this.d = ''\n this.lvl = level\n this._mdf = false\n this.closed = data.hd === true\n this.pElem = createNS('path')\n this.msElem = null\n }\n\n SVGStyleData.prototype.reset = function () {\n this.d = ''\n this._mdf = false\n }\n\n function DashProperty(elem, data, renderer, container) {\n this.elem = elem\n this.frameId = -1\n this.dataProps = createSizedArray(data.length)\n this.renderer = renderer\n this.k = false\n this.dashStr = ''\n this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0)\n this.dashoffset = createTypedArray('float32', 1)\n this.initDynamicPropertyContainer(container)\n var i\n var len = data.length || 0\n var prop\n for (i = 0; i < len; i += 1) {\n prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this)\n this.k = prop.k || this.k\n this.dataProps[i] = { n: data[i].n, p: prop }\n }\n if (!this.k) {\n this.getValue(true)\n }\n this._isAnimated = this.k\n }\n\n DashProperty.prototype.getValue = function (forceRender) {\n if (this.elem.globalData.frameId === this.frameId && !forceRender) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n this._mdf = this._mdf || forceRender\n if (this._mdf) {\n var i = 0\n var len = this.dataProps.length\n if (this.renderer === 'svg') {\n this.dashStr = ''\n }\n for (i = 0; i < len; i += 1) {\n if (this.dataProps[i].n !== 'o') {\n if (this.renderer === 'svg') {\n this.dashStr += ' ' + this.dataProps[i].p.v\n } else {\n this.dashArray[i] = this.dataProps[i].p.v\n }\n } else {\n this.dashoffset[0] = this.dataProps[i].p.v\n }\n }\n }\n }\n extendPrototype([DynamicPropertyContainer], DashProperty)\n\n function SVGStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this)\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this)\n this.d = new DashProperty(elem, data.d || {}, 'svg', this)\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this)\n this.style = styleOb\n this._isAnimated = !!this._isAnimated\n }\n\n extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData)\n\n function SVGFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this)\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this)\n this.style = styleOb\n }\n\n extendPrototype([DynamicPropertyContainer], SVGFillStyleData)\n\n function SVGNoStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.style = styleOb\n }\n\n extendPrototype([DynamicPropertyContainer], SVGNoStyleData)\n\n function GradientProperty(elem, data, container) {\n this.data = data\n this.c = createTypedArray('uint8c', data.p * 4)\n var cLength = data.k.k[0].s ? data.k.k[0].s.length - data.p * 4 : data.k.k.length - data.p * 4\n this.o = createTypedArray('float32', cLength)\n this._cmdf = false\n this._omdf = false\n this._collapsable = this.checkCollapsable()\n this._hasOpacity = cLength\n this.initDynamicPropertyContainer(container)\n this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this)\n this.k = this.prop.k\n this.getValue(true)\n }\n\n GradientProperty.prototype.comparePoints = function (values, points) {\n var i = 0\n var len = this.o.length / 2\n var diff\n while (i < len) {\n diff = Math.abs(values[i * 4] - values[points * 4 + i * 2])\n if (diff > 0.01) {\n return false\n }\n i += 1\n }\n return true\n }\n\n GradientProperty.prototype.checkCollapsable = function () {\n if (this.o.length / 2 !== this.c.length / 4) {\n return false\n }\n if (this.data.k.k[0].s) {\n var i = 0\n var len = this.data.k.k.length\n while (i < len) {\n if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {\n return false\n }\n i += 1\n }\n } else if (!this.comparePoints(this.data.k.k, this.data.p)) {\n return false\n }\n return true\n }\n\n GradientProperty.prototype.getValue = function (forceRender) {\n this.prop.getValue()\n this._mdf = false\n this._cmdf = false\n this._omdf = false\n if (this.prop._mdf || forceRender) {\n var i\n var len = this.data.p * 4\n var mult\n var val\n for (i = 0; i < len; i += 1) {\n mult = i % 4 === 0 ? 100 : 255\n val = Math.round(this.prop.v[i] * mult)\n if (this.c[i] !== val) {\n this.c[i] = val\n this._cmdf = !forceRender\n }\n }\n if (this.o.length) {\n len = this.prop.v.length\n for (i = this.data.p * 4; i < len; i += 1) {\n mult = i % 2 === 0 ? 100 : 1\n val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i]\n if (this.o[i - this.data.p * 4] !== val) {\n this.o[i - this.data.p * 4] = val\n this._omdf = !forceRender\n }\n }\n }\n this._mdf = !forceRender\n }\n }\n\n extendPrototype([DynamicPropertyContainer], GradientProperty)\n\n function SVGGradientFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.initGradientData(elem, data, styleOb)\n }\n\n SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this)\n this.s = PropertyFactory.getProp(elem, data.s, 1, null, this)\n this.e = PropertyFactory.getProp(elem, data.e, 1, null, this)\n this.h = PropertyFactory.getProp(elem, data.h || { k: 0 }, 0, 0.01, this)\n this.a = PropertyFactory.getProp(elem, data.a || { k: 0 }, 0, degToRads, this)\n this.g = new GradientProperty(elem, data.g, this)\n this.style = styleOb\n this.stops = []\n this.setGradientData(styleOb.pElem, data)\n this.setGradientOpacity(data, styleOb)\n this._isAnimated = !!this._isAnimated\n }\n\n SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {\n var gradientId = createElementID()\n var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient')\n gfill.setAttribute('id', gradientId)\n gfill.setAttribute('spreadMethod', 'pad')\n gfill.setAttribute('gradientUnits', 'userSpaceOnUse')\n var stops = []\n var stop\n var j\n var jLen\n jLen = data.g.p * 4\n for (j = 0; j < jLen; j += 4) {\n stop = createNS('stop')\n gfill.appendChild(stop)\n stops.push(stop)\n }\n pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + gradientId + ')')\n this.gf = gfill\n this.cst = stops\n }\n\n SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {\n if (this.g._hasOpacity && !this.g._collapsable) {\n var stop\n var j\n var jLen\n var mask = createNS('mask')\n var maskElement = createNS('path')\n mask.appendChild(maskElement)\n var opacityId = createElementID()\n var maskId = createElementID()\n mask.setAttribute('id', maskId)\n var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient')\n opFill.setAttribute('id', opacityId)\n opFill.setAttribute('spreadMethod', 'pad')\n opFill.setAttribute('gradientUnits', 'userSpaceOnUse')\n jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length\n var stops = this.stops\n for (j = data.g.p * 4; j < jLen; j += 2) {\n stop = createNS('stop')\n stop.setAttribute('stop-color', 'rgb(255,255,255)')\n opFill.appendChild(stop)\n stops.push(stop)\n }\n maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + opacityId + ')')\n if (data.ty === 'gs') {\n maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2])\n maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2])\n if (data.lj === 1) {\n maskElement.setAttribute('stroke-miterlimit', data.ml)\n }\n }\n this.of = opFill\n this.ms = mask\n this.ost = stops\n this.maskId = maskId\n styleOb.msElem = maskElement\n }\n }\n\n extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData)\n\n function SVGGradientStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this)\n this.d = new DashProperty(elem, data.d || {}, 'svg', this)\n this.initGradientData(elem, data, styleOb)\n this._isAnimated = !!this._isAnimated\n }\n\n extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData)\n\n function ShapeGroupData() {\n this.it = []\n this.prevViewData = []\n this.gr = createNS('g')\n }\n\n function SVGTransformData(mProps, op, container) {\n this.transform = {\n mProps: mProps,\n op: op,\n container: container,\n }\n this.elements = []\n this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length\n }\n\n const buildShapeString = function (pathNodes, length, closed, mat) {\n if (length === 0) {\n return ''\n }\n var _o = pathNodes.o\n var _i = pathNodes.i\n var _v = pathNodes.v\n var i\n var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1])\n for (i = 1; i < length; i += 1) {\n shapeString +=\n ' C' +\n mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) +\n ' ' +\n mat.applyToPointStringified(_i[i][0], _i[i][1]) +\n ' ' +\n mat.applyToPointStringified(_v[i][0], _v[i][1])\n }\n if (closed && length) {\n shapeString +=\n ' C' +\n mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) +\n ' ' +\n mat.applyToPointStringified(_i[0][0], _i[0][1]) +\n ' ' +\n mat.applyToPointStringified(_v[0][0], _v[0][1])\n shapeString += 'z'\n }\n return shapeString\n }\n\n const SVGElementsRenderer = (function () {\n var _identityMatrix = new Matrix()\n var _matrixHelper = new Matrix()\n\n var ob = {\n createRenderFunction: createRenderFunction,\n }\n\n function createRenderFunction(data) {\n switch (data.ty) {\n case 'fl':\n return renderFill\n case 'gf':\n return renderGradient\n case 'gs':\n return renderGradientStroke\n case 'st':\n return renderStroke\n case 'sh':\n case 'el':\n case 'rc':\n case 'sr':\n return renderPath\n case 'tr':\n return renderContentTransform\n case 'no':\n return renderNoop\n default:\n return null\n }\n }\n\n function renderContentTransform(styleData, itemData, isFirstFrame) {\n if (isFirstFrame || itemData.transform.op._mdf) {\n itemData.transform.container.setAttribute('opacity', itemData.transform.op.v)\n }\n if (isFirstFrame || itemData.transform.mProps._mdf) {\n itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS())\n }\n }\n\n function renderNoop() {}\n\n function renderPath(styleData, itemData, isFirstFrame) {\n var j\n var jLen\n var pathStringTransformed\n var redraw\n var pathNodes\n var l\n var lLen = itemData.styles.length\n var lvl = itemData.lvl\n var paths\n var mat\n var props\n var iterations\n var k\n for (l = 0; l < lLen; l += 1) {\n redraw = itemData.sh._mdf || isFirstFrame\n if (itemData.styles[l].lvl < lvl) {\n mat = _matrixHelper.reset()\n iterations = lvl - itemData.styles[l].lvl\n k = itemData.transformers.length - 1\n while (!redraw && iterations > 0) {\n redraw = itemData.transformers[k].mProps._mdf || redraw\n iterations -= 1\n k -= 1\n }\n if (redraw) {\n iterations = lvl - itemData.styles[l].lvl\n k = itemData.transformers.length - 1\n while (iterations > 0) {\n props = itemData.transformers[k].mProps.v.props\n mat.transform(\n props[0],\n props[1],\n props[2],\n props[3],\n props[4],\n props[5],\n props[6],\n props[7],\n props[8],\n props[9],\n props[10],\n props[11],\n props[12],\n props[13],\n props[14],\n props[15],\n )\n iterations -= 1\n k -= 1\n }\n }\n } else {\n mat = _identityMatrix\n }\n paths = itemData.sh.paths\n jLen = paths._length\n if (redraw) {\n pathStringTransformed = ''\n for (j = 0; j < jLen; j += 1) {\n pathNodes = paths.shapes[j]\n if (pathNodes && pathNodes._length) {\n pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat)\n }\n }\n itemData.caches[l] = pathStringTransformed\n } else {\n pathStringTransformed = itemData.caches[l]\n }\n itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed\n itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf\n }\n }\n\n function renderFill(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style\n\n if (itemData.c._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute(\n 'fill',\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')',\n )\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('fill-opacity', itemData.o.v)\n }\n }\n\n function renderGradientStroke(styleData, itemData, isFirstFrame) {\n renderGradient(styleData, itemData, isFirstFrame)\n renderStroke(styleData, itemData, isFirstFrame)\n }\n\n function renderGradient(styleData, itemData, isFirstFrame) {\n var gfill = itemData.gf\n var hasOpacity = itemData.g._hasOpacity\n var pt1 = itemData.s.v\n var pt2 = itemData.e.v\n\n if (itemData.o._mdf || isFirstFrame) {\n var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity'\n itemData.style.pElem.setAttribute(attr, itemData.o.v)\n }\n if (itemData.s._mdf || isFirstFrame) {\n var attr1 = styleData.t === 1 ? 'x1' : 'cx'\n var attr2 = attr1 === 'x1' ? 'y1' : 'cy'\n gfill.setAttribute(attr1, pt1[0])\n gfill.setAttribute(attr2, pt1[1])\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute(attr1, pt1[0])\n itemData.of.setAttribute(attr2, pt1[1])\n }\n }\n var stops\n var i\n var len\n var stop\n if (itemData.g._cmdf || isFirstFrame) {\n stops = itemData.cst\n var cValues = itemData.g.c\n len = stops.length\n for (i = 0; i < len; i += 1) {\n stop = stops[i]\n stop.setAttribute('offset', cValues[i * 4] + '%')\n stop.setAttribute(\n 'stop-color',\n 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')',\n )\n }\n }\n if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {\n var oValues = itemData.g.o\n if (itemData.g._collapsable) {\n stops = itemData.cst\n } else {\n stops = itemData.ost\n }\n len = stops.length\n for (i = 0; i < len; i += 1) {\n stop = stops[i]\n if (!itemData.g._collapsable) {\n stop.setAttribute('offset', oValues[i * 2] + '%')\n }\n stop.setAttribute('stop-opacity', oValues[i * 2 + 1])\n }\n }\n if (styleData.t === 1) {\n if (itemData.e._mdf || isFirstFrame) {\n gfill.setAttribute('x2', pt2[0])\n gfill.setAttribute('y2', pt2[1])\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('x2', pt2[0])\n itemData.of.setAttribute('y2', pt2[1])\n }\n }\n } else {\n var rad\n if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2))\n gfill.setAttribute('r', rad)\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('r', rad)\n }\n }\n if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {\n if (!rad) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2))\n }\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0])\n\n var percent = itemData.h.v\n if (percent >= 1) {\n percent = 0.99\n } else if (percent <= -1) {\n percent = -0.99\n }\n var dist = rad * percent\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]\n gfill.setAttribute('fx', x)\n gfill.setAttribute('fy', y)\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('fx', x)\n itemData.of.setAttribute('fy', y)\n }\n }\n // gfill.setAttribute('fy','200');\n }\n }\n\n function renderStroke(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style\n var d = itemData.d\n if (d && (d._mdf || isFirstFrame) && d.dashStr) {\n styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr)\n styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0])\n }\n if (itemData.c && (itemData.c._mdf || isFirstFrame)) {\n styleElem.pElem.setAttribute(\n 'stroke',\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')',\n )\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v)\n }\n if (itemData.w._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-width', itemData.w.v)\n if (styleElem.msElem) {\n styleElem.msElem.setAttribute('stroke-width', itemData.w.v)\n }\n }\n }\n\n return ob\n })()\n\n function SVGShapeElement(data, globalData, comp) {\n // List of drawable elements\n this.shapes = []\n // Full shape data\n this.shapesData = data.shapes\n // List of styles that will be applied to shapes\n this.stylesList = []\n // List of modifiers that will be applied to shapes\n this.shapeModifiers = []\n // List of items in shape tree\n this.itemsData = []\n // List of items in previous shape tree\n this.processedElements = []\n // List of animated components\n this.animatedContents = []\n this.initElement(data, globalData, comp)\n // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n // List of elements that have been created\n this.prevViewData = []\n // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n }\n\n extendPrototype(\n [\n BaseElement,\n TransformElement,\n SVGBaseElement,\n IShapeElement,\n HierarchyElement,\n FrameElement,\n RenderableDOMElement,\n ],\n SVGShapeElement,\n )\n\n SVGShapeElement.prototype.initSecondaryElement = function () {}\n\n SVGShapeElement.prototype.identityMatrix = new Matrix()\n\n SVGShapeElement.prototype.buildExpressionInterface = function () {}\n\n SVGShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true)\n this.filterUniqueShapes()\n }\n\n /*\nThis method searches for multiple shapes that affect a single element and one of them is animated\n*/\n SVGShapeElement.prototype.filterUniqueShapes = function () {\n var i\n var len = this.shapes.length\n var shape\n var j\n var jLen = this.stylesList.length\n var style\n var tempShapes = []\n var areAnimated = false\n for (j = 0; j < jLen; j += 1) {\n style = this.stylesList[j]\n areAnimated = false\n tempShapes.length = 0\n for (i = 0; i < len; i += 1) {\n shape = this.shapes[i]\n if (shape.styles.indexOf(style) !== -1) {\n tempShapes.push(shape)\n areAnimated = shape._isAnimated || areAnimated\n }\n }\n if (tempShapes.length > 1 && areAnimated) {\n this.setShapesAsAnimated(tempShapes)\n }\n }\n }\n\n SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {\n var i\n var len = shapes.length\n for (i = 0; i < len; i += 1) {\n shapes[i].setAsAnimated()\n }\n }\n\n SVGShapeElement.prototype.createStyleElement = function (data, level) {\n // TODO: prevent drawing of hidden styles\n var elementData\n var styleOb = new SVGStyleData(data, level)\n\n var pathElement = styleOb.pElem\n if (data.ty === 'st') {\n elementData = new SVGStrokeStyleData(this, data, styleOb)\n } else if (data.ty === 'fl') {\n elementData = new SVGFillStyleData(this, data, styleOb)\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData\n elementData = new GradientConstructor(this, data, styleOb)\n this.globalData.defs.appendChild(elementData.gf)\n if (elementData.maskId) {\n this.globalData.defs.appendChild(elementData.ms)\n this.globalData.defs.appendChild(elementData.of)\n pathElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + elementData.maskId + ')')\n }\n } else if (data.ty === 'no') {\n elementData = new SVGNoStyleData(this, data, styleOb)\n }\n\n if (data.ty === 'st' || data.ty === 'gs') {\n pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2])\n pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2])\n pathElement.setAttribute('fill-opacity', '0')\n if (data.lj === 1) {\n pathElement.setAttribute('stroke-miterlimit', data.ml)\n }\n }\n\n if (data.r === 2) {\n pathElement.setAttribute('fill-rule', 'evenodd')\n }\n\n if (data.ln) {\n pathElement.setAttribute('id', data.ln)\n }\n if (data.cl) {\n pathElement.setAttribute('class', data.cl)\n }\n if (data.bm) {\n pathElement.style['mix-blend-mode'] = getBlendMode(data.bm)\n }\n this.stylesList.push(styleOb)\n this.addToAnimatedContents(data, elementData)\n return elementData\n }\n\n SVGShapeElement.prototype.createGroupElement = function (data) {\n var elementData = new ShapeGroupData()\n if (data.ln) {\n elementData.gr.setAttribute('id', data.ln)\n }\n if (data.cl) {\n elementData.gr.setAttribute('class', data.cl)\n }\n if (data.bm) {\n elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm)\n }\n return elementData\n }\n\n SVGShapeElement.prototype.createTransformElement = function (data, container) {\n var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this)\n var elementData = new SVGTransformData(transformProperty, transformProperty.o, container)\n this.addToAnimatedContents(data, elementData)\n return elementData\n }\n\n SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {\n var ty = 4\n if (data.ty === 'rc') {\n ty = 5\n } else if (data.ty === 'el') {\n ty = 6\n } else if (data.ty === 'sr') {\n ty = 7\n }\n var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this)\n var elementData = new SVGShapeData(ownTransformers, level, shapeProperty)\n this.shapes.push(elementData)\n this.addShapeToModifiers(elementData)\n this.addToAnimatedContents(data, elementData)\n return elementData\n }\n\n SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {\n var i = 0\n var len = this.animatedContents.length\n while (i < len) {\n if (this.animatedContents[i].element === element) {\n return\n }\n i += 1\n }\n this.animatedContents.push({\n fn: SVGElementsRenderer.createRenderFunction(data),\n element: element,\n data: data,\n })\n }\n\n SVGShapeElement.prototype.setElementStyles = function (elementData) {\n var arr = elementData.styles\n var j\n var jLen = this.stylesList.length\n for (j = 0; j < jLen; j += 1) {\n if (!this.stylesList[j].closed) {\n arr.push(this.stylesList[j])\n }\n }\n }\n\n SVGShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true\n var i\n var len = this.itemsData.length\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i]\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true)\n this.filterUniqueShapes()\n len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue()\n }\n this.renderModifiers()\n }\n\n SVGShapeElement.prototype.searchShapes = function (\n arr,\n itemsData,\n prevViewData,\n container,\n level,\n transformers,\n render,\n ) {\n var ownTransformers = [].concat(transformers)\n var i\n var len = arr.length - 1\n var j\n var jLen\n var ownStyles = []\n var ownModifiers = []\n var currentTransform\n var modifier\n var processedPos\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i])\n if (!processedPos) {\n arr[i]._render = render\n } else {\n itemsData[i] = prevViewData[processedPos - 1]\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs' || arr[i].ty === 'no') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], level)\n } else {\n itemsData[i].style.closed = false\n }\n if (arr[i]._render) {\n if (itemsData[i].style.pElem.parentNode !== container) {\n container.appendChild(itemsData[i].style.pElem)\n }\n }\n ownStyles.push(itemsData[i].style)\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i])\n } else {\n jLen = itemsData[i].it.length\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j]\n }\n }\n this.searchShapes(\n arr[i].it,\n itemsData[i].it,\n itemsData[i].prevViewData,\n itemsData[i].gr,\n level + 1,\n ownTransformers,\n render,\n )\n if (arr[i]._render) {\n if (itemsData[i].gr.parentNode !== container) {\n container.appendChild(itemsData[i].gr)\n }\n }\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n itemsData[i] = this.createTransformElement(arr[i], container)\n }\n currentTransform = itemsData[i].transform\n ownTransformers.push(currentTransform)\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level)\n }\n this.setElementStyles(itemsData[i])\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n modifier.init(this, arr[i])\n itemsData[i] = modifier\n this.shapeModifiers.push(modifier)\n } else {\n modifier = itemsData[i]\n modifier.closed = false\n }\n ownModifiers.push(modifier)\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n itemsData[i] = modifier\n modifier.init(this, arr, i, itemsData)\n this.shapeModifiers.push(modifier)\n render = false\n } else {\n modifier = itemsData[i]\n modifier.closed = true\n }\n ownModifiers.push(modifier)\n }\n this.addProcessedElement(arr[i], i + 1)\n }\n len = ownStyles.length\n for (i = 0; i < len; i += 1) {\n ownStyles[i].closed = true\n }\n len = ownModifiers.length\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true\n }\n }\n\n SVGShapeElement.prototype.renderInnerContent = function () {\n this.renderModifiers()\n var i\n var len = this.stylesList.length\n for (i = 0; i < len; i += 1) {\n this.stylesList[i].reset()\n }\n this.renderShape()\n for (i = 0; i < len; i += 1) {\n if (this.stylesList[i]._mdf || this._isFirstFrame) {\n if (this.stylesList[i].msElem) {\n this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d)\n // Adding M0 0 fixes same mask bug on all browsers\n this.stylesList[i].d = 'M0 0' + this.stylesList[i].d\n }\n this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0')\n }\n }\n }\n\n SVGShapeElement.prototype.renderShape = function () {\n var i\n var len = this.animatedContents.length\n var animatedContent\n for (i = 0; i < len; i += 1) {\n animatedContent = this.animatedContents[i]\n if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {\n animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame)\n }\n }\n }\n\n SVGShapeElement.prototype.destroy = function () {\n this.destroyBaseElement()\n this.shapesData = null\n this.itemsData = null\n }\n\n function LetterProps(o, sw, sc, fc, m, p) {\n this.o = o\n this.sw = sw\n this.sc = sc\n this.fc = fc\n this.m = m\n this.p = p\n this._mdf = {\n o: true,\n sw: !!sw,\n sc: !!sc,\n fc: !!fc,\n m: true,\n p: true,\n }\n }\n\n LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {\n this._mdf.o = false\n this._mdf.sw = false\n this._mdf.sc = false\n this._mdf.fc = false\n this._mdf.m = false\n this._mdf.p = false\n var updated = false\n\n if (this.o !== o) {\n this.o = o\n this._mdf.o = true\n updated = true\n }\n if (this.sw !== sw) {\n this.sw = sw\n this._mdf.sw = true\n updated = true\n }\n if (this.sc !== sc) {\n this.sc = sc\n this._mdf.sc = true\n updated = true\n }\n if (this.fc !== fc) {\n this.fc = fc\n this._mdf.fc = true\n updated = true\n }\n if (this.m !== m) {\n this.m = m\n this._mdf.m = true\n updated = true\n }\n if (\n p.length &&\n (this.p[0] !== p[0] ||\n this.p[1] !== p[1] ||\n this.p[4] !== p[4] ||\n this.p[5] !== p[5] ||\n this.p[12] !== p[12] ||\n this.p[13] !== p[13])\n ) {\n this.p = p\n this._mdf.p = true\n updated = true\n }\n return updated\n }\n\n function TextProperty(elem, data) {\n this._frameId = initialDefaultFrame\n this.pv = ''\n this.v = ''\n this.kf = false\n this._isFirstFrame = true\n this._mdf = false\n this.data = data\n this.elem = elem\n this.comp = this.elem.comp\n this.keysIndex = 0\n this.canResize = false\n this.minimumFontSize = 1\n this.effectsSequence = []\n this.currentData = {\n ascent: 0,\n boxWidth: this.defaultBoxWidth,\n f: '',\n fStyle: '',\n fWeight: '',\n fc: '',\n j: '',\n justifyOffset: '',\n l: [],\n lh: 0,\n lineWidths: [],\n ls: '',\n of: '',\n s: '',\n sc: '',\n sw: 0,\n t: 0,\n tr: 0,\n sz: 0,\n ps: null,\n fillColorAnim: false,\n strokeColorAnim: false,\n strokeWidthAnim: false,\n yOffset: 0,\n finalSize: 0,\n finalText: [],\n finalLineHeight: 0,\n __complete: false,\n }\n this.copyData(this.currentData, this.data.d.k[0].s)\n\n if (!this.searchProperty()) {\n this.completeTextData(this.currentData)\n }\n }\n\n TextProperty.prototype.defaultBoxWidth = [0, 0]\n\n TextProperty.prototype.copyData = function (obj, data) {\n for (var s in data) {\n if (Object.prototype.hasOwnProperty.call(data, s)) {\n obj[s] = data[s]\n }\n }\n return obj\n }\n\n TextProperty.prototype.setCurrentData = function (data) {\n if (!data.__complete) {\n this.completeTextData(data)\n }\n this.currentData = data\n this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth\n this._mdf = true\n }\n\n TextProperty.prototype.searchProperty = function () {\n return this.searchKeyframes()\n }\n\n TextProperty.prototype.searchKeyframes = function () {\n this.kf = this.data.d.k.length > 1\n if (this.kf) {\n this.addEffect(this.getKeyframeValue.bind(this))\n }\n return this.kf\n }\n\n TextProperty.prototype.addEffect = function (effectFunction) {\n this.effectsSequence.push(effectFunction)\n this.elem.addDynamicProperty(this)\n }\n\n TextProperty.prototype.getValue = function (_finalValue) {\n if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {\n return\n }\n this.currentData.t = this.data.d.k[this.keysIndex].s.t\n var currentValue = this.currentData\n var currentIndex = this.keysIndex\n if (this.lock) {\n this.setCurrentData(this.currentData)\n return\n }\n this.lock = true\n this._mdf = false\n var i\n var len = this.effectsSequence.length\n var finalValue = _finalValue || this.data.d.k[this.keysIndex].s\n for (i = 0; i < len; i += 1) {\n // Checking if index changed to prevent creating a new object every time the expression updates.\n if (currentIndex !== this.keysIndex) {\n finalValue = this.effectsSequence[i](finalValue, finalValue.t)\n } else {\n finalValue = this.effectsSequence[i](this.currentData, finalValue.t)\n }\n }\n if (currentValue !== finalValue) {\n this.setCurrentData(finalValue)\n }\n this.v = this.currentData\n this.pv = this.v\n this.lock = false\n this.frameId = this.elem.globalData.frameId\n }\n\n TextProperty.prototype.getKeyframeValue = function () {\n var textKeys = this.data.d.k\n var frameNum = this.elem.comp.renderedFrame\n var i = 0\n var len = textKeys.length\n while (i <= len - 1) {\n if (i === len - 1 || textKeys[i + 1].t > frameNum) {\n break\n }\n i += 1\n }\n if (this.keysIndex !== i) {\n this.keysIndex = i\n }\n return this.data.d.k[this.keysIndex].s\n }\n\n TextProperty.prototype.buildFinalText = function (text) {\n var charactersArray = []\n var i = 0\n var len = text.length\n var charCode\n var secondCharCode\n var shouldCombine = false\n while (i < len) {\n charCode = text.charCodeAt(i)\n if (FontManager.isCombinedCharacter(charCode)) {\n charactersArray[charactersArray.length - 1] += text.charAt(i)\n } else if (charCode >= 0xd800 && charCode <= 0xdbff) {\n secondCharCode = text.charCodeAt(i + 1)\n if (secondCharCode >= 0xdc00 && secondCharCode <= 0xdfff) {\n if (shouldCombine || FontManager.isModifier(charCode, secondCharCode)) {\n charactersArray[charactersArray.length - 1] += text.substr(i, 2)\n shouldCombine = false\n } else {\n charactersArray.push(text.substr(i, 2))\n }\n i += 1\n } else {\n charactersArray.push(text.charAt(i))\n }\n } else if (charCode > 0xdbff) {\n secondCharCode = text.charCodeAt(i + 1)\n if (FontManager.isZeroWidthJoiner(charCode, secondCharCode)) {\n shouldCombine = true\n charactersArray[charactersArray.length - 1] += text.substr(i, 2)\n i += 1\n } else {\n charactersArray.push(text.charAt(i))\n }\n } else if (FontManager.isZeroWidthJoiner(charCode)) {\n charactersArray[charactersArray.length - 1] += text.charAt(i)\n shouldCombine = true\n } else {\n charactersArray.push(text.charAt(i))\n }\n i += 1\n }\n return charactersArray\n }\n\n TextProperty.prototype.completeTextData = function (documentData) {\n documentData.__complete = true\n var fontManager = this.elem.globalData.fontManager\n var data = this.data\n var letters = []\n var i\n var len\n var newLineFlag\n var index = 0\n var val\n var anchorGrouping = data.m.g\n var currentSize = 0\n var currentPos = 0\n var currentLine = 0\n var lineWidths = []\n var lineWidth = 0\n var maxLineWidth = 0\n var j\n var jLen\n var fontData = fontManager.getFontByName(documentData.f)\n var charData\n var cLength = 0\n\n var fontProps = getFontProperties(fontData)\n documentData.fWeight = fontProps.weight\n documentData.fStyle = fontProps.style\n documentData.finalSize = documentData.s\n documentData.finalText = this.buildFinalText(documentData.t)\n len = documentData.finalText.length\n documentData.finalLineHeight = documentData.lh\n var trackingOffset = (documentData.tr / 1000) * documentData.finalSize\n var charCode\n if (documentData.sz) {\n var flag = true\n var boxWidth = documentData.sz[0]\n var boxHeight = documentData.sz[1]\n var currentHeight\n var finalText\n while (flag) {\n finalText = this.buildFinalText(documentData.t)\n currentHeight = 0\n lineWidth = 0\n len = finalText.length\n trackingOffset = (documentData.tr / 1000) * documentData.finalSize\n var lastSpaceIndex = -1\n for (i = 0; i < len; i += 1) {\n charCode = finalText[i].charCodeAt(0)\n newLineFlag = false\n if (finalText[i] === ' ') {\n lastSpaceIndex = i\n } else if (charCode === 13 || charCode === 3) {\n lineWidth = 0\n newLineFlag = true\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily)\n cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100\n } else {\n // tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;\n cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize)\n }\n if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {\n if (lastSpaceIndex === -1) {\n len += 1\n } else {\n i = lastSpaceIndex\n }\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2\n finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\\r')\n // finalText = finalText.substr(0,i) + \"\\r\" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);\n lastSpaceIndex = -1\n lineWidth = 0\n } else {\n lineWidth += cLength\n lineWidth += trackingOffset\n }\n }\n currentHeight += (fontData.ascent * documentData.finalSize) / 100\n if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {\n documentData.finalSize -= 1\n documentData.finalLineHeight = (documentData.finalSize * documentData.lh) / documentData.s\n } else {\n documentData.finalText = finalText\n len = documentData.finalText.length\n flag = false\n }\n }\n }\n lineWidth = -trackingOffset\n cLength = 0\n var uncollapsedSpaces = 0\n var currentChar\n for (i = 0; i < len; i += 1) {\n newLineFlag = false\n currentChar = documentData.finalText[i]\n charCode = currentChar.charCodeAt(0)\n if (charCode === 13 || charCode === 3) {\n uncollapsedSpaces = 0\n lineWidths.push(lineWidth)\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth\n lineWidth = -2 * trackingOffset\n val = ''\n newLineFlag = true\n currentLine += 1\n } else {\n val = currentChar\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(\n currentChar,\n fontData.fStyle,\n fontManager.getFontByName(documentData.f).fFamily,\n )\n cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100\n } else {\n // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);\n // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;\n cLength = fontManager.measureText(val, documentData.f, documentData.finalSize)\n }\n\n //\n if (currentChar === ' ') {\n uncollapsedSpaces += cLength + trackingOffset\n } else {\n lineWidth += cLength + trackingOffset + uncollapsedSpaces\n uncollapsedSpaces = 0\n }\n letters.push({\n l: cLength,\n an: cLength,\n add: currentSize,\n n: newLineFlag,\n anIndexes: [],\n val: val,\n line: currentLine,\n animatorJustifyOffset: 0,\n })\n if (anchorGrouping == 2) {\n // eslint-disable-line eqeqeq\n currentSize += cLength\n if (val === '' || val === ' ' || i === len - 1) {\n if (val === '' || val === ' ') {\n currentSize -= cLength\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize\n letters[currentPos].ind = index\n letters[currentPos].extra = cLength\n currentPos += 1\n }\n index += 1\n currentSize = 0\n }\n } else if (anchorGrouping == 3) {\n // eslint-disable-line eqeqeq\n currentSize += cLength\n if (val === '' || i === len - 1) {\n if (val === '') {\n currentSize -= cLength\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize\n letters[currentPos].ind = index\n letters[currentPos].extra = cLength\n currentPos += 1\n }\n currentSize = 0\n index += 1\n }\n } else {\n letters[index].ind = index\n letters[index].extra = 0\n index += 1\n }\n }\n documentData.l = letters\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth\n lineWidths.push(lineWidth)\n if (documentData.sz) {\n documentData.boxWidth = documentData.sz[0]\n documentData.justifyOffset = 0\n } else {\n documentData.boxWidth = maxLineWidth\n switch (documentData.j) {\n case 1:\n documentData.justifyOffset = -documentData.boxWidth\n break\n case 2:\n documentData.justifyOffset = -documentData.boxWidth / 2\n break\n default:\n documentData.justifyOffset = 0\n }\n }\n documentData.lineWidths = lineWidths\n\n var animators = data.a\n var animatorData\n var letterData\n jLen = animators.length\n var based\n var ind\n var indexes = []\n for (j = 0; j < jLen; j += 1) {\n animatorData = animators[j]\n if (animatorData.a.sc) {\n documentData.strokeColorAnim = true\n }\n if (animatorData.a.sw) {\n documentData.strokeWidthAnim = true\n }\n if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {\n documentData.fillColorAnim = true\n }\n ind = 0\n based = animatorData.s.b\n for (i = 0; i < len; i += 1) {\n letterData = letters[i]\n letterData.anIndexes[j] = ind\n if (\n (based == 1 && letterData.val !== '') ||\n (based == 2 && letterData.val !== '' && letterData.val !== ' ') ||\n (based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1)) ||\n (based == 4 && (letterData.n || i == len - 1))\n ) {\n // eslint-disable-line eqeqeq\n if (animatorData.s.rn === 1) {\n indexes.push(ind)\n }\n ind += 1\n }\n }\n data.a[j].s.totalChars = ind\n var currentInd = -1\n var newInd\n if (animatorData.s.rn === 1) {\n for (i = 0; i < len; i += 1) {\n letterData = letters[i]\n if (currentInd != letterData.anIndexes[j]) {\n // eslint-disable-line eqeqeq\n currentInd = letterData.anIndexes[j]\n newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0]\n }\n letterData.anIndexes[j] = newInd\n }\n }\n }\n documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2\n documentData.ls = documentData.ls || 0\n documentData.ascent = (fontData.ascent * documentData.finalSize) / 100\n }\n\n TextProperty.prototype.updateDocumentData = function (newData, index) {\n index = index === undefined ? this.keysIndex : index\n var dData = this.copyData({}, this.data.d.k[index].s)\n dData = this.copyData(dData, newData)\n this.data.d.k[index].s = dData\n this.recalculate(index)\n this.elem.addDynamicProperty(this)\n }\n\n TextProperty.prototype.recalculate = function (index) {\n var dData = this.data.d.k[index].s\n dData.__complete = false\n this.keysIndex = 0\n this._isFirstFrame = true\n this.getValue(dData)\n }\n\n TextProperty.prototype.canResizeFont = function (_canResize) {\n this.canResize = _canResize\n this.recalculate(this.keysIndex)\n this.elem.addDynamicProperty(this)\n }\n\n TextProperty.prototype.setMinimumFontSize = function (_fontValue) {\n this.minimumFontSize = Math.floor(_fontValue) || 1\n this.recalculate(this.keysIndex)\n this.elem.addDynamicProperty(this)\n }\n\n const TextSelectorProp = (function () {\n var max = Math.max\n var min = Math.min\n var floor = Math.floor\n\n function TextSelectorPropFactory(elem, data) {\n this._currentTextLength = -1\n this.k = false\n this.data = data\n this.elem = elem\n this.comp = elem.comp\n this.finalS = 0\n this.finalE = 0\n this.initDynamicPropertyContainer(elem)\n this.s = PropertyFactory.getProp(elem, data.s || { k: 0 }, 0, 0, this)\n if ('e' in data) {\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this)\n } else {\n this.e = { v: 100 }\n }\n this.o = PropertyFactory.getProp(elem, data.o || { k: 0 }, 0, 0, this)\n this.xe = PropertyFactory.getProp(elem, data.xe || { k: 0 }, 0, 0, this)\n this.ne = PropertyFactory.getProp(elem, data.ne || { k: 0 }, 0, 0, this)\n this.sm = PropertyFactory.getProp(elem, data.sm || { k: 100 }, 0, 0, this)\n this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this)\n if (!this.dynamicProperties.length) {\n this.getValue()\n }\n }\n\n TextSelectorPropFactory.prototype = {\n getMult: function (ind) {\n if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {\n this.getValue()\n }\n var x1 = 0\n var y1 = 0\n var x2 = 1\n var y2 = 1\n if (this.ne.v > 0) {\n x1 = this.ne.v / 100.0\n } else {\n y1 = -this.ne.v / 100.0\n }\n if (this.xe.v > 0) {\n x2 = 1.0 - this.xe.v / 100.0\n } else {\n y2 = 1.0 + this.xe.v / 100.0\n }\n var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get\n\n var mult = 0\n var s = this.finalS\n var e = this.finalE\n var type = this.data.sh\n if (type === 2) {\n if (e === s) {\n mult = ind >= e ? 1 : 0\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1))\n }\n mult = easer(mult)\n } else if (type === 3) {\n if (e === s) {\n mult = ind >= e ? 0 : 1\n } else {\n mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1))\n }\n\n mult = easer(mult)\n } else if (type === 4) {\n if (e === s) {\n mult = 0\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1))\n if (mult < 0.5) {\n mult *= 2\n } else {\n mult = 1 - 2 * (mult - 0.5)\n }\n }\n mult = easer(mult)\n } else if (type === 5) {\n if (e === s) {\n mult = 0\n } else {\n var tot = e - s\n /* ind += 0.5;\n mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */\n ind = min(max(0, ind + 0.5 - s), e - s)\n var x = -tot / 2 + ind\n var a = tot / 2\n mult = Math.sqrt(1 - (x * x) / (a * a))\n }\n mult = easer(mult)\n } else if (type === 6) {\n if (e === s) {\n mult = 0\n } else {\n ind = min(max(0, ind + 0.5 - s), e - s)\n mult = (1 + Math.cos(Math.PI + (Math.PI * 2 * ind) / (e - s))) / 2 // eslint-disable-line\n }\n mult = easer(mult)\n } else {\n if (ind >= floor(s)) {\n if (ind - s < 0) {\n mult = max(0, min(min(e, 1) - (s - ind), 1))\n } else {\n mult = max(0, min(e - ind, 1))\n }\n }\n mult = easer(mult)\n }\n // Smoothness implementation.\n // The smoothness represents a reduced range of the original [0; 1] range.\n // if smoothness is 25%, the new range will be [0.375; 0.625]\n // Steps are:\n // - find the lower value of the new range (threshold)\n // - if multiplier is smaller than that value, floor it to 0\n // - if it is larger,\n // - subtract the threshold\n // - divide it by the smoothness (this will return the range to [0; 1])\n // Note: If it doesn't work on some scenarios, consider applying it before the easer.\n if (this.sm.v !== 100) {\n var smoothness = this.sm.v * 0.01\n if (smoothness === 0) {\n smoothness = 0.00000001\n }\n var threshold = 0.5 - smoothness * 0.5\n if (mult < threshold) {\n mult = 0\n } else {\n mult = (mult - threshold) / smoothness\n if (mult > 1) {\n mult = 1\n }\n }\n }\n return mult * this.a.v\n },\n getValue: function (newCharsFlag) {\n this.iterateDynamicProperties()\n this._mdf = newCharsFlag || this._mdf\n this._currentTextLength = this.elem.textProperty.currentData.l.length || 0\n if (newCharsFlag && this.data.r === 2) {\n this.e.v = this._currentTextLength\n }\n var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars\n var o = this.o.v / divisor\n var s = this.s.v / divisor + o\n var e = this.e.v / divisor + o\n if (s > e) {\n var _s = s\n s = e\n e = _s\n }\n this.finalS = s\n this.finalE = e\n },\n }\n extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory)\n\n function getTextSelectorProp(elem, data, arr) {\n return new TextSelectorPropFactory(elem, data, arr)\n }\n\n return {\n getTextSelectorProp: getTextSelectorProp,\n }\n })()\n\n function TextAnimatorDataProperty(elem, animatorProps, container) {\n var defaultData = { propType: false }\n var getProp = PropertyFactory.getProp\n var textAnimatorAnimatables = animatorProps.a\n this.a = {\n r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData,\n rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData,\n ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData,\n sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData,\n sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData,\n s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData,\n a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData,\n o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData,\n p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData,\n sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData,\n sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData,\n fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData,\n fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData,\n fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData,\n fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData,\n t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData,\n }\n\n this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container)\n this.s.t = animatorProps.s.t\n }\n\n function TextAnimatorProperty(textData, renderType, elem) {\n this._isFirstFrame = true\n this._hasMaskedPath = false\n this._frameId = -1\n this._textData = textData\n this._renderType = renderType\n this._elem = elem\n this._animatorsData = createSizedArray(this._textData.a.length)\n this._pathData = {}\n this._moreOptions = {\n alignment: {},\n }\n this.renderedLetters = []\n this.lettersChangedFlag = false\n this.initDynamicPropertyContainer(elem)\n }\n\n TextAnimatorProperty.prototype.searchProperties = function () {\n var i\n var len = this._textData.a.length\n var animatorProps\n var getProp = PropertyFactory.getProp\n for (i = 0; i < len; i += 1) {\n animatorProps = this._textData.a[i]\n this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this)\n }\n if (this._textData.p && 'm' in this._textData.p) {\n this._pathData = {\n a: getProp(this._elem, this._textData.p.a, 0, 0, this),\n f: getProp(this._elem, this._textData.p.f, 0, 0, this),\n l: getProp(this._elem, this._textData.p.l, 0, 0, this),\n r: getProp(this._elem, this._textData.p.r, 0, 0, this),\n p: getProp(this._elem, this._textData.p.p, 0, 0, this),\n m: this._elem.maskManager.getMaskProperty(this._textData.p.m),\n }\n this._hasMaskedPath = true\n } else {\n this._hasMaskedPath = false\n }\n this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this)\n }\n\n TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {\n this.lettersChangedFlag = lettersChangedFlag\n if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {\n return\n }\n this._isFirstFrame = false\n var alignment = this._moreOptions.alignment.v\n var animators = this._animatorsData\n var textData = this._textData\n var matrixHelper = this.mHelper\n var renderType = this._renderType\n var renderedLettersCount = this.renderedLetters.length\n var xPos\n var yPos\n var i\n var len\n var letters = documentData.l\n var pathInfo\n var currentLength\n var currentPoint\n var segmentLength\n var flag\n var pointInd\n var segmentInd\n var prevPoint\n var points\n var segments\n var partialLength\n var totalLength\n var perc\n var tanAngle\n var mask\n if (this._hasMaskedPath) {\n mask = this._pathData.m\n if (!this._pathData.n || this._pathData._mdf) {\n var paths = mask.v\n if (this._pathData.r.v) {\n paths = paths.reverse()\n }\n // TODO: release bezier data cached from previous pathInfo: this._pathData.pi\n pathInfo = {\n tLength: 0,\n segments: [],\n }\n len = paths._length - 1\n var bezierData\n totalLength = 0\n for (i = 0; i < len; i += 1) {\n bezierData = bez.buildBezierData(\n paths.v[i],\n paths.v[i + 1],\n [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],\n [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]],\n )\n pathInfo.tLength += bezierData.segmentLength\n pathInfo.segments.push(bezierData)\n totalLength += bezierData.segmentLength\n }\n i = len\n if (mask.v.c) {\n bezierData = bez.buildBezierData(\n paths.v[i],\n paths.v[0],\n [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],\n [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]],\n )\n pathInfo.tLength += bezierData.segmentLength\n pathInfo.segments.push(bezierData)\n totalLength += bezierData.segmentLength\n }\n this._pathData.pi = pathInfo\n }\n pathInfo = this._pathData.pi\n\n currentLength = this._pathData.f.v\n segmentInd = 0\n pointInd = 1\n segmentLength = 0\n flag = true\n segments = pathInfo.segments\n if (currentLength < 0 && mask.v.c) {\n if (pathInfo.tLength < Math.abs(currentLength)) {\n currentLength = -Math.abs(currentLength) % pathInfo.tLength\n }\n segmentInd = segments.length - 1\n points = segments[segmentInd].points\n pointInd = points.length - 1\n while (currentLength < 0) {\n currentLength += points[pointInd].partialLength\n pointInd -= 1\n if (pointInd < 0) {\n segmentInd -= 1\n points = segments[segmentInd].points\n pointInd = points.length - 1\n }\n }\n }\n points = segments[segmentInd].points\n prevPoint = points[pointInd - 1]\n currentPoint = points[pointInd]\n partialLength = currentPoint.partialLength\n }\n\n len = letters.length\n xPos = 0\n yPos = 0\n var yOff = documentData.finalSize * 1.2 * 0.714\n var firstLine = true\n var animatorProps\n var animatorSelector\n var j\n var jLen\n var letterValue\n\n jLen = animators.length\n\n var mult\n var ind = -1\n var offf\n var xPathPos\n var yPathPos\n var initPathPos = currentLength\n var initSegmentInd = segmentInd\n var initPointInd = pointInd\n var currentLine = -1\n var elemOpacity\n var sc\n var sw\n var fc\n var k\n var letterSw\n var letterSc\n var letterFc\n var letterM = ''\n var letterP = this.defaultPropsArray\n var letterO\n\n //\n if (documentData.j === 2 || documentData.j === 1) {\n var animatorJustifyOffset = 0\n var animatorFirstCharOffset = 0\n var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1\n var lastIndex = 0\n var isNewLine = true\n\n for (i = 0; i < len; i += 1) {\n if (letters[i].n) {\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset\n lastIndex += 1\n }\n animatorJustifyOffset = 0\n isNewLine = true\n } else {\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.t.propType) {\n if (isNewLine && documentData.j === 2) {\n animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult\n }\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult\n } else {\n animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult\n }\n }\n }\n isNewLine = false\n }\n }\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset\n lastIndex += 1\n }\n }\n //\n\n for (i = 0; i < len; i += 1) {\n matrixHelper.reset()\n elemOpacity = 1\n if (letters[i].n) {\n xPos = 0\n yPos += documentData.yOffset\n yPos += firstLine ? 1 : 0\n currentLength = initPathPos\n firstLine = false\n if (this._hasMaskedPath) {\n segmentInd = initSegmentInd\n pointInd = initPointInd\n points = segments[segmentInd].points\n prevPoint = points[pointInd - 1]\n currentPoint = points[pointInd]\n partialLength = currentPoint.partialLength\n segmentLength = 0\n }\n letterM = ''\n letterFc = ''\n letterSw = ''\n letterO = ''\n letterP = this.defaultPropsArray\n } else {\n if (this._hasMaskedPath) {\n if (currentLine !== letters[i].line) {\n switch (documentData.j) {\n case 1:\n currentLength += totalLength - documentData.lineWidths[letters[i].line]\n break\n case 2:\n currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2\n break\n default:\n break\n }\n currentLine = letters[i].line\n }\n if (ind !== letters[i].ind) {\n if (letters[ind]) {\n currentLength += letters[ind].extra\n }\n currentLength += letters[i].an / 2\n ind = letters[i].ind\n }\n currentLength += alignment[0] * letters[i].an * 0.005\n var animatorOffset = 0\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n animatorOffset += animatorProps.p.v[0] * mult[0]\n } else {\n animatorOffset += animatorProps.p.v[0] * mult\n }\n }\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n animatorOffset += animatorProps.a.v[0] * mult[0]\n } else {\n animatorOffset += animatorProps.a.v[0] * mult\n }\n }\n }\n flag = true\n // Force alignment only works with a single line for now\n if (this._pathData.a.v) {\n currentLength =\n letters[0].an * 0.5 +\n ((totalLength - this._pathData.f.v - letters[0].an * 0.5 - letters[letters.length - 1].an * 0.5) * ind) /\n (len - 1)\n currentLength += this._pathData.f.v\n }\n while (flag) {\n if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {\n perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength\n xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc\n yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -(alignment[1] * yOff) * 0.01)\n flag = false\n } else if (points) {\n segmentLength += currentPoint.partialLength\n pointInd += 1\n if (pointInd >= points.length) {\n pointInd = 0\n segmentInd += 1\n if (!segments[segmentInd]) {\n if (mask.v.c) {\n pointInd = 0\n segmentInd = 0\n points = segments[segmentInd].points\n } else {\n segmentLength -= currentPoint.partialLength\n points = null\n }\n } else {\n points = segments[segmentInd].points\n }\n }\n if (points) {\n prevPoint = currentPoint\n currentPoint = points[pointInd]\n partialLength = currentPoint.partialLength\n }\n }\n }\n offf = letters[i].an / 2 - letters[i].add\n matrixHelper.translate(-offf, 0, 0)\n } else {\n offf = letters[i].an / 2 - letters[i].add\n matrixHelper.translate(-offf, 0, 0)\n\n // Grouping alignment\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -alignment[1] * yOff * 0.01, 0)\n }\n\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.t.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n // This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean \"isNewLine\"\n if (xPos !== 0 || documentData.j !== 0) {\n if (this._hasMaskedPath) {\n if (mult.length) {\n currentLength += animatorProps.t.v * mult[0]\n } else {\n currentLength += animatorProps.t.v * mult\n }\n } else if (mult.length) {\n xPos += animatorProps.t.v * mult[0]\n } else {\n xPos += animatorProps.t.v * mult\n }\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n sw = documentData.sw || 0\n }\n if (documentData.strokeColorAnim) {\n if (documentData.sc) {\n sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]]\n } else {\n sc = [0, 0, 0]\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]]\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n\n if (mult.length) {\n matrixHelper.translate(\n -animatorProps.a.v[0] * mult[0],\n -animatorProps.a.v[1] * mult[1],\n animatorProps.a.v[2] * mult[2],\n )\n } else {\n matrixHelper.translate(\n -animatorProps.a.v[0] * mult,\n -animatorProps.a.v[1] * mult,\n animatorProps.a.v[2] * mult,\n )\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.s.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult[0], 1 + (animatorProps.s.v[1] - 1) * mult[1], 1)\n } else {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult, 1 + (animatorProps.s.v[1] - 1) * mult, 1)\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (animatorProps.sk.propType) {\n if (mult.length) {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1])\n } else {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult)\n }\n }\n if (animatorProps.r.propType) {\n if (mult.length) {\n matrixHelper.rotateZ(-animatorProps.r.v * mult[2])\n } else {\n matrixHelper.rotateZ(-animatorProps.r.v * mult)\n }\n }\n if (animatorProps.ry.propType) {\n if (mult.length) {\n matrixHelper.rotateY(animatorProps.ry.v * mult[1])\n } else {\n matrixHelper.rotateY(animatorProps.ry.v * mult)\n }\n }\n if (animatorProps.rx.propType) {\n if (mult.length) {\n matrixHelper.rotateX(animatorProps.rx.v * mult[0])\n } else {\n matrixHelper.rotateX(animatorProps.rx.v * mult)\n }\n }\n if (animatorProps.o.propType) {\n if (mult.length) {\n elemOpacity += (animatorProps.o.v * mult[0] - elemOpacity) * mult[0]\n } else {\n elemOpacity += (animatorProps.o.v * mult - elemOpacity) * mult\n }\n }\n if (documentData.strokeWidthAnim && animatorProps.sw.propType) {\n if (mult.length) {\n sw += animatorProps.sw.v * mult[0]\n } else {\n sw += animatorProps.sw.v * mult\n }\n }\n if (documentData.strokeColorAnim && animatorProps.sc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0]\n } else {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult\n }\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n if (animatorProps.fc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0]\n } else {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult\n }\n }\n }\n if (animatorProps.fh.propType) {\n if (mult.length) {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult[0])\n } else {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult)\n }\n }\n if (animatorProps.fs.propType) {\n if (mult.length) {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0])\n } else {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult)\n }\n }\n if (animatorProps.fb.propType) {\n if (mult.length) {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0])\n } else {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult)\n }\n }\n }\n }\n\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (this._hasMaskedPath) {\n if (mult.length) {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1])\n } else {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult)\n }\n } else if (mult.length) {\n matrixHelper.translate(\n animatorProps.p.v[0] * mult[0],\n animatorProps.p.v[1] * mult[1],\n -animatorProps.p.v[2] * mult[2],\n )\n } else {\n matrixHelper.translate(\n animatorProps.p.v[0] * mult,\n animatorProps.p.v[1] * mult,\n -animatorProps.p.v[2] * mult,\n )\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n letterSw = sw < 0 ? 0 : sw\n }\n if (documentData.strokeColorAnim) {\n letterSc =\n 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')'\n }\n if (documentData.fillColorAnim && documentData.fc) {\n letterFc =\n 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')'\n }\n\n if (this._hasMaskedPath) {\n matrixHelper.translate(0, -documentData.ls)\n\n matrixHelper.translate(0, alignment[1] * yOff * 0.01 + yPos, 0)\n if (this._pathData.p.v) {\n tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0])\n var rot = (Math.atan(tanAngle) * 180) / Math.PI\n if (currentPoint.point[0] < prevPoint.point[0]) {\n rot += 180\n }\n matrixHelper.rotate((-rot * Math.PI) / 180)\n }\n matrixHelper.translate(xPathPos, yPathPos, 0)\n currentLength -= alignment[0] * letters[i].an * 0.005\n if (letters[i + 1] && ind !== letters[i + 1].ind) {\n currentLength += letters[i].an / 2\n currentLength += documentData.tr * 0.001 * documentData.finalSize\n }\n } else {\n matrixHelper.translate(xPos, yPos, 0)\n\n if (documentData.ps) {\n // matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0)\n }\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(\n letters[i].animatorJustifyOffset +\n documentData.justifyOffset +\n (documentData.boxWidth - documentData.lineWidths[letters[i].line]),\n 0,\n 0,\n )\n break\n case 2:\n matrixHelper.translate(\n letters[i].animatorJustifyOffset +\n documentData.justifyOffset +\n (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2,\n 0,\n 0,\n )\n break\n default:\n break\n }\n matrixHelper.translate(0, -documentData.ls)\n matrixHelper.translate(offf, 0, 0)\n matrixHelper.translate(alignment[0] * letters[i].an * 0.005, alignment[1] * yOff * 0.01, 0)\n xPos += letters[i].l + documentData.tr * 0.001 * documentData.finalSize\n }\n if (renderType === 'html') {\n letterM = matrixHelper.toCSS()\n } else if (renderType === 'svg') {\n letterM = matrixHelper.to2dCSS()\n } else {\n letterP = [\n matrixHelper.props[0],\n matrixHelper.props[1],\n matrixHelper.props[2],\n matrixHelper.props[3],\n matrixHelper.props[4],\n matrixHelper.props[5],\n matrixHelper.props[6],\n matrixHelper.props[7],\n matrixHelper.props[8],\n matrixHelper.props[9],\n matrixHelper.props[10],\n matrixHelper.props[11],\n matrixHelper.props[12],\n matrixHelper.props[13],\n matrixHelper.props[14],\n matrixHelper.props[15],\n ]\n }\n letterO = elemOpacity\n }\n\n if (renderedLettersCount <= i) {\n letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP)\n this.renderedLetters.push(letterValue)\n renderedLettersCount += 1\n this.lettersChangedFlag = true\n } else {\n letterValue = this.renderedLetters[i]\n this.lettersChangedFlag =\n letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag\n }\n }\n }\n\n TextAnimatorProperty.prototype.getValue = function () {\n if (this._elem.globalData.frameId === this._frameId) {\n return\n }\n this._frameId = this._elem.globalData.frameId\n this.iterateDynamicProperties()\n }\n\n TextAnimatorProperty.prototype.mHelper = new Matrix()\n TextAnimatorProperty.prototype.defaultPropsArray = []\n extendPrototype([DynamicPropertyContainer], TextAnimatorProperty)\n\n function ITextElement() {}\n\n ITextElement.prototype.initElement = function (data, globalData, comp) {\n this.lettersChangedFlag = true\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.textProperty = new TextProperty(this, data.t, this.dynamicProperties)\n this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this)\n this.initTransform(data, globalData, comp)\n this.initHierarchy()\n this.initRenderable()\n this.initRendererElement()\n this.createContainerElements()\n this.createRenderableComponents()\n this.createContent()\n this.hide()\n this.textAnimator.searchProperties(this.dynamicProperties)\n }\n\n ITextElement.prototype.prepareFrame = function (num) {\n this._mdf = false\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n if (this.textProperty._mdf || this.textProperty._isFirstFrame) {\n this.buildNewText()\n this.textProperty._isFirstFrame = false\n this.textProperty._mdf = false\n }\n }\n\n ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {\n var j\n var jLen = shapes.length\n var pathNodes\n var shapeStr = ''\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n pathNodes = shapes[j].ks.k\n shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper)\n }\n }\n return shapeStr\n }\n\n ITextElement.prototype.updateDocumentData = function (newData, index) {\n this.textProperty.updateDocumentData(newData, index)\n }\n\n ITextElement.prototype.canResizeFont = function (_canResize) {\n this.textProperty.canResizeFont(_canResize)\n }\n\n ITextElement.prototype.setMinimumFontSize = function (_fontSize) {\n this.textProperty.setMinimumFontSize(_fontSize)\n }\n\n ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {\n if (documentData.ps) {\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0)\n }\n matrixHelper.translate(0, -documentData.ls, 0)\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(\n documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]),\n 0,\n 0,\n )\n break\n case 2:\n matrixHelper.translate(\n documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2,\n 0,\n 0,\n )\n break\n default:\n break\n }\n matrixHelper.translate(xPos, yPos, 0)\n }\n\n ITextElement.prototype.buildColor = function (colorData) {\n return (\n 'rgb(' +\n Math.round(colorData[0] * 255) +\n ',' +\n Math.round(colorData[1] * 255) +\n ',' +\n Math.round(colorData[2] * 255) +\n ')'\n )\n }\n\n ITextElement.prototype.emptyProp = new LetterProps()\n\n ITextElement.prototype.destroy = function () {}\n\n var emptyShapeData = {\n shapes: [],\n }\n\n function SVGTextLottieElement(data, globalData, comp) {\n this.textSpans = []\n this.renderType = 'svg'\n this.initElement(data, globalData, comp)\n }\n\n extendPrototype(\n [BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement],\n SVGTextLottieElement,\n )\n\n SVGTextLottieElement.prototype.createContent = function () {\n if (this.data.singleShape && !this.globalData.fontManager.chars) {\n this.textContainer = createNS('text')\n }\n }\n\n SVGTextLottieElement.prototype.buildTextContents = function (textArray) {\n var i = 0\n var len = textArray.length\n var textContents = []\n var currentTextContent = ''\n while (i < len) {\n if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {\n textContents.push(currentTextContent)\n currentTextContent = ''\n } else {\n currentTextContent += textArray[i]\n }\n i += 1\n }\n textContents.push(currentTextContent)\n return textContents\n }\n\n SVGTextLottieElement.prototype.buildShapeData = function (data, scale) {\n // data should probably be cloned to apply scale separately to each instance of a text on different layers\n // but since text internal content gets only rendered once and then it's never rerendered,\n // it's probably safe not to clone data and reuse always the same instance even if the object is mutated.\n // Avoiding cloning is preferred since cloning each character shape data is expensive\n if (data.shapes && data.shapes.length) {\n var shape = data.shapes[0]\n if (shape.it) {\n var shapeItem = shape.it[shape.it.length - 1]\n if (shapeItem.s) {\n shapeItem.s.k[0] = scale\n shapeItem.s.k[1] = scale\n }\n }\n }\n return data\n }\n\n SVGTextLottieElement.prototype.buildNewText = function () {\n this.addDynamicProperty(this)\n var i\n var len\n\n var documentData = this.textProperty.currentData\n this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0)\n if (documentData.fc) {\n this.layerElement.setAttribute('fill', this.buildColor(documentData.fc))\n } else {\n this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)')\n }\n if (documentData.sc) {\n this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc))\n this.layerElement.setAttribute('stroke-width', documentData.sw)\n }\n this.layerElement.setAttribute('font-size', documentData.finalSize)\n var fontData = this.globalData.fontManager.getFontByName(documentData.f)\n if (fontData.fClass) {\n this.layerElement.setAttribute('class', fontData.fClass)\n } else {\n this.layerElement.setAttribute('font-family', fontData.fFamily)\n var fWeight = documentData.fWeight\n var fStyle = documentData.fStyle\n this.layerElement.setAttribute('font-style', fStyle)\n this.layerElement.setAttribute('font-weight', fWeight)\n }\n this.layerElement.setAttribute('aria-label', documentData.t)\n\n var letters = documentData.l || []\n var usesGlyphs = !!this.globalData.fontManager.chars\n len = letters.length\n\n var tSpan\n var matrixHelper = this.mHelper\n var shapeStr = ''\n var singleShape = this.data.singleShape\n var xPos = 0\n var yPos = 0\n var firstLine = true\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize\n if (singleShape && !usesGlyphs && !documentData.sz) {\n var tElement = this.textContainer\n var justify = 'start'\n switch (documentData.j) {\n case 1:\n justify = 'end'\n break\n case 2:\n justify = 'middle'\n break\n default:\n justify = 'start'\n break\n }\n tElement.setAttribute('text-anchor', justify)\n tElement.setAttribute('letter-spacing', trackingOffset)\n var textContent = this.buildTextContents(documentData.finalText)\n len = textContent.length\n yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0\n for (i = 0; i < len; i += 1) {\n tSpan = this.textSpans[i].span || createNS('tspan')\n tSpan.textContent = textContent[i]\n tSpan.setAttribute('x', 0)\n tSpan.setAttribute('y', yPos)\n tSpan.style.display = 'inherit'\n tElement.appendChild(tSpan)\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n glyph: null,\n }\n }\n this.textSpans[i].span = tSpan\n yPos += documentData.finalLineHeight\n }\n\n this.layerElement.appendChild(tElement)\n } else {\n var cachedSpansLength = this.textSpans.length\n var charData\n for (i = 0; i < len; i += 1) {\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n childSpan: null,\n glyph: null,\n }\n }\n if (!usesGlyphs || !singleShape || i === 0) {\n tSpan = cachedSpansLength > i ? this.textSpans[i].span : createNS(usesGlyphs ? 'g' : 'text')\n if (cachedSpansLength <= i) {\n tSpan.setAttribute('stroke-linecap', 'butt')\n tSpan.setAttribute('stroke-linejoin', 'round')\n tSpan.setAttribute('stroke-miterlimit', '4')\n this.textSpans[i].span = tSpan\n if (usesGlyphs) {\n var childSpan = createNS('g')\n tSpan.appendChild(childSpan)\n this.textSpans[i].childSpan = childSpan\n }\n this.textSpans[i].span = tSpan\n this.layerElement.appendChild(tSpan)\n }\n tSpan.style.display = 'inherit'\n }\n\n matrixHelper.reset()\n if (singleShape) {\n if (letters[i].n) {\n xPos = -trackingOffset\n yPos += documentData.yOffset\n yPos += firstLine ? 1 : 0\n firstLine = false\n }\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos)\n xPos += letters[i].l || 0\n // xPos += letters[i].val === ' ' ? 0 : trackingOffset;\n xPos += trackingOffset\n }\n if (usesGlyphs) {\n charData = this.globalData.fontManager.getCharData(\n documentData.finalText[i],\n fontData.fStyle,\n this.globalData.fontManager.getFontByName(documentData.f).fFamily,\n )\n var glyphElement\n // t === 1 means the character has been replaced with an animated shaped\n if (charData.t === 1) {\n glyphElement = new SVGCompElement(charData.data, this.globalData, this)\n } else {\n var data = emptyShapeData\n if (charData.data && charData.data.shapes) {\n data = this.buildShapeData(charData.data, documentData.finalSize)\n }\n glyphElement = new SVGShapeElement(data, this.globalData, this)\n }\n if (this.textSpans[i].glyph) {\n var glyph = this.textSpans[i].glyph\n this.textSpans[i].childSpan.removeChild(glyph.layerElement)\n glyph.destroy()\n }\n this.textSpans[i].glyph = glyphElement\n glyphElement._debug = true\n glyphElement.prepareFrame(0)\n glyphElement.renderFrame()\n this.textSpans[i].childSpan.appendChild(glyphElement.layerElement)\n // when using animated shapes, the layer will be scaled instead of replacing the internal scale\n // this might have issues with strokes and might need a different solution\n if (charData.t === 1) {\n this.textSpans[i].childSpan.setAttribute(\n 'transform',\n 'scale(' + documentData.finalSize / 100 + ',' + documentData.finalSize / 100 + ')',\n )\n }\n } else {\n if (singleShape) {\n tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')')\n }\n tSpan.textContent = letters[i].val\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve')\n }\n //\n }\n if (singleShape && tSpan) {\n tSpan.setAttribute('d', shapeStr)\n }\n }\n while (i < this.textSpans.length) {\n this.textSpans[i].span.style.display = 'none'\n i += 1\n }\n\n this._sizeChanged = true\n }\n\n SVGTextLottieElement.prototype.sourceRectAtTime = function () {\n this.prepareFrame(this.comp.renderedFrame - this.data.st)\n this.renderInnerContent()\n if (this._sizeChanged) {\n this._sizeChanged = false\n var textBox = this.layerElement.getBBox()\n this.bbox = {\n top: textBox.y,\n left: textBox.x,\n width: textBox.width,\n height: textBox.height,\n }\n }\n return this.bbox\n }\n\n SVGTextLottieElement.prototype.getValue = function () {\n var i\n var len = this.textSpans.length\n var glyphElement\n this.renderedFrame = this.comp.renderedFrame\n for (i = 0; i < len; i += 1) {\n glyphElement = this.textSpans[i].glyph\n if (glyphElement) {\n glyphElement.prepareFrame(this.comp.renderedFrame - this.data.st)\n if (glyphElement._mdf) {\n this._mdf = true\n }\n }\n }\n }\n\n SVGTextLottieElement.prototype.renderInnerContent = function () {\n if (!this.data.singleShape || this._mdf) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag)\n if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {\n this._sizeChanged = true\n var i\n var len\n var renderedLetters = this.textAnimator.renderedLetters\n\n var letters = this.textProperty.currentData.l\n\n len = letters.length\n var renderedLetter\n var textSpan\n var glyphElement\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i]\n textSpan = this.textSpans[i].span\n glyphElement = this.textSpans[i].glyph\n if (glyphElement) {\n glyphElement.renderFrame()\n }\n if (renderedLetter._mdf.m) {\n textSpan.setAttribute('transform', renderedLetter.m)\n }\n if (renderedLetter._mdf.o) {\n textSpan.setAttribute('opacity', renderedLetter.o)\n }\n if (renderedLetter._mdf.sw) {\n textSpan.setAttribute('stroke-width', renderedLetter.sw)\n }\n if (renderedLetter._mdf.sc) {\n textSpan.setAttribute('stroke', renderedLetter.sc)\n }\n if (renderedLetter._mdf.fc) {\n textSpan.setAttribute('fill', renderedLetter.fc)\n }\n }\n }\n }\n }\n }\n\n function ISolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp)\n }\n extendPrototype([IImageElement], ISolidElement)\n\n ISolidElement.prototype.createContent = function () {\n var rect = createNS('rect')\n /// /rect.style.width = this.data.sw;\n /// /rect.style.height = this.data.sh;\n /// /rect.style.fill = this.data.sc;\n rect.setAttribute('width', this.data.sw)\n rect.setAttribute('height', this.data.sh)\n rect.setAttribute('fill', this.data.sc)\n this.layerElement.appendChild(rect)\n }\n\n function NullElement(data, globalData, comp) {\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.initFrame()\n this.initTransform(data, globalData, comp)\n this.initHierarchy()\n }\n\n NullElement.prototype.prepareFrame = function (num) {\n this.prepareProperties(num, true)\n }\n\n NullElement.prototype.renderFrame = function () {}\n\n NullElement.prototype.getBaseElement = function () {\n return null\n }\n\n NullElement.prototype.destroy = function () {}\n\n NullElement.prototype.sourceRectAtTime = function () {}\n\n NullElement.prototype.hide = function () {}\n\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement)\n\n function SVGRendererBase() {}\n\n extendPrototype([BaseRenderer], SVGRendererBase)\n\n SVGRendererBase.prototype.createNull = function (data) {\n return new NullElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createShape = function (data) {\n return new SVGShapeElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createText = function (data) {\n return new SVGTextLottieElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createImage = function (data) {\n return new IImageElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createSolid = function (data) {\n return new ISolidElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.configAnimation = function (animData) {\n this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n if (this.renderConfig.viewBoxSize) {\n this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize)\n } else {\n this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h)\n }\n\n if (!this.renderConfig.viewBoxOnly) {\n this.svgElement.setAttribute('width', animData.w)\n this.svgElement.setAttribute('height', animData.h)\n this.svgElement.style.width = '100%'\n this.svgElement.style.height = '100%'\n this.svgElement.style.transform = 'translate3d(0,0,0)'\n this.svgElement.style.contentVisibility = this.renderConfig.contentVisibility\n }\n if (this.renderConfig.width) {\n this.svgElement.setAttribute('width', this.renderConfig.width)\n }\n if (this.renderConfig.height) {\n this.svgElement.setAttribute('height', this.renderConfig.height)\n }\n if (this.renderConfig.className) {\n this.svgElement.setAttribute('class', this.renderConfig.className)\n }\n if (this.renderConfig.id) {\n this.svgElement.setAttribute('id', this.renderConfig.id)\n }\n if (this.renderConfig.focusable !== undefined) {\n this.svgElement.setAttribute('focusable', this.renderConfig.focusable)\n }\n this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio)\n // this.layerElement.style.transform = 'translate3d(0,0,0)';\n // this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = \"0px 0px 0px\";\n this.animationItem.wrapper.appendChild(this.svgElement)\n // Mask animation\n var defs = this.globalData.defs\n\n this.setupGlobalData(animData, defs)\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad\n this.data = animData\n\n var maskElement = createNS('clipPath')\n var rect = createNS('rect')\n rect.setAttribute('width', animData.w)\n rect.setAttribute('height', animData.h)\n rect.setAttribute('x', 0)\n rect.setAttribute('y', 0)\n var maskId = createElementID()\n maskElement.setAttribute('id', maskId)\n maskElement.appendChild(rect)\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + maskId + ')')\n\n defs.appendChild(maskElement)\n this.layers = animData.layers\n this.elements = createSizedArray(animData.layers.length)\n }\n\n SVGRendererBase.prototype.destroy = function () {\n if (this.animationItem.wrapper) {\n this.animationItem.wrapper.innerText = ''\n }\n this.layerElement = null\n this.globalData.defs = null\n var i\n var len = this.layers ? this.layers.length : 0\n for (i = 0; i < len; i += 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n this.elements.length = 0\n this.destroyed = true\n this.animationItem = null\n }\n\n SVGRendererBase.prototype.updateContainerSize = function () {}\n\n SVGRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements\n if (elements[pos] || this.layers[pos].ty === 99) {\n return\n }\n elements[pos] = true\n var element = this.createItem(this.layers[pos])\n\n elements[pos] = element\n if (getExpressionsPlugin()) {\n if (this.layers[pos].ty === 0) {\n this.globalData.projectInterface.registerComposition(element)\n }\n element.initExpressions()\n }\n this.appendElementInPos(element, pos)\n if (this.layers[pos].tt) {\n if (!this.elements[pos - 1] || this.elements[pos - 1] === true) {\n this.buildItem(pos - 1)\n this.addPendingElement(element)\n } else {\n element.setMatte(elements[pos - 1].layerId)\n }\n }\n }\n\n SVGRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop()\n element.checkParenting()\n if (element.data.tt) {\n var i = 0\n var len = this.elements.length\n while (i < len) {\n if (this.elements[i] === element) {\n element.setMatte(this.elements[i - 1].layerId)\n break\n }\n i += 1\n }\n }\n }\n }\n\n SVGRendererBase.prototype.renderFrame = function (num) {\n if (this.renderedFrame === num || this.destroyed) {\n return\n }\n if (num === null) {\n num = this.renderedFrame\n } else {\n this.renderedFrame = num\n }\n // console.log('-------');\n // console.log('FRAME ',num);\n this.globalData.frameNum = num\n this.globalData.frameId += 1\n this.globalData.projectInterface.currentFrame = num\n this.globalData._mdf = false\n var i\n var len = this.layers.length\n if (!this.completeLayers) {\n this.checkLayers(num)\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st)\n }\n }\n if (this.globalData._mdf) {\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n }\n }\n\n SVGRendererBase.prototype.appendElementInPos = function (element, pos) {\n var newElement = element.getBaseElement()\n if (!newElement) {\n return\n }\n var i = 0\n var nextElement\n while (i < pos) {\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {\n nextElement = this.elements[i].getBaseElement()\n }\n i += 1\n }\n if (nextElement) {\n this.layerElement.insertBefore(newElement, nextElement)\n } else {\n this.layerElement.appendChild(newElement)\n }\n }\n\n SVGRendererBase.prototype.hide = function () {\n this.layerElement.style.display = 'none'\n }\n\n SVGRendererBase.prototype.show = function () {\n this.layerElement.style.display = 'block'\n }\n\n function ICompElement() {}\n\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement)\n\n ICompElement.prototype.initElement = function (data, globalData, comp) {\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.initTransform(data, globalData, comp)\n this.initRenderable()\n this.initHierarchy()\n this.initRendererElement()\n this.createContainerElements()\n this.createRenderableComponents()\n if (this.data.xt || !globalData.progressiveLoad) {\n this.buildAllItems()\n }\n this.hide()\n }\n\n /* ICompElement.prototype.hide = function(){\n if(!this.hidden){\n this.hideElement();\n var i,len = this.elements.length;\n for( i = 0; i < len; i+=1 ){\n if(this.elements[i]){\n this.elements[i].hide();\n }\n }\n }\n}; */\n\n ICompElement.prototype.prepareFrame = function (num) {\n this._mdf = false\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n if (!this.isInRange && !this.data.xt) {\n return\n }\n\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v\n if (timeRemapped === this.data.op) {\n timeRemapped = this.data.op - 1\n }\n this.renderedFrame = timeRemapped\n } else {\n this.renderedFrame = num / this.data.sr\n }\n var i\n var len = this.elements.length\n if (!this.completeLayers) {\n this.checkLayers(this.renderedFrame)\n }\n // This iteration needs to be backwards because of how expressions connect between each other\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st)\n if (this.elements[i]._mdf) {\n this._mdf = true\n }\n }\n }\n }\n\n ICompElement.prototype.renderInnerContent = function () {\n var i\n var len = this.layers.length\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n }\n\n ICompElement.prototype.setElements = function (elems) {\n this.elements = elems\n }\n\n ICompElement.prototype.getElements = function () {\n return this.elements\n }\n\n ICompElement.prototype.destroyElements = function () {\n var i\n var len = this.layers.length\n for (i = 0; i < len; i += 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n }\n\n ICompElement.prototype.destroy = function () {\n this.destroyElements()\n this.destroyBaseElement()\n }\n\n function SVGCompElement(data, globalData, comp) {\n this.layers = data.layers\n this.supports3d = true\n this.completeLayers = false\n this.pendingElements = []\n this.elements = this.layers ? createSizedArray(this.layers.length) : []\n this.initElement(data, globalData, comp)\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }\n }\n\n extendPrototype([SVGRendererBase, ICompElement, SVGBaseElement], SVGCompElement)\n\n SVGCompElement.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this)\n }\n\n function SVGRenderer(animationItem, config) {\n this.animationItem = animationItem\n this.layers = null\n this.renderedFrame = -1\n this.svgElement = createNS('svg')\n var ariaLabel = ''\n if (config && config.title) {\n var titleElement = createNS('title')\n var titleId = createElementID()\n titleElement.setAttribute('id', titleId)\n titleElement.textContent = config.title\n this.svgElement.appendChild(titleElement)\n ariaLabel += titleId\n }\n if (config && config.description) {\n var descElement = createNS('desc')\n var descId = createElementID()\n descElement.setAttribute('id', descId)\n descElement.textContent = config.description\n this.svgElement.appendChild(descElement)\n ariaLabel += ' ' + descId\n }\n if (ariaLabel) {\n this.svgElement.setAttribute('aria-labelledby', ariaLabel)\n }\n var defs = createNS('defs')\n this.svgElement.appendChild(defs)\n var maskElement = createNS('g')\n this.svgElement.appendChild(maskElement)\n this.layerElement = maskElement\n this.renderConfig = {\n preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\n imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\n contentVisibility: (config && config.contentVisibility) || 'visible',\n progressiveLoad: (config && config.progressiveLoad) || false,\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n viewBoxOnly: (config && config.viewBoxOnly) || false,\n viewBoxSize: (config && config.viewBoxSize) || false,\n className: (config && config.className) || '',\n id: (config && config.id) || '',\n focusable: config && config.focusable,\n filterSize: {\n width: (config && config.filterSize && config.filterSize.width) || '100%',\n height: (config && config.filterSize && config.filterSize.height) || '100%',\n x: (config && config.filterSize && config.filterSize.x) || '0%',\n y: (config && config.filterSize && config.filterSize.y) || '0%',\n },\n width: config && config.width,\n height: config && config.height,\n }\n\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n defs: defs,\n renderConfig: this.renderConfig,\n }\n this.elements = []\n this.pendingElements = []\n this.destroyed = false\n this.rendererType = 'svg'\n }\n\n extendPrototype([SVGRendererBase], SVGRenderer)\n\n SVGRenderer.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this)\n }\n\n function CVContextData() {\n this.saved = []\n this.cArrPos = 0\n this.cTr = new Matrix()\n this.cO = 1\n var i\n var len = 15\n this.savedOp = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n this.saved[i] = createTypedArray('float32', 16)\n }\n this._length = len\n }\n\n CVContextData.prototype.duplicate = function () {\n var newLength = this._length * 2\n var currentSavedOp = this.savedOp\n this.savedOp = createTypedArray('float32', newLength)\n this.savedOp.set(currentSavedOp)\n var i = 0\n for (i = this._length; i < newLength; i += 1) {\n this.saved[i] = createTypedArray('float32', 16)\n }\n this._length = newLength\n }\n\n CVContextData.prototype.reset = function () {\n this.cArrPos = 0\n this.cTr.reset()\n this.cO = 1\n }\n\n function ShapeTransformManager() {\n this.sequences = {}\n this.sequenceList = []\n this.transform_key_count = 0\n }\n\n ShapeTransformManager.prototype = {\n addTransformSequence: function (transforms) {\n var i\n var len = transforms.length\n var key = '_'\n for (i = 0; i < len; i += 1) {\n key += transforms[i].transform.key + '_'\n }\n var sequence = this.sequences[key]\n if (!sequence) {\n sequence = {\n transforms: [].concat(transforms),\n finalTransform: new Matrix(),\n _mdf: false,\n }\n this.sequences[key] = sequence\n this.sequenceList.push(sequence)\n }\n return sequence\n },\n processSequence: function (sequence, isFirstFrame) {\n var i = 0\n var len = sequence.transforms.length\n var _mdf = isFirstFrame\n while (i < len && !isFirstFrame) {\n if (sequence.transforms[i].transform.mProps._mdf) {\n _mdf = true\n break\n }\n i += 1\n }\n if (_mdf) {\n var props\n sequence.finalTransform.reset()\n for (i = len - 1; i >= 0; i -= 1) {\n props = sequence.transforms[i].transform.mProps.v.props\n sequence.finalTransform.transform(\n props[0],\n props[1],\n props[2],\n props[3],\n props[4],\n props[5],\n props[6],\n props[7],\n props[8],\n props[9],\n props[10],\n props[11],\n props[12],\n props[13],\n props[14],\n props[15],\n )\n }\n }\n sequence._mdf = _mdf\n },\n processSequences: function (isFirstFrame) {\n var i\n var len = this.sequenceList.length\n for (i = 0; i < len; i += 1) {\n this.processSequence(this.sequenceList[i], isFirstFrame)\n }\n },\n getNewKey: function () {\n this.transform_key_count += 1\n return '_' + this.transform_key_count\n },\n }\n\n function CVEffects() {}\n CVEffects.prototype.renderFrame = function () {}\n\n function CVMaskElement(data, element) {\n this.data = data\n this.element = element\n this.masksProperties = this.data.masksProperties || []\n this.viewData = createSizedArray(this.masksProperties.length)\n var i\n var len = this.masksProperties.length\n var hasMasks = false\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n hasMasks = true\n }\n this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3)\n }\n this.hasMasks = hasMasks\n if (hasMasks) {\n this.element.addRenderableComponent(this)\n }\n }\n\n CVMaskElement.prototype.renderFrame = function () {\n if (!this.hasMasks) {\n return\n }\n var transform = this.element.finalTransform.mat\n var ctx = this.element.canvasContext\n var i\n var len = this.masksProperties.length\n var pt\n var pts\n var data\n ctx.beginPath()\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n if (this.masksProperties[i].inv) {\n ctx.moveTo(0, 0)\n ctx.lineTo(this.element.globalData.compSize.w, 0)\n ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h)\n ctx.lineTo(0, this.element.globalData.compSize.h)\n ctx.lineTo(0, 0)\n }\n data = this.viewData[i].v\n pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0)\n ctx.moveTo(pt[0], pt[1])\n var j\n var jLen = data._length\n for (j = 1; j < jLen; j += 1) {\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j])\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5])\n }\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0])\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5])\n }\n }\n this.element.globalData.renderer.save(true)\n ctx.clip()\n }\n\n CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty\n\n CVMaskElement.prototype.destroy = function () {\n this.element = null\n }\n\n function CVBaseElement() {}\n\n CVBaseElement.prototype = {\n createElements: function () {},\n initRendererElement: function () {},\n createContainerElements: function () {\n this.canvasContext = this.globalData.canvasContext\n this.renderableEffectsManager = new CVEffects(this)\n },\n createContent: function () {},\n setBlendMode: function () {\n var globalData = this.globalData\n if (globalData.blendMode !== this.data.bm) {\n globalData.blendMode = this.data.bm\n var blendModeValue = getBlendMode(this.data.bm)\n globalData.canvasContext.globalCompositeOperation = blendModeValue\n }\n },\n createRenderableComponents: function () {\n this.maskManager = new CVMaskElement(this.data, this)\n },\n hideElement: function () {\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n this.hidden = true\n }\n },\n showElement: function () {\n if (this.isInRange && !this.isTransparent) {\n this.hidden = false\n this._isFirstFrame = true\n this.maskManager._isFirstFrame = true\n }\n },\n renderFrame: function () {\n if (this.hidden || this.data.hd) {\n return\n }\n this.renderTransform()\n this.renderRenderable()\n this.setBlendMode()\n var forceRealStack = this.data.ty === 0\n this.globalData.renderer.save(forceRealStack)\n this.globalData.renderer.ctxTransform(this.finalTransform.mat.props)\n this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v)\n this.renderInnerContent()\n this.globalData.renderer.restore(forceRealStack)\n if (this.maskManager.hasMasks) {\n this.globalData.renderer.restore(true)\n }\n if (this._isFirstFrame) {\n this._isFirstFrame = false\n }\n },\n destroy: function () {\n this.canvasContext = null\n this.data = null\n this.globalData = null\n this.maskManager.destroy()\n },\n mHelper: new Matrix(),\n }\n CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement\n CVBaseElement.prototype.show = CVBaseElement.prototype.showElement\n\n function CVShapeData(element, data, styles, transformsManager) {\n this.styledShapes = []\n this.tr = [0, 0, 0, 0, 0, 0]\n var ty = 4\n if (data.ty === 'rc') {\n ty = 5\n } else if (data.ty === 'el') {\n ty = 6\n } else if (data.ty === 'sr') {\n ty = 7\n }\n this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element)\n var i\n var len = styles.length\n var styledShape\n for (i = 0; i < len; i += 1) {\n if (!styles[i].closed) {\n styledShape = {\n transforms: transformsManager.addTransformSequence(styles[i].transforms),\n trNodes: [],\n }\n this.styledShapes.push(styledShape)\n styles[i].elements.push(styledShape)\n }\n }\n }\n\n CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated\n\n function CVShapeElement(data, globalData, comp) {\n this.shapes = []\n this.shapesData = data.shapes\n this.stylesList = []\n this.itemsData = []\n this.prevViewData = []\n this.shapeModifiers = []\n this.processedElements = []\n this.transformsManager = new ShapeTransformManager()\n this.initElement(data, globalData, comp)\n }\n\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement],\n CVShapeElement,\n )\n\n CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement\n\n CVShapeElement.prototype.transformHelper = { opacity: 1, _opMdf: false }\n\n CVShapeElement.prototype.dashResetter = []\n\n CVShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, [])\n }\n\n CVShapeElement.prototype.createStyleElement = function (data, transforms) {\n var styleElem = {\n data: data,\n type: data.ty,\n preTransforms: this.transformsManager.addTransformSequence(transforms),\n transforms: [],\n elements: [],\n closed: data.hd === true,\n }\n var elementData = {}\n if (data.ty === 'fl' || data.ty === 'st') {\n elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this)\n if (!elementData.c.k) {\n styleElem.co =\n 'rgb(' +\n bmFloor(elementData.c.v[0]) +\n ',' +\n bmFloor(elementData.c.v[1]) +\n ',' +\n bmFloor(elementData.c.v[2]) +\n ')'\n }\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this)\n elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this)\n elementData.h = PropertyFactory.getProp(this, data.h || { k: 0 }, 0, 0.01, this)\n elementData.a = PropertyFactory.getProp(this, data.a || { k: 0 }, 0, degToRads, this)\n elementData.g = new GradientProperty(this, data.g, this)\n }\n elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this)\n if (data.ty === 'st' || data.ty === 'gs') {\n styleElem.lc = lineCapEnum[data.lc || 2]\n styleElem.lj = lineJoinEnum[data.lj || 2]\n if (data.lj == 1) {\n // eslint-disable-line eqeqeq\n styleElem.ml = data.ml\n }\n elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this)\n if (!elementData.w.k) {\n styleElem.wi = elementData.w.v\n }\n if (data.d) {\n var d = new DashProperty(this, data.d, 'canvas', this)\n elementData.d = d\n if (!elementData.d.k) {\n styleElem.da = elementData.d.dashArray\n styleElem.do = elementData.d.dashoffset[0]\n }\n }\n } else {\n styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero'\n }\n this.stylesList.push(styleElem)\n elementData.style = styleElem\n return elementData\n }\n\n CVShapeElement.prototype.createGroupElement = function () {\n var elementData = {\n it: [],\n prevViewData: [],\n }\n return elementData\n }\n\n CVShapeElement.prototype.createTransformElement = function (data) {\n var elementData = {\n transform: {\n opacity: 1,\n _opMdf: false,\n key: this.transformsManager.getNewKey(),\n op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),\n mProps: TransformPropertyFactory.getTransformProperty(this, data, this),\n },\n }\n return elementData\n }\n\n CVShapeElement.prototype.createShapeElement = function (data) {\n var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager)\n\n this.shapes.push(elementData)\n this.addShapeToModifiers(elementData)\n return elementData\n }\n\n CVShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true\n var i\n var len = this.itemsData.length\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i]\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, [])\n len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue()\n }\n this.renderModifiers()\n this.transformsManager.processSequences(this._isFirstFrame)\n }\n\n CVShapeElement.prototype.addTransformToStyleList = function (transform) {\n var i\n var len = this.stylesList.length\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.push(transform)\n }\n }\n }\n\n CVShapeElement.prototype.removeTransformFromStyleList = function () {\n var i\n var len = this.stylesList.length\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.pop()\n }\n }\n }\n\n CVShapeElement.prototype.closeStyles = function (styles) {\n var i\n var len = styles.length\n for (i = 0; i < len; i += 1) {\n styles[i].closed = true\n }\n }\n\n CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {\n var i\n var len = arr.length - 1\n var j\n var jLen\n var ownStyles = []\n var ownModifiers = []\n var processedPos\n var modifier\n var currentTransform\n var ownTransforms = [].concat(transforms)\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i])\n if (!processedPos) {\n arr[i]._shouldRender = shouldRender\n } else {\n itemsData[i] = prevViewData[processedPos - 1]\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], ownTransforms)\n } else {\n itemsData[i].style.closed = false\n }\n\n ownStyles.push(itemsData[i].style)\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i])\n } else {\n jLen = itemsData[i].it.length\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j]\n }\n }\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms)\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n currentTransform = this.createTransformElement(arr[i])\n itemsData[i] = currentTransform\n }\n ownTransforms.push(itemsData[i])\n this.addTransformToStyleList(itemsData[i])\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i])\n }\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n modifier.init(this, arr[i])\n itemsData[i] = modifier\n this.shapeModifiers.push(modifier)\n } else {\n modifier = itemsData[i]\n modifier.closed = false\n }\n ownModifiers.push(modifier)\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n itemsData[i] = modifier\n modifier.init(this, arr, i, itemsData)\n this.shapeModifiers.push(modifier)\n shouldRender = false\n } else {\n modifier = itemsData[i]\n modifier.closed = true\n }\n ownModifiers.push(modifier)\n }\n this.addProcessedElement(arr[i], i + 1)\n }\n this.removeTransformFromStyleList()\n this.closeStyles(ownStyles)\n len = ownModifiers.length\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true\n }\n }\n\n CVShapeElement.prototype.renderInnerContent = function () {\n this.transformHelper.opacity = 1\n this.transformHelper._opMdf = false\n this.renderModifiers()\n this.transformsManager.processSequences(this._isFirstFrame)\n this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true)\n }\n\n CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {\n if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {\n groupTransform.opacity = parentTransform.opacity\n groupTransform.opacity *= groupTransform.op.v\n groupTransform._opMdf = true\n }\n }\n\n CVShapeElement.prototype.drawLayer = function () {\n var i\n var len = this.stylesList.length\n var j\n var jLen\n var k\n var kLen\n var elems\n var nodes\n var renderer = this.globalData.renderer\n var ctx = this.globalData.canvasContext\n var type\n var currentStyle\n for (i = 0; i < len; i += 1) {\n currentStyle = this.stylesList[i]\n type = currentStyle.type\n\n // Skipping style when\n // Stroke width equals 0\n // style should not be rendered (extra unused repeaters)\n // current opacity equals 0\n // global opacity equals 0\n if (\n !(\n ((type === 'st' || type === 'gs') && currentStyle.wi === 0) ||\n !currentStyle.data._shouldRender ||\n currentStyle.coOp === 0 ||\n this.globalData.currentGlobalAlpha === 0\n )\n ) {\n renderer.save()\n elems = currentStyle.elements\n if (type === 'st' || type === 'gs') {\n ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd\n ctx.lineWidth = currentStyle.wi\n ctx.lineCap = currentStyle.lc\n ctx.lineJoin = currentStyle.lj\n ctx.miterLimit = currentStyle.ml || 0\n } else {\n ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd\n }\n renderer.ctxOpacity(currentStyle.coOp)\n if (type !== 'st' && type !== 'gs') {\n ctx.beginPath()\n }\n renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props)\n jLen = elems.length\n for (j = 0; j < jLen; j += 1) {\n if (type === 'st' || type === 'gs') {\n ctx.beginPath()\n if (currentStyle.da) {\n ctx.setLineDash(currentStyle.da)\n ctx.lineDashOffset = currentStyle.do\n }\n }\n nodes = elems[j].trNodes\n kLen = nodes.length\n\n for (k = 0; k < kLen; k += 1) {\n if (nodes[k].t === 'm') {\n ctx.moveTo(nodes[k].p[0], nodes[k].p[1])\n } else if (nodes[k].t === 'c') {\n ctx.bezierCurveTo(\n nodes[k].pts[0],\n nodes[k].pts[1],\n nodes[k].pts[2],\n nodes[k].pts[3],\n nodes[k].pts[4],\n nodes[k].pts[5],\n )\n } else {\n ctx.closePath()\n }\n }\n if (type === 'st' || type === 'gs') {\n ctx.stroke()\n if (currentStyle.da) {\n ctx.setLineDash(this.dashResetter)\n }\n }\n }\n if (type !== 'st' && type !== 'gs') {\n ctx.fill(currentStyle.r)\n }\n renderer.restore()\n }\n }\n }\n\n CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {\n var i\n var len = items.length - 1\n var groupTransform\n groupTransform = parentTransform\n for (i = len; i >= 0; i -= 1) {\n if (items[i].ty === 'tr') {\n groupTransform = data[i].transform\n this.renderShapeTransform(parentTransform, groupTransform)\n } else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') {\n this.renderPath(items[i], data[i])\n } else if (items[i].ty === 'fl') {\n this.renderFill(items[i], data[i], groupTransform)\n } else if (items[i].ty === 'st') {\n this.renderStroke(items[i], data[i], groupTransform)\n } else if (items[i].ty === 'gf' || items[i].ty === 'gs') {\n this.renderGradientFill(items[i], data[i], groupTransform)\n } else if (items[i].ty === 'gr') {\n this.renderShape(groupTransform, items[i].it, data[i].it)\n } else if (items[i].ty === 'tm') {\n //\n }\n }\n if (isMain) {\n this.drawLayer()\n }\n }\n\n CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {\n if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {\n var shapeNodes = styledShape.trNodes\n var paths = shape.paths\n var i\n var len\n var j\n var jLen = paths._length\n shapeNodes.length = 0\n var groupTransformMat = styledShape.transforms.finalTransform\n for (j = 0; j < jLen; j += 1) {\n var pathNodes = paths.shapes[j]\n if (pathNodes && pathNodes.v) {\n len = pathNodes._length\n for (i = 1; i < len; i += 1) {\n if (i === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n })\n }\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i]),\n })\n }\n if (len === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n })\n }\n if (pathNodes.c && len) {\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0]),\n })\n shapeNodes.push({\n t: 'z',\n })\n }\n }\n }\n styledShape.trNodes = shapeNodes\n }\n }\n\n CVShapeElement.prototype.renderPath = function (pathData, itemData) {\n if (pathData.hd !== true && pathData._shouldRender) {\n var i\n var len = itemData.styledShapes.length\n for (i = 0; i < len; i += 1) {\n this.renderStyledShape(itemData.styledShapes[i], itemData.sh)\n }\n }\n }\n\n CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style\n\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co =\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity\n }\n }\n\n CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style\n var grd\n if (\n !styleElem.grd ||\n itemData.g._mdf ||\n itemData.s._mdf ||\n itemData.e._mdf ||\n (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))\n ) {\n var ctx = this.globalData.canvasContext\n var pt1 = itemData.s.v\n var pt2 = itemData.e.v\n if (styleData.t === 1) {\n grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1])\n } else {\n var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2))\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0])\n\n var percent = itemData.h.v\n if (percent >= 1) {\n percent = 0.99\n } else if (percent <= -1) {\n percent = -0.99\n }\n var dist = rad * percent\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]\n grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad)\n }\n\n var i\n var len = styleData.g.p\n var cValues = itemData.g.c\n var opacity = 1\n\n for (i = 0; i < len; i += 1) {\n if (itemData.g._hasOpacity && itemData.g._collapsable) {\n opacity = itemData.g.o[i * 2 + 1]\n }\n grd.addColorStop(\n cValues[i * 4] / 100,\n 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')',\n )\n }\n styleElem.grd = grd\n }\n styleElem.coOp = itemData.o.v * groupTransform.opacity\n }\n\n CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style\n var d = itemData.d\n if (d && (d._mdf || this._isFirstFrame)) {\n styleElem.da = d.dashArray\n styleElem.do = d.dashoffset[0]\n }\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co =\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity\n }\n if (itemData.w._mdf || this._isFirstFrame) {\n styleElem.wi = itemData.w.v\n }\n }\n\n CVShapeElement.prototype.destroy = function () {\n this.shapesData = null\n this.globalData = null\n this.canvasContext = null\n this.stylesList.length = 0\n this.itemsData.length = 0\n }\n\n function CVTextElement(data, globalData, comp) {\n this.textSpans = []\n this.yOffset = 0\n this.fillColorAnim = false\n this.strokeColorAnim = false\n this.strokeWidthAnim = false\n this.stroke = false\n this.fill = false\n this.justifyOffset = 0\n this.currentRender = null\n this.renderType = 'canvas'\n this.values = {\n fill: 'rgba(0,0,0,0)',\n stroke: 'rgba(0,0,0,0)',\n sWidth: 0,\n fValue: '',\n }\n this.initElement(data, globalData, comp)\n }\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement],\n CVTextElement,\n )\n\n CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d')\n\n CVTextElement.prototype.buildNewText = function () {\n var documentData = this.textProperty.currentData\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0)\n\n var hasFill = false\n if (documentData.fc) {\n hasFill = true\n this.values.fill = this.buildColor(documentData.fc)\n } else {\n this.values.fill = 'rgba(0,0,0,0)'\n }\n this.fill = hasFill\n var hasStroke = false\n if (documentData.sc) {\n hasStroke = true\n this.values.stroke = this.buildColor(documentData.sc)\n this.values.sWidth = documentData.sw\n }\n var fontData = this.globalData.fontManager.getFontByName(documentData.f)\n var i\n var len\n var letters = documentData.l\n var matrixHelper = this.mHelper\n this.stroke = hasStroke\n this.values.fValue =\n documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily\n len = documentData.finalText.length\n // this.tHelper.font = this.values.fValue;\n var charData\n var shapeData\n var k\n var kLen\n var shapes\n var j\n var jLen\n var pathNodes\n var commands\n var pathArr\n var singleShape = this.data.singleShape\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize\n var xPos = 0\n var yPos = 0\n var firstLine = true\n var cnt = 0\n for (i = 0; i < len; i += 1) {\n charData = this.globalData.fontManager.getCharData(\n documentData.finalText[i],\n fontData.fStyle,\n this.globalData.fontManager.getFontByName(documentData.f).fFamily,\n )\n shapeData = (charData && charData.data) || {}\n matrixHelper.reset()\n if (singleShape && letters[i].n) {\n xPos = -trackingOffset\n yPos += documentData.yOffset\n yPos += firstLine ? 1 : 0\n firstLine = false\n }\n shapes = shapeData.shapes ? shapeData.shapes[0].it : []\n jLen = shapes.length\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100)\n if (singleShape) {\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos)\n }\n commands = createSizedArray(jLen - 1)\n var commandsCounter = 0\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n kLen = shapes[j].ks.k.i.length\n pathNodes = shapes[j].ks.k\n pathArr = []\n for (k = 1; k < kLen; k += 1) {\n if (k === 1) {\n pathArr.push(\n matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n )\n }\n pathArr.push(\n matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0),\n matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0),\n matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0),\n matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0),\n )\n }\n pathArr.push(\n matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0),\n matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0),\n matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n )\n commands[commandsCounter] = pathArr\n commandsCounter += 1\n }\n }\n if (singleShape) {\n xPos += letters[i].l\n xPos += trackingOffset\n }\n if (this.textSpans[cnt]) {\n this.textSpans[cnt].elem = commands\n } else {\n this.textSpans[cnt] = { elem: commands }\n }\n cnt += 1\n }\n }\n\n CVTextElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext\n ctx.font = this.values.fValue\n ctx.lineCap = 'butt'\n ctx.lineJoin = 'miter'\n ctx.miterLimit = 4\n\n if (!this.data.singleShape) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag)\n }\n\n var i\n var len\n var j\n var jLen\n var k\n var kLen\n var renderedLetters = this.textAnimator.renderedLetters\n\n var letters = this.textProperty.currentData.l\n\n len = letters.length\n var renderedLetter\n var lastFill = null\n var lastStroke = null\n var lastStrokeW = null\n var commands\n var pathArr\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i]\n if (renderedLetter) {\n this.globalData.renderer.save()\n this.globalData.renderer.ctxTransform(renderedLetter.p)\n this.globalData.renderer.ctxOpacity(renderedLetter.o)\n }\n if (this.fill) {\n if (renderedLetter && renderedLetter.fc) {\n if (lastFill !== renderedLetter.fc) {\n lastFill = renderedLetter.fc\n ctx.fillStyle = renderedLetter.fc\n }\n } else if (lastFill !== this.values.fill) {\n lastFill = this.values.fill\n ctx.fillStyle = this.values.fill\n }\n commands = this.textSpans[i].elem\n jLen = commands.length\n this.globalData.canvasContext.beginPath()\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j]\n kLen = pathArr.length\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1])\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(\n pathArr[k],\n pathArr[k + 1],\n pathArr[k + 2],\n pathArr[k + 3],\n pathArr[k + 4],\n pathArr[k + 5],\n )\n }\n }\n this.globalData.canvasContext.closePath()\n this.globalData.canvasContext.fill()\n /// ctx.fillText(this.textSpans[i].val,0,0);\n }\n if (this.stroke) {\n if (renderedLetter && renderedLetter.sw) {\n if (lastStrokeW !== renderedLetter.sw) {\n lastStrokeW = renderedLetter.sw\n ctx.lineWidth = renderedLetter.sw\n }\n } else if (lastStrokeW !== this.values.sWidth) {\n lastStrokeW = this.values.sWidth\n ctx.lineWidth = this.values.sWidth\n }\n if (renderedLetter && renderedLetter.sc) {\n if (lastStroke !== renderedLetter.sc) {\n lastStroke = renderedLetter.sc\n ctx.strokeStyle = renderedLetter.sc\n }\n } else if (lastStroke !== this.values.stroke) {\n lastStroke = this.values.stroke\n ctx.strokeStyle = this.values.stroke\n }\n commands = this.textSpans[i].elem\n jLen = commands.length\n this.globalData.canvasContext.beginPath()\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j]\n kLen = pathArr.length\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1])\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(\n pathArr[k],\n pathArr[k + 1],\n pathArr[k + 2],\n pathArr[k + 3],\n pathArr[k + 4],\n pathArr[k + 5],\n )\n }\n }\n this.globalData.canvasContext.closePath()\n this.globalData.canvasContext.stroke()\n /// ctx.strokeText(letters[i].val,0,0);\n }\n if (renderedLetter) {\n this.globalData.renderer.restore()\n }\n }\n }\n }\n\n function CVImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId)\n this.img = globalData.imageLoader.getAsset(this.assetData)\n this.initElement(data, globalData, comp)\n }\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement],\n CVImageElement,\n )\n\n CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement\n CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame\n\n CVImageElement.prototype.createContent = function () {\n if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {\n var canvas = createTag('canvas')\n canvas.width = this.assetData.w\n canvas.height = this.assetData.h\n var ctx = canvas.getContext('2d')\n\n var imgW = this.img.width\n var imgH = this.img.height\n var imgRel = imgW / imgH\n var canvasRel = this.assetData.w / this.assetData.h\n var widthCrop\n var heightCrop\n var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio\n if ((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {\n heightCrop = imgH\n widthCrop = heightCrop * canvasRel\n } else {\n widthCrop = imgW\n heightCrop = widthCrop / canvasRel\n }\n ctx.drawImage(\n this.img,\n (imgW - widthCrop) / 2,\n (imgH - heightCrop) / 2,\n widthCrop,\n heightCrop,\n 0,\n 0,\n this.assetData.w,\n this.assetData.h,\n )\n this.img = canvas\n }\n }\n\n CVImageElement.prototype.renderInnerContent = function () {\n this.canvasContext.drawImage(this.img, 0, 0)\n }\n\n CVImageElement.prototype.destroy = function () {\n this.img = null\n }\n\n function CVSolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp)\n }\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement],\n CVSolidElement,\n )\n\n CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement\n CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame\n\n CVSolidElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext\n ctx.fillStyle = this.data.sc\n ctx.fillRect(0, 0, this.data.sw, this.data.sh)\n //\n }\n\n function CanvasRendererBase(animationItem, config) {\n this.animationItem = animationItem\n this.renderConfig = {\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\n context: (config && config.context) || null,\n progressiveLoad: (config && config.progressiveLoad) || false,\n preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\n imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\n contentVisibility: (config && config.contentVisibility) || 'visible',\n className: (config && config.className) || '',\n id: (config && config.id) || '',\n }\n this.renderConfig.dpr = (config && config.dpr) || 1\n if (this.animationItem.wrapper) {\n this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1\n }\n this.renderedFrame = -1\n this.globalData = {\n frameNum: -1,\n _mdf: false,\n renderConfig: this.renderConfig,\n currentGlobalAlpha: -1,\n }\n this.contextData = new CVContextData()\n this.elements = []\n this.pendingElements = []\n this.transformMat = new Matrix()\n this.completeLayers = false\n this.rendererType = 'canvas'\n }\n extendPrototype([BaseRenderer], CanvasRendererBase)\n\n CanvasRendererBase.prototype.createShape = function (data) {\n return new CVShapeElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createText = function (data) {\n return new CVTextElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createImage = function (data) {\n return new CVImageElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createSolid = function (data) {\n return new CVSolidElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createNull = SVGRenderer.prototype.createNull\n\n CanvasRendererBase.prototype.ctxTransform = function (props) {\n if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {\n return\n }\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13])\n return\n }\n this.transformMat.cloneFromProps(props)\n var cProps = this.contextData.cTr.props\n this.transformMat.transform(\n cProps[0],\n cProps[1],\n cProps[2],\n cProps[3],\n cProps[4],\n cProps[5],\n cProps[6],\n cProps[7],\n cProps[8],\n cProps[9],\n cProps[10],\n cProps[11],\n cProps[12],\n cProps[13],\n cProps[14],\n cProps[15],\n )\n // this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);\n this.contextData.cTr.cloneFromProps(this.transformMat.props)\n var trProps = this.contextData.cTr.props\n this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13])\n }\n\n CanvasRendererBase.prototype.ctxOpacity = function (op) {\n /* if(op === 1){\n return;\n } */\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.globalAlpha *= op < 0 ? 0 : op\n this.globalData.currentGlobalAlpha = this.contextData.cO\n return\n }\n this.contextData.cO *= op < 0 ? 0 : op\n if (this.globalData.currentGlobalAlpha !== this.contextData.cO) {\n this.canvasContext.globalAlpha = this.contextData.cO\n this.globalData.currentGlobalAlpha = this.contextData.cO\n }\n }\n\n CanvasRendererBase.prototype.reset = function () {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore()\n return\n }\n this.contextData.reset()\n }\n\n CanvasRendererBase.prototype.save = function (actionFlag) {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.save()\n return\n }\n if (actionFlag) {\n this.canvasContext.save()\n }\n var props = this.contextData.cTr.props\n if (this.contextData._length <= this.contextData.cArrPos) {\n this.contextData.duplicate()\n }\n var i\n var arr = this.contextData.saved[this.contextData.cArrPos]\n for (i = 0; i < 16; i += 1) {\n arr[i] = props[i]\n }\n this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO\n this.contextData.cArrPos += 1\n }\n\n CanvasRendererBase.prototype.restore = function (actionFlag) {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore()\n return\n }\n if (actionFlag) {\n this.canvasContext.restore()\n this.globalData.blendMode = 'source-over'\n }\n this.contextData.cArrPos -= 1\n var popped = this.contextData.saved[this.contextData.cArrPos]\n var i\n var arr = this.contextData.cTr.props\n for (i = 0; i < 16; i += 1) {\n arr[i] = popped[i]\n }\n this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13])\n popped = this.contextData.savedOp[this.contextData.cArrPos]\n this.contextData.cO = popped\n if (this.globalData.currentGlobalAlpha !== popped) {\n this.canvasContext.globalAlpha = popped\n this.globalData.currentGlobalAlpha = popped\n }\n }\n\n CanvasRendererBase.prototype.configAnimation = function (animData) {\n if (this.animationItem.wrapper) {\n this.animationItem.container = createTag('canvas')\n var containerStyle = this.animationItem.container.style\n containerStyle.width = '100%'\n containerStyle.height = '100%'\n var origin = '0px 0px 0px'\n containerStyle.transformOrigin = origin\n containerStyle.mozTransformOrigin = origin\n containerStyle.webkitTransformOrigin = origin\n containerStyle['-webkit-transform'] = origin\n containerStyle.contentVisibility = this.renderConfig.contentVisibility\n this.animationItem.wrapper.appendChild(this.animationItem.container)\n this.canvasContext = this.animationItem.container.getContext('2d')\n if (this.renderConfig.className) {\n this.animationItem.container.setAttribute('class', this.renderConfig.className)\n }\n if (this.renderConfig.id) {\n this.animationItem.container.setAttribute('id', this.renderConfig.id)\n }\n } else {\n this.canvasContext = this.renderConfig.context\n }\n this.data = animData\n this.layers = animData.layers\n this.transformCanvas = {\n w: animData.w,\n h: animData.h,\n sx: 0,\n sy: 0,\n tx: 0,\n ty: 0,\n }\n this.setupGlobalData(animData, document.body)\n this.globalData.canvasContext = this.canvasContext\n this.globalData.renderer = this\n this.globalData.isDashed = false\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad\n this.globalData.transformCanvas = this.transformCanvas\n this.elements = createSizedArray(animData.layers.length)\n\n this.updateContainerSize()\n }\n\n CanvasRendererBase.prototype.updateContainerSize = function () {\n this.reset()\n var elementWidth\n var elementHeight\n if (this.animationItem.wrapper && this.animationItem.container) {\n elementWidth = this.animationItem.wrapper.offsetWidth\n elementHeight = this.animationItem.wrapper.offsetHeight\n this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr)\n this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr)\n } else {\n elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr\n elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr\n }\n var elementRel\n var animationRel\n if (\n this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 ||\n this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1\n ) {\n var par = this.renderConfig.preserveAspectRatio.split(' ')\n var fillType = par[1] || 'meet'\n var pos = par[0] || 'xMidYMid'\n var xPos = pos.substr(0, 4)\n var yPos = pos.substr(4)\n elementRel = elementWidth / elementHeight\n animationRel = this.transformCanvas.w / this.transformCanvas.h\n if ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice')) {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr)\n this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr)\n } else {\n this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr)\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr)\n }\n\n if (\n xPos === 'xMid' &&\n ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.tx =\n ((elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2) *\n this.renderConfig.dpr\n } else if (\n xPos === 'xMax' &&\n ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.tx =\n (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr\n } else {\n this.transformCanvas.tx = 0\n }\n if (\n yPos === 'YMid' &&\n ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.ty =\n ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2) *\n this.renderConfig.dpr\n } else if (\n yPos === 'YMax' &&\n ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.ty =\n (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) * this.renderConfig.dpr\n } else {\n this.transformCanvas.ty = 0\n }\n } else if (this.renderConfig.preserveAspectRatio === 'none') {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr)\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr)\n this.transformCanvas.tx = 0\n this.transformCanvas.ty = 0\n } else {\n this.transformCanvas.sx = this.renderConfig.dpr\n this.transformCanvas.sy = this.renderConfig.dpr\n this.transformCanvas.tx = 0\n this.transformCanvas.ty = 0\n }\n this.transformCanvas.props = [\n this.transformCanvas.sx,\n 0,\n 0,\n 0,\n 0,\n this.transformCanvas.sy,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n this.transformCanvas.tx,\n this.transformCanvas.ty,\n 0,\n 1,\n ]\n /* var i, len = this.elements.length;\n for(i=0;i= 0; i -= 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n this.elements.length = 0\n this.globalData.canvasContext = null\n this.animationItem.container = null\n this.destroyed = true\n }\n\n CanvasRendererBase.prototype.renderFrame = function (num, forceRender) {\n if (\n (this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) ||\n this.destroyed ||\n num === -1\n ) {\n return\n }\n this.renderedFrame = num\n this.globalData.frameNum = num - this.animationItem._isFirstFrame\n this.globalData.frameId += 1\n this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender\n this.globalData.projectInterface.currentFrame = num\n\n // console.log('--------');\n // console.log('NEW: ',num);\n var i\n var len = this.layers.length\n if (!this.completeLayers) {\n this.checkLayers(num)\n }\n\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st)\n }\n }\n if (this.globalData._mdf) {\n if (this.renderConfig.clearCanvas === true) {\n this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h)\n } else {\n this.save()\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n if (this.renderConfig.clearCanvas !== true) {\n this.restore()\n }\n }\n }\n\n CanvasRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements\n if (elements[pos] || this.layers[pos].ty === 99) {\n return\n }\n var element = this.createItem(this.layers[pos], this, this.globalData)\n elements[pos] = element\n element.initExpressions()\n /* if(this.layers[pos].ty === 0){\n element.resize(this.globalData.transformCanvas);\n } */\n }\n\n CanvasRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop()\n element.checkParenting()\n }\n }\n\n CanvasRendererBase.prototype.hide = function () {\n this.animationItem.container.style.display = 'none'\n }\n\n CanvasRendererBase.prototype.show = function () {\n this.animationItem.container.style.display = 'block'\n }\n\n function CVCompElement(data, globalData, comp) {\n this.completeLayers = false\n this.layers = data.layers\n this.pendingElements = []\n this.elements = createSizedArray(this.layers.length)\n this.initElement(data, globalData, comp)\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }\n }\n\n extendPrototype([CanvasRendererBase, ICompElement, CVBaseElement], CVCompElement)\n\n CVCompElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext\n ctx.beginPath()\n ctx.moveTo(0, 0)\n ctx.lineTo(this.data.w, 0)\n ctx.lineTo(this.data.w, this.data.h)\n ctx.lineTo(0, this.data.h)\n ctx.lineTo(0, 0)\n ctx.clip()\n var i\n var len = this.layers.length\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n }\n\n CVCompElement.prototype.destroy = function () {\n var i\n var len = this.layers.length\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n this.layers = null\n this.elements = null\n }\n\n CVCompElement.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this)\n }\n\n function CanvasRenderer(animationItem, config) {\n this.animationItem = animationItem\n this.renderConfig = {\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\n context: (config && config.context) || null,\n progressiveLoad: (config && config.progressiveLoad) || false,\n preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\n imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\n contentVisibility: (config && config.contentVisibility) || 'visible',\n className: (config && config.className) || '',\n id: (config && config.id) || '',\n }\n this.renderConfig.dpr = (config && config.dpr) || 1\n if (this.animationItem.wrapper) {\n this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1\n }\n this.renderedFrame = -1\n this.globalData = {\n frameNum: -1,\n _mdf: false,\n renderConfig: this.renderConfig,\n currentGlobalAlpha: -1,\n }\n this.contextData = new CVContextData()\n this.elements = []\n this.pendingElements = []\n this.transformMat = new Matrix()\n this.completeLayers = false\n this.rendererType = 'canvas'\n }\n extendPrototype([CanvasRendererBase], CanvasRenderer)\n\n CanvasRenderer.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this)\n }\n\n // Registering renderers\n registerRenderer('canvas', CanvasRenderer)\n\n // Registering shape modifiers\n ShapeModifiers.registerModifier('tm', TrimModifier)\n ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier)\n ShapeModifiers.registerModifier('rp', RepeaterModifier)\n ShapeModifiers.registerModifier('rd', RoundCornersModifier)\n\n const Expressions = (function () {\n var ob = {}\n ob.initExpressions = initExpressions\n\n function initExpressions(animation) {\n var stackCount = 0\n var registers = []\n\n function pushExpression() {\n stackCount += 1\n }\n\n function popExpression() {\n stackCount -= 1\n if (stackCount === 0) {\n releaseInstances()\n }\n }\n\n function registerExpressionProperty(expression) {\n if (registers.indexOf(expression) === -1) {\n registers.push(expression)\n }\n }\n\n function releaseInstances() {\n var i\n var len = registers.length\n for (i = 0; i < len; i += 1) {\n registers[i].release()\n }\n registers.length = 0\n }\n\n animation.renderer.compInterface = CompExpressionInterface(animation.renderer)\n animation.renderer.globalData.projectInterface.registerComposition(animation.renderer)\n animation.renderer.globalData.pushExpression = pushExpression\n animation.renderer.globalData.popExpression = popExpression\n animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty\n }\n return ob\n })()\n\n /* eslint-disable */\n /*\n Copyright 2014 David Bau.\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n */\n\n function seedRandom(pool, math) {\n //\n // The following constants are related to IEEE 754 limits.\n //\n var global = this,\n width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto // node.js crypto module, initialized at the bottom.\n\n //\n // seedrandom()\n // This is the seedrandom function described above.\n //\n function seedrandom(seed, options, callback) {\n var key = []\n options = options === true ? { entropy: true } : options || {}\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(\n flatten(options.entropy ? [seed, tostring(pool)] : seed === null ? autoseed() : seed, 3),\n key,\n )\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key)\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function () {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0 // and no 'extra last byte'.\n while (n < significance) {\n // Fill up all significant digits by\n n = (n + x) * width // shifting numerator and\n d *= width // denominator and generating a\n x = arc4.g(1) // new least-significant-byte.\n }\n while (n >= overflow) {\n // To avoid rounding up, before adding\n n /= 2 // last byte, shift everything\n d /= 2 // right using integer math until\n x >>>= 1 // we have exactly the desired bits.\n }\n return (n + x) / d // Form the number within [0, 1).\n }\n\n prng.int32 = function () {\n return arc4.g(4) | 0\n }\n prng.quick = function () {\n return arc4.g(4) / 0x100000000\n }\n prng.double = prng\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool)\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (\n options.pass ||\n callback ||\n function (prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) {\n copy(state, arc4)\n }\n // Only provide the .state method if requested via options.state.\n prng.state = function () {\n return copy(arc4, {})\n }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) {\n math[rngname] = prng\n return seed\n }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng\n }\n )(prng, shortseed, 'global' in options ? options.global : this == math, options.state)\n }\n math['seed' + rngname] = seedrandom\n\n //\n // ARC4\n //\n // An ARC4 implementation. The constructor takes a key in the form of\n // an array of at most (width) integers that should be 0 <= x < (width).\n //\n // The g(count) method returns a pseudorandom integer that concatenates\n // the next (count) outputs from ARC4. Its return value is a number x\n // that is in the range 0 <= x < (width ^ count).\n //\n function ARC4(key) {\n var t,\n keylen = key.length,\n me = this,\n i = 0,\n j = (me.i = me.j = 0),\n s = (me.S = [])\n\n // The empty key [] is treated as [0].\n if (!keylen) {\n key = [keylen++]\n }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++\n }\n for (i = 0; i < width; i++) {\n s[i] = s[(j = mask & (j + key[i % keylen] + (t = s[i])))]\n s[j] = t\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n me.g = function (count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t,\n r = 0,\n i = me.i,\n j = me.j,\n s = me.S\n while (count--) {\n t = s[(i = mask & (i + 1))]\n r = r * width + s[mask & ((s[i] = s[(j = mask & (j + t))]) + (s[j] = t))]\n }\n me.i = i\n me.j = j\n return r\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n }\n }\n\n //\n // copy()\n // Copies internal state of ARC4 to or from a plain object.\n //\n function copy(f, t) {\n t.i = f.i\n t.j = f.j\n t.S = f.S.slice()\n return t\n }\n\n //\n // flatten()\n // Converts an object tree to nested arrays of strings.\n //\n function flatten(obj, depth) {\n var result = [],\n typ = typeof obj,\n prop\n if (depth && typ == 'object') {\n for (prop in obj) {\n try {\n result.push(flatten(obj[prop], depth - 1))\n } catch (e) {}\n }\n }\n return result.length ? result : typ == 'string' ? obj : obj + '\\0'\n }\n\n //\n // mixkey()\n // Mixes a string seed into a key that is an array of integers, and\n // returns a shortened string seed that is equivalent to the result key.\n //\n function mixkey(seed, key) {\n var stringseed = seed + '',\n smear,\n j = 0\n while (j < stringseed.length) {\n key[mask & j] = mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++))\n }\n return tostring(key)\n }\n\n //\n // autoseed()\n // Returns an object for autoseeding, using window.crypto and Node crypto\n // module if available.\n //\n function autoseed() {\n try {\n if (nodecrypto) {\n return tostring(nodecrypto.randomBytes(width))\n }\n var out = new Uint8Array(width)\n ;(global.crypto || global.msCrypto).getRandomValues(out)\n return tostring(out)\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins\n return [+new Date(), global, plugins, global.screen, tostring(pool)]\n }\n }\n\n //\n // tostring()\n // Converts an array of charcodes to a string\n //\n function tostring(a) {\n return String.fromCharCode.apply(0, a)\n }\n\n //\n // When seedrandom.js is loaded, we immediately mix a few bits\n // from the built-in RNG into the entropy pool. Because we do\n // not want to interfere with deterministic PRNG state later,\n // seedrandom will not call math.random on its own again after\n // initialization.\n //\n mixkey(math.random(), pool)\n\n //\n // Nodejs and AMD support: export the implementation as a module using\n // either convention.\n //\n\n // End anonymous scope, and pass initial values.\n }\n\n function initialize$2(BMMath) {\n seedRandom([], BMMath)\n }\n\n var propTypes = {\n SHAPE: 'shape',\n }\n\n /* eslint-disable camelcase */\n\n const ExpressionManager = (function () {\n 'use strict'\n\n var ob = {}\n var Math = BMMath\n var window = null\n var document = null\n var XMLHttpRequest = null\n var fetch = null\n var frames = null\n initialize$2(BMMath)\n\n function $bm_isInstanceOfArray(arr) {\n return arr.constructor === Array || arr.constructor === Float32Array\n }\n\n function isNumerable(tOfV, v) {\n return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number\n }\n\n function $bm_neg(a) {\n var tOfA = typeof a\n if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) {\n return -a\n }\n if ($bm_isInstanceOfArray(a)) {\n var i\n var lenA = a.length\n var retArr = []\n for (i = 0; i < lenA; i += 1) {\n retArr[i] = -a[i]\n }\n return retArr\n }\n if (a.propType) {\n return a.v\n }\n return -a\n }\n\n var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get\n var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get\n var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get\n\n function sum(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n if (tOfA === 'string' || tOfB === 'string') {\n return a + b\n }\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a + b\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0)\n a[0] += b\n return a\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0)\n b[0] = a + b[0]\n return b\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0\n var lenA = a.length\n var lenB = b.length\n var retArr = []\n while (i < lenA || i < lenB) {\n if (\n (typeof a[i] === 'number' || a[i] instanceof Number) &&\n (typeof b[i] === 'number' || b[i] instanceof Number)\n ) {\n retArr[i] = a[i] + b[i]\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i]\n }\n i += 1\n }\n return retArr\n }\n return 0\n }\n var add = sum\n\n function sub(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n if (tOfA === 'string') {\n a = parseInt(a, 10)\n }\n if (tOfB === 'string') {\n b = parseInt(b, 10)\n }\n return a - b\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0)\n a[0] -= b\n return a\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0)\n b[0] = a - b[0]\n return b\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0\n var lenA = a.length\n var lenB = b.length\n var retArr = []\n while (i < lenA || i < lenB) {\n if (\n (typeof a[i] === 'number' || a[i] instanceof Number) &&\n (typeof b[i] === 'number' || b[i] instanceof Number)\n ) {\n retArr[i] = a[i] - b[i]\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i]\n }\n i += 1\n }\n return retArr\n }\n return 0\n }\n\n function mul(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n var arr\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a * b\n }\n\n var i\n var len\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] * b\n }\n return arr\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a * b[i]\n }\n return arr\n }\n return 0\n }\n\n function div(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n var arr\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a / b\n }\n var i\n var len\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] / b\n }\n return arr\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a / b[i]\n }\n return arr\n }\n return 0\n }\n function mod(a, b) {\n if (typeof a === 'string') {\n a = parseInt(a, 10)\n }\n if (typeof b === 'string') {\n b = parseInt(b, 10)\n }\n return a % b\n }\n var $bm_sum = sum\n var $bm_sub = sub\n var $bm_mul = mul\n var $bm_div = div\n var $bm_mod = mod\n\n function clamp(num, min, max) {\n if (min > max) {\n var mm = max\n max = min\n min = mm\n }\n return Math.min(Math.max(num, min), max)\n }\n\n function radiansToDegrees(val) {\n return val / degToRads\n }\n var radians_to_degrees = radiansToDegrees\n\n function degreesToRadians(val) {\n return val * degToRads\n }\n var degrees_to_radians = radiansToDegrees\n\n var helperLengthArray = [0, 0, 0, 0, 0, 0]\n\n function length(arr1, arr2) {\n if (typeof arr1 === 'number' || arr1 instanceof Number) {\n arr2 = arr2 || 0\n return Math.abs(arr1 - arr2)\n }\n if (!arr2) {\n arr2 = helperLengthArray\n }\n var i\n var len = Math.min(arr1.length, arr2.length)\n var addedLength = 0\n for (i = 0; i < len; i += 1) {\n addedLength += Math.pow(arr2[i] - arr1[i], 2)\n }\n return Math.sqrt(addedLength)\n }\n\n function normalize(vec) {\n return div(vec, length(vec))\n }\n\n function rgbToHsl(val) {\n var r = val[0]\n var g = val[1]\n var b = val[2]\n var max = Math.max(r, g, b)\n var min = Math.min(r, g, b)\n var h\n var s\n var l = (max + min) / 2\n\n if (max === min) {\n h = 0 // achromatic\n s = 0 // achromatic\n } else {\n var d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0)\n break\n case g:\n h = (b - r) / d + 2\n break\n case b:\n h = (r - g) / d + 4\n break\n default:\n break\n }\n h /= 6\n }\n\n return [h, s, l, val[3]]\n }\n\n function 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 < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n }\n\n function hslToRgb(val) {\n var h = val[0]\n var s = val[1]\n var l = val[2]\n\n var r\n var g\n var b\n\n if (s === 0) {\n r = l // achromatic\n b = l // achromatic\n g = l // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s\n var p = 2 * l - q\n r = hue2rgb(p, q, h + 1 / 3)\n g = hue2rgb(p, q, h)\n b = hue2rgb(p, q, h - 1 / 3)\n }\n\n return [r, g, b, val[3]]\n }\n\n function linear(t, tMin, tMax, value1, value2) {\n if (value1 === undefined || value2 === undefined) {\n value1 = tMin\n value2 = tMax\n tMin = 0\n tMax = 1\n }\n if (tMax < tMin) {\n var _tMin = tMax\n tMax = tMin\n tMin = _tMin\n }\n if (t <= tMin) {\n return value1\n }\n if (t >= tMax) {\n return value2\n }\n var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin)\n if (!value1.length) {\n return value1 + (value2 - value1) * perc\n }\n var i\n var len = value1.length\n var arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = value1[i] + (value2[i] - value1[i]) * perc\n }\n return arr\n }\n function random(min, max) {\n if (max === undefined) {\n if (min === undefined) {\n min = 0\n max = 1\n } else {\n max = min\n min = undefined\n }\n }\n if (max.length) {\n var i\n var len = max.length\n if (!min) {\n min = createTypedArray('float32', len)\n }\n var arr = createTypedArray('float32', len)\n var rnd = BMMath.random()\n for (i = 0; i < len; i += 1) {\n arr[i] = min[i] + rnd * (max[i] - min[i])\n }\n return arr\n }\n if (min === undefined) {\n min = 0\n }\n var rndm = BMMath.random()\n return min + rndm * (max - min)\n }\n\n function createPath(points, inTangents, outTangents, closed) {\n var i\n var len = points.length\n var path = shapePool.newElement()\n path.setPathData(!!closed, len)\n var arrPlaceholder = [0, 0]\n var inVertexPoint\n var outVertexPoint\n for (i = 0; i < len; i += 1) {\n inVertexPoint = inTangents && inTangents[i] ? inTangents[i] : arrPlaceholder\n outVertexPoint = outTangents && outTangents[i] ? outTangents[i] : arrPlaceholder\n path.setTripleAt(\n points[i][0],\n points[i][1],\n outVertexPoint[0] + points[i][0],\n outVertexPoint[1] + points[i][1],\n inVertexPoint[0] + points[i][0],\n inVertexPoint[1] + points[i][1],\n i,\n true,\n )\n }\n return path\n }\n\n function initiateExpression(elem, data, property) {\n var val = data.x\n var needsVelocity = /velocity(?![\\w\\d])/.test(val)\n var _needsRandom = val.indexOf('random') !== -1\n var elemType = elem.data.ty\n var transform\n var $bm_transform\n var content\n var effect\n var thisProperty = property\n thisProperty.valueAtTime = thisProperty.getValueAtTime\n Object.defineProperty(thisProperty, 'value', {\n get: function () {\n return thisProperty.v\n },\n })\n elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate\n elem.comp.displayStartTime = 0\n var inPoint = elem.data.ip / elem.comp.globalData.frameRate\n var outPoint = elem.data.op / elem.comp.globalData.frameRate\n var width = elem.data.sw ? elem.data.sw : 0\n var height = elem.data.sh ? elem.data.sh : 0\n var name = elem.data.nm\n var loopIn\n var loop_in\n var loopOut\n var loop_out\n var smooth\n var toWorld\n var fromWorld\n var fromComp\n var toComp\n var fromCompToSurface\n var position\n var rotation\n var anchorPoint\n var scale\n var thisLayer\n var thisComp\n var mask\n var valueAtTime\n var velocityAtTime\n\n var scoped_bm_rt\n // val = val.replace(/(\\\\?\"|')((http)(s)?(:\\/))?\\/.*?(\\\\?\"|')/g, \"\\\"\\\"\"); // deter potential network calls\n var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0] // eslint-disable-line no-eval\n var numKeys = property.kf ? data.k.length : 0\n\n var active = !this.data || this.data.hd !== true\n\n var wiggle = function wiggle(freq, amp) {\n var iWiggle\n var j\n var lenWiggle = this.pv.length ? this.pv.length : 1\n var addedAmps = createTypedArray('float32', lenWiggle)\n freq = 5\n var iterations = Math.floor(time * freq)\n iWiggle = 0\n j = 0\n while (iWiggle < iterations) {\n // var rnd = BMMath.random();\n for (j = 0; j < lenWiggle; j += 1) {\n addedAmps[j] += -amp + amp * 2 * BMMath.random()\n // addedAmps[j] += -amp + amp*2*rnd;\n }\n iWiggle += 1\n }\n // var rnd2 = BMMath.random();\n var periods = time * freq\n var perc = periods - Math.floor(periods)\n var arr = createTypedArray('float32', lenWiggle)\n if (lenWiggle > 1) {\n for (j = 0; j < lenWiggle; j += 1) {\n arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc\n // arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;\n // arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);\n }\n return arr\n }\n return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc\n }.bind(this)\n\n if (thisProperty.loopIn) {\n loopIn = thisProperty.loopIn.bind(thisProperty)\n loop_in = loopIn\n }\n\n if (thisProperty.loopOut) {\n loopOut = thisProperty.loopOut.bind(thisProperty)\n loop_out = loopOut\n }\n\n if (thisProperty.smooth) {\n smooth = thisProperty.smooth.bind(thisProperty)\n }\n\n function loopInDuration(type, duration) {\n return loopIn(type, duration, true)\n }\n\n function loopOutDuration(type, duration) {\n return loopOut(type, duration, true)\n }\n\n if (this.getValueAtTime) {\n valueAtTime = this.getValueAtTime.bind(this)\n }\n\n if (this.getVelocityAtTime) {\n velocityAtTime = this.getVelocityAtTime.bind(this)\n }\n\n var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface)\n\n function lookAt(elem1, elem2) {\n var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]]\n var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads\n var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads\n return [yaw, pitch, 0]\n }\n\n function easeOut(t, tMin, tMax, val1, val2) {\n return applyEase(easeOutBez, t, tMin, tMax, val1, val2)\n }\n\n function easeIn(t, tMin, tMax, val1, val2) {\n return applyEase(easeInBez, t, tMin, tMax, val1, val2)\n }\n\n function ease(t, tMin, tMax, val1, val2) {\n return applyEase(easeInOutBez, t, tMin, tMax, val1, val2)\n }\n\n function applyEase(fn, t, tMin, tMax, val1, val2) {\n if (val1 === undefined) {\n val1 = tMin\n val2 = tMax\n } else {\n t = (t - tMin) / (tMax - tMin)\n }\n if (t > 1) {\n t = 1\n } else if (t < 0) {\n t = 0\n }\n var mult = fn(t)\n if ($bm_isInstanceOfArray(val1)) {\n var iKey\n var lenKey = val1.length\n var arr = createTypedArray('float32', lenKey)\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey]\n }\n return arr\n }\n return (val2 - val1) * mult + val1\n }\n\n function nearestKey(time) {\n var iKey\n var lenKey = data.k.length\n var index\n var keyTime\n if (!data.k.length || typeof data.k[0] === 'number') {\n index = 0\n keyTime = 0\n } else {\n index = -1\n time *= elem.comp.globalData.frameRate\n if (time < data.k[0].t) {\n index = 1\n keyTime = data.k[0].t\n } else {\n for (iKey = 0; iKey < lenKey - 1; iKey += 1) {\n if (time === data.k[iKey].t) {\n index = iKey + 1\n keyTime = data.k[iKey].t\n break\n } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) {\n if (time - data.k[iKey].t > data.k[iKey + 1].t - time) {\n index = iKey + 2\n keyTime = data.k[iKey + 1].t\n } else {\n index = iKey + 1\n keyTime = data.k[iKey].t\n }\n break\n }\n }\n if (index === -1) {\n index = iKey + 1\n keyTime = data.k[iKey].t\n }\n }\n }\n var obKey = {}\n obKey.index = index\n obKey.time = keyTime / elem.comp.globalData.frameRate\n return obKey\n }\n\n function key(ind) {\n var obKey\n var iKey\n var lenKey\n if (!data.k.length || typeof data.k[0] === 'number') {\n throw new Error('The property has no keyframe at index ' + ind)\n }\n ind -= 1\n obKey = {\n time: data.k[ind].t / elem.comp.globalData.frameRate,\n value: [],\n }\n var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e\n\n lenKey = arr.length\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n obKey[iKey] = arr[iKey]\n obKey.value[iKey] = arr[iKey]\n }\n return obKey\n }\n\n function framesToTime(fr, fps) {\n if (!fps) {\n fps = elem.comp.globalData.frameRate\n }\n return fr / fps\n }\n\n function timeToFrames(t, fps) {\n if (!t && t !== 0) {\n t = time\n }\n if (!fps) {\n fps = elem.comp.globalData.frameRate\n }\n return t * fps\n }\n\n function seedRandom(seed) {\n BMMath.seedrandom(randSeed + seed)\n }\n\n function sourceRectAtTime() {\n return elem.sourceRectAtTime()\n }\n\n function substring(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substring(init)\n }\n return value.substring(init, end)\n }\n return ''\n }\n\n function substr(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substr(init)\n }\n return value.substr(init, end)\n }\n return ''\n }\n\n function posterizeTime(framesPerSecond) {\n time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond\n value = valueAtTime(time)\n }\n\n var time\n var velocity\n var value\n var text\n var textIndex\n var textTotal\n var selectorValue\n var index = elem.data.ind\n var hasParent = !!(elem.hierarchy && elem.hierarchy.length)\n var parent\n var randSeed = Math.floor(Math.random() * 1000000)\n var globalData = elem.globalData\n function executeExpression(_value) {\n // globalData.pushExpression();\n value = _value\n if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {\n return value\n }\n if (this.propType === 'textSelector') {\n textIndex = this.textIndex\n textTotal = this.textTotal\n selectorValue = this.selectorValue\n }\n if (!thisLayer) {\n text = elem.layerInterface.text\n thisLayer = elem.layerInterface\n thisComp = elem.comp.compInterface\n toWorld = thisLayer.toWorld.bind(thisLayer)\n fromWorld = thisLayer.fromWorld.bind(thisLayer)\n fromComp = thisLayer.fromComp.bind(thisLayer)\n toComp = thisLayer.toComp.bind(thisLayer)\n mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null\n fromCompToSurface = fromComp\n }\n if (!transform) {\n transform = elem.layerInterface('ADBE Transform Group')\n $bm_transform = transform\n if (transform) {\n anchorPoint = transform.anchorPoint\n /* position = transform.position;\n rotation = transform.rotation;\n scale = transform.scale; */\n }\n }\n\n if (elemType === 4 && !content) {\n content = thisLayer('ADBE Root Vectors Group')\n }\n if (!effect) {\n effect = thisLayer(4)\n }\n hasParent = !!(elem.hierarchy && elem.hierarchy.length)\n if (hasParent && !parent) {\n parent = elem.hierarchy[0].layerInterface\n }\n time = this.comp.renderedFrame / this.comp.globalData.frameRate\n if (_needsRandom) {\n seedRandom(randSeed + time)\n }\n if (needsVelocity) {\n velocity = velocityAtTime(time)\n }\n expression_function()\n this.frameExpressionId = elem.globalData.frameId\n\n // TODO: Check if it's possible to return on ShapeInterface the .v value\n // Changed this to a ternary operation because Rollup failed compiling it correctly\n scoped_bm_rt = scoped_bm_rt.propType === propTypes.SHAPE ? scoped_bm_rt.v : scoped_bm_rt\n return scoped_bm_rt\n }\n // Bundlers will see these as dead code and unless we reference them\n executeExpression.__preventDeadCodeRemoval = [\n $bm_transform,\n anchorPoint,\n time,\n velocity,\n inPoint,\n outPoint,\n width,\n height,\n name,\n loop_in,\n loop_out,\n smooth,\n toComp,\n fromCompToSurface,\n toWorld,\n fromWorld,\n mask,\n position,\n rotation,\n scale,\n thisComp,\n numKeys,\n active,\n wiggle,\n loopInDuration,\n loopOutDuration,\n comp,\n lookAt,\n easeOut,\n easeIn,\n ease,\n nearestKey,\n key,\n text,\n textIndex,\n textTotal,\n selectorValue,\n framesToTime,\n timeToFrames,\n sourceRectAtTime,\n substring,\n substr,\n posterizeTime,\n index,\n globalData,\n ]\n return executeExpression\n }\n\n ob.initiateExpression = initiateExpression\n ob.__preventDeadCodeRemoval = [\n window,\n document,\n XMLHttpRequest,\n fetch,\n frames,\n $bm_neg,\n add,\n $bm_sum,\n $bm_sub,\n $bm_mul,\n $bm_div,\n $bm_mod,\n clamp,\n radians_to_degrees,\n degreesToRadians,\n degrees_to_radians,\n normalize,\n rgbToHsl,\n hslToRgb,\n linear,\n random,\n createPath,\n ]\n return ob\n })()\n\n const expressionHelpers = (function () {\n function searchExpressions(elem, data, prop) {\n if (data.x) {\n prop.k = true\n prop.x = true\n prop.initiateExpression = ExpressionManager.initiateExpression\n prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop))\n }\n }\n\n function getValueAtTime(frameNum) {\n frameNum *= this.elem.globalData.frameRate\n frameNum -= this.offsetTime\n if (frameNum !== this._cachingAtTime.lastFrame) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0\n this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime)\n this._cachingAtTime.lastFrame = frameNum\n }\n return this._cachingAtTime.value\n }\n\n function getSpeedAtTime(frameNum) {\n var delta = -0.01\n var v1 = this.getValueAtTime(frameNum)\n var v2 = this.getValueAtTime(frameNum + delta)\n var speed = 0\n if (v1.length) {\n var i\n for (i = 0; i < v1.length; i += 1) {\n speed += Math.pow(v2[i] - v1[i], 2)\n }\n speed = Math.sqrt(speed) * 100\n } else {\n speed = 0\n }\n return speed\n }\n\n function getVelocityAtTime(frameNum) {\n if (this.vel !== undefined) {\n return this.vel\n }\n var delta = -0.001\n // frameNum += this.elem.data.st;\n var v1 = this.getValueAtTime(frameNum)\n var v2 = this.getValueAtTime(frameNum + delta)\n var velocity\n if (v1.length) {\n velocity = createTypedArray('float32', v1.length)\n var i\n for (i = 0; i < v1.length; i += 1) {\n // removing frameRate\n // if needed, don't add it here\n // velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);\n velocity[i] = (v2[i] - v1[i]) / delta\n }\n } else {\n velocity = (v2 - v1) / delta\n }\n return velocity\n }\n\n function getStaticValueAtTime() {\n return this.pv\n }\n\n function setGroupProperty(propertyGroup) {\n this.propertyGroup = propertyGroup\n }\n\n return {\n searchExpressions: searchExpressions,\n getSpeedAtTime: getSpeedAtTime,\n getVelocityAtTime: getVelocityAtTime,\n getValueAtTime: getValueAtTime,\n getStaticValueAtTime: getStaticValueAtTime,\n setGroupProperty: setGroupProperty,\n }\n })()\n\n function addPropertyDecorator() {\n function loopOut(type, duration, durationFlag) {\n if (!this.k || !this.keyframes) {\n return this.pv\n }\n type = type ? type.toLowerCase() : ''\n var currentFrame = this.comp.renderedFrame\n var keyframes = this.keyframes\n var lastKeyFrame = keyframes[keyframes.length - 1].t\n if (currentFrame <= lastKeyFrame) {\n return this.pv\n }\n var cycleDuration\n var firstKeyFrame\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1\n }\n firstKeyFrame = keyframes[keyframes.length - 1 - duration].t\n cycleDuration = lastKeyFrame - firstKeyFrame\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip)\n } else {\n cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration)\n }\n firstKeyFrame = lastKeyFrame - cycleDuration\n }\n var i\n var len\n var ret\n if (type === 'pingpong') {\n var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration)\n if (iterations % 2 !== 0) {\n return this.getValueAtTime(\n (cycleDuration - ((currentFrame - firstKeyFrame) % cycleDuration) + firstKeyFrame) /\n this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0)\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0)\n var current = this.getValueAtTime(\n (((currentFrame - firstKeyFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration)\n if (this.pv.length) {\n ret = new Array(initV.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] = (endV[i] - initV[i]) * repeats + current[i]\n }\n return ret\n }\n return (endV - initV) * repeats + current\n } else if (type === 'continue') {\n var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0)\n var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0)\n if (this.pv.length) {\n ret = new Array(lastValue.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] =\n lastValue[i] +\n ((lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate)) /\n 0.0005 // eslint-disable-line\n }\n return ret\n }\n return lastValue + (lastValue - nextLastValue) * ((currentFrame - lastKeyFrame) / 0.001)\n }\n return this.getValueAtTime(\n (((currentFrame - firstKeyFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n\n function loopIn(type, duration, durationFlag) {\n if (!this.k) {\n return this.pv\n }\n type = type ? type.toLowerCase() : ''\n var currentFrame = this.comp.renderedFrame\n var keyframes = this.keyframes\n var firstKeyFrame = keyframes[0].t\n if (currentFrame >= firstKeyFrame) {\n return this.pv\n }\n var cycleDuration\n var lastKeyFrame\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1\n }\n lastKeyFrame = keyframes[duration].t\n cycleDuration = lastKeyFrame - firstKeyFrame\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame)\n } else {\n cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration)\n }\n lastKeyFrame = firstKeyFrame + cycleDuration\n }\n var i\n var len\n var ret\n if (type === 'pingpong') {\n var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration)\n if (iterations % 2 === 0) {\n return this.getValueAtTime(\n (((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0)\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0)\n var current = this.getValueAtTime(\n (cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame) /\n this.comp.globalData.frameRate,\n 0,\n )\n var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1\n if (this.pv.length) {\n ret = new Array(initV.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] = current[i] - (endV[i] - initV[i]) * repeats\n }\n return ret\n }\n return current - (endV - initV) * repeats\n } else if (type === 'continue') {\n var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0)\n var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0)\n if (this.pv.length) {\n ret = new Array(firstValue.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] = firstValue[i] + ((firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame)) / 0.001\n }\n return ret\n }\n return firstValue + ((firstValue - nextFirstValue) * (firstKeyFrame - currentFrame)) / 0.001\n }\n return this.getValueAtTime(\n (cycleDuration - (((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame)) /\n this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n\n function smooth(width, samples) {\n if (!this.k) {\n return this.pv\n }\n width = (width || 0.4) * 0.5\n samples = Math.floor(samples || 5)\n if (samples <= 1) {\n return this.pv\n }\n var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate\n var initFrame = currentTime - width\n var endFrame = currentTime + width\n var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1\n var i = 0\n var j = 0\n var value\n if (this.pv.length) {\n value = createTypedArray('float32', this.pv.length)\n } else {\n value = 0\n }\n var sampleValue\n while (i < samples) {\n sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency)\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] += sampleValue[j]\n }\n } else {\n value += sampleValue\n }\n i += 1\n }\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] /= samples\n }\n } else {\n value /= samples\n }\n return value\n }\n\n function getTransformValueAtTime(time) {\n if (!this._transformCachingAtTime) {\n this._transformCachingAtTime = {\n v: new Matrix(),\n }\n }\n /// /\n var matrix = this._transformCachingAtTime.v\n matrix.cloneFromProps(this.pre.props)\n if (this.appliedTransformations < 1) {\n var anchor = this.a.getValueAtTime(time)\n matrix.translate(-anchor[0] * this.a.mult, -anchor[1] * this.a.mult, anchor[2] * this.a.mult)\n }\n if (this.appliedTransformations < 2) {\n var scale = this.s.getValueAtTime(time)\n matrix.scale(scale[0] * this.s.mult, scale[1] * this.s.mult, scale[2] * this.s.mult)\n }\n if (this.sk && this.appliedTransformations < 3) {\n var skew = this.sk.getValueAtTime(time)\n var skewAxis = this.sa.getValueAtTime(time)\n matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult)\n }\n if (this.r && this.appliedTransformations < 4) {\n var rotation = this.r.getValueAtTime(time)\n matrix.rotate(-rotation * this.r.mult)\n } else if (!this.r && this.appliedTransformations < 4) {\n var rotationZ = this.rz.getValueAtTime(time)\n var rotationY = this.ry.getValueAtTime(time)\n var rotationX = this.rx.getValueAtTime(time)\n var orientation = this.or.getValueAtTime(time)\n matrix\n .rotateZ(-rotationZ * this.rz.mult)\n .rotateY(rotationY * this.ry.mult)\n .rotateX(rotationX * this.rx.mult)\n .rotateZ(-orientation[2] * this.or.mult)\n .rotateY(orientation[1] * this.or.mult)\n .rotateX(orientation[0] * this.or.mult)\n }\n if (this.data.p && this.data.p.s) {\n var positionX = this.px.getValueAtTime(time)\n var positionY = this.py.getValueAtTime(time)\n if (this.data.p.z) {\n var positionZ = this.pz.getValueAtTime(time)\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, -positionZ * this.pz.mult)\n } else {\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0)\n }\n } else {\n var position = this.p.getValueAtTime(time)\n matrix.translate(position[0] * this.p.mult, position[1] * this.p.mult, -position[2] * this.p.mult)\n }\n return matrix\n /// /\n }\n\n function getTransformStaticValueAtTime() {\n return this.v.clone(new Matrix())\n }\n\n var getTransformProperty = TransformPropertyFactory.getTransformProperty\n TransformPropertyFactory.getTransformProperty = function (elem, data, container) {\n var prop = getTransformProperty(elem, data, container)\n if (prop.dynamicProperties.length) {\n prop.getValueAtTime = getTransformValueAtTime.bind(prop)\n } else {\n prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop)\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty\n return prop\n }\n\n var propertyGetProp = PropertyFactory.getProp\n PropertyFactory.getProp = function (elem, data, type, mult, container) {\n var prop = propertyGetProp(elem, data, type, mult, container)\n // prop.getVelocityAtTime = getVelocityAtTime;\n // prop.loopOut = loopOut;\n // prop.loopIn = loopIn;\n if (prop.kf) {\n prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop)\n } else {\n prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop)\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty\n prop.loopOut = loopOut\n prop.loopIn = loopIn\n prop.smooth = smooth\n prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop)\n prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop)\n prop.numKeys = data.a === 1 ? data.k.length : 0\n prop.propertyIndex = data.ix\n var value = 0\n if (type !== 0) {\n value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length)\n }\n prop._cachingAtTime = {\n lastFrame: initialDefaultFrame,\n lastIndex: 0,\n value: value,\n }\n expressionHelpers.searchExpressions(elem, data, prop)\n if (prop.k) {\n container.addDynamicProperty(prop)\n }\n\n return prop\n }\n\n function getShapeValueAtTime(frameNum) {\n // For now this caching object is created only when needed instead of creating it when the shape is initialized.\n if (!this._cachingAtTime) {\n this._cachingAtTime = {\n shapeValue: shapePool.clone(this.pv),\n lastIndex: 0,\n lastTime: initialDefaultFrame,\n }\n }\n\n frameNum *= this.elem.globalData.frameRate\n frameNum -= this.offsetTime\n if (frameNum !== this._cachingAtTime.lastTime) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0\n this._cachingAtTime.lastTime = frameNum\n this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime)\n }\n return this._cachingAtTime.shapeValue\n }\n\n var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction()\n var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction()\n\n function ShapeExpressions() {}\n ShapeExpressions.prototype = {\n vertices: function (prop, time) {\n if (this.k) {\n this.getValue()\n }\n var shapePath = this.v\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0)\n }\n var i\n var len = shapePath._length\n var vertices = shapePath[prop]\n var points = shapePath.v\n var arr = createSizedArray(len)\n for (i = 0; i < len; i += 1) {\n if (prop === 'i' || prop === 'o') {\n arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]]\n } else {\n arr[i] = [vertices[i][0], vertices[i][1]]\n }\n }\n return arr\n },\n points: function (time) {\n return this.vertices('v', time)\n },\n inTangents: function (time) {\n return this.vertices('i', time)\n },\n outTangents: function (time) {\n return this.vertices('o', time)\n },\n isClosed: function () {\n return this.v.c\n },\n pointOnPath: function (perc, time) {\n var shapePath = this.v\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0)\n }\n if (!this._segmentsLength) {\n this._segmentsLength = bez.getSegmentsLength(shapePath)\n }\n\n var segmentsLength = this._segmentsLength\n var lengths = segmentsLength.lengths\n var lengthPos = segmentsLength.totalLength * perc\n var i = 0\n var len = lengths.length\n var accumulatedLength = 0\n var pt\n while (i < len) {\n if (accumulatedLength + lengths[i].addedLength > lengthPos) {\n var initIndex = i\n var endIndex = shapePath.c && i === len - 1 ? 0 : i + 1\n var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength\n pt = bez.getPointInSegment(\n shapePath.v[initIndex],\n shapePath.v[endIndex],\n shapePath.o[initIndex],\n shapePath.i[endIndex],\n segmentPerc,\n lengths[i],\n )\n break\n } else {\n accumulatedLength += lengths[i].addedLength\n }\n i += 1\n }\n if (!pt) {\n pt = shapePath.c\n ? [shapePath.v[0][0], shapePath.v[0][1]]\n : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]]\n }\n return pt\n },\n vectorOnPath: function (perc, time, vectorType) {\n // perc doesn't use triple equality because it can be a Number object as well as a primitive.\n if (perc == 1) {\n // eslint-disable-line eqeqeq\n perc = this.v.c\n } else if (perc == 0) {\n // eslint-disable-line eqeqeq\n perc = 0.999\n }\n var pt1 = this.pointOnPath(perc, time)\n var pt2 = this.pointOnPath(perc + 0.001, time)\n var xLength = pt2[0] - pt1[0]\n var yLength = pt2[1] - pt1[1]\n var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2))\n if (magnitude === 0) {\n return [0, 0]\n }\n var unitVector =\n vectorType === 'tangent'\n ? [xLength / magnitude, yLength / magnitude]\n : [-yLength / magnitude, xLength / magnitude]\n return unitVector\n },\n tangentOnPath: function (perc, time) {\n return this.vectorOnPath(perc, time, 'tangent')\n },\n normalOnPath: function (perc, time) {\n return this.vectorOnPath(perc, time, 'normal')\n },\n setGroupProperty: expressionHelpers.setGroupProperty,\n getValueAtTime: expressionHelpers.getStaticValueAtTime,\n }\n extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction)\n extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction)\n KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime\n KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression\n\n var propertyGetShapeProp = ShapePropertyFactory.getShapeProp\n ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {\n var prop = propertyGetShapeProp(elem, data, type, arr, trims)\n prop.propertyIndex = data.ix\n prop.lock = false\n if (type === 3) {\n expressionHelpers.searchExpressions(elem, data.pt, prop)\n } else if (type === 4) {\n expressionHelpers.searchExpressions(elem, data.ks, prop)\n }\n if (prop.k) {\n elem.addDynamicProperty(prop)\n }\n return prop\n }\n }\n\n function initialize$1() {\n addPropertyDecorator()\n }\n\n function addDecorator() {\n function searchExpressions() {\n if (this.data.d.x) {\n this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this)\n this.addEffect(this.getExpressionValue.bind(this))\n return true\n }\n return null\n }\n\n TextProperty.prototype.getExpressionValue = function (currentValue, text) {\n var newValue = this.calculateExpression(text)\n if (currentValue.t !== newValue) {\n var newData = {}\n this.copyData(newData, currentValue)\n newData.t = newValue.toString()\n newData.__complete = false\n return newData\n }\n return currentValue\n }\n\n TextProperty.prototype.searchProperty = function () {\n var isKeyframed = this.searchKeyframes()\n var hasExpressions = this.searchExpressions()\n this.kf = isKeyframed || hasExpressions\n return this.kf\n }\n\n TextProperty.prototype.searchExpressions = searchExpressions\n }\n\n function initialize() {\n addDecorator()\n }\n\n // Registering expression plugin\n setExpressionsPlugin(Expressions)\n initialize$1()\n initialize()\n\n return lottie\n})()\n\nexport { lottie as default }\n", "const { parseBuffer } = (() => {\n /**\n * https://opentype.js.org v1.3.4 | (c) Frederik De Bleser and other contributors | MIT License | Uses tiny-inflate by Devon Govett and string.prototype.codepointat polyfill by Mathias Bynens\n */\n\n var TINF_OK = 0\n var TINF_DATA_ERROR = -3\n\n function Tree() {\n this.table = new Uint16Array(16) /* table of code length counts */\n this.trans = new Uint16Array(288) /* code -> symbol translation table */\n }\n\n function Data(source, dest) {\n this.source = source\n this.sourceIndex = 0\n this.tag = 0\n this.bitcount = 0\n\n this.dest = dest\n this.destLen = 0\n\n this.ltree = new Tree() /* dynamic length/symbol tree */\n this.dtree = new Tree() /* dynamic distance tree */\n }\n\n /* --------------------------------------------------- *\n * -- uninitialized global data (static structures) -- *\n * --------------------------------------------------- */\n\n var sltree = new Tree()\n var sdtree = new Tree()\n\n /* extra bits and base tables for length codes */\n var length_bits = new Uint8Array(30)\n var length_base = new Uint16Array(30)\n\n /* extra bits and base tables for distance codes */\n var dist_bits = new Uint8Array(30)\n var dist_base = new Uint16Array(30)\n\n /* special ordering of code length codes */\n var clcidx = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])\n\n /* used by tinf_decode_trees, avoids allocations every call */\n var code_tree = new Tree()\n var lengths = new Uint8Array(288 + 32)\n\n /* ----------------------- *\n * -- utility functions -- *\n * ----------------------- */\n\n /* build extra bits and base tables */\n function tinf_build_bits_base(bits, base, delta, first) {\n var i, sum\n\n /* build bits table */\n for (i = 0; i < delta; ++i) {\n bits[i] = 0\n }\n for (i = 0; i < 30 - delta; ++i) {\n bits[i + delta] = (i / delta) | 0\n }\n\n /* build base table */\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum\n sum += 1 << bits[i]\n }\n }\n\n /* build the fixed huffman trees */\n function tinf_build_fixed_trees(lt, dt) {\n var i\n\n /* build fixed length tree */\n for (i = 0; i < 7; ++i) {\n lt.table[i] = 0\n }\n\n lt.table[7] = 24\n lt.table[8] = 152\n lt.table[9] = 112\n\n for (i = 0; i < 24; ++i) {\n lt.trans[i] = 256 + i\n }\n for (i = 0; i < 144; ++i) {\n lt.trans[24 + i] = i\n }\n for (i = 0; i < 8; ++i) {\n lt.trans[24 + 144 + i] = 280 + i\n }\n for (i = 0; i < 112; ++i) {\n lt.trans[24 + 144 + 8 + i] = 144 + i\n }\n\n /* build fixed distance tree */\n for (i = 0; i < 5; ++i) {\n dt.table[i] = 0\n }\n\n dt.table[5] = 32\n\n for (i = 0; i < 32; ++i) {\n dt.trans[i] = i\n }\n }\n\n /* given an array of code lengths, build a tree */\n var offs = new Uint16Array(16)\n\n function tinf_build_tree(t, lengths, off, num) {\n var i, sum\n\n /* clear code length count table */\n for (i = 0; i < 16; ++i) {\n t.table[i] = 0\n }\n\n /* scan symbol lengths, and sum code length counts */\n for (i = 0; i < num; ++i) {\n t.table[lengths[off + i]]++\n }\n\n t.table[0] = 0\n\n /* compute offset table for distribution sort */\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum\n sum += t.table[i]\n }\n\n /* create code->symbol translation table (symbols sorted by code) */\n for (i = 0; i < num; ++i) {\n if (lengths[off + i]) {\n t.trans[offs[lengths[off + i]]++] = i\n }\n }\n }\n\n /* ---------------------- *\n * -- decode functions -- *\n * ---------------------- */\n\n /* get one bit from source stream */\n function tinf_getbit(d) {\n /* check if tag is empty */\n if (!d.bitcount--) {\n /* load next tag */\n d.tag = d.source[d.sourceIndex++]\n d.bitcount = 7\n }\n\n /* shift bit out of tag */\n var bit = d.tag & 1\n d.tag >>>= 1\n\n return bit\n }\n\n /* read a num bit value from a stream and add base */\n function tinf_read_bits(d, num, base) {\n if (!num) {\n return base\n }\n\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount\n d.bitcount += 8\n }\n\n var val = d.tag & (0xffff >>> (16 - num))\n d.tag >>>= num\n d.bitcount -= num\n return val + base\n }\n\n /* given a data stream and a tree, decode a symbol */\n function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount\n d.bitcount += 8\n }\n\n var sum = 0,\n cur = 0,\n len = 0\n var tag = d.tag\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1)\n tag >>>= 1\n ++len\n\n sum += t.table[len]\n cur -= t.table[len]\n } while (cur >= 0)\n\n d.tag = tag\n d.bitcount -= len\n\n return t.trans[sum + cur]\n }\n\n /* given a data stream, decode dynamic trees from it */\n function tinf_decode_trees(d, lt, dt) {\n var hlit, hdist, hclen\n var i, num, length\n\n /* get 5 bits HLIT (257-286) */\n hlit = tinf_read_bits(d, 5, 257)\n\n /* get 5 bits HDIST (1-32) */\n hdist = tinf_read_bits(d, 5, 1)\n\n /* get 4 bits HCLEN (4-19) */\n hclen = tinf_read_bits(d, 4, 4)\n\n for (i = 0; i < 19; ++i) {\n lengths[i] = 0\n }\n\n /* read code lengths for code length alphabet */\n for (i = 0; i < hclen; ++i) {\n /* get 3 bits code length (0-7) */\n var clen = tinf_read_bits(d, 3, 0)\n lengths[clcidx[i]] = clen\n }\n\n /* build code length tree */\n tinf_build_tree(code_tree, lengths, 0, 19)\n\n /* decode code lengths for the dynamic trees */\n for (num = 0; num < hlit + hdist; ) {\n var sym = tinf_decode_symbol(d, code_tree)\n\n switch (sym) {\n case 16:\n /* copy previous code length 3-6 times (read 2 bits) */\n var prev = lengths[num - 1]\n for (length = tinf_read_bits(d, 2, 3); length; --length) {\n lengths[num++] = prev\n }\n break\n case 17:\n /* repeat code length 0 for 3-10 times (read 3 bits) */\n for (length = tinf_read_bits(d, 3, 3); length; --length) {\n lengths[num++] = 0\n }\n break\n case 18:\n /* repeat code length 0 for 11-138 times (read 7 bits) */\n for (length = tinf_read_bits(d, 7, 11); length; --length) {\n lengths[num++] = 0\n }\n break\n default:\n /* values 0-15 represent the actual code lengths */\n lengths[num++] = sym\n break\n }\n }\n\n /* build dynamic trees */\n tinf_build_tree(lt, lengths, 0, hlit)\n tinf_build_tree(dt, lengths, hlit, hdist)\n }\n\n /* ----------------------------- *\n * -- block inflate functions -- *\n * ----------------------------- */\n\n /* given a stream and two trees, inflate a block of data */\n function tinf_inflate_block_data(d, lt, dt) {\n while (1) {\n var sym = tinf_decode_symbol(d, lt)\n\n /* check for end of block */\n if (sym === 256) {\n return TINF_OK\n }\n\n if (sym < 256) {\n d.dest[d.destLen++] = sym\n } else {\n var length, dist, offs\n var i\n\n sym -= 257\n\n /* possibly get more bits from length code */\n length = tinf_read_bits(d, length_bits[sym], length_base[sym])\n\n dist = tinf_decode_symbol(d, dt)\n\n /* possibly get more bits from distance code */\n offs = d.destLen - tinf_read_bits(d, dist_bits[dist], dist_base[dist])\n\n /* copy match */\n for (i = offs; i < offs + length; ++i) {\n d.dest[d.destLen++] = d.dest[i]\n }\n }\n }\n }\n\n /* inflate an uncompressed block of data */\n function tinf_inflate_uncompressed_block(d) {\n var length, invlength\n var i\n\n /* unread from bitbuffer */\n while (d.bitcount > 8) {\n d.sourceIndex--\n d.bitcount -= 8\n }\n\n /* get length */\n length = d.source[d.sourceIndex + 1]\n length = 256 * length + d.source[d.sourceIndex]\n\n /* get one's complement of length */\n invlength = d.source[d.sourceIndex + 3]\n invlength = 256 * invlength + d.source[d.sourceIndex + 2]\n\n /* check length */\n if (length !== (~invlength & 0x0000ffff)) {\n return TINF_DATA_ERROR\n }\n\n d.sourceIndex += 4\n\n /* copy block */\n for (i = length; i; --i) {\n d.dest[d.destLen++] = d.source[d.sourceIndex++]\n }\n\n /* make sure we start next block on a byte boundary */\n d.bitcount = 0\n\n return TINF_OK\n }\n\n /* inflate stream from source to dest */\n function tinf_uncompress(source, dest) {\n var d = new Data(source, dest)\n var bfinal, btype, res\n\n do {\n /* read final block flag */\n bfinal = tinf_getbit(d)\n\n /* read block type (2 bits) */\n btype = tinf_read_bits(d, 2, 0)\n\n /* decompress block */\n switch (btype) {\n case 0:\n /* decompress uncompressed block */\n res = tinf_inflate_uncompressed_block(d)\n break\n case 1:\n /* decompress block with fixed huffman trees */\n res = tinf_inflate_block_data(d, sltree, sdtree)\n break\n case 2:\n /* decompress block with dynamic huffman trees */\n tinf_decode_trees(d, d.ltree, d.dtree)\n res = tinf_inflate_block_data(d, d.ltree, d.dtree)\n break\n default:\n res = TINF_DATA_ERROR\n }\n\n if (res !== TINF_OK) {\n throw new Error('Data error')\n }\n } while (!bfinal)\n\n if (d.destLen < d.dest.length) {\n if (typeof d.dest.slice === 'function') {\n return d.dest.slice(0, d.destLen)\n } else {\n return d.dest.subarray(0, d.destLen)\n }\n }\n\n return d.dest\n }\n\n /* -------------------- *\n * -- initialization -- *\n * -------------------- */\n\n /* build fixed huffman trees */\n tinf_build_fixed_trees(sltree, sdtree)\n\n /* build extra bits and base tables */\n tinf_build_bits_base(length_bits, length_base, 4, 3)\n tinf_build_bits_base(dist_bits, dist_base, 2, 1)\n\n /* fix a special case */\n length_bits[28] = 0\n length_base[28] = 258\n\n var tinyInflate = tinf_uncompress\n\n // The Bounding Box object\n\n function derive(v0, v1, v2, v3, t) {\n return (\n Math.pow(1 - t, 3) * v0 +\n 3 * Math.pow(1 - t, 2) * t * v1 +\n 3 * (1 - t) * Math.pow(t, 2) * v2 +\n Math.pow(t, 3) * v3\n )\n }\n /**\n * A bounding box is an enclosing box that describes the smallest measure within which all the points lie.\n * It is used to calculate the bounding box of a glyph or text path.\n *\n * On initialization, x1/y1/x2/y2 will be NaN. Check if the bounding box is empty using `isEmpty()`.\n *\n * @exports opentype.BoundingBox\n * @class\n * @constructor\n */\n function BoundingBox() {\n this.x1 = Number.NaN\n this.y1 = Number.NaN\n this.x2 = Number.NaN\n this.y2 = Number.NaN\n }\n\n /**\n * Returns true if the bounding box is empty, that is, no points have been added to the box yet.\n */\n BoundingBox.prototype.isEmpty = function () {\n return isNaN(this.x1) || isNaN(this.y1) || isNaN(this.x2) || isNaN(this.y2)\n }\n\n /**\n * Add the point to the bounding box.\n * The x1/y1/x2/y2 coordinates of the bounding box will now encompass the given point.\n * @param {number} x - The X coordinate of the point.\n * @param {number} y - The Y coordinate of the point.\n */\n BoundingBox.prototype.addPoint = function (x, y) {\n if (typeof x === 'number') {\n if (isNaN(this.x1) || isNaN(this.x2)) {\n this.x1 = x\n this.x2 = x\n }\n if (x < this.x1) {\n this.x1 = x\n }\n if (x > this.x2) {\n this.x2 = x\n }\n }\n if (typeof y === 'number') {\n if (isNaN(this.y1) || isNaN(this.y2)) {\n this.y1 = y\n this.y2 = y\n }\n if (y < this.y1) {\n this.y1 = y\n }\n if (y > this.y2) {\n this.y2 = y\n }\n }\n }\n\n /**\n * Add a X coordinate to the bounding box.\n * This extends the bounding box to include the X coordinate.\n * This function is used internally inside of addBezier.\n * @param {number} x - The X coordinate of the point.\n */\n BoundingBox.prototype.addX = function (x) {\n this.addPoint(x, null)\n }\n\n /**\n * Add a Y coordinate to the bounding box.\n * This extends the bounding box to include the Y coordinate.\n * This function is used internally inside of addBezier.\n * @param {number} y - The Y coordinate of the point.\n */\n BoundingBox.prototype.addY = function (y) {\n this.addPoint(null, y)\n }\n\n /**\n * Add a Bézier curve to the bounding box.\n * This extends the bounding box to include the entire Bézier.\n * @param {number} x0 - The starting X coordinate.\n * @param {number} y0 - The starting Y coordinate.\n * @param {number} x1 - The X coordinate of the first control point.\n * @param {number} y1 - The Y coordinate of the first control point.\n * @param {number} x2 - The X coordinate of the second control point.\n * @param {number} y2 - The Y coordinate of the second control point.\n * @param {number} x - The ending X coordinate.\n * @param {number} y - The ending Y coordinate.\n */\n BoundingBox.prototype.addBezier = function (x0, y0, x1, y1, x2, y2, x, y) {\n // This code is based on http://nishiohirokazu.blogspot.com/2009/06/how-to-calculate-bezier-curves-bounding.html\n // and https://github.com/icons8/svg-path-bounding-box\n\n var p0 = [x0, y0]\n var p1 = [x1, y1]\n var p2 = [x2, y2]\n var p3 = [x, y]\n\n this.addPoint(x0, y0)\n this.addPoint(x, y)\n\n for (var i = 0; i <= 1; i++) {\n var b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i]\n var a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i]\n var c = 3 * p1[i] - 3 * p0[i]\n\n if (a === 0) {\n if (b === 0) {\n continue\n }\n var t = -c / b\n if (0 < t && t < 1) {\n if (i === 0) {\n this.addX(derive(p0[i], p1[i], p2[i], p3[i], t))\n }\n if (i === 1) {\n this.addY(derive(p0[i], p1[i], p2[i], p3[i], t))\n }\n }\n continue\n }\n\n var b2ac = Math.pow(b, 2) - 4 * c * a\n if (b2ac < 0) {\n continue\n }\n var t1 = (-b + Math.sqrt(b2ac)) / (2 * a)\n if (0 < t1 && t1 < 1) {\n if (i === 0) {\n this.addX(derive(p0[i], p1[i], p2[i], p3[i], t1))\n }\n if (i === 1) {\n this.addY(derive(p0[i], p1[i], p2[i], p3[i], t1))\n }\n }\n var t2 = (-b - Math.sqrt(b2ac)) / (2 * a)\n if (0 < t2 && t2 < 1) {\n if (i === 0) {\n this.addX(derive(p0[i], p1[i], p2[i], p3[i], t2))\n }\n if (i === 1) {\n this.addY(derive(p0[i], p1[i], p2[i], p3[i], t2))\n }\n }\n }\n }\n\n /**\n * Add a quadratic curve to the bounding box.\n * This extends the bounding box to include the entire quadratic curve.\n * @param {number} x0 - The starting X coordinate.\n * @param {number} y0 - The starting Y coordinate.\n * @param {number} x1 - The X coordinate of the control point.\n * @param {number} y1 - The Y coordinate of the control point.\n * @param {number} x - The ending X coordinate.\n * @param {number} y - The ending Y coordinate.\n */\n BoundingBox.prototype.addQuad = function (x0, y0, x1, y1, x, y) {\n var cp1x = x0 + (2 / 3) * (x1 - x0)\n var cp1y = y0 + (2 / 3) * (y1 - y0)\n var cp2x = cp1x + (1 / 3) * (x - x0)\n var cp2y = cp1y + (1 / 3) * (y - y0)\n this.addBezier(x0, y0, cp1x, cp1y, cp2x, cp2y, x, y)\n }\n\n // Geometric objects\n\n /**\n * A bézier path containing a set of path commands similar to a SVG path.\n * Paths can be drawn on a context using `draw`.\n * @exports opentype.Path\n * @class\n * @constructor\n */\n function Path() {\n this.commands = []\n this.fill = 'black'\n this.stroke = null\n this.strokeWidth = 1\n }\n\n /**\n * @param {number} x\n * @param {number} y\n */\n Path.prototype.moveTo = function (x, y) {\n this.commands.push({\n type: 'M',\n x: x,\n y: y,\n })\n }\n\n /**\n * @param {number} x\n * @param {number} y\n */\n Path.prototype.lineTo = function (x, y) {\n this.commands.push({\n type: 'L',\n x: x,\n y: y,\n })\n }\n\n /**\n * Draws cubic curve\n * @function\n * curveTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control 1\n * @param {number} y1 - y of control 1\n * @param {number} x2 - x of control 2\n * @param {number} y2 - y of control 2\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n */\n\n /**\n * Draws cubic curve\n * @function\n * bezierCurveTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control 1\n * @param {number} y1 - y of control 1\n * @param {number} x2 - x of control 2\n * @param {number} y2 - y of control 2\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n * @see curveTo\n */\n Path.prototype.curveTo = Path.prototype.bezierCurveTo = function (x1, y1, x2, y2, x, y) {\n this.commands.push({\n type: 'C',\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2,\n x: x,\n y: y,\n })\n }\n\n /**\n * Draws quadratic curve\n * @function\n * quadraticCurveTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control\n * @param {number} y1 - y of control\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n */\n\n /**\n * Draws quadratic curve\n * @function\n * quadTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control\n * @param {number} y1 - y of control\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n */\n Path.prototype.quadTo = Path.prototype.quadraticCurveTo = function (x1, y1, x, y) {\n this.commands.push({\n type: 'Q',\n x1: x1,\n y1: y1,\n x: x,\n y: y,\n })\n }\n\n /**\n * Closes the path\n * @function closePath\n * @memberof opentype.Path.prototype\n */\n\n /**\n * Close the path\n * @function close\n * @memberof opentype.Path.prototype\n */\n Path.prototype.close = Path.prototype.closePath = function () {\n this.commands.push({\n type: 'Z',\n })\n }\n\n /**\n * Add the given path or list of commands to the commands of this path.\n * @param {Array} pathOrCommands - another opentype.Path, an opentype.BoundingBox, or an array of commands.\n */\n Path.prototype.extend = function (pathOrCommands) {\n if (pathOrCommands.commands) {\n pathOrCommands = pathOrCommands.commands\n } else if (pathOrCommands instanceof BoundingBox) {\n var box = pathOrCommands\n this.moveTo(box.x1, box.y1)\n this.lineTo(box.x2, box.y1)\n this.lineTo(box.x2, box.y2)\n this.lineTo(box.x1, box.y2)\n this.close()\n return\n }\n\n Array.prototype.push.apply(this.commands, pathOrCommands)\n }\n\n /**\n * Calculate the bounding box of the path.\n * @returns {opentype.BoundingBox}\n */\n Path.prototype.getBoundingBox = function () {\n var box = new BoundingBox()\n\n var startX = 0\n var startY = 0\n var prevX = 0\n var prevY = 0\n for (var i = 0; i < this.commands.length; i++) {\n var cmd = this.commands[i]\n switch (cmd.type) {\n case 'M':\n box.addPoint(cmd.x, cmd.y)\n startX = prevX = cmd.x\n startY = prevY = cmd.y\n break\n case 'L':\n box.addPoint(cmd.x, cmd.y)\n prevX = cmd.x\n prevY = cmd.y\n break\n case 'Q':\n box.addQuad(prevX, prevY, cmd.x1, cmd.y1, cmd.x, cmd.y)\n prevX = cmd.x\n prevY = cmd.y\n break\n case 'C':\n box.addBezier(prevX, prevY, cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y)\n prevX = cmd.x\n prevY = cmd.y\n break\n case 'Z':\n prevX = startX\n prevY = startY\n break\n default:\n throw new Error('Unexpected path command ' + cmd.type)\n }\n }\n if (box.isEmpty()) {\n box.addPoint(0, 0)\n }\n return box\n }\n\n /**\n * Draw the path to a 2D context.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context.\n */\n Path.prototype.draw = function (ctx) {\n ctx.beginPath()\n for (var i = 0; i < this.commands.length; i += 1) {\n var cmd = this.commands[i]\n if (cmd.type === 'M') {\n ctx.moveTo(cmd.x, cmd.y)\n } else if (cmd.type === 'L') {\n ctx.lineTo(cmd.x, cmd.y)\n } else if (cmd.type === 'C') {\n ctx.bezierCurveTo(cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y)\n } else if (cmd.type === 'Q') {\n ctx.quadraticCurveTo(cmd.x1, cmd.y1, cmd.x, cmd.y)\n } else if (cmd.type === 'Z') {\n ctx.closePath()\n }\n }\n\n if (this.fill) {\n ctx.fillStyle = this.fill\n ctx.fill()\n }\n\n if (this.stroke) {\n ctx.strokeStyle = this.stroke\n ctx.lineWidth = this.strokeWidth\n ctx.stroke()\n }\n }\n\n /**\n * Convert the Path to a string of path data instructions\n * See http://www.w3.org/TR/SVG/paths.html#PathData\n * @param {number} [decimalPlaces=2] - The amount of decimal places for floating-point values\n * @return {string}\n */\n Path.prototype.toPathData = function (decimalPlaces) {\n decimalPlaces = decimalPlaces !== undefined ? decimalPlaces : 2\n\n function floatToString(v) {\n if (Math.round(v) === v) {\n return '' + Math.round(v)\n } else {\n return v.toFixed(decimalPlaces)\n }\n }\n\n function packValues() {\n var arguments$1 = arguments\n\n var s = ''\n for (var i = 0; i < arguments.length; i += 1) {\n var v = arguments$1[i]\n if (v >= 0 && i > 0) {\n s += ' '\n }\n\n s += floatToString(v)\n }\n\n return s\n }\n\n var d = ''\n for (var i = 0; i < this.commands.length; i += 1) {\n var cmd = this.commands[i]\n if (cmd.type === 'M') {\n d += 'M' + packValues(cmd.x, cmd.y)\n } else if (cmd.type === 'L') {\n d += 'L' + packValues(cmd.x, cmd.y)\n } else if (cmd.type === 'C') {\n d += 'C' + packValues(cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y)\n } else if (cmd.type === 'Q') {\n d += 'Q' + packValues(cmd.x1, cmd.y1, cmd.x, cmd.y)\n } else if (cmd.type === 'Z') {\n d += 'Z'\n }\n }\n\n return d\n }\n\n /**\n * Convert the path to an SVG element, as a string.\n * @param {number} [decimalPlaces=2] - The amount of decimal places for floating-point values\n * @return {string}\n */\n Path.prototype.toSVG = function (decimalPlaces) {\n var svg = '= 0 && v <= 255, 'Byte value should be between 0 and 255.')\n return [v]\n }\n /**\n * @constant\n * @type {number}\n */\n sizeOf.BYTE = constant(1)\n\n /**\n * Convert a 8-bit signed integer to a list of 1 byte.\n * @param {string}\n * @returns {Array}\n */\n encode.CHAR = function (v) {\n return [v.charCodeAt(0)]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.CHAR = constant(1)\n\n /**\n * Convert an ASCII string to a list of bytes.\n * @param {string}\n * @returns {Array}\n */\n encode.CHARARRAY = function (v) {\n if (typeof v === 'undefined') {\n v = ''\n console.warn(\n 'Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name.',\n )\n }\n var b = []\n for (var i = 0; i < v.length; i += 1) {\n b[i] = v.charCodeAt(i)\n }\n\n return b\n }\n\n /**\n * @param {Array}\n * @returns {number}\n */\n sizeOf.CHARARRAY = function (v) {\n if (typeof v === 'undefined') {\n return 0\n }\n return v.length\n }\n\n /**\n * Convert a 16-bit unsigned integer to a list of 2 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.USHORT = function (v) {\n return [(v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.USHORT = constant(2)\n\n /**\n * Convert a 16-bit signed integer to a list of 2 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.SHORT = function (v) {\n // Two's complement\n if (v >= LIMIT16) {\n v = -(2 * LIMIT16 - v)\n }\n\n return [(v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.SHORT = constant(2)\n\n /**\n * Convert a 24-bit unsigned integer to a list of 3 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.UINT24 = function (v) {\n return [(v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.UINT24 = constant(3)\n\n /**\n * Convert a 32-bit unsigned integer to a list of 4 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.ULONG = function (v) {\n return [(v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.ULONG = constant(4)\n\n /**\n * Convert a 32-bit unsigned integer to a list of 4 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.LONG = function (v) {\n // Two's complement\n if (v >= LIMIT32) {\n v = -(2 * LIMIT32 - v)\n }\n\n return [(v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.LONG = constant(4)\n\n encode.FIXED = encode.ULONG\n sizeOf.FIXED = sizeOf.ULONG\n\n encode.FWORD = encode.SHORT\n sizeOf.FWORD = sizeOf.SHORT\n\n encode.UFWORD = encode.USHORT\n sizeOf.UFWORD = sizeOf.USHORT\n\n /**\n * Convert a 32-bit Apple Mac timestamp integer to a list of 8 bytes, 64-bit timestamp.\n * @param {number}\n * @returns {Array}\n */\n encode.LONGDATETIME = function (v) {\n return [0, 0, 0, 0, (v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.LONGDATETIME = constant(8)\n\n /**\n * Convert a 4-char tag to a list of 4 bytes.\n * @param {string}\n * @returns {Array}\n */\n encode.TAG = function (v) {\n check.argument(v.length === 4, 'Tag should be exactly 4 ASCII characters.')\n return [v.charCodeAt(0), v.charCodeAt(1), v.charCodeAt(2), v.charCodeAt(3)]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.TAG = constant(4)\n\n // CFF data types ///////////////////////////////////////////////////////////\n\n encode.Card8 = encode.BYTE\n sizeOf.Card8 = sizeOf.BYTE\n\n encode.Card16 = encode.USHORT\n sizeOf.Card16 = sizeOf.USHORT\n\n encode.OffSize = encode.BYTE\n sizeOf.OffSize = sizeOf.BYTE\n\n encode.SID = encode.USHORT\n sizeOf.SID = sizeOf.USHORT\n\n // Convert a numeric operand or charstring number to a variable-size list of bytes.\n /**\n * Convert a numeric operand or charstring number to a variable-size list of bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.NUMBER = function (v) {\n if (v >= -107 && v <= 107) {\n return [v + 139]\n } else if (v >= 108 && v <= 1131) {\n v = v - 108\n return [(v >> 8) + 247, v & 0xff]\n } else if (v >= -1131 && v <= -108) {\n v = -v - 108\n return [(v >> 8) + 251, v & 0xff]\n } else if (v >= -32768 && v <= 32767) {\n return encode.NUMBER16(v)\n } else {\n return encode.NUMBER32(v)\n }\n }\n\n /**\n * @param {number}\n * @returns {number}\n */\n sizeOf.NUMBER = function (v) {\n return encode.NUMBER(v).length\n }\n\n /**\n * Convert a signed number between -32768 and +32767 to a three-byte value.\n * This ensures we always use three bytes, but is not the most compact format.\n * @param {number}\n * @returns {Array}\n */\n encode.NUMBER16 = function (v) {\n return [28, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.NUMBER16 = constant(3)\n\n /**\n * Convert a signed number between -(2^31) and +(2^31-1) to a five-byte value.\n * This is useful if you want to be sure you always use four bytes,\n * at the expense of wasting a few bytes for smaller numbers.\n * @param {number}\n * @returns {Array}\n */\n encode.NUMBER32 = function (v) {\n return [29, (v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.NUMBER32 = constant(5)\n\n /**\n * @param {number}\n * @returns {Array}\n */\n encode.REAL = function (v) {\n var value = v.toString()\n\n // Some numbers use an epsilon to encode the value. (e.g. JavaScript will store 0.0000001 as 1e-7)\n // This code converts it back to a number without the epsilon.\n var m = /\\.(\\d*?)(?:9{5,20}|0{5,20})\\d{0,2}(?:e(.+)|$)/.exec(value)\n if (m) {\n var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length))\n value = (Math.round(v * epsilon) / epsilon).toString()\n }\n\n var nibbles = ''\n for (var i = 0, ii = value.length; i < ii; i += 1) {\n var c = value[i]\n if (c === 'e') {\n nibbles += value[++i] === '-' ? 'c' : 'b'\n } else if (c === '.') {\n nibbles += 'a'\n } else if (c === '-') {\n nibbles += 'e'\n } else {\n nibbles += c\n }\n }\n\n nibbles += nibbles.length & 1 ? 'f' : 'ff'\n var out = [30]\n for (var i$1 = 0, ii$1 = nibbles.length; i$1 < ii$1; i$1 += 2) {\n out.push(parseInt(nibbles.substr(i$1, 2), 16))\n }\n\n return out\n }\n\n /**\n * @param {number}\n * @returns {number}\n */\n sizeOf.REAL = function (v) {\n return encode.REAL(v).length\n }\n\n encode.NAME = encode.CHARARRAY\n sizeOf.NAME = sizeOf.CHARARRAY\n\n encode.STRING = encode.CHARARRAY\n sizeOf.STRING = sizeOf.CHARARRAY\n\n /**\n * @param {DataView} data\n * @param {number} offset\n * @param {number} numBytes\n * @returns {string}\n */\n decode.UTF8 = function (data, offset, numBytes) {\n var codePoints = []\n var numChars = numBytes\n for (var j = 0; j < numChars; j++, offset += 1) {\n codePoints[j] = data.getUint8(offset)\n }\n\n return String.fromCharCode.apply(null, codePoints)\n }\n\n /**\n * @param {DataView} data\n * @param {number} offset\n * @param {number} numBytes\n * @returns {string}\n */\n decode.UTF16 = function (data, offset, numBytes) {\n var codePoints = []\n var numChars = numBytes / 2\n for (var j = 0; j < numChars; j++, offset += 2) {\n codePoints[j] = data.getUint16(offset)\n }\n\n return String.fromCharCode.apply(null, codePoints)\n }\n\n /**\n * Convert a JavaScript string to UTF16-BE.\n * @param {string}\n * @returns {Array}\n */\n encode.UTF16 = function (v) {\n var b = []\n for (var i = 0; i < v.length; i += 1) {\n var codepoint = v.charCodeAt(i)\n b[b.length] = (codepoint >> 8) & 0xff\n b[b.length] = codepoint & 0xff\n }\n\n return b\n }\n\n /**\n * @param {string}\n * @returns {number}\n */\n sizeOf.UTF16 = function (v) {\n return v.length * 2\n }\n\n // Data for converting old eight-bit Macintosh encodings to Unicode.\n // This representation is optimized for decoding; encoding is slower\n // and needs more memory. The assumption is that all opentype.js users\n // want to open fonts, but saving a font will be comparatively rare\n // so it can be more expensive. Keyed by IANA character set name.\n //\n // Python script for generating these strings:\n //\n // s = u''.join([chr(c).decode('mac_greek') for c in range(128, 256)])\n // print(s.encode('utf-8'))\n /**\n * @private\n */\n var eightBitMacEncodings = {\n // Python: 'mac_croatian'\n 'x-mac-croatian':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø' +\n '¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ',\n // Python: 'mac_cyrillic'\n 'x-mac-cyrillic':\n 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњ' +\n 'јЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю',\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/GAELIC.TXT\n 'x-mac-gaelic':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæø' +\n 'ṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ',\n // Python: 'mac_greek'\n 'x-mac-greek':\n 'Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩ' +\n 'άΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ\\u00AD',\n // Python: 'mac_iceland'\n 'x-mac-icelandic':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/INUIT.TXT\n 'x-mac-inuit':\n 'ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗ' +\n 'ᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł',\n // Python: 'mac_latin2'\n 'x-mac-ce':\n 'ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅ' +\n 'ņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ',\n // Python: 'mac_roman'\n macintosh:\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',\n // Python: 'mac_romanian'\n 'x-mac-romanian':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',\n // Python: 'mac_turkish'\n 'x-mac-turkish':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ',\n }\n\n /**\n * Decodes an old-style Macintosh string. Returns either a Unicode JavaScript\n * string, or 'undefined' if the encoding is unsupported. For example, we do\n * not support Chinese, Japanese or Korean because these would need large\n * mapping tables.\n * @param {DataView} dataView\n * @param {number} offset\n * @param {number} dataLength\n * @param {string} encoding\n * @returns {string}\n */\n decode.MACSTRING = function (dataView, offset, dataLength, encoding) {\n var table = eightBitMacEncodings[encoding]\n if (table === undefined) {\n return undefined\n }\n\n var result = ''\n for (var i = 0; i < dataLength; i++) {\n var c = dataView.getUint8(offset + i)\n // In all eight-bit Mac encodings, the characters 0x00..0x7F are\n // mapped to U+0000..U+007F; we only need to look up the others.\n if (c <= 0x7f) {\n result += String.fromCharCode(c)\n } else {\n result += table[c & 0x7f]\n }\n }\n\n return result\n }\n\n // Helper function for encode.MACSTRING. Returns a dictionary for mapping\n // Unicode character codes to their 8-bit MacOS equivalent. This table\n // is not exactly a super cheap data structure, but we do not care because\n // encoding Macintosh strings is only rarely needed in typical applications.\n var macEncodingTableCache = typeof WeakMap === 'function' && new WeakMap()\n var macEncodingCacheKeys\n var getMacEncodingTable = function (encoding) {\n // Since we use encoding as a cache key for WeakMap, it has to be\n // a String object and not a literal. And at least on NodeJS 2.10.1,\n // WeakMap requires that the same String instance is passed for cache hits.\n if (!macEncodingCacheKeys) {\n macEncodingCacheKeys = {}\n for (var e in eightBitMacEncodings) {\n /*jshint -W053 */ // Suppress \"Do not use String as a constructor.\"\n macEncodingCacheKeys[e] = new String(e)\n }\n }\n\n var cacheKey = macEncodingCacheKeys[encoding]\n if (cacheKey === undefined) {\n return undefined\n }\n\n // We can't do \"if (cache.has(key)) {return cache.get(key)}\" here:\n // since garbage collection may run at any time, it could also kick in\n // between the calls to cache.has() and cache.get(). In that case,\n // we would return 'undefined' even though we do support the encoding.\n if (macEncodingTableCache) {\n var cachedTable = macEncodingTableCache.get(cacheKey)\n if (cachedTable !== undefined) {\n return cachedTable\n }\n }\n\n var decodingTable = eightBitMacEncodings[encoding]\n if (decodingTable === undefined) {\n return undefined\n }\n\n var encodingTable = {}\n for (var i = 0; i < decodingTable.length; i++) {\n encodingTable[decodingTable.charCodeAt(i)] = i + 0x80\n }\n\n if (macEncodingTableCache) {\n macEncodingTableCache.set(cacheKey, encodingTable)\n }\n\n return encodingTable\n }\n\n /**\n * Encodes an old-style Macintosh string. Returns a byte array upon success.\n * If the requested encoding is unsupported, or if the input string contains\n * a character that cannot be expressed in the encoding, the function returns\n * 'undefined'.\n * @param {string} str\n * @param {string} encoding\n * @returns {Array}\n */\n encode.MACSTRING = function (str, encoding) {\n var table = getMacEncodingTable(encoding)\n if (table === undefined) {\n return undefined\n }\n\n var result = []\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i)\n\n // In all eight-bit Mac encodings, the characters 0x00..0x7F are\n // mapped to U+0000..U+007F; we only need to look up the others.\n if (c >= 0x80) {\n c = table[c]\n if (c === undefined) {\n // str contains a Unicode character that cannot be encoded\n // in the requested encoding.\n return undefined\n }\n }\n result[i] = c\n // result.push(c);\n }\n\n return result\n }\n\n /**\n * @param {string} str\n * @param {string} encoding\n * @returns {number}\n */\n sizeOf.MACSTRING = function (str, encoding) {\n var b = encode.MACSTRING(str, encoding)\n if (b !== undefined) {\n return b.length\n } else {\n return 0\n }\n }\n\n // Helper for encode.VARDELTAS\n function isByteEncodable(value) {\n return value >= -128 && value <= 127\n }\n\n // Helper for encode.VARDELTAS\n function encodeVarDeltaRunAsZeroes(deltas, pos, result) {\n var runLength = 0\n var numDeltas = deltas.length\n while (pos < numDeltas && runLength < 64 && deltas[pos] === 0) {\n ++pos\n ++runLength\n }\n result.push(0x80 | (runLength - 1))\n return pos\n }\n\n // Helper for encode.VARDELTAS\n function encodeVarDeltaRunAsBytes(deltas, offset, result) {\n var runLength = 0\n var numDeltas = deltas.length\n var pos = offset\n while (pos < numDeltas && runLength < 64) {\n var value = deltas[pos]\n if (!isByteEncodable(value)) {\n break\n }\n\n // Within a byte-encoded run of deltas, a single zero is best\n // stored literally as 0x00 value. However, if we have two or\n // more zeroes in a sequence, it is better to start a new run.\n // Fore example, the sequence of deltas [15, 15, 0, 15, 15]\n // becomes 6 bytes (04 0F 0F 00 0F 0F) when storing the zero\n // within the current run, but 7 bytes (01 0F 0F 80 01 0F 0F)\n // when starting a new run.\n if (value === 0 && pos + 1 < numDeltas && deltas[pos + 1] === 0) {\n break\n }\n\n ++pos\n ++runLength\n }\n result.push(runLength - 1)\n for (var i = offset; i < pos; ++i) {\n result.push((deltas[i] + 256) & 0xff)\n }\n return pos\n }\n\n // Helper for encode.VARDELTAS\n function encodeVarDeltaRunAsWords(deltas, offset, result) {\n var runLength = 0\n var numDeltas = deltas.length\n var pos = offset\n while (pos < numDeltas && runLength < 64) {\n var value = deltas[pos]\n\n // Within a word-encoded run of deltas, it is easiest to start\n // a new run (with a different encoding) whenever we encounter\n // a zero value. For example, the sequence [0x6666, 0, 0x7777]\n // needs 7 bytes when storing the zero inside the current run\n // (42 66 66 00 00 77 77), and equally 7 bytes when starting a\n // new run (40 66 66 80 40 77 77).\n if (value === 0) {\n break\n }\n\n // Within a word-encoded run of deltas, a single value in the\n // range (-128..127) should be encoded within the current run\n // because it is more compact. For example, the sequence\n // [0x6666, 2, 0x7777] becomes 7 bytes when storing the value\n // literally (42 66 66 00 02 77 77), but 8 bytes when starting\n // a new run (40 66 66 00 02 40 77 77).\n if (isByteEncodable(value) && pos + 1 < numDeltas && isByteEncodable(deltas[pos + 1])) {\n break\n }\n\n ++pos\n ++runLength\n }\n result.push(0x40 | (runLength - 1))\n for (var i = offset; i < pos; ++i) {\n var val = deltas[i]\n result.push(((val + 0x10000) >> 8) & 0xff, (val + 0x100) & 0xff)\n }\n return pos\n }\n\n /**\n * Encode a list of variation adjustment deltas.\n *\n * Variation adjustment deltas are used in ‘gvar’ and ‘cvar’ tables.\n * They indicate how points (in ‘gvar’) or values (in ‘cvar’) get adjusted\n * when generating instances of variation fonts.\n *\n * @see https://www.microsoft.com/typography/otspec/gvar.htm\n * @see https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gvar.html\n * @param {Array}\n * @return {Array}\n */\n encode.VARDELTAS = function (deltas) {\n var pos = 0\n var result = []\n while (pos < deltas.length) {\n var value = deltas[pos]\n if (value === 0) {\n pos = encodeVarDeltaRunAsZeroes(deltas, pos, result)\n } else if (value >= -128 && value <= 127) {\n pos = encodeVarDeltaRunAsBytes(deltas, pos, result)\n } else {\n pos = encodeVarDeltaRunAsWords(deltas, pos, result)\n }\n }\n return result\n }\n\n // Convert a list of values to a CFF INDEX structure.\n // The values should be objects containing name / type / value.\n /**\n * @param {Array} l\n * @returns {Array}\n */\n encode.INDEX = function (l) {\n //var offset, offsets, offsetEncoder, encodedOffsets, encodedOffset, data,\n // i, v;\n // Because we have to know which data type to use to encode the offsets,\n // we have to go through the values twice: once to encode the data and\n // calculate the offsets, then again to encode the offsets using the fitting data type.\n var offset = 1 // First offset is always 1.\n var offsets = [offset]\n var data = []\n for (var i = 0; i < l.length; i += 1) {\n var v = encode.OBJECT(l[i])\n Array.prototype.push.apply(data, v)\n offset += v.length\n offsets.push(offset)\n }\n\n if (data.length === 0) {\n return [0, 0]\n }\n\n var encodedOffsets = []\n var offSize = (1 + Math.floor(Math.log(offset) / Math.log(2)) / 8) | 0\n var offsetEncoder = [undefined, encode.BYTE, encode.USHORT, encode.UINT24, encode.ULONG][offSize]\n for (var i$1 = 0; i$1 < offsets.length; i$1 += 1) {\n var encodedOffset = offsetEncoder(offsets[i$1])\n Array.prototype.push.apply(encodedOffsets, encodedOffset)\n }\n\n return Array.prototype.concat(encode.Card16(l.length), encode.OffSize(offSize), encodedOffsets, data)\n }\n\n /**\n * @param {Array}\n * @returns {number}\n */\n sizeOf.INDEX = function (v) {\n return encode.INDEX(v).length\n }\n\n /**\n * Convert an object to a CFF DICT structure.\n * The keys should be numeric.\n * The values should be objects containing name / type / value.\n * @param {Object} m\n * @returns {Array}\n */\n encode.DICT = function (m) {\n var d = []\n var keys = Object.keys(m)\n var length = keys.length\n\n for (var i = 0; i < length; i += 1) {\n // Object.keys() return string keys, but our keys are always numeric.\n var k = parseInt(keys[i], 0)\n var v = m[k]\n // Value comes before the key.\n d = d.concat(encode.OPERAND(v.value, v.type))\n d = d.concat(encode.OPERATOR(k))\n }\n\n return d\n }\n\n /**\n * @param {Object}\n * @returns {number}\n */\n sizeOf.DICT = function (m) {\n return encode.DICT(m).length\n }\n\n /**\n * @param {number}\n * @returns {Array}\n */\n encode.OPERATOR = function (v) {\n if (v < 1200) {\n return [v]\n } else {\n return [12, v - 1200]\n }\n }\n\n /**\n * @param {Array} v\n * @param {string}\n * @returns {Array}\n */\n encode.OPERAND = function (v, type) {\n var d = []\n if (Array.isArray(type)) {\n for (var i = 0; i < type.length; i += 1) {\n check.argument(v.length === type.length, 'Not enough arguments given for type' + type)\n d = d.concat(encode.OPERAND(v[i], type[i]))\n }\n } else {\n if (type === 'SID') {\n d = d.concat(encode.NUMBER(v))\n } else if (type === 'offset') {\n // We make it easy for ourselves and always encode offsets as\n // 4 bytes. This makes offset calculation for the top dict easier.\n d = d.concat(encode.NUMBER32(v))\n } else if (type === 'number') {\n d = d.concat(encode.NUMBER(v))\n } else if (type === 'real') {\n d = d.concat(encode.REAL(v))\n } else {\n throw new Error('Unknown operand type ' + type)\n // FIXME Add support for booleans\n }\n }\n\n return d\n }\n\n encode.OP = encode.BYTE\n sizeOf.OP = sizeOf.BYTE\n\n // memoize charstring encoding using WeakMap if available\n var wmm = typeof WeakMap === 'function' && new WeakMap()\n\n /**\n * Convert a list of CharString operations to bytes.\n * @param {Array}\n * @returns {Array}\n */\n encode.CHARSTRING = function (ops) {\n // See encode.MACSTRING for why we don't do \"if (wmm && wmm.has(ops))\".\n if (wmm) {\n var cachedValue = wmm.get(ops)\n if (cachedValue !== undefined) {\n return cachedValue\n }\n }\n\n var d = []\n var length = ops.length\n\n for (var i = 0; i < length; i += 1) {\n var op = ops[i]\n d = d.concat(encode[op.type](op.value))\n }\n\n if (wmm) {\n wmm.set(ops, d)\n }\n\n return d\n }\n\n /**\n * @param {Array}\n * @returns {number}\n */\n sizeOf.CHARSTRING = function (ops) {\n return encode.CHARSTRING(ops).length\n }\n\n // Utility functions ////////////////////////////////////////////////////////\n\n /**\n * Convert an object containing name / type / value to bytes.\n * @param {Object}\n * @returns {Array}\n */\n encode.OBJECT = function (v) {\n var encodingFunction = encode[v.type]\n check.argument(encodingFunction !== undefined, 'No encoding function for type ' + v.type)\n return encodingFunction(v.value)\n }\n\n /**\n * @param {Object}\n * @returns {number}\n */\n sizeOf.OBJECT = function (v) {\n var sizeOfFunction = sizeOf[v.type]\n check.argument(sizeOfFunction !== undefined, 'No sizeOf function for type ' + v.type)\n return sizeOfFunction(v.value)\n }\n\n /**\n * Convert a table object to bytes.\n * A table contains a list of fields containing the metadata (name, type and default value).\n * The table itself has the field values set as attributes.\n * @param {opentype.Table}\n * @returns {Array}\n */\n encode.TABLE = function (table) {\n var d = []\n var length = table.fields.length\n var subtables = []\n var subtableOffsets = []\n\n for (var i = 0; i < length; i += 1) {\n var field = table.fields[i]\n var encodingFunction = encode[field.type]\n check.argument(\n encodingFunction !== undefined,\n 'No encoding function for field type ' + field.type + ' (' + field.name + ')',\n )\n var value = table[field.name]\n if (value === undefined) {\n value = field.value\n }\n\n var bytes = encodingFunction(value)\n\n if (field.type === 'TABLE') {\n subtableOffsets.push(d.length)\n d = d.concat([0, 0])\n subtables.push(bytes)\n } else {\n d = d.concat(bytes)\n }\n }\n\n for (var i$1 = 0; i$1 < subtables.length; i$1 += 1) {\n var o = subtableOffsets[i$1]\n var offset = d.length\n check.argument(offset < 65536, 'Table ' + table.tableName + ' too big.')\n d[o] = offset >> 8\n d[o + 1] = offset & 0xff\n d = d.concat(subtables[i$1])\n }\n\n return d\n }\n\n /**\n * @param {opentype.Table}\n * @returns {number}\n */\n sizeOf.TABLE = function (table) {\n var numBytes = 0\n var length = table.fields.length\n\n for (var i = 0; i < length; i += 1) {\n var field = table.fields[i]\n var sizeOfFunction = sizeOf[field.type]\n check.argument(\n sizeOfFunction !== undefined,\n 'No sizeOf function for field type ' + field.type + ' (' + field.name + ')',\n )\n var value = table[field.name]\n if (value === undefined) {\n value = field.value\n }\n\n numBytes += sizeOfFunction(value)\n\n // Subtables take 2 more bytes for offsets.\n if (field.type === 'TABLE') {\n numBytes += 2\n }\n }\n\n return numBytes\n }\n\n encode.RECORD = encode.TABLE\n sizeOf.RECORD = sizeOf.TABLE\n\n // Merge in a list of bytes.\n encode.LITERAL = function (v) {\n return v\n }\n\n sizeOf.LITERAL = function (v) {\n return v.length\n }\n\n // Table metadata\n\n /**\n * @exports opentype.Table\n * @class\n * @param {string} tableName\n * @param {Array} fields\n * @param {Object} options\n * @constructor\n */\n function Table(tableName, fields, options) {\n // For coverage tables with coverage format 2, we do not want to add the coverage data directly to the table object,\n // as this will result in wrong encoding order of the coverage data on serialization to bytes.\n // The fallback of using the field values directly when not present on the table is handled in types.encode.TABLE() already.\n if (fields.length && (fields[0].name !== 'coverageFormat' || fields[0].value === 1)) {\n for (var i = 0; i < fields.length; i += 1) {\n var field = fields[i]\n this[field.name] = field.value\n }\n }\n\n this.tableName = tableName\n this.fields = fields\n if (options) {\n var optionKeys = Object.keys(options)\n for (var i$1 = 0; i$1 < optionKeys.length; i$1 += 1) {\n var k = optionKeys[i$1]\n var v = options[k]\n if (this[k] !== undefined) {\n this[k] = v\n }\n }\n }\n }\n\n /**\n * Encodes the table and returns an array of bytes\n * @return {Array}\n */\n Table.prototype.encode = function () {\n return encode.TABLE(this)\n }\n\n /**\n * Get the size of the table.\n * @return {number}\n */\n Table.prototype.sizeOf = function () {\n return sizeOf.TABLE(this)\n }\n\n /**\n * @private\n */\n function ushortList(itemName, list, count) {\n if (count === undefined) {\n count = list.length\n }\n var fields = new Array(list.length + 1)\n fields[0] = { name: itemName + 'Count', type: 'USHORT', value: count }\n for (var i = 0; i < list.length; i++) {\n fields[i + 1] = { name: itemName + i, type: 'USHORT', value: list[i] }\n }\n return fields\n }\n\n /**\n * @private\n */\n function tableList(itemName, records, itemCallback) {\n var count = records.length\n var fields = new Array(count + 1)\n fields[0] = { name: itemName + 'Count', type: 'USHORT', value: count }\n for (var i = 0; i < count; i++) {\n fields[i + 1] = { name: itemName + i, type: 'TABLE', value: itemCallback(records[i], i) }\n }\n return fields\n }\n\n /**\n * @private\n */\n function recordList(itemName, records, itemCallback) {\n var count = records.length\n var fields = []\n fields[0] = { name: itemName + 'Count', type: 'USHORT', value: count }\n for (var i = 0; i < count; i++) {\n fields = fields.concat(itemCallback(records[i], i))\n }\n return fields\n }\n\n // Common Layout Tables\n\n /**\n * @exports opentype.Coverage\n * @class\n * @param {opentype.Table}\n * @constructor\n * @extends opentype.Table\n */\n function Coverage(coverageTable) {\n if (coverageTable.format === 1) {\n Table.call(\n this,\n 'coverageTable',\n [{ name: 'coverageFormat', type: 'USHORT', value: 1 }].concat(ushortList('glyph', coverageTable.glyphs)),\n )\n } else if (coverageTable.format === 2) {\n Table.call(\n this,\n 'coverageTable',\n [{ name: 'coverageFormat', type: 'USHORT', value: 2 }].concat(\n recordList('rangeRecord', coverageTable.ranges, function (RangeRecord) {\n return [\n { name: 'startGlyphID', type: 'USHORT', value: RangeRecord.start },\n { name: 'endGlyphID', type: 'USHORT', value: RangeRecord.end },\n { name: 'startCoverageIndex', type: 'USHORT', value: RangeRecord.index },\n ]\n }),\n ),\n )\n } else {\n check.assert(false, 'Coverage format must be 1 or 2.')\n }\n }\n Coverage.prototype = Object.create(Table.prototype)\n Coverage.prototype.constructor = Coverage\n\n function ScriptList(scriptListTable) {\n Table.call(\n this,\n 'scriptListTable',\n recordList('scriptRecord', scriptListTable, function (scriptRecord, i) {\n var script = scriptRecord.script\n var defaultLangSys = script.defaultLangSys\n check.assert(\n !!defaultLangSys,\n 'Unable to write GSUB: script ' + scriptRecord.tag + ' has no default language system.',\n )\n return [\n { name: 'scriptTag' + i, type: 'TAG', value: scriptRecord.tag },\n {\n name: 'script' + i,\n type: 'TABLE',\n value: new Table(\n 'scriptTable',\n [\n {\n name: 'defaultLangSys',\n type: 'TABLE',\n value: new Table(\n 'defaultLangSys',\n [\n { name: 'lookupOrder', type: 'USHORT', value: 0 },\n { name: 'reqFeatureIndex', type: 'USHORT', value: defaultLangSys.reqFeatureIndex },\n ].concat(ushortList('featureIndex', defaultLangSys.featureIndexes)),\n ),\n },\n ].concat(\n recordList('langSys', script.langSysRecords, function (langSysRecord, i) {\n var langSys = langSysRecord.langSys\n return [\n { name: 'langSysTag' + i, type: 'TAG', value: langSysRecord.tag },\n {\n name: 'langSys' + i,\n type: 'TABLE',\n value: new Table(\n 'langSys',\n [\n { name: 'lookupOrder', type: 'USHORT', value: 0 },\n { name: 'reqFeatureIndex', type: 'USHORT', value: langSys.reqFeatureIndex },\n ].concat(ushortList('featureIndex', langSys.featureIndexes)),\n ),\n },\n ]\n }),\n ),\n ),\n },\n ]\n }),\n )\n }\n ScriptList.prototype = Object.create(Table.prototype)\n ScriptList.prototype.constructor = ScriptList\n\n /**\n * @exports opentype.FeatureList\n * @class\n * @param {opentype.Table}\n * @constructor\n * @extends opentype.Table\n */\n function FeatureList(featureListTable) {\n Table.call(\n this,\n 'featureListTable',\n recordList('featureRecord', featureListTable, function (featureRecord, i) {\n var feature = featureRecord.feature\n return [\n { name: 'featureTag' + i, type: 'TAG', value: featureRecord.tag },\n {\n name: 'feature' + i,\n type: 'TABLE',\n value: new Table(\n 'featureTable',\n [{ name: 'featureParams', type: 'USHORT', value: feature.featureParams }].concat(\n ushortList('lookupListIndex', feature.lookupListIndexes),\n ),\n ),\n },\n ]\n }),\n )\n }\n FeatureList.prototype = Object.create(Table.prototype)\n FeatureList.prototype.constructor = FeatureList\n\n /**\n * @exports opentype.LookupList\n * @class\n * @param {opentype.Table}\n * @param {Object}\n * @constructor\n * @extends opentype.Table\n */\n function LookupList(lookupListTable, subtableMakers) {\n Table.call(\n this,\n 'lookupListTable',\n tableList('lookup', lookupListTable, function (lookupTable) {\n var subtableCallback = subtableMakers[lookupTable.lookupType]\n check.assert(!!subtableCallback, 'Unable to write GSUB lookup type ' + lookupTable.lookupType + ' tables.')\n return new Table(\n 'lookupTable',\n [\n { name: 'lookupType', type: 'USHORT', value: lookupTable.lookupType },\n { name: 'lookupFlag', type: 'USHORT', value: lookupTable.lookupFlag },\n ].concat(tableList('subtable', lookupTable.subtables, subtableCallback)),\n )\n }),\n )\n }\n LookupList.prototype = Object.create(Table.prototype)\n LookupList.prototype.constructor = LookupList\n\n // Record = same as Table, but inlined (a Table has an offset and its data is further in the stream)\n // Don't use offsets inside Records (probable bug), only in Tables.\n var table = {\n Table: Table,\n Record: Table,\n Coverage: Coverage,\n ScriptList: ScriptList,\n FeatureList: FeatureList,\n LookupList: LookupList,\n ushortList: ushortList,\n tableList: tableList,\n recordList: recordList,\n }\n\n // Parsing utility functions\n\n // Retrieve an unsigned byte from the DataView.\n function getByte(dataView, offset) {\n return dataView.getUint8(offset)\n }\n\n // Retrieve an unsigned 16-bit short from the DataView.\n // The value is stored in big endian.\n function getUShort(dataView, offset) {\n return dataView.getUint16(offset, false)\n }\n\n // Retrieve a signed 16-bit short from the DataView.\n // The value is stored in big endian.\n function getShort(dataView, offset) {\n return dataView.getInt16(offset, false)\n }\n\n // Retrieve an unsigned 32-bit long from the DataView.\n // The value is stored in big endian.\n function getULong(dataView, offset) {\n return dataView.getUint32(offset, false)\n }\n\n // Retrieve a 32-bit signed fixed-point number (16.16) from the DataView.\n // The value is stored in big endian.\n function getFixed(dataView, offset) {\n var decimal = dataView.getInt16(offset, false)\n var fraction = dataView.getUint16(offset + 2, false)\n return decimal + fraction / 65535\n }\n\n // Retrieve a 4-character tag from the DataView.\n // Tags are used to identify tables.\n function getTag(dataView, offset) {\n var tag = ''\n for (var i = offset; i < offset + 4; i += 1) {\n tag += String.fromCharCode(dataView.getInt8(i))\n }\n\n return tag\n }\n\n // Retrieve an offset from the DataView.\n // Offsets are 1 to 4 bytes in length, depending on the offSize argument.\n function getOffset(dataView, offset, offSize) {\n var v = 0\n for (var i = 0; i < offSize; i += 1) {\n v <<= 8\n v += dataView.getUint8(offset + i)\n }\n\n return v\n }\n\n // Retrieve a number of bytes from start offset to the end offset from the DataView.\n function getBytes(dataView, startOffset, endOffset) {\n var bytes = []\n for (var i = startOffset; i < endOffset; i += 1) {\n bytes.push(dataView.getUint8(i))\n }\n\n return bytes\n }\n\n // Convert the list of bytes to a string.\n function bytesToString(bytes) {\n var s = ''\n for (var i = 0; i < bytes.length; i += 1) {\n s += String.fromCharCode(bytes[i])\n }\n\n return s\n }\n\n var typeOffsets = {\n byte: 1,\n uShort: 2,\n short: 2,\n uLong: 4,\n fixed: 4,\n longDateTime: 8,\n tag: 4,\n }\n\n // A stateful parser that changes the offset whenever a value is retrieved.\n // The data is a DataView.\n function Parser(data, offset) {\n this.data = data\n this.offset = offset\n this.relativeOffset = 0\n }\n\n Parser.prototype.parseByte = function () {\n var v = this.data.getUint8(this.offset + this.relativeOffset)\n this.relativeOffset += 1\n return v\n }\n\n Parser.prototype.parseChar = function () {\n var v = this.data.getInt8(this.offset + this.relativeOffset)\n this.relativeOffset += 1\n return v\n }\n\n Parser.prototype.parseCard8 = Parser.prototype.parseByte\n\n Parser.prototype.parseUShort = function () {\n var v = this.data.getUint16(this.offset + this.relativeOffset)\n this.relativeOffset += 2\n return v\n }\n\n Parser.prototype.parseCard16 = Parser.prototype.parseUShort\n Parser.prototype.parseSID = Parser.prototype.parseUShort\n Parser.prototype.parseOffset16 = Parser.prototype.parseUShort\n\n Parser.prototype.parseShort = function () {\n var v = this.data.getInt16(this.offset + this.relativeOffset)\n this.relativeOffset += 2\n return v\n }\n\n Parser.prototype.parseF2Dot14 = function () {\n var v = this.data.getInt16(this.offset + this.relativeOffset) / 16384\n this.relativeOffset += 2\n return v\n }\n\n Parser.prototype.parseULong = function () {\n var v = getULong(this.data, this.offset + this.relativeOffset)\n this.relativeOffset += 4\n return v\n }\n\n Parser.prototype.parseOffset32 = Parser.prototype.parseULong\n\n Parser.prototype.parseFixed = function () {\n var v = getFixed(this.data, this.offset + this.relativeOffset)\n this.relativeOffset += 4\n return v\n }\n\n Parser.prototype.parseString = function (length) {\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n var string = ''\n this.relativeOffset += length\n for (var i = 0; i < length; i++) {\n string += String.fromCharCode(dataView.getUint8(offset + i))\n }\n\n return string\n }\n\n Parser.prototype.parseTag = function () {\n return this.parseString(4)\n }\n\n // LONGDATETIME is a 64-bit integer.\n // JavaScript and unix timestamps traditionally use 32 bits, so we\n // only take the last 32 bits.\n // + Since until 2038 those bits will be filled by zeros we can ignore them.\n Parser.prototype.parseLongDateTime = function () {\n var v = getULong(this.data, this.offset + this.relativeOffset + 4)\n // Subtract seconds between 01/01/1904 and 01/01/1970\n // to convert Apple Mac timestamp to Standard Unix timestamp\n v -= 2082844800\n this.relativeOffset += 8\n return v\n }\n\n Parser.prototype.parseVersion = function (minorBase) {\n var major = getUShort(this.data, this.offset + this.relativeOffset)\n\n // How to interpret the minor version is very vague in the spec. 0x5000 is 5, 0x1000 is 1\n // Default returns the correct number if minor = 0xN000 where N is 0-9\n // Set minorBase to 1 for tables that use minor = N where N is 0-9\n var minor = getUShort(this.data, this.offset + this.relativeOffset + 2)\n this.relativeOffset += 4\n if (minorBase === undefined) {\n minorBase = 0x1000\n }\n return major + minor / minorBase / 10\n }\n\n Parser.prototype.skip = function (type, amount) {\n if (amount === undefined) {\n amount = 1\n }\n\n this.relativeOffset += typeOffsets[type] * amount\n }\n\n ///// Parsing lists and records ///////////////////////////////\n\n // Parse a list of 32 bit unsigned integers.\n Parser.prototype.parseULongList = function (count) {\n if (count === undefined) {\n count = this.parseULong()\n }\n var offsets = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n offsets[i] = dataView.getUint32(offset)\n offset += 4\n }\n\n this.relativeOffset += count * 4\n return offsets\n }\n\n // Parse a list of 16 bit unsigned integers. The length of the list can be read on the stream\n // or provided as an argument.\n Parser.prototype.parseOffset16List = Parser.prototype.parseUShortList = function (count) {\n if (count === undefined) {\n count = this.parseUShort()\n }\n var offsets = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n offsets[i] = dataView.getUint16(offset)\n offset += 2\n }\n\n this.relativeOffset += count * 2\n return offsets\n }\n\n // Parses a list of 16 bit signed integers.\n Parser.prototype.parseShortList = function (count) {\n var list = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n list[i] = dataView.getInt16(offset)\n offset += 2\n }\n\n this.relativeOffset += count * 2\n return list\n }\n\n // Parses a list of bytes.\n Parser.prototype.parseByteList = function (count) {\n var list = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n list[i] = dataView.getUint8(offset++)\n }\n\n this.relativeOffset += count\n return list\n }\n\n /**\n * Parse a list of items.\n * Record count is optional, if omitted it is read from the stream.\n * itemCallback is one of the Parser methods.\n */\n Parser.prototype.parseList = function (count, itemCallback) {\n if (!itemCallback) {\n itemCallback = count\n count = this.parseUShort()\n }\n var list = new Array(count)\n for (var i = 0; i < count; i++) {\n list[i] = itemCallback.call(this)\n }\n return list\n }\n\n Parser.prototype.parseList32 = function (count, itemCallback) {\n if (!itemCallback) {\n itemCallback = count\n count = this.parseULong()\n }\n var list = new Array(count)\n for (var i = 0; i < count; i++) {\n list[i] = itemCallback.call(this)\n }\n return list\n }\n\n /**\n * Parse a list of records.\n * Record count is optional, if omitted it is read from the stream.\n * Example of recordDescription: { sequenceIndex: Parser.uShort, lookupListIndex: Parser.uShort }\n */\n Parser.prototype.parseRecordList = function (count, recordDescription) {\n // If the count argument is absent, read it in the stream.\n if (!recordDescription) {\n recordDescription = count\n count = this.parseUShort()\n }\n var records = new Array(count)\n var fields = Object.keys(recordDescription)\n for (var i = 0; i < count; i++) {\n var rec = {}\n for (var j = 0; j < fields.length; j++) {\n var fieldName = fields[j]\n var fieldType = recordDescription[fieldName]\n rec[fieldName] = fieldType.call(this)\n }\n records[i] = rec\n }\n return records\n }\n\n Parser.prototype.parseRecordList32 = function (count, recordDescription) {\n // If the count argument is absent, read it in the stream.\n if (!recordDescription) {\n recordDescription = count\n count = this.parseULong()\n }\n var records = new Array(count)\n var fields = Object.keys(recordDescription)\n for (var i = 0; i < count; i++) {\n var rec = {}\n for (var j = 0; j < fields.length; j++) {\n var fieldName = fields[j]\n var fieldType = recordDescription[fieldName]\n rec[fieldName] = fieldType.call(this)\n }\n records[i] = rec\n }\n return records\n }\n\n // Parse a data structure into an object\n // Example of description: { sequenceIndex: Parser.uShort, lookupListIndex: Parser.uShort }\n Parser.prototype.parseStruct = function (description) {\n if (typeof description === 'function') {\n return description.call(this)\n } else {\n var fields = Object.keys(description)\n var struct = {}\n for (var j = 0; j < fields.length; j++) {\n var fieldName = fields[j]\n var fieldType = description[fieldName]\n struct[fieldName] = fieldType.call(this)\n }\n return struct\n }\n }\n\n /**\n * Parse a GPOS valueRecord\n * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#value-record\n * valueFormat is optional, if omitted it is read from the stream.\n */\n Parser.prototype.parseValueRecord = function (valueFormat) {\n if (valueFormat === undefined) {\n valueFormat = this.parseUShort()\n }\n if (valueFormat === 0) {\n // valueFormat2 in kerning pairs is most often 0\n // in this case return undefined instead of an empty object, to save space\n return\n }\n var valueRecord = {}\n\n if (valueFormat & 0x0001) {\n valueRecord.xPlacement = this.parseShort()\n }\n if (valueFormat & 0x0002) {\n valueRecord.yPlacement = this.parseShort()\n }\n if (valueFormat & 0x0004) {\n valueRecord.xAdvance = this.parseShort()\n }\n if (valueFormat & 0x0008) {\n valueRecord.yAdvance = this.parseShort()\n }\n\n // Device table (non-variable font) / VariationIndex table (variable font) not supported\n // https://docs.microsoft.com/fr-fr/typography/opentype/spec/chapter2#devVarIdxTbls\n if (valueFormat & 0x0010) {\n valueRecord.xPlaDevice = undefined\n this.parseShort()\n }\n if (valueFormat & 0x0020) {\n valueRecord.yPlaDevice = undefined\n this.parseShort()\n }\n if (valueFormat & 0x0040) {\n valueRecord.xAdvDevice = undefined\n this.parseShort()\n }\n if (valueFormat & 0x0080) {\n valueRecord.yAdvDevice = undefined\n this.parseShort()\n }\n\n return valueRecord\n }\n\n /**\n * Parse a list of GPOS valueRecords\n * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#value-record\n * valueFormat and valueCount are read from the stream.\n */\n Parser.prototype.parseValueRecordList = function () {\n var valueFormat = this.parseUShort()\n var valueCount = this.parseUShort()\n var values = new Array(valueCount)\n for (var i = 0; i < valueCount; i++) {\n values[i] = this.parseValueRecord(valueFormat)\n }\n return values\n }\n\n Parser.prototype.parsePointer = function (description) {\n var structOffset = this.parseOffset16()\n if (structOffset > 0) {\n // NULL offset => return undefined\n return new Parser(this.data, this.offset + structOffset).parseStruct(description)\n }\n return undefined\n }\n\n Parser.prototype.parsePointer32 = function (description) {\n var structOffset = this.parseOffset32()\n if (structOffset > 0) {\n // NULL offset => return undefined\n return new Parser(this.data, this.offset + structOffset).parseStruct(description)\n }\n return undefined\n }\n\n /**\n * Parse a list of offsets to lists of 16-bit integers,\n * or a list of offsets to lists of offsets to any kind of items.\n * If itemCallback is not provided, a list of list of UShort is assumed.\n * If provided, itemCallback is called on each item and must parse the item.\n * See examples in tables/gsub.js\n */\n Parser.prototype.parseListOfLists = function (itemCallback) {\n var offsets = this.parseOffset16List()\n var count = offsets.length\n var relativeOffset = this.relativeOffset\n var list = new Array(count)\n for (var i = 0; i < count; i++) {\n var start = offsets[i]\n if (start === 0) {\n // NULL offset\n // Add i as owned property to list. Convenient with assert.\n list[i] = undefined\n continue\n }\n this.relativeOffset = start\n if (itemCallback) {\n var subOffsets = this.parseOffset16List()\n var subList = new Array(subOffsets.length)\n for (var j = 0; j < subOffsets.length; j++) {\n this.relativeOffset = start + subOffsets[j]\n subList[j] = itemCallback.call(this)\n }\n list[i] = subList\n } else {\n list[i] = this.parseUShortList()\n }\n }\n this.relativeOffset = relativeOffset\n return list\n }\n\n ///// Complex tables parsing //////////////////////////////////\n\n // Parse a coverage table in a GSUB, GPOS or GDEF table.\n // https://www.microsoft.com/typography/OTSPEC/chapter2.htm\n // parser.offset must point to the start of the table containing the coverage.\n Parser.prototype.parseCoverage = function () {\n var startOffset = this.offset + this.relativeOffset\n var format = this.parseUShort()\n var count = this.parseUShort()\n if (format === 1) {\n return {\n format: 1,\n glyphs: this.parseUShortList(count),\n }\n } else if (format === 2) {\n var ranges = new Array(count)\n for (var i = 0; i < count; i++) {\n ranges[i] = {\n start: this.parseUShort(),\n end: this.parseUShort(),\n index: this.parseUShort(),\n }\n }\n return {\n format: 2,\n ranges: ranges,\n }\n }\n throw new Error('0x' + startOffset.toString(16) + ': Coverage format must be 1 or 2.')\n }\n\n // Parse a Class Definition Table in a GSUB, GPOS or GDEF table.\n // https://www.microsoft.com/typography/OTSPEC/chapter2.htm\n Parser.prototype.parseClassDef = function () {\n var startOffset = this.offset + this.relativeOffset\n var format = this.parseUShort()\n if (format === 1) {\n return {\n format: 1,\n startGlyph: this.parseUShort(),\n classes: this.parseUShortList(),\n }\n } else if (format === 2) {\n return {\n format: 2,\n ranges: this.parseRecordList({\n start: Parser.uShort,\n end: Parser.uShort,\n classId: Parser.uShort,\n }),\n }\n }\n throw new Error('0x' + startOffset.toString(16) + ': ClassDef format must be 1 or 2.')\n }\n\n ///// Static methods ///////////////////////////////////\n // These convenience methods can be used as callbacks and should be called with \"this\" context set to a Parser instance.\n\n Parser.list = function (count, itemCallback) {\n return function () {\n return this.parseList(count, itemCallback)\n }\n }\n\n Parser.list32 = function (count, itemCallback) {\n return function () {\n return this.parseList32(count, itemCallback)\n }\n }\n\n Parser.recordList = function (count, recordDescription) {\n return function () {\n return this.parseRecordList(count, recordDescription)\n }\n }\n\n Parser.recordList32 = function (count, recordDescription) {\n return function () {\n return this.parseRecordList32(count, recordDescription)\n }\n }\n\n Parser.pointer = function (description) {\n return function () {\n return this.parsePointer(description)\n }\n }\n\n Parser.pointer32 = function (description) {\n return function () {\n return this.parsePointer32(description)\n }\n }\n\n Parser.tag = Parser.prototype.parseTag\n Parser.byte = Parser.prototype.parseByte\n Parser.uShort = Parser.offset16 = Parser.prototype.parseUShort\n Parser.uShortList = Parser.prototype.parseUShortList\n Parser.uLong = Parser.offset32 = Parser.prototype.parseULong\n Parser.uLongList = Parser.prototype.parseULongList\n Parser.struct = Parser.prototype.parseStruct\n Parser.coverage = Parser.prototype.parseCoverage\n Parser.classDef = Parser.prototype.parseClassDef\n\n ///// Script, Feature, Lookup lists ///////////////////////////////////////////////\n // https://www.microsoft.com/typography/OTSPEC/chapter2.htm\n\n var langSysTable = {\n reserved: Parser.uShort,\n reqFeatureIndex: Parser.uShort,\n featureIndexes: Parser.uShortList,\n }\n\n Parser.prototype.parseScriptList = function () {\n return (\n this.parsePointer(\n Parser.recordList({\n tag: Parser.tag,\n script: Parser.pointer({\n defaultLangSys: Parser.pointer(langSysTable),\n langSysRecords: Parser.recordList({\n tag: Parser.tag,\n langSys: Parser.pointer(langSysTable),\n }),\n }),\n }),\n ) || []\n )\n }\n\n Parser.prototype.parseFeatureList = function () {\n return (\n this.parsePointer(\n Parser.recordList({\n tag: Parser.tag,\n feature: Parser.pointer({\n featureParams: Parser.offset16,\n lookupListIndexes: Parser.uShortList,\n }),\n }),\n ) || []\n )\n }\n\n Parser.prototype.parseLookupList = function (lookupTableParsers) {\n return (\n this.parsePointer(\n Parser.list(\n Parser.pointer(function () {\n var lookupType = this.parseUShort()\n check.argument(1 <= lookupType && lookupType <= 9, 'GPOS/GSUB lookup type ' + lookupType + ' unknown.')\n var lookupFlag = this.parseUShort()\n var useMarkFilteringSet = lookupFlag & 0x10\n return {\n lookupType: lookupType,\n lookupFlag: lookupFlag,\n subtables: this.parseList(Parser.pointer(lookupTableParsers[lookupType])),\n markFilteringSet: useMarkFilteringSet ? this.parseUShort() : undefined,\n }\n }),\n ),\n ) || []\n )\n }\n\n Parser.prototype.parseFeatureVariationsList = function () {\n return (\n this.parsePointer32(function () {\n var majorVersion = this.parseUShort()\n var minorVersion = this.parseUShort()\n check.argument(majorVersion === 1 && minorVersion < 1, 'GPOS/GSUB feature variations table unknown.')\n var featureVariations = this.parseRecordList32({\n conditionSetOffset: Parser.offset32,\n featureTableSubstitutionOffset: Parser.offset32,\n })\n return featureVariations\n }) || []\n )\n }\n\n var parse = {\n getByte: getByte,\n getCard8: getByte,\n getUShort: getUShort,\n getCard16: getUShort,\n getShort: getShort,\n getULong: getULong,\n getFixed: getFixed,\n getTag: getTag,\n getOffset: getOffset,\n getBytes: getBytes,\n bytesToString: bytesToString,\n Parser: Parser,\n }\n\n // The `cmap` table stores the mappings from characters to glyphs.\n\n function parseCmapTableFormat12(cmap, p) {\n //Skip reserved.\n p.parseUShort()\n\n // Length in bytes of the sub-tables.\n cmap.length = p.parseULong()\n cmap.language = p.parseULong()\n\n var groupCount\n cmap.groupCount = groupCount = p.parseULong()\n cmap.glyphIndexMap = {}\n\n for (var i = 0; i < groupCount; i += 1) {\n var startCharCode = p.parseULong()\n var endCharCode = p.parseULong()\n var startGlyphId = p.parseULong()\n\n for (var c = startCharCode; c <= endCharCode; c += 1) {\n cmap.glyphIndexMap[c] = startGlyphId\n startGlyphId++\n }\n }\n }\n\n function parseCmapTableFormat4(cmap, p, data, start, offset) {\n // Length in bytes of the sub-tables.\n cmap.length = p.parseUShort()\n cmap.language = p.parseUShort()\n\n // segCount is stored x 2.\n var segCount\n cmap.segCount = segCount = p.parseUShort() >> 1\n\n // Skip searchRange, entrySelector, rangeShift.\n p.skip('uShort', 3)\n\n // The \"unrolled\" mapping from character codes to glyph indices.\n cmap.glyphIndexMap = {}\n var endCountParser = new parse.Parser(data, start + offset + 14)\n var startCountParser = new parse.Parser(data, start + offset + 16 + segCount * 2)\n var idDeltaParser = new parse.Parser(data, start + offset + 16 + segCount * 4)\n var idRangeOffsetParser = new parse.Parser(data, start + offset + 16 + segCount * 6)\n var glyphIndexOffset = start + offset + 16 + segCount * 8\n for (var i = 0; i < segCount - 1; i += 1) {\n var glyphIndex = void 0\n var endCount = endCountParser.parseUShort()\n var startCount = startCountParser.parseUShort()\n var idDelta = idDeltaParser.parseShort()\n var idRangeOffset = idRangeOffsetParser.parseUShort()\n for (var c = startCount; c <= endCount; c += 1) {\n if (idRangeOffset !== 0) {\n // The idRangeOffset is relative to the current position in the idRangeOffset array.\n // Take the current offset in the idRangeOffset array.\n glyphIndexOffset = idRangeOffsetParser.offset + idRangeOffsetParser.relativeOffset - 2\n\n // Add the value of the idRangeOffset, which will move us into the glyphIndex array.\n glyphIndexOffset += idRangeOffset\n\n // Then add the character index of the current segment, multiplied by 2 for USHORTs.\n glyphIndexOffset += (c - startCount) * 2\n glyphIndex = parse.getUShort(data, glyphIndexOffset)\n if (glyphIndex !== 0) {\n glyphIndex = (glyphIndex + idDelta) & 0xffff\n }\n } else {\n glyphIndex = (c + idDelta) & 0xffff\n }\n\n cmap.glyphIndexMap[c] = glyphIndex\n }\n }\n }\n\n // Parse the `cmap` table. This table stores the mappings from characters to glyphs.\n // There are many available formats, but we only support the Windows format 4 and 12.\n // This function returns a `CmapEncoding` object or null if no supported format could be found.\n function parseCmapTable(data, start) {\n var cmap = {}\n cmap.version = parse.getUShort(data, start)\n check.argument(cmap.version === 0, 'cmap table version should be 0.')\n\n // The cmap table can contain many sub-tables, each with their own format.\n // We're only interested in a \"platform 0\" (Unicode format) and \"platform 3\" (Windows format) table.\n cmap.numTables = parse.getUShort(data, start + 2)\n var offset = -1\n for (var i = cmap.numTables - 1; i >= 0; i -= 1) {\n var platformId = parse.getUShort(data, start + 4 + i * 8)\n var encodingId = parse.getUShort(data, start + 4 + i * 8 + 2)\n if (\n (platformId === 3 && (encodingId === 0 || encodingId === 1 || encodingId === 10)) ||\n (platformId === 0 &&\n (encodingId === 0 || encodingId === 1 || encodingId === 2 || encodingId === 3 || encodingId === 4))\n ) {\n offset = parse.getULong(data, start + 4 + i * 8 + 4)\n break\n }\n }\n\n if (offset === -1) {\n // There is no cmap table in the font that we support.\n throw new Error('No valid cmap sub-tables found.')\n }\n\n var p = new parse.Parser(data, start + offset)\n cmap.format = p.parseUShort()\n\n if (cmap.format === 12) {\n parseCmapTableFormat12(cmap, p)\n } else if (cmap.format === 4) {\n parseCmapTableFormat4(cmap, p, data, start, offset)\n } else {\n throw new Error('Only format 4 and 12 cmap tables are supported (found format ' + cmap.format + ').')\n }\n\n return cmap\n }\n\n function addSegment(t, code, glyphIndex) {\n t.segments.push({\n end: code,\n start: code,\n delta: -(code - glyphIndex),\n offset: 0,\n glyphIndex: glyphIndex,\n })\n }\n\n function addTerminatorSegment(t) {\n t.segments.push({\n end: 0xffff,\n start: 0xffff,\n delta: 1,\n offset: 0,\n })\n }\n\n // Make cmap table, format 4 by default, 12 if needed only\n function makeCmapTable(glyphs) {\n // Plan 0 is the base Unicode Plan but emojis, for example are on another plan, and needs cmap 12 format (with 32bit)\n var isPlan0Only = true\n var i\n\n // Check if we need to add cmap format 12 or if format 4 only is fine\n for (i = glyphs.length - 1; i > 0; i -= 1) {\n var g = glyphs.get(i)\n if (g.unicode > 65535) {\n console.log('Adding CMAP format 12 (needed!)')\n isPlan0Only = false\n break\n }\n }\n\n var cmapTable = [\n { name: 'version', type: 'USHORT', value: 0 },\n { name: 'numTables', type: 'USHORT', value: isPlan0Only ? 1 : 2 },\n\n // CMAP 4 header\n { name: 'platformID', type: 'USHORT', value: 3 },\n { name: 'encodingID', type: 'USHORT', value: 1 },\n { name: 'offset', type: 'ULONG', value: isPlan0Only ? 12 : 12 + 8 },\n ]\n\n if (!isPlan0Only) {\n cmapTable = cmapTable.concat([\n // CMAP 12 header\n { name: 'cmap12PlatformID', type: 'USHORT', value: 3 }, // We encode only for PlatformID = 3 (Windows) because it is supported everywhere\n { name: 'cmap12EncodingID', type: 'USHORT', value: 10 },\n { name: 'cmap12Offset', type: 'ULONG', value: 0 },\n ])\n }\n\n cmapTable = cmapTable.concat([\n // CMAP 4 Subtable\n { name: 'format', type: 'USHORT', value: 4 },\n { name: 'cmap4Length', type: 'USHORT', value: 0 },\n { name: 'language', type: 'USHORT', value: 0 },\n { name: 'segCountX2', type: 'USHORT', value: 0 },\n { name: 'searchRange', type: 'USHORT', value: 0 },\n { name: 'entrySelector', type: 'USHORT', value: 0 },\n { name: 'rangeShift', type: 'USHORT', value: 0 },\n ])\n\n var t = new table.Table('cmap', cmapTable)\n\n t.segments = []\n for (i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n for (var j = 0; j < glyph.unicodes.length; j += 1) {\n addSegment(t, glyph.unicodes[j], i)\n }\n\n t.segments = t.segments.sort(function (a, b) {\n return a.start - b.start\n })\n }\n\n addTerminatorSegment(t)\n\n var segCount = t.segments.length\n var segCountToRemove = 0\n\n // CMAP 4\n // Set up parallel segment arrays.\n var endCounts = []\n var startCounts = []\n var idDeltas = []\n var idRangeOffsets = []\n var glyphIds = []\n\n // CMAP 12\n var cmap12Groups = []\n\n // Reminder this loop is not following the specification at 100%\n // The specification -> find suites of characters and make a group\n // Here we're doing one group for each letter\n // Doing as the spec can save 8 times (or more) space\n for (i = 0; i < segCount; i += 1) {\n var segment = t.segments[i]\n\n // CMAP 4\n if (segment.end <= 65535 && segment.start <= 65535) {\n endCounts = endCounts.concat({ name: 'end_' + i, type: 'USHORT', value: segment.end })\n startCounts = startCounts.concat({ name: 'start_' + i, type: 'USHORT', value: segment.start })\n idDeltas = idDeltas.concat({ name: 'idDelta_' + i, type: 'SHORT', value: segment.delta })\n idRangeOffsets = idRangeOffsets.concat({ name: 'idRangeOffset_' + i, type: 'USHORT', value: segment.offset })\n if (segment.glyphId !== undefined) {\n glyphIds = glyphIds.concat({ name: 'glyph_' + i, type: 'USHORT', value: segment.glyphId })\n }\n } else {\n // Skip Unicode > 65535 (16bit unsigned max) for CMAP 4, will be added in CMAP 12\n segCountToRemove += 1\n }\n\n // CMAP 12\n // Skip Terminator Segment\n if (!isPlan0Only && segment.glyphIndex !== undefined) {\n cmap12Groups = cmap12Groups.concat({ name: 'cmap12Start_' + i, type: 'ULONG', value: segment.start })\n cmap12Groups = cmap12Groups.concat({ name: 'cmap12End_' + i, type: 'ULONG', value: segment.end })\n cmap12Groups = cmap12Groups.concat({ name: 'cmap12Glyph_' + i, type: 'ULONG', value: segment.glyphIndex })\n }\n }\n\n // CMAP 4 Subtable\n t.segCountX2 = (segCount - segCountToRemove) * 2\n t.searchRange = Math.pow(2, Math.floor(Math.log(segCount - segCountToRemove) / Math.log(2))) * 2\n t.entrySelector = Math.log(t.searchRange / 2) / Math.log(2)\n t.rangeShift = t.segCountX2 - t.searchRange\n\n t.fields = t.fields.concat(endCounts)\n t.fields.push({ name: 'reservedPad', type: 'USHORT', value: 0 })\n t.fields = t.fields.concat(startCounts)\n t.fields = t.fields.concat(idDeltas)\n t.fields = t.fields.concat(idRangeOffsets)\n t.fields = t.fields.concat(glyphIds)\n\n t.cmap4Length =\n 14 + // Subtable header\n endCounts.length * 2 +\n 2 + // reservedPad\n startCounts.length * 2 +\n idDeltas.length * 2 +\n idRangeOffsets.length * 2 +\n glyphIds.length * 2\n\n if (!isPlan0Only) {\n // CMAP 12 Subtable\n var cmap12Length =\n 16 + // Subtable header\n cmap12Groups.length * 4\n\n t.cmap12Offset = 12 + 2 * 2 + 4 + t.cmap4Length\n t.fields = t.fields.concat([\n { name: 'cmap12Format', type: 'USHORT', value: 12 },\n { name: 'cmap12Reserved', type: 'USHORT', value: 0 },\n { name: 'cmap12Length', type: 'ULONG', value: cmap12Length },\n { name: 'cmap12Language', type: 'ULONG', value: 0 },\n { name: 'cmap12nGroups', type: 'ULONG', value: cmap12Groups.length / 3 },\n ])\n\n t.fields = t.fields.concat(cmap12Groups)\n }\n\n return t\n }\n\n var cmap = { parse: parseCmapTable, make: makeCmapTable }\n\n // Glyph encoding\n\n var cffStandardStrings = [\n '.notdef',\n 'space',\n 'exclam',\n 'quotedbl',\n 'numbersign',\n 'dollar',\n 'percent',\n 'ampersand',\n 'quoteright',\n 'parenleft',\n 'parenright',\n 'asterisk',\n 'plus',\n 'comma',\n 'hyphen',\n 'period',\n 'slash',\n 'zero',\n 'one',\n 'two',\n 'three',\n 'four',\n 'five',\n 'six',\n 'seven',\n 'eight',\n 'nine',\n 'colon',\n 'semicolon',\n 'less',\n 'equal',\n 'greater',\n 'question',\n 'at',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'R',\n 'S',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'bracketleft',\n 'backslash',\n 'bracketright',\n 'asciicircum',\n 'underscore',\n 'quoteleft',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n 'braceleft',\n 'bar',\n 'braceright',\n 'asciitilde',\n 'exclamdown',\n 'cent',\n 'sterling',\n 'fraction',\n 'yen',\n 'florin',\n 'section',\n 'currency',\n 'quotesingle',\n 'quotedblleft',\n 'guillemotleft',\n 'guilsinglleft',\n 'guilsinglright',\n 'fi',\n 'fl',\n 'endash',\n 'dagger',\n 'daggerdbl',\n 'periodcentered',\n 'paragraph',\n 'bullet',\n 'quotesinglbase',\n 'quotedblbase',\n 'quotedblright',\n 'guillemotright',\n 'ellipsis',\n 'perthousand',\n 'questiondown',\n 'grave',\n 'acute',\n 'circumflex',\n 'tilde',\n 'macron',\n 'breve',\n 'dotaccent',\n 'dieresis',\n 'ring',\n 'cedilla',\n 'hungarumlaut',\n 'ogonek',\n 'caron',\n 'emdash',\n 'AE',\n 'ordfeminine',\n 'Lslash',\n 'Oslash',\n 'OE',\n 'ordmasculine',\n 'ae',\n 'dotlessi',\n 'lslash',\n 'oslash',\n 'oe',\n 'germandbls',\n 'onesuperior',\n 'logicalnot',\n 'mu',\n 'trademark',\n 'Eth',\n 'onehalf',\n 'plusminus',\n 'Thorn',\n 'onequarter',\n 'divide',\n 'brokenbar',\n 'degree',\n 'thorn',\n 'threequarters',\n 'twosuperior',\n 'registered',\n 'minus',\n 'eth',\n 'multiply',\n 'threesuperior',\n 'copyright',\n 'Aacute',\n 'Acircumflex',\n 'Adieresis',\n 'Agrave',\n 'Aring',\n 'Atilde',\n 'Ccedilla',\n 'Eacute',\n 'Ecircumflex',\n 'Edieresis',\n 'Egrave',\n 'Iacute',\n 'Icircumflex',\n 'Idieresis',\n 'Igrave',\n 'Ntilde',\n 'Oacute',\n 'Ocircumflex',\n 'Odieresis',\n 'Ograve',\n 'Otilde',\n 'Scaron',\n 'Uacute',\n 'Ucircumflex',\n 'Udieresis',\n 'Ugrave',\n 'Yacute',\n 'Ydieresis',\n 'Zcaron',\n 'aacute',\n 'acircumflex',\n 'adieresis',\n 'agrave',\n 'aring',\n 'atilde',\n 'ccedilla',\n 'eacute',\n 'ecircumflex',\n 'edieresis',\n 'egrave',\n 'iacute',\n 'icircumflex',\n 'idieresis',\n 'igrave',\n 'ntilde',\n 'oacute',\n 'ocircumflex',\n 'odieresis',\n 'ograve',\n 'otilde',\n 'scaron',\n 'uacute',\n 'ucircumflex',\n 'udieresis',\n 'ugrave',\n 'yacute',\n 'ydieresis',\n 'zcaron',\n 'exclamsmall',\n 'Hungarumlautsmall',\n 'dollaroldstyle',\n 'dollarsuperior',\n 'ampersandsmall',\n 'Acutesmall',\n 'parenleftsuperior',\n 'parenrightsuperior',\n '266 ff',\n 'onedotenleader',\n 'zerooldstyle',\n 'oneoldstyle',\n 'twooldstyle',\n 'threeoldstyle',\n 'fouroldstyle',\n 'fiveoldstyle',\n 'sixoldstyle',\n 'sevenoldstyle',\n 'eightoldstyle',\n 'nineoldstyle',\n 'commasuperior',\n 'threequartersemdash',\n 'periodsuperior',\n 'questionsmall',\n 'asuperior',\n 'bsuperior',\n 'centsuperior',\n 'dsuperior',\n 'esuperior',\n 'isuperior',\n 'lsuperior',\n 'msuperior',\n 'nsuperior',\n 'osuperior',\n 'rsuperior',\n 'ssuperior',\n 'tsuperior',\n 'ff',\n 'ffi',\n 'ffl',\n 'parenleftinferior',\n 'parenrightinferior',\n 'Circumflexsmall',\n 'hyphensuperior',\n 'Gravesmall',\n 'Asmall',\n 'Bsmall',\n 'Csmall',\n 'Dsmall',\n 'Esmall',\n 'Fsmall',\n 'Gsmall',\n 'Hsmall',\n 'Ismall',\n 'Jsmall',\n 'Ksmall',\n 'Lsmall',\n 'Msmall',\n 'Nsmall',\n 'Osmall',\n 'Psmall',\n 'Qsmall',\n 'Rsmall',\n 'Ssmall',\n 'Tsmall',\n 'Usmall',\n 'Vsmall',\n 'Wsmall',\n 'Xsmall',\n 'Ysmall',\n 'Zsmall',\n 'colonmonetary',\n 'onefitted',\n 'rupiah',\n 'Tildesmall',\n 'exclamdownsmall',\n 'centoldstyle',\n 'Lslashsmall',\n 'Scaronsmall',\n 'Zcaronsmall',\n 'Dieresissmall',\n 'Brevesmall',\n 'Caronsmall',\n 'Dotaccentsmall',\n 'Macronsmall',\n 'figuredash',\n 'hypheninferior',\n 'Ogoneksmall',\n 'Ringsmall',\n 'Cedillasmall',\n 'questiondownsmall',\n 'oneeighth',\n 'threeeighths',\n 'fiveeighths',\n 'seveneighths',\n 'onethird',\n 'twothirds',\n 'zerosuperior',\n 'foursuperior',\n 'fivesuperior',\n 'sixsuperior',\n 'sevensuperior',\n 'eightsuperior',\n 'ninesuperior',\n 'zeroinferior',\n 'oneinferior',\n 'twoinferior',\n 'threeinferior',\n 'fourinferior',\n 'fiveinferior',\n 'sixinferior',\n 'seveninferior',\n 'eightinferior',\n 'nineinferior',\n 'centinferior',\n 'dollarinferior',\n 'periodinferior',\n 'commainferior',\n 'Agravesmall',\n 'Aacutesmall',\n 'Acircumflexsmall',\n 'Atildesmall',\n 'Adieresissmall',\n 'Aringsmall',\n 'AEsmall',\n 'Ccedillasmall',\n 'Egravesmall',\n 'Eacutesmall',\n 'Ecircumflexsmall',\n 'Edieresissmall',\n 'Igravesmall',\n 'Iacutesmall',\n 'Icircumflexsmall',\n 'Idieresissmall',\n 'Ethsmall',\n 'Ntildesmall',\n 'Ogravesmall',\n 'Oacutesmall',\n 'Ocircumflexsmall',\n 'Otildesmall',\n 'Odieresissmall',\n 'OEsmall',\n 'Oslashsmall',\n 'Ugravesmall',\n 'Uacutesmall',\n 'Ucircumflexsmall',\n 'Udieresissmall',\n 'Yacutesmall',\n 'Thornsmall',\n 'Ydieresissmall',\n '001.000',\n '001.001',\n '001.002',\n '001.003',\n 'Black',\n 'Bold',\n 'Book',\n 'Light',\n 'Medium',\n 'Regular',\n 'Roman',\n 'Semibold',\n ]\n\n var cffStandardEncoding = [\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'space',\n 'exclam',\n 'quotedbl',\n 'numbersign',\n 'dollar',\n 'percent',\n 'ampersand',\n 'quoteright',\n 'parenleft',\n 'parenright',\n 'asterisk',\n 'plus',\n 'comma',\n 'hyphen',\n 'period',\n 'slash',\n 'zero',\n 'one',\n 'two',\n 'three',\n 'four',\n 'five',\n 'six',\n 'seven',\n 'eight',\n 'nine',\n 'colon',\n 'semicolon',\n 'less',\n 'equal',\n 'greater',\n 'question',\n 'at',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'R',\n 'S',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'bracketleft',\n 'backslash',\n 'bracketright',\n 'asciicircum',\n 'underscore',\n 'quoteleft',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n 'braceleft',\n 'bar',\n 'braceright',\n 'asciitilde',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'exclamdown',\n 'cent',\n 'sterling',\n 'fraction',\n 'yen',\n 'florin',\n 'section',\n 'currency',\n 'quotesingle',\n 'quotedblleft',\n 'guillemotleft',\n 'guilsinglleft',\n 'guilsinglright',\n 'fi',\n 'fl',\n '',\n 'endash',\n 'dagger',\n 'daggerdbl',\n 'periodcentered',\n '',\n 'paragraph',\n 'bullet',\n 'quotesinglbase',\n 'quotedblbase',\n 'quotedblright',\n 'guillemotright',\n 'ellipsis',\n 'perthousand',\n '',\n 'questiondown',\n '',\n 'grave',\n 'acute',\n 'circumflex',\n 'tilde',\n 'macron',\n 'breve',\n 'dotaccent',\n 'dieresis',\n '',\n 'ring',\n 'cedilla',\n '',\n 'hungarumlaut',\n 'ogonek',\n 'caron',\n 'emdash',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'AE',\n '',\n 'ordfeminine',\n '',\n '',\n '',\n '',\n 'Lslash',\n 'Oslash',\n 'OE',\n 'ordmasculine',\n '',\n '',\n '',\n '',\n '',\n 'ae',\n '',\n '',\n '',\n 'dotlessi',\n '',\n '',\n 'lslash',\n 'oslash',\n 'oe',\n 'germandbls',\n ]\n\n var cffExpertEncoding = [\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'space',\n 'exclamsmall',\n 'Hungarumlautsmall',\n '',\n 'dollaroldstyle',\n 'dollarsuperior',\n 'ampersandsmall',\n 'Acutesmall',\n 'parenleftsuperior',\n 'parenrightsuperior',\n 'twodotenleader',\n 'onedotenleader',\n 'comma',\n 'hyphen',\n 'period',\n 'fraction',\n 'zerooldstyle',\n 'oneoldstyle',\n 'twooldstyle',\n 'threeoldstyle',\n 'fouroldstyle',\n 'fiveoldstyle',\n 'sixoldstyle',\n 'sevenoldstyle',\n 'eightoldstyle',\n 'nineoldstyle',\n 'colon',\n 'semicolon',\n 'commasuperior',\n 'threequartersemdash',\n 'periodsuperior',\n 'questionsmall',\n '',\n 'asuperior',\n 'bsuperior',\n 'centsuperior',\n 'dsuperior',\n 'esuperior',\n '',\n '',\n 'isuperior',\n '',\n '',\n 'lsuperior',\n 'msuperior',\n 'nsuperior',\n 'osuperior',\n '',\n '',\n 'rsuperior',\n 'ssuperior',\n 'tsuperior',\n '',\n 'ff',\n 'fi',\n 'fl',\n 'ffi',\n 'ffl',\n 'parenleftinferior',\n '',\n 'parenrightinferior',\n 'Circumflexsmall',\n 'hyphensuperior',\n 'Gravesmall',\n 'Asmall',\n 'Bsmall',\n 'Csmall',\n 'Dsmall',\n 'Esmall',\n 'Fsmall',\n 'Gsmall',\n 'Hsmall',\n 'Ismall',\n 'Jsmall',\n 'Ksmall',\n 'Lsmall',\n 'Msmall',\n 'Nsmall',\n 'Osmall',\n 'Psmall',\n 'Qsmall',\n 'Rsmall',\n 'Ssmall',\n 'Tsmall',\n 'Usmall',\n 'Vsmall',\n 'Wsmall',\n 'Xsmall',\n 'Ysmall',\n 'Zsmall',\n 'colonmonetary',\n 'onefitted',\n 'rupiah',\n 'Tildesmall',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'exclamdownsmall',\n 'centoldstyle',\n 'Lslashsmall',\n '',\n '',\n 'Scaronsmall',\n 'Zcaronsmall',\n 'Dieresissmall',\n 'Brevesmall',\n 'Caronsmall',\n '',\n 'Dotaccentsmall',\n '',\n '',\n 'Macronsmall',\n '',\n '',\n 'figuredash',\n 'hypheninferior',\n '',\n '',\n 'Ogoneksmall',\n 'Ringsmall',\n 'Cedillasmall',\n '',\n '',\n '',\n 'onequarter',\n 'onehalf',\n 'threequarters',\n 'questiondownsmall',\n 'oneeighth',\n 'threeeighths',\n 'fiveeighths',\n 'seveneighths',\n 'onethird',\n 'twothirds',\n '',\n '',\n 'zerosuperior',\n 'onesuperior',\n 'twosuperior',\n 'threesuperior',\n 'foursuperior',\n 'fivesuperior',\n 'sixsuperior',\n 'sevensuperior',\n 'eightsuperior',\n 'ninesuperior',\n 'zeroinferior',\n 'oneinferior',\n 'twoinferior',\n 'threeinferior',\n 'fourinferior',\n 'fiveinferior',\n 'sixinferior',\n 'seveninferior',\n 'eightinferior',\n 'nineinferior',\n 'centinferior',\n 'dollarinferior',\n 'periodinferior',\n 'commainferior',\n 'Agravesmall',\n 'Aacutesmall',\n 'Acircumflexsmall',\n 'Atildesmall',\n 'Adieresissmall',\n 'Aringsmall',\n 'AEsmall',\n 'Ccedillasmall',\n 'Egravesmall',\n 'Eacutesmall',\n 'Ecircumflexsmall',\n 'Edieresissmall',\n 'Igravesmall',\n 'Iacutesmall',\n 'Icircumflexsmall',\n 'Idieresissmall',\n 'Ethsmall',\n 'Ntildesmall',\n 'Ogravesmall',\n 'Oacutesmall',\n 'Ocircumflexsmall',\n 'Otildesmall',\n 'Odieresissmall',\n 'OEsmall',\n 'Oslashsmall',\n 'Ugravesmall',\n 'Uacutesmall',\n 'Ucircumflexsmall',\n 'Udieresissmall',\n 'Yacutesmall',\n 'Thornsmall',\n 'Ydieresissmall',\n ]\n\n var standardNames = [\n '.notdef',\n '.null',\n 'nonmarkingreturn',\n 'space',\n 'exclam',\n 'quotedbl',\n 'numbersign',\n 'dollar',\n 'percent',\n 'ampersand',\n 'quotesingle',\n 'parenleft',\n 'parenright',\n 'asterisk',\n 'plus',\n 'comma',\n 'hyphen',\n 'period',\n 'slash',\n 'zero',\n 'one',\n 'two',\n 'three',\n 'four',\n 'five',\n 'six',\n 'seven',\n 'eight',\n 'nine',\n 'colon',\n 'semicolon',\n 'less',\n 'equal',\n 'greater',\n 'question',\n 'at',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'R',\n 'S',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'bracketleft',\n 'backslash',\n 'bracketright',\n 'asciicircum',\n 'underscore',\n 'grave',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n 'braceleft',\n 'bar',\n 'braceright',\n 'asciitilde',\n 'Adieresis',\n 'Aring',\n 'Ccedilla',\n 'Eacute',\n 'Ntilde',\n 'Odieresis',\n 'Udieresis',\n 'aacute',\n 'agrave',\n 'acircumflex',\n 'adieresis',\n 'atilde',\n 'aring',\n 'ccedilla',\n 'eacute',\n 'egrave',\n 'ecircumflex',\n 'edieresis',\n 'iacute',\n 'igrave',\n 'icircumflex',\n 'idieresis',\n 'ntilde',\n 'oacute',\n 'ograve',\n 'ocircumflex',\n 'odieresis',\n 'otilde',\n 'uacute',\n 'ugrave',\n 'ucircumflex',\n 'udieresis',\n 'dagger',\n 'degree',\n 'cent',\n 'sterling',\n 'section',\n 'bullet',\n 'paragraph',\n 'germandbls',\n 'registered',\n 'copyright',\n 'trademark',\n 'acute',\n 'dieresis',\n 'notequal',\n 'AE',\n 'Oslash',\n 'infinity',\n 'plusminus',\n 'lessequal',\n 'greaterequal',\n 'yen',\n 'mu',\n 'partialdiff',\n 'summation',\n 'product',\n 'pi',\n 'integral',\n 'ordfeminine',\n 'ordmasculine',\n 'Omega',\n 'ae',\n 'oslash',\n 'questiondown',\n 'exclamdown',\n 'logicalnot',\n 'radical',\n 'florin',\n 'approxequal',\n 'Delta',\n 'guillemotleft',\n 'guillemotright',\n 'ellipsis',\n 'nonbreakingspace',\n 'Agrave',\n 'Atilde',\n 'Otilde',\n 'OE',\n 'oe',\n 'endash',\n 'emdash',\n 'quotedblleft',\n 'quotedblright',\n 'quoteleft',\n 'quoteright',\n 'divide',\n 'lozenge',\n 'ydieresis',\n 'Ydieresis',\n 'fraction',\n 'currency',\n 'guilsinglleft',\n 'guilsinglright',\n 'fi',\n 'fl',\n 'daggerdbl',\n 'periodcentered',\n 'quotesinglbase',\n 'quotedblbase',\n 'perthousand',\n 'Acircumflex',\n 'Ecircumflex',\n 'Aacute',\n 'Edieresis',\n 'Egrave',\n 'Iacute',\n 'Icircumflex',\n 'Idieresis',\n 'Igrave',\n 'Oacute',\n 'Ocircumflex',\n 'apple',\n 'Ograve',\n 'Uacute',\n 'Ucircumflex',\n 'Ugrave',\n 'dotlessi',\n 'circumflex',\n 'tilde',\n 'macron',\n 'breve',\n 'dotaccent',\n 'ring',\n 'cedilla',\n 'hungarumlaut',\n 'ogonek',\n 'caron',\n 'Lslash',\n 'lslash',\n 'Scaron',\n 'scaron',\n 'Zcaron',\n 'zcaron',\n 'brokenbar',\n 'Eth',\n 'eth',\n 'Yacute',\n 'yacute',\n 'Thorn',\n 'thorn',\n 'minus',\n 'multiply',\n 'onesuperior',\n 'twosuperior',\n 'threesuperior',\n 'onehalf',\n 'onequarter',\n 'threequarters',\n 'franc',\n 'Gbreve',\n 'gbreve',\n 'Idotaccent',\n 'Scedilla',\n 'scedilla',\n 'Cacute',\n 'cacute',\n 'Ccaron',\n 'ccaron',\n 'dcroat',\n ]\n\n /**\n * This is the encoding used for fonts created from scratch.\n * It loops through all glyphs and finds the appropriate unicode value.\n * Since it's linear time, other encodings will be faster.\n * @exports opentype.DefaultEncoding\n * @class\n * @constructor\n * @param {opentype.Font}\n */\n function DefaultEncoding(font) {\n this.font = font\n }\n\n DefaultEncoding.prototype.charToGlyphIndex = function (c) {\n var code = c.codePointAt(0)\n var glyphs = this.font.glyphs\n if (glyphs) {\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n for (var j = 0; j < glyph.unicodes.length; j += 1) {\n if (glyph.unicodes[j] === code) {\n return i\n }\n }\n }\n }\n return null\n }\n\n /**\n * @exports opentype.CmapEncoding\n * @class\n * @constructor\n * @param {Object} cmap - a object with the cmap encoded data\n */\n function CmapEncoding(cmap) {\n this.cmap = cmap\n }\n\n /**\n * @param {string} c - the character\n * @return {number} The glyph index.\n */\n CmapEncoding.prototype.charToGlyphIndex = function (c) {\n return this.cmap.glyphIndexMap[c.codePointAt(0)] || 0\n }\n\n /**\n * @exports opentype.CffEncoding\n * @class\n * @constructor\n * @param {string} encoding - The encoding\n * @param {Array} charset - The character set.\n */\n function CffEncoding(encoding, charset) {\n this.encoding = encoding\n this.charset = charset\n }\n\n /**\n * @param {string} s - The character\n * @return {number} The index.\n */\n CffEncoding.prototype.charToGlyphIndex = function (s) {\n var code = s.codePointAt(0)\n var charName = this.encoding[code]\n return this.charset.indexOf(charName)\n }\n\n /**\n * @exports opentype.GlyphNames\n * @class\n * @constructor\n * @param {Object} post\n */\n function GlyphNames(post) {\n switch (post.version) {\n case 1:\n this.names = standardNames.slice()\n break\n case 2:\n this.names = new Array(post.numberOfGlyphs)\n for (var i = 0; i < post.numberOfGlyphs; i++) {\n if (post.glyphNameIndex[i] < standardNames.length) {\n this.names[i] = standardNames[post.glyphNameIndex[i]]\n } else {\n this.names[i] = post.names[post.glyphNameIndex[i] - standardNames.length]\n }\n }\n\n break\n case 2.5:\n this.names = new Array(post.numberOfGlyphs)\n for (var i$1 = 0; i$1 < post.numberOfGlyphs; i$1++) {\n this.names[i$1] = standardNames[i$1 + post.glyphNameIndex[i$1]]\n }\n\n break\n case 3:\n this.names = []\n break\n default:\n this.names = []\n break\n }\n }\n\n /**\n * Gets the index of a glyph by name.\n * @param {string} name - The glyph name\n * @return {number} The index\n */\n GlyphNames.prototype.nameToGlyphIndex = function (name) {\n return this.names.indexOf(name)\n }\n\n /**\n * @param {number} gid\n * @return {string}\n */\n GlyphNames.prototype.glyphIndexToName = function (gid) {\n return this.names[gid]\n }\n\n function addGlyphNamesAll(font) {\n var glyph\n var glyphIndexMap = font.tables.cmap.glyphIndexMap\n var charCodes = Object.keys(glyphIndexMap)\n\n for (var i = 0; i < charCodes.length; i += 1) {\n var c = charCodes[i]\n var glyphIndex = glyphIndexMap[c]\n glyph = font.glyphs.get(glyphIndex)\n glyph.addUnicode(parseInt(c))\n }\n\n for (var i$1 = 0; i$1 < font.glyphs.length; i$1 += 1) {\n glyph = font.glyphs.get(i$1)\n if (font.cffEncoding) {\n if (font.isCIDFont) {\n glyph.name = 'gid' + i$1\n } else {\n glyph.name = font.cffEncoding.charset[i$1]\n }\n } else if (font.glyphNames.names) {\n glyph.name = font.glyphNames.glyphIndexToName(i$1)\n }\n }\n }\n\n function addGlyphNamesToUnicodeMap(font) {\n font._IndexToUnicodeMap = {}\n\n var glyphIndexMap = font.tables.cmap.glyphIndexMap\n var charCodes = Object.keys(glyphIndexMap)\n\n for (var i = 0; i < charCodes.length; i += 1) {\n var c = charCodes[i]\n var glyphIndex = glyphIndexMap[c]\n if (font._IndexToUnicodeMap[glyphIndex] === undefined) {\n font._IndexToUnicodeMap[glyphIndex] = {\n unicodes: [parseInt(c)],\n }\n } else {\n font._IndexToUnicodeMap[glyphIndex].unicodes.push(parseInt(c))\n }\n }\n }\n\n /**\n * @alias opentype.addGlyphNames\n * @param {opentype.Font}\n * @param {Object}\n */\n function addGlyphNames(font, opt) {\n if (opt.lowMemory) {\n addGlyphNamesToUnicodeMap(font)\n } else {\n addGlyphNamesAll(font)\n }\n }\n\n // Drawing utility functions.\n\n // Draw a line on the given context from point `x1,y1` to point `x2,y2`.\n function line(ctx, x1, y1, x2, y2) {\n ctx.beginPath()\n ctx.moveTo(x1, y1)\n ctx.lineTo(x2, y2)\n ctx.stroke()\n }\n\n var draw = { line: line }\n\n // The Glyph object\n // import glyf from './tables/glyf' Can't be imported here, because it's a circular dependency\n\n function getPathDefinition(glyph, path) {\n var _path = path || new Path()\n return {\n configurable: true,\n\n get: function () {\n if (typeof _path === 'function') {\n _path = _path()\n }\n\n return _path\n },\n\n set: function (p) {\n _path = p\n },\n }\n }\n /**\n * @typedef GlyphOptions\n * @type Object\n * @property {string} [name] - The glyph name\n * @property {number} [unicode]\n * @property {Array} [unicodes]\n * @property {number} [xMin]\n * @property {number} [yMin]\n * @property {number} [xMax]\n * @property {number} [yMax]\n * @property {number} [advanceWidth]\n */\n\n // A Glyph is an individual mark that often corresponds to a character.\n // Some glyphs, such as ligatures, are a combination of many characters.\n // Glyphs are the basic building blocks of a font.\n //\n // The `Glyph` class contains utility methods for drawing the path and its points.\n /**\n * @exports opentype.Glyph\n * @class\n * @param {GlyphOptions}\n * @constructor\n */\n function Glyph(options) {\n // By putting all the code on a prototype function (which is only declared once)\n // we reduce the memory requirements for larger fonts by some 2%\n this.bindConstructorValues(options)\n }\n\n /**\n * @param {GlyphOptions}\n */\n Glyph.prototype.bindConstructorValues = function (options) {\n this.index = options.index || 0\n\n // These three values cannot be deferred for memory optimization:\n this.name = options.name || null\n this.unicode = options.unicode || undefined\n this.unicodes = options.unicodes || options.unicode !== undefined ? [options.unicode] : []\n\n // But by binding these values only when necessary, we reduce can\n // the memory requirements by almost 3% for larger fonts.\n if ('xMin' in options) {\n this.xMin = options.xMin\n }\n\n if ('yMin' in options) {\n this.yMin = options.yMin\n }\n\n if ('xMax' in options) {\n this.xMax = options.xMax\n }\n\n if ('yMax' in options) {\n this.yMax = options.yMax\n }\n\n if ('advanceWidth' in options) {\n this.advanceWidth = options.advanceWidth\n }\n\n // The path for a glyph is the most memory intensive, and is bound as a value\n // with a getter/setter to ensure we actually do path parsing only once the\n // path is actually needed by anything.\n Object.defineProperty(this, 'path', getPathDefinition(this, options.path))\n }\n\n /**\n * @param {number}\n */\n Glyph.prototype.addUnicode = function (unicode) {\n if (this.unicodes.length === 0) {\n this.unicode = unicode\n }\n\n this.unicodes.push(unicode)\n }\n\n /**\n * Calculate the minimum bounding box for this glyph.\n * @return {opentype.BoundingBox}\n */\n Glyph.prototype.getBoundingBox = function () {\n return this.path.getBoundingBox()\n }\n\n /**\n * Convert the glyph to a Path we can draw on a drawing context.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {Object=} options - xScale, yScale to stretch the glyph.\n * @param {opentype.Font} if hinting is to be used, the font\n * @return {opentype.Path}\n */\n Glyph.prototype.getPath = function (x, y, fontSize, options, font) {\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 72\n var commands\n var hPoints\n if (!options) {\n options = {}\n }\n var xScale = options.xScale\n var yScale = options.yScale\n\n if (options.hinting && font && font.hinting) {\n // in case of hinting, the hinting engine takes care\n // of scaling the points (not the path) before hinting.\n hPoints = this.path && font.hinting.exec(this, fontSize)\n // in case the hinting engine failed hPoints is undefined\n // and thus reverts to plain rending\n }\n\n if (hPoints) {\n // Call font.hinting.getCommands instead of `glyf.getPath(hPoints).commands` to avoid a circular dependency\n commands = font.hinting.getCommands(hPoints)\n x = Math.round(x)\n y = Math.round(y)\n // TODO in case of hinting xyScaling is not yet supported\n xScale = yScale = 1\n } else {\n commands = this.path.commands\n var scale = (1 / (this.path.unitsPerEm || 1000)) * fontSize\n if (xScale === undefined) {\n xScale = scale\n }\n if (yScale === undefined) {\n yScale = scale\n }\n }\n\n var p = new Path()\n for (var i = 0; i < commands.length; i += 1) {\n var cmd = commands[i]\n if (cmd.type === 'M') {\n p.moveTo(x + cmd.x * xScale, y + -cmd.y * yScale)\n } else if (cmd.type === 'L') {\n p.lineTo(x + cmd.x * xScale, y + -cmd.y * yScale)\n } else if (cmd.type === 'Q') {\n p.quadraticCurveTo(x + cmd.x1 * xScale, y + -cmd.y1 * yScale, x + cmd.x * xScale, y + -cmd.y * yScale)\n } else if (cmd.type === 'C') {\n p.curveTo(\n x + cmd.x1 * xScale,\n y + -cmd.y1 * yScale,\n x + cmd.x2 * xScale,\n y + -cmd.y2 * yScale,\n x + cmd.x * xScale,\n y + -cmd.y * yScale,\n )\n } else if (cmd.type === 'Z') {\n p.closePath()\n }\n }\n\n return p\n }\n\n /**\n * Split the glyph into contours.\n * This function is here for backwards compatibility, and to\n * provide raw access to the TrueType glyph outlines.\n * @return {Array}\n */\n Glyph.prototype.getContours = function () {\n if (this.points === undefined) {\n return []\n }\n\n var contours = []\n var currentContour = []\n for (var i = 0; i < this.points.length; i += 1) {\n var pt = this.points[i]\n currentContour.push(pt)\n if (pt.lastPointOfContour) {\n contours.push(currentContour)\n currentContour = []\n }\n }\n\n check.argument(currentContour.length === 0, 'There are still points left in the current contour.')\n return contours\n }\n\n /**\n * Calculate the xMin/yMin/xMax/yMax/lsb/rsb for a Glyph.\n * @return {Object}\n */\n Glyph.prototype.getMetrics = function () {\n var commands = this.path.commands\n var xCoords = []\n var yCoords = []\n for (var i = 0; i < commands.length; i += 1) {\n var cmd = commands[i]\n if (cmd.type !== 'Z') {\n xCoords.push(cmd.x)\n yCoords.push(cmd.y)\n }\n\n if (cmd.type === 'Q' || cmd.type === 'C') {\n xCoords.push(cmd.x1)\n yCoords.push(cmd.y1)\n }\n\n if (cmd.type === 'C') {\n xCoords.push(cmd.x2)\n yCoords.push(cmd.y2)\n }\n }\n\n var metrics = {\n xMin: Math.min.apply(null, xCoords),\n yMin: Math.min.apply(null, yCoords),\n xMax: Math.max.apply(null, xCoords),\n yMax: Math.max.apply(null, yCoords),\n leftSideBearing: this.leftSideBearing,\n }\n\n if (!isFinite(metrics.xMin)) {\n metrics.xMin = 0\n }\n\n if (!isFinite(metrics.xMax)) {\n metrics.xMax = this.advanceWidth\n }\n\n if (!isFinite(metrics.yMin)) {\n metrics.yMin = 0\n }\n\n if (!isFinite(metrics.yMax)) {\n metrics.yMax = 0\n }\n\n metrics.rightSideBearing = this.advanceWidth - metrics.leftSideBearing - (metrics.xMax - metrics.xMin)\n return metrics\n }\n\n /**\n * Draw the glyph on the given context.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {Object=} options - xScale, yScale to stretch the glyph.\n */\n Glyph.prototype.draw = function (ctx, x, y, fontSize, options) {\n this.getPath(x, y, fontSize, options).draw(ctx)\n }\n\n /**\n * Draw the points of the glyph.\n * On-curve points will be drawn in blue, off-curve points will be drawn in red.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n */\n Glyph.prototype.drawPoints = function (ctx, x, y, fontSize) {\n function drawCircles(l, x, y, scale) {\n ctx.beginPath()\n for (var j = 0; j < l.length; j += 1) {\n ctx.moveTo(x + l[j].x * scale, y + l[j].y * scale)\n ctx.arc(x + l[j].x * scale, y + l[j].y * scale, 2, 0, Math.PI * 2, false)\n }\n\n ctx.closePath()\n ctx.fill()\n }\n\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 24\n var scale = (1 / this.path.unitsPerEm) * fontSize\n\n var blueCircles = []\n var redCircles = []\n var path = this.path\n for (var i = 0; i < path.commands.length; i += 1) {\n var cmd = path.commands[i]\n if (cmd.x !== undefined) {\n blueCircles.push({ x: cmd.x, y: -cmd.y })\n }\n\n if (cmd.x1 !== undefined) {\n redCircles.push({ x: cmd.x1, y: -cmd.y1 })\n }\n\n if (cmd.x2 !== undefined) {\n redCircles.push({ x: cmd.x2, y: -cmd.y2 })\n }\n }\n\n ctx.fillStyle = 'blue'\n drawCircles(blueCircles, x, y, scale)\n ctx.fillStyle = 'red'\n drawCircles(redCircles, x, y, scale)\n }\n\n /**\n * Draw lines indicating important font measurements.\n * Black lines indicate the origin of the coordinate system (point 0,0).\n * Blue lines indicate the glyph bounding box.\n * Green line indicates the advance width of the glyph.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n */\n Glyph.prototype.drawMetrics = function (ctx, x, y, fontSize) {\n var scale\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 24\n scale = (1 / this.path.unitsPerEm) * fontSize\n ctx.lineWidth = 1\n\n // Draw the origin\n ctx.strokeStyle = 'black'\n draw.line(ctx, x, -10000, x, 10000)\n draw.line(ctx, -10000, y, 10000, y)\n\n // This code is here due to memory optimization: by not using\n // defaults in the constructor, we save a notable amount of memory.\n var xMin = this.xMin || 0\n var yMin = this.yMin || 0\n var xMax = this.xMax || 0\n var yMax = this.yMax || 0\n var advanceWidth = this.advanceWidth || 0\n\n // Draw the glyph box\n ctx.strokeStyle = 'blue'\n draw.line(ctx, x + xMin * scale, -10000, x + xMin * scale, 10000)\n draw.line(ctx, x + xMax * scale, -10000, x + xMax * scale, 10000)\n draw.line(ctx, -10000, y + -yMin * scale, 10000, y + -yMin * scale)\n draw.line(ctx, -10000, y + -yMax * scale, 10000, y + -yMax * scale)\n\n // Draw the advance width\n ctx.strokeStyle = 'green'\n draw.line(ctx, x + advanceWidth * scale, -10000, x + advanceWidth * scale, 10000)\n }\n\n // The GlyphSet object\n\n // Define a property on the glyph that depends on the path being loaded.\n function defineDependentProperty(glyph, externalName, internalName) {\n Object.defineProperty(glyph, externalName, {\n get: function () {\n // Request the path property to make sure the path is loaded.\n glyph.path // jshint ignore:line\n return glyph[internalName]\n },\n set: function (newValue) {\n glyph[internalName] = newValue\n },\n enumerable: true,\n configurable: true,\n })\n }\n\n /**\n * A GlyphSet represents all glyphs available in the font, but modelled using\n * a deferred glyph loader, for retrieving glyphs only once they are absolutely\n * necessary, to keep the memory footprint down.\n * @exports opentype.GlyphSet\n * @class\n * @param {opentype.Font}\n * @param {Array}\n */\n function GlyphSet(font, glyphs) {\n this.font = font\n this.glyphs = {}\n if (Array.isArray(glyphs)) {\n for (var i = 0; i < glyphs.length; i++) {\n var glyph = glyphs[i]\n glyph.path.unitsPerEm = font.unitsPerEm\n this.glyphs[i] = glyph\n }\n }\n\n this.length = (glyphs && glyphs.length) || 0\n }\n\n /**\n * @param {number} index\n * @return {opentype.Glyph}\n */\n GlyphSet.prototype.get = function (index) {\n // this.glyphs[index] is 'undefined' when low memory mode is on. glyph is pushed on request only.\n if (this.glyphs[index] === undefined) {\n this.font._push(index)\n if (typeof this.glyphs[index] === 'function') {\n this.glyphs[index] = this.glyphs[index]()\n }\n\n var glyph = this.glyphs[index]\n var unicodeObj = this.font._IndexToUnicodeMap[index]\n\n if (unicodeObj) {\n for (var j = 0; j < unicodeObj.unicodes.length; j++) {\n glyph.addUnicode(unicodeObj.unicodes[j])\n }\n }\n\n if (this.font.cffEncoding) {\n if (this.font.isCIDFont) {\n glyph.name = 'gid' + index\n } else {\n glyph.name = this.font.cffEncoding.charset[index]\n }\n } else if (this.font.glyphNames.names) {\n glyph.name = this.font.glyphNames.glyphIndexToName(index)\n }\n\n this.glyphs[index].advanceWidth = this.font._hmtxTableData[index].advanceWidth\n this.glyphs[index].leftSideBearing = this.font._hmtxTableData[index].leftSideBearing\n } else {\n if (typeof this.glyphs[index] === 'function') {\n this.glyphs[index] = this.glyphs[index]()\n }\n }\n\n return this.glyphs[index]\n }\n\n /**\n * @param {number} index\n * @param {Object}\n */\n GlyphSet.prototype.push = function (index, loader) {\n this.glyphs[index] = loader\n this.length++\n }\n\n /**\n * @alias opentype.glyphLoader\n * @param {opentype.Font} font\n * @param {number} index\n * @return {opentype.Glyph}\n */\n function glyphLoader(font, index) {\n return new Glyph({ index: index, font: font })\n }\n\n /**\n * Generate a stub glyph that can be filled with all metadata *except*\n * the \"points\" and \"path\" properties, which must be loaded only once\n * the glyph's path is actually requested for text shaping.\n * @alias opentype.ttfGlyphLoader\n * @param {opentype.Font} font\n * @param {number} index\n * @param {Function} parseGlyph\n * @param {Object} data\n * @param {number} position\n * @param {Function} buildPath\n * @return {opentype.Glyph}\n */\n function ttfGlyphLoader(font, index, parseGlyph, data, position, buildPath) {\n return function () {\n var glyph = new Glyph({ index: index, font: font })\n\n glyph.path = function () {\n parseGlyph(glyph, data, position)\n var path = buildPath(font.glyphs, glyph)\n path.unitsPerEm = font.unitsPerEm\n return path\n }\n\n defineDependentProperty(glyph, 'xMin', '_xMin')\n defineDependentProperty(glyph, 'xMax', '_xMax')\n defineDependentProperty(glyph, 'yMin', '_yMin')\n defineDependentProperty(glyph, 'yMax', '_yMax')\n\n return glyph\n }\n }\n /**\n * @alias opentype.cffGlyphLoader\n * @param {opentype.Font} font\n * @param {number} index\n * @param {Function} parseCFFCharstring\n * @param {string} charstring\n * @return {opentype.Glyph}\n */\n function cffGlyphLoader(font, index, parseCFFCharstring, charstring) {\n return function () {\n var glyph = new Glyph({ index: index, font: font })\n\n glyph.path = function () {\n var path = parseCFFCharstring(font, glyph, charstring)\n path.unitsPerEm = font.unitsPerEm\n return path\n }\n\n return glyph\n }\n }\n\n var glyphset = {\n GlyphSet: GlyphSet,\n glyphLoader: glyphLoader,\n ttfGlyphLoader: ttfGlyphLoader,\n cffGlyphLoader: cffGlyphLoader,\n }\n\n // The `CFF` table contains the glyph outlines in PostScript format.\n\n // Custom equals function that can also check lists.\n function equals(a, b) {\n if (a === b) {\n return true\n } else if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return false\n }\n\n for (var i = 0; i < a.length; i += 1) {\n if (!equals(a[i], b[i])) {\n return false\n }\n }\n\n return true\n } else {\n return false\n }\n }\n\n // Subroutines are encoded using the negative half of the number space.\n // See type 2 chapter 4.7 \"Subroutine operators\".\n function calcCFFSubroutineBias(subrs) {\n var bias\n if (subrs.length < 1240) {\n bias = 107\n } else if (subrs.length < 33900) {\n bias = 1131\n } else {\n bias = 32768\n }\n\n return bias\n }\n\n // Parse a `CFF` INDEX array.\n // An index array consists of a list of offsets, then a list of objects at those offsets.\n function parseCFFIndex(data, start, conversionFn) {\n var offsets = []\n var objects = []\n var count = parse.getCard16(data, start)\n var objectOffset\n var endOffset\n if (count !== 0) {\n var offsetSize = parse.getByte(data, start + 2)\n objectOffset = start + (count + 1) * offsetSize + 2\n var pos = start + 3\n for (var i = 0; i < count + 1; i += 1) {\n offsets.push(parse.getOffset(data, pos, offsetSize))\n pos += offsetSize\n }\n\n // The total size of the index array is 4 header bytes + the value of the last offset.\n endOffset = objectOffset + offsets[count]\n } else {\n endOffset = start + 2\n }\n\n for (var i$1 = 0; i$1 < offsets.length - 1; i$1 += 1) {\n var value = parse.getBytes(data, objectOffset + offsets[i$1], objectOffset + offsets[i$1 + 1])\n if (conversionFn) {\n value = conversionFn(value)\n }\n\n objects.push(value)\n }\n\n return { objects: objects, startOffset: start, endOffset: endOffset }\n }\n\n function parseCFFIndexLowMemory(data, start) {\n var offsets = []\n var count = parse.getCard16(data, start)\n var objectOffset\n var endOffset\n if (count !== 0) {\n var offsetSize = parse.getByte(data, start + 2)\n objectOffset = start + (count + 1) * offsetSize + 2\n var pos = start + 3\n for (var i = 0; i < count + 1; i += 1) {\n offsets.push(parse.getOffset(data, pos, offsetSize))\n pos += offsetSize\n }\n\n // The total size of the index array is 4 header bytes + the value of the last offset.\n endOffset = objectOffset + offsets[count]\n } else {\n endOffset = start + 2\n }\n\n return { offsets: offsets, startOffset: start, endOffset: endOffset }\n }\n function getCffIndexObject(i, offsets, data, start, conversionFn) {\n var count = parse.getCard16(data, start)\n var objectOffset = 0\n if (count !== 0) {\n var offsetSize = parse.getByte(data, start + 2)\n objectOffset = start + (count + 1) * offsetSize + 2\n }\n\n var value = parse.getBytes(data, objectOffset + offsets[i], objectOffset + offsets[i + 1])\n if (conversionFn) {\n value = conversionFn(value)\n }\n return value\n }\n\n // Parse a `CFF` DICT real value.\n function parseFloatOperand(parser) {\n var s = ''\n var eof = 15\n var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-']\n while (true) {\n var b = parser.parseByte()\n var n1 = b >> 4\n var n2 = b & 15\n\n if (n1 === eof) {\n break\n }\n\n s += lookup[n1]\n\n if (n2 === eof) {\n break\n }\n\n s += lookup[n2]\n }\n\n return parseFloat(s)\n }\n\n // Parse a `CFF` DICT operand.\n function parseOperand(parser, b0) {\n var b1\n var b2\n var b3\n var b4\n if (b0 === 28) {\n b1 = parser.parseByte()\n b2 = parser.parseByte()\n return (b1 << 8) | b2\n }\n\n if (b0 === 29) {\n b1 = parser.parseByte()\n b2 = parser.parseByte()\n b3 = parser.parseByte()\n b4 = parser.parseByte()\n return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4\n }\n\n if (b0 === 30) {\n return parseFloatOperand(parser)\n }\n\n if (b0 >= 32 && b0 <= 246) {\n return b0 - 139\n }\n\n if (b0 >= 247 && b0 <= 250) {\n b1 = parser.parseByte()\n return (b0 - 247) * 256 + b1 + 108\n }\n\n if (b0 >= 251 && b0 <= 254) {\n b1 = parser.parseByte()\n return -(b0 - 251) * 256 - b1 - 108\n }\n\n throw new Error('Invalid b0 ' + b0)\n }\n\n // Convert the entries returned by `parseDict` to a proper dictionary.\n // If a value is a list of one, it is unpacked.\n function entriesToObject(entries) {\n var o = {}\n for (var i = 0; i < entries.length; i += 1) {\n var key = entries[i][0]\n var values = entries[i][1]\n var value = void 0\n if (values.length === 1) {\n value = values[0]\n } else {\n value = values\n }\n\n if (o.hasOwnProperty(key) && !isNaN(o[key])) {\n throw new Error('Object ' + o + ' already has key ' + key)\n }\n\n o[key] = value\n }\n\n return o\n }\n\n // Parse a `CFF` DICT object.\n // A dictionary contains key-value pairs in a compact tokenized format.\n function parseCFFDict(data, start, size) {\n start = start !== undefined ? start : 0\n var parser = new parse.Parser(data, start)\n var entries = []\n var operands = []\n size = size !== undefined ? size : data.length\n\n while (parser.relativeOffset < size) {\n var op = parser.parseByte()\n\n // The first byte for each dict item distinguishes between operator (key) and operand (value).\n // Values <= 21 are operators.\n if (op <= 21) {\n // Two-byte operators have an initial escape byte of 12.\n if (op === 12) {\n op = 1200 + parser.parseByte()\n }\n\n entries.push([op, operands])\n operands = []\n } else {\n // Since the operands (values) come before the operators (keys), we store all operands in a list\n // until we encounter an operator.\n operands.push(parseOperand(parser, op))\n }\n }\n\n return entriesToObject(entries)\n }\n\n // Given a String Index (SID), return the value of the string.\n // Strings below index 392 are standard CFF strings and are not encoded in the font.\n function getCFFString(strings, index) {\n if (index <= 390) {\n index = cffStandardStrings[index]\n } else {\n index = strings[index - 391]\n }\n\n return index\n }\n\n // Interpret a dictionary and return a new dictionary with readable keys and values for missing entries.\n // This function takes `meta` which is a list of objects containing `operand`, `name` and `default`.\n function interpretDict(dict, meta, strings) {\n var newDict = {}\n var value\n\n // Because we also want to include missing values, we start out from the meta list\n // and lookup values in the dict.\n for (var i = 0; i < meta.length; i += 1) {\n var m = meta[i]\n\n if (Array.isArray(m.type)) {\n var values = []\n values.length = m.type.length\n for (var j = 0; j < m.type.length; j++) {\n value = dict[m.op] !== undefined ? dict[m.op][j] : undefined\n if (value === undefined) {\n value = m.value !== undefined && m.value[j] !== undefined ? m.value[j] : null\n }\n if (m.type[j] === 'SID') {\n value = getCFFString(strings, value)\n }\n values[j] = value\n }\n newDict[m.name] = values\n } else {\n value = dict[m.op]\n if (value === undefined) {\n value = m.value !== undefined ? m.value : null\n }\n\n if (m.type === 'SID') {\n value = getCFFString(strings, value)\n }\n newDict[m.name] = value\n }\n }\n\n return newDict\n }\n\n // Parse the CFF header.\n function parseCFFHeader(data, start) {\n var header = {}\n header.formatMajor = parse.getCard8(data, start)\n header.formatMinor = parse.getCard8(data, start + 1)\n header.size = parse.getCard8(data, start + 2)\n header.offsetSize = parse.getCard8(data, start + 3)\n header.startOffset = start\n header.endOffset = start + 4\n return header\n }\n\n var TOP_DICT_META = [\n { name: 'version', op: 0, type: 'SID' },\n { name: 'notice', op: 1, type: 'SID' },\n { name: 'copyright', op: 1200, type: 'SID' },\n { name: 'fullName', op: 2, type: 'SID' },\n { name: 'familyName', op: 3, type: 'SID' },\n { name: 'weight', op: 4, type: 'SID' },\n { name: 'isFixedPitch', op: 1201, type: 'number', value: 0 },\n { name: 'italicAngle', op: 1202, type: 'number', value: 0 },\n { name: 'underlinePosition', op: 1203, type: 'number', value: -100 },\n { name: 'underlineThickness', op: 1204, type: 'number', value: 50 },\n { name: 'paintType', op: 1205, type: 'number', value: 0 },\n { name: 'charstringType', op: 1206, type: 'number', value: 2 },\n {\n name: 'fontMatrix',\n op: 1207,\n type: ['real', 'real', 'real', 'real', 'real', 'real'],\n value: [0.001, 0, 0, 0.001, 0, 0],\n },\n { name: 'uniqueId', op: 13, type: 'number' },\n { name: 'fontBBox', op: 5, type: ['number', 'number', 'number', 'number'], value: [0, 0, 0, 0] },\n { name: 'strokeWidth', op: 1208, type: 'number', value: 0 },\n { name: 'xuid', op: 14, type: [], value: null },\n { name: 'charset', op: 15, type: 'offset', value: 0 },\n { name: 'encoding', op: 16, type: 'offset', value: 0 },\n { name: 'charStrings', op: 17, type: 'offset', value: 0 },\n { name: 'private', op: 18, type: ['number', 'offset'], value: [0, 0] },\n { name: 'ros', op: 1230, type: ['SID', 'SID', 'number'] },\n { name: 'cidFontVersion', op: 1231, type: 'number', value: 0 },\n { name: 'cidFontRevision', op: 1232, type: 'number', value: 0 },\n { name: 'cidFontType', op: 1233, type: 'number', value: 0 },\n { name: 'cidCount', op: 1234, type: 'number', value: 8720 },\n { name: 'uidBase', op: 1235, type: 'number' },\n { name: 'fdArray', op: 1236, type: 'offset' },\n { name: 'fdSelect', op: 1237, type: 'offset' },\n { name: 'fontName', op: 1238, type: 'SID' },\n ]\n\n var PRIVATE_DICT_META = [\n { name: 'subrs', op: 19, type: 'offset', value: 0 },\n { name: 'defaultWidthX', op: 20, type: 'number', value: 0 },\n { name: 'nominalWidthX', op: 21, type: 'number', value: 0 },\n ]\n\n // Parse the CFF top dictionary. A CFF table can contain multiple fonts, each with their own top dictionary.\n // The top dictionary contains the essential metadata for the font, together with the private dictionary.\n function parseCFFTopDict(data, strings) {\n var dict = parseCFFDict(data, 0, data.byteLength)\n return interpretDict(dict, TOP_DICT_META, strings)\n }\n\n // Parse the CFF private dictionary. We don't fully parse out all the values, only the ones we need.\n function parseCFFPrivateDict(data, start, size, strings) {\n var dict = parseCFFDict(data, start, size)\n return interpretDict(dict, PRIVATE_DICT_META, strings)\n }\n\n // Returns a list of \"Top DICT\"s found using an INDEX list.\n // Used to read both the usual high-level Top DICTs and also the FDArray\n // discovered inside CID-keyed fonts. When a Top DICT has a reference to\n // a Private DICT that is read and saved into the Top DICT.\n //\n // In addition to the expected/optional values as outlined in TOP_DICT_META\n // the following values might be saved into the Top DICT.\n //\n // _subrs [] array of local CFF subroutines from Private DICT\n // _subrsBias bias value computed from number of subroutines\n // (see calcCFFSubroutineBias() and parseCFFCharstring())\n // _defaultWidthX default widths for CFF characters\n // _nominalWidthX bias added to width embedded within glyph description\n //\n // _privateDict saved copy of parsed Private DICT from Top DICT\n function gatherCFFTopDicts(data, start, cffIndex, strings) {\n var topDictArray = []\n for (var iTopDict = 0; iTopDict < cffIndex.length; iTopDict += 1) {\n var topDictData = new DataView(new Uint8Array(cffIndex[iTopDict]).buffer)\n var topDict = parseCFFTopDict(topDictData, strings)\n topDict._subrs = []\n topDict._subrsBias = 0\n topDict._defaultWidthX = 0\n topDict._nominalWidthX = 0\n var privateSize = topDict.private[0]\n var privateOffset = topDict.private[1]\n if (privateSize !== 0 && privateOffset !== 0) {\n var privateDict = parseCFFPrivateDict(data, privateOffset + start, privateSize, strings)\n topDict._defaultWidthX = privateDict.defaultWidthX\n topDict._nominalWidthX = privateDict.nominalWidthX\n if (privateDict.subrs !== 0) {\n var subrOffset = privateOffset + privateDict.subrs\n var subrIndex = parseCFFIndex(data, subrOffset + start)\n topDict._subrs = subrIndex.objects\n topDict._subrsBias = calcCFFSubroutineBias(topDict._subrs)\n }\n topDict._privateDict = privateDict\n }\n topDictArray.push(topDict)\n }\n return topDictArray\n }\n\n // Parse the CFF charset table, which contains internal names for all the glyphs.\n // This function will return a list of glyph names.\n // See Adobe TN #5176 chapter 13, \"Charsets\".\n function parseCFFCharset(data, start, nGlyphs, strings) {\n var sid\n var count\n var parser = new parse.Parser(data, start)\n\n // The .notdef glyph is not included, so subtract 1.\n nGlyphs -= 1\n var charset = ['.notdef']\n\n var format = parser.parseCard8()\n if (format === 0) {\n for (var i = 0; i < nGlyphs; i += 1) {\n sid = parser.parseSID()\n charset.push(getCFFString(strings, sid))\n }\n } else if (format === 1) {\n while (charset.length <= nGlyphs) {\n sid = parser.parseSID()\n count = parser.parseCard8()\n for (var i$1 = 0; i$1 <= count; i$1 += 1) {\n charset.push(getCFFString(strings, sid))\n sid += 1\n }\n }\n } else if (format === 2) {\n while (charset.length <= nGlyphs) {\n sid = parser.parseSID()\n count = parser.parseCard16()\n for (var i$2 = 0; i$2 <= count; i$2 += 1) {\n charset.push(getCFFString(strings, sid))\n sid += 1\n }\n }\n } else {\n throw new Error('Unknown charset format ' + format)\n }\n\n return charset\n }\n\n // Parse the CFF encoding data. Only one encoding can be specified per font.\n // See Adobe TN #5176 chapter 12, \"Encodings\".\n function parseCFFEncoding(data, start, charset) {\n var code\n var enc = {}\n var parser = new parse.Parser(data, start)\n var format = parser.parseCard8()\n if (format === 0) {\n var nCodes = parser.parseCard8()\n for (var i = 0; i < nCodes; i += 1) {\n code = parser.parseCard8()\n enc[code] = i\n }\n } else if (format === 1) {\n var nRanges = parser.parseCard8()\n code = 1\n for (var i$1 = 0; i$1 < nRanges; i$1 += 1) {\n var first = parser.parseCard8()\n var nLeft = parser.parseCard8()\n for (var j = first; j <= first + nLeft; j += 1) {\n enc[j] = code\n code += 1\n }\n }\n } else {\n throw new Error('Unknown encoding format ' + format)\n }\n\n return new CffEncoding(enc, charset)\n }\n\n // Take in charstring code and return a Glyph object.\n // The encoding is described in the Type 2 Charstring Format\n // https://www.microsoft.com/typography/OTSPEC/charstr2.htm\n function parseCFFCharstring(font, glyph, code) {\n var c1x\n var c1y\n var c2x\n var c2y\n var p = new Path()\n var stack = []\n var nStems = 0\n var haveWidth = false\n var open = false\n var x = 0\n var y = 0\n var subrs\n var subrsBias\n var defaultWidthX\n var nominalWidthX\n if (font.isCIDFont) {\n var fdIndex = font.tables.cff.topDict._fdSelect[glyph.index]\n var fdDict = font.tables.cff.topDict._fdArray[fdIndex]\n subrs = fdDict._subrs\n subrsBias = fdDict._subrsBias\n defaultWidthX = fdDict._defaultWidthX\n nominalWidthX = fdDict._nominalWidthX\n } else {\n subrs = font.tables.cff.topDict._subrs\n subrsBias = font.tables.cff.topDict._subrsBias\n defaultWidthX = font.tables.cff.topDict._defaultWidthX\n nominalWidthX = font.tables.cff.topDict._nominalWidthX\n }\n var width = defaultWidthX\n\n function newContour(x, y) {\n if (open) {\n p.closePath()\n }\n\n p.moveTo(x, y)\n open = true\n }\n\n function parseStems() {\n var hasWidthArg\n\n // The number of stem operators on the stack is always even.\n // If the value is uneven, that means a width is specified.\n hasWidthArg = stack.length % 2 !== 0\n if (hasWidthArg && !haveWidth) {\n width = stack.shift() + nominalWidthX\n }\n\n nStems += stack.length >> 1\n stack.length = 0\n haveWidth = true\n }\n\n function parse(code) {\n var b1\n var b2\n var b3\n var b4\n var codeIndex\n var subrCode\n var jpx\n var jpy\n var c3x\n var c3y\n var c4x\n var c4y\n\n var i = 0\n while (i < code.length) {\n var v = code[i]\n i += 1\n switch (v) {\n case 1: // hstem\n parseStems()\n break\n case 3: // vstem\n parseStems()\n break\n case 4: // vmoveto\n if (stack.length > 1 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n y += stack.pop()\n newContour(x, y)\n break\n case 5: // rlineto\n while (stack.length > 0) {\n x += stack.shift()\n y += stack.shift()\n p.lineTo(x, y)\n }\n\n break\n case 6: // hlineto\n while (stack.length > 0) {\n x += stack.shift()\n p.lineTo(x, y)\n if (stack.length === 0) {\n break\n }\n\n y += stack.shift()\n p.lineTo(x, y)\n }\n\n break\n case 7: // vlineto\n while (stack.length > 0) {\n y += stack.shift()\n p.lineTo(x, y)\n if (stack.length === 0) {\n break\n }\n\n x += stack.shift()\n p.lineTo(x, y)\n }\n\n break\n case 8: // rrcurveto\n while (stack.length > 0) {\n c1x = x + stack.shift()\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 10: // callsubr\n codeIndex = stack.pop() + subrsBias\n subrCode = subrs[codeIndex]\n if (subrCode) {\n parse(subrCode)\n }\n\n break\n case 11: // return\n return\n case 12: // flex operators\n v = code[i]\n i += 1\n switch (v) {\n case 35: // flex\n // |- dx1 dy1 dx2 dy2 dx3 dy3 dx4 dy4 dx5 dy5 dx6 dy6 fd flex (12 35) |-\n c1x = x + stack.shift() // dx1\n c1y = y + stack.shift() // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y + stack.shift() // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = jpy + stack.shift() // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = c3y + stack.shift() // dy5\n x = c4x + stack.shift() // dx6\n y = c4y + stack.shift() // dy6\n stack.shift() // flex depth\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n case 34: // hflex\n // |- dx1 dx2 dy2 dx3 dx4 dx5 dx6 hflex (12 34) |-\n c1x = x + stack.shift() // dx1\n c1y = y // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = c2y // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = y // dy5\n x = c4x + stack.shift() // dx6\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n case 36: // hflex1\n // |- dx1 dy1 dx2 dy2 dx3 dx4 dx5 dy5 dx6 hflex1 (12 36) |-\n c1x = x + stack.shift() // dx1\n c1y = y + stack.shift() // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = c2y // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = c3y + stack.shift() // dy5\n x = c4x + stack.shift() // dx6\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n case 37: // flex1\n // |- dx1 dy1 dx2 dy2 dx3 dy3 dx4 dy4 dx5 dy5 d6 flex1 (12 37) |-\n c1x = x + stack.shift() // dx1\n c1y = y + stack.shift() // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y + stack.shift() // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = jpy + stack.shift() // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = c3y + stack.shift() // dy5\n if (Math.abs(c4x - x) > Math.abs(c4y - y)) {\n x = c4x + stack.shift()\n } else {\n y = c4y + stack.shift()\n }\n\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n default:\n console.log('Glyph ' + glyph.index + ': unknown operator ' + 1200 + v)\n stack.length = 0\n }\n break\n case 14: // endchar\n if (stack.length > 0 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n if (open) {\n p.closePath()\n open = false\n }\n\n break\n case 18: // hstemhm\n parseStems()\n break\n case 19: // hintmask\n case 20: // cntrmask\n parseStems()\n i += (nStems + 7) >> 3\n break\n case 21: // rmoveto\n if (stack.length > 2 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n y += stack.pop()\n x += stack.pop()\n newContour(x, y)\n break\n case 22: // hmoveto\n if (stack.length > 1 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n x += stack.pop()\n newContour(x, y)\n break\n case 23: // vstemhm\n parseStems()\n break\n case 24: // rcurveline\n while (stack.length > 2) {\n c1x = x + stack.shift()\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n x += stack.shift()\n y += stack.shift()\n p.lineTo(x, y)\n break\n case 25: // rlinecurve\n while (stack.length > 6) {\n x += stack.shift()\n y += stack.shift()\n p.lineTo(x, y)\n }\n\n c1x = x + stack.shift()\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n break\n case 26: // vvcurveto\n if (stack.length % 2) {\n x += stack.shift()\n }\n\n while (stack.length > 0) {\n c1x = x\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 27: // hhcurveto\n if (stack.length % 2) {\n y += stack.shift()\n }\n\n while (stack.length > 0) {\n c1x = x + stack.shift()\n c1y = y\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 28: // shortint\n b1 = code[i]\n b2 = code[i + 1]\n stack.push(((b1 << 24) | (b2 << 16)) >> 16)\n i += 2\n break\n case 29: // callgsubr\n codeIndex = stack.pop() + font.gsubrsBias\n subrCode = font.gsubrs[codeIndex]\n if (subrCode) {\n parse(subrCode)\n }\n\n break\n case 30: // vhcurveto\n while (stack.length > 0) {\n c1x = x\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n if (stack.length === 0) {\n break\n }\n\n c1x = x + stack.shift()\n c1y = y\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n y = c2y + stack.shift()\n x = c2x + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 31: // hvcurveto\n while (stack.length > 0) {\n c1x = x + stack.shift()\n c1y = y\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n y = c2y + stack.shift()\n x = c2x + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n if (stack.length === 0) {\n break\n }\n\n c1x = x\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n default:\n if (v < 32) {\n console.log('Glyph ' + glyph.index + ': unknown operator ' + v)\n } else if (v < 247) {\n stack.push(v - 139)\n } else if (v < 251) {\n b1 = code[i]\n i += 1\n stack.push((v - 247) * 256 + b1 + 108)\n } else if (v < 255) {\n b1 = code[i]\n i += 1\n stack.push(-(v - 251) * 256 - b1 - 108)\n } else {\n b1 = code[i]\n b2 = code[i + 1]\n b3 = code[i + 2]\n b4 = code[i + 3]\n i += 4\n stack.push(((b1 << 24) | (b2 << 16) | (b3 << 8) | b4) / 65536)\n }\n }\n }\n }\n\n parse(code)\n\n glyph.advanceWidth = width\n return p\n }\n\n function parseCFFFDSelect(data, start, nGlyphs, fdArrayCount) {\n var fdSelect = []\n var fdIndex\n var parser = new parse.Parser(data, start)\n var format = parser.parseCard8()\n if (format === 0) {\n // Simple list of nGlyphs elements\n for (var iGid = 0; iGid < nGlyphs; iGid++) {\n fdIndex = parser.parseCard8()\n if (fdIndex >= fdArrayCount) {\n throw new Error(\n 'CFF table CID Font FDSelect has bad FD index value ' + fdIndex + ' (FD count ' + fdArrayCount + ')',\n )\n }\n fdSelect.push(fdIndex)\n }\n } else if (format === 3) {\n // Ranges\n var nRanges = parser.parseCard16()\n var first = parser.parseCard16()\n if (first !== 0) {\n throw new Error('CFF Table CID Font FDSelect format 3 range has bad initial GID ' + first)\n }\n var next\n for (var iRange = 0; iRange < nRanges; iRange++) {\n fdIndex = parser.parseCard8()\n next = parser.parseCard16()\n if (fdIndex >= fdArrayCount) {\n throw new Error(\n 'CFF table CID Font FDSelect has bad FD index value ' + fdIndex + ' (FD count ' + fdArrayCount + ')',\n )\n }\n if (next > nGlyphs) {\n throw new Error('CFF Table CID Font FDSelect format 3 range has bad GID ' + next)\n }\n for (; first < next; first++) {\n fdSelect.push(fdIndex)\n }\n first = next\n }\n if (next !== nGlyphs) {\n throw new Error('CFF Table CID Font FDSelect format 3 range has bad final GID ' + next)\n }\n } else {\n throw new Error('CFF Table CID Font FDSelect table has unsupported format ' + format)\n }\n return fdSelect\n }\n\n // Parse the `CFF` table, which contains the glyph outlines in PostScript format.\n function parseCFFTable(data, start, font, opt) {\n font.tables.cff = {}\n var header = parseCFFHeader(data, start)\n var nameIndex = parseCFFIndex(data, header.endOffset, parse.bytesToString)\n var topDictIndex = parseCFFIndex(data, nameIndex.endOffset)\n var stringIndex = parseCFFIndex(data, topDictIndex.endOffset, parse.bytesToString)\n var globalSubrIndex = parseCFFIndex(data, stringIndex.endOffset)\n font.gsubrs = globalSubrIndex.objects\n font.gsubrsBias = calcCFFSubroutineBias(font.gsubrs)\n\n var topDictArray = gatherCFFTopDicts(data, start, topDictIndex.objects, stringIndex.objects)\n if (topDictArray.length !== 1) {\n throw new Error(\n \"CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = \" + topDictArray.length,\n )\n }\n\n var topDict = topDictArray[0]\n font.tables.cff.topDict = topDict\n\n if (topDict._privateDict) {\n font.defaultWidthX = topDict._privateDict.defaultWidthX\n font.nominalWidthX = topDict._privateDict.nominalWidthX\n }\n\n if (topDict.ros[0] !== undefined && topDict.ros[1] !== undefined) {\n font.isCIDFont = true\n }\n\n if (font.isCIDFont) {\n var fdArrayOffset = topDict.fdArray\n var fdSelectOffset = topDict.fdSelect\n if (fdArrayOffset === 0 || fdSelectOffset === 0) {\n throw new Error('Font is marked as a CID font, but FDArray and/or FDSelect information is missing')\n }\n fdArrayOffset += start\n var fdArrayIndex = parseCFFIndex(data, fdArrayOffset)\n var fdArray = gatherCFFTopDicts(data, start, fdArrayIndex.objects, stringIndex.objects)\n topDict._fdArray = fdArray\n fdSelectOffset += start\n topDict._fdSelect = parseCFFFDSelect(data, fdSelectOffset, font.numGlyphs, fdArray.length)\n }\n\n var privateDictOffset = start + topDict.private[1]\n var privateDict = parseCFFPrivateDict(data, privateDictOffset, topDict.private[0], stringIndex.objects)\n font.defaultWidthX = privateDict.defaultWidthX\n font.nominalWidthX = privateDict.nominalWidthX\n\n if (privateDict.subrs !== 0) {\n var subrOffset = privateDictOffset + privateDict.subrs\n var subrIndex = parseCFFIndex(data, subrOffset)\n font.subrs = subrIndex.objects\n font.subrsBias = calcCFFSubroutineBias(font.subrs)\n } else {\n font.subrs = []\n font.subrsBias = 0\n }\n\n // Offsets in the top dict are relative to the beginning of the CFF data, so add the CFF start offset.\n var charStringsIndex\n if (opt.lowMemory) {\n charStringsIndex = parseCFFIndexLowMemory(data, start + topDict.charStrings)\n font.nGlyphs = charStringsIndex.offsets.length\n } else {\n charStringsIndex = parseCFFIndex(data, start + topDict.charStrings)\n font.nGlyphs = charStringsIndex.objects.length\n }\n\n var charset = parseCFFCharset(data, start + topDict.charset, font.nGlyphs, stringIndex.objects)\n if (topDict.encoding === 0) {\n // Standard encoding\n font.cffEncoding = new CffEncoding(cffStandardEncoding, charset)\n } else if (topDict.encoding === 1) {\n // Expert encoding\n font.cffEncoding = new CffEncoding(cffExpertEncoding, charset)\n } else {\n font.cffEncoding = parseCFFEncoding(data, start + topDict.encoding, charset)\n }\n\n // Prefer the CMAP encoding to the CFF encoding.\n font.encoding = font.encoding || font.cffEncoding\n\n font.glyphs = new glyphset.GlyphSet(font)\n if (opt.lowMemory) {\n font._push = function (i) {\n var charString = getCffIndexObject(i, charStringsIndex.offsets, data, start + topDict.charStrings)\n font.glyphs.push(i, glyphset.cffGlyphLoader(font, i, parseCFFCharstring, charString))\n }\n } else {\n for (var i = 0; i < font.nGlyphs; i += 1) {\n var charString = charStringsIndex.objects[i]\n font.glyphs.push(i, glyphset.cffGlyphLoader(font, i, parseCFFCharstring, charString))\n }\n }\n }\n\n // Convert a string to a String ID (SID).\n // The list of strings is modified in place.\n function encodeString(s, strings) {\n var sid\n\n // Is the string in the CFF standard strings?\n var i = cffStandardStrings.indexOf(s)\n if (i >= 0) {\n sid = i\n }\n\n // Is the string already in the string index?\n i = strings.indexOf(s)\n if (i >= 0) {\n sid = i + cffStandardStrings.length\n } else {\n sid = cffStandardStrings.length + strings.length\n strings.push(s)\n }\n\n return sid\n }\n\n function makeHeader() {\n return new table.Record('Header', [\n { name: 'major', type: 'Card8', value: 1 },\n { name: 'minor', type: 'Card8', value: 0 },\n { name: 'hdrSize', type: 'Card8', value: 4 },\n { name: 'major', type: 'Card8', value: 1 },\n ])\n }\n\n function makeNameIndex(fontNames) {\n var t = new table.Record('Name INDEX', [{ name: 'names', type: 'INDEX', value: [] }])\n t.names = []\n for (var i = 0; i < fontNames.length; i += 1) {\n t.names.push({ name: 'name_' + i, type: 'NAME', value: fontNames[i] })\n }\n\n return t\n }\n\n // Given a dictionary's metadata, create a DICT structure.\n function makeDict(meta, attrs, strings) {\n var m = {}\n for (var i = 0; i < meta.length; i += 1) {\n var entry = meta[i]\n var value = attrs[entry.name]\n if (value !== undefined && !equals(value, entry.value)) {\n if (entry.type === 'SID') {\n value = encodeString(value, strings)\n }\n\n m[entry.op] = { name: entry.name, type: entry.type, value: value }\n }\n }\n\n return m\n }\n\n // The Top DICT houses the global font attributes.\n function makeTopDict(attrs, strings) {\n var t = new table.Record('Top DICT', [{ name: 'dict', type: 'DICT', value: {} }])\n t.dict = makeDict(TOP_DICT_META, attrs, strings)\n return t\n }\n\n function makeTopDictIndex(topDict) {\n var t = new table.Record('Top DICT INDEX', [{ name: 'topDicts', type: 'INDEX', value: [] }])\n t.topDicts = [{ name: 'topDict_0', type: 'TABLE', value: topDict }]\n return t\n }\n\n function makeStringIndex(strings) {\n var t = new table.Record('String INDEX', [{ name: 'strings', type: 'INDEX', value: [] }])\n t.strings = []\n for (var i = 0; i < strings.length; i += 1) {\n t.strings.push({ name: 'string_' + i, type: 'STRING', value: strings[i] })\n }\n\n return t\n }\n\n function makeGlobalSubrIndex() {\n // Currently we don't use subroutines.\n return new table.Record('Global Subr INDEX', [{ name: 'subrs', type: 'INDEX', value: [] }])\n }\n\n function makeCharsets(glyphNames, strings) {\n var t = new table.Record('Charsets', [{ name: 'format', type: 'Card8', value: 0 }])\n for (var i = 0; i < glyphNames.length; i += 1) {\n var glyphName = glyphNames[i]\n var glyphSID = encodeString(glyphName, strings)\n t.fields.push({ name: 'glyph_' + i, type: 'SID', value: glyphSID })\n }\n\n return t\n }\n\n function glyphToOps(glyph) {\n var ops = []\n var path = glyph.path\n ops.push({ name: 'width', type: 'NUMBER', value: glyph.advanceWidth })\n var x = 0\n var y = 0\n for (var i = 0; i < path.commands.length; i += 1) {\n var dx = void 0\n var dy = void 0\n var cmd = path.commands[i]\n if (cmd.type === 'Q') {\n // CFF only supports bézier curves, so convert the quad to a bézier.\n var _13 = 1 / 3\n var _23 = 2 / 3\n\n // We're going to create a new command so we don't change the original path.\n // Since all coordinates are relative, we round() them ASAP to avoid propagating errors.\n cmd = {\n type: 'C',\n x: cmd.x,\n y: cmd.y,\n x1: Math.round(_13 * x + _23 * cmd.x1),\n y1: Math.round(_13 * y + _23 * cmd.y1),\n x2: Math.round(_13 * cmd.x + _23 * cmd.x1),\n y2: Math.round(_13 * cmd.y + _23 * cmd.y1),\n }\n }\n\n if (cmd.type === 'M') {\n dx = Math.round(cmd.x - x)\n dy = Math.round(cmd.y - y)\n ops.push({ name: 'dx', type: 'NUMBER', value: dx })\n ops.push({ name: 'dy', type: 'NUMBER', value: dy })\n ops.push({ name: 'rmoveto', type: 'OP', value: 21 })\n x = Math.round(cmd.x)\n y = Math.round(cmd.y)\n } else if (cmd.type === 'L') {\n dx = Math.round(cmd.x - x)\n dy = Math.round(cmd.y - y)\n ops.push({ name: 'dx', type: 'NUMBER', value: dx })\n ops.push({ name: 'dy', type: 'NUMBER', value: dy })\n ops.push({ name: 'rlineto', type: 'OP', value: 5 })\n x = Math.round(cmd.x)\n y = Math.round(cmd.y)\n } else if (cmd.type === 'C') {\n var dx1 = Math.round(cmd.x1 - x)\n var dy1 = Math.round(cmd.y1 - y)\n var dx2 = Math.round(cmd.x2 - cmd.x1)\n var dy2 = Math.round(cmd.y2 - cmd.y1)\n dx = Math.round(cmd.x - cmd.x2)\n dy = Math.round(cmd.y - cmd.y2)\n ops.push({ name: 'dx1', type: 'NUMBER', value: dx1 })\n ops.push({ name: 'dy1', type: 'NUMBER', value: dy1 })\n ops.push({ name: 'dx2', type: 'NUMBER', value: dx2 })\n ops.push({ name: 'dy2', type: 'NUMBER', value: dy2 })\n ops.push({ name: 'dx', type: 'NUMBER', value: dx })\n ops.push({ name: 'dy', type: 'NUMBER', value: dy })\n ops.push({ name: 'rrcurveto', type: 'OP', value: 8 })\n x = Math.round(cmd.x)\n y = Math.round(cmd.y)\n }\n\n // Contours are closed automatically.\n }\n\n ops.push({ name: 'endchar', type: 'OP', value: 14 })\n return ops\n }\n\n function makeCharStringsIndex(glyphs) {\n var t = new table.Record('CharStrings INDEX', [{ name: 'charStrings', type: 'INDEX', value: [] }])\n\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n var ops = glyphToOps(glyph)\n t.charStrings.push({ name: glyph.name, type: 'CHARSTRING', value: ops })\n }\n\n return t\n }\n\n function makePrivateDict(attrs, strings) {\n var t = new table.Record('Private DICT', [{ name: 'dict', type: 'DICT', value: {} }])\n t.dict = makeDict(PRIVATE_DICT_META, attrs, strings)\n return t\n }\n\n function makeCFFTable(glyphs, options) {\n var t = new table.Table('CFF ', [\n { name: 'header', type: 'RECORD' },\n { name: 'nameIndex', type: 'RECORD' },\n { name: 'topDictIndex', type: 'RECORD' },\n { name: 'stringIndex', type: 'RECORD' },\n { name: 'globalSubrIndex', type: 'RECORD' },\n { name: 'charsets', type: 'RECORD' },\n { name: 'charStringsIndex', type: 'RECORD' },\n { name: 'privateDict', type: 'RECORD' },\n ])\n\n var fontScale = 1 / options.unitsPerEm\n // We use non-zero values for the offsets so that the DICT encodes them.\n // This is important because the size of the Top DICT plays a role in offset calculation,\n // and the size shouldn't change after we've written correct offsets.\n var attrs = {\n version: options.version,\n fullName: options.fullName,\n familyName: options.familyName,\n weight: options.weightName,\n fontBBox: options.fontBBox || [0, 0, 0, 0],\n fontMatrix: [fontScale, 0, 0, fontScale, 0, 0],\n charset: 999,\n encoding: 0,\n charStrings: 999,\n private: [0, 999],\n }\n\n var privateAttrs = {}\n\n var glyphNames = []\n var glyph\n\n // Skip first glyph (.notdef)\n for (var i = 1; i < glyphs.length; i += 1) {\n glyph = glyphs.get(i)\n glyphNames.push(glyph.name)\n }\n\n var strings = []\n\n t.header = makeHeader()\n t.nameIndex = makeNameIndex([options.postScriptName])\n var topDict = makeTopDict(attrs, strings)\n t.topDictIndex = makeTopDictIndex(topDict)\n t.globalSubrIndex = makeGlobalSubrIndex()\n t.charsets = makeCharsets(glyphNames, strings)\n t.charStringsIndex = makeCharStringsIndex(glyphs)\n t.privateDict = makePrivateDict(privateAttrs, strings)\n\n // Needs to come at the end, to encode all custom strings used in the font.\n t.stringIndex = makeStringIndex(strings)\n\n var startOffset =\n t.header.sizeOf() +\n t.nameIndex.sizeOf() +\n t.topDictIndex.sizeOf() +\n t.stringIndex.sizeOf() +\n t.globalSubrIndex.sizeOf()\n attrs.charset = startOffset\n\n // We use the CFF standard encoding; proper encoding will be handled in cmap.\n attrs.encoding = 0\n attrs.charStrings = attrs.charset + t.charsets.sizeOf()\n attrs.private[1] = attrs.charStrings + t.charStringsIndex.sizeOf()\n\n // Recreate the Top DICT INDEX with the correct offsets.\n topDict = makeTopDict(attrs, strings)\n t.topDictIndex = makeTopDictIndex(topDict)\n\n return t\n }\n\n var cff = { parse: parseCFFTable, make: makeCFFTable }\n\n // The `head` table contains global information about the font.\n\n // Parse the header `head` table\n function parseHeadTable(data, start) {\n var head = {}\n var p = new parse.Parser(data, start)\n head.version = p.parseVersion()\n head.fontRevision = Math.round(p.parseFixed() * 1000) / 1000\n head.checkSumAdjustment = p.parseULong()\n head.magicNumber = p.parseULong()\n check.argument(head.magicNumber === 0x5f0f3cf5, 'Font header has wrong magic number.')\n head.flags = p.parseUShort()\n head.unitsPerEm = p.parseUShort()\n head.created = p.parseLongDateTime()\n head.modified = p.parseLongDateTime()\n head.xMin = p.parseShort()\n head.yMin = p.parseShort()\n head.xMax = p.parseShort()\n head.yMax = p.parseShort()\n head.macStyle = p.parseUShort()\n head.lowestRecPPEM = p.parseUShort()\n head.fontDirectionHint = p.parseShort()\n head.indexToLocFormat = p.parseShort()\n head.glyphDataFormat = p.parseShort()\n return head\n }\n\n function makeHeadTable(options) {\n // Apple Mac timestamp epoch is 01/01/1904 not 01/01/1970\n var timestamp = Math.round(new Date().getTime() / 1000) + 2082844800\n var createdTimestamp = timestamp\n\n if (options.createdTimestamp) {\n createdTimestamp = options.createdTimestamp + 2082844800\n }\n\n return new table.Table(\n 'head',\n [\n { name: 'version', type: 'FIXED', value: 0x00010000 },\n { name: 'fontRevision', type: 'FIXED', value: 0x00010000 },\n { name: 'checkSumAdjustment', type: 'ULONG', value: 0 },\n { name: 'magicNumber', type: 'ULONG', value: 0x5f0f3cf5 },\n { name: 'flags', type: 'USHORT', value: 0 },\n { name: 'unitsPerEm', type: 'USHORT', value: 1000 },\n { name: 'created', type: 'LONGDATETIME', value: createdTimestamp },\n { name: 'modified', type: 'LONGDATETIME', value: timestamp },\n { name: 'xMin', type: 'SHORT', value: 0 },\n { name: 'yMin', type: 'SHORT', value: 0 },\n { name: 'xMax', type: 'SHORT', value: 0 },\n { name: 'yMax', type: 'SHORT', value: 0 },\n { name: 'macStyle', type: 'USHORT', value: 0 },\n { name: 'lowestRecPPEM', type: 'USHORT', value: 0 },\n { name: 'fontDirectionHint', type: 'SHORT', value: 2 },\n { name: 'indexToLocFormat', type: 'SHORT', value: 0 },\n { name: 'glyphDataFormat', type: 'SHORT', value: 0 },\n ],\n options,\n )\n }\n\n var head = { parse: parseHeadTable, make: makeHeadTable }\n\n // The `hhea` table contains information for horizontal layout.\n\n // Parse the horizontal header `hhea` table\n function parseHheaTable(data, start) {\n var hhea = {}\n var p = new parse.Parser(data, start)\n hhea.version = p.parseVersion()\n hhea.ascender = p.parseShort()\n hhea.descender = p.parseShort()\n hhea.lineGap = p.parseShort()\n hhea.advanceWidthMax = p.parseUShort()\n hhea.minLeftSideBearing = p.parseShort()\n hhea.minRightSideBearing = p.parseShort()\n hhea.xMaxExtent = p.parseShort()\n hhea.caretSlopeRise = p.parseShort()\n hhea.caretSlopeRun = p.parseShort()\n hhea.caretOffset = p.parseShort()\n p.relativeOffset += 8\n hhea.metricDataFormat = p.parseShort()\n hhea.numberOfHMetrics = p.parseUShort()\n return hhea\n }\n\n function makeHheaTable(options) {\n return new table.Table(\n 'hhea',\n [\n { name: 'version', type: 'FIXED', value: 0x00010000 },\n { name: 'ascender', type: 'FWORD', value: 0 },\n { name: 'descender', type: 'FWORD', value: 0 },\n { name: 'lineGap', type: 'FWORD', value: 0 },\n { name: 'advanceWidthMax', type: 'UFWORD', value: 0 },\n { name: 'minLeftSideBearing', type: 'FWORD', value: 0 },\n { name: 'minRightSideBearing', type: 'FWORD', value: 0 },\n { name: 'xMaxExtent', type: 'FWORD', value: 0 },\n { name: 'caretSlopeRise', type: 'SHORT', value: 1 },\n { name: 'caretSlopeRun', type: 'SHORT', value: 0 },\n { name: 'caretOffset', type: 'SHORT', value: 0 },\n { name: 'reserved1', type: 'SHORT', value: 0 },\n { name: 'reserved2', type: 'SHORT', value: 0 },\n { name: 'reserved3', type: 'SHORT', value: 0 },\n { name: 'reserved4', type: 'SHORT', value: 0 },\n { name: 'metricDataFormat', type: 'SHORT', value: 0 },\n { name: 'numberOfHMetrics', type: 'USHORT', value: 0 },\n ],\n options,\n )\n }\n\n var hhea = { parse: parseHheaTable, make: makeHheaTable }\n\n // The `hmtx` table contains the horizontal metrics for all glyphs.\n\n function parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs) {\n var advanceWidth\n var leftSideBearing\n var p = new parse.Parser(data, start)\n for (var i = 0; i < numGlyphs; i += 1) {\n // If the font is monospaced, only one entry is needed. This last entry applies to all subsequent glyphs.\n if (i < numMetrics) {\n advanceWidth = p.parseUShort()\n leftSideBearing = p.parseShort()\n }\n\n var glyph = glyphs.get(i)\n glyph.advanceWidth = advanceWidth\n glyph.leftSideBearing = leftSideBearing\n }\n }\n\n function parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs) {\n font._hmtxTableData = {}\n\n var advanceWidth\n var leftSideBearing\n var p = new parse.Parser(data, start)\n for (var i = 0; i < numGlyphs; i += 1) {\n // If the font is monospaced, only one entry is needed. This last entry applies to all subsequent glyphs.\n if (i < numMetrics) {\n advanceWidth = p.parseUShort()\n leftSideBearing = p.parseShort()\n }\n\n font._hmtxTableData[i] = {\n advanceWidth: advanceWidth,\n leftSideBearing: leftSideBearing,\n }\n }\n }\n\n // Parse the `hmtx` table, which contains the horizontal metrics for all glyphs.\n // This function augments the glyph array, adding the advanceWidth and leftSideBearing to each glyph.\n function parseHmtxTable(font, data, start, numMetrics, numGlyphs, glyphs, opt) {\n if (opt.lowMemory) {\n parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs)\n } else {\n parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs)\n }\n }\n\n function makeHmtxTable(glyphs) {\n var t = new table.Table('hmtx', [])\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n var advanceWidth = glyph.advanceWidth || 0\n var leftSideBearing = glyph.leftSideBearing || 0\n t.fields.push({ name: 'advanceWidth_' + i, type: 'USHORT', value: advanceWidth })\n t.fields.push({ name: 'leftSideBearing_' + i, type: 'SHORT', value: leftSideBearing })\n }\n\n return t\n }\n\n var hmtx = { parse: parseHmtxTable, make: makeHmtxTable }\n\n // The `ltag` table stores IETF BCP-47 language tags. It allows supporting\n\n function makeLtagTable(tags) {\n var result = new table.Table('ltag', [\n { name: 'version', type: 'ULONG', value: 1 },\n { name: 'flags', type: 'ULONG', value: 0 },\n { name: 'numTags', type: 'ULONG', value: tags.length },\n ])\n\n var stringPool = ''\n var stringPoolOffset = 12 + tags.length * 4\n for (var i = 0; i < tags.length; ++i) {\n var pos = stringPool.indexOf(tags[i])\n if (pos < 0) {\n pos = stringPool.length\n stringPool += tags[i]\n }\n\n result.fields.push({ name: 'offset ' + i, type: 'USHORT', value: stringPoolOffset + pos })\n result.fields.push({ name: 'length ' + i, type: 'USHORT', value: tags[i].length })\n }\n\n result.fields.push({ name: 'stringPool', type: 'CHARARRAY', value: stringPool })\n return result\n }\n\n function parseLtagTable(data, start) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseULong()\n check.argument(tableVersion === 1, 'Unsupported ltag table version.')\n // The 'ltag' specification does not define any flags; skip the field.\n p.skip('uLong', 1)\n var numTags = p.parseULong()\n\n var tags = []\n for (var i = 0; i < numTags; i++) {\n var tag = ''\n var offset = start + p.parseUShort()\n var length = p.parseUShort()\n for (var j = offset; j < offset + length; ++j) {\n tag += String.fromCharCode(data.getInt8(j))\n }\n\n tags.push(tag)\n }\n\n return tags\n }\n\n var ltag = { make: makeLtagTable, parse: parseLtagTable }\n\n // The `maxp` table establishes the memory requirements for the font.\n\n // Parse the maximum profile `maxp` table.\n function parseMaxpTable(data, start) {\n var maxp = {}\n var p = new parse.Parser(data, start)\n maxp.version = p.parseVersion()\n maxp.numGlyphs = p.parseUShort()\n if (maxp.version === 1.0) {\n maxp.maxPoints = p.parseUShort()\n maxp.maxContours = p.parseUShort()\n maxp.maxCompositePoints = p.parseUShort()\n maxp.maxCompositeContours = p.parseUShort()\n maxp.maxZones = p.parseUShort()\n maxp.maxTwilightPoints = p.parseUShort()\n maxp.maxStorage = p.parseUShort()\n maxp.maxFunctionDefs = p.parseUShort()\n maxp.maxInstructionDefs = p.parseUShort()\n maxp.maxStackElements = p.parseUShort()\n maxp.maxSizeOfInstructions = p.parseUShort()\n maxp.maxComponentElements = p.parseUShort()\n maxp.maxComponentDepth = p.parseUShort()\n }\n\n return maxp\n }\n\n function makeMaxpTable(numGlyphs) {\n return new table.Table('maxp', [\n { name: 'version', type: 'FIXED', value: 0x00005000 },\n { name: 'numGlyphs', type: 'USHORT', value: numGlyphs },\n ])\n }\n\n var maxp = { parse: parseMaxpTable, make: makeMaxpTable }\n\n // The `name` naming table.\n\n // NameIDs for the name table.\n var nameTableNames = [\n 'copyright', // 0\n 'fontFamily', // 1\n 'fontSubfamily', // 2\n 'uniqueID', // 3\n 'fullName', // 4\n 'version', // 5\n 'postScriptName', // 6\n 'trademark', // 7\n 'manufacturer', // 8\n 'designer', // 9\n 'description', // 10\n 'manufacturerURL', // 11\n 'designerURL', // 12\n 'license', // 13\n 'licenseURL', // 14\n 'reserved', // 15\n 'preferredFamily', // 16\n 'preferredSubfamily', // 17\n 'compatibleFullName', // 18\n 'sampleText', // 19\n 'postScriptFindFontName', // 20\n 'wwsFamily', // 21\n 'wwsSubfamily', // 22\n ]\n\n var macLanguages = {\n 0: 'en',\n 1: 'fr',\n 2: 'de',\n 3: 'it',\n 4: 'nl',\n 5: 'sv',\n 6: 'es',\n 7: 'da',\n 8: 'pt',\n 9: 'no',\n 10: 'he',\n 11: 'ja',\n 12: 'ar',\n 13: 'fi',\n 14: 'el',\n 15: 'is',\n 16: 'mt',\n 17: 'tr',\n 18: 'hr',\n 19: 'zh-Hant',\n 20: 'ur',\n 21: 'hi',\n 22: 'th',\n 23: 'ko',\n 24: 'lt',\n 25: 'pl',\n 26: 'hu',\n 27: 'es',\n 28: 'lv',\n 29: 'se',\n 30: 'fo',\n 31: 'fa',\n 32: 'ru',\n 33: 'zh',\n 34: 'nl-BE',\n 35: 'ga',\n 36: 'sq',\n 37: 'ro',\n 38: 'cz',\n 39: 'sk',\n 40: 'si',\n 41: 'yi',\n 42: 'sr',\n 43: 'mk',\n 44: 'bg',\n 45: 'uk',\n 46: 'be',\n 47: 'uz',\n 48: 'kk',\n 49: 'az-Cyrl',\n 50: 'az-Arab',\n 51: 'hy',\n 52: 'ka',\n 53: 'mo',\n 54: 'ky',\n 55: 'tg',\n 56: 'tk',\n 57: 'mn-CN',\n 58: 'mn',\n 59: 'ps',\n 60: 'ks',\n 61: 'ku',\n 62: 'sd',\n 63: 'bo',\n 64: 'ne',\n 65: 'sa',\n 66: 'mr',\n 67: 'bn',\n 68: 'as',\n 69: 'gu',\n 70: 'pa',\n 71: 'or',\n 72: 'ml',\n 73: 'kn',\n 74: 'ta',\n 75: 'te',\n 76: 'si',\n 77: 'my',\n 78: 'km',\n 79: 'lo',\n 80: 'vi',\n 81: 'id',\n 82: 'tl',\n 83: 'ms',\n 84: 'ms-Arab',\n 85: 'am',\n 86: 'ti',\n 87: 'om',\n 88: 'so',\n 89: 'sw',\n 90: 'rw',\n 91: 'rn',\n 92: 'ny',\n 93: 'mg',\n 94: 'eo',\n 128: 'cy',\n 129: 'eu',\n 130: 'ca',\n 131: 'la',\n 132: 'qu',\n 133: 'gn',\n 134: 'ay',\n 135: 'tt',\n 136: 'ug',\n 137: 'dz',\n 138: 'jv',\n 139: 'su',\n 140: 'gl',\n 141: 'af',\n 142: 'br',\n 143: 'iu',\n 144: 'gd',\n 145: 'gv',\n 146: 'ga',\n 147: 'to',\n 148: 'el-polyton',\n 149: 'kl',\n 150: 'az',\n 151: 'nn',\n }\n\n // MacOS language ID → MacOS script ID\n //\n // Note that the script ID is not sufficient to determine what encoding\n // to use in TrueType files. For some languages, MacOS used a modification\n // of a mainstream script. For example, an Icelandic name would be stored\n // with smRoman in the TrueType naming table, but the actual encoding\n // is a special Icelandic version of the normal Macintosh Roman encoding.\n // As another example, Inuktitut uses an 8-bit encoding for Canadian Aboriginal\n // Syllables but MacOS had run out of available script codes, so this was\n // done as a (pretty radical) \"modification\" of Ethiopic.\n //\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt\n var macLanguageToScript = {\n 0: 0, // langEnglish → smRoman\n 1: 0, // langFrench → smRoman\n 2: 0, // langGerman → smRoman\n 3: 0, // langItalian → smRoman\n 4: 0, // langDutch → smRoman\n 5: 0, // langSwedish → smRoman\n 6: 0, // langSpanish → smRoman\n 7: 0, // langDanish → smRoman\n 8: 0, // langPortuguese → smRoman\n 9: 0, // langNorwegian → smRoman\n 10: 5, // langHebrew → smHebrew\n 11: 1, // langJapanese → smJapanese\n 12: 4, // langArabic → smArabic\n 13: 0, // langFinnish → smRoman\n 14: 6, // langGreek → smGreek\n 15: 0, // langIcelandic → smRoman (modified)\n 16: 0, // langMaltese → smRoman\n 17: 0, // langTurkish → smRoman (modified)\n 18: 0, // langCroatian → smRoman (modified)\n 19: 2, // langTradChinese → smTradChinese\n 20: 4, // langUrdu → smArabic\n 21: 9, // langHindi → smDevanagari\n 22: 21, // langThai → smThai\n 23: 3, // langKorean → smKorean\n 24: 29, // langLithuanian → smCentralEuroRoman\n 25: 29, // langPolish → smCentralEuroRoman\n 26: 29, // langHungarian → smCentralEuroRoman\n 27: 29, // langEstonian → smCentralEuroRoman\n 28: 29, // langLatvian → smCentralEuroRoman\n 29: 0, // langSami → smRoman\n 30: 0, // langFaroese → smRoman (modified)\n 31: 4, // langFarsi → smArabic (modified)\n 32: 7, // langRussian → smCyrillic\n 33: 25, // langSimpChinese → smSimpChinese\n 34: 0, // langFlemish → smRoman\n 35: 0, // langIrishGaelic → smRoman (modified)\n 36: 0, // langAlbanian → smRoman\n 37: 0, // langRomanian → smRoman (modified)\n 38: 29, // langCzech → smCentralEuroRoman\n 39: 29, // langSlovak → smCentralEuroRoman\n 40: 0, // langSlovenian → smRoman (modified)\n 41: 5, // langYiddish → smHebrew\n 42: 7, // langSerbian → smCyrillic\n 43: 7, // langMacedonian → smCyrillic\n 44: 7, // langBulgarian → smCyrillic\n 45: 7, // langUkrainian → smCyrillic (modified)\n 46: 7, // langByelorussian → smCyrillic\n 47: 7, // langUzbek → smCyrillic\n 48: 7, // langKazakh → smCyrillic\n 49: 7, // langAzerbaijani → smCyrillic\n 50: 4, // langAzerbaijanAr → smArabic\n 51: 24, // langArmenian → smArmenian\n 52: 23, // langGeorgian → smGeorgian\n 53: 7, // langMoldavian → smCyrillic\n 54: 7, // langKirghiz → smCyrillic\n 55: 7, // langTajiki → smCyrillic\n 56: 7, // langTurkmen → smCyrillic\n 57: 27, // langMongolian → smMongolian\n 58: 7, // langMongolianCyr → smCyrillic\n 59: 4, // langPashto → smArabic\n 60: 4, // langKurdish → smArabic\n 61: 4, // langKashmiri → smArabic\n 62: 4, // langSindhi → smArabic\n 63: 26, // langTibetan → smTibetan\n 64: 9, // langNepali → smDevanagari\n 65: 9, // langSanskrit → smDevanagari\n 66: 9, // langMarathi → smDevanagari\n 67: 13, // langBengali → smBengali\n 68: 13, // langAssamese → smBengali\n 69: 11, // langGujarati → smGujarati\n 70: 10, // langPunjabi → smGurmukhi\n 71: 12, // langOriya → smOriya\n 72: 17, // langMalayalam → smMalayalam\n 73: 16, // langKannada → smKannada\n 74: 14, // langTamil → smTamil\n 75: 15, // langTelugu → smTelugu\n 76: 18, // langSinhalese → smSinhalese\n 77: 19, // langBurmese → smBurmese\n 78: 20, // langKhmer → smKhmer\n 79: 22, // langLao → smLao\n 80: 30, // langVietnamese → smVietnamese\n 81: 0, // langIndonesian → smRoman\n 82: 0, // langTagalog → smRoman\n 83: 0, // langMalayRoman → smRoman\n 84: 4, // langMalayArabic → smArabic\n 85: 28, // langAmharic → smEthiopic\n 86: 28, // langTigrinya → smEthiopic\n 87: 28, // langOromo → smEthiopic\n 88: 0, // langSomali → smRoman\n 89: 0, // langSwahili → smRoman\n 90: 0, // langKinyarwanda → smRoman\n 91: 0, // langRundi → smRoman\n 92: 0, // langNyanja → smRoman\n 93: 0, // langMalagasy → smRoman\n 94: 0, // langEsperanto → smRoman\n 128: 0, // langWelsh → smRoman (modified)\n 129: 0, // langBasque → smRoman\n 130: 0, // langCatalan → smRoman\n 131: 0, // langLatin → smRoman\n 132: 0, // langQuechua → smRoman\n 133: 0, // langGuarani → smRoman\n 134: 0, // langAymara → smRoman\n 135: 7, // langTatar → smCyrillic\n 136: 4, // langUighur → smArabic\n 137: 26, // langDzongkha → smTibetan\n 138: 0, // langJavaneseRom → smRoman\n 139: 0, // langSundaneseRom → smRoman\n 140: 0, // langGalician → smRoman\n 141: 0, // langAfrikaans → smRoman\n 142: 0, // langBreton → smRoman (modified)\n 143: 28, // langInuktitut → smEthiopic (modified)\n 144: 0, // langScottishGaelic → smRoman (modified)\n 145: 0, // langManxGaelic → smRoman (modified)\n 146: 0, // langIrishGaelicScript → smRoman (modified)\n 147: 0, // langTongan → smRoman\n 148: 6, // langGreekAncient → smRoman\n 149: 0, // langGreenlandic → smRoman\n 150: 0, // langAzerbaijanRoman → smRoman\n 151: 0, // langNynorsk → smRoman\n }\n\n // While Microsoft indicates a region/country for all its language\n // IDs, we omit the region code if it's equal to the \"most likely\n // region subtag\" according to Unicode CLDR. For scripts, we omit\n // the subtag if it is equal to the Suppress-Script entry in the\n // IANA language subtag registry for IETF BCP 47.\n //\n // For example, Microsoft states that its language code 0x041A is\n // Croatian in Croatia. We transform this to the BCP 47 language code 'hr'\n // and not 'hr-HR' because Croatia is the default country for Croatian,\n // according to Unicode CLDR. As another example, Microsoft states\n // that 0x101A is Croatian (Latin) in Bosnia-Herzegovina. We transform\n // this to 'hr-BA' and not 'hr-Latn-BA' because Latin is the default script\n // for the Croatian language, according to IANA.\n //\n // http://www.unicode.org/cldr/charts/latest/supplemental/likely_subtags.html\n // http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry\n var windowsLanguages = {\n 0x0436: 'af',\n 0x041c: 'sq',\n 0x0484: 'gsw',\n 0x045e: 'am',\n 0x1401: 'ar-DZ',\n 0x3c01: 'ar-BH',\n 0x0c01: 'ar',\n 0x0801: 'ar-IQ',\n 0x2c01: 'ar-JO',\n 0x3401: 'ar-KW',\n 0x3001: 'ar-LB',\n 0x1001: 'ar-LY',\n 0x1801: 'ary',\n 0x2001: 'ar-OM',\n 0x4001: 'ar-QA',\n 0x0401: 'ar-SA',\n 0x2801: 'ar-SY',\n 0x1c01: 'aeb',\n 0x3801: 'ar-AE',\n 0x2401: 'ar-YE',\n 0x042b: 'hy',\n 0x044d: 'as',\n 0x082c: 'az-Cyrl',\n 0x042c: 'az',\n 0x046d: 'ba',\n 0x042d: 'eu',\n 0x0423: 'be',\n 0x0845: 'bn',\n 0x0445: 'bn-IN',\n 0x201a: 'bs-Cyrl',\n 0x141a: 'bs',\n 0x047e: 'br',\n 0x0402: 'bg',\n 0x0403: 'ca',\n 0x0c04: 'zh-HK',\n 0x1404: 'zh-MO',\n 0x0804: 'zh',\n 0x1004: 'zh-SG',\n 0x0404: 'zh-TW',\n 0x0483: 'co',\n 0x041a: 'hr',\n 0x101a: 'hr-BA',\n 0x0405: 'cs',\n 0x0406: 'da',\n 0x048c: 'prs',\n 0x0465: 'dv',\n 0x0813: 'nl-BE',\n 0x0413: 'nl',\n 0x0c09: 'en-AU',\n 0x2809: 'en-BZ',\n 0x1009: 'en-CA',\n 0x2409: 'en-029',\n 0x4009: 'en-IN',\n 0x1809: 'en-IE',\n 0x2009: 'en-JM',\n 0x4409: 'en-MY',\n 0x1409: 'en-NZ',\n 0x3409: 'en-PH',\n 0x4809: 'en-SG',\n 0x1c09: 'en-ZA',\n 0x2c09: 'en-TT',\n 0x0809: 'en-GB',\n 0x0409: 'en',\n 0x3009: 'en-ZW',\n 0x0425: 'et',\n 0x0438: 'fo',\n 0x0464: 'fil',\n 0x040b: 'fi',\n 0x080c: 'fr-BE',\n 0x0c0c: 'fr-CA',\n 0x040c: 'fr',\n 0x140c: 'fr-LU',\n 0x180c: 'fr-MC',\n 0x100c: 'fr-CH',\n 0x0462: 'fy',\n 0x0456: 'gl',\n 0x0437: 'ka',\n 0x0c07: 'de-AT',\n 0x0407: 'de',\n 0x1407: 'de-LI',\n 0x1007: 'de-LU',\n 0x0807: 'de-CH',\n 0x0408: 'el',\n 0x046f: 'kl',\n 0x0447: 'gu',\n 0x0468: 'ha',\n 0x040d: 'he',\n 0x0439: 'hi',\n 0x040e: 'hu',\n 0x040f: 'is',\n 0x0470: 'ig',\n 0x0421: 'id',\n 0x045d: 'iu',\n 0x085d: 'iu-Latn',\n 0x083c: 'ga',\n 0x0434: 'xh',\n 0x0435: 'zu',\n 0x0410: 'it',\n 0x0810: 'it-CH',\n 0x0411: 'ja',\n 0x044b: 'kn',\n 0x043f: 'kk',\n 0x0453: 'km',\n 0x0486: 'quc',\n 0x0487: 'rw',\n 0x0441: 'sw',\n 0x0457: 'kok',\n 0x0412: 'ko',\n 0x0440: 'ky',\n 0x0454: 'lo',\n 0x0426: 'lv',\n 0x0427: 'lt',\n 0x082e: 'dsb',\n 0x046e: 'lb',\n 0x042f: 'mk',\n 0x083e: 'ms-BN',\n 0x043e: 'ms',\n 0x044c: 'ml',\n 0x043a: 'mt',\n 0x0481: 'mi',\n 0x047a: 'arn',\n 0x044e: 'mr',\n 0x047c: 'moh',\n 0x0450: 'mn',\n 0x0850: 'mn-CN',\n 0x0461: 'ne',\n 0x0414: 'nb',\n 0x0814: 'nn',\n 0x0482: 'oc',\n 0x0448: 'or',\n 0x0463: 'ps',\n 0x0415: 'pl',\n 0x0416: 'pt',\n 0x0816: 'pt-PT',\n 0x0446: 'pa',\n 0x046b: 'qu-BO',\n 0x086b: 'qu-EC',\n 0x0c6b: 'qu',\n 0x0418: 'ro',\n 0x0417: 'rm',\n 0x0419: 'ru',\n 0x243b: 'smn',\n 0x103b: 'smj-NO',\n 0x143b: 'smj',\n 0x0c3b: 'se-FI',\n 0x043b: 'se',\n 0x083b: 'se-SE',\n 0x203b: 'sms',\n 0x183b: 'sma-NO',\n 0x1c3b: 'sms',\n 0x044f: 'sa',\n 0x1c1a: 'sr-Cyrl-BA',\n 0x0c1a: 'sr',\n 0x181a: 'sr-Latn-BA',\n 0x081a: 'sr-Latn',\n 0x046c: 'nso',\n 0x0432: 'tn',\n 0x045b: 'si',\n 0x041b: 'sk',\n 0x0424: 'sl',\n 0x2c0a: 'es-AR',\n 0x400a: 'es-BO',\n 0x340a: 'es-CL',\n 0x240a: 'es-CO',\n 0x140a: 'es-CR',\n 0x1c0a: 'es-DO',\n 0x300a: 'es-EC',\n 0x440a: 'es-SV',\n 0x100a: 'es-GT',\n 0x480a: 'es-HN',\n 0x080a: 'es-MX',\n 0x4c0a: 'es-NI',\n 0x180a: 'es-PA',\n 0x3c0a: 'es-PY',\n 0x280a: 'es-PE',\n 0x500a: 'es-PR',\n\n // Microsoft has defined two different language codes for\n // “Spanish with modern sorting” and “Spanish with traditional\n // sorting”. This makes sense for collation APIs, and it would be\n // possible to express this in BCP 47 language tags via Unicode\n // extensions (eg., es-u-co-trad is Spanish with traditional\n // sorting). However, for storing names in fonts, the distinction\n // does not make sense, so we give “es” in both cases.\n 0x0c0a: 'es',\n 0x040a: 'es',\n\n 0x540a: 'es-US',\n 0x380a: 'es-UY',\n 0x200a: 'es-VE',\n 0x081d: 'sv-FI',\n 0x041d: 'sv',\n 0x045a: 'syr',\n 0x0428: 'tg',\n 0x085f: 'tzm',\n 0x0449: 'ta',\n 0x0444: 'tt',\n 0x044a: 'te',\n 0x041e: 'th',\n 0x0451: 'bo',\n 0x041f: 'tr',\n 0x0442: 'tk',\n 0x0480: 'ug',\n 0x0422: 'uk',\n 0x042e: 'hsb',\n 0x0420: 'ur',\n 0x0843: 'uz-Cyrl',\n 0x0443: 'uz',\n 0x042a: 'vi',\n 0x0452: 'cy',\n 0x0488: 'wo',\n 0x0485: 'sah',\n 0x0478: 'ii',\n 0x046a: 'yo',\n }\n\n // Returns a IETF BCP 47 language code, for example 'zh-Hant'\n // for 'Chinese in the traditional script'.\n function getLanguageCode(platformID, languageID, ltag) {\n switch (platformID) {\n case 0: // Unicode\n if (languageID === 0xffff) {\n return 'und'\n } else if (ltag) {\n return ltag[languageID]\n }\n\n break\n\n case 1: // Macintosh\n return macLanguages[languageID]\n\n case 3: // Windows\n return windowsLanguages[languageID]\n }\n\n return undefined\n }\n\n var utf16 = 'utf-16'\n\n // MacOS script ID → encoding. This table stores the default case,\n // which can be overridden by macLanguageEncodings.\n var macScriptEncodings = {\n 0: 'macintosh', // smRoman\n 1: 'x-mac-japanese', // smJapanese\n 2: 'x-mac-chinesetrad', // smTradChinese\n 3: 'x-mac-korean', // smKorean\n 6: 'x-mac-greek', // smGreek\n 7: 'x-mac-cyrillic', // smCyrillic\n 9: 'x-mac-devanagai', // smDevanagari\n 10: 'x-mac-gurmukhi', // smGurmukhi\n 11: 'x-mac-gujarati', // smGujarati\n 12: 'x-mac-oriya', // smOriya\n 13: 'x-mac-bengali', // smBengali\n 14: 'x-mac-tamil', // smTamil\n 15: 'x-mac-telugu', // smTelugu\n 16: 'x-mac-kannada', // smKannada\n 17: 'x-mac-malayalam', // smMalayalam\n 18: 'x-mac-sinhalese', // smSinhalese\n 19: 'x-mac-burmese', // smBurmese\n 20: 'x-mac-khmer', // smKhmer\n 21: 'x-mac-thai', // smThai\n 22: 'x-mac-lao', // smLao\n 23: 'x-mac-georgian', // smGeorgian\n 24: 'x-mac-armenian', // smArmenian\n 25: 'x-mac-chinesesimp', // smSimpChinese\n 26: 'x-mac-tibetan', // smTibetan\n 27: 'x-mac-mongolian', // smMongolian\n 28: 'x-mac-ethiopic', // smEthiopic\n 29: 'x-mac-ce', // smCentralEuroRoman\n 30: 'x-mac-vietnamese', // smVietnamese\n 31: 'x-mac-extarabic', // smExtArabic\n }\n\n // MacOS language ID → encoding. This table stores the exceptional\n // cases, which override macScriptEncodings. For writing MacOS naming\n // tables, we need to emit a MacOS script ID. Therefore, we cannot\n // merge macScriptEncodings into macLanguageEncodings.\n //\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt\n var macLanguageEncodings = {\n 15: 'x-mac-icelandic', // langIcelandic\n 17: 'x-mac-turkish', // langTurkish\n 18: 'x-mac-croatian', // langCroatian\n 24: 'x-mac-ce', // langLithuanian\n 25: 'x-mac-ce', // langPolish\n 26: 'x-mac-ce', // langHungarian\n 27: 'x-mac-ce', // langEstonian\n 28: 'x-mac-ce', // langLatvian\n 30: 'x-mac-icelandic', // langFaroese\n 37: 'x-mac-romanian', // langRomanian\n 38: 'x-mac-ce', // langCzech\n 39: 'x-mac-ce', // langSlovak\n 40: 'x-mac-ce', // langSlovenian\n 143: 'x-mac-inuit', // langInuktitut\n 146: 'x-mac-gaelic', // langIrishGaelicScript\n }\n\n function getEncoding(platformID, encodingID, languageID) {\n switch (platformID) {\n case 0: // Unicode\n return utf16\n\n case 1: // Apple Macintosh\n return macLanguageEncodings[languageID] || macScriptEncodings[encodingID]\n\n case 3: // Microsoft Windows\n if (encodingID === 1 || encodingID === 10) {\n return utf16\n }\n\n break\n }\n\n return undefined\n }\n\n // Parse the naming `name` table.\n // FIXME: Format 1 additional fields are not supported yet.\n // ltag is the content of the `ltag' table, such as ['en', 'zh-Hans', 'de-CH-1904'].\n function parseNameTable(data, start, ltag) {\n var name = {}\n var p = new parse.Parser(data, start)\n var format = p.parseUShort()\n var count = p.parseUShort()\n var stringOffset = p.offset + p.parseUShort()\n for (var i = 0; i < count; i++) {\n var platformID = p.parseUShort()\n var encodingID = p.parseUShort()\n var languageID = p.parseUShort()\n var nameID = p.parseUShort()\n var property = nameTableNames[nameID] || nameID\n var byteLength = p.parseUShort()\n var offset = p.parseUShort()\n var language = getLanguageCode(platformID, languageID, ltag)\n var encoding = getEncoding(platformID, encodingID, languageID)\n if (encoding !== undefined && language !== undefined) {\n var text = void 0\n if (encoding === utf16) {\n text = decode.UTF16(data, stringOffset + offset, byteLength)\n } else {\n text = decode.MACSTRING(data, stringOffset + offset, byteLength, encoding)\n }\n\n if (text) {\n var translations = name[property]\n if (translations === undefined) {\n translations = name[property] = {}\n }\n\n translations[language] = text\n }\n }\n }\n\n var langTagCount = 0\n if (format === 1) {\n // FIXME: Also handle Microsoft's 'name' table 1.\n langTagCount = p.parseUShort()\n }\n\n return name\n }\n\n // {23: 'foo'} → {'foo': 23}\n // ['bar', 'baz'] → {'bar': 0, 'baz': 1}\n function reverseDict(dict) {\n var result = {}\n for (var key in dict) {\n result[dict[key]] = parseInt(key)\n }\n\n return result\n }\n\n function makeNameRecord(platformID, encodingID, languageID, nameID, length, offset) {\n return new table.Record('NameRecord', [\n { name: 'platformID', type: 'USHORT', value: platformID },\n { name: 'encodingID', type: 'USHORT', value: encodingID },\n { name: 'languageID', type: 'USHORT', value: languageID },\n { name: 'nameID', type: 'USHORT', value: nameID },\n { name: 'length', type: 'USHORT', value: length },\n { name: 'offset', type: 'USHORT', value: offset },\n ])\n }\n\n // Finds the position of needle in haystack, or -1 if not there.\n // Like String.indexOf(), but for arrays.\n function findSubArray(needle, haystack) {\n var needleLength = needle.length\n var limit = haystack.length - needleLength + 1\n\n loop: for (var pos = 0; pos < limit; pos++) {\n for (; pos < limit; pos++) {\n for (var k = 0; k < needleLength; k++) {\n if (haystack[pos + k] !== needle[k]) {\n continue loop\n }\n }\n\n return pos\n }\n }\n\n return -1\n }\n\n function addStringToPool(s, pool) {\n var offset = findSubArray(s, pool)\n if (offset < 0) {\n offset = pool.length\n var i = 0\n var len = s.length\n for (; i < len; ++i) {\n pool.push(s[i])\n }\n }\n\n return offset\n }\n\n function makeNameTable(names, ltag) {\n var nameID\n var nameIDs = []\n\n var namesWithNumericKeys = {}\n var nameTableIds = reverseDict(nameTableNames)\n for (var key in names) {\n var id = nameTableIds[key]\n if (id === undefined) {\n id = key\n }\n\n nameID = parseInt(id)\n\n if (isNaN(nameID)) {\n throw new Error('Name table entry \"' + key + '\" does not exist, see nameTableNames for complete list.')\n }\n\n namesWithNumericKeys[nameID] = names[key]\n nameIDs.push(nameID)\n }\n\n var macLanguageIds = reverseDict(macLanguages)\n var windowsLanguageIds = reverseDict(windowsLanguages)\n\n var nameRecords = []\n var stringPool = []\n\n for (var i = 0; i < nameIDs.length; i++) {\n nameID = nameIDs[i]\n var translations = namesWithNumericKeys[nameID]\n for (var lang in translations) {\n var text = translations[lang]\n\n // For MacOS, we try to emit the name in the form that was introduced\n // in the initial version of the TrueType spec (in the late 1980s).\n // However, this can fail for various reasons: the requested BCP 47\n // language code might not have an old-style Mac equivalent;\n // we might not have a codec for the needed character encoding;\n // or the name might contain characters that cannot be expressed\n // in the old-style Macintosh encoding. In case of failure, we emit\n // the name in a more modern fashion (Unicode encoding with BCP 47\n // language tags) that is recognized by MacOS 10.5, released in 2009.\n // If fonts were only read by operating systems, we could simply\n // emit all names in the modern form; this would be much easier.\n // However, there are many applications and libraries that read\n // 'name' tables directly, and these will usually only recognize\n // the ancient form (silently skipping the unrecognized names).\n var macPlatform = 1 // Macintosh\n var macLanguage = macLanguageIds[lang]\n var macScript = macLanguageToScript[macLanguage]\n var macEncoding = getEncoding(macPlatform, macScript, macLanguage)\n var macName = encode.MACSTRING(text, macEncoding)\n if (macName === undefined) {\n macPlatform = 0 // Unicode\n macLanguage = ltag.indexOf(lang)\n if (macLanguage < 0) {\n macLanguage = ltag.length\n ltag.push(lang)\n }\n\n macScript = 4 // Unicode 2.0 and later\n macName = encode.UTF16(text)\n }\n\n var macNameOffset = addStringToPool(macName, stringPool)\n nameRecords.push(makeNameRecord(macPlatform, macScript, macLanguage, nameID, macName.length, macNameOffset))\n\n var winLanguage = windowsLanguageIds[lang]\n if (winLanguage !== undefined) {\n var winName = encode.UTF16(text)\n var winNameOffset = addStringToPool(winName, stringPool)\n nameRecords.push(makeNameRecord(3, 1, winLanguage, nameID, winName.length, winNameOffset))\n }\n }\n }\n\n nameRecords.sort(function (a, b) {\n return (\n a.platformID - b.platformID || a.encodingID - b.encodingID || a.languageID - b.languageID || a.nameID - b.nameID\n )\n })\n\n var t = new table.Table('name', [\n { name: 'format', type: 'USHORT', value: 0 },\n { name: 'count', type: 'USHORT', value: nameRecords.length },\n { name: 'stringOffset', type: 'USHORT', value: 6 + nameRecords.length * 12 },\n ])\n\n for (var r = 0; r < nameRecords.length; r++) {\n t.fields.push({ name: 'record_' + r, type: 'RECORD', value: nameRecords[r] })\n }\n\n t.fields.push({ name: 'strings', type: 'LITERAL', value: stringPool })\n return t\n }\n\n var _name = { parse: parseNameTable, make: makeNameTable }\n\n // The `OS/2` table contains metrics required in OpenType fonts.\n\n var unicodeRanges = [\n { begin: 0x0000, end: 0x007f }, // Basic Latin\n { begin: 0x0080, end: 0x00ff }, // Latin-1 Supplement\n { begin: 0x0100, end: 0x017f }, // Latin Extended-A\n { begin: 0x0180, end: 0x024f }, // Latin Extended-B\n { begin: 0x0250, end: 0x02af }, // IPA Extensions\n { begin: 0x02b0, end: 0x02ff }, // Spacing Modifier Letters\n { begin: 0x0300, end: 0x036f }, // Combining Diacritical Marks\n { begin: 0x0370, end: 0x03ff }, // Greek and Coptic\n { begin: 0x2c80, end: 0x2cff }, // Coptic\n { begin: 0x0400, end: 0x04ff }, // Cyrillic\n { begin: 0x0530, end: 0x058f }, // Armenian\n { begin: 0x0590, end: 0x05ff }, // Hebrew\n { begin: 0xa500, end: 0xa63f }, // Vai\n { begin: 0x0600, end: 0x06ff }, // Arabic\n { begin: 0x07c0, end: 0x07ff }, // NKo\n { begin: 0x0900, end: 0x097f }, // Devanagari\n { begin: 0x0980, end: 0x09ff }, // Bengali\n { begin: 0x0a00, end: 0x0a7f }, // Gurmukhi\n { begin: 0x0a80, end: 0x0aff }, // Gujarati\n { begin: 0x0b00, end: 0x0b7f }, // Oriya\n { begin: 0x0b80, end: 0x0bff }, // Tamil\n { begin: 0x0c00, end: 0x0c7f }, // Telugu\n { begin: 0x0c80, end: 0x0cff }, // Kannada\n { begin: 0x0d00, end: 0x0d7f }, // Malayalam\n { begin: 0x0e00, end: 0x0e7f }, // Thai\n { begin: 0x0e80, end: 0x0eff }, // Lao\n { begin: 0x10a0, end: 0x10ff }, // Georgian\n { begin: 0x1b00, end: 0x1b7f }, // Balinese\n { begin: 0x1100, end: 0x11ff }, // Hangul Jamo\n { begin: 0x1e00, end: 0x1eff }, // Latin Extended Additional\n { begin: 0x1f00, end: 0x1fff }, // Greek Extended\n { begin: 0x2000, end: 0x206f }, // General Punctuation\n { begin: 0x2070, end: 0x209f }, // Superscripts And Subscripts\n { begin: 0x20a0, end: 0x20cf }, // Currency Symbol\n { begin: 0x20d0, end: 0x20ff }, // Combining Diacritical Marks For Symbols\n { begin: 0x2100, end: 0x214f }, // Letterlike Symbols\n { begin: 0x2150, end: 0x218f }, // Number Forms\n { begin: 0x2190, end: 0x21ff }, // Arrows\n { begin: 0x2200, end: 0x22ff }, // Mathematical Operators\n { begin: 0x2300, end: 0x23ff }, // Miscellaneous Technical\n { begin: 0x2400, end: 0x243f }, // Control Pictures\n { begin: 0x2440, end: 0x245f }, // Optical Character Recognition\n { begin: 0x2460, end: 0x24ff }, // Enclosed Alphanumerics\n { begin: 0x2500, end: 0x257f }, // Box Drawing\n { begin: 0x2580, end: 0x259f }, // Block Elements\n { begin: 0x25a0, end: 0x25ff }, // Geometric Shapes\n { begin: 0x2600, end: 0x26ff }, // Miscellaneous Symbols\n { begin: 0x2700, end: 0x27bf }, // Dingbats\n { begin: 0x3000, end: 0x303f }, // CJK Symbols And Punctuation\n { begin: 0x3040, end: 0x309f }, // Hiragana\n { begin: 0x30a0, end: 0x30ff }, // Katakana\n { begin: 0x3100, end: 0x312f }, // Bopomofo\n { begin: 0x3130, end: 0x318f }, // Hangul Compatibility Jamo\n { begin: 0xa840, end: 0xa87f }, // Phags-pa\n { begin: 0x3200, end: 0x32ff }, // Enclosed CJK Letters And Months\n { begin: 0x3300, end: 0x33ff }, // CJK Compatibility\n { begin: 0xac00, end: 0xd7af }, // Hangul Syllables\n { begin: 0xd800, end: 0xdfff }, // Non-Plane 0 *\n { begin: 0x10900, end: 0x1091f }, // Phoenicia\n { begin: 0x4e00, end: 0x9fff }, // CJK Unified Ideographs\n { begin: 0xe000, end: 0xf8ff }, // Private Use Area (plane 0)\n { begin: 0x31c0, end: 0x31ef }, // CJK Strokes\n { begin: 0xfb00, end: 0xfb4f }, // Alphabetic Presentation Forms\n { begin: 0xfb50, end: 0xfdff }, // Arabic Presentation Forms-A\n { begin: 0xfe20, end: 0xfe2f }, // Combining Half Marks\n { begin: 0xfe10, end: 0xfe1f }, // Vertical Forms\n { begin: 0xfe50, end: 0xfe6f }, // Small Form Variants\n { begin: 0xfe70, end: 0xfeff }, // Arabic Presentation Forms-B\n { begin: 0xff00, end: 0xffef }, // Halfwidth And Fullwidth Forms\n { begin: 0xfff0, end: 0xffff }, // Specials\n { begin: 0x0f00, end: 0x0fff }, // Tibetan\n { begin: 0x0700, end: 0x074f }, // Syriac\n { begin: 0x0780, end: 0x07bf }, // Thaana\n { begin: 0x0d80, end: 0x0dff }, // Sinhala\n { begin: 0x1000, end: 0x109f }, // Myanmar\n { begin: 0x1200, end: 0x137f }, // Ethiopic\n { begin: 0x13a0, end: 0x13ff }, // Cherokee\n { begin: 0x1400, end: 0x167f }, // Unified Canadian Aboriginal Syllabics\n { begin: 0x1680, end: 0x169f }, // Ogham\n { begin: 0x16a0, end: 0x16ff }, // Runic\n { begin: 0x1780, end: 0x17ff }, // Khmer\n { begin: 0x1800, end: 0x18af }, // Mongolian\n { begin: 0x2800, end: 0x28ff }, // Braille Patterns\n { begin: 0xa000, end: 0xa48f }, // Yi Syllables\n { begin: 0x1700, end: 0x171f }, // Tagalog\n { begin: 0x10300, end: 0x1032f }, // Old Italic\n { begin: 0x10330, end: 0x1034f }, // Gothic\n { begin: 0x10400, end: 0x1044f }, // Deseret\n { begin: 0x1d000, end: 0x1d0ff }, // Byzantine Musical Symbols\n { begin: 0x1d400, end: 0x1d7ff }, // Mathematical Alphanumeric Symbols\n { begin: 0xff000, end: 0xffffd }, // Private Use (plane 15)\n { begin: 0xfe00, end: 0xfe0f }, // Variation Selectors\n { begin: 0xe0000, end: 0xe007f }, // Tags\n { begin: 0x1900, end: 0x194f }, // Limbu\n { begin: 0x1950, end: 0x197f }, // Tai Le\n { begin: 0x1980, end: 0x19df }, // New Tai Lue\n { begin: 0x1a00, end: 0x1a1f }, // Buginese\n { begin: 0x2c00, end: 0x2c5f }, // Glagolitic\n { begin: 0x2d30, end: 0x2d7f }, // Tifinagh\n { begin: 0x4dc0, end: 0x4dff }, // Yijing Hexagram Symbols\n { begin: 0xa800, end: 0xa82f }, // Syloti Nagri\n { begin: 0x10000, end: 0x1007f }, // Linear B Syllabary\n { begin: 0x10140, end: 0x1018f }, // Ancient Greek Numbers\n { begin: 0x10380, end: 0x1039f }, // Ugaritic\n { begin: 0x103a0, end: 0x103df }, // Old Persian\n { begin: 0x10450, end: 0x1047f }, // Shavian\n { begin: 0x10480, end: 0x104af }, // Osmanya\n { begin: 0x10800, end: 0x1083f }, // Cypriot Syllabary\n { begin: 0x10a00, end: 0x10a5f }, // Kharoshthi\n { begin: 0x1d300, end: 0x1d35f }, // Tai Xuan Jing Symbols\n { begin: 0x12000, end: 0x123ff }, // Cuneiform\n { begin: 0x1d360, end: 0x1d37f }, // Counting Rod Numerals\n { begin: 0x1b80, end: 0x1bbf }, // Sundanese\n { begin: 0x1c00, end: 0x1c4f }, // Lepcha\n { begin: 0x1c50, end: 0x1c7f }, // Ol Chiki\n { begin: 0xa880, end: 0xa8df }, // Saurashtra\n { begin: 0xa900, end: 0xa92f }, // Kayah Li\n { begin: 0xa930, end: 0xa95f }, // Rejang\n { begin: 0xaa00, end: 0xaa5f }, // Cham\n { begin: 0x10190, end: 0x101cf }, // Ancient Symbols\n { begin: 0x101d0, end: 0x101ff }, // Phaistos Disc\n { begin: 0x102a0, end: 0x102df }, // Carian\n { begin: 0x1f030, end: 0x1f09f }, // Domino Tiles\n ]\n\n function getUnicodeRange(unicode) {\n for (var i = 0; i < unicodeRanges.length; i += 1) {\n var range = unicodeRanges[i]\n if (unicode >= range.begin && unicode < range.end) {\n return i\n }\n }\n\n return -1\n }\n\n // Parse the OS/2 and Windows metrics `OS/2` table\n function parseOS2Table(data, start) {\n var os2 = {}\n var p = new parse.Parser(data, start)\n os2.version = p.parseUShort()\n os2.xAvgCharWidth = p.parseShort()\n os2.usWeightClass = p.parseUShort()\n os2.usWidthClass = p.parseUShort()\n os2.fsType = p.parseUShort()\n os2.ySubscriptXSize = p.parseShort()\n os2.ySubscriptYSize = p.parseShort()\n os2.ySubscriptXOffset = p.parseShort()\n os2.ySubscriptYOffset = p.parseShort()\n os2.ySuperscriptXSize = p.parseShort()\n os2.ySuperscriptYSize = p.parseShort()\n os2.ySuperscriptXOffset = p.parseShort()\n os2.ySuperscriptYOffset = p.parseShort()\n os2.yStrikeoutSize = p.parseShort()\n os2.yStrikeoutPosition = p.parseShort()\n os2.sFamilyClass = p.parseShort()\n os2.panose = []\n for (var i = 0; i < 10; i++) {\n os2.panose[i] = p.parseByte()\n }\n\n os2.ulUnicodeRange1 = p.parseULong()\n os2.ulUnicodeRange2 = p.parseULong()\n os2.ulUnicodeRange3 = p.parseULong()\n os2.ulUnicodeRange4 = p.parseULong()\n os2.achVendID = String.fromCharCode(p.parseByte(), p.parseByte(), p.parseByte(), p.parseByte())\n os2.fsSelection = p.parseUShort()\n os2.usFirstCharIndex = p.parseUShort()\n os2.usLastCharIndex = p.parseUShort()\n os2.sTypoAscender = p.parseShort()\n os2.sTypoDescender = p.parseShort()\n os2.sTypoLineGap = p.parseShort()\n os2.usWinAscent = p.parseUShort()\n os2.usWinDescent = p.parseUShort()\n if (os2.version >= 1) {\n os2.ulCodePageRange1 = p.parseULong()\n os2.ulCodePageRange2 = p.parseULong()\n }\n\n if (os2.version >= 2) {\n os2.sxHeight = p.parseShort()\n os2.sCapHeight = p.parseShort()\n os2.usDefaultChar = p.parseUShort()\n os2.usBreakChar = p.parseUShort()\n os2.usMaxContent = p.parseUShort()\n }\n\n return os2\n }\n\n function makeOS2Table(options) {\n return new table.Table(\n 'OS/2',\n [\n { name: 'version', type: 'USHORT', value: 0x0003 },\n { name: 'xAvgCharWidth', type: 'SHORT', value: 0 },\n { name: 'usWeightClass', type: 'USHORT', value: 0 },\n { name: 'usWidthClass', type: 'USHORT', value: 0 },\n { name: 'fsType', type: 'USHORT', value: 0 },\n { name: 'ySubscriptXSize', type: 'SHORT', value: 650 },\n { name: 'ySubscriptYSize', type: 'SHORT', value: 699 },\n { name: 'ySubscriptXOffset', type: 'SHORT', value: 0 },\n { name: 'ySubscriptYOffset', type: 'SHORT', value: 140 },\n { name: 'ySuperscriptXSize', type: 'SHORT', value: 650 },\n { name: 'ySuperscriptYSize', type: 'SHORT', value: 699 },\n { name: 'ySuperscriptXOffset', type: 'SHORT', value: 0 },\n { name: 'ySuperscriptYOffset', type: 'SHORT', value: 479 },\n { name: 'yStrikeoutSize', type: 'SHORT', value: 49 },\n { name: 'yStrikeoutPosition', type: 'SHORT', value: 258 },\n { name: 'sFamilyClass', type: 'SHORT', value: 0 },\n { name: 'bFamilyType', type: 'BYTE', value: 0 },\n { name: 'bSerifStyle', type: 'BYTE', value: 0 },\n { name: 'bWeight', type: 'BYTE', value: 0 },\n { name: 'bProportion', type: 'BYTE', value: 0 },\n { name: 'bContrast', type: 'BYTE', value: 0 },\n { name: 'bStrokeVariation', type: 'BYTE', value: 0 },\n { name: 'bArmStyle', type: 'BYTE', value: 0 },\n { name: 'bLetterform', type: 'BYTE', value: 0 },\n { name: 'bMidline', type: 'BYTE', value: 0 },\n { name: 'bXHeight', type: 'BYTE', value: 0 },\n { name: 'ulUnicodeRange1', type: 'ULONG', value: 0 },\n { name: 'ulUnicodeRange2', type: 'ULONG', value: 0 },\n { name: 'ulUnicodeRange3', type: 'ULONG', value: 0 },\n { name: 'ulUnicodeRange4', type: 'ULONG', value: 0 },\n { name: 'achVendID', type: 'CHARARRAY', value: 'XXXX' },\n { name: 'fsSelection', type: 'USHORT', value: 0 },\n { name: 'usFirstCharIndex', type: 'USHORT', value: 0 },\n { name: 'usLastCharIndex', type: 'USHORT', value: 0 },\n { name: 'sTypoAscender', type: 'SHORT', value: 0 },\n { name: 'sTypoDescender', type: 'SHORT', value: 0 },\n { name: 'sTypoLineGap', type: 'SHORT', value: 0 },\n { name: 'usWinAscent', type: 'USHORT', value: 0 },\n { name: 'usWinDescent', type: 'USHORT', value: 0 },\n { name: 'ulCodePageRange1', type: 'ULONG', value: 0 },\n { name: 'ulCodePageRange2', type: 'ULONG', value: 0 },\n { name: 'sxHeight', type: 'SHORT', value: 0 },\n { name: 'sCapHeight', type: 'SHORT', value: 0 },\n { name: 'usDefaultChar', type: 'USHORT', value: 0 },\n { name: 'usBreakChar', type: 'USHORT', value: 0 },\n { name: 'usMaxContext', type: 'USHORT', value: 0 },\n ],\n options,\n )\n }\n\n var os2 = { parse: parseOS2Table, make: makeOS2Table, unicodeRanges: unicodeRanges, getUnicodeRange: getUnicodeRange }\n\n // The `post` table stores additional PostScript information, such as glyph names.\n\n // Parse the PostScript `post` table\n function parsePostTable(data, start) {\n var post = {}\n var p = new parse.Parser(data, start)\n post.version = p.parseVersion()\n post.italicAngle = p.parseFixed()\n post.underlinePosition = p.parseShort()\n post.underlineThickness = p.parseShort()\n post.isFixedPitch = p.parseULong()\n post.minMemType42 = p.parseULong()\n post.maxMemType42 = p.parseULong()\n post.minMemType1 = p.parseULong()\n post.maxMemType1 = p.parseULong()\n switch (post.version) {\n case 1:\n post.names = standardNames.slice()\n break\n case 2:\n post.numberOfGlyphs = p.parseUShort()\n post.glyphNameIndex = new Array(post.numberOfGlyphs)\n for (var i = 0; i < post.numberOfGlyphs; i++) {\n post.glyphNameIndex[i] = p.parseUShort()\n }\n\n post.names = []\n for (var i$1 = 0; i$1 < post.numberOfGlyphs; i$1++) {\n if (post.glyphNameIndex[i$1] >= standardNames.length) {\n var nameLength = p.parseChar()\n post.names.push(p.parseString(nameLength))\n }\n }\n\n break\n case 2.5:\n post.numberOfGlyphs = p.parseUShort()\n post.offset = new Array(post.numberOfGlyphs)\n for (var i$2 = 0; i$2 < post.numberOfGlyphs; i$2++) {\n post.offset[i$2] = p.parseChar()\n }\n\n break\n }\n return post\n }\n\n function makePostTable() {\n return new table.Table('post', [\n { name: 'version', type: 'FIXED', value: 0x00030000 },\n { name: 'italicAngle', type: 'FIXED', value: 0 },\n { name: 'underlinePosition', type: 'FWORD', value: 0 },\n { name: 'underlineThickness', type: 'FWORD', value: 0 },\n { name: 'isFixedPitch', type: 'ULONG', value: 0 },\n { name: 'minMemType42', type: 'ULONG', value: 0 },\n { name: 'maxMemType42', type: 'ULONG', value: 0 },\n { name: 'minMemType1', type: 'ULONG', value: 0 },\n { name: 'maxMemType1', type: 'ULONG', value: 0 },\n ])\n }\n\n var post = { parse: parsePostTable, make: makePostTable }\n\n // The `GSUB` table contains ligatures, among other things.\n\n var subtableParsers = new Array(9) // subtableParsers[0] is unused\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#SS\n subtableParsers[1] = function parseLookup1() {\n var start = this.offset + this.relativeOffset\n var substFormat = this.parseUShort()\n if (substFormat === 1) {\n return {\n substFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n deltaGlyphId: this.parseUShort(),\n }\n } else if (substFormat === 2) {\n return {\n substFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n substitute: this.parseOffset16List(),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': lookup type 1 format must be 1 or 2.')\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#MS\n subtableParsers[2] = function parseLookup2() {\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB Multiple Substitution Subtable identifier-format must be 1')\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n sequences: this.parseListOfLists(),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#AS\n subtableParsers[3] = function parseLookup3() {\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB Alternate Substitution Subtable identifier-format must be 1')\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n alternateSets: this.parseListOfLists(),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#LS\n subtableParsers[4] = function parseLookup4() {\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB ligature table identifier-format must be 1')\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n ligatureSets: this.parseListOfLists(function () {\n return {\n ligGlyph: this.parseUShort(),\n components: this.parseUShortList(this.parseUShort() - 1),\n }\n }),\n }\n }\n\n var lookupRecordDesc = {\n sequenceIndex: Parser.uShort,\n lookupListIndex: Parser.uShort,\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#CSF\n subtableParsers[5] = function parseLookup5() {\n var start = this.offset + this.relativeOffset\n var substFormat = this.parseUShort()\n\n if (substFormat === 1) {\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n ruleSets: this.parseListOfLists(function () {\n var glyphCount = this.parseUShort()\n var substCount = this.parseUShort()\n return {\n input: this.parseUShortList(glyphCount - 1),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 2) {\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n classDef: this.parsePointer(Parser.classDef),\n classSets: this.parseListOfLists(function () {\n var glyphCount = this.parseUShort()\n var substCount = this.parseUShort()\n return {\n classes: this.parseUShortList(glyphCount - 1),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 3) {\n var glyphCount = this.parseUShort()\n var substCount = this.parseUShort()\n return {\n substFormat: substFormat,\n coverages: this.parseList(glyphCount, Parser.pointer(Parser.coverage)),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': lookup type 5 format must be 1, 2 or 3.')\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#CC\n subtableParsers[6] = function parseLookup6() {\n var start = this.offset + this.relativeOffset\n var substFormat = this.parseUShort()\n if (substFormat === 1) {\n return {\n substFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n chainRuleSets: this.parseListOfLists(function () {\n return {\n backtrack: this.parseUShortList(),\n input: this.parseUShortList(this.parseShort() - 1),\n lookahead: this.parseUShortList(),\n lookupRecords: this.parseRecordList(lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 2) {\n return {\n substFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n backtrackClassDef: this.parsePointer(Parser.classDef),\n inputClassDef: this.parsePointer(Parser.classDef),\n lookaheadClassDef: this.parsePointer(Parser.classDef),\n chainClassSet: this.parseListOfLists(function () {\n return {\n backtrack: this.parseUShortList(),\n input: this.parseUShortList(this.parseShort() - 1),\n lookahead: this.parseUShortList(),\n lookupRecords: this.parseRecordList(lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 3) {\n return {\n substFormat: 3,\n backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n inputCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookupRecords: this.parseRecordList(lookupRecordDesc),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': lookup type 6 format must be 1, 2 or 3.')\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#ES\n subtableParsers[7] = function parseLookup7() {\n // Extension Substitution subtable\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB Extension Substitution subtable identifier-format must be 1')\n var extensionLookupType = this.parseUShort()\n var extensionParser = new Parser(this.data, this.offset + this.parseULong())\n return {\n substFormat: 1,\n lookupType: extensionLookupType,\n extension: subtableParsers[extensionLookupType].call(extensionParser),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#RCCS\n subtableParsers[8] = function parseLookup8() {\n var substFormat = this.parseUShort()\n check.argument(\n substFormat === 1,\n 'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1',\n )\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n substitutes: this.parseUShortList(),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/gsub.htm\n function parseGsubTable(data, start) {\n start = start || 0\n var p = new Parser(data, start)\n var tableVersion = p.parseVersion(1)\n check.argument(tableVersion === 1 || tableVersion === 1.1, 'Unsupported GSUB table version.')\n if (tableVersion === 1) {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers),\n }\n } else {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers),\n variations: p.parseFeatureVariationsList(),\n }\n }\n }\n\n // GSUB Writing //////////////////////////////////////////////\n var subtableMakers = new Array(9)\n\n subtableMakers[1] = function makeLookup1(subtable) {\n if (subtable.substFormat === 1) {\n return new table.Table('substitutionTable', [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n { name: 'deltaGlyphID', type: 'USHORT', value: subtable.deltaGlyphId },\n ])\n } else {\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 2 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(table.ushortList('substitute', subtable.substitute)),\n )\n }\n }\n\n subtableMakers[2] = function makeLookup2(subtable) {\n check.assert(subtable.substFormat === 1, 'Lookup type 2 substFormat must be 1.')\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('seqSet', subtable.sequences, function (sequenceSet) {\n return new table.Table('sequenceSetTable', table.ushortList('sequence', sequenceSet))\n }),\n ),\n )\n }\n\n subtableMakers[3] = function makeLookup3(subtable) {\n check.assert(subtable.substFormat === 1, 'Lookup type 3 substFormat must be 1.')\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('altSet', subtable.alternateSets, function (alternateSet) {\n return new table.Table('alternateSetTable', table.ushortList('alternate', alternateSet))\n }),\n ),\n )\n }\n\n subtableMakers[4] = function makeLookup4(subtable) {\n check.assert(subtable.substFormat === 1, 'Lookup type 4 substFormat must be 1.')\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('ligSet', subtable.ligatureSets, function (ligatureSet) {\n return new table.Table(\n 'ligatureSetTable',\n table.tableList('ligature', ligatureSet, function (ligature) {\n return new table.Table(\n 'ligatureTable',\n [{ name: 'ligGlyph', type: 'USHORT', value: ligature.ligGlyph }].concat(\n table.ushortList('component', ligature.components, ligature.components.length + 1),\n ),\n )\n }),\n )\n }),\n ),\n )\n }\n\n subtableMakers[6] = function makeLookup6(subtable) {\n if (subtable.substFormat === 1) {\n var returnTable = new table.Table(\n 'chainContextTable',\n [\n { name: 'substFormat', type: 'USHORT', value: subtable.substFormat },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('chainRuleSet', subtable.chainRuleSets, function (chainRuleSet) {\n return new table.Table(\n 'chainRuleSetTable',\n table.tableList('chainRule', chainRuleSet, function (chainRule) {\n var tableData = table\n .ushortList('backtrackGlyph', chainRule.backtrack, chainRule.backtrack.length)\n .concat(table.ushortList('inputGlyph', chainRule.input, chainRule.input.length + 1))\n .concat(table.ushortList('lookaheadGlyph', chainRule.lookahead, chainRule.lookahead.length))\n .concat(table.ushortList('substitution', [], chainRule.lookupRecords.length))\n\n chainRule.lookupRecords.forEach(function (record, i) {\n tableData = tableData\n .concat({ name: 'sequenceIndex' + i, type: 'USHORT', value: record.sequenceIndex })\n .concat({ name: 'lookupListIndex' + i, type: 'USHORT', value: record.lookupListIndex })\n })\n return new table.Table('chainRuleTable', tableData)\n }),\n )\n }),\n ),\n )\n return returnTable\n } else if (subtable.substFormat === 2) {\n check.assert(false, 'lookup type 6 format 2 is not yet supported.')\n } else if (subtable.substFormat === 3) {\n var tableData = [{ name: 'substFormat', type: 'USHORT', value: subtable.substFormat }]\n\n tableData.push({ name: 'backtrackGlyphCount', type: 'USHORT', value: subtable.backtrackCoverage.length })\n subtable.backtrackCoverage.forEach(function (coverage, i) {\n tableData.push({ name: 'backtrackCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage) })\n })\n tableData.push({ name: 'inputGlyphCount', type: 'USHORT', value: subtable.inputCoverage.length })\n subtable.inputCoverage.forEach(function (coverage, i) {\n tableData.push({ name: 'inputCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage) })\n })\n tableData.push({ name: 'lookaheadGlyphCount', type: 'USHORT', value: subtable.lookaheadCoverage.length })\n subtable.lookaheadCoverage.forEach(function (coverage, i) {\n tableData.push({ name: 'lookaheadCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage) })\n })\n\n tableData.push({ name: 'substitutionCount', type: 'USHORT', value: subtable.lookupRecords.length })\n subtable.lookupRecords.forEach(function (record, i) {\n tableData = tableData\n .concat({ name: 'sequenceIndex' + i, type: 'USHORT', value: record.sequenceIndex })\n .concat({ name: 'lookupListIndex' + i, type: 'USHORT', value: record.lookupListIndex })\n })\n\n var returnTable$1 = new table.Table('chainContextTable', tableData)\n\n return returnTable$1\n }\n\n check.assert(false, 'lookup type 6 format must be 1, 2 or 3.')\n }\n\n function makeGsubTable(gsub) {\n return new table.Table('GSUB', [\n { name: 'version', type: 'ULONG', value: 0x10000 },\n { name: 'scripts', type: 'TABLE', value: new table.ScriptList(gsub.scripts) },\n { name: 'features', type: 'TABLE', value: new table.FeatureList(gsub.features) },\n { name: 'lookups', type: 'TABLE', value: new table.LookupList(gsub.lookups, subtableMakers) },\n ])\n }\n\n var gsub = { parse: parseGsubTable, make: makeGsubTable }\n\n // The `GPOS` table contains kerning pairs, among other things.\n\n // Parse the metadata `meta` table.\n // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6meta.html\n function parseMetaTable(data, start) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseULong()\n check.argument(tableVersion === 1, 'Unsupported META table version.')\n p.parseULong() // flags - currently unused and set to 0\n p.parseULong() // tableOffset\n var numDataMaps = p.parseULong()\n\n var tags = {}\n for (var i = 0; i < numDataMaps; i++) {\n var tag = p.parseTag()\n var dataOffset = p.parseULong()\n var dataLength = p.parseULong()\n var text = decode.UTF8(data, start + dataOffset, dataLength)\n\n tags[tag] = text\n }\n return tags\n }\n\n function makeMetaTable(tags) {\n var numTags = Object.keys(tags).length\n var stringPool = ''\n var stringPoolOffset = 16 + numTags * 12\n\n var result = new table.Table('meta', [\n { name: 'version', type: 'ULONG', value: 1 },\n { name: 'flags', type: 'ULONG', value: 0 },\n { name: 'offset', type: 'ULONG', value: stringPoolOffset },\n { name: 'numTags', type: 'ULONG', value: numTags },\n ])\n\n for (var tag in tags) {\n var pos = stringPool.length\n stringPool += tags[tag]\n\n result.fields.push({ name: 'tag ' + tag, type: 'TAG', value: tag })\n result.fields.push({ name: 'offset ' + tag, type: 'ULONG', value: stringPoolOffset + pos })\n result.fields.push({ name: 'length ' + tag, type: 'ULONG', value: tags[tag].length })\n }\n\n result.fields.push({ name: 'stringPool', type: 'CHARARRAY', value: stringPool })\n\n return result\n }\n\n var meta = { parse: parseMetaTable, make: makeMetaTable }\n\n // The `sfnt` wrapper provides organization for the tables in the font.\n\n function log2(v) {\n return (Math.log(v) / Math.log(2)) | 0\n }\n\n function computeCheckSum(bytes) {\n while (bytes.length % 4 !== 0) {\n bytes.push(0)\n }\n\n var sum = 0\n for (var i = 0; i < bytes.length; i += 4) {\n sum += (bytes[i] << 24) + (bytes[i + 1] << 16) + (bytes[i + 2] << 8) + bytes[i + 3]\n }\n\n sum %= Math.pow(2, 32)\n return sum\n }\n\n function makeTableRecord(tag, checkSum, offset, length) {\n return new table.Record('Table Record', [\n { name: 'tag', type: 'TAG', value: tag !== undefined ? tag : '' },\n { name: 'checkSum', type: 'ULONG', value: checkSum !== undefined ? checkSum : 0 },\n { name: 'offset', type: 'ULONG', value: offset !== undefined ? offset : 0 },\n { name: 'length', type: 'ULONG', value: length !== undefined ? length : 0 },\n ])\n }\n\n function makeSfntTable(tables) {\n var sfnt = new table.Table('sfnt', [\n { name: 'version', type: 'TAG', value: 'OTTO' },\n { name: 'numTables', type: 'USHORT', value: 0 },\n { name: 'searchRange', type: 'USHORT', value: 0 },\n { name: 'entrySelector', type: 'USHORT', value: 0 },\n { name: 'rangeShift', type: 'USHORT', value: 0 },\n ])\n sfnt.tables = tables\n sfnt.numTables = tables.length\n var highestPowerOf2 = Math.pow(2, log2(sfnt.numTables))\n sfnt.searchRange = 16 * highestPowerOf2\n sfnt.entrySelector = log2(highestPowerOf2)\n sfnt.rangeShift = sfnt.numTables * 16 - sfnt.searchRange\n\n var recordFields = []\n var tableFields = []\n\n var offset = sfnt.sizeOf() + makeTableRecord().sizeOf() * sfnt.numTables\n while (offset % 4 !== 0) {\n offset += 1\n tableFields.push({ name: 'padding', type: 'BYTE', value: 0 })\n }\n\n for (var i = 0; i < tables.length; i += 1) {\n var t = tables[i]\n check.argument(t.tableName.length === 4, 'Table name' + t.tableName + ' is invalid.')\n var tableLength = t.sizeOf()\n var tableRecord = makeTableRecord(t.tableName, computeCheckSum(t.encode()), offset, tableLength)\n recordFields.push({ name: tableRecord.tag + ' Table Record', type: 'RECORD', value: tableRecord })\n tableFields.push({ name: t.tableName + ' table', type: 'RECORD', value: t })\n offset += tableLength\n check.argument(!isNaN(offset), 'Something went wrong calculating the offset.')\n while (offset % 4 !== 0) {\n offset += 1\n tableFields.push({ name: 'padding', type: 'BYTE', value: 0 })\n }\n }\n\n // Table records need to be sorted alphabetically.\n recordFields.sort(function (r1, r2) {\n if (r1.value.tag > r2.value.tag) {\n return 1\n } else {\n return -1\n }\n })\n\n sfnt.fields = sfnt.fields.concat(recordFields)\n sfnt.fields = sfnt.fields.concat(tableFields)\n return sfnt\n }\n\n // Get the metrics for a character. If the string has more than one character\n // this function returns metrics for the first available character.\n // You can provide optional fallback metrics if no characters are available.\n function metricsForChar(font, chars, notFoundMetrics) {\n for (var i = 0; i < chars.length; i += 1) {\n var glyphIndex = font.charToGlyphIndex(chars[i])\n if (glyphIndex > 0) {\n var glyph = font.glyphs.get(glyphIndex)\n return glyph.getMetrics()\n }\n }\n\n return notFoundMetrics\n }\n\n function average(vs) {\n var sum = 0\n for (var i = 0; i < vs.length; i += 1) {\n sum += vs[i]\n }\n\n return sum / vs.length\n }\n\n // Convert the font object to a SFNT data structure.\n // This structure contains all the necessary tables and metadata to create a binary OTF file.\n function fontToSfntTable(font) {\n var xMins = []\n var yMins = []\n var xMaxs = []\n var yMaxs = []\n var advanceWidths = []\n var leftSideBearings = []\n var rightSideBearings = []\n var firstCharIndex\n var lastCharIndex = 0\n var ulUnicodeRange1 = 0\n var ulUnicodeRange2 = 0\n var ulUnicodeRange3 = 0\n var ulUnicodeRange4 = 0\n\n for (var i = 0; i < font.glyphs.length; i += 1) {\n var glyph = font.glyphs.get(i)\n var unicode = glyph.unicode | 0\n\n if (isNaN(glyph.advanceWidth)) {\n throw new Error('Glyph ' + glyph.name + ' (' + i + '): advanceWidth is not a number.')\n }\n\n if (firstCharIndex > unicode || firstCharIndex === undefined) {\n // ignore .notdef char\n if (unicode > 0) {\n firstCharIndex = unicode\n }\n }\n\n if (lastCharIndex < unicode) {\n lastCharIndex = unicode\n }\n\n var position = os2.getUnicodeRange(unicode)\n if (position < 32) {\n ulUnicodeRange1 |= 1 << position\n } else if (position < 64) {\n ulUnicodeRange2 |= 1 << (position - 32)\n } else if (position < 96) {\n ulUnicodeRange3 |= 1 << (position - 64)\n } else if (position < 123) {\n ulUnicodeRange4 |= 1 << (position - 96)\n } else {\n throw new Error('Unicode ranges bits > 123 are reserved for internal usage')\n }\n // Skip non-important characters.\n if (glyph.name === '.notdef') {\n continue\n }\n var metrics = glyph.getMetrics()\n xMins.push(metrics.xMin)\n yMins.push(metrics.yMin)\n xMaxs.push(metrics.xMax)\n yMaxs.push(metrics.yMax)\n leftSideBearings.push(metrics.leftSideBearing)\n rightSideBearings.push(metrics.rightSideBearing)\n advanceWidths.push(glyph.advanceWidth)\n }\n\n var globals = {\n xMin: Math.min.apply(null, xMins),\n yMin: Math.min.apply(null, yMins),\n xMax: Math.max.apply(null, xMaxs),\n yMax: Math.max.apply(null, yMaxs),\n advanceWidthMax: Math.max.apply(null, advanceWidths),\n advanceWidthAvg: average(advanceWidths),\n minLeftSideBearing: Math.min.apply(null, leftSideBearings),\n maxLeftSideBearing: Math.max.apply(null, leftSideBearings),\n minRightSideBearing: Math.min.apply(null, rightSideBearings),\n }\n globals.ascender = font.ascender\n globals.descender = font.descender\n\n var headTable = head.make({\n flags: 3, // 00000011 (baseline for font at y=0; left sidebearing point at x=0)\n unitsPerEm: font.unitsPerEm,\n xMin: globals.xMin,\n yMin: globals.yMin,\n xMax: globals.xMax,\n yMax: globals.yMax,\n lowestRecPPEM: 3,\n createdTimestamp: font.createdTimestamp,\n })\n\n var hheaTable = hhea.make({\n ascender: globals.ascender,\n descender: globals.descender,\n advanceWidthMax: globals.advanceWidthMax,\n minLeftSideBearing: globals.minLeftSideBearing,\n minRightSideBearing: globals.minRightSideBearing,\n xMaxExtent: globals.maxLeftSideBearing + (globals.xMax - globals.xMin),\n numberOfHMetrics: font.glyphs.length,\n })\n\n var maxpTable = maxp.make(font.glyphs.length)\n\n var os2Table = os2.make(\n Object.assign(\n {\n xAvgCharWidth: Math.round(globals.advanceWidthAvg),\n usFirstCharIndex: firstCharIndex,\n usLastCharIndex: lastCharIndex,\n ulUnicodeRange1: ulUnicodeRange1,\n ulUnicodeRange2: ulUnicodeRange2,\n ulUnicodeRange3: ulUnicodeRange3,\n ulUnicodeRange4: ulUnicodeRange4,\n // See http://typophile.com/node/13081 for more info on vertical metrics.\n // We get metrics for typical characters (such as \"x\" for xHeight).\n // We provide some fallback characters if characters are unavailable: their\n // ordering was chosen experimentally.\n sTypoAscender: globals.ascender,\n sTypoDescender: globals.descender,\n sTypoLineGap: 0,\n usWinAscent: globals.yMax,\n usWinDescent: Math.abs(globals.yMin),\n ulCodePageRange1: 1, // FIXME: hard-code Latin 1 support for now\n sxHeight: metricsForChar(font, 'xyvw', { yMax: Math.round(globals.ascender / 2) }).yMax,\n sCapHeight: metricsForChar(font, 'HIKLEFJMNTZBDPRAGOQSUVWXY', globals).yMax,\n usDefaultChar: font.hasChar(' ') ? 32 : 0, // Use space as the default character, if available.\n usBreakChar: font.hasChar(' ') ? 32 : 0, // Use space as the break character, if available.\n },\n font.tables.os2,\n ),\n )\n\n var hmtxTable = hmtx.make(font.glyphs)\n var cmapTable = cmap.make(font.glyphs)\n\n var englishFamilyName = font.getEnglishName('fontFamily')\n var englishStyleName = font.getEnglishName('fontSubfamily')\n var englishFullName = englishFamilyName + ' ' + englishStyleName\n var postScriptName = font.getEnglishName('postScriptName')\n if (!postScriptName) {\n postScriptName = englishFamilyName.replace(/\\s/g, '') + '-' + englishStyleName\n }\n\n var names = {}\n for (var n in font.names) {\n names[n] = font.names[n]\n }\n\n if (!names.uniqueID) {\n names.uniqueID = { en: font.getEnglishName('manufacturer') + ':' + englishFullName }\n }\n\n if (!names.postScriptName) {\n names.postScriptName = { en: postScriptName }\n }\n\n if (!names.preferredFamily) {\n names.preferredFamily = font.names.fontFamily\n }\n\n if (!names.preferredSubfamily) {\n names.preferredSubfamily = font.names.fontSubfamily\n }\n\n var languageTags = []\n var nameTable = _name.make(names, languageTags)\n var ltagTable = languageTags.length > 0 ? ltag.make(languageTags) : undefined\n\n var postTable = post.make()\n var cffTable = cff.make(font.glyphs, {\n version: font.getEnglishName('version'),\n fullName: englishFullName,\n familyName: englishFamilyName,\n weightName: englishStyleName,\n postScriptName: postScriptName,\n unitsPerEm: font.unitsPerEm,\n fontBBox: [0, globals.yMin, globals.ascender, globals.advanceWidthMax],\n })\n\n var metaTable = font.metas && Object.keys(font.metas).length > 0 ? meta.make(font.metas) : undefined\n\n // The order does not matter because makeSfntTable() will sort them.\n var tables = [headTable, hheaTable, maxpTable, os2Table, nameTable, cmapTable, postTable, cffTable, hmtxTable]\n if (ltagTable) {\n tables.push(ltagTable)\n }\n // Optional tables\n if (font.tables.gsub) {\n tables.push(gsub.make(font.tables.gsub))\n }\n if (metaTable) {\n tables.push(metaTable)\n }\n\n var sfntTable = makeSfntTable(tables)\n\n // Compute the font's checkSum and store it in head.checkSumAdjustment.\n var bytes = sfntTable.encode()\n var checkSum = computeCheckSum(bytes)\n var tableFields = sfntTable.fields\n var checkSumAdjusted = false\n for (var i$1 = 0; i$1 < tableFields.length; i$1 += 1) {\n if (tableFields[i$1].name === 'head table') {\n tableFields[i$1].value.checkSumAdjustment = 0xb1b0afba - checkSum\n checkSumAdjusted = true\n break\n }\n }\n\n if (!checkSumAdjusted) {\n throw new Error('Could not find head table with checkSum to adjust.')\n }\n\n return sfntTable\n }\n\n var sfnt = { make: makeSfntTable, fontToTable: fontToSfntTable, computeCheckSum: computeCheckSum }\n\n // The Layout object is the prototype of Substitution objects, and provides\n\n function searchTag(arr, tag) {\n /* jshint bitwise: false */\n var imin = 0\n var imax = arr.length - 1\n while (imin <= imax) {\n var imid = (imin + imax) >>> 1\n var val = arr[imid].tag\n if (val === tag) {\n return imid\n } else if (val < tag) {\n imin = imid + 1\n } else {\n imax = imid - 1\n }\n }\n // Not found: return -1-insertion point\n return -imin - 1\n }\n\n function binSearch(arr, value) {\n /* jshint bitwise: false */\n var imin = 0\n var imax = arr.length - 1\n while (imin <= imax) {\n var imid = (imin + imax) >>> 1\n var val = arr[imid]\n if (val === value) {\n return imid\n } else if (val < value) {\n imin = imid + 1\n } else {\n imax = imid - 1\n }\n }\n // Not found: return -1-insertion point\n return -imin - 1\n }\n\n // binary search in a list of ranges (coverage, class definition)\n function searchRange(ranges, value) {\n // jshint bitwise: false\n var range\n var imin = 0\n var imax = ranges.length - 1\n while (imin <= imax) {\n var imid = (imin + imax) >>> 1\n range = ranges[imid]\n var start = range.start\n if (start === value) {\n return range\n } else if (start < value) {\n imin = imid + 1\n } else {\n imax = imid - 1\n }\n }\n if (imin > 0) {\n range = ranges[imin - 1]\n if (value > range.end) {\n return 0\n }\n return range\n }\n }\n\n /**\n * @exports opentype.Layout\n * @class\n */\n function Layout(font, tableName) {\n this.font = font\n this.tableName = tableName\n }\n\n Layout.prototype = {\n /**\n * Binary search an object by \"tag\" property\n * @instance\n * @function searchTag\n * @memberof opentype.Layout\n * @param {Array} arr\n * @param {string} tag\n * @return {number}\n */\n searchTag: searchTag,\n\n /**\n * Binary search in a list of numbers\n * @instance\n * @function binSearch\n * @memberof opentype.Layout\n * @param {Array} arr\n * @param {number} value\n * @return {number}\n */\n binSearch: binSearch,\n\n /**\n * Get or create the Layout table (GSUB, GPOS etc).\n * @param {boolean} create - Whether to create a new one.\n * @return {Object} The GSUB or GPOS table.\n */\n getTable: function (create) {\n var layout = this.font.tables[this.tableName]\n if (!layout && create) {\n layout = this.font.tables[this.tableName] = this.createDefaultTable()\n }\n return layout\n },\n\n /**\n * Returns all scripts in the substitution table.\n * @instance\n * @return {Array}\n */\n getScriptNames: function () {\n var layout = this.getTable()\n if (!layout) {\n return []\n }\n return layout.scripts.map(function (script) {\n return script.tag\n })\n },\n\n /**\n * Returns the best bet for a script name.\n * Returns 'DFLT' if it exists.\n * If not, returns 'latn' if it exists.\n * If neither exist, returns undefined.\n */\n getDefaultScriptName: function () {\n var layout = this.getTable()\n if (!layout) {\n return\n }\n var hasLatn = false\n for (var i = 0; i < layout.scripts.length; i++) {\n var name = layout.scripts[i].tag\n if (name === 'DFLT') {\n return name\n }\n if (name === 'latn') {\n hasLatn = true\n }\n }\n if (hasLatn) {\n return 'latn'\n }\n },\n\n /**\n * Returns all LangSysRecords in the given script.\n * @instance\n * @param {string} [script='DFLT']\n * @param {boolean} create - forces the creation of this script table if it doesn't exist.\n * @return {Object} An object with tag and script properties.\n */\n getScriptTable: function (script, create) {\n var layout = this.getTable(create)\n if (layout) {\n script = script || 'DFLT'\n var scripts = layout.scripts\n var pos = searchTag(layout.scripts, script)\n if (pos >= 0) {\n return scripts[pos].script\n } else if (create) {\n var scr = {\n tag: script,\n script: {\n defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] },\n langSysRecords: [],\n },\n }\n scripts.splice(-1 - pos, 0, scr)\n return scr.script\n }\n }\n },\n\n /**\n * Returns a language system table\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {boolean} create - forces the creation of this langSysTable if it doesn't exist.\n * @return {Object}\n */\n getLangSysTable: function (script, language, create) {\n var scriptTable = this.getScriptTable(script, create)\n if (scriptTable) {\n if (!language || language === 'dflt' || language === 'DFLT') {\n return scriptTable.defaultLangSys\n }\n var pos = searchTag(scriptTable.langSysRecords, language)\n if (pos >= 0) {\n return scriptTable.langSysRecords[pos].langSys\n } else if (create) {\n var langSysRecord = {\n tag: language,\n langSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] },\n }\n scriptTable.langSysRecords.splice(-1 - pos, 0, langSysRecord)\n return langSysRecord.langSys\n }\n }\n },\n\n /**\n * Get a specific feature table.\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {string} feature - One of the codes listed at https://www.microsoft.com/typography/OTSPEC/featurelist.htm\n * @param {boolean} create - forces the creation of the feature table if it doesn't exist.\n * @return {Object}\n */\n getFeatureTable: function (script, language, feature, create) {\n var langSysTable = this.getLangSysTable(script, language, create)\n if (langSysTable) {\n var featureRecord\n var featIndexes = langSysTable.featureIndexes\n var allFeatures = this.font.tables[this.tableName].features\n // The FeatureIndex array of indices is in arbitrary order,\n // even if allFeatures is sorted alphabetically by feature tag.\n for (var i = 0; i < featIndexes.length; i++) {\n featureRecord = allFeatures[featIndexes[i]]\n if (featureRecord.tag === feature) {\n return featureRecord.feature\n }\n }\n if (create) {\n var index = allFeatures.length\n // Automatic ordering of features would require to shift feature indexes in the script list.\n check.assert(\n index === 0 || feature >= allFeatures[index - 1].tag,\n 'Features must be added in alphabetical order.',\n )\n featureRecord = {\n tag: feature,\n feature: { params: 0, lookupListIndexes: [] },\n }\n allFeatures.push(featureRecord)\n featIndexes.push(index)\n return featureRecord.feature\n }\n }\n },\n\n /**\n * Get the lookup tables of a given type for a script/language/feature.\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {string} feature - 4-letter feature code\n * @param {number} lookupType - 1 to 9\n * @param {boolean} create - forces the creation of the lookup table if it doesn't exist, with no subtables.\n * @return {Object[]}\n */\n getLookupTables: function (script, language, feature, lookupType, create) {\n var featureTable = this.getFeatureTable(script, language, feature, create)\n var tables = []\n if (featureTable) {\n var lookupTable\n var lookupListIndexes = featureTable.lookupListIndexes\n var allLookups = this.font.tables[this.tableName].lookups\n // lookupListIndexes are in no particular order, so use naive search.\n for (var i = 0; i < lookupListIndexes.length; i++) {\n lookupTable = allLookups[lookupListIndexes[i]]\n if (lookupTable.lookupType === lookupType) {\n tables.push(lookupTable)\n }\n }\n if (tables.length === 0 && create) {\n lookupTable = {\n lookupType: lookupType,\n lookupFlag: 0,\n subtables: [],\n markFilteringSet: undefined,\n }\n var index = allLookups.length\n allLookups.push(lookupTable)\n lookupListIndexes.push(index)\n return [lookupTable]\n }\n }\n return tables\n },\n\n /**\n * Find a glyph in a class definition table\n * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#class-definition-table\n * @param {object} classDefTable - an OpenType Layout class definition table\n * @param {number} glyphIndex - the index of the glyph to find\n * @returns {number} -1 if not found\n */\n getGlyphClass: function (classDefTable, glyphIndex) {\n switch (classDefTable.format) {\n case 1:\n if (\n classDefTable.startGlyph <= glyphIndex &&\n glyphIndex < classDefTable.startGlyph + classDefTable.classes.length\n ) {\n return classDefTable.classes[glyphIndex - classDefTable.startGlyph]\n }\n return 0\n case 2:\n var range = searchRange(classDefTable.ranges, glyphIndex)\n return range ? range.classId : 0\n }\n },\n\n /**\n * Find a glyph in a coverage table\n * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#coverage-table\n * @param {object} coverageTable - an OpenType Layout coverage table\n * @param {number} glyphIndex - the index of the glyph to find\n * @returns {number} -1 if not found\n */\n getCoverageIndex: function (coverageTable, glyphIndex) {\n switch (coverageTable.format) {\n case 1:\n var index = binSearch(coverageTable.glyphs, glyphIndex)\n return index >= 0 ? index : -1\n case 2:\n var range = searchRange(coverageTable.ranges, glyphIndex)\n return range ? range.index + glyphIndex - range.start : -1\n }\n },\n\n /**\n * Returns the list of glyph indexes of a coverage table.\n * Format 1: the list is stored raw\n * Format 2: compact list as range records.\n * @instance\n * @param {Object} coverageTable\n * @return {Array}\n */\n expandCoverage: function (coverageTable) {\n if (coverageTable.format === 1) {\n return coverageTable.glyphs\n } else {\n var glyphs = []\n var ranges = coverageTable.ranges\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n var start = range.start\n var end = range.end\n for (var j = start; j <= end; j++) {\n glyphs.push(j)\n }\n }\n return glyphs\n }\n },\n }\n\n // The Position object provides utility methods to manipulate\n\n /**\n * @exports opentype.Position\n * @class\n * @extends opentype.Layout\n * @param {opentype.Font}\n * @constructor\n */\n function Position(font) {\n Layout.call(this, font, 'gpos')\n }\n\n Position.prototype = Layout.prototype\n\n /**\n * Init some data for faster and easier access later.\n */\n Position.prototype.init = function () {\n var script = this.getDefaultScriptName()\n this.defaultKerningTables = this.getKerningTables(script)\n }\n\n /**\n * Find a glyph pair in a list of lookup tables of type 2 and retrieve the xAdvance kerning value.\n *\n * @param {integer} leftIndex - left glyph index\n * @param {integer} rightIndex - right glyph index\n * @returns {integer}\n */\n Position.prototype.getKerningValue = function (kerningLookups, leftIndex, rightIndex) {\n for (var i = 0; i < kerningLookups.length; i++) {\n var subtables = kerningLookups[i].subtables\n for (var j = 0; j < subtables.length; j++) {\n var subtable = subtables[j]\n var covIndex = this.getCoverageIndex(subtable.coverage, leftIndex)\n if (covIndex < 0) {\n continue\n }\n switch (subtable.posFormat) {\n case 1:\n // Search Pair Adjustment Positioning Format 1\n var pairSet = subtable.pairSets[covIndex]\n for (var k = 0; k < pairSet.length; k++) {\n var pair = pairSet[k]\n if (pair.secondGlyph === rightIndex) {\n return (pair.value1 && pair.value1.xAdvance) || 0\n }\n }\n break // left glyph found, not right glyph - try next subtable\n case 2:\n // Search Pair Adjustment Positioning Format 2\n var class1 = this.getGlyphClass(subtable.classDef1, leftIndex)\n var class2 = this.getGlyphClass(subtable.classDef2, rightIndex)\n var pair$1 = subtable.classRecords[class1][class2]\n return (pair$1.value1 && pair$1.value1.xAdvance) || 0\n }\n }\n }\n return 0\n }\n\n /**\n * List all kerning lookup tables.\n *\n * @param {string} [script='DFLT'] - use font.position.getDefaultScriptName() for a better default value\n * @param {string} [language='dflt']\n * @return {object[]} The list of kerning lookup tables (may be empty), or undefined if there is no GPOS table (and we should use the kern table)\n */\n Position.prototype.getKerningTables = function (script, language) {\n if (this.font.tables.gpos) {\n return this.getLookupTables(script, language, 'kern', 2)\n }\n }\n\n // The Substitution object provides utility methods to manipulate\n\n /**\n * @exports opentype.Substitution\n * @class\n * @extends opentype.Layout\n * @param {opentype.Font}\n * @constructor\n */\n function Substitution(font) {\n Layout.call(this, font, 'gsub')\n }\n\n // Check if 2 arrays of primitives are equal.\n function arraysEqual(ar1, ar2) {\n var n = ar1.length\n if (n !== ar2.length) {\n return false\n }\n for (var i = 0; i < n; i++) {\n if (ar1[i] !== ar2[i]) {\n return false\n }\n }\n return true\n }\n\n // Find the first subtable of a lookup table in a particular format.\n function getSubstFormat(lookupTable, format, defaultSubtable) {\n var subtables = lookupTable.subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n if (subtable.substFormat === format) {\n return subtable\n }\n }\n if (defaultSubtable) {\n subtables.push(defaultSubtable)\n return defaultSubtable\n }\n return undefined\n }\n\n Substitution.prototype = Layout.prototype\n\n /**\n * Create a default GSUB table.\n * @return {Object} gsub - The GSUB table.\n */\n Substitution.prototype.createDefaultTable = function () {\n // Generate a default empty GSUB table with just a DFLT script and dflt lang sys.\n return {\n version: 1,\n scripts: [\n {\n tag: 'DFLT',\n script: {\n defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] },\n langSysRecords: [],\n },\n },\n ],\n features: [],\n lookups: [],\n }\n }\n\n /**\n * List all single substitutions (lookup type 1) for a given script, language, and feature.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @param {string} feature - 4-character feature name ('aalt', 'salt', 'ss01'...)\n * @return {Array} substitutions - The list of substitutions.\n */\n Substitution.prototype.getSingle = function (feature, script, language) {\n var substitutions = []\n var lookupTables = this.getLookupTables(script, language, feature, 1)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var j = void 0\n if (subtable.substFormat === 1) {\n var delta = subtable.deltaGlyphId\n for (j = 0; j < glyphs.length; j++) {\n var glyph = glyphs[j]\n substitutions.push({ sub: glyph, by: glyph + delta })\n }\n } else {\n var substitute = subtable.substitute\n for (j = 0; j < glyphs.length; j++) {\n substitutions.push({ sub: glyphs[j], by: substitute[j] })\n }\n }\n }\n }\n return substitutions\n }\n\n /**\n * List all multiple substitutions (lookup type 2) for a given script, language, and feature.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @param {string} feature - 4-character feature name ('ccmp', 'stch')\n * @return {Array} substitutions - The list of substitutions.\n */\n Substitution.prototype.getMultiple = function (feature, script, language) {\n var substitutions = []\n var lookupTables = this.getLookupTables(script, language, feature, 2)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var j = void 0\n\n for (j = 0; j < glyphs.length; j++) {\n var glyph = glyphs[j]\n var replacements = subtable.sequences[j]\n substitutions.push({ sub: glyph, by: replacements })\n }\n }\n }\n return substitutions\n }\n\n /**\n * List all alternates (lookup type 3) for a given script, language, and feature.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @param {string} feature - 4-character feature name ('aalt', 'salt'...)\n * @return {Array} alternates - The list of alternates\n */\n Substitution.prototype.getAlternates = function (feature, script, language) {\n var alternates = []\n var lookupTables = this.getLookupTables(script, language, feature, 3)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var alternateSets = subtable.alternateSets\n for (var j = 0; j < glyphs.length; j++) {\n alternates.push({ sub: glyphs[j], by: alternateSets[j] })\n }\n }\n }\n return alternates\n }\n\n /**\n * List all ligatures (lookup type 4) for a given script, language, and feature.\n * The result is an array of ligature objects like { sub: [ids], by: id }\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @return {Array} ligatures - The list of ligatures.\n */\n Substitution.prototype.getLigatures = function (feature, script, language) {\n var ligatures = []\n var lookupTables = this.getLookupTables(script, language, feature, 4)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var ligatureSets = subtable.ligatureSets\n for (var j = 0; j < glyphs.length; j++) {\n var startGlyph = glyphs[j]\n var ligSet = ligatureSets[j]\n for (var k = 0; k < ligSet.length; k++) {\n var lig = ligSet[k]\n ligatures.push({\n sub: [startGlyph].concat(lig.components),\n by: lig.ligGlyph,\n })\n }\n }\n }\n }\n return ligatures\n }\n\n /**\n * Add or modify a single substitution (lookup type 1)\n * Format 2, more flexible, is always used.\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {Object} substitution - { sub: id, by: id } (format 1 is not supported)\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addSingle = function (feature, substitution, script, language) {\n var lookupTable = this.getLookupTables(script, language, feature, 1, true)[0]\n var subtable = getSubstFormat(lookupTable, 2, {\n // lookup type 1 subtable, format 2, coverage format 1\n substFormat: 2,\n coverage: { format: 1, glyphs: [] },\n substitute: [],\n })\n check.assert(\n subtable.coverage.format === 1,\n 'Single: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = substitution.sub\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos < 0) {\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.substitute.splice(pos, 0, 0)\n }\n subtable.substitute[pos] = substitution.by\n }\n\n /**\n * Add or modify a multiple substitution (lookup type 2)\n * @param {string} feature - 4-letter feature name ('ccmp', 'stch')\n * @param {Object} substitution - { sub: id, by: [id] } for format 2.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addMultiple = function (feature, substitution, script, language) {\n check.assert(\n substitution.by instanceof Array && substitution.by.length > 1,\n 'Multiple: \"by\" must be an array of two or more ids',\n )\n var lookupTable = this.getLookupTables(script, language, feature, 2, true)[0]\n var subtable = getSubstFormat(lookupTable, 1, {\n // lookup type 2 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n sequences: [],\n })\n check.assert(\n subtable.coverage.format === 1,\n 'Multiple: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = substitution.sub\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos < 0) {\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.sequences.splice(pos, 0, 0)\n }\n subtable.sequences[pos] = substitution.by\n }\n\n /**\n * Add or modify an alternate substitution (lookup type 3)\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {Object} substitution - { sub: id, by: [ids] }\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addAlternate = function (feature, substitution, script, language) {\n var lookupTable = this.getLookupTables(script, language, feature, 3, true)[0]\n var subtable = getSubstFormat(lookupTable, 1, {\n // lookup type 3 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n alternateSets: [],\n })\n check.assert(\n subtable.coverage.format === 1,\n 'Alternate: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = substitution.sub\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos < 0) {\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.alternateSets.splice(pos, 0, 0)\n }\n subtable.alternateSets[pos] = substitution.by\n }\n\n /**\n * Add a ligature (lookup type 4)\n * Ligatures with more components must be stored ahead of those with fewer components in order to be found\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {Object} ligature - { sub: [ids], by: id }\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addLigature = function (feature, ligature, script, language) {\n var lookupTable = this.getLookupTables(script, language, feature, 4, true)[0]\n var subtable = lookupTable.subtables[0]\n if (!subtable) {\n subtable = {\n // lookup type 4 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n ligatureSets: [],\n }\n lookupTable.subtables[0] = subtable\n }\n check.assert(\n subtable.coverage.format === 1,\n 'Ligature: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = ligature.sub[0]\n var ligComponents = ligature.sub.slice(1)\n var ligatureTable = {\n ligGlyph: ligature.by,\n components: ligComponents,\n }\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos >= 0) {\n // ligatureSet already exists\n var ligatureSet = subtable.ligatureSets[pos]\n for (var i = 0; i < ligatureSet.length; i++) {\n // If ligature already exists, return.\n if (arraysEqual(ligatureSet[i].components, ligComponents)) {\n return\n }\n }\n // ligature does not exist: add it.\n ligatureSet.push(ligatureTable)\n } else {\n // Create a new ligatureSet and add coverage for the first glyph.\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.ligatureSets.splice(pos, 0, [ligatureTable])\n }\n }\n\n /**\n * List all feature data for a given script and language.\n * @param {string} feature - 4-letter feature name\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @return {Array} substitutions - The list of substitutions.\n */\n Substitution.prototype.getFeature = function (feature, script, language) {\n if (/ss\\d\\d/.test(feature)) {\n // ss01 - ss20\n return this.getSingle(feature, script, language)\n }\n switch (feature) {\n case 'aalt':\n case 'salt':\n return this.getSingle(feature, script, language).concat(this.getAlternates(feature, script, language))\n case 'dlig':\n case 'liga':\n case 'rlig':\n return this.getLigatures(feature, script, language)\n case 'ccmp':\n return this.getMultiple(feature, script, language).concat(this.getLigatures(feature, script, language))\n case 'stch':\n return this.getMultiple(feature, script, language)\n }\n return undefined\n }\n\n /**\n * Add a substitution to a feature for a given script and language.\n * @param {string} feature - 4-letter feature name\n * @param {Object} sub - the substitution to add (an object like { sub: id or [ids], by: id or [ids] })\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.add = function (feature, sub, script, language) {\n if (/ss\\d\\d/.test(feature)) {\n // ss01 - ss20\n return this.addSingle(feature, sub, script, language)\n }\n switch (feature) {\n case 'aalt':\n case 'salt':\n if (typeof sub.by === 'number') {\n return this.addSingle(feature, sub, script, language)\n }\n return this.addAlternate(feature, sub, script, language)\n case 'dlig':\n case 'liga':\n case 'rlig':\n return this.addLigature(feature, sub, script, language)\n case 'ccmp':\n if (sub.by instanceof Array) {\n return this.addMultiple(feature, sub, script, language)\n }\n return this.addLigature(feature, sub, script, language)\n }\n return undefined\n }\n\n function checkArgument(expression, message) {\n if (!expression) {\n throw message\n }\n }\n\n // The `glyf` table describes the glyphs in TrueType outline format.\n\n // Parse the coordinate data for a glyph.\n function parseGlyphCoordinate(p, flag, previousValue, shortVectorBitMask, sameBitMask) {\n var v\n if ((flag & shortVectorBitMask) > 0) {\n // The coordinate is 1 byte long.\n v = p.parseByte()\n // The `same` bit is re-used for short values to signify the sign of the value.\n if ((flag & sameBitMask) === 0) {\n v = -v\n }\n\n v = previousValue + v\n } else {\n // The coordinate is 2 bytes long.\n // If the `same` bit is set, the coordinate is the same as the previous coordinate.\n if ((flag & sameBitMask) > 0) {\n v = previousValue\n } else {\n // Parse the coordinate as a signed 16-bit delta value.\n v = previousValue + p.parseShort()\n }\n }\n\n return v\n }\n\n // Parse a TrueType glyph.\n function parseGlyph(glyph, data, start) {\n var p = new parse.Parser(data, start)\n glyph.numberOfContours = p.parseShort()\n glyph._xMin = p.parseShort()\n glyph._yMin = p.parseShort()\n glyph._xMax = p.parseShort()\n glyph._yMax = p.parseShort()\n var flags\n var flag\n\n if (glyph.numberOfContours > 0) {\n // This glyph is not a composite.\n var endPointIndices = (glyph.endPointIndices = [])\n for (var i = 0; i < glyph.numberOfContours; i += 1) {\n endPointIndices.push(p.parseUShort())\n }\n\n glyph.instructionLength = p.parseUShort()\n glyph.instructions = []\n for (var i$1 = 0; i$1 < glyph.instructionLength; i$1 += 1) {\n glyph.instructions.push(p.parseByte())\n }\n\n var numberOfCoordinates = endPointIndices[endPointIndices.length - 1] + 1\n flags = []\n for (var i$2 = 0; i$2 < numberOfCoordinates; i$2 += 1) {\n flag = p.parseByte()\n flags.push(flag)\n // If bit 3 is set, we repeat this flag n times, where n is the next byte.\n if ((flag & 8) > 0) {\n var repeatCount = p.parseByte()\n for (var j = 0; j < repeatCount; j += 1) {\n flags.push(flag)\n i$2 += 1\n }\n }\n }\n\n check.argument(flags.length === numberOfCoordinates, 'Bad flags.')\n\n if (endPointIndices.length > 0) {\n var points = []\n var point\n // X/Y coordinates are relative to the previous point, except for the first point which is relative to 0,0.\n if (numberOfCoordinates > 0) {\n for (var i$3 = 0; i$3 < numberOfCoordinates; i$3 += 1) {\n flag = flags[i$3]\n point = {}\n point.onCurve = !!(flag & 1)\n point.lastPointOfContour = endPointIndices.indexOf(i$3) >= 0\n points.push(point)\n }\n\n var px = 0\n for (var i$4 = 0; i$4 < numberOfCoordinates; i$4 += 1) {\n flag = flags[i$4]\n point = points[i$4]\n point.x = parseGlyphCoordinate(p, flag, px, 2, 16)\n px = point.x\n }\n\n var py = 0\n for (var i$5 = 0; i$5 < numberOfCoordinates; i$5 += 1) {\n flag = flags[i$5]\n point = points[i$5]\n point.y = parseGlyphCoordinate(p, flag, py, 4, 32)\n py = point.y\n }\n }\n\n glyph.points = points\n } else {\n glyph.points = []\n }\n } else if (glyph.numberOfContours === 0) {\n glyph.points = []\n } else {\n glyph.isComposite = true\n glyph.points = []\n glyph.components = []\n var moreComponents = true\n while (moreComponents) {\n flags = p.parseUShort()\n var component = {\n glyphIndex: p.parseUShort(),\n xScale: 1,\n scale01: 0,\n scale10: 0,\n yScale: 1,\n dx: 0,\n dy: 0,\n }\n if ((flags & 1) > 0) {\n // The arguments are words\n if ((flags & 2) > 0) {\n // values are offset\n component.dx = p.parseShort()\n component.dy = p.parseShort()\n } else {\n // values are matched points\n component.matchedPoints = [p.parseUShort(), p.parseUShort()]\n }\n } else {\n // The arguments are bytes\n if ((flags & 2) > 0) {\n // values are offset\n component.dx = p.parseChar()\n component.dy = p.parseChar()\n } else {\n // values are matched points\n component.matchedPoints = [p.parseByte(), p.parseByte()]\n }\n }\n\n if ((flags & 8) > 0) {\n // We have a scale\n component.xScale = component.yScale = p.parseF2Dot14()\n } else if ((flags & 64) > 0) {\n // We have an X / Y scale\n component.xScale = p.parseF2Dot14()\n component.yScale = p.parseF2Dot14()\n } else if ((flags & 128) > 0) {\n // We have a 2x2 transformation\n component.xScale = p.parseF2Dot14()\n component.scale01 = p.parseF2Dot14()\n component.scale10 = p.parseF2Dot14()\n component.yScale = p.parseF2Dot14()\n }\n\n glyph.components.push(component)\n moreComponents = !!(flags & 32)\n }\n if (flags & 0x100) {\n // We have instructions\n glyph.instructionLength = p.parseUShort()\n glyph.instructions = []\n for (var i$6 = 0; i$6 < glyph.instructionLength; i$6 += 1) {\n glyph.instructions.push(p.parseByte())\n }\n }\n }\n }\n\n // Transform an array of points and return a new array.\n function transformPoints(points, transform) {\n var newPoints = []\n for (var i = 0; i < points.length; i += 1) {\n var pt = points[i]\n var newPt = {\n x: transform.xScale * pt.x + transform.scale01 * pt.y + transform.dx,\n y: transform.scale10 * pt.x + transform.yScale * pt.y + transform.dy,\n onCurve: pt.onCurve,\n lastPointOfContour: pt.lastPointOfContour,\n }\n newPoints.push(newPt)\n }\n\n return newPoints\n }\n\n function getContours(points) {\n var contours = []\n var currentContour = []\n for (var i = 0; i < points.length; i += 1) {\n var pt = points[i]\n currentContour.push(pt)\n if (pt.lastPointOfContour) {\n contours.push(currentContour)\n currentContour = []\n }\n }\n\n check.argument(currentContour.length === 0, 'There are still points left in the current contour.')\n return contours\n }\n\n // Convert the TrueType glyph outline to a Path.\n function getPath(points) {\n var p = new Path()\n if (!points) {\n return p\n }\n\n var contours = getContours(points)\n\n for (var contourIndex = 0; contourIndex < contours.length; ++contourIndex) {\n var contour = contours[contourIndex]\n\n var prev = null\n var curr = contour[contour.length - 1]\n var next = contour[0]\n\n if (curr.onCurve) {\n p.moveTo(curr.x, curr.y)\n } else {\n if (next.onCurve) {\n p.moveTo(next.x, next.y)\n } else {\n // If both first and last points are off-curve, start at their middle.\n var start = { x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5 }\n p.moveTo(start.x, start.y)\n }\n }\n\n for (var i = 0; i < contour.length; ++i) {\n prev = curr\n curr = next\n next = contour[(i + 1) % contour.length]\n\n if (curr.onCurve) {\n // This is a straight line.\n p.lineTo(curr.x, curr.y)\n } else {\n var prev2 = prev\n var next2 = next\n\n if (!prev.onCurve) {\n prev2 = { x: (curr.x + prev.x) * 0.5, y: (curr.y + prev.y) * 0.5 }\n }\n\n if (!next.onCurve) {\n next2 = { x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5 }\n }\n\n p.quadraticCurveTo(curr.x, curr.y, next2.x, next2.y)\n }\n }\n\n p.closePath()\n }\n return p\n }\n\n function buildPath(glyphs, glyph) {\n if (glyph.isComposite) {\n for (var j = 0; j < glyph.components.length; j += 1) {\n var component = glyph.components[j]\n var componentGlyph = glyphs.get(component.glyphIndex)\n // Force the ttfGlyphLoader to parse the glyph.\n componentGlyph.getPath()\n if (componentGlyph.points) {\n var transformedPoints = void 0\n if (component.matchedPoints === undefined) {\n // component positioned by offset\n transformedPoints = transformPoints(componentGlyph.points, component)\n } else {\n // component positioned by matched points\n if (\n component.matchedPoints[0] > glyph.points.length - 1 ||\n component.matchedPoints[1] > componentGlyph.points.length - 1\n ) {\n throw Error('Matched points out of range in ' + glyph.name)\n }\n var firstPt = glyph.points[component.matchedPoints[0]]\n var secondPt = componentGlyph.points[component.matchedPoints[1]]\n var transform = {\n xScale: component.xScale,\n scale01: component.scale01,\n scale10: component.scale10,\n yScale: component.yScale,\n dx: 0,\n dy: 0,\n }\n secondPt = transformPoints([secondPt], transform)[0]\n transform.dx = firstPt.x - secondPt.x\n transform.dy = firstPt.y - secondPt.y\n transformedPoints = transformPoints(componentGlyph.points, transform)\n }\n glyph.points = glyph.points.concat(transformedPoints)\n }\n }\n }\n\n return getPath(glyph.points)\n }\n\n function parseGlyfTableAll(data, start, loca, font) {\n var glyphs = new glyphset.GlyphSet(font)\n\n // The last element of the loca table is invalid.\n for (var i = 0; i < loca.length - 1; i += 1) {\n var offset = loca[i]\n var nextOffset = loca[i + 1]\n if (offset !== nextOffset) {\n glyphs.push(i, glyphset.ttfGlyphLoader(font, i, parseGlyph, data, start + offset, buildPath))\n } else {\n glyphs.push(i, glyphset.glyphLoader(font, i))\n }\n }\n\n return glyphs\n }\n\n function parseGlyfTableOnLowMemory(data, start, loca, font) {\n var glyphs = new glyphset.GlyphSet(font)\n\n font._push = function (i) {\n var offset = loca[i]\n var nextOffset = loca[i + 1]\n if (offset !== nextOffset) {\n glyphs.push(i, glyphset.ttfGlyphLoader(font, i, parseGlyph, data, start + offset, buildPath))\n } else {\n glyphs.push(i, glyphset.glyphLoader(font, i))\n }\n }\n\n return glyphs\n }\n\n // Parse all the glyphs according to the offsets from the `loca` table.\n function parseGlyfTable(data, start, loca, font, opt) {\n if (opt.lowMemory) {\n return parseGlyfTableOnLowMemory(data, start, loca, font)\n } else {\n return parseGlyfTableAll(data, start, loca, font)\n }\n }\n\n var glyf = { getPath: getPath, parse: parseGlyfTable }\n\n /* A TrueType font hinting interpreter.\n *\n * (c) 2017 Axel Kittenberger\n *\n * This interpreter has been implemented according to this documentation:\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM05/Chap5.html\n *\n * According to the documentation F24DOT6 values are used for pixels.\n * That means calculation is 1/64 pixel accurate and uses integer operations.\n * However, Javascript has floating point operations by default and only\n * those are available. One could make a case to simulate the 1/64 accuracy\n * exactly by truncating after every division operation\n * (for example with << 0) to get pixel exactly results as other TrueType\n * implementations. It may make sense since some fonts are pixel optimized\n * by hand using DELTAP instructions. The current implementation doesn't\n * and rather uses full floating point precision.\n *\n * xScale, yScale and rotation is currently ignored.\n *\n * A few non-trivial instructions are missing as I didn't encounter yet\n * a font that used them to test a possible implementation.\n *\n * Some fonts seem to use undocumented features regarding the twilight zone.\n * Only some of them are implemented as they were encountered.\n *\n * The exports.DEBUG statements are removed on the minified distribution file.\n */\n\n var instructionTable\n var exec\n var execGlyph\n var execComponent\n\n /*\n * Creates a hinting object.\n *\n * There ought to be exactly one\n * for each truetype font that is used for hinting.\n */\n function Hinting(font) {\n // the font this hinting object is for\n this.font = font\n\n this.getCommands = function (hPoints) {\n return glyf.getPath(hPoints).commands\n }\n\n // cached states\n this._fpgmState = this._prepState = undefined\n\n // errorState\n // 0 ... all okay\n // 1 ... had an error in a glyf,\n // continue working but stop spamming\n // the console\n // 2 ... error at prep, stop hinting at this ppem\n // 3 ... error at fpeg, stop hinting for this font at all\n this._errorState = 0\n }\n\n /*\n * Not rounding.\n */\n function roundOff(v) {\n return v\n }\n\n /*\n * Rounding to grid.\n */\n function roundToGrid(v) {\n //Rounding in TT is supposed to \"symmetrical around zero\"\n return Math.sign(v) * Math.round(Math.abs(v))\n }\n\n /*\n * Rounding to double grid.\n */\n function roundToDoubleGrid(v) {\n return (Math.sign(v) * Math.round(Math.abs(v * 2))) / 2\n }\n\n /*\n * Rounding to half grid.\n */\n function roundToHalfGrid(v) {\n return Math.sign(v) * (Math.round(Math.abs(v) + 0.5) - 0.5)\n }\n\n /*\n * Rounding to up to grid.\n */\n function roundUpToGrid(v) {\n return Math.sign(v) * Math.ceil(Math.abs(v))\n }\n\n /*\n * Rounding to down to grid.\n */\n function roundDownToGrid(v) {\n return Math.sign(v) * Math.floor(Math.abs(v))\n }\n\n /*\n * Super rounding.\n */\n var roundSuper = function (v) {\n var period = this.srPeriod\n var phase = this.srPhase\n var threshold = this.srThreshold\n var sign = 1\n\n if (v < 0) {\n v = -v\n sign = -1\n }\n\n v += threshold - phase\n\n v = Math.trunc(v / period) * period\n\n v += phase\n\n // according to http://xgridfit.sourceforge.net/round.html\n if (v < 0) {\n return phase * sign\n }\n\n return v * sign\n }\n\n /*\n * Unit vector of x-axis.\n */\n var xUnitVector = {\n x: 1,\n\n y: 0,\n\n axis: 'x',\n\n // Gets the projected distance between two points.\n // o1/o2 ... if true, respective original position is used.\n distance: function (p1, p2, o1, o2) {\n return (o1 ? p1.xo : p1.x) - (o2 ? p2.xo : p2.x)\n },\n\n // Moves point p so the moved position has the same relative\n // position to the moved positions of rp1 and rp2 than the\n // original positions had.\n //\n // See APPENDIX on INTERPOLATE at the bottom of this file.\n interpolate: function (p, rp1, rp2, pv) {\n var do1\n var do2\n var doa1\n var doa2\n var dm1\n var dm2\n var dt\n\n if (!pv || pv === this) {\n do1 = p.xo - rp1.xo\n do2 = p.xo - rp2.xo\n dm1 = rp1.x - rp1.xo\n dm2 = rp2.x - rp2.xo\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n p.x = p.xo + (dm1 + dm2) / 2\n return\n }\n\n p.x = p.xo + (dm1 * doa2 + dm2 * doa1) / dt\n return\n }\n\n do1 = pv.distance(p, rp1, true, true)\n do2 = pv.distance(p, rp2, true, true)\n dm1 = pv.distance(rp1, rp1, false, true)\n dm2 = pv.distance(rp2, rp2, false, true)\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n xUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true)\n return\n }\n\n xUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true)\n },\n\n // Slope of line normal to this\n normalSlope: Number.NEGATIVE_INFINITY,\n\n // Sets the point 'p' relative to point 'rp'\n // by the distance 'd'.\n //\n // See APPENDIX on SETRELATIVE at the bottom of this file.\n //\n // p ... point to set\n // rp ... reference point\n // d ... distance on projection vector\n // pv ... projection vector (undefined = this)\n // org ... if true, uses the original position of rp as reference.\n setRelative: function (p, rp, d, pv, org) {\n if (!pv || pv === this) {\n p.x = (org ? rp.xo : rp.x) + d\n return\n }\n\n var rpx = org ? rp.xo : rp.x\n var rpy = org ? rp.yo : rp.y\n var rpdx = rpx + d * pv.x\n var rpdy = rpy + d * pv.y\n\n p.x = rpdx + (p.y - rpdy) / pv.normalSlope\n },\n\n // Slope of vector line.\n slope: 0,\n\n // Touches the point p.\n touch: function (p) {\n p.xTouched = true\n },\n\n // Tests if a point p is touched.\n touched: function (p) {\n return p.xTouched\n },\n\n // Untouches the point p.\n untouch: function (p) {\n p.xTouched = false\n },\n }\n\n /*\n * Unit vector of y-axis.\n */\n var yUnitVector = {\n x: 0,\n\n y: 1,\n\n axis: 'y',\n\n // Gets the projected distance between two points.\n // o1/o2 ... if true, respective original position is used.\n distance: function (p1, p2, o1, o2) {\n return (o1 ? p1.yo : p1.y) - (o2 ? p2.yo : p2.y)\n },\n\n // Moves point p so the moved position has the same relative\n // position to the moved positions of rp1 and rp2 than the\n // original positions had.\n //\n // See APPENDIX on INTERPOLATE at the bottom of this file.\n interpolate: function (p, rp1, rp2, pv) {\n var do1\n var do2\n var doa1\n var doa2\n var dm1\n var dm2\n var dt\n\n if (!pv || pv === this) {\n do1 = p.yo - rp1.yo\n do2 = p.yo - rp2.yo\n dm1 = rp1.y - rp1.yo\n dm2 = rp2.y - rp2.yo\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n p.y = p.yo + (dm1 + dm2) / 2\n return\n }\n\n p.y = p.yo + (dm1 * doa2 + dm2 * doa1) / dt\n return\n }\n\n do1 = pv.distance(p, rp1, true, true)\n do2 = pv.distance(p, rp2, true, true)\n dm1 = pv.distance(rp1, rp1, false, true)\n dm2 = pv.distance(rp2, rp2, false, true)\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n yUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true)\n return\n }\n\n yUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true)\n },\n\n // Slope of line normal to this.\n normalSlope: 0,\n\n // Sets the point 'p' relative to point 'rp'\n // by the distance 'd'\n //\n // See APPENDIX on SETRELATIVE at the bottom of this file.\n //\n // p ... point to set\n // rp ... reference point\n // d ... distance on projection vector\n // pv ... projection vector (undefined = this)\n // org ... if true, uses the original position of rp as reference.\n setRelative: function (p, rp, d, pv, org) {\n if (!pv || pv === this) {\n p.y = (org ? rp.yo : rp.y) + d\n return\n }\n\n var rpx = org ? rp.xo : rp.x\n var rpy = org ? rp.yo : rp.y\n var rpdx = rpx + d * pv.x\n var rpdy = rpy + d * pv.y\n\n p.y = rpdy + pv.normalSlope * (p.x - rpdx)\n },\n\n // Slope of vector line.\n slope: Number.POSITIVE_INFINITY,\n\n // Touches the point p.\n touch: function (p) {\n p.yTouched = true\n },\n\n // Tests if a point p is touched.\n touched: function (p) {\n return p.yTouched\n },\n\n // Untouches the point p.\n untouch: function (p) {\n p.yTouched = false\n },\n }\n\n Object.freeze(xUnitVector)\n Object.freeze(yUnitVector)\n\n /*\n * Creates a unit vector that is not x- or y-axis.\n */\n function UnitVector(x, y) {\n this.x = x\n this.y = y\n this.axis = undefined\n this.slope = y / x\n this.normalSlope = -x / y\n Object.freeze(this)\n }\n\n /*\n * Gets the projected distance between two points.\n * o1/o2 ... if true, respective original position is used.\n */\n UnitVector.prototype.distance = function (p1, p2, o1, o2) {\n return this.x * xUnitVector.distance(p1, p2, o1, o2) + this.y * yUnitVector.distance(p1, p2, o1, o2)\n }\n\n /*\n * Moves point p so the moved position has the same relative\n * position to the moved positions of rp1 and rp2 than the\n * original positions had.\n *\n * See APPENDIX on INTERPOLATE at the bottom of this file.\n */\n UnitVector.prototype.interpolate = function (p, rp1, rp2, pv) {\n var dm1\n var dm2\n var do1\n var do2\n var doa1\n var doa2\n var dt\n\n do1 = pv.distance(p, rp1, true, true)\n do2 = pv.distance(p, rp2, true, true)\n dm1 = pv.distance(rp1, rp1, false, true)\n dm2 = pv.distance(rp2, rp2, false, true)\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n this.setRelative(p, p, (dm1 + dm2) / 2, pv, true)\n return\n }\n\n this.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true)\n }\n\n /*\n * Sets the point 'p' relative to point 'rp'\n * by the distance 'd'\n *\n * See APPENDIX on SETRELATIVE at the bottom of this file.\n *\n * p ... point to set\n * rp ... reference point\n * d ... distance on projection vector\n * pv ... projection vector (undefined = this)\n * org ... if true, uses the original position of rp as reference.\n */\n UnitVector.prototype.setRelative = function (p, rp, d, pv, org) {\n pv = pv || this\n\n var rpx = org ? rp.xo : rp.x\n var rpy = org ? rp.yo : rp.y\n var rpdx = rpx + d * pv.x\n var rpdy = rpy + d * pv.y\n\n var pvns = pv.normalSlope\n var fvs = this.slope\n\n var px = p.x\n var py = p.y\n\n p.x = (fvs * px - pvns * rpdx + rpdy - py) / (fvs - pvns)\n p.y = fvs * (p.x - px) + py\n }\n\n /*\n * Touches the point p.\n */\n UnitVector.prototype.touch = function (p) {\n p.xTouched = true\n p.yTouched = true\n }\n\n /*\n * Returns a unit vector with x/y coordinates.\n */\n function getUnitVector(x, y) {\n var d = Math.sqrt(x * x + y * y)\n\n x /= d\n y /= d\n\n if (x === 1 && y === 0) {\n return xUnitVector\n } else if (x === 0 && y === 1) {\n return yUnitVector\n } else {\n return new UnitVector(x, y)\n }\n }\n\n /*\n * Creates a point in the hinting engine.\n */\n function HPoint(x, y, lastPointOfContour, onCurve) {\n this.x = this.xo = Math.round(x * 64) / 64 // hinted x value and original x-value\n this.y = this.yo = Math.round(y * 64) / 64 // hinted y value and original y-value\n\n this.lastPointOfContour = lastPointOfContour\n this.onCurve = onCurve\n this.prevPointOnContour = undefined\n this.nextPointOnContour = undefined\n this.xTouched = false\n this.yTouched = false\n\n Object.preventExtensions(this)\n }\n\n /*\n * Returns the next touched point on the contour.\n *\n * v ... unit vector to test touch axis.\n */\n HPoint.prototype.nextTouched = function (v) {\n var p = this.nextPointOnContour\n\n while (!v.touched(p) && p !== this) {\n p = p.nextPointOnContour\n }\n\n return p\n }\n\n /*\n * Returns the previous touched point on the contour\n *\n * v ... unit vector to test touch axis.\n */\n HPoint.prototype.prevTouched = function (v) {\n var p = this.prevPointOnContour\n\n while (!v.touched(p) && p !== this) {\n p = p.prevPointOnContour\n }\n\n return p\n }\n\n /*\n * The zero point.\n */\n var HPZero = Object.freeze(new HPoint(0, 0))\n\n /*\n * The default state of the interpreter.\n *\n * Note: Freezing the defaultState and then deriving from it\n * makes the V8 Javascript engine going awkward,\n * so this is avoided, albeit the defaultState shouldn't\n * ever change.\n */\n var defaultState = {\n cvCutIn: 17 / 16, // control value cut in\n deltaBase: 9,\n deltaShift: 0.125,\n loop: 1, // loops some instructions\n minDis: 1, // minimum distance\n autoFlip: true,\n }\n\n /*\n * The current state of the interpreter.\n *\n * env ... 'fpgm' or 'prep' or 'glyf'\n * prog ... the program\n */\n function State(env, prog) {\n this.env = env\n this.stack = []\n this.prog = prog\n\n switch (env) {\n case 'glyf':\n this.zp0 = this.zp1 = this.zp2 = 1\n this.rp0 = this.rp1 = this.rp2 = 0\n /* fall through */\n case 'prep':\n this.fv = this.pv = this.dpv = xUnitVector\n this.round = roundToGrid\n }\n }\n\n /*\n * Executes a glyph program.\n *\n * This does the hinting for each glyph.\n *\n * Returns an array of moved points.\n *\n * glyph: the glyph to hint\n * ppem: the size the glyph is rendered for\n */\n Hinting.prototype.exec = function (glyph, ppem) {\n if (typeof ppem !== 'number') {\n throw new Error('Point size is not a number!')\n }\n\n // Received a fatal error, don't do any hinting anymore.\n if (this._errorState > 2) {\n return\n }\n\n var font = this.font\n var prepState = this._prepState\n\n if (!prepState || prepState.ppem !== ppem) {\n var fpgmState = this._fpgmState\n\n if (!fpgmState) {\n // Executes the fpgm state.\n // This is used by fonts to define functions.\n State.prototype = defaultState\n\n fpgmState = this._fpgmState = new State('fpgm', font.tables.fpgm)\n\n fpgmState.funcs = []\n fpgmState.font = font\n\n if (exports.DEBUG) {\n console.log('---EXEC FPGM---')\n fpgmState.step = -1\n }\n\n try {\n exec(fpgmState)\n } catch (e) {\n console.log('Hinting error in FPGM:' + e)\n this._errorState = 3\n return\n }\n }\n\n // Executes the prep program for this ppem setting.\n // This is used by fonts to set cvt values\n // depending on to be rendered font size.\n\n State.prototype = fpgmState\n prepState = this._prepState = new State('prep', font.tables.prep)\n\n prepState.ppem = ppem\n\n // Creates a copy of the cvt table\n // and scales it to the current ppem setting.\n var oCvt = font.tables.cvt\n if (oCvt) {\n var cvt = (prepState.cvt = new Array(oCvt.length))\n var scale = ppem / font.unitsPerEm\n for (var c = 0; c < oCvt.length; c++) {\n cvt[c] = oCvt[c] * scale\n }\n } else {\n prepState.cvt = []\n }\n\n if (exports.DEBUG) {\n console.log('---EXEC PREP---')\n prepState.step = -1\n }\n\n try {\n exec(prepState)\n } catch (e) {\n if (this._errorState < 2) {\n console.log('Hinting error in PREP:' + e)\n }\n this._errorState = 2\n }\n }\n\n if (this._errorState > 1) {\n return\n }\n\n try {\n return execGlyph(glyph, prepState)\n } catch (e) {\n if (this._errorState < 1) {\n console.log('Hinting error:' + e)\n console.log('Note: further hinting errors are silenced')\n }\n this._errorState = 1\n return undefined\n }\n }\n\n /*\n * Executes the hinting program for a glyph.\n */\n execGlyph = function (glyph, prepState) {\n // original point positions\n var xScale = prepState.ppem / prepState.font.unitsPerEm\n var yScale = xScale\n var components = glyph.components\n var contours\n var gZone\n var state\n\n State.prototype = prepState\n if (!components) {\n state = new State('glyf', glyph.instructions)\n if (exports.DEBUG) {\n console.log('---EXEC GLYPH---')\n state.step = -1\n }\n execComponent(glyph, state, xScale, yScale)\n gZone = state.gZone\n } else {\n var font = prepState.font\n gZone = []\n contours = []\n for (var i = 0; i < components.length; i++) {\n var c = components[i]\n var cg = font.glyphs.get(c.glyphIndex)\n\n state = new State('glyf', cg.instructions)\n\n if (exports.DEBUG) {\n console.log('---EXEC COMP ' + i + '---')\n state.step = -1\n }\n\n execComponent(cg, state, xScale, yScale)\n // appends the computed points to the result array\n // post processes the component points\n var dx = Math.round(c.dx * xScale)\n var dy = Math.round(c.dy * yScale)\n var gz = state.gZone\n var cc = state.contours\n for (var pi = 0; pi < gz.length; pi++) {\n var p = gz[pi]\n p.xTouched = p.yTouched = false\n p.xo = p.x = p.x + dx\n p.yo = p.y = p.y + dy\n }\n\n var gLen = gZone.length\n gZone.push.apply(gZone, gz)\n for (var j = 0; j < cc.length; j++) {\n contours.push(cc[j] + gLen)\n }\n }\n\n if (glyph.instructions && !state.inhibitGridFit) {\n // the composite has instructions on its own\n state = new State('glyf', glyph.instructions)\n\n state.gZone = state.z0 = state.z1 = state.z2 = gZone\n\n state.contours = contours\n\n // note: HPZero cannot be used here, since\n // the point might be modified\n gZone.push(new HPoint(0, 0), new HPoint(Math.round(glyph.advanceWidth * xScale), 0))\n\n if (exports.DEBUG) {\n console.log('---EXEC COMPOSITE---')\n state.step = -1\n }\n\n exec(state)\n\n gZone.length -= 2\n }\n }\n\n return gZone\n }\n\n /*\n * Executes the hinting program for a component of a multi-component glyph\n * or of the glyph itself for a non-component glyph.\n */\n execComponent = function (glyph, state, xScale, yScale) {\n var points = glyph.points || []\n var pLen = points.length\n var gZone = (state.gZone = state.z0 = state.z1 = state.z2 = [])\n var contours = (state.contours = [])\n\n // Scales the original points and\n // makes copies for the hinted points.\n var cp // current point\n for (var i = 0; i < pLen; i++) {\n cp = points[i]\n\n gZone[i] = new HPoint(cp.x * xScale, cp.y * yScale, cp.lastPointOfContour, cp.onCurve)\n }\n\n // Chain links the contours.\n var sp // start point\n var np // next point\n\n for (var i$1 = 0; i$1 < pLen; i$1++) {\n cp = gZone[i$1]\n\n if (!sp) {\n sp = cp\n contours.push(i$1)\n }\n\n if (cp.lastPointOfContour) {\n cp.nextPointOnContour = sp\n sp.prevPointOnContour = cp\n sp = undefined\n } else {\n np = gZone[i$1 + 1]\n cp.nextPointOnContour = np\n np.prevPointOnContour = cp\n }\n }\n\n if (state.inhibitGridFit) {\n return\n }\n\n if (exports.DEBUG) {\n console.log('PROCESSING GLYPH', state.stack)\n for (var i$2 = 0; i$2 < pLen; i$2++) {\n console.log(i$2, gZone[i$2].x, gZone[i$2].y)\n }\n }\n\n gZone.push(new HPoint(0, 0), new HPoint(Math.round(glyph.advanceWidth * xScale), 0))\n\n exec(state)\n\n // Removes the extra points.\n gZone.length -= 2\n\n if (exports.DEBUG) {\n console.log('FINISHED GLYPH', state.stack)\n for (var i$3 = 0; i$3 < pLen; i$3++) {\n console.log(i$3, gZone[i$3].x, gZone[i$3].y)\n }\n }\n }\n\n /*\n * Executes the program loaded in state.\n */\n exec = function (state) {\n var prog = state.prog\n\n if (!prog) {\n return\n }\n\n var pLen = prog.length\n var ins\n\n for (state.ip = 0; state.ip < pLen; state.ip++) {\n if (exports.DEBUG) {\n state.step++\n }\n ins = instructionTable[prog[state.ip]]\n\n if (!ins) {\n throw new Error('unknown instruction: 0x' + Number(prog[state.ip]).toString(16))\n }\n\n ins(state)\n\n // very extensive debugging for each step\n /*\n if (exports.DEBUG) {\n var da;\n if (state.gZone) {\n da = [];\n for (let i = 0; i < state.gZone.length; i++)\n {\n da.push(i + ' ' +\n state.gZone[i].x * 64 + ' ' +\n state.gZone[i].y * 64 + ' ' +\n (state.gZone[i].xTouched ? 'x' : '') +\n (state.gZone[i].yTouched ? 'y' : '')\n );\n }\n console.log('GZ', da);\n }\n\n if (state.tZone) {\n da = [];\n for (let i = 0; i < state.tZone.length; i++) {\n da.push(i + ' ' +\n state.tZone[i].x * 64 + ' ' +\n state.tZone[i].y * 64 + ' ' +\n (state.tZone[i].xTouched ? 'x' : '') +\n (state.tZone[i].yTouched ? 'y' : '')\n );\n }\n console.log('TZ', da);\n }\n\n if (state.stack.length > 10) {\n console.log(\n state.stack.length,\n '...', state.stack.slice(state.stack.length - 10)\n );\n } else {\n console.log(state.stack.length, state.stack);\n }\n }\n */\n }\n }\n\n /*\n * Initializes the twilight zone.\n *\n * This is only done if a SZPx instruction\n * refers to the twilight zone.\n */\n function initTZone(state) {\n var tZone = (state.tZone = new Array(state.gZone.length))\n\n // no idea if this is actually correct...\n for (var i = 0; i < tZone.length; i++) {\n tZone[i] = new HPoint(0, 0)\n }\n }\n\n /*\n * Skips the instruction pointer ahead over an IF/ELSE block.\n * handleElse .. if true breaks on matching ELSE\n */\n function skip(state, handleElse) {\n var prog = state.prog\n var ip = state.ip\n var nesting = 1\n var ins\n\n do {\n ins = prog[++ip]\n if (ins === 0x58) {\n // IF\n nesting++\n } else if (ins === 0x59) {\n // EIF\n nesting--\n } else if (ins === 0x40) {\n // NPUSHB\n ip += prog[ip + 1] + 1\n } else if (ins === 0x41) {\n // NPUSHW\n ip += 2 * prog[ip + 1] + 1\n } else if (ins >= 0xb0 && ins <= 0xb7) {\n // PUSHB\n ip += ins - 0xb0 + 1\n } else if (ins >= 0xb8 && ins <= 0xbf) {\n // PUSHW\n ip += (ins - 0xb8 + 1) * 2\n } else if (handleElse && nesting === 1 && ins === 0x1b) {\n // ELSE\n break\n }\n } while (nesting > 0)\n\n state.ip = ip\n }\n\n /*----------------------------------------------------------*\n * And then a lot of instructions... *\n *----------------------------------------------------------*/\n\n // SVTCA[a] Set freedom and projection Vectors To Coordinate Axis\n // 0x00-0x01\n function SVTCA(v, state) {\n if (exports.DEBUG) {\n console.log(state.step, 'SVTCA[' + v.axis + ']')\n }\n\n state.fv = state.pv = state.dpv = v\n }\n\n // SPVTCA[a] Set Projection Vector to Coordinate Axis\n // 0x02-0x03\n function SPVTCA(v, state) {\n if (exports.DEBUG) {\n console.log(state.step, 'SPVTCA[' + v.axis + ']')\n }\n\n state.pv = state.dpv = v\n }\n\n // SFVTCA[a] Set Freedom Vector to Coordinate Axis\n // 0x04-0x05\n function SFVTCA(v, state) {\n if (exports.DEBUG) {\n console.log(state.step, 'SFVTCA[' + v.axis + ']')\n }\n\n state.fv = v\n }\n\n // SPVTL[a] Set Projection Vector To Line\n // 0x06-0x07\n function SPVTL(a, state) {\n var stack = state.stack\n var p2i = stack.pop()\n var p1i = stack.pop()\n var p2 = state.z2[p2i]\n var p1 = state.z1[p1i]\n\n if (exports.DEBUG) {\n console.log('SPVTL[' + a + ']', p2i, p1i)\n }\n\n var dx\n var dy\n\n if (!a) {\n dx = p1.x - p2.x\n dy = p1.y - p2.y\n } else {\n dx = p2.y - p1.y\n dy = p1.x - p2.x\n }\n\n state.pv = state.dpv = getUnitVector(dx, dy)\n }\n\n // SFVTL[a] Set Freedom Vector To Line\n // 0x08-0x09\n function SFVTL(a, state) {\n var stack = state.stack\n var p2i = stack.pop()\n var p1i = stack.pop()\n var p2 = state.z2[p2i]\n var p1 = state.z1[p1i]\n\n if (exports.DEBUG) {\n console.log('SFVTL[' + a + ']', p2i, p1i)\n }\n\n var dx\n var dy\n\n if (!a) {\n dx = p1.x - p2.x\n dy = p1.y - p2.y\n } else {\n dx = p2.y - p1.y\n dy = p1.x - p2.x\n }\n\n state.fv = getUnitVector(dx, dy)\n }\n\n // SPVFS[] Set Projection Vector From Stack\n // 0x0A\n function SPVFS(state) {\n var stack = state.stack\n var y = stack.pop()\n var x = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SPVFS[]', y, x)\n }\n\n state.pv = state.dpv = getUnitVector(x, y)\n }\n\n // SFVFS[] Set Freedom Vector From Stack\n // 0x0B\n function SFVFS(state) {\n var stack = state.stack\n var y = stack.pop()\n var x = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SPVFS[]', y, x)\n }\n\n state.fv = getUnitVector(x, y)\n }\n\n // GPV[] Get Projection Vector\n // 0x0C\n function GPV(state) {\n var stack = state.stack\n var pv = state.pv\n\n if (exports.DEBUG) {\n console.log(state.step, 'GPV[]')\n }\n\n stack.push(pv.x * 0x4000)\n stack.push(pv.y * 0x4000)\n }\n\n // GFV[] Get Freedom Vector\n // 0x0C\n function GFV(state) {\n var stack = state.stack\n var fv = state.fv\n\n if (exports.DEBUG) {\n console.log(state.step, 'GFV[]')\n }\n\n stack.push(fv.x * 0x4000)\n stack.push(fv.y * 0x4000)\n }\n\n // SFVTPV[] Set Freedom Vector To Projection Vector\n // 0x0E\n function SFVTPV(state) {\n state.fv = state.pv\n\n if (exports.DEBUG) {\n console.log(state.step, 'SFVTPV[]')\n }\n }\n\n // ISECT[] moves point p to the InterSECTion of two lines\n // 0x0F\n function ISECT(state) {\n var stack = state.stack\n var pa0i = stack.pop()\n var pa1i = stack.pop()\n var pb0i = stack.pop()\n var pb1i = stack.pop()\n var pi = stack.pop()\n var z0 = state.z0\n var z1 = state.z1\n var pa0 = z0[pa0i]\n var pa1 = z0[pa1i]\n var pb0 = z1[pb0i]\n var pb1 = z1[pb1i]\n var p = state.z2[pi]\n\n if (exports.DEBUG) {\n console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi)\n }\n\n // math from\n // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line\n\n var x1 = pa0.x\n var y1 = pa0.y\n var x2 = pa1.x\n var y2 = pa1.y\n var x3 = pb0.x\n var y3 = pb0.y\n var x4 = pb1.x\n var y4 = pb1.y\n\n var div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)\n var f1 = x1 * y2 - y1 * x2\n var f2 = x3 * y4 - y3 * x4\n\n p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div\n p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div\n }\n\n // SRP0[] Set Reference Point 0\n // 0x10\n function SRP0(state) {\n state.rp0 = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SRP0[]', state.rp0)\n }\n }\n\n // SRP1[] Set Reference Point 1\n // 0x11\n function SRP1(state) {\n state.rp1 = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SRP1[]', state.rp1)\n }\n }\n\n // SRP1[] Set Reference Point 2\n // 0x12\n function SRP2(state) {\n state.rp2 = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SRP2[]', state.rp2)\n }\n }\n\n // SZP0[] Set Zone Pointer 0\n // 0x13\n function SZP0(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZP0[]', n)\n }\n\n state.zp0 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z0 = state.tZone\n break\n case 1:\n state.z0 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SZP1[] Set Zone Pointer 1\n // 0x14\n function SZP1(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZP1[]', n)\n }\n\n state.zp1 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z1 = state.tZone\n break\n case 1:\n state.z1 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SZP2[] Set Zone Pointer 2\n // 0x15\n function SZP2(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZP2[]', n)\n }\n\n state.zp2 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z2 = state.tZone\n break\n case 1:\n state.z2 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SZPS[] Set Zone PointerS\n // 0x16\n function SZPS(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZPS[]', n)\n }\n\n state.zp0 = state.zp1 = state.zp2 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z0 = state.z1 = state.z2 = state.tZone\n break\n case 1:\n state.z0 = state.z1 = state.z2 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SLOOP[] Set LOOP variable\n // 0x17\n function SLOOP(state) {\n state.loop = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SLOOP[]', state.loop)\n }\n }\n\n // RTG[] Round To Grid\n // 0x18\n function RTG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RTG[]')\n }\n\n state.round = roundToGrid\n }\n\n // RTHG[] Round To Half Grid\n // 0x19\n function RTHG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RTHG[]')\n }\n\n state.round = roundToHalfGrid\n }\n\n // SMD[] Set Minimum Distance\n // 0x1A\n function SMD(state) {\n var d = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SMD[]', d)\n }\n\n state.minDis = d / 0x40\n }\n\n // ELSE[] ELSE clause\n // 0x1B\n function ELSE(state) {\n // This instruction has been reached by executing a then branch\n // so it just skips ahead until matching EIF.\n //\n // In case the IF was negative the IF[] instruction already\n // skipped forward over the ELSE[]\n\n if (exports.DEBUG) {\n console.log(state.step, 'ELSE[]')\n }\n\n skip(state, false)\n }\n\n // JMPR[] JuMP Relative\n // 0x1C\n function JMPR(state) {\n var o = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'JMPR[]', o)\n }\n\n // A jump by 1 would do nothing.\n state.ip += o - 1\n }\n\n // SCVTCI[] Set Control Value Table Cut-In\n // 0x1D\n function SCVTCI(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SCVTCI[]', n)\n }\n\n state.cvCutIn = n / 0x40\n }\n\n // DUP[] DUPlicate top stack element\n // 0x20\n function DUP(state) {\n var stack = state.stack\n\n if (exports.DEBUG) {\n console.log(state.step, 'DUP[]')\n }\n\n stack.push(stack[stack.length - 1])\n }\n\n // POP[] POP top stack element\n // 0x21\n function POP(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'POP[]')\n }\n\n state.stack.pop()\n }\n\n // CLEAR[] CLEAR the stack\n // 0x22\n function CLEAR(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'CLEAR[]')\n }\n\n state.stack.length = 0\n }\n\n // SWAP[] SWAP the top two elements on the stack\n // 0x23\n function SWAP(state) {\n var stack = state.stack\n\n var a = stack.pop()\n var b = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SWAP[]')\n }\n\n stack.push(a)\n stack.push(b)\n }\n\n // DEPTH[] DEPTH of the stack\n // 0x24\n function DEPTH(state) {\n var stack = state.stack\n\n if (exports.DEBUG) {\n console.log(state.step, 'DEPTH[]')\n }\n\n stack.push(stack.length)\n }\n\n // LOOPCALL[] LOOPCALL function\n // 0x2A\n function LOOPCALL(state) {\n var stack = state.stack\n var fn = stack.pop()\n var c = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'LOOPCALL[]', fn, c)\n }\n\n // saves callers program\n var cip = state.ip\n var cprog = state.prog\n\n state.prog = state.funcs[fn]\n\n // executes the function\n for (var i = 0; i < c; i++) {\n exec(state)\n\n if (exports.DEBUG) {\n console.log(++state.step, i + 1 < c ? 'next loopcall' : 'done loopcall', i)\n }\n }\n\n // restores the callers program\n state.ip = cip\n state.prog = cprog\n }\n\n // CALL[] CALL function\n // 0x2B\n function CALL(state) {\n var fn = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'CALL[]', fn)\n }\n\n // saves callers program\n var cip = state.ip\n var cprog = state.prog\n\n state.prog = state.funcs[fn]\n\n // executes the function\n exec(state)\n\n // restores the callers program\n state.ip = cip\n state.prog = cprog\n\n if (exports.DEBUG) {\n console.log(++state.step, 'returning from', fn)\n }\n }\n\n // CINDEX[] Copy the INDEXed element to the top of the stack\n // 0x25\n function CINDEX(state) {\n var stack = state.stack\n var k = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'CINDEX[]', k)\n }\n\n // In case of k == 1, it copies the last element after popping\n // thus stack.length - k.\n stack.push(stack[stack.length - k])\n }\n\n // MINDEX[] Move the INDEXed element to the top of the stack\n // 0x26\n function MINDEX(state) {\n var stack = state.stack\n var k = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MINDEX[]', k)\n }\n\n stack.push(stack.splice(stack.length - k, 1)[0])\n }\n\n // FDEF[] Function DEFinition\n // 0x2C\n function FDEF(state) {\n if (state.env !== 'fpgm') {\n throw new Error('FDEF not allowed here')\n }\n var stack = state.stack\n var prog = state.prog\n var ip = state.ip\n\n var fn = stack.pop()\n var ipBegin = ip\n\n if (exports.DEBUG) {\n console.log(state.step, 'FDEF[]', fn)\n }\n\n while (prog[++ip] !== 0x2d) {}\n\n state.ip = ip\n state.funcs[fn] = prog.slice(ipBegin + 1, ip)\n }\n\n // MDAP[a] Move Direct Absolute Point\n // 0x2E-0x2F\n function MDAP(round, state) {\n var pi = state.stack.pop()\n var p = state.z0[pi]\n var fv = state.fv\n var pv = state.pv\n\n if (exports.DEBUG) {\n console.log(state.step, 'MDAP[' + round + ']', pi)\n }\n\n var d = pv.distance(p, HPZero)\n\n if (round) {\n d = state.round(d)\n }\n\n fv.setRelative(p, HPZero, d, pv)\n fv.touch(p)\n\n state.rp0 = state.rp1 = pi\n }\n\n // IUP[a] Interpolate Untouched Points through the outline\n // 0x30\n function IUP(v, state) {\n var z2 = state.z2\n var pLen = z2.length - 2\n var cp\n var pp\n var np\n\n if (exports.DEBUG) {\n console.log(state.step, 'IUP[' + v.axis + ']')\n }\n\n for (var i = 0; i < pLen; i++) {\n cp = z2[i] // current point\n\n // if this point has been touched go on\n if (v.touched(cp)) {\n continue\n }\n\n pp = cp.prevTouched(v)\n\n // no point on the contour has been touched?\n if (pp === cp) {\n continue\n }\n\n np = cp.nextTouched(v)\n\n if (pp === np) {\n // only one point on the contour has been touched\n // so simply moves the point like that\n\n v.setRelative(cp, cp, v.distance(pp, pp, false, true), v, true)\n }\n\n v.interpolate(cp, pp, np, v)\n }\n }\n\n // SHP[] SHift Point using reference point\n // 0x32-0x33\n function SHP(a, state) {\n var stack = state.stack\n var rpi = a ? state.rp1 : state.rp2\n var rp = (a ? state.z0 : state.z1)[rpi]\n var fv = state.fv\n var pv = state.pv\n var loop = state.loop\n var z2 = state.z2\n\n while (loop--) {\n var pi = stack.pop()\n var p = z2[pi]\n\n var d = pv.distance(rp, rp, false, true)\n fv.setRelative(p, p, d, pv)\n fv.touch(p)\n\n if (exports.DEBUG) {\n console.log(\n state.step,\n (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'SHP[' + (a ? 'rp1' : 'rp2') + ']',\n pi,\n )\n }\n }\n\n state.loop = 1\n }\n\n // SHC[] SHift Contour using reference point\n // 0x36-0x37\n function SHC(a, state) {\n var stack = state.stack\n var rpi = a ? state.rp1 : state.rp2\n var rp = (a ? state.z0 : state.z1)[rpi]\n var fv = state.fv\n var pv = state.pv\n var ci = stack.pop()\n var sp = state.z2[state.contours[ci]]\n var p = sp\n\n if (exports.DEBUG) {\n console.log(state.step, 'SHC[' + a + ']', ci)\n }\n\n var d = pv.distance(rp, rp, false, true)\n\n do {\n if (p !== rp) {\n fv.setRelative(p, p, d, pv)\n }\n p = p.nextPointOnContour\n } while (p !== sp)\n }\n\n // SHZ[] SHift Zone using reference point\n // 0x36-0x37\n function SHZ(a, state) {\n var stack = state.stack\n var rpi = a ? state.rp1 : state.rp2\n var rp = (a ? state.z0 : state.z1)[rpi]\n var fv = state.fv\n var pv = state.pv\n\n var e = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SHZ[' + a + ']', e)\n }\n\n var z\n switch (e) {\n case 0:\n z = state.tZone\n break\n case 1:\n z = state.gZone\n break\n default:\n throw new Error('Invalid zone')\n }\n\n var p\n var d = pv.distance(rp, rp, false, true)\n var pLen = z.length - 2\n for (var i = 0; i < pLen; i++) {\n p = z[i]\n fv.setRelative(p, p, d, pv)\n //if (p !== rp) fv.setRelative(p, p, d, pv);\n }\n }\n\n // SHPIX[] SHift point by a PIXel amount\n // 0x38\n function SHPIX(state) {\n var stack = state.stack\n var loop = state.loop\n var fv = state.fv\n var d = stack.pop() / 0x40\n var z2 = state.z2\n\n while (loop--) {\n var pi = stack.pop()\n var p = z2[pi]\n\n if (exports.DEBUG) {\n console.log(state.step, (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'SHPIX[]', pi, d)\n }\n\n fv.setRelative(p, p, d)\n fv.touch(p)\n }\n\n state.loop = 1\n }\n\n // IP[] Interpolate Point\n // 0x39\n function IP(state) {\n var stack = state.stack\n var rp1i = state.rp1\n var rp2i = state.rp2\n var loop = state.loop\n var rp1 = state.z0[rp1i]\n var rp2 = state.z1[rp2i]\n var fv = state.fv\n var pv = state.dpv\n var z2 = state.z2\n\n while (loop--) {\n var pi = stack.pop()\n var p = z2[pi]\n\n if (exports.DEBUG) {\n console.log(\n state.step,\n (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'IP[]',\n pi,\n rp1i,\n '<->',\n rp2i,\n )\n }\n\n fv.interpolate(p, rp1, rp2, pv)\n\n fv.touch(p)\n }\n\n state.loop = 1\n }\n\n // MSIRP[a] Move Stack Indirect Relative Point\n // 0x3A-0x3B\n function MSIRP(a, state) {\n var stack = state.stack\n var d = stack.pop() / 64\n var pi = stack.pop()\n var p = state.z1[pi]\n var rp0 = state.z0[state.rp0]\n var fv = state.fv\n var pv = state.pv\n\n fv.setRelative(p, rp0, d, pv)\n fv.touch(p)\n\n if (exports.DEBUG) {\n console.log(state.step, 'MSIRP[' + a + ']', d, pi)\n }\n\n state.rp1 = state.rp0\n state.rp2 = pi\n if (a) {\n state.rp0 = pi\n }\n }\n\n // ALIGNRP[] Align to reference point.\n // 0x3C\n function ALIGNRP(state) {\n var stack = state.stack\n var rp0i = state.rp0\n var rp0 = state.z0[rp0i]\n var loop = state.loop\n var fv = state.fv\n var pv = state.pv\n var z1 = state.z1\n\n while (loop--) {\n var pi = stack.pop()\n var p = z1[pi]\n\n if (exports.DEBUG) {\n console.log(state.step, (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'ALIGNRP[]', pi)\n }\n\n fv.setRelative(p, rp0, 0, pv)\n fv.touch(p)\n }\n\n state.loop = 1\n }\n\n // RTG[] Round To Double Grid\n // 0x3D\n function RTDG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RTDG[]')\n }\n\n state.round = roundToDoubleGrid\n }\n\n // MIAP[a] Move Indirect Absolute Point\n // 0x3E-0x3F\n function MIAP(round, state) {\n var stack = state.stack\n var n = stack.pop()\n var pi = stack.pop()\n var p = state.z0[pi]\n var fv = state.fv\n var pv = state.pv\n var cv = state.cvt[n]\n\n if (exports.DEBUG) {\n console.log(state.step, 'MIAP[' + round + ']', n, '(', cv, ')', pi)\n }\n\n var d = pv.distance(p, HPZero)\n\n if (round) {\n if (Math.abs(d - cv) < state.cvCutIn) {\n d = cv\n }\n\n d = state.round(d)\n }\n\n fv.setRelative(p, HPZero, d, pv)\n\n if (state.zp0 === 0) {\n p.xo = p.x\n p.yo = p.y\n }\n\n fv.touch(p)\n\n state.rp0 = state.rp1 = pi\n }\n\n // NPUSB[] PUSH N Bytes\n // 0x40\n function NPUSHB(state) {\n var prog = state.prog\n var ip = state.ip\n var stack = state.stack\n\n var n = prog[++ip]\n\n if (exports.DEBUG) {\n console.log(state.step, 'NPUSHB[]', n)\n }\n\n for (var i = 0; i < n; i++) {\n stack.push(prog[++ip])\n }\n\n state.ip = ip\n }\n\n // NPUSHW[] PUSH N Words\n // 0x41\n function NPUSHW(state) {\n var ip = state.ip\n var prog = state.prog\n var stack = state.stack\n var n = prog[++ip]\n\n if (exports.DEBUG) {\n console.log(state.step, 'NPUSHW[]', n)\n }\n\n for (var i = 0; i < n; i++) {\n var w = (prog[++ip] << 8) | prog[++ip]\n if (w & 0x8000) {\n w = -((w ^ 0xffff) + 1)\n }\n stack.push(w)\n }\n\n state.ip = ip\n }\n\n // WS[] Write Store\n // 0x42\n function WS(state) {\n var stack = state.stack\n var store = state.store\n\n if (!store) {\n store = state.store = []\n }\n\n var v = stack.pop()\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'WS', v, l)\n }\n\n store[l] = v\n }\n\n // RS[] Read Store\n // 0x43\n function RS(state) {\n var stack = state.stack\n var store = state.store\n\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'RS', l)\n }\n\n var v = (store && store[l]) || 0\n\n stack.push(v)\n }\n\n // WCVTP[] Write Control Value Table in Pixel units\n // 0x44\n function WCVTP(state) {\n var stack = state.stack\n\n var v = stack.pop()\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'WCVTP', v, l)\n }\n\n state.cvt[l] = v / 0x40\n }\n\n // RCVT[] Read Control Value Table entry\n // 0x45\n function RCVT(state) {\n var stack = state.stack\n var cvte = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'RCVT', cvte)\n }\n\n stack.push(state.cvt[cvte] * 0x40)\n }\n\n // GC[] Get Coordinate projected onto the projection vector\n // 0x46-0x47\n function GC(a, state) {\n var stack = state.stack\n var pi = stack.pop()\n var p = state.z2[pi]\n\n if (exports.DEBUG) {\n console.log(state.step, 'GC[' + a + ']', pi)\n }\n\n stack.push(state.dpv.distance(p, HPZero, a, false) * 0x40)\n }\n\n // MD[a] Measure Distance\n // 0x49-0x4A\n function MD(a, state) {\n var stack = state.stack\n var pi2 = stack.pop()\n var pi1 = stack.pop()\n var p2 = state.z1[pi2]\n var p1 = state.z0[pi1]\n var d = state.dpv.distance(p1, p2, a, a)\n\n if (exports.DEBUG) {\n console.log(state.step, 'MD[' + a + ']', pi2, pi1, '->', d)\n }\n\n state.stack.push(Math.round(d * 64))\n }\n\n // MPPEM[] Measure Pixels Per EM\n // 0x4B\n function MPPEM(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'MPPEM[]')\n }\n state.stack.push(state.ppem)\n }\n\n // FLIPON[] set the auto FLIP Boolean to ON\n // 0x4D\n function FLIPON(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'FLIPON[]')\n }\n state.autoFlip = true\n }\n\n // LT[] Less Than\n // 0x50\n function LT(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'LT[]', e2, e1)\n }\n\n stack.push(e1 < e2 ? 1 : 0)\n }\n\n // LTEQ[] Less Than or EQual\n // 0x53\n function LTEQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'LTEQ[]', e2, e1)\n }\n\n stack.push(e1 <= e2 ? 1 : 0)\n }\n\n // GTEQ[] Greater Than\n // 0x52\n function GT(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'GT[]', e2, e1)\n }\n\n stack.push(e1 > e2 ? 1 : 0)\n }\n\n // GTEQ[] Greater Than or EQual\n // 0x53\n function GTEQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'GTEQ[]', e2, e1)\n }\n\n stack.push(e1 >= e2 ? 1 : 0)\n }\n\n // EQ[] EQual\n // 0x54\n function EQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'EQ[]', e2, e1)\n }\n\n stack.push(e2 === e1 ? 1 : 0)\n }\n\n // NEQ[] Not EQual\n // 0x55\n function NEQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'NEQ[]', e2, e1)\n }\n\n stack.push(e2 !== e1 ? 1 : 0)\n }\n\n // ODD[] ODD\n // 0x56\n function ODD(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ODD[]', n)\n }\n\n stack.push(Math.trunc(n) % 2 ? 1 : 0)\n }\n\n // EVEN[] EVEN\n // 0x57\n function EVEN(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'EVEN[]', n)\n }\n\n stack.push(Math.trunc(n) % 2 ? 0 : 1)\n }\n\n // IF[] IF test\n // 0x58\n function IF(state) {\n var test = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'IF[]', test)\n }\n\n // if test is true it just continues\n // if not the ip is skipped until matching ELSE or EIF\n if (!test) {\n skip(state, true)\n\n if (exports.DEBUG) {\n console.log(state.step, 'EIF[]')\n }\n }\n }\n\n // EIF[] End IF\n // 0x59\n function EIF(state) {\n // this can be reached normally when\n // executing an else branch.\n // -> just ignore it\n\n if (exports.DEBUG) {\n console.log(state.step, 'EIF[]')\n }\n }\n\n // AND[] logical AND\n // 0x5A\n function AND(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'AND[]', e2, e1)\n }\n\n stack.push(e2 && e1 ? 1 : 0)\n }\n\n // OR[] logical OR\n // 0x5B\n function OR(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'OR[]', e2, e1)\n }\n\n stack.push(e2 || e1 ? 1 : 0)\n }\n\n // NOT[] logical NOT\n // 0x5C\n function NOT(state) {\n var stack = state.stack\n var e = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'NOT[]', e)\n }\n\n stack.push(e ? 0 : 1)\n }\n\n // DELTAP1[] DELTA exception P1\n // DELTAP2[] DELTA exception P2\n // DELTAP3[] DELTA exception P3\n // 0x5D, 0x71, 0x72\n function DELTAP123(b, state) {\n var stack = state.stack\n var n = stack.pop()\n var fv = state.fv\n var pv = state.pv\n var ppem = state.ppem\n var base = state.deltaBase + (b - 1) * 16\n var ds = state.deltaShift\n var z0 = state.z0\n\n if (exports.DEBUG) {\n console.log(state.step, 'DELTAP[' + b + ']', n, stack)\n }\n\n for (var i = 0; i < n; i++) {\n var pi = stack.pop()\n var arg = stack.pop()\n var appem = base + ((arg & 0xf0) >> 4)\n if (appem !== ppem) {\n continue\n }\n\n var mag = (arg & 0x0f) - 8\n if (mag >= 0) {\n mag++\n }\n if (exports.DEBUG) {\n console.log(state.step, 'DELTAPFIX', pi, 'by', mag * ds)\n }\n\n var p = z0[pi]\n fv.setRelative(p, p, mag * ds, pv)\n }\n }\n\n // SDB[] Set Delta Base in the graphics state\n // 0x5E\n function SDB(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SDB[]', n)\n }\n\n state.deltaBase = n\n }\n\n // SDS[] Set Delta Shift in the graphics state\n // 0x5F\n function SDS(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SDS[]', n)\n }\n\n state.deltaShift = Math.pow(0.5, n)\n }\n\n // ADD[] ADD\n // 0x60\n function ADD(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ADD[]', n2, n1)\n }\n\n stack.push(n1 + n2)\n }\n\n // SUB[] SUB\n // 0x61\n function SUB(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SUB[]', n2, n1)\n }\n\n stack.push(n1 - n2)\n }\n\n // DIV[] DIV\n // 0x62\n function DIV(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'DIV[]', n2, n1)\n }\n\n stack.push((n1 * 64) / n2)\n }\n\n // MUL[] MUL\n // 0x63\n function MUL(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MUL[]', n2, n1)\n }\n\n stack.push((n1 * n2) / 64)\n }\n\n // ABS[] ABSolute value\n // 0x64\n function ABS(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ABS[]', n)\n }\n\n stack.push(Math.abs(n))\n }\n\n // NEG[] NEGate\n // 0x65\n function NEG(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'NEG[]', n)\n }\n\n stack.push(-n)\n }\n\n // FLOOR[] FLOOR\n // 0x66\n function FLOOR(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'FLOOR[]', n)\n }\n\n stack.push(Math.floor(n / 0x40) * 0x40)\n }\n\n // CEILING[] CEILING\n // 0x67\n function CEILING(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'CEILING[]', n)\n }\n\n stack.push(Math.ceil(n / 0x40) * 0x40)\n }\n\n // ROUND[ab] ROUND value\n // 0x68-0x6B\n function ROUND(dt, state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ROUND[]')\n }\n\n stack.push(state.round(n / 0x40) * 0x40)\n }\n\n // WCVTF[] Write Control Value Table in Funits\n // 0x70\n function WCVTF(state) {\n var stack = state.stack\n var v = stack.pop()\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'WCVTF[]', v, l)\n }\n\n state.cvt[l] = (v * state.ppem) / state.font.unitsPerEm\n }\n\n // DELTAC1[] DELTA exception C1\n // DELTAC2[] DELTA exception C2\n // DELTAC3[] DELTA exception C3\n // 0x73, 0x74, 0x75\n function DELTAC123(b, state) {\n var stack = state.stack\n var n = stack.pop()\n var ppem = state.ppem\n var base = state.deltaBase + (b - 1) * 16\n var ds = state.deltaShift\n\n if (exports.DEBUG) {\n console.log(state.step, 'DELTAC[' + b + ']', n, stack)\n }\n\n for (var i = 0; i < n; i++) {\n var c = stack.pop()\n var arg = stack.pop()\n var appem = base + ((arg & 0xf0) >> 4)\n if (appem !== ppem) {\n continue\n }\n\n var mag = (arg & 0x0f) - 8\n if (mag >= 0) {\n mag++\n }\n\n var delta = mag * ds\n\n if (exports.DEBUG) {\n console.log(state.step, 'DELTACFIX', c, 'by', delta)\n }\n\n state.cvt[c] += delta\n }\n }\n\n // SROUND[] Super ROUND\n // 0x76\n function SROUND(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SROUND[]', n)\n }\n\n state.round = roundSuper\n\n var period\n\n switch (n & 0xc0) {\n case 0x00:\n period = 0.5\n break\n case 0x40:\n period = 1\n break\n case 0x80:\n period = 2\n break\n default:\n throw new Error('invalid SROUND value')\n }\n\n state.srPeriod = period\n\n switch (n & 0x30) {\n case 0x00:\n state.srPhase = 0\n break\n case 0x10:\n state.srPhase = 0.25 * period\n break\n case 0x20:\n state.srPhase = 0.5 * period\n break\n case 0x30:\n state.srPhase = 0.75 * period\n break\n default:\n throw new Error('invalid SROUND value')\n }\n\n n &= 0x0f\n\n if (n === 0) {\n state.srThreshold = 0\n } else {\n state.srThreshold = (n / 8 - 0.5) * period\n }\n }\n\n // S45ROUND[] Super ROUND 45 degrees\n // 0x77\n function S45ROUND(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'S45ROUND[]', n)\n }\n\n state.round = roundSuper\n\n var period\n\n switch (n & 0xc0) {\n case 0x00:\n period = Math.sqrt(2) / 2\n break\n case 0x40:\n period = Math.sqrt(2)\n break\n case 0x80:\n period = 2 * Math.sqrt(2)\n break\n default:\n throw new Error('invalid S45ROUND value')\n }\n\n state.srPeriod = period\n\n switch (n & 0x30) {\n case 0x00:\n state.srPhase = 0\n break\n case 0x10:\n state.srPhase = 0.25 * period\n break\n case 0x20:\n state.srPhase = 0.5 * period\n break\n case 0x30:\n state.srPhase = 0.75 * period\n break\n default:\n throw new Error('invalid S45ROUND value')\n }\n\n n &= 0x0f\n\n if (n === 0) {\n state.srThreshold = 0\n } else {\n state.srThreshold = (n / 8 - 0.5) * period\n }\n }\n\n // ROFF[] Round Off\n // 0x7A\n function ROFF(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'ROFF[]')\n }\n\n state.round = roundOff\n }\n\n // RUTG[] Round Up To Grid\n // 0x7C\n function RUTG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RUTG[]')\n }\n\n state.round = roundUpToGrid\n }\n\n // RDTG[] Round Down To Grid\n // 0x7D\n function RDTG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RDTG[]')\n }\n\n state.round = roundDownToGrid\n }\n\n // SCANCTRL[] SCAN conversion ConTRoL\n // 0x85\n function SCANCTRL(state) {\n var n = state.stack.pop()\n\n // ignored by opentype.js\n\n if (exports.DEBUG) {\n console.log(state.step, 'SCANCTRL[]', n)\n }\n }\n\n // SDPVTL[a] Set Dual Projection Vector To Line\n // 0x86-0x87\n function SDPVTL(a, state) {\n var stack = state.stack\n var p2i = stack.pop()\n var p1i = stack.pop()\n var p2 = state.z2[p2i]\n var p1 = state.z1[p1i]\n\n if (exports.DEBUG) {\n console.log(state.step, 'SDPVTL[' + a + ']', p2i, p1i)\n }\n\n var dx\n var dy\n\n if (!a) {\n dx = p1.x - p2.x\n dy = p1.y - p2.y\n } else {\n dx = p2.y - p1.y\n dy = p1.x - p2.x\n }\n\n state.dpv = getUnitVector(dx, dy)\n }\n\n // GETINFO[] GET INFOrmation\n // 0x88\n function GETINFO(state) {\n var stack = state.stack\n var sel = stack.pop()\n var r = 0\n\n if (exports.DEBUG) {\n console.log(state.step, 'GETINFO[]', sel)\n }\n\n // v35 as in no subpixel hinting\n if (sel & 0x01) {\n r = 35\n }\n\n // TODO rotation and stretch currently not supported\n // and thus those GETINFO are always 0.\n\n // opentype.js is always gray scaling\n if (sel & 0x20) {\n r |= 0x1000\n }\n\n stack.push(r)\n }\n\n // ROLL[] ROLL the top three stack elements\n // 0x8A\n function ROLL(state) {\n var stack = state.stack\n var a = stack.pop()\n var b = stack.pop()\n var c = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ROLL[]')\n }\n\n stack.push(b)\n stack.push(a)\n stack.push(c)\n }\n\n // MAX[] MAXimum of top two stack elements\n // 0x8B\n function MAX(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MAX[]', e2, e1)\n }\n\n stack.push(Math.max(e1, e2))\n }\n\n // MIN[] MINimum of top two stack elements\n // 0x8C\n function MIN(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MIN[]', e2, e1)\n }\n\n stack.push(Math.min(e1, e2))\n }\n\n // SCANTYPE[] SCANTYPE\n // 0x8D\n function SCANTYPE(state) {\n var n = state.stack.pop()\n // ignored by opentype.js\n if (exports.DEBUG) {\n console.log(state.step, 'SCANTYPE[]', n)\n }\n }\n\n // INSTCTRL[] INSTCTRL\n // 0x8D\n function INSTCTRL(state) {\n var s = state.stack.pop()\n var v = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'INSTCTRL[]', s, v)\n }\n\n switch (s) {\n case 1:\n state.inhibitGridFit = !!v\n return\n case 2:\n state.ignoreCvt = !!v\n return\n default:\n throw new Error('invalid INSTCTRL[] selector')\n }\n }\n\n // PUSHB[abc] PUSH Bytes\n // 0xB0-0xB7\n function PUSHB(n, state) {\n var stack = state.stack\n var prog = state.prog\n var ip = state.ip\n\n if (exports.DEBUG) {\n console.log(state.step, 'PUSHB[' + n + ']')\n }\n\n for (var i = 0; i < n; i++) {\n stack.push(prog[++ip])\n }\n\n state.ip = ip\n }\n\n // PUSHW[abc] PUSH Words\n // 0xB8-0xBF\n function PUSHW(n, state) {\n var ip = state.ip\n var prog = state.prog\n var stack = state.stack\n\n if (exports.DEBUG) {\n console.log(state.ip, 'PUSHW[' + n + ']')\n }\n\n for (var i = 0; i < n; i++) {\n var w = (prog[++ip] << 8) | prog[++ip]\n if (w & 0x8000) {\n w = -((w ^ 0xffff) + 1)\n }\n stack.push(w)\n }\n\n state.ip = ip\n }\n\n // MDRP[abcde] Move Direct Relative Point\n // 0xD0-0xEF\n // (if indirect is 0)\n //\n // and\n //\n // MIRP[abcde] Move Indirect Relative Point\n // 0xE0-0xFF\n // (if indirect is 1)\n\n function MDRP_MIRP(indirect, setRp0, keepD, ro, dt, state) {\n var stack = state.stack\n var cvte = indirect && stack.pop()\n var pi = stack.pop()\n var rp0i = state.rp0\n var rp = state.z0[rp0i]\n var p = state.z1[pi]\n\n var md = state.minDis\n var fv = state.fv\n var pv = state.dpv\n var od // original distance\n var d // moving distance\n var sign // sign of distance\n var cv\n\n d = od = pv.distance(p, rp, true, true)\n sign = d >= 0 ? 1 : -1 // Math.sign would be 0 in case of 0\n\n // TODO consider autoFlip\n d = Math.abs(d)\n\n if (indirect) {\n cv = state.cvt[cvte]\n\n if (ro && Math.abs(d - cv) < state.cvCutIn) {\n d = cv\n }\n }\n\n if (keepD && d < md) {\n d = md\n }\n\n if (ro) {\n d = state.round(d)\n }\n\n fv.setRelative(p, rp, sign * d, pv)\n fv.touch(p)\n\n if (exports.DEBUG) {\n console.log(\n state.step,\n (indirect ? 'MIRP[' : 'MDRP[') +\n (setRp0 ? 'M' : 'm') +\n (keepD ? '>' : '_') +\n (ro ? 'R' : '_') +\n (dt === 0 ? 'Gr' : dt === 1 ? 'Bl' : dt === 2 ? 'Wh' : '') +\n ']',\n indirect ? cvte + '(' + state.cvt[cvte] + ',' + cv + ')' : '',\n pi,\n '(d =',\n od,\n '->',\n sign * d,\n ')',\n )\n }\n\n state.rp1 = state.rp0\n state.rp2 = pi\n if (setRp0) {\n state.rp0 = pi\n }\n }\n\n /*\n * The instruction table.\n */\n instructionTable = [\n /* 0x00 */ SVTCA.bind(undefined, yUnitVector),\n /* 0x01 */ SVTCA.bind(undefined, xUnitVector),\n /* 0x02 */ SPVTCA.bind(undefined, yUnitVector),\n /* 0x03 */ SPVTCA.bind(undefined, xUnitVector),\n /* 0x04 */ SFVTCA.bind(undefined, yUnitVector),\n /* 0x05 */ SFVTCA.bind(undefined, xUnitVector),\n /* 0x06 */ SPVTL.bind(undefined, 0),\n /* 0x07 */ SPVTL.bind(undefined, 1),\n /* 0x08 */ SFVTL.bind(undefined, 0),\n /* 0x09 */ SFVTL.bind(undefined, 1),\n /* 0x0A */ SPVFS,\n /* 0x0B */ SFVFS,\n /* 0x0C */ GPV,\n /* 0x0D */ GFV,\n /* 0x0E */ SFVTPV,\n /* 0x0F */ ISECT,\n /* 0x10 */ SRP0,\n /* 0x11 */ SRP1,\n /* 0x12 */ SRP2,\n /* 0x13 */ SZP0,\n /* 0x14 */ SZP1,\n /* 0x15 */ SZP2,\n /* 0x16 */ SZPS,\n /* 0x17 */ SLOOP,\n /* 0x18 */ RTG,\n /* 0x19 */ RTHG,\n /* 0x1A */ SMD,\n /* 0x1B */ ELSE,\n /* 0x1C */ JMPR,\n /* 0x1D */ SCVTCI,\n /* 0x1E */ undefined, // TODO SSWCI\n /* 0x1F */ undefined, // TODO SSW\n /* 0x20 */ DUP,\n /* 0x21 */ POP,\n /* 0x22 */ CLEAR,\n /* 0x23 */ SWAP,\n /* 0x24 */ DEPTH,\n /* 0x25 */ CINDEX,\n /* 0x26 */ MINDEX,\n /* 0x27 */ undefined, // TODO ALIGNPTS\n /* 0x28 */ undefined,\n /* 0x29 */ undefined, // TODO UTP\n /* 0x2A */ LOOPCALL,\n /* 0x2B */ CALL,\n /* 0x2C */ FDEF,\n /* 0x2D */ undefined, // ENDF (eaten by FDEF)\n /* 0x2E */ MDAP.bind(undefined, 0),\n /* 0x2F */ MDAP.bind(undefined, 1),\n /* 0x30 */ IUP.bind(undefined, yUnitVector),\n /* 0x31 */ IUP.bind(undefined, xUnitVector),\n /* 0x32 */ SHP.bind(undefined, 0),\n /* 0x33 */ SHP.bind(undefined, 1),\n /* 0x34 */ SHC.bind(undefined, 0),\n /* 0x35 */ SHC.bind(undefined, 1),\n /* 0x36 */ SHZ.bind(undefined, 0),\n /* 0x37 */ SHZ.bind(undefined, 1),\n /* 0x38 */ SHPIX,\n /* 0x39 */ IP,\n /* 0x3A */ MSIRP.bind(undefined, 0),\n /* 0x3B */ MSIRP.bind(undefined, 1),\n /* 0x3C */ ALIGNRP,\n /* 0x3D */ RTDG,\n /* 0x3E */ MIAP.bind(undefined, 0),\n /* 0x3F */ MIAP.bind(undefined, 1),\n /* 0x40 */ NPUSHB,\n /* 0x41 */ NPUSHW,\n /* 0x42 */ WS,\n /* 0x43 */ RS,\n /* 0x44 */ WCVTP,\n /* 0x45 */ RCVT,\n /* 0x46 */ GC.bind(undefined, 0),\n /* 0x47 */ GC.bind(undefined, 1),\n /* 0x48 */ undefined, // TODO SCFS\n /* 0x49 */ MD.bind(undefined, 0),\n /* 0x4A */ MD.bind(undefined, 1),\n /* 0x4B */ MPPEM,\n /* 0x4C */ undefined, // TODO MPS\n /* 0x4D */ FLIPON,\n /* 0x4E */ undefined, // TODO FLIPOFF\n /* 0x4F */ undefined, // TODO DEBUG\n /* 0x50 */ LT,\n /* 0x51 */ LTEQ,\n /* 0x52 */ GT,\n /* 0x53 */ GTEQ,\n /* 0x54 */ EQ,\n /* 0x55 */ NEQ,\n /* 0x56 */ ODD,\n /* 0x57 */ EVEN,\n /* 0x58 */ IF,\n /* 0x59 */ EIF,\n /* 0x5A */ AND,\n /* 0x5B */ OR,\n /* 0x5C */ NOT,\n /* 0x5D */ DELTAP123.bind(undefined, 1),\n /* 0x5E */ SDB,\n /* 0x5F */ SDS,\n /* 0x60 */ ADD,\n /* 0x61 */ SUB,\n /* 0x62 */ DIV,\n /* 0x63 */ MUL,\n /* 0x64 */ ABS,\n /* 0x65 */ NEG,\n /* 0x66 */ FLOOR,\n /* 0x67 */ CEILING,\n /* 0x68 */ ROUND.bind(undefined, 0),\n /* 0x69 */ ROUND.bind(undefined, 1),\n /* 0x6A */ ROUND.bind(undefined, 2),\n /* 0x6B */ ROUND.bind(undefined, 3),\n /* 0x6C */ undefined, // TODO NROUND[ab]\n /* 0x6D */ undefined, // TODO NROUND[ab]\n /* 0x6E */ undefined, // TODO NROUND[ab]\n /* 0x6F */ undefined, // TODO NROUND[ab]\n /* 0x70 */ WCVTF,\n /* 0x71 */ DELTAP123.bind(undefined, 2),\n /* 0x72 */ DELTAP123.bind(undefined, 3),\n /* 0x73 */ DELTAC123.bind(undefined, 1),\n /* 0x74 */ DELTAC123.bind(undefined, 2),\n /* 0x75 */ DELTAC123.bind(undefined, 3),\n /* 0x76 */ SROUND,\n /* 0x77 */ S45ROUND,\n /* 0x78 */ undefined, // TODO JROT[]\n /* 0x79 */ undefined, // TODO JROF[]\n /* 0x7A */ ROFF,\n /* 0x7B */ undefined,\n /* 0x7C */ RUTG,\n /* 0x7D */ RDTG,\n /* 0x7E */ POP, // actually SANGW, supposed to do only a pop though\n /* 0x7F */ POP, // actually AA, supposed to do only a pop though\n /* 0x80 */ undefined, // TODO FLIPPT\n /* 0x81 */ undefined, // TODO FLIPRGON\n /* 0x82 */ undefined, // TODO FLIPRGOFF\n /* 0x83 */ undefined,\n /* 0x84 */ undefined,\n /* 0x85 */ SCANCTRL,\n /* 0x86 */ SDPVTL.bind(undefined, 0),\n /* 0x87 */ SDPVTL.bind(undefined, 1),\n /* 0x88 */ GETINFO,\n /* 0x89 */ undefined, // TODO IDEF\n /* 0x8A */ ROLL,\n /* 0x8B */ MAX,\n /* 0x8C */ MIN,\n /* 0x8D */ SCANTYPE,\n /* 0x8E */ INSTCTRL,\n /* 0x8F */ undefined,\n /* 0x90 */ undefined,\n /* 0x91 */ undefined,\n /* 0x92 */ undefined,\n /* 0x93 */ undefined,\n /* 0x94 */ undefined,\n /* 0x95 */ undefined,\n /* 0x96 */ undefined,\n /* 0x97 */ undefined,\n /* 0x98 */ undefined,\n /* 0x99 */ undefined,\n /* 0x9A */ undefined,\n /* 0x9B */ undefined,\n /* 0x9C */ undefined,\n /* 0x9D */ undefined,\n /* 0x9E */ undefined,\n /* 0x9F */ undefined,\n /* 0xA0 */ undefined,\n /* 0xA1 */ undefined,\n /* 0xA2 */ undefined,\n /* 0xA3 */ undefined,\n /* 0xA4 */ undefined,\n /* 0xA5 */ undefined,\n /* 0xA6 */ undefined,\n /* 0xA7 */ undefined,\n /* 0xA8 */ undefined,\n /* 0xA9 */ undefined,\n /* 0xAA */ undefined,\n /* 0xAB */ undefined,\n /* 0xAC */ undefined,\n /* 0xAD */ undefined,\n /* 0xAE */ undefined,\n /* 0xAF */ undefined,\n /* 0xB0 */ PUSHB.bind(undefined, 1),\n /* 0xB1 */ PUSHB.bind(undefined, 2),\n /* 0xB2 */ PUSHB.bind(undefined, 3),\n /* 0xB3 */ PUSHB.bind(undefined, 4),\n /* 0xB4 */ PUSHB.bind(undefined, 5),\n /* 0xB5 */ PUSHB.bind(undefined, 6),\n /* 0xB6 */ PUSHB.bind(undefined, 7),\n /* 0xB7 */ PUSHB.bind(undefined, 8),\n /* 0xB8 */ PUSHW.bind(undefined, 1),\n /* 0xB9 */ PUSHW.bind(undefined, 2),\n /* 0xBA */ PUSHW.bind(undefined, 3),\n /* 0xBB */ PUSHW.bind(undefined, 4),\n /* 0xBC */ PUSHW.bind(undefined, 5),\n /* 0xBD */ PUSHW.bind(undefined, 6),\n /* 0xBE */ PUSHW.bind(undefined, 7),\n /* 0xBF */ PUSHW.bind(undefined, 8),\n /* 0xC0 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 0),\n /* 0xC1 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 1),\n /* 0xC2 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 2),\n /* 0xC3 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 3),\n /* 0xC4 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 0),\n /* 0xC5 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 1),\n /* 0xC6 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 2),\n /* 0xC7 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 3),\n /* 0xC8 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 0),\n /* 0xC9 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 1),\n /* 0xCA */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 2),\n /* 0xCB */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 3),\n /* 0xCC */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 0),\n /* 0xCD */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 1),\n /* 0xCE */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 2),\n /* 0xCF */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 3),\n /* 0xD0 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 0),\n /* 0xD1 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 1),\n /* 0xD2 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 2),\n /* 0xD3 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 3),\n /* 0xD4 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 0),\n /* 0xD5 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 1),\n /* 0xD6 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 2),\n /* 0xD7 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 3),\n /* 0xD8 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 0),\n /* 0xD9 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 1),\n /* 0xDA */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 2),\n /* 0xDB */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 3),\n /* 0xDC */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 0),\n /* 0xDD */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 1),\n /* 0xDE */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 2),\n /* 0xDF */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 3),\n /* 0xE0 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 0),\n /* 0xE1 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 1),\n /* 0xE2 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 2),\n /* 0xE3 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 3),\n /* 0xE4 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 0),\n /* 0xE5 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 1),\n /* 0xE6 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 2),\n /* 0xE7 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 3),\n /* 0xE8 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 0),\n /* 0xE9 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 1),\n /* 0xEA */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 2),\n /* 0xEB */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 3),\n /* 0xEC */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 0),\n /* 0xED */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 1),\n /* 0xEE */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 2),\n /* 0xEF */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 3),\n /* 0xF0 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 0),\n /* 0xF1 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 1),\n /* 0xF2 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 2),\n /* 0xF3 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 3),\n /* 0xF4 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 0),\n /* 0xF5 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 1),\n /* 0xF6 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 2),\n /* 0xF7 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 3),\n /* 0xF8 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 0),\n /* 0xF9 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 1),\n /* 0xFA */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 2),\n /* 0xFB */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 3),\n /* 0xFC */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 0),\n /* 0xFD */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 1),\n /* 0xFE */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 2),\n /* 0xFF */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 3),\n ]\n\n /*****************************\n Mathematical Considerations\n******************************\n\nfv ... refers to freedom vector\npv ... refers to projection vector\nrp ... refers to reference point\np ... refers to to point being operated on\nd ... refers to distance\n\nSETRELATIVE:\n============\n\ncase freedom vector == x-axis:\n------------------------------\n\n (pv)\n .-'\n rpd .-'\n .-*\n d .-'90°'\n .-' '\n .-' '\n *-' ' b\n rp '\n '\n '\n p *----------*-------------- (fv)\n pm\n\n rpdx = rpx + d * pv.x\n rpdy = rpy + d * pv.y\n\n equation of line b\n\n y - rpdy = pvns * (x- rpdx)\n\n y = p.y\n\n x = rpdx + ( p.y - rpdy ) / pvns\n\n\ncase freedom vector == y-axis:\n------------------------------\n\n * pm\n |\\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\ b\n | \\\n | \\\n | \\ .-' (pv)\n | 90° \\.-'\n | .-'* rpd\n | .-'\n * *-' d\n p rp\n\n rpdx = rpx + d * pv.x\n rpdy = rpy + d * pv.y\n\n equation of line b:\n pvns ... normal slope to pv\n\n y - rpdy = pvns * (x - rpdx)\n\n x = p.x\n\n y = rpdy + pvns * (p.x - rpdx)\n\n\n\ngeneric case:\n-------------\n\n\n .'(fv)\n .'\n .* pm\n .' !\n .' .\n .' !\n .' . b\n .' !\n * .\n p !\n 90° . ... (pv)\n ...-*-'''\n ...---''' rpd\n ...---''' d\n *--'''\n rp\n\n rpdx = rpx + d * pv.x\n rpdy = rpy + d * pv.y\n\n equation of line b:\n pvns... normal slope to pv\n\n y - rpdy = pvns * (x - rpdx)\n\n equation of freedom vector line:\n fvs ... slope of freedom vector (=fy/fx)\n\n y - py = fvs * (x - px)\n\n\n on pm both equations are true for same x/y\n\n y - rpdy = pvns * (x - rpdx)\n\n y - py = fvs * (x - px)\n\n form to y and set equal:\n\n pvns * (x - rpdx) + rpdy = fvs * (x - px) + py\n\n expand:\n\n pvns * x - pvns * rpdx + rpdy = fvs * x - fvs * px + py\n\n switch:\n\n fvs * x - fvs * px + py = pvns * x - pvns * rpdx + rpdy\n\n solve for x:\n\n fvs * x - pvns * x = fvs * px - pvns * rpdx - py + rpdy\n\n\n\n fvs * px - pvns * rpdx + rpdy - py\n x = -----------------------------------\n fvs - pvns\n\n and:\n\n y = fvs * (x - px) + py\n\n\n\nINTERPOLATE:\n============\n\nExamples of point interpolation.\n\nThe weight of the movement of the reference point gets bigger\nthe further the other reference point is away, thus the safest\noption (that is avoiding 0/0 divisions) is to weight the\noriginal distance of the other point by the sum of both distances.\n\nIf the sum of both distances is 0, then move the point by the\narithmetic average of the movement of both reference points.\n\n\n\n\n (+6)\n rp1o *---->*rp1\n . . (+12)\n . . rp2o *---------->* rp2\n . . . .\n . . . .\n . 10 20 . .\n |.........|...................| .\n . . .\n . . (+8) .\n po *------>*p .\n . . .\n . 12 . 24 .\n |...........|.......................|\n 36\n\n\n-------\n\n\n\n (+10)\n rp1o *-------->*rp1\n . . (-10)\n . . rp2 *<---------* rpo2\n . . . .\n . . . .\n . 10 . 30 . .\n |.........|.............................|\n . .\n . (+5) .\n po *--->* p .\n . . .\n . . 20 .\n |....|..............|\n 5 15\n\n\n-------\n\n\n (+10)\n rp1o *-------->*rp1\n . .\n . .\n rp2o *-------->*rp2\n\n\n (+10)\n po *-------->* p\n\n-------\n\n\n (+10)\n rp1o *-------->*rp1\n . .\n . .(+30)\n rp2o *---------------------------->*rp2\n\n\n (+25)\n po *----------------------->* p\n\n\n\nvim: set ts=4 sw=4 expandtab:\n*****/\n\n /**\n * Converts a string into a list of tokens.\n */\n\n /**\n * Create a new token\n * @param {string} char a single char\n */\n function Token(char) {\n this.char = char\n this.state = {}\n this.activeState = null\n }\n\n /**\n * Create a new context range\n * @param {number} startIndex range start index\n * @param {number} endOffset range end index offset\n * @param {string} contextName owner context name\n */\n function ContextRange(startIndex, endOffset, contextName) {\n this.contextName = contextName\n this.startIndex = startIndex\n this.endOffset = endOffset\n }\n\n /**\n * Check context start and end\n * @param {string} contextName a unique context name\n * @param {function} checkStart a predicate function the indicates a context's start\n * @param {function} checkEnd a predicate function the indicates a context's end\n */\n function ContextChecker(contextName, checkStart, checkEnd) {\n this.contextName = contextName\n this.openRange = null\n this.ranges = []\n this.checkStart = checkStart\n this.checkEnd = checkEnd\n }\n\n /**\n * @typedef ContextParams\n * @type Object\n * @property {array} context context items\n * @property {number} currentIndex current item index\n */\n\n /**\n * Create a context params\n * @param {array} context a list of items\n * @param {number} currentIndex current item index\n */\n function ContextParams(context, currentIndex) {\n this.context = context\n this.index = currentIndex\n this.length = context.length\n this.current = context[currentIndex]\n this.backtrack = context.slice(0, currentIndex)\n this.lookahead = context.slice(currentIndex + 1)\n }\n\n /**\n * Create an event instance\n * @param {string} eventId event unique id\n */\n function Event(eventId) {\n this.eventId = eventId\n this.subscribers = []\n }\n\n /**\n * Initialize a core events and auto subscribe required event handlers\n * @param {any} events an object that enlists core events handlers\n */\n function initializeCoreEvents(events) {\n var this$1 = this\n\n var coreEvents = [\n 'start',\n 'end',\n 'next',\n 'newToken',\n 'contextStart',\n 'contextEnd',\n 'insertToken',\n 'removeToken',\n 'removeRange',\n 'replaceToken',\n 'replaceRange',\n 'composeRUD',\n 'updateContextsRanges',\n ]\n\n coreEvents.forEach(function (eventId) {\n Object.defineProperty(this$1.events, eventId, {\n value: new Event(eventId),\n })\n })\n\n if (!!events) {\n coreEvents.forEach(function (eventId) {\n var event = events[eventId]\n if (typeof event === 'function') {\n this$1.events[eventId].subscribe(event)\n }\n })\n }\n var requiresContextUpdate = [\n 'insertToken',\n 'removeToken',\n 'removeRange',\n 'replaceToken',\n 'replaceRange',\n 'composeRUD',\n ]\n requiresContextUpdate.forEach(function (eventId) {\n this$1.events[eventId].subscribe(this$1.updateContextsRanges)\n })\n }\n\n /**\n * Converts a string into a list of tokens\n * @param {any} events tokenizer core events\n */\n function Tokenizer(events) {\n this.tokens = []\n this.registeredContexts = {}\n this.contextCheckers = []\n this.events = {}\n this.registeredModifiers = []\n\n initializeCoreEvents.call(this, events)\n }\n\n /**\n * Sets the state of a token, usually called by a state modifier.\n * @param {string} key state item key\n * @param {any} value state item value\n */\n Token.prototype.setState = function (key, value) {\n this.state[key] = value\n this.activeState = { key: key, value: this.state[key] }\n return this.activeState\n }\n\n Token.prototype.getState = function (stateId) {\n return this.state[stateId] || null\n }\n\n /**\n * Checks if an index exists in the tokens list.\n * @param {number} index token index\n */\n Tokenizer.prototype.inboundIndex = function (index) {\n return index >= 0 && index < this.tokens.length\n }\n\n /**\n * Compose and apply a list of operations (replace, update, delete)\n * @param {array} RUDs replace, update and delete operations\n * TODO: Perf. Optimization (lengthBefore === lengthAfter ? dispatch once)\n */\n Tokenizer.prototype.composeRUD = function (RUDs) {\n var this$1 = this\n\n var silent = true\n var state = RUDs.map(function (RUD) {\n return this$1[RUD[0]].apply(this$1, RUD.slice(1).concat(silent))\n })\n var hasFAILObject = function (obj) {\n return typeof obj === 'object' && obj.hasOwnProperty('FAIL')\n }\n if (state.every(hasFAILObject)) {\n return {\n FAIL: \"composeRUD: one or more operations hasn't completed successfully\",\n report: state.filter(hasFAILObject),\n }\n }\n this.dispatch('composeRUD', [\n state.filter(function (op) {\n return !hasFAILObject(op)\n }),\n ])\n }\n\n /**\n * Replace a range of tokens with a list of tokens\n * @param {number} startIndex range start index\n * @param {number} offset range offset\n * @param {token} tokens a list of tokens to replace\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.replaceRange = function (startIndex, offset, tokens, silent) {\n offset = offset !== null ? offset : this.tokens.length\n var isTokenType = tokens.every(function (token) {\n return token instanceof Token\n })\n if (!isNaN(startIndex) && this.inboundIndex(startIndex) && isTokenType) {\n var replaced = this.tokens.splice.apply(this.tokens, [startIndex, offset].concat(tokens))\n if (!silent) {\n this.dispatch('replaceToken', [startIndex, offset, tokens])\n }\n return [replaced, tokens]\n } else {\n return { FAIL: 'replaceRange: invalid tokens or startIndex.' }\n }\n }\n\n /**\n * Replace a token with another token\n * @param {number} index token index\n * @param {token} token a token to replace\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.replaceToken = function (index, token, silent) {\n if (!isNaN(index) && this.inboundIndex(index) && token instanceof Token) {\n var replaced = this.tokens.splice(index, 1, token)\n if (!silent) {\n this.dispatch('replaceToken', [index, token])\n }\n return [replaced[0], token]\n } else {\n return { FAIL: 'replaceToken: invalid token or index.' }\n }\n }\n\n /**\n * Removes a range of tokens\n * @param {number} startIndex range start index\n * @param {number} offset range offset\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.removeRange = function (startIndex, offset, silent) {\n offset = !isNaN(offset) ? offset : this.tokens.length\n var tokens = this.tokens.splice(startIndex, offset)\n if (!silent) {\n this.dispatch('removeRange', [tokens, startIndex, offset])\n }\n return tokens\n }\n\n /**\n * Remove a token at a certain index\n * @param {number} index token index\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.removeToken = function (index, silent) {\n if (!isNaN(index) && this.inboundIndex(index)) {\n var token = this.tokens.splice(index, 1)\n if (!silent) {\n this.dispatch('removeToken', [token, index])\n }\n return token\n } else {\n return { FAIL: 'removeToken: invalid token index.' }\n }\n }\n\n /**\n * Insert a list of tokens at a certain index\n * @param {array} tokens a list of tokens to insert\n * @param {number} index insert the list of tokens at index\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.insertToken = function (tokens, index, silent) {\n var tokenType = tokens.every(function (token) {\n return token instanceof Token\n })\n if (tokenType) {\n this.tokens.splice.apply(this.tokens, [index, 0].concat(tokens))\n if (!silent) {\n this.dispatch('insertToken', [tokens, index])\n }\n return tokens\n } else {\n return { FAIL: 'insertToken: invalid token(s).' }\n }\n }\n\n /**\n * A state modifier that is called on 'newToken' event\n * @param {string} modifierId state modifier id\n * @param {function} condition a predicate function that returns true or false\n * @param {function} modifier a function to update token state\n */\n Tokenizer.prototype.registerModifier = function (modifierId, condition, modifier) {\n this.events.newToken.subscribe(function (token, contextParams) {\n var conditionParams = [token, contextParams]\n var canApplyModifier = condition === null || condition.apply(this, conditionParams) === true\n var modifierParams = [token, contextParams]\n if (canApplyModifier) {\n var newStateValue = modifier.apply(this, modifierParams)\n token.setState(modifierId, newStateValue)\n }\n })\n this.registeredModifiers.push(modifierId)\n }\n\n /**\n * Subscribe a handler to an event\n * @param {function} eventHandler an event handler function\n */\n Event.prototype.subscribe = function (eventHandler) {\n if (typeof eventHandler === 'function') {\n return this.subscribers.push(eventHandler) - 1\n } else {\n return { FAIL: \"invalid '\" + this.eventId + \"' event handler\" }\n }\n }\n\n /**\n * Unsubscribe an event handler\n * @param {string} subsId subscription id\n */\n Event.prototype.unsubscribe = function (subsId) {\n this.subscribers.splice(subsId, 1)\n }\n\n /**\n * Sets context params current value index\n * @param {number} index context params current value index\n */\n ContextParams.prototype.setCurrentIndex = function (index) {\n this.index = index\n this.current = this.context[index]\n this.backtrack = this.context.slice(0, index)\n this.lookahead = this.context.slice(index + 1)\n }\n\n /**\n * Get an item at an offset from the current value\n * example (current value is 3):\n * 1 2 [3] 4 5 | items values\n * -2 -1 0 1 2 | offset values\n * @param {number} offset an offset from current value index\n */\n ContextParams.prototype.get = function (offset) {\n switch (true) {\n case offset === 0:\n return this.current\n case offset < 0 && Math.abs(offset) <= this.backtrack.length:\n return this.backtrack.slice(offset)[0]\n case offset > 0 && offset <= this.lookahead.length:\n return this.lookahead[offset - 1]\n default:\n return null\n }\n }\n\n /**\n * Converts a context range into a string value\n * @param {contextRange} range a context range\n */\n Tokenizer.prototype.rangeToText = function (range) {\n if (range instanceof ContextRange) {\n return this.getRangeTokens(range)\n .map(function (token) {\n return token.char\n })\n .join('')\n }\n }\n\n /**\n * Converts all tokens into a string\n */\n Tokenizer.prototype.getText = function () {\n return this.tokens\n .map(function (token) {\n return token.char\n })\n .join('')\n }\n\n /**\n * Get a context by name\n * @param {string} contextName context name to get\n */\n Tokenizer.prototype.getContext = function (contextName) {\n var context = this.registeredContexts[contextName]\n return !!context ? context : null\n }\n\n /**\n * Subscribes a new event handler to an event\n * @param {string} eventName event name to subscribe to\n * @param {function} eventHandler a function to be invoked on event\n */\n Tokenizer.prototype.on = function (eventName, eventHandler) {\n var event = this.events[eventName]\n if (!!event) {\n return event.subscribe(eventHandler)\n } else {\n return null\n }\n }\n\n /**\n * Dispatches an event\n * @param {string} eventName event name\n * @param {any} args event handler arguments\n */\n Tokenizer.prototype.dispatch = function (eventName, args) {\n var this$1 = this\n\n var event = this.events[eventName]\n if (event instanceof Event) {\n event.subscribers.forEach(function (subscriber) {\n subscriber.apply(this$1, args || [])\n })\n }\n }\n\n /**\n * Register a new context checker\n * @param {string} contextName a unique context name\n * @param {function} contextStartCheck a predicate function that returns true on context start\n * @param {function} contextEndCheck a predicate function that returns true on context end\n * TODO: call tokenize on registration to update context ranges with the new context.\n */\n Tokenizer.prototype.registerContextChecker = function (contextName, contextStartCheck, contextEndCheck) {\n if (!!this.getContext(contextName)) {\n return {\n FAIL: \"context name '\" + contextName + \"' is already registered.\",\n }\n }\n if (typeof contextStartCheck !== 'function') {\n return {\n FAIL: 'missing context start check.',\n }\n }\n if (typeof contextEndCheck !== 'function') {\n return {\n FAIL: 'missing context end check.',\n }\n }\n var contextCheckers = new ContextChecker(contextName, contextStartCheck, contextEndCheck)\n this.registeredContexts[contextName] = contextCheckers\n this.contextCheckers.push(contextCheckers)\n return contextCheckers\n }\n\n /**\n * Gets a context range tokens\n * @param {contextRange} range a context range\n */\n Tokenizer.prototype.getRangeTokens = function (range) {\n var endIndex = range.startIndex + range.endOffset\n return [].concat(this.tokens.slice(range.startIndex, endIndex))\n }\n\n /**\n * Gets the ranges of a context\n * @param {string} contextName context name\n */\n Tokenizer.prototype.getContextRanges = function (contextName) {\n var context = this.getContext(contextName)\n if (!!context) {\n return context.ranges\n } else {\n return { FAIL: \"context checker '\" + contextName + \"' is not registered.\" }\n }\n }\n\n /**\n * Resets context ranges to run context update\n */\n Tokenizer.prototype.resetContextsRanges = function () {\n var registeredContexts = this.registeredContexts\n for (var contextName in registeredContexts) {\n if (registeredContexts.hasOwnProperty(contextName)) {\n var context = registeredContexts[contextName]\n context.ranges = []\n }\n }\n }\n\n /**\n * Updates context ranges\n */\n Tokenizer.prototype.updateContextsRanges = function () {\n this.resetContextsRanges()\n var chars = this.tokens.map(function (token) {\n return token.char\n })\n for (var i = 0; i < chars.length; i++) {\n var contextParams = new ContextParams(chars, i)\n this.runContextCheck(contextParams)\n }\n this.dispatch('updateContextsRanges', [this.registeredContexts])\n }\n\n /**\n * Sets the end offset of an open range\n * @param {number} offset range end offset\n * @param {string} contextName context name\n */\n Tokenizer.prototype.setEndOffset = function (offset, contextName) {\n var startIndex = this.getContext(contextName).openRange.startIndex\n var range = new ContextRange(startIndex, offset, contextName)\n var ranges = this.getContext(contextName).ranges\n range.rangeId = contextName + '.' + ranges.length\n ranges.push(range)\n this.getContext(contextName).openRange = null\n return range\n }\n\n /**\n * Runs a context check on the current context\n * @param {contextParams} contextParams current context params\n */\n Tokenizer.prototype.runContextCheck = function (contextParams) {\n var this$1 = this\n\n var index = contextParams.index\n this.contextCheckers.forEach(function (contextChecker) {\n var contextName = contextChecker.contextName\n var openRange = this$1.getContext(contextName).openRange\n if (!openRange && contextChecker.checkStart(contextParams)) {\n openRange = new ContextRange(index, null, contextName)\n this$1.getContext(contextName).openRange = openRange\n this$1.dispatch('contextStart', [contextName, index])\n }\n if (!!openRange && contextChecker.checkEnd(contextParams)) {\n var offset = index - openRange.startIndex + 1\n var range = this$1.setEndOffset(offset, contextName)\n this$1.dispatch('contextEnd', [contextName, range])\n }\n })\n }\n\n /**\n * Converts a text into a list of tokens\n * @param {string} text a text to tokenize\n */\n Tokenizer.prototype.tokenize = function (text) {\n this.tokens = []\n this.resetContextsRanges()\n var chars = Array.from(text)\n this.dispatch('start')\n for (var i = 0; i < chars.length; i++) {\n var char = chars[i]\n var contextParams = new ContextParams(chars, i)\n this.dispatch('next', [contextParams])\n this.runContextCheck(contextParams)\n var token = new Token(char)\n this.tokens.push(token)\n this.dispatch('newToken', [token, contextParams])\n }\n this.dispatch('end', [this.tokens])\n return this.tokens\n }\n\n // ╭─┄┄┄────────────────────────┄─────────────────────────────────────────────╮\n // ┊ Character Class Assertions ┊ Checks if a char belongs to a certain class ┊\n // ╰─╾──────────────────────────┄─────────────────────────────────────────────╯\n // jscs:disable maximumLineLength\n /**\n * Check if a char is Arabic\n * @param {string} c a single char\n */\n function isArabicChar(c) {\n return /[\\u0600-\\u065F\\u066A-\\u06D2\\u06FA-\\u06FF]/.test(c)\n }\n\n /**\n * Check if a char is an isolated arabic char\n * @param {string} c a single char\n */\n function isIsolatedArabicChar(char) {\n return /[\\u0630\\u0690\\u0621\\u0631\\u0661\\u0671\\u0622\\u0632\\u0672\\u0692\\u06C2\\u0623\\u0673\\u0693\\u06C3\\u0624\\u0694\\u06C4\\u0625\\u0675\\u0695\\u06C5\\u06E5\\u0676\\u0696\\u06C6\\u0627\\u0677\\u0697\\u06C7\\u0648\\u0688\\u0698\\u06C8\\u0689\\u0699\\u06C9\\u068A\\u06CA\\u066B\\u068B\\u06CB\\u068C\\u068D\\u06CD\\u06FD\\u068E\\u06EE\\u06FE\\u062F\\u068F\\u06CF\\u06EF]/.test(\n char,\n )\n }\n\n /**\n * Check if a char is an Arabic Tashkeel char\n * @param {string} c a single char\n */\n function isTashkeelArabicChar(char) {\n return /[\\u0600-\\u0605\\u060C-\\u060E\\u0610-\\u061B\\u061E\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED]/.test(\n char,\n )\n }\n\n /**\n * Check if a char is Latin\n * @param {string} c a single char\n */\n function isLatinChar(c) {\n return /[A-z]/.test(c)\n }\n\n /**\n * Check if a char is whitespace char\n * @param {string} c a single char\n */\n function isWhiteSpace(c) {\n return /\\s/.test(c)\n }\n\n /**\n * Query a feature by some of it's properties to lookup a glyph substitution.\n */\n\n /**\n * Create feature query instance\n * @param {Font} font opentype font instance\n */\n function FeatureQuery(font) {\n this.font = font\n this.features = {}\n }\n\n /**\n * @typedef SubstitutionAction\n * @type Object\n * @property {number} id substitution type\n * @property {string} tag feature tag\n * @property {any} substitution substitution value(s)\n */\n\n /**\n * Create a substitution action instance\n * @param {SubstitutionAction} action\n */\n function SubstitutionAction(action) {\n this.id = action.id\n this.tag = action.tag\n this.substitution = action.substitution\n }\n\n /**\n * Lookup a coverage table\n * @param {number} glyphIndex glyph index\n * @param {CoverageTable} coverage coverage table\n */\n function lookupCoverage(glyphIndex, coverage) {\n if (!glyphIndex) {\n return -1\n }\n switch (coverage.format) {\n case 1:\n return coverage.glyphs.indexOf(glyphIndex)\n\n case 2:\n var ranges = coverage.ranges\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n if (glyphIndex >= range.start && glyphIndex <= range.end) {\n var offset = glyphIndex - range.start\n return range.index + offset\n }\n }\n break\n default:\n return -1 // not found\n }\n return -1\n }\n\n /**\n * Handle a single substitution - format 1\n * @param {ContextParams} contextParams context params to lookup\n */\n function singleSubstitutionFormat1(glyphIndex, subtable) {\n var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (substituteIndex === -1) {\n return null\n }\n return glyphIndex + subtable.deltaGlyphId\n }\n\n /**\n * Handle a single substitution - format 2\n * @param {ContextParams} contextParams context params to lookup\n */\n function singleSubstitutionFormat2(glyphIndex, subtable) {\n var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (substituteIndex === -1) {\n return null\n }\n return subtable.substitute[substituteIndex]\n }\n\n /**\n * Lookup a list of coverage tables\n * @param {any} coverageList a list of coverage tables\n * @param {ContextParams} contextParams context params to lookup\n */\n function lookupCoverageList(coverageList, contextParams) {\n var lookupList = []\n for (var i = 0; i < coverageList.length; i++) {\n var coverage = coverageList[i]\n var glyphIndex = contextParams.current\n glyphIndex = Array.isArray(glyphIndex) ? glyphIndex[0] : glyphIndex\n var lookupIndex = lookupCoverage(glyphIndex, coverage)\n if (lookupIndex !== -1) {\n lookupList.push(lookupIndex)\n }\n }\n if (lookupList.length !== coverageList.length) {\n return -1\n }\n return lookupList\n }\n\n /**\n * Handle chaining context substitution - format 3\n * @param {ContextParams} contextParams context params to lookup\n */\n function chainingSubstitutionFormat3(contextParams, subtable) {\n var lookupsCount =\n subtable.inputCoverage.length + subtable.lookaheadCoverage.length + subtable.backtrackCoverage.length\n if (contextParams.context.length < lookupsCount) {\n return []\n }\n // INPUT LOOKUP //\n var inputLookups = lookupCoverageList(subtable.inputCoverage, contextParams)\n if (inputLookups === -1) {\n return []\n }\n // LOOKAHEAD LOOKUP //\n var lookaheadOffset = subtable.inputCoverage.length - 1\n if (contextParams.lookahead.length < subtable.lookaheadCoverage.length) {\n return []\n }\n var lookaheadContext = contextParams.lookahead.slice(lookaheadOffset)\n while (lookaheadContext.length && isTashkeelArabicChar(lookaheadContext[0].char)) {\n lookaheadContext.shift()\n }\n var lookaheadParams = new ContextParams(lookaheadContext, 0)\n var lookaheadLookups = lookupCoverageList(subtable.lookaheadCoverage, lookaheadParams)\n // BACKTRACK LOOKUP //\n var backtrackContext = [].concat(contextParams.backtrack)\n backtrackContext.reverse()\n while (backtrackContext.length && isTashkeelArabicChar(backtrackContext[0].char)) {\n backtrackContext.shift()\n }\n if (backtrackContext.length < subtable.backtrackCoverage.length) {\n return []\n }\n var backtrackParams = new ContextParams(backtrackContext, 0)\n var backtrackLookups = lookupCoverageList(subtable.backtrackCoverage, backtrackParams)\n var contextRulesMatch =\n inputLookups.length === subtable.inputCoverage.length &&\n lookaheadLookups.length === subtable.lookaheadCoverage.length &&\n backtrackLookups.length === subtable.backtrackCoverage.length\n var substitutions = []\n if (contextRulesMatch) {\n for (var i = 0; i < subtable.lookupRecords.length; i++) {\n var lookupRecord = subtable.lookupRecords[i]\n var lookupListIndex = lookupRecord.lookupListIndex\n var lookupTable = this.getLookupByIndex(lookupListIndex)\n for (var s = 0; s < lookupTable.subtables.length; s++) {\n var subtable$1 = lookupTable.subtables[s]\n var lookup = this.getLookupMethod(lookupTable, subtable$1)\n var substitutionType = this.getSubstitutionType(lookupTable, subtable$1)\n if (substitutionType === '12') {\n for (var n = 0; n < inputLookups.length; n++) {\n var glyphIndex = contextParams.get(n)\n var substitution = lookup(glyphIndex)\n if (substitution) {\n substitutions.push(substitution)\n }\n }\n }\n }\n }\n }\n return substitutions\n }\n\n /**\n * Handle ligature substitution - format 1\n * @param {ContextParams} contextParams context params to lookup\n */\n function ligatureSubstitutionFormat1(contextParams, subtable) {\n // COVERAGE LOOKUP //\n var glyphIndex = contextParams.current\n var ligSetIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (ligSetIndex === -1) {\n return null\n }\n // COMPONENTS LOOKUP\n // (!) note, components are ordered in the written direction.\n var ligature\n var ligatureSet = subtable.ligatureSets[ligSetIndex]\n for (var s = 0; s < ligatureSet.length; s++) {\n ligature = ligatureSet[s]\n for (var l = 0; l < ligature.components.length; l++) {\n var lookaheadItem = contextParams.lookahead[l]\n var component = ligature.components[l]\n if (lookaheadItem !== component) {\n break\n }\n if (l === ligature.components.length - 1) {\n return ligature\n }\n }\n }\n return null\n }\n\n /**\n * Handle decomposition substitution - format 1\n * @param {number} glyphIndex glyph index\n * @param {any} subtable subtable\n */\n function decompositionSubstitutionFormat1(glyphIndex, subtable) {\n var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (substituteIndex === -1) {\n return null\n }\n return subtable.sequences[substituteIndex]\n }\n\n /**\n * Get default script features indexes\n */\n FeatureQuery.prototype.getDefaultScriptFeaturesIndexes = function () {\n var scripts = this.font.tables.gsub.scripts\n for (var s = 0; s < scripts.length; s++) {\n var script = scripts[s]\n if (script.tag === 'DFLT') {\n return script.script.defaultLangSys.featureIndexes\n }\n }\n return []\n }\n\n /**\n * Get feature indexes of a specific script\n * @param {string} scriptTag script tag\n */\n FeatureQuery.prototype.getScriptFeaturesIndexes = function (scriptTag) {\n var tables = this.font.tables\n if (!tables.gsub) {\n return []\n }\n if (!scriptTag) {\n return this.getDefaultScriptFeaturesIndexes()\n }\n var scripts = this.font.tables.gsub.scripts\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i]\n if (script.tag === scriptTag && script.script.defaultLangSys) {\n return script.script.defaultLangSys.featureIndexes\n } else {\n var langSysRecords = script.langSysRecords\n if (!!langSysRecords) {\n for (var j = 0; j < langSysRecords.length; j++) {\n var langSysRecord = langSysRecords[j]\n if (langSysRecord.tag === scriptTag) {\n var langSys = langSysRecord.langSys\n return langSys.featureIndexes\n }\n }\n }\n }\n }\n return this.getDefaultScriptFeaturesIndexes()\n }\n\n /**\n * Map a feature tag to a gsub feature\n * @param {any} features gsub features\n * @param {string} scriptTag script tag\n */\n FeatureQuery.prototype.mapTagsToFeatures = function (features, scriptTag) {\n var tags = {}\n for (var i = 0; i < features.length; i++) {\n var tag = features[i].tag\n var feature = features[i].feature\n tags[tag] = feature\n }\n this.features[scriptTag].tags = tags\n }\n\n /**\n * Get features of a specific script\n * @param {string} scriptTag script tag\n */\n FeatureQuery.prototype.getScriptFeatures = function (scriptTag) {\n var features = this.features[scriptTag]\n if (this.features.hasOwnProperty(scriptTag)) {\n return features\n }\n var featuresIndexes = this.getScriptFeaturesIndexes(scriptTag)\n if (!featuresIndexes) {\n return null\n }\n var gsub = this.font.tables.gsub\n features = featuresIndexes.map(function (index) {\n return gsub.features[index]\n })\n this.features[scriptTag] = features\n this.mapTagsToFeatures(features, scriptTag)\n return features\n }\n\n /**\n * Get substitution type\n * @param {any} lookupTable lookup table\n * @param {any} subtable subtable\n */\n FeatureQuery.prototype.getSubstitutionType = function (lookupTable, subtable) {\n var lookupType = lookupTable.lookupType.toString()\n var substFormat = subtable.substFormat.toString()\n return lookupType + substFormat\n }\n\n /**\n * Get lookup method\n * @param {any} lookupTable lookup table\n * @param {any} subtable subtable\n */\n FeatureQuery.prototype.getLookupMethod = function (lookupTable, subtable) {\n var this$1 = this\n\n var substitutionType = this.getSubstitutionType(lookupTable, subtable)\n switch (substitutionType) {\n case '11':\n return function (glyphIndex) {\n return singleSubstitutionFormat1.apply(this$1, [glyphIndex, subtable])\n }\n case '12':\n return function (glyphIndex) {\n return singleSubstitutionFormat2.apply(this$1, [glyphIndex, subtable])\n }\n case '63':\n return function (contextParams) {\n return chainingSubstitutionFormat3.apply(this$1, [contextParams, subtable])\n }\n case '41':\n return function (contextParams) {\n return ligatureSubstitutionFormat1.apply(this$1, [contextParams, subtable])\n }\n case '21':\n return function (glyphIndex) {\n return decompositionSubstitutionFormat1.apply(this$1, [glyphIndex, subtable])\n }\n default:\n throw new Error(\n 'lookupType: ' +\n lookupTable.lookupType +\n ' - ' +\n 'substFormat: ' +\n subtable.substFormat +\n ' ' +\n 'is not yet supported',\n )\n }\n }\n\n /**\n * [ LOOKUP TYPES ]\n * -------------------------------\n * Single 1;\n * Multiple 2;\n * Alternate 3;\n * Ligature 4;\n * Context 5;\n * ChainingContext 6;\n * ExtensionSubstitution 7;\n * ReverseChainingContext 8;\n * -------------------------------\n *\n */\n\n /**\n * @typedef FQuery\n * @type Object\n * @param {string} tag feature tag\n * @param {string} script feature script\n * @param {ContextParams} contextParams context params\n */\n\n /**\n * Lookup a feature using a query parameters\n * @param {FQuery} query feature query\n */\n FeatureQuery.prototype.lookupFeature = function (query) {\n var contextParams = query.contextParams\n var currentIndex = contextParams.index\n var feature = this.getFeature({\n tag: query.tag,\n script: query.script,\n })\n if (!feature) {\n return new Error(\n \"font '\" +\n this.font.names.fullName.en +\n \"' \" +\n \"doesn't support feature '\" +\n query.tag +\n \"' \" +\n \"for script '\" +\n query.script +\n \"'.\",\n )\n }\n var lookups = this.getFeatureLookups(feature)\n var substitutions = [].concat(contextParams.context)\n for (var l = 0; l < lookups.length; l++) {\n var lookupTable = lookups[l]\n var subtables = this.getLookupSubtables(lookupTable)\n for (var s = 0; s < subtables.length; s++) {\n var subtable = subtables[s]\n var substType = this.getSubstitutionType(lookupTable, subtable)\n var lookup = this.getLookupMethod(lookupTable, subtable)\n var substitution = void 0\n switch (substType) {\n case '11':\n substitution = lookup(contextParams.current)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 11,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '12':\n substitution = lookup(contextParams.current)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 12,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '63':\n substitution = lookup(contextParams)\n if (Array.isArray(substitution) && substitution.length) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 63,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '41':\n substitution = lookup(contextParams)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 41,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '21':\n substitution = lookup(contextParams.current)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 21,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n }\n contextParams = new ContextParams(substitutions, currentIndex)\n if (Array.isArray(substitution) && !substitution.length) {\n continue\n }\n substitution = null\n }\n }\n return substitutions.length ? substitutions : null\n }\n\n /**\n * Checks if a font supports a specific features\n * @param {FQuery} query feature query object\n */\n FeatureQuery.prototype.supports = function (query) {\n if (!query.script) {\n return false\n }\n this.getScriptFeatures(query.script)\n var supportedScript = this.features.hasOwnProperty(query.script)\n if (!query.tag) {\n return supportedScript\n }\n var supportedFeature = this.features[query.script].some(function (feature) {\n return feature.tag === query.tag\n })\n return supportedScript && supportedFeature\n }\n\n /**\n * Get lookup table subtables\n * @param {any} lookupTable lookup table\n */\n FeatureQuery.prototype.getLookupSubtables = function (lookupTable) {\n return lookupTable.subtables || null\n }\n\n /**\n * Get lookup table by index\n * @param {number} index lookup table index\n */\n FeatureQuery.prototype.getLookupByIndex = function (index) {\n var lookups = this.font.tables.gsub.lookups\n return lookups[index] || null\n }\n\n /**\n * Get lookup tables for a feature\n * @param {string} feature\n */\n FeatureQuery.prototype.getFeatureLookups = function (feature) {\n // TODO: memoize\n return feature.lookupListIndexes.map(this.getLookupByIndex.bind(this))\n }\n\n /**\n * Query a feature by it's properties\n * @param {any} query an object that describes the properties of a query\n */\n FeatureQuery.prototype.getFeature = function getFeature(query) {\n if (!this.font) {\n return { FAIL: 'No font was found' }\n }\n if (!this.features.hasOwnProperty(query.script)) {\n this.getScriptFeatures(query.script)\n }\n var scriptFeatures = this.features[query.script]\n if (!scriptFeatures) {\n return { FAIL: 'No feature for script ' + query.script }\n }\n if (!scriptFeatures.tags[query.tag]) {\n return null\n }\n return this.features[query.script].tags[query.tag]\n }\n\n /**\n * Arabic word context checkers\n */\n\n function arabicWordStartCheck(contextParams) {\n var char = contextParams.current\n var prevChar = contextParams.get(-1)\n return (\n // ? arabic first char\n (prevChar === null && isArabicChar(char)) ||\n // ? arabic char preceded with a non arabic char\n (!isArabicChar(prevChar) && isArabicChar(char))\n )\n }\n\n function arabicWordEndCheck(contextParams) {\n var nextChar = contextParams.get(1)\n return (\n // ? last arabic char\n nextChar === null ||\n // ? next char is not arabic\n !isArabicChar(nextChar)\n )\n }\n\n var arabicWordCheck = {\n startCheck: arabicWordStartCheck,\n endCheck: arabicWordEndCheck,\n }\n\n /**\n * Arabic sentence context checkers\n */\n\n function arabicSentenceStartCheck(contextParams) {\n var char = contextParams.current\n var prevChar = contextParams.get(-1)\n return (\n // ? an arabic char preceded with a non arabic char\n (isArabicChar(char) || isTashkeelArabicChar(char)) && !isArabicChar(prevChar)\n )\n }\n\n function arabicSentenceEndCheck(contextParams) {\n var nextChar = contextParams.get(1)\n switch (true) {\n case nextChar === null:\n return true\n case !isArabicChar(nextChar) && !isTashkeelArabicChar(nextChar):\n var nextIsWhitespace = isWhiteSpace(nextChar)\n if (!nextIsWhitespace) {\n return true\n }\n if (nextIsWhitespace) {\n var arabicCharAhead = false\n arabicCharAhead = contextParams.lookahead.some(function (c) {\n return isArabicChar(c) || isTashkeelArabicChar(c)\n })\n if (!arabicCharAhead) {\n return true\n }\n }\n break\n default:\n return false\n }\n }\n\n var arabicSentenceCheck = {\n startCheck: arabicSentenceStartCheck,\n endCheck: arabicSentenceEndCheck,\n }\n\n /**\n * Apply single substitution format 1\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function singleSubstitutionFormat1$1(action, tokens, index) {\n tokens[index].setState(action.tag, action.substitution)\n }\n\n /**\n * Apply single substitution format 2\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function singleSubstitutionFormat2$1(action, tokens, index) {\n tokens[index].setState(action.tag, action.substitution)\n }\n\n /**\n * Apply chaining context substitution format 3\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function chainingSubstitutionFormat3$1(action, tokens, index) {\n action.substitution.forEach(function (subst, offset) {\n var token = tokens[index + offset]\n token.setState(action.tag, subst)\n })\n }\n\n /**\n * Apply ligature substitution format 1\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function ligatureSubstitutionFormat1$1(action, tokens, index) {\n var token = tokens[index]\n token.setState(action.tag, action.substitution.ligGlyph)\n var compsCount = action.substitution.components.length\n for (var i = 0; i < compsCount; i++) {\n token = tokens[index + i + 1]\n token.setState('deleted', true)\n }\n }\n\n /**\n * Supported substitutions\n */\n var SUBSTITUTIONS = {\n 11: singleSubstitutionFormat1$1,\n 12: singleSubstitutionFormat2$1,\n 63: chainingSubstitutionFormat3$1,\n 41: ligatureSubstitutionFormat1$1,\n }\n\n /**\n * Apply substitutions to a list of tokens\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function applySubstitution(action, tokens, index) {\n if (action instanceof SubstitutionAction && SUBSTITUTIONS[action.id]) {\n SUBSTITUTIONS[action.id](action, tokens, index)\n }\n }\n\n /**\n * Apply Arabic presentation forms to a range of tokens\n */\n\n /**\n * Check if a char can be connected to it's preceding char\n * @param {ContextParams} charContextParams context params of a char\n */\n function willConnectPrev(charContextParams) {\n var backtrack = [].concat(charContextParams.backtrack)\n for (var i = backtrack.length - 1; i >= 0; i--) {\n var prevChar = backtrack[i]\n var isolated = isIsolatedArabicChar(prevChar)\n var tashkeel = isTashkeelArabicChar(prevChar)\n if (!isolated && !tashkeel) {\n return true\n }\n if (isolated) {\n return false\n }\n }\n return false\n }\n\n /**\n * Check if a char can be connected to it's proceeding char\n * @param {ContextParams} charContextParams context params of a char\n */\n function willConnectNext(charContextParams) {\n if (isIsolatedArabicChar(charContextParams.current)) {\n return false\n }\n for (var i = 0; i < charContextParams.lookahead.length; i++) {\n var nextChar = charContextParams.lookahead[i]\n var tashkeel = isTashkeelArabicChar(nextChar)\n if (!tashkeel) {\n return true\n }\n }\n return false\n }\n\n /**\n * Apply arabic presentation forms to a list of tokens\n * @param {ContextRange} range a range of tokens\n */\n function arabicPresentationForms(range) {\n var this$1 = this\n\n var script = 'arab'\n var tags = this.featuresTags[script]\n var tokens = this.tokenizer.getRangeTokens(range)\n if (tokens.length === 1) {\n return\n }\n var contextParams = new ContextParams(\n tokens.map(function (token) {\n return token.getState('glyphIndex')\n }),\n 0,\n )\n var charContextParams = new ContextParams(\n tokens.map(function (token) {\n return token.char\n }),\n 0,\n )\n tokens.forEach(function (token, index) {\n if (isTashkeelArabicChar(token.char)) {\n return\n }\n contextParams.setCurrentIndex(index)\n charContextParams.setCurrentIndex(index)\n var CONNECT = 0 // 2 bits 00 (10: can connect next) (01: can connect prev)\n if (willConnectPrev(charContextParams)) {\n CONNECT |= 1\n }\n if (willConnectNext(charContextParams)) {\n CONNECT |= 2\n }\n var tag\n switch (CONNECT) {\n case 1:\n tag = 'fina'\n break\n case 2:\n tag = 'init'\n break\n case 3:\n tag = 'medi'\n break\n }\n if (tags.indexOf(tag) === -1) {\n return\n }\n var substitutions = this$1.query.lookupFeature({\n tag: tag,\n script: script,\n contextParams: contextParams,\n })\n if (substitutions instanceof Error) {\n return console.info(substitutions.message)\n }\n substitutions.forEach(function (action, index) {\n if (action instanceof SubstitutionAction) {\n applySubstitution(action, tokens, index)\n contextParams.context[index] = action.substitution\n }\n })\n })\n }\n\n /**\n * Apply Arabic required ligatures feature to a range of tokens\n */\n\n /**\n * Update context params\n * @param {any} tokens a list of tokens\n * @param {number} index current item index\n */\n function getContextParams(tokens, index) {\n var context = tokens.map(function (token) {\n return token.activeState.value\n })\n return new ContextParams(context, index || 0)\n }\n\n /**\n * Apply Arabic required ligatures to a context range\n * @param {ContextRange} range a range of tokens\n */\n function arabicRequiredLigatures(range) {\n var this$1 = this\n\n var script = 'arab'\n var tokens = this.tokenizer.getRangeTokens(range)\n var contextParams = getContextParams(tokens)\n contextParams.context.forEach(function (glyphIndex, index) {\n contextParams.setCurrentIndex(index)\n var substitutions = this$1.query.lookupFeature({\n tag: 'rlig',\n script: script,\n contextParams: contextParams,\n })\n if (substitutions.length) {\n substitutions.forEach(function (action) {\n return applySubstitution(action, tokens, index)\n })\n contextParams = getContextParams(tokens)\n }\n })\n }\n\n /**\n * Latin word context checkers\n */\n\n function latinWordStartCheck(contextParams) {\n var char = contextParams.current\n var prevChar = contextParams.get(-1)\n return (\n // ? latin first char\n (prevChar === null && isLatinChar(char)) ||\n // ? latin char preceded with a non latin char\n (!isLatinChar(prevChar) && isLatinChar(char))\n )\n }\n\n function latinWordEndCheck(contextParams) {\n var nextChar = contextParams.get(1)\n return (\n // ? last latin char\n nextChar === null ||\n // ? next char is not latin\n !isLatinChar(nextChar)\n )\n }\n\n var latinWordCheck = {\n startCheck: latinWordStartCheck,\n endCheck: latinWordEndCheck,\n }\n\n /**\n * Apply Latin ligature feature to a range of tokens\n */\n\n /**\n * Update context params\n * @param {any} tokens a list of tokens\n * @param {number} index current item index\n */\n function getContextParams$1(tokens, index) {\n var context = tokens.map(function (token) {\n return token.activeState.value\n })\n return new ContextParams(context, index || 0)\n }\n\n /**\n * Apply Arabic required ligatures to a context range\n * @param {ContextRange} range a range of tokens\n */\n function latinLigature(range) {\n var this$1 = this\n\n var script = 'latn'\n var tokens = this.tokenizer.getRangeTokens(range)\n var contextParams = getContextParams$1(tokens)\n contextParams.context.forEach(function (glyphIndex, index) {\n contextParams.setCurrentIndex(index)\n var substitutions = this$1.query.lookupFeature({\n tag: 'liga',\n script: script,\n contextParams: contextParams,\n })\n if (substitutions.length) {\n substitutions.forEach(function (action) {\n return applySubstitution(action, tokens, index)\n })\n contextParams = getContextParams$1(tokens)\n }\n })\n }\n\n /**\n * Infer bidirectional properties for a given text and apply\n * the corresponding layout rules.\n */\n\n /**\n * Create Bidi. features\n * @param {string} baseDir text base direction. value either 'ltr' or 'rtl'\n */\n function Bidi(baseDir) {\n this.baseDir = baseDir || 'ltr'\n this.tokenizer = new Tokenizer()\n this.featuresTags = {}\n }\n\n /**\n * Sets Bidi text\n * @param {string} text a text input\n */\n Bidi.prototype.setText = function (text) {\n this.text = text\n }\n\n /**\n * Store essential context checks:\n * arabic word check for applying gsub features\n * arabic sentence check for adjusting arabic layout\n */\n Bidi.prototype.contextChecks = {\n latinWordCheck: latinWordCheck,\n arabicWordCheck: arabicWordCheck,\n arabicSentenceCheck: arabicSentenceCheck,\n }\n\n /**\n * Register arabic word check\n */\n function registerContextChecker(checkId) {\n var check = this.contextChecks[checkId + 'Check']\n return this.tokenizer.registerContextChecker(checkId, check.startCheck, check.endCheck)\n }\n\n /**\n * Perform pre tokenization procedure then\n * tokenize text input\n */\n function tokenizeText() {\n registerContextChecker.call(this, 'latinWord')\n registerContextChecker.call(this, 'arabicWord')\n registerContextChecker.call(this, 'arabicSentence')\n return this.tokenizer.tokenize(this.text)\n }\n\n /**\n * Reverse arabic sentence layout\n * TODO: check base dir before applying adjustments - priority low\n */\n function reverseArabicSentences() {\n var this$1 = this\n\n var ranges = this.tokenizer.getContextRanges('arabicSentence')\n ranges.forEach(function (range) {\n var rangeTokens = this$1.tokenizer.getRangeTokens(range)\n this$1.tokenizer.replaceRange(range.startIndex, range.endOffset, rangeTokens.reverse())\n })\n }\n\n /**\n * Register supported features tags\n * @param {script} script script tag\n * @param {Array} tags features tags list\n */\n Bidi.prototype.registerFeatures = function (script, tags) {\n var this$1 = this\n\n var supportedTags = tags.filter(function (tag) {\n return this$1.query.supports({ script: script, tag: tag })\n })\n if (!this.featuresTags.hasOwnProperty(script)) {\n this.featuresTags[script] = supportedTags\n } else {\n this.featuresTags[script] = this.featuresTags[script].concat(supportedTags)\n }\n }\n\n /**\n * Apply GSUB features\n * @param {Array} tagsList a list of features tags\n * @param {string} script a script tag\n * @param {Font} font opentype font instance\n */\n Bidi.prototype.applyFeatures = function (font, features) {\n if (!font) {\n throw new Error('No valid font was provided to apply features')\n }\n if (!this.query) {\n this.query = new FeatureQuery(font)\n }\n for (var f = 0; f < features.length; f++) {\n var feature = features[f]\n if (!this.query.supports({ script: feature.script })) {\n continue\n }\n this.registerFeatures(feature.script, feature.tags)\n }\n }\n\n /**\n * Register a state modifier\n * @param {string} modifierId state modifier id\n * @param {function} condition a predicate function that returns true or false\n * @param {function} modifier a modifier function to set token state\n */\n Bidi.prototype.registerModifier = function (modifierId, condition, modifier) {\n this.tokenizer.registerModifier(modifierId, condition, modifier)\n }\n\n /**\n * Check if 'glyphIndex' is registered\n */\n function checkGlyphIndexStatus() {\n if (this.tokenizer.registeredModifiers.indexOf('glyphIndex') === -1) {\n throw new Error('glyphIndex modifier is required to apply ' + 'arabic presentation features.')\n }\n }\n\n /**\n * Apply arabic presentation forms features\n */\n function applyArabicPresentationForms() {\n var this$1 = this\n\n var script = 'arab'\n if (!this.featuresTags.hasOwnProperty(script)) {\n return\n }\n checkGlyphIndexStatus.call(this)\n var ranges = this.tokenizer.getContextRanges('arabicWord')\n ranges.forEach(function (range) {\n arabicPresentationForms.call(this$1, range)\n })\n }\n\n /**\n * Apply required arabic ligatures\n */\n function applyArabicRequireLigatures() {\n var this$1 = this\n\n var script = 'arab'\n if (!this.featuresTags.hasOwnProperty(script)) {\n return\n }\n var tags = this.featuresTags[script]\n if (tags.indexOf('rlig') === -1) {\n return\n }\n checkGlyphIndexStatus.call(this)\n var ranges = this.tokenizer.getContextRanges('arabicWord')\n ranges.forEach(function (range) {\n arabicRequiredLigatures.call(this$1, range)\n })\n }\n\n /**\n * Apply required arabic ligatures\n */\n function applyLatinLigatures() {\n var this$1 = this\n\n var script = 'latn'\n if (!this.featuresTags.hasOwnProperty(script)) {\n return\n }\n var tags = this.featuresTags[script]\n if (tags.indexOf('liga') === -1) {\n return\n }\n checkGlyphIndexStatus.call(this)\n var ranges = this.tokenizer.getContextRanges('latinWord')\n ranges.forEach(function (range) {\n latinLigature.call(this$1, range)\n })\n }\n\n /**\n * Check if a context is registered\n * @param {string} contextId context id\n */\n Bidi.prototype.checkContextReady = function (contextId) {\n return !!this.tokenizer.getContext(contextId)\n }\n\n /**\n * Apply features to registered contexts\n */\n Bidi.prototype.applyFeaturesToContexts = function () {\n if (this.checkContextReady('arabicWord')) {\n applyArabicPresentationForms.call(this)\n applyArabicRequireLigatures.call(this)\n }\n if (this.checkContextReady('latinWord')) {\n applyLatinLigatures.call(this)\n }\n if (this.checkContextReady('arabicSentence')) {\n reverseArabicSentences.call(this)\n }\n }\n\n /**\n * process text input\n * @param {string} text an input text\n */\n Bidi.prototype.processText = function (text) {\n if (!this.text || this.text !== text) {\n this.setText(text)\n tokenizeText.call(this)\n this.applyFeaturesToContexts()\n }\n }\n\n /**\n * Process a string of text to identify and adjust\n * bidirectional text entities.\n * @param {string} text input text\n */\n Bidi.prototype.getBidiText = function (text) {\n this.processText(text)\n return this.tokenizer.getText()\n }\n\n /**\n * Get the current state index of each token\n * @param {text} text an input text\n */\n Bidi.prototype.getTextGlyphs = function (text) {\n this.processText(text)\n var indexes = []\n for (var i = 0; i < this.tokenizer.tokens.length; i++) {\n var token = this.tokenizer.tokens[i]\n if (token.state.deleted) {\n continue\n }\n var index = token.activeState.value\n indexes.push(Array.isArray(index) ? index[0] : index)\n }\n return indexes\n }\n\n // The Font object\n\n /**\n * @typedef FontOptions\n * @type Object\n * @property {Boolean} empty - whether to create a new empty font\n * @property {string} familyName\n * @property {string} styleName\n * @property {string=} fullName\n * @property {string=} postScriptName\n * @property {string=} designer\n * @property {string=} designerURL\n * @property {string=} manufacturer\n * @property {string=} manufacturerURL\n * @property {string=} license\n * @property {string=} licenseURL\n * @property {string=} version\n * @property {string=} description\n * @property {string=} copyright\n * @property {string=} trademark\n * @property {Number} unitsPerEm\n * @property {Number} ascender\n * @property {Number} descender\n * @property {Number} createdTimestamp\n * @property {string=} weightClass\n * @property {string=} widthClass\n * @property {string=} fsSelection\n */\n\n /**\n * A Font represents a loaded OpenType font file.\n * It contains a set of glyphs and methods to draw text on a drawing context,\n * or to get a path representing the text.\n * @exports opentype.Font\n * @class\n * @param {FontOptions}\n * @constructor\n */\n function Font(options) {\n options = options || {}\n options.tables = options.tables || {}\n\n if (!options.empty) {\n // Check that we've provided the minimum set of names.\n checkArgument(options.familyName, 'When creating a new Font object, familyName is required.')\n checkArgument(options.styleName, 'When creating a new Font object, styleName is required.')\n checkArgument(options.unitsPerEm, 'When creating a new Font object, unitsPerEm is required.')\n checkArgument(options.ascender, 'When creating a new Font object, ascender is required.')\n checkArgument(options.descender <= 0, 'When creating a new Font object, negative descender value is required.')\n\n // OS X will complain if the names are empty, so we put a single space everywhere by default.\n this.names = {\n fontFamily: { en: options.familyName || ' ' },\n fontSubfamily: { en: options.styleName || ' ' },\n fullName: { en: options.fullName || options.familyName + ' ' + options.styleName },\n // postScriptName may not contain any whitespace\n postScriptName: { en: options.postScriptName || (options.familyName + options.styleName).replace(/\\s/g, '') },\n designer: { en: options.designer || ' ' },\n designerURL: { en: options.designerURL || ' ' },\n manufacturer: { en: options.manufacturer || ' ' },\n manufacturerURL: { en: options.manufacturerURL || ' ' },\n license: { en: options.license || ' ' },\n licenseURL: { en: options.licenseURL || ' ' },\n version: { en: options.version || 'Version 0.1' },\n description: { en: options.description || ' ' },\n copyright: { en: options.copyright || ' ' },\n trademark: { en: options.trademark || ' ' },\n }\n this.unitsPerEm = options.unitsPerEm || 1000\n this.ascender = options.ascender\n this.descender = options.descender\n this.createdTimestamp = options.createdTimestamp\n this.tables = Object.assign(options.tables, {\n os2: Object.assign(\n {\n usWeightClass: options.weightClass || this.usWeightClasses.MEDIUM,\n usWidthClass: options.widthClass || this.usWidthClasses.MEDIUM,\n fsSelection: options.fsSelection || this.fsSelectionValues.REGULAR,\n },\n options.tables.os2,\n ),\n })\n }\n\n this.supported = true // Deprecated: parseBuffer will throw an error if font is not supported.\n this.glyphs = new glyphset.GlyphSet(this, options.glyphs || [])\n this.encoding = new DefaultEncoding(this)\n this.position = new Position(this)\n this.substitution = new Substitution(this)\n this.tables = this.tables || {}\n\n // needed for low memory mode only.\n this._push = null\n this._hmtxTableData = {}\n\n Object.defineProperty(this, 'hinting', {\n get: function () {\n if (this._hinting) {\n return this._hinting\n }\n if (this.outlinesFormat === 'truetype') {\n return (this._hinting = new Hinting(this))\n }\n },\n })\n }\n\n /**\n * Check if the font has a glyph for the given character.\n * @param {string}\n * @return {Boolean}\n */\n Font.prototype.hasChar = function (c) {\n return this.encoding.charToGlyphIndex(c) !== null\n }\n\n /**\n * Convert the given character to a single glyph index.\n * Note that this function assumes that there is a one-to-one mapping between\n * the given character and a glyph; for complex scripts this might not be the case.\n * @param {string}\n * @return {Number}\n */\n Font.prototype.charToGlyphIndex = function (s) {\n return this.encoding.charToGlyphIndex(s)\n }\n\n /**\n * Convert the given character to a single Glyph object.\n * Note that this function assumes that there is a one-to-one mapping between\n * the given character and a glyph; for complex scripts this might not be the case.\n * @param {string}\n * @return {opentype.Glyph}\n */\n Font.prototype.charToGlyph = function (c) {\n var glyphIndex = this.charToGlyphIndex(c)\n var glyph = this.glyphs.get(glyphIndex)\n if (!glyph) {\n // .notdef\n glyph = this.glyphs.get(0)\n }\n\n return glyph\n }\n\n /**\n * Update features\n * @param {any} options features options\n */\n Font.prototype.updateFeatures = function (options) {\n // TODO: update all features options not only 'latn'.\n return this.defaultRenderOptions.features.map(function (feature) {\n if (feature.script === 'latn') {\n return {\n script: 'latn',\n tags: feature.tags.filter(function (tag) {\n return options[tag]\n }),\n }\n } else {\n return feature\n }\n })\n }\n\n /**\n * Convert the given text to a list of Glyph objects.\n * Note that there is no strict one-to-one mapping between characters and\n * glyphs, so the list of returned glyphs can be larger or smaller than the\n * length of the given string.\n * @param {string}\n * @param {GlyphRenderOptions} [options]\n * @return {opentype.Glyph[]}\n */\n Font.prototype.stringToGlyphs = function (s, options) {\n var this$1 = this\n\n var bidi = new Bidi()\n\n // Create and register 'glyphIndex' state modifier\n var charToGlyphIndexMod = function (token) {\n return this$1.charToGlyphIndex(token.char)\n }\n bidi.registerModifier('glyphIndex', null, charToGlyphIndexMod)\n\n // roll-back to default features\n var features = options ? this.updateFeatures(options.features) : this.defaultRenderOptions.features\n\n bidi.applyFeatures(this, features)\n\n var indexes = bidi.getTextGlyphs(s)\n\n var length = indexes.length\n\n // convert glyph indexes to glyph objects\n var glyphs = new Array(length)\n var notdef = this.glyphs.get(0)\n for (var i = 0; i < length; i += 1) {\n glyphs[i] = this.glyphs.get(indexes[i]) || notdef\n }\n return glyphs\n }\n\n /**\n * @param {string}\n * @return {Number}\n */\n Font.prototype.nameToGlyphIndex = function (name) {\n return this.glyphNames.nameToGlyphIndex(name)\n }\n\n /**\n * @param {string}\n * @return {opentype.Glyph}\n */\n Font.prototype.nameToGlyph = function (name) {\n var glyphIndex = this.nameToGlyphIndex(name)\n var glyph = this.glyphs.get(glyphIndex)\n if (!glyph) {\n // .notdef\n glyph = this.glyphs.get(0)\n }\n\n return glyph\n }\n\n /**\n * @param {Number}\n * @return {String}\n */\n Font.prototype.glyphIndexToName = function (gid) {\n if (!this.glyphNames.glyphIndexToName) {\n return ''\n }\n\n return this.glyphNames.glyphIndexToName(gid)\n }\n\n /**\n * Retrieve the value of the kerning pair between the left glyph (or its index)\n * and the right glyph (or its index). If no kerning pair is found, return 0.\n * The kerning value gets added to the advance width when calculating the spacing\n * between glyphs.\n * For GPOS kerning, this method uses the default script and language, which covers\n * most use cases. To have greater control, use font.position.getKerningValue .\n * @param {opentype.Glyph} leftGlyph\n * @param {opentype.Glyph} rightGlyph\n * @return {Number}\n */\n Font.prototype.getKerningValue = function (leftGlyph, rightGlyph) {\n leftGlyph = leftGlyph.index || leftGlyph\n rightGlyph = rightGlyph.index || rightGlyph\n var gposKerning = this.position.defaultKerningTables\n if (gposKerning) {\n return this.position.getKerningValue(gposKerning, leftGlyph, rightGlyph)\n }\n // \"kern\" table\n return this.kerningPairs[leftGlyph + ',' + rightGlyph] || 0\n }\n\n /**\n * @typedef GlyphRenderOptions\n * @type Object\n * @property {string} [script] - script used to determine which features to apply. By default, 'DFLT' or 'latn' is used.\n * See https://www.microsoft.com/typography/otspec/scripttags.htm\n * @property {string} [language='dflt'] - language system used to determine which features to apply.\n * See https://www.microsoft.com/typography/developers/opentype/languagetags.aspx\n * @property {boolean} [kerning=true] - whether to include kerning values\n * @property {object} [features] - OpenType Layout feature tags. Used to enable or disable the features of the given script/language system.\n * See https://www.microsoft.com/typography/otspec/featuretags.htm\n */\n Font.prototype.defaultRenderOptions = {\n kerning: true,\n features: [\n /**\n * these 4 features are required to render Arabic text properly\n * and shouldn't be turned off when rendering arabic text.\n */\n { script: 'arab', tags: ['init', 'medi', 'fina', 'rlig'] },\n { script: 'latn', tags: ['liga', 'rlig'] },\n ],\n }\n\n /**\n * Helper function that invokes the given callback for each glyph in the given text.\n * The callback gets `(glyph, x, y, fontSize, options)`.* @param {string} text\n * @param {string} text - The text to apply.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @param {Function} callback\n */\n Font.prototype.forEachGlyph = function (text, x, y, fontSize, options, callback) {\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 72\n options = Object.assign({}, this.defaultRenderOptions, options)\n var fontScale = (1 / this.unitsPerEm) * fontSize\n var glyphs = this.stringToGlyphs(text, options)\n var kerningLookups\n if (options.kerning) {\n var script = options.script || this.position.getDefaultScriptName()\n kerningLookups = this.position.getKerningTables(script, options.language)\n }\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs[i]\n callback.call(this, glyph, x, y, fontSize, options)\n if (glyph.advanceWidth) {\n x += glyph.advanceWidth * fontScale\n }\n\n if (options.kerning && i < glyphs.length - 1) {\n // We should apply position adjustment lookups in a more generic way.\n // Here we only use the xAdvance value.\n var kerningValue = kerningLookups\n ? this.position.getKerningValue(kerningLookups, glyph.index, glyphs[i + 1].index)\n : this.getKerningValue(glyph, glyphs[i + 1])\n x += kerningValue * fontScale\n }\n\n if (options.letterSpacing) {\n x += options.letterSpacing * fontSize\n } else if (options.tracking) {\n x += (options.tracking / 1000) * fontSize\n }\n }\n return x\n }\n\n /**\n * Create a Path object that represents the given text.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @return {opentype.Path}\n */\n Font.prototype.getPath = function (text, x, y, fontSize, options) {\n var fullPath = new Path()\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n var glyphPath = glyph.getPath(gX, gY, gFontSize, options, this)\n fullPath.extend(glyphPath)\n })\n return fullPath\n }\n\n /**\n * Create an array of Path objects that represent the glyphs of a given text.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @return {opentype.Path[]}\n */\n Font.prototype.getPaths = function (text, x, y, fontSize, options) {\n var glyphPaths = []\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n var glyphPath = glyph.getPath(gX, gY, gFontSize, options, this)\n glyphPaths.push(glyphPath)\n })\n\n return glyphPaths\n }\n\n /**\n * Returns the advance width of a text.\n *\n * This is something different than Path.getBoundingBox() as for example a\n * suffixed whitespace increases the advanceWidth but not the bounding box\n * or an overhanging letter like a calligraphic 'f' might have a quite larger\n * bounding box than its advance width.\n *\n * This corresponds to canvas2dContext.measureText(text).width\n *\n * @param {string} text - The text to create.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @return advance width\n */\n Font.prototype.getAdvanceWidth = function (text, fontSize, options) {\n return this.forEachGlyph(text, 0, 0, fontSize, options, function () {})\n }\n\n /**\n * Draw the text on the given drawing context.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n */\n Font.prototype.draw = function (ctx, text, x, y, fontSize, options) {\n this.getPath(text, x, y, fontSize, options).draw(ctx)\n }\n\n /**\n * Draw the points of all glyphs in the text.\n * On-curve points will be drawn in blue, off-curve points will be drawn in red.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n */\n Font.prototype.drawPoints = function (ctx, text, x, y, fontSize, options) {\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n glyph.drawPoints(ctx, gX, gY, gFontSize)\n })\n }\n\n /**\n * Draw lines indicating important font measurements for all glyphs in the text.\n * Black lines indicate the origin of the coordinate system (point 0,0).\n * Blue lines indicate the glyph bounding box.\n * Green line indicates the advance width of the glyph.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n */\n Font.prototype.drawMetrics = function (ctx, text, x, y, fontSize, options) {\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n glyph.drawMetrics(ctx, gX, gY, gFontSize)\n })\n }\n\n /**\n * @param {string}\n * @return {string}\n */\n Font.prototype.getEnglishName = function (name) {\n var translations = this.names[name]\n if (translations) {\n return translations.en\n }\n }\n\n /**\n * Validate\n */\n Font.prototype.validate = function () {\n var _this = this\n\n function assert(predicate) {}\n\n function assertNamePresent(name) {\n var englishName = _this.getEnglishName(name)\n assert(englishName && englishName.trim().length > 0)\n }\n\n // Identification information\n assertNamePresent('fontFamily')\n assertNamePresent('weightName')\n assertNamePresent('manufacturer')\n assertNamePresent('copyright')\n assertNamePresent('version')\n\n // Dimension information\n assert(this.unitsPerEm > 0)\n }\n\n /**\n * Convert the font object to a SFNT data structure.\n * This structure contains all the necessary tables and metadata to create a binary OTF file.\n * @return {opentype.Table}\n */\n Font.prototype.toTables = function () {\n return sfnt.fontToTable(this)\n }\n /**\n * @deprecated Font.toBuffer is deprecated. Use Font.toArrayBuffer instead.\n */\n Font.prototype.toBuffer = function () {\n console.warn('Font.toBuffer is deprecated. Use Font.toArrayBuffer instead.')\n return this.toArrayBuffer()\n }\n /**\n * Converts a `opentype.Font` into an `ArrayBuffer`\n * @return {ArrayBuffer}\n */\n Font.prototype.toArrayBuffer = function () {\n var sfntTable = this.toTables()\n var bytes = sfntTable.encode()\n var buffer = new ArrayBuffer(bytes.length)\n var intArray = new Uint8Array(buffer)\n for (var i = 0; i < bytes.length; i++) {\n intArray[i] = bytes[i]\n }\n\n return buffer\n }\n\n /**\n * @private\n */\n Font.prototype.fsSelectionValues = {\n ITALIC: 0x001, //1\n UNDERSCORE: 0x002, //2\n NEGATIVE: 0x004, //4\n OUTLINED: 0x008, //8\n STRIKEOUT: 0x010, //16\n BOLD: 0x020, //32\n REGULAR: 0x040, //64\n USER_TYPO_METRICS: 0x080, //128\n WWS: 0x100, //256\n OBLIQUE: 0x200, //512\n }\n\n /**\n * @private\n */\n Font.prototype.usWidthClasses = {\n ULTRA_CONDENSED: 1,\n EXTRA_CONDENSED: 2,\n CONDENSED: 3,\n SEMI_CONDENSED: 4,\n MEDIUM: 5,\n SEMI_EXPANDED: 6,\n EXPANDED: 7,\n EXTRA_EXPANDED: 8,\n ULTRA_EXPANDED: 9,\n }\n\n /**\n * @private\n */\n Font.prototype.usWeightClasses = {\n THIN: 100,\n EXTRA_LIGHT: 200,\n LIGHT: 300,\n NORMAL: 400,\n MEDIUM: 500,\n SEMI_BOLD: 600,\n BOLD: 700,\n EXTRA_BOLD: 800,\n BLACK: 900,\n }\n\n // The `fvar` table stores font variation axes and instances.\n\n function addName(name, names) {\n var nameString = JSON.stringify(name)\n var nameID = 256\n for (var nameKey in names) {\n var n = parseInt(nameKey)\n if (!n || n < 256) {\n continue\n }\n\n if (JSON.stringify(names[nameKey]) === nameString) {\n return n\n }\n\n if (nameID <= n) {\n nameID = n + 1\n }\n }\n\n names[nameID] = name\n return nameID\n }\n\n function makeFvarAxis(n, axis, names) {\n var nameID = addName(axis.name, names)\n return [\n { name: 'tag_' + n, type: 'TAG', value: axis.tag },\n { name: 'minValue_' + n, type: 'FIXED', value: axis.minValue << 16 },\n { name: 'defaultValue_' + n, type: 'FIXED', value: axis.defaultValue << 16 },\n { name: 'maxValue_' + n, type: 'FIXED', value: axis.maxValue << 16 },\n { name: 'flags_' + n, type: 'USHORT', value: 0 },\n { name: 'nameID_' + n, type: 'USHORT', value: nameID },\n ]\n }\n\n function parseFvarAxis(data, start, names) {\n var axis = {}\n var p = new parse.Parser(data, start)\n axis.tag = p.parseTag()\n axis.minValue = p.parseFixed()\n axis.defaultValue = p.parseFixed()\n axis.maxValue = p.parseFixed()\n p.skip('uShort', 1) // reserved for flags; no values defined\n axis.name = names[p.parseUShort()] || {}\n return axis\n }\n\n function makeFvarInstance(n, inst, axes, names) {\n var nameID = addName(inst.name, names)\n var fields = [\n { name: 'nameID_' + n, type: 'USHORT', value: nameID },\n { name: 'flags_' + n, type: 'USHORT', value: 0 },\n ]\n\n for (var i = 0; i < axes.length; ++i) {\n var axisTag = axes[i].tag\n fields.push({\n name: 'axis_' + n + ' ' + axisTag,\n type: 'FIXED',\n value: inst.coordinates[axisTag] << 16,\n })\n }\n\n return fields\n }\n\n function parseFvarInstance(data, start, axes, names) {\n var inst = {}\n var p = new parse.Parser(data, start)\n inst.name = names[p.parseUShort()] || {}\n p.skip('uShort', 1) // reserved for flags; no values defined\n\n inst.coordinates = {}\n for (var i = 0; i < axes.length; ++i) {\n inst.coordinates[axes[i].tag] = p.parseFixed()\n }\n\n return inst\n }\n\n function makeFvarTable(fvar, names) {\n var result = new table.Table('fvar', [\n { name: 'version', type: 'ULONG', value: 0x10000 },\n { name: 'offsetToData', type: 'USHORT', value: 0 },\n { name: 'countSizePairs', type: 'USHORT', value: 2 },\n { name: 'axisCount', type: 'USHORT', value: fvar.axes.length },\n { name: 'axisSize', type: 'USHORT', value: 20 },\n { name: 'instanceCount', type: 'USHORT', value: fvar.instances.length },\n { name: 'instanceSize', type: 'USHORT', value: 4 + fvar.axes.length * 4 },\n ])\n result.offsetToData = result.sizeOf()\n\n for (var i = 0; i < fvar.axes.length; i++) {\n result.fields = result.fields.concat(makeFvarAxis(i, fvar.axes[i], names))\n }\n\n for (var j = 0; j < fvar.instances.length; j++) {\n result.fields = result.fields.concat(makeFvarInstance(j, fvar.instances[j], fvar.axes, names))\n }\n\n return result\n }\n\n function parseFvarTable(data, start, names) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseULong()\n check.argument(tableVersion === 0x00010000, 'Unsupported fvar table version.')\n var offsetToData = p.parseOffset16()\n // Skip countSizePairs.\n p.skip('uShort', 1)\n var axisCount = p.parseUShort()\n var axisSize = p.parseUShort()\n var instanceCount = p.parseUShort()\n var instanceSize = p.parseUShort()\n\n var axes = []\n for (var i = 0; i < axisCount; i++) {\n axes.push(parseFvarAxis(data, start + offsetToData + i * axisSize, names))\n }\n\n var instances = []\n var instanceStart = start + offsetToData + axisCount * axisSize\n for (var j = 0; j < instanceCount; j++) {\n instances.push(parseFvarInstance(data, instanceStart + j * instanceSize, axes, names))\n }\n\n return { axes: axes, instances: instances }\n }\n\n var fvar = { make: makeFvarTable, parse: parseFvarTable }\n\n // The `GDEF` table contains various glyph properties\n\n var attachList = function () {\n return {\n coverage: this.parsePointer(Parser.coverage),\n attachPoints: this.parseList(Parser.pointer(Parser.uShortList)),\n }\n }\n\n var caretValue = function () {\n var format = this.parseUShort()\n check.argument(format === 1 || format === 2 || format === 3, 'Unsupported CaretValue table version.')\n if (format === 1) {\n return { coordinate: this.parseShort() }\n } else if (format === 2) {\n return { pointindex: this.parseShort() }\n } else if (format === 3) {\n // Device / Variation Index tables unsupported\n return { coordinate: this.parseShort() }\n }\n }\n\n var ligGlyph = function () {\n return this.parseList(Parser.pointer(caretValue))\n }\n\n var ligCaretList = function () {\n return {\n coverage: this.parsePointer(Parser.coverage),\n ligGlyphs: this.parseList(Parser.pointer(ligGlyph)),\n }\n }\n\n var markGlyphSets = function () {\n this.parseUShort() // Version\n return this.parseList(Parser.pointer(Parser.coverage))\n }\n\n function parseGDEFTable(data, start) {\n start = start || 0\n var p = new Parser(data, start)\n var tableVersion = p.parseVersion(1)\n check.argument(\n tableVersion === 1 || tableVersion === 1.2 || tableVersion === 1.3,\n 'Unsupported GDEF table version.',\n )\n var gdef = {\n version: tableVersion,\n classDef: p.parsePointer(Parser.classDef),\n attachList: p.parsePointer(attachList),\n ligCaretList: p.parsePointer(ligCaretList),\n markAttachClassDef: p.parsePointer(Parser.classDef),\n }\n if (tableVersion >= 1.2) {\n gdef.markGlyphSets = p.parsePointer(markGlyphSets)\n }\n return gdef\n }\n var gdef = { parse: parseGDEFTable }\n\n // The `GPOS` table contains kerning pairs, among other things.\n\n var subtableParsers$1 = new Array(10) // subtableParsers[0] is unused\n\n // https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-1-single-adjustment-positioning-subtable\n // this = Parser instance\n subtableParsers$1[1] = function parseLookup1() {\n var start = this.offset + this.relativeOffset\n var posformat = this.parseUShort()\n if (posformat === 1) {\n return {\n posFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n value: this.parseValueRecord(),\n }\n } else if (posformat === 2) {\n return {\n posFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n values: this.parseValueRecordList(),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': GPOS lookup type 1 format must be 1 or 2.')\n }\n\n // https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-2-pair-adjustment-positioning-subtable\n subtableParsers$1[2] = function parseLookup2() {\n var start = this.offset + this.relativeOffset\n var posFormat = this.parseUShort()\n check.assert(\n posFormat === 1 || posFormat === 2,\n '0x' + start.toString(16) + ': GPOS lookup type 2 format must be 1 or 2.',\n )\n var coverage = this.parsePointer(Parser.coverage)\n var valueFormat1 = this.parseUShort()\n var valueFormat2 = this.parseUShort()\n if (posFormat === 1) {\n // Adjustments for Glyph Pairs\n return {\n posFormat: posFormat,\n coverage: coverage,\n valueFormat1: valueFormat1,\n valueFormat2: valueFormat2,\n pairSets: this.parseList(\n Parser.pointer(\n Parser.list(function () {\n return {\n // pairValueRecord\n secondGlyph: this.parseUShort(),\n value1: this.parseValueRecord(valueFormat1),\n value2: this.parseValueRecord(valueFormat2),\n }\n }),\n ),\n ),\n }\n } else if (posFormat === 2) {\n var classDef1 = this.parsePointer(Parser.classDef)\n var classDef2 = this.parsePointer(Parser.classDef)\n var class1Count = this.parseUShort()\n var class2Count = this.parseUShort()\n return {\n // Class Pair Adjustment\n posFormat: posFormat,\n coverage: coverage,\n valueFormat1: valueFormat1,\n valueFormat2: valueFormat2,\n classDef1: classDef1,\n classDef2: classDef2,\n class1Count: class1Count,\n class2Count: class2Count,\n classRecords: this.parseList(\n class1Count,\n Parser.list(class2Count, function () {\n return {\n value1: this.parseValueRecord(valueFormat1),\n value2: this.parseValueRecord(valueFormat2),\n }\n }),\n ),\n }\n }\n }\n\n subtableParsers$1[3] = function parseLookup3() {\n return { error: 'GPOS Lookup 3 not supported' }\n }\n subtableParsers$1[4] = function parseLookup4() {\n return { error: 'GPOS Lookup 4 not supported' }\n }\n subtableParsers$1[5] = function parseLookup5() {\n return { error: 'GPOS Lookup 5 not supported' }\n }\n subtableParsers$1[6] = function parseLookup6() {\n return { error: 'GPOS Lookup 6 not supported' }\n }\n subtableParsers$1[7] = function parseLookup7() {\n return { error: 'GPOS Lookup 7 not supported' }\n }\n subtableParsers$1[8] = function parseLookup8() {\n return { error: 'GPOS Lookup 8 not supported' }\n }\n subtableParsers$1[9] = function parseLookup9() {\n return { error: 'GPOS Lookup 9 not supported' }\n }\n\n // https://docs.microsoft.com/en-us/typography/opentype/spec/gpos\n function parseGposTable(data, start) {\n start = start || 0\n var p = new Parser(data, start)\n var tableVersion = p.parseVersion(1)\n check.argument(tableVersion === 1 || tableVersion === 1.1, 'Unsupported GPOS table version ' + tableVersion)\n\n if (tableVersion === 1) {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers$1),\n }\n } else {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers$1),\n variations: p.parseFeatureVariationsList(),\n }\n }\n }\n\n // GPOS Writing //////////////////////////////////////////////\n // NOT SUPPORTED\n var subtableMakers$1 = new Array(10)\n\n function makeGposTable(gpos) {\n return new table.Table('GPOS', [\n { name: 'version', type: 'ULONG', value: 0x10000 },\n { name: 'scripts', type: 'TABLE', value: new table.ScriptList(gpos.scripts) },\n { name: 'features', type: 'TABLE', value: new table.FeatureList(gpos.features) },\n { name: 'lookups', type: 'TABLE', value: new table.LookupList(gpos.lookups, subtableMakers$1) },\n ])\n }\n\n var gpos = { parse: parseGposTable, make: makeGposTable }\n\n // The `kern` table contains kerning pairs.\n\n function parseWindowsKernTable(p) {\n var pairs = {}\n // Skip nTables.\n p.skip('uShort')\n var subtableVersion = p.parseUShort()\n check.argument(subtableVersion === 0, 'Unsupported kern sub-table version.')\n // Skip subtableLength, subtableCoverage\n p.skip('uShort', 2)\n var nPairs = p.parseUShort()\n // Skip searchRange, entrySelector, rangeShift.\n p.skip('uShort', 3)\n for (var i = 0; i < nPairs; i += 1) {\n var leftIndex = p.parseUShort()\n var rightIndex = p.parseUShort()\n var value = p.parseShort()\n pairs[leftIndex + ',' + rightIndex] = value\n }\n return pairs\n }\n\n function parseMacKernTable(p) {\n var pairs = {}\n // The Mac kern table stores the version as a fixed (32 bits) but we only loaded the first 16 bits.\n // Skip the rest.\n p.skip('uShort')\n var nTables = p.parseULong()\n //check.argument(nTables === 1, 'Only 1 subtable is supported (got ' + nTables + ').');\n if (nTables > 1) {\n console.warn('Only the first kern subtable is supported.')\n }\n p.skip('uLong')\n var coverage = p.parseUShort()\n var subtableVersion = coverage & 0xff\n p.skip('uShort')\n if (subtableVersion === 0) {\n var nPairs = p.parseUShort()\n // Skip searchRange, entrySelector, rangeShift.\n p.skip('uShort', 3)\n for (var i = 0; i < nPairs; i += 1) {\n var leftIndex = p.parseUShort()\n var rightIndex = p.parseUShort()\n var value = p.parseShort()\n pairs[leftIndex + ',' + rightIndex] = value\n }\n }\n return pairs\n }\n\n // Parse the `kern` table which contains kerning pairs.\n function parseKernTable(data, start) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseUShort()\n if (tableVersion === 0) {\n return parseWindowsKernTable(p)\n } else if (tableVersion === 1) {\n return parseMacKernTable(p)\n } else {\n throw new Error('Unsupported kern table version (' + tableVersion + ').')\n }\n }\n\n var kern = { parse: parseKernTable }\n\n // The `loca` table stores the offsets to the locations of the glyphs in the font.\n\n // Parse the `loca` table. This table stores the offsets to the locations of the glyphs in the font,\n // relative to the beginning of the glyphData table.\n // The number of glyphs stored in the `loca` table is specified in the `maxp` table (under numGlyphs)\n // The loca table has two versions: a short version where offsets are stored as uShorts, and a long\n // version where offsets are stored as uLongs. The `head` table specifies which version to use\n // (under indexToLocFormat).\n function parseLocaTable(data, start, numGlyphs, shortVersion) {\n var p = new parse.Parser(data, start)\n var parseFn = shortVersion ? p.parseUShort : p.parseULong\n // There is an extra entry after the last index element to compute the length of the last glyph.\n // That's why we use numGlyphs + 1.\n var glyphOffsets = []\n for (var i = 0; i < numGlyphs + 1; i += 1) {\n var glyphOffset = parseFn.call(p)\n if (shortVersion) {\n // The short table version stores the actual offset divided by 2.\n glyphOffset *= 2\n }\n\n glyphOffsets.push(glyphOffset)\n }\n\n return glyphOffsets\n }\n\n var loca = { parse: parseLocaTable }\n\n // opentype.js\n\n // Table Directory Entries //////////////////////////////////////////////\n /**\n * Parses OpenType table entries.\n * @param {DataView}\n * @param {Number}\n * @return {Object[]}\n */\n function parseOpenTypeTableEntries(data, numTables) {\n var tableEntries = []\n var p = 12\n for (var i = 0; i < numTables; i += 1) {\n var tag = parse.getTag(data, p)\n var checksum = parse.getULong(data, p + 4)\n var offset = parse.getULong(data, p + 8)\n var length = parse.getULong(data, p + 12)\n tableEntries.push({ tag: tag, checksum: checksum, offset: offset, length: length, compression: false })\n p += 16\n }\n\n return tableEntries\n }\n\n /**\n * Parses WOFF table entries.\n * @param {DataView}\n * @param {Number}\n * @return {Object[]}\n */\n function parseWOFFTableEntries(data, numTables) {\n var tableEntries = []\n var p = 44 // offset to the first table directory entry.\n for (var i = 0; i < numTables; i += 1) {\n var tag = parse.getTag(data, p)\n var offset = parse.getULong(data, p + 4)\n var compLength = parse.getULong(data, p + 8)\n var origLength = parse.getULong(data, p + 12)\n var compression = void 0\n if (compLength < origLength) {\n compression = 'WOFF'\n } else {\n compression = false\n }\n\n tableEntries.push({\n tag: tag,\n offset: offset,\n compression: compression,\n compressedLength: compLength,\n length: origLength,\n })\n p += 20\n }\n\n return tableEntries\n }\n\n /**\n * @typedef TableData\n * @type Object\n * @property {DataView} data - The DataView\n * @property {number} offset - The data offset.\n */\n\n /**\n * @param {DataView}\n * @param {Object}\n * @return {TableData}\n */\n function uncompressTable(data, tableEntry) {\n if (tableEntry.compression === 'WOFF') {\n var inBuffer = new Uint8Array(data.buffer, tableEntry.offset + 2, tableEntry.compressedLength - 2)\n var outBuffer = new Uint8Array(tableEntry.length)\n tinyInflate(inBuffer, outBuffer)\n if (outBuffer.byteLength !== tableEntry.length) {\n throw new Error('Decompression error: ' + tableEntry.tag + \" decompressed length doesn't match recorded length\")\n }\n\n var view = new DataView(outBuffer.buffer, 0)\n return { data: view, offset: 0 }\n } else {\n return { data: data, offset: tableEntry.offset }\n }\n }\n\n // Public API ///////////////////////////////////////////////////////////\n\n /**\n * Parse the OpenType file data (as an ArrayBuffer) and return a Font object.\n * Throws an error if the font could not be parsed.\n * @param {ArrayBuffer}\n * @param {Object} opt - options for parsing\n * @return {opentype.Font}\n */\n function parseBuffer(buffer, opt) {\n opt = opt === undefined || opt === null ? {} : opt\n\n var indexToLocFormat\n var ltagTable\n\n // Since the constructor can also be called to create new fonts from scratch, we indicate this\n // should be an empty font that we'll fill with our own data.\n var font = new Font({ empty: true })\n\n // OpenType fonts use big endian byte ordering.\n // We can't rely on typed array view types, because they operate with the endianness of the host computer.\n // Instead we use DataViews where we can specify endianness.\n var data = new DataView(buffer, 0)\n var numTables\n var tableEntries = []\n var signature = parse.getTag(data, 0)\n if (signature === String.fromCharCode(0, 1, 0, 0) || signature === 'true' || signature === 'typ1') {\n font.outlinesFormat = 'truetype'\n numTables = parse.getUShort(data, 4)\n tableEntries = parseOpenTypeTableEntries(data, numTables)\n } else if (signature === 'OTTO') {\n font.outlinesFormat = 'cff'\n numTables = parse.getUShort(data, 4)\n tableEntries = parseOpenTypeTableEntries(data, numTables)\n } else if (signature === 'wOFF') {\n var flavor = parse.getTag(data, 4)\n if (flavor === String.fromCharCode(0, 1, 0, 0)) {\n font.outlinesFormat = 'truetype'\n } else if (flavor === 'OTTO') {\n font.outlinesFormat = 'cff'\n } else {\n throw new Error('Unsupported OpenType flavor ' + signature)\n }\n\n numTables = parse.getUShort(data, 12)\n tableEntries = parseWOFFTableEntries(data, numTables)\n } else {\n throw new Error('Unsupported OpenType signature ' + signature)\n }\n\n var cffTableEntry\n var fvarTableEntry\n var glyfTableEntry\n var gdefTableEntry\n var gposTableEntry\n var gsubTableEntry\n var hmtxTableEntry\n var kernTableEntry\n var locaTableEntry\n var nameTableEntry\n var metaTableEntry\n var p\n\n for (var i = 0; i < numTables; i += 1) {\n var tableEntry = tableEntries[i]\n var table = void 0\n switch (tableEntry.tag) {\n case 'cmap':\n table = uncompressTable(data, tableEntry)\n font.tables.cmap = cmap.parse(table.data, table.offset)\n font.encoding = new CmapEncoding(font.tables.cmap)\n break\n case 'cvt ':\n table = uncompressTable(data, tableEntry)\n p = new parse.Parser(table.data, table.offset)\n font.tables.cvt = p.parseShortList(tableEntry.length / 2)\n break\n case 'fvar':\n fvarTableEntry = tableEntry\n break\n case 'fpgm':\n table = uncompressTable(data, tableEntry)\n p = new parse.Parser(table.data, table.offset)\n font.tables.fpgm = p.parseByteList(tableEntry.length)\n break\n case 'head':\n table = uncompressTable(data, tableEntry)\n font.tables.head = head.parse(table.data, table.offset)\n font.unitsPerEm = font.tables.head.unitsPerEm\n indexToLocFormat = font.tables.head.indexToLocFormat\n break\n case 'hhea':\n table = uncompressTable(data, tableEntry)\n font.tables.hhea = hhea.parse(table.data, table.offset)\n font.ascender = font.tables.hhea.ascender\n font.descender = font.tables.hhea.descender\n font.numberOfHMetrics = font.tables.hhea.numberOfHMetrics\n break\n case 'hmtx':\n hmtxTableEntry = tableEntry\n break\n case 'ltag':\n table = uncompressTable(data, tableEntry)\n ltagTable = ltag.parse(table.data, table.offset)\n break\n case 'maxp':\n table = uncompressTable(data, tableEntry)\n font.tables.maxp = maxp.parse(table.data, table.offset)\n font.numGlyphs = font.tables.maxp.numGlyphs\n break\n case 'name':\n nameTableEntry = tableEntry\n break\n case 'OS/2':\n table = uncompressTable(data, tableEntry)\n font.tables.os2 = os2.parse(table.data, table.offset)\n break\n case 'post':\n table = uncompressTable(data, tableEntry)\n font.tables.post = post.parse(table.data, table.offset)\n font.glyphNames = new GlyphNames(font.tables.post)\n break\n case 'prep':\n table = uncompressTable(data, tableEntry)\n p = new parse.Parser(table.data, table.offset)\n font.tables.prep = p.parseByteList(tableEntry.length)\n break\n case 'glyf':\n glyfTableEntry = tableEntry\n break\n case 'loca':\n locaTableEntry = tableEntry\n break\n case 'CFF ':\n cffTableEntry = tableEntry\n break\n case 'kern':\n kernTableEntry = tableEntry\n break\n case 'GDEF':\n gdefTableEntry = tableEntry\n break\n case 'GPOS':\n gposTableEntry = tableEntry\n break\n case 'GSUB':\n gsubTableEntry = tableEntry\n break\n case 'meta':\n metaTableEntry = tableEntry\n break\n }\n }\n\n var nameTable = uncompressTable(data, nameTableEntry)\n font.tables.name = _name.parse(nameTable.data, nameTable.offset, ltagTable)\n font.names = font.tables.name\n\n if (glyfTableEntry && locaTableEntry) {\n var shortVersion = indexToLocFormat === 0\n var locaTable = uncompressTable(data, locaTableEntry)\n var locaOffsets = loca.parse(locaTable.data, locaTable.offset, font.numGlyphs, shortVersion)\n var glyfTable = uncompressTable(data, glyfTableEntry)\n font.glyphs = glyf.parse(glyfTable.data, glyfTable.offset, locaOffsets, font, opt)\n } else if (cffTableEntry) {\n var cffTable = uncompressTable(data, cffTableEntry)\n cff.parse(cffTable.data, cffTable.offset, font, opt)\n } else {\n throw new Error(\"Font doesn't contain TrueType or CFF outlines.\")\n }\n\n var hmtxTable = uncompressTable(data, hmtxTableEntry)\n hmtx.parse(font, hmtxTable.data, hmtxTable.offset, font.numberOfHMetrics, font.numGlyphs, font.glyphs, opt)\n addGlyphNames(font, opt)\n\n if (kernTableEntry) {\n var kernTable = uncompressTable(data, kernTableEntry)\n font.kerningPairs = kern.parse(kernTable.data, kernTable.offset)\n } else {\n font.kerningPairs = {}\n }\n\n if (gdefTableEntry) {\n var gdefTable = uncompressTable(data, gdefTableEntry)\n font.tables.gdef = gdef.parse(gdefTable.data, gdefTable.offset)\n }\n\n if (gposTableEntry) {\n var gposTable = uncompressTable(data, gposTableEntry)\n font.tables.gpos = gpos.parse(gposTable.data, gposTable.offset)\n font.position.init()\n }\n\n if (gsubTableEntry) {\n var gsubTable = uncompressTable(data, gsubTableEntry)\n font.tables.gsub = gsub.parse(gsubTable.data, gsubTable.offset)\n }\n\n if (fvarTableEntry) {\n var fvarTable = uncompressTable(data, fvarTableEntry)\n font.tables.fvar = fvar.parse(fvarTable.data, fvarTable.offset, font.names)\n }\n\n if (metaTableEntry) {\n var metaTable = uncompressTable(data, metaTableEntry)\n font.tables.meta = meta.parse(metaTable.data, metaTable.offset)\n font.metas = font.tables.meta\n }\n\n return font\n }\n\n return { parseBuffer }\n})()\n\nexport { parseBuffer as parse }\n", "import {\n Texture,\n DataTextureLoader,\n DataUtils,\n FloatType,\n HalfFloatType,\n LinearFilter,\n RedFormat,\n RGBAFormat,\n} from 'three'\nimport { unzlibSync } from 'fflate'\n\n/**\n * OpenEXR loader currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression.\n * Supports reading as UnsignedByte, HalfFloat and Float type data texture.\n *\n * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita\n * implementation, so I have preserved their copyright notices.\n */\n\n// /*\n// Copyright (c) 2014 - 2017, Syoyo Fujita\n// All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n// * Neither the name of the Syoyo Fujita nor the\n// names of its contributors may be used to endorse or promote products\n// derived from this software without specific prior written permission.\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n// DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n// */\n\n// // TinyEXR contains some OpenEXR code, which is licensed under ------------\n\n// ///////////////////////////////////////////////////////////////////////////\n// //\n// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas\n// // Digital Ltd. LLC\n// //\n// // All rights reserved.\n// //\n// // Redistribution and use in source and binary forms, with or without\n// // modification, are permitted provided that the following conditions are\n// // met:\n// // * Redistributions of source code must retain the above copyright\n// // notice, this list of conditions and the following disclaimer.\n// // * Redistributions in binary form must reproduce the above\n// // copyright notice, this list of conditions and the following disclaimer\n// // in the documentation and/or other materials provided with the\n// // distribution.\n// // * Neither the name of Industrial Light & Magic nor the names of\n// // its contributors may be used to endorse or promote products derived\n// // from this software without specific prior written permission.\n// //\n// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n// //\n// ///////////////////////////////////////////////////////////////////////////\n\n// // End of OpenEXR license -------------------------------------------------\n\nconst hasColorSpace = 'colorSpace' in new Texture()\n\nclass EXRLoader extends DataTextureLoader {\n constructor(manager) {\n super(manager)\n\n this.type = HalfFloatType\n }\n\n parse(buffer) {\n const USHORT_RANGE = 1 << 16\n const BITMAP_SIZE = USHORT_RANGE >> 3\n\n const HUF_ENCBITS = 16 // literal (value) bit length\n const HUF_DECBITS = 14 // decoding bit size (>= 8)\n\n const HUF_ENCSIZE = (1 << HUF_ENCBITS) + 1 // encoding table size\n const HUF_DECSIZE = 1 << HUF_DECBITS // decoding table size\n const HUF_DECMASK = HUF_DECSIZE - 1\n\n const NBITS = 16\n const A_OFFSET = 1 << (NBITS - 1)\n const MOD_MASK = (1 << NBITS) - 1\n\n const SHORT_ZEROCODE_RUN = 59\n const LONG_ZEROCODE_RUN = 63\n const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN\n\n const ULONG_SIZE = 8\n const FLOAT32_SIZE = 4\n const INT32_SIZE = 4\n const INT16_SIZE = 2\n const INT8_SIZE = 1\n\n const STATIC_HUFFMAN = 0\n const DEFLATE = 1\n\n const UNKNOWN = 0\n const LOSSY_DCT = 1\n const RLE = 2\n\n const logBase = Math.pow(2.7182818, 2.2)\n\n function reverseLutFromBitmap(bitmap, lut) {\n var k = 0\n\n for (var i = 0; i < USHORT_RANGE; ++i) {\n if (i == 0 || bitmap[i >> 3] & (1 << (i & 7))) {\n lut[k++] = i\n }\n }\n\n var n = k - 1\n\n while (k < USHORT_RANGE) lut[k++] = 0\n\n return n\n }\n\n function hufClearDecTable(hdec) {\n for (var i = 0; i < HUF_DECSIZE; i++) {\n hdec[i] = {}\n hdec[i].len = 0\n hdec[i].lit = 0\n hdec[i].p = null\n }\n }\n\n const getBitsReturn = { l: 0, c: 0, lc: 0 }\n\n function getBits(nBits, c, lc, uInt8Array, inOffset) {\n while (lc < nBits) {\n c = (c << 8) | parseUint8Array(uInt8Array, inOffset)\n lc += 8\n }\n\n lc -= nBits\n\n getBitsReturn.l = (c >> lc) & ((1 << nBits) - 1)\n getBitsReturn.c = c\n getBitsReturn.lc = lc\n }\n\n const hufTableBuffer = new Array(59)\n\n function hufCanonicalCodeTable(hcode) {\n for (var i = 0; i <= 58; ++i) hufTableBuffer[i] = 0\n for (var i = 0; i < HUF_ENCSIZE; ++i) hufTableBuffer[hcode[i]] += 1\n\n var c = 0\n\n for (var i = 58; i > 0; --i) {\n var nc = (c + hufTableBuffer[i]) >> 1\n hufTableBuffer[i] = c\n c = nc\n }\n\n for (var i = 0; i < HUF_ENCSIZE; ++i) {\n var l = hcode[i]\n if (l > 0) hcode[i] = l | (hufTableBuffer[l]++ << 6)\n }\n }\n\n function hufUnpackEncTable(uInt8Array, inDataView, inOffset, ni, im, iM, hcode) {\n var p = inOffset\n var c = 0\n var lc = 0\n\n for (; im <= iM; im++) {\n if (p.value - inOffset.value > ni) return false\n\n getBits(6, c, lc, uInt8Array, p)\n\n var l = getBitsReturn.l\n c = getBitsReturn.c\n lc = getBitsReturn.lc\n\n hcode[im] = l\n\n if (l == LONG_ZEROCODE_RUN) {\n if (p.value - inOffset.value > ni) {\n throw 'Something wrong with hufUnpackEncTable'\n }\n\n getBits(8, c, lc, uInt8Array, p)\n\n var zerun = getBitsReturn.l + SHORTEST_LONG_RUN\n c = getBitsReturn.c\n lc = getBitsReturn.lc\n\n if (im + zerun > iM + 1) {\n throw 'Something wrong with hufUnpackEncTable'\n }\n\n while (zerun--) hcode[im++] = 0\n\n im--\n } else if (l >= SHORT_ZEROCODE_RUN) {\n var zerun = l - SHORT_ZEROCODE_RUN + 2\n\n if (im + zerun > iM + 1) {\n throw 'Something wrong with hufUnpackEncTable'\n }\n\n while (zerun--) hcode[im++] = 0\n\n im--\n }\n }\n\n hufCanonicalCodeTable(hcode)\n }\n\n function hufLength(code) {\n return code & 63\n }\n\n function hufCode(code) {\n return code >> 6\n }\n\n function hufBuildDecTable(hcode, im, iM, hdecod) {\n for (; im <= iM; im++) {\n var c = hufCode(hcode[im])\n var l = hufLength(hcode[im])\n\n if (c >> l) {\n throw 'Invalid table entry'\n }\n\n if (l > HUF_DECBITS) {\n var pl = hdecod[c >> (l - HUF_DECBITS)]\n\n if (pl.len) {\n throw 'Invalid table entry'\n }\n\n pl.lit++\n\n if (pl.p) {\n var p = pl.p\n pl.p = new Array(pl.lit)\n\n for (var i = 0; i < pl.lit - 1; ++i) {\n pl.p[i] = p[i]\n }\n } else {\n pl.p = new Array(1)\n }\n\n pl.p[pl.lit - 1] = im\n } else if (l) {\n var plOffset = 0\n\n for (var i = 1 << (HUF_DECBITS - l); i > 0; i--) {\n var pl = hdecod[(c << (HUF_DECBITS - l)) + plOffset]\n\n if (pl.len || pl.p) {\n throw 'Invalid table entry'\n }\n\n pl.len = l\n pl.lit = im\n\n plOffset++\n }\n }\n }\n\n return true\n }\n\n const getCharReturn = { c: 0, lc: 0 }\n\n function getChar(c, lc, uInt8Array, inOffset) {\n c = (c << 8) | parseUint8Array(uInt8Array, inOffset)\n lc += 8\n\n getCharReturn.c = c\n getCharReturn.lc = lc\n }\n\n const getCodeReturn = { c: 0, lc: 0 }\n\n function getCode(po, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outBufferOffset, outBufferEndOffset) {\n if (po == rlc) {\n if (lc < 8) {\n getChar(c, lc, uInt8Array, inOffset)\n c = getCharReturn.c\n lc = getCharReturn.lc\n }\n\n lc -= 8\n\n var cs = c >> lc\n var cs = new Uint8Array([cs])[0]\n\n if (outBufferOffset.value + cs > outBufferEndOffset) {\n return false\n }\n\n var s = outBuffer[outBufferOffset.value - 1]\n\n while (cs-- > 0) {\n outBuffer[outBufferOffset.value++] = s\n }\n } else if (outBufferOffset.value < outBufferEndOffset) {\n outBuffer[outBufferOffset.value++] = po\n } else {\n return false\n }\n\n getCodeReturn.c = c\n getCodeReturn.lc = lc\n }\n\n function UInt16(value) {\n return value & 0xffff\n }\n\n function Int16(value) {\n var ref = UInt16(value)\n return ref > 0x7fff ? ref - 0x10000 : ref\n }\n\n const wdec14Return = { a: 0, b: 0 }\n\n function wdec14(l, h) {\n var ls = Int16(l)\n var hs = Int16(h)\n\n var hi = hs\n var ai = ls + (hi & 1) + (hi >> 1)\n\n var as = ai\n var bs = ai - hi\n\n wdec14Return.a = as\n wdec14Return.b = bs\n }\n\n function wdec16(l, h) {\n var m = UInt16(l)\n var d = UInt16(h)\n\n var bb = (m - (d >> 1)) & MOD_MASK\n var aa = (d + bb - A_OFFSET) & MOD_MASK\n\n wdec14Return.a = aa\n wdec14Return.b = bb\n }\n\n function wav2Decode(buffer, j, nx, ox, ny, oy, mx) {\n var w14 = mx < 1 << 14\n var n = nx > ny ? ny : nx\n var p = 1\n var p2\n\n while (p <= n) p <<= 1\n\n p >>= 1\n p2 = p\n p >>= 1\n\n while (p >= 1) {\n var py = 0\n var ey = py + oy * (ny - p2)\n var oy1 = oy * p\n var oy2 = oy * p2\n var ox1 = ox * p\n var ox2 = ox * p2\n var i00, i01, i10, i11\n\n for (; py <= ey; py += oy2) {\n var px = py\n var ex = py + ox * (nx - p2)\n\n for (; px <= ex; px += ox2) {\n var p01 = px + ox1\n var p10 = px + oy1\n var p11 = p10 + ox1\n\n if (w14) {\n wdec14(buffer[px + j], buffer[p10 + j])\n\n i00 = wdec14Return.a\n i10 = wdec14Return.b\n\n wdec14(buffer[p01 + j], buffer[p11 + j])\n\n i01 = wdec14Return.a\n i11 = wdec14Return.b\n\n wdec14(i00, i01)\n\n buffer[px + j] = wdec14Return.a\n buffer[p01 + j] = wdec14Return.b\n\n wdec14(i10, i11)\n\n buffer[p10 + j] = wdec14Return.a\n buffer[p11 + j] = wdec14Return.b\n } else {\n wdec16(buffer[px + j], buffer[p10 + j])\n\n i00 = wdec14Return.a\n i10 = wdec14Return.b\n\n wdec16(buffer[p01 + j], buffer[p11 + j])\n\n i01 = wdec14Return.a\n i11 = wdec14Return.b\n\n wdec16(i00, i01)\n\n buffer[px + j] = wdec14Return.a\n buffer[p01 + j] = wdec14Return.b\n\n wdec16(i10, i11)\n\n buffer[p10 + j] = wdec14Return.a\n buffer[p11 + j] = wdec14Return.b\n }\n }\n\n if (nx & p) {\n var p10 = px + oy1\n\n if (w14) wdec14(buffer[px + j], buffer[p10 + j])\n else wdec16(buffer[px + j], buffer[p10 + j])\n\n i00 = wdec14Return.a\n buffer[p10 + j] = wdec14Return.b\n\n buffer[px + j] = i00\n }\n }\n\n if (ny & p) {\n var px = py\n var ex = py + ox * (nx - p2)\n\n for (; px <= ex; px += ox2) {\n var p01 = px + ox1\n\n if (w14) wdec14(buffer[px + j], buffer[p01 + j])\n else wdec16(buffer[px + j], buffer[p01 + j])\n\n i00 = wdec14Return.a\n buffer[p01 + j] = wdec14Return.b\n\n buffer[px + j] = i00\n }\n }\n\n p2 = p\n p >>= 1\n }\n\n return py\n }\n\n function hufDecode(\n encodingTable,\n decodingTable,\n uInt8Array,\n inDataView,\n inOffset,\n ni,\n rlc,\n no,\n outBuffer,\n outOffset,\n ) {\n var c = 0\n var lc = 0\n var outBufferEndOffset = no\n var inOffsetEnd = Math.trunc(inOffset.value + (ni + 7) / 8)\n\n while (inOffset.value < inOffsetEnd) {\n getChar(c, lc, uInt8Array, inOffset)\n\n c = getCharReturn.c\n lc = getCharReturn.lc\n\n while (lc >= HUF_DECBITS) {\n var index = (c >> (lc - HUF_DECBITS)) & HUF_DECMASK\n var pl = decodingTable[index]\n\n if (pl.len) {\n lc -= pl.len\n\n getCode(pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset)\n\n c = getCodeReturn.c\n lc = getCodeReturn.lc\n } else {\n if (!pl.p) {\n throw 'hufDecode issues'\n }\n\n var j\n\n for (j = 0; j < pl.lit; j++) {\n var l = hufLength(encodingTable[pl.p[j]])\n\n while (lc < l && inOffset.value < inOffsetEnd) {\n getChar(c, lc, uInt8Array, inOffset)\n\n c = getCharReturn.c\n lc = getCharReturn.lc\n }\n\n if (lc >= l) {\n if (hufCode(encodingTable[pl.p[j]]) == ((c >> (lc - l)) & ((1 << l) - 1))) {\n lc -= l\n\n getCode(\n pl.p[j],\n rlc,\n c,\n lc,\n uInt8Array,\n inDataView,\n inOffset,\n outBuffer,\n outOffset,\n outBufferEndOffset,\n )\n\n c = getCodeReturn.c\n lc = getCodeReturn.lc\n\n break\n }\n }\n }\n\n if (j == pl.lit) {\n throw 'hufDecode issues'\n }\n }\n }\n }\n\n var i = (8 - ni) & 7\n\n c >>= i\n lc -= i\n\n while (lc > 0) {\n var pl = decodingTable[(c << (HUF_DECBITS - lc)) & HUF_DECMASK]\n\n if (pl.len) {\n lc -= pl.len\n\n getCode(pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset)\n\n c = getCodeReturn.c\n lc = getCodeReturn.lc\n } else {\n throw 'hufDecode issues'\n }\n }\n\n return true\n }\n\n function hufUncompress(uInt8Array, inDataView, inOffset, nCompressed, outBuffer, nRaw) {\n var outOffset = { value: 0 }\n var initialInOffset = inOffset.value\n\n var im = parseUint32(inDataView, inOffset)\n var iM = parseUint32(inDataView, inOffset)\n\n inOffset.value += 4\n\n var nBits = parseUint32(inDataView, inOffset)\n\n inOffset.value += 4\n\n if (im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE) {\n throw 'Something wrong with HUF_ENCSIZE'\n }\n\n var freq = new Array(HUF_ENCSIZE)\n var hdec = new Array(HUF_DECSIZE)\n\n hufClearDecTable(hdec)\n\n var ni = nCompressed - (inOffset.value - initialInOffset)\n\n hufUnpackEncTable(uInt8Array, inDataView, inOffset, ni, im, iM, freq)\n\n if (nBits > 8 * (nCompressed - (inOffset.value - initialInOffset))) {\n throw 'Something wrong with hufUncompress'\n }\n\n hufBuildDecTable(freq, im, iM, hdec)\n\n hufDecode(freq, hdec, uInt8Array, inDataView, inOffset, nBits, iM, nRaw, outBuffer, outOffset)\n }\n\n function applyLut(lut, data, nData) {\n for (var i = 0; i < nData; ++i) {\n data[i] = lut[data[i]]\n }\n }\n\n function predictor(source) {\n for (var t = 1; t < source.length; t++) {\n var d = source[t - 1] + source[t] - 128\n source[t] = d\n }\n }\n\n function interleaveScalar(source, out) {\n var t1 = 0\n var t2 = Math.floor((source.length + 1) / 2)\n var s = 0\n var stop = source.length - 1\n\n while (true) {\n if (s > stop) break\n out[s++] = source[t1++]\n\n if (s > stop) break\n out[s++] = source[t2++]\n }\n }\n\n function decodeRunLength(source) {\n var size = source.byteLength\n var out = new Array()\n var p = 0\n\n var reader = new DataView(source)\n\n while (size > 0) {\n var l = reader.getInt8(p++)\n\n if (l < 0) {\n var count = -l\n size -= count + 1\n\n for (var i = 0; i < count; i++) {\n out.push(reader.getUint8(p++))\n }\n } else {\n var count = l\n size -= 2\n\n var value = reader.getUint8(p++)\n\n for (var i = 0; i < count + 1; i++) {\n out.push(value)\n }\n }\n }\n\n return out\n }\n\n function lossyDctDecode(cscSet, rowPtrs, channelData, acBuffer, dcBuffer, outBuffer) {\n var dataView = new DataView(outBuffer.buffer)\n\n var width = channelData[cscSet.idx[0]].width\n var height = channelData[cscSet.idx[0]].height\n\n var numComp = 3\n\n var numFullBlocksX = Math.floor(width / 8.0)\n var numBlocksX = Math.ceil(width / 8.0)\n var numBlocksY = Math.ceil(height / 8.0)\n var leftoverX = width - (numBlocksX - 1) * 8\n var leftoverY = height - (numBlocksY - 1) * 8\n\n var currAcComp = { value: 0 }\n var currDcComp = new Array(numComp)\n var dctData = new Array(numComp)\n var halfZigBlock = new Array(numComp)\n var rowBlock = new Array(numComp)\n var rowOffsets = new Array(numComp)\n\n for (let comp = 0; comp < numComp; ++comp) {\n rowOffsets[comp] = rowPtrs[cscSet.idx[comp]]\n currDcComp[comp] = comp < 1 ? 0 : currDcComp[comp - 1] + numBlocksX * numBlocksY\n dctData[comp] = new Float32Array(64)\n halfZigBlock[comp] = new Uint16Array(64)\n rowBlock[comp] = new Uint16Array(numBlocksX * 64)\n }\n\n for (let blocky = 0; blocky < numBlocksY; ++blocky) {\n var maxY = 8\n\n if (blocky == numBlocksY - 1) maxY = leftoverY\n\n var maxX = 8\n\n for (let blockx = 0; blockx < numBlocksX; ++blockx) {\n if (blockx == numBlocksX - 1) maxX = leftoverX\n\n for (let comp = 0; comp < numComp; ++comp) {\n halfZigBlock[comp].fill(0)\n\n // set block DC component\n halfZigBlock[comp][0] = dcBuffer[currDcComp[comp]++]\n // set block AC components\n unRleAC(currAcComp, acBuffer, halfZigBlock[comp])\n\n // UnZigZag block to float\n unZigZag(halfZigBlock[comp], dctData[comp])\n // decode float dct\n dctInverse(dctData[comp])\n }\n\n if (numComp == 3) {\n csc709Inverse(dctData)\n }\n\n for (let comp = 0; comp < numComp; ++comp) {\n convertToHalf(dctData[comp], rowBlock[comp], blockx * 64)\n }\n } // blockx\n\n let offset = 0\n\n for (let comp = 0; comp < numComp; ++comp) {\n const type = channelData[cscSet.idx[comp]].type\n\n for (let y = 8 * blocky; y < 8 * blocky + maxY; ++y) {\n offset = rowOffsets[comp][y]\n\n for (let blockx = 0; blockx < numFullBlocksX; ++blockx) {\n const src = blockx * 64 + (y & 0x7) * 8\n\n dataView.setUint16(offset + 0 * INT16_SIZE * type, rowBlock[comp][src + 0], true)\n dataView.setUint16(offset + 1 * INT16_SIZE * type, rowBlock[comp][src + 1], true)\n dataView.setUint16(offset + 2 * INT16_SIZE * type, rowBlock[comp][src + 2], true)\n dataView.setUint16(offset + 3 * INT16_SIZE * type, rowBlock[comp][src + 3], true)\n\n dataView.setUint16(offset + 4 * INT16_SIZE * type, rowBlock[comp][src + 4], true)\n dataView.setUint16(offset + 5 * INT16_SIZE * type, rowBlock[comp][src + 5], true)\n dataView.setUint16(offset + 6 * INT16_SIZE * type, rowBlock[comp][src + 6], true)\n dataView.setUint16(offset + 7 * INT16_SIZE * type, rowBlock[comp][src + 7], true)\n\n offset += 8 * INT16_SIZE * type\n }\n }\n\n // handle partial X blocks\n if (numFullBlocksX != numBlocksX) {\n for (let y = 8 * blocky; y < 8 * blocky + maxY; ++y) {\n const offset = rowOffsets[comp][y] + 8 * numFullBlocksX * INT16_SIZE * type\n const src = numFullBlocksX * 64 + (y & 0x7) * 8\n\n for (let x = 0; x < maxX; ++x) {\n dataView.setUint16(offset + x * INT16_SIZE * type, rowBlock[comp][src + x], true)\n }\n }\n }\n } // comp\n } // blocky\n\n var halfRow = new Uint16Array(width)\n var dataView = new DataView(outBuffer.buffer)\n\n // convert channels back to float, if needed\n for (var comp = 0; comp < numComp; ++comp) {\n channelData[cscSet.idx[comp]].decoded = true\n var type = channelData[cscSet.idx[comp]].type\n\n if (channelData[comp].type != 2) continue\n\n for (var y = 0; y < height; ++y) {\n const offset = rowOffsets[comp][y]\n\n for (var x = 0; x < width; ++x) {\n halfRow[x] = dataView.getUint16(offset + x * INT16_SIZE * type, true)\n }\n\n for (var x = 0; x < width; ++x) {\n dataView.setFloat32(offset + x * INT16_SIZE * type, decodeFloat16(halfRow[x]), true)\n }\n }\n }\n }\n\n function unRleAC(currAcComp, acBuffer, halfZigBlock) {\n var acValue\n var dctComp = 1\n\n while (dctComp < 64) {\n acValue = acBuffer[currAcComp.value]\n\n if (acValue == 0xff00) {\n dctComp = 64\n } else if (acValue >> 8 == 0xff) {\n dctComp += acValue & 0xff\n } else {\n halfZigBlock[dctComp] = acValue\n dctComp++\n }\n\n currAcComp.value++\n }\n }\n\n function unZigZag(src, dst) {\n dst[0] = decodeFloat16(src[0])\n dst[1] = decodeFloat16(src[1])\n dst[2] = decodeFloat16(src[5])\n dst[3] = decodeFloat16(src[6])\n dst[4] = decodeFloat16(src[14])\n dst[5] = decodeFloat16(src[15])\n dst[6] = decodeFloat16(src[27])\n dst[7] = decodeFloat16(src[28])\n dst[8] = decodeFloat16(src[2])\n dst[9] = decodeFloat16(src[4])\n\n dst[10] = decodeFloat16(src[7])\n dst[11] = decodeFloat16(src[13])\n dst[12] = decodeFloat16(src[16])\n dst[13] = decodeFloat16(src[26])\n dst[14] = decodeFloat16(src[29])\n dst[15] = decodeFloat16(src[42])\n dst[16] = decodeFloat16(src[3])\n dst[17] = decodeFloat16(src[8])\n dst[18] = decodeFloat16(src[12])\n dst[19] = decodeFloat16(src[17])\n\n dst[20] = decodeFloat16(src[25])\n dst[21] = decodeFloat16(src[30])\n dst[22] = decodeFloat16(src[41])\n dst[23] = decodeFloat16(src[43])\n dst[24] = decodeFloat16(src[9])\n dst[25] = decodeFloat16(src[11])\n dst[26] = decodeFloat16(src[18])\n dst[27] = decodeFloat16(src[24])\n dst[28] = decodeFloat16(src[31])\n dst[29] = decodeFloat16(src[40])\n\n dst[30] = decodeFloat16(src[44])\n dst[31] = decodeFloat16(src[53])\n dst[32] = decodeFloat16(src[10])\n dst[33] = decodeFloat16(src[19])\n dst[34] = decodeFloat16(src[23])\n dst[35] = decodeFloat16(src[32])\n dst[36] = decodeFloat16(src[39])\n dst[37] = decodeFloat16(src[45])\n dst[38] = decodeFloat16(src[52])\n dst[39] = decodeFloat16(src[54])\n\n dst[40] = decodeFloat16(src[20])\n dst[41] = decodeFloat16(src[22])\n dst[42] = decodeFloat16(src[33])\n dst[43] = decodeFloat16(src[38])\n dst[44] = decodeFloat16(src[46])\n dst[45] = decodeFloat16(src[51])\n dst[46] = decodeFloat16(src[55])\n dst[47] = decodeFloat16(src[60])\n dst[48] = decodeFloat16(src[21])\n dst[49] = decodeFloat16(src[34])\n\n dst[50] = decodeFloat16(src[37])\n dst[51] = decodeFloat16(src[47])\n dst[52] = decodeFloat16(src[50])\n dst[53] = decodeFloat16(src[56])\n dst[54] = decodeFloat16(src[59])\n dst[55] = decodeFloat16(src[61])\n dst[56] = decodeFloat16(src[35])\n dst[57] = decodeFloat16(src[36])\n dst[58] = decodeFloat16(src[48])\n dst[59] = decodeFloat16(src[49])\n\n dst[60] = decodeFloat16(src[57])\n dst[61] = decodeFloat16(src[58])\n dst[62] = decodeFloat16(src[62])\n dst[63] = decodeFloat16(src[63])\n }\n\n function dctInverse(data) {\n const a = 0.5 * Math.cos(3.14159 / 4.0)\n const b = 0.5 * Math.cos(3.14159 / 16.0)\n const c = 0.5 * Math.cos(3.14159 / 8.0)\n const d = 0.5 * Math.cos((3.0 * 3.14159) / 16.0)\n const e = 0.5 * Math.cos((5.0 * 3.14159) / 16.0)\n const f = 0.5 * Math.cos((3.0 * 3.14159) / 8.0)\n const g = 0.5 * Math.cos((7.0 * 3.14159) / 16.0)\n\n var alpha = new Array(4)\n var beta = new Array(4)\n var theta = new Array(4)\n var gamma = new Array(4)\n\n for (var row = 0; row < 8; ++row) {\n var rowPtr = row * 8\n\n alpha[0] = c * data[rowPtr + 2]\n alpha[1] = f * data[rowPtr + 2]\n alpha[2] = c * data[rowPtr + 6]\n alpha[3] = f * data[rowPtr + 6]\n\n beta[0] = b * data[rowPtr + 1] + d * data[rowPtr + 3] + e * data[rowPtr + 5] + g * data[rowPtr + 7]\n beta[1] = d * data[rowPtr + 1] - g * data[rowPtr + 3] - b * data[rowPtr + 5] - e * data[rowPtr + 7]\n beta[2] = e * data[rowPtr + 1] - b * data[rowPtr + 3] + g * data[rowPtr + 5] + d * data[rowPtr + 7]\n beta[3] = g * data[rowPtr + 1] - e * data[rowPtr + 3] + d * data[rowPtr + 5] - b * data[rowPtr + 7]\n\n theta[0] = a * (data[rowPtr + 0] + data[rowPtr + 4])\n theta[3] = a * (data[rowPtr + 0] - data[rowPtr + 4])\n theta[1] = alpha[0] + alpha[3]\n theta[2] = alpha[1] - alpha[2]\n\n gamma[0] = theta[0] + theta[1]\n gamma[1] = theta[3] + theta[2]\n gamma[2] = theta[3] - theta[2]\n gamma[3] = theta[0] - theta[1]\n\n data[rowPtr + 0] = gamma[0] + beta[0]\n data[rowPtr + 1] = gamma[1] + beta[1]\n data[rowPtr + 2] = gamma[2] + beta[2]\n data[rowPtr + 3] = gamma[3] + beta[3]\n\n data[rowPtr + 4] = gamma[3] - beta[3]\n data[rowPtr + 5] = gamma[2] - beta[2]\n data[rowPtr + 6] = gamma[1] - beta[1]\n data[rowPtr + 7] = gamma[0] - beta[0]\n }\n\n for (var column = 0; column < 8; ++column) {\n alpha[0] = c * data[16 + column]\n alpha[1] = f * data[16 + column]\n alpha[2] = c * data[48 + column]\n alpha[3] = f * data[48 + column]\n\n beta[0] = b * data[8 + column] + d * data[24 + column] + e * data[40 + column] + g * data[56 + column]\n beta[1] = d * data[8 + column] - g * data[24 + column] - b * data[40 + column] - e * data[56 + column]\n beta[2] = e * data[8 + column] - b * data[24 + column] + g * data[40 + column] + d * data[56 + column]\n beta[3] = g * data[8 + column] - e * data[24 + column] + d * data[40 + column] - b * data[56 + column]\n\n theta[0] = a * (data[column] + data[32 + column])\n theta[3] = a * (data[column] - data[32 + column])\n\n theta[1] = alpha[0] + alpha[3]\n theta[2] = alpha[1] - alpha[2]\n\n gamma[0] = theta[0] + theta[1]\n gamma[1] = theta[3] + theta[2]\n gamma[2] = theta[3] - theta[2]\n gamma[3] = theta[0] - theta[1]\n\n data[0 + column] = gamma[0] + beta[0]\n data[8 + column] = gamma[1] + beta[1]\n data[16 + column] = gamma[2] + beta[2]\n data[24 + column] = gamma[3] + beta[3]\n\n data[32 + column] = gamma[3] - beta[3]\n data[40 + column] = gamma[2] - beta[2]\n data[48 + column] = gamma[1] - beta[1]\n data[56 + column] = gamma[0] - beta[0]\n }\n }\n\n function csc709Inverse(data) {\n for (var i = 0; i < 64; ++i) {\n var y = data[0][i]\n var cb = data[1][i]\n var cr = data[2][i]\n\n data[0][i] = y + 1.5747 * cr\n data[1][i] = y - 0.1873 * cb - 0.4682 * cr\n data[2][i] = y + 1.8556 * cb\n }\n }\n\n function convertToHalf(src, dst, idx) {\n for (var i = 0; i < 64; ++i) {\n dst[idx + i] = DataUtils.toHalfFloat(toLinear(src[i]))\n }\n }\n\n function toLinear(float) {\n if (float <= 1) {\n return Math.sign(float) * Math.pow(Math.abs(float), 2.2)\n } else {\n return Math.sign(float) * Math.pow(logBase, Math.abs(float) - 1.0)\n }\n }\n\n function uncompressRAW(info) {\n return new DataView(info.array.buffer, info.offset.value, info.size)\n }\n\n function uncompressRLE(info) {\n var compressed = info.viewer.buffer.slice(info.offset.value, info.offset.value + info.size)\n\n var rawBuffer = new Uint8Array(decodeRunLength(compressed))\n var tmpBuffer = new Uint8Array(rawBuffer.length)\n\n predictor(rawBuffer) // revert predictor\n\n interleaveScalar(rawBuffer, tmpBuffer) // interleave pixels\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressZIP(info) {\n var compressed = info.array.slice(info.offset.value, info.offset.value + info.size)\n var rawBuffer = unzlibSync(compressed)\n var tmpBuffer = new Uint8Array(rawBuffer.length)\n\n predictor(rawBuffer) // revert predictor\n\n interleaveScalar(rawBuffer, tmpBuffer) // interleave pixels\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressPIZ(info) {\n var inDataView = info.viewer\n var inOffset = { value: info.offset.value }\n\n var outBuffer = new Uint16Array(info.width * info.scanlineBlockSize * (info.channels * info.type))\n var bitmap = new Uint8Array(BITMAP_SIZE)\n\n // Setup channel info\n var outBufferEnd = 0\n var pizChannelData = new Array(info.channels)\n for (var i = 0; i < info.channels; i++) {\n pizChannelData[i] = {}\n pizChannelData[i]['start'] = outBufferEnd\n pizChannelData[i]['end'] = pizChannelData[i]['start']\n pizChannelData[i]['nx'] = info.width\n pizChannelData[i]['ny'] = info.lines\n pizChannelData[i]['size'] = info.type\n\n outBufferEnd += pizChannelData[i].nx * pizChannelData[i].ny * pizChannelData[i].size\n }\n\n // Read range compression data\n\n var minNonZero = parseUint16(inDataView, inOffset)\n var maxNonZero = parseUint16(inDataView, inOffset)\n\n if (maxNonZero >= BITMAP_SIZE) {\n throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE'\n }\n\n if (minNonZero <= maxNonZero) {\n for (var i = 0; i < maxNonZero - minNonZero + 1; i++) {\n bitmap[i + minNonZero] = parseUint8(inDataView, inOffset)\n }\n }\n\n // Reverse LUT\n var lut = new Uint16Array(USHORT_RANGE)\n var maxValue = reverseLutFromBitmap(bitmap, lut)\n\n var length = parseUint32(inDataView, inOffset)\n\n // Huffman decoding\n hufUncompress(info.array, inDataView, inOffset, length, outBuffer, outBufferEnd)\n\n // Wavelet decoding\n for (var i = 0; i < info.channels; ++i) {\n var cd = pizChannelData[i]\n\n for (var j = 0; j < pizChannelData[i].size; ++j) {\n wav2Decode(outBuffer, cd.start + j, cd.nx, cd.size, cd.ny, cd.nx * cd.size, maxValue)\n }\n }\n\n // Expand the pixel data to their original range\n applyLut(lut, outBuffer, outBufferEnd)\n\n // Rearrange the pixel data into the format expected by the caller.\n var tmpOffset = 0\n var tmpBuffer = new Uint8Array(outBuffer.buffer.byteLength)\n for (var y = 0; y < info.lines; y++) {\n for (var c = 0; c < info.channels; c++) {\n var cd = pizChannelData[c]\n\n var n = cd.nx * cd.size\n var cp = new Uint8Array(outBuffer.buffer, cd.end * INT16_SIZE, n * INT16_SIZE)\n\n tmpBuffer.set(cp, tmpOffset)\n tmpOffset += n * INT16_SIZE\n cd.end += n\n }\n }\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressPXR(info) {\n var compressed = info.array.slice(info.offset.value, info.offset.value + info.size)\n var rawBuffer = unzlibSync(compressed)\n\n const sz = info.lines * info.channels * info.width\n const tmpBuffer = info.type == 1 ? new Uint16Array(sz) : new Uint32Array(sz)\n\n let tmpBufferEnd = 0\n let writePtr = 0\n const ptr = new Array(4)\n\n for (let y = 0; y < info.lines; y++) {\n for (let c = 0; c < info.channels; c++) {\n let pixel = 0\n\n switch (info.type) {\n case 1:\n ptr[0] = tmpBufferEnd\n ptr[1] = ptr[0] + info.width\n tmpBufferEnd = ptr[1] + info.width\n\n for (let j = 0; j < info.width; ++j) {\n const diff = (rawBuffer[ptr[0]++] << 8) | rawBuffer[ptr[1]++]\n\n pixel += diff\n\n tmpBuffer[writePtr] = pixel\n writePtr++\n }\n\n break\n\n case 2:\n ptr[0] = tmpBufferEnd\n ptr[1] = ptr[0] + info.width\n ptr[2] = ptr[1] + info.width\n tmpBufferEnd = ptr[2] + info.width\n\n for (let j = 0; j < info.width; ++j) {\n const diff = (rawBuffer[ptr[0]++] << 24) | (rawBuffer[ptr[1]++] << 16) | (rawBuffer[ptr[2]++] << 8)\n\n pixel += diff\n\n tmpBuffer[writePtr] = pixel\n writePtr++\n }\n\n break\n }\n }\n }\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressDWA(info) {\n var inDataView = info.viewer\n var inOffset = { value: info.offset.value }\n var outBuffer = new Uint8Array(info.width * info.lines * (info.channels * info.type * INT16_SIZE))\n\n // Read compression header information\n var dwaHeader = {\n version: parseInt64(inDataView, inOffset),\n unknownUncompressedSize: parseInt64(inDataView, inOffset),\n unknownCompressedSize: parseInt64(inDataView, inOffset),\n acCompressedSize: parseInt64(inDataView, inOffset),\n dcCompressedSize: parseInt64(inDataView, inOffset),\n rleCompressedSize: parseInt64(inDataView, inOffset),\n rleUncompressedSize: parseInt64(inDataView, inOffset),\n rleRawSize: parseInt64(inDataView, inOffset),\n totalAcUncompressedCount: parseInt64(inDataView, inOffset),\n totalDcUncompressedCount: parseInt64(inDataView, inOffset),\n acCompression: parseInt64(inDataView, inOffset),\n }\n\n if (dwaHeader.version < 2) {\n throw 'EXRLoader.parse: ' + EXRHeader.compression + ' version ' + dwaHeader.version + ' is unsupported'\n }\n\n // Read channel ruleset information\n var channelRules = new Array()\n var ruleSize = parseUint16(inDataView, inOffset) - INT16_SIZE\n\n while (ruleSize > 0) {\n var name = parseNullTerminatedString(inDataView.buffer, inOffset)\n var value = parseUint8(inDataView, inOffset)\n var compression = (value >> 2) & 3\n var csc = (value >> 4) - 1\n var index = new Int8Array([csc])[0]\n var type = parseUint8(inDataView, inOffset)\n\n channelRules.push({\n name: name,\n index: index,\n type: type,\n compression: compression,\n })\n\n ruleSize -= name.length + 3\n }\n\n // Classify channels\n var channels = EXRHeader.channels\n var channelData = new Array(info.channels)\n\n for (var i = 0; i < info.channels; ++i) {\n var cd = (channelData[i] = {})\n var channel = channels[i]\n\n cd.name = channel.name\n cd.compression = UNKNOWN\n cd.decoded = false\n cd.type = channel.pixelType\n cd.pLinear = channel.pLinear\n cd.width = info.width\n cd.height = info.lines\n }\n\n var cscSet = {\n idx: new Array(3),\n }\n\n for (var offset = 0; offset < info.channels; ++offset) {\n var cd = channelData[offset]\n\n for (var i = 0; i < channelRules.length; ++i) {\n var rule = channelRules[i]\n\n if (cd.name == rule.name) {\n cd.compression = rule.compression\n\n if (rule.index >= 0) {\n cscSet.idx[rule.index] = offset\n }\n\n cd.offset = offset\n }\n }\n }\n\n // Read DCT - AC component data\n if (dwaHeader.acCompressedSize > 0) {\n switch (dwaHeader.acCompression) {\n case STATIC_HUFFMAN:\n var acBuffer = new Uint16Array(dwaHeader.totalAcUncompressedCount)\n hufUncompress(\n info.array,\n inDataView,\n inOffset,\n dwaHeader.acCompressedSize,\n acBuffer,\n dwaHeader.totalAcUncompressedCount,\n )\n break\n\n case DEFLATE:\n var compressed = info.array.slice(inOffset.value, inOffset.value + dwaHeader.totalAcUncompressedCount)\n var data = unzlibSync(compressed)\n var acBuffer = new Uint16Array(data.buffer)\n inOffset.value += dwaHeader.totalAcUncompressedCount\n break\n }\n }\n\n // Read DCT - DC component data\n if (dwaHeader.dcCompressedSize > 0) {\n var zlibInfo = {\n array: info.array,\n offset: inOffset,\n size: dwaHeader.dcCompressedSize,\n }\n var dcBuffer = new Uint16Array(uncompressZIP(zlibInfo).buffer)\n inOffset.value += dwaHeader.dcCompressedSize\n }\n\n // Read RLE compressed data\n if (dwaHeader.rleRawSize > 0) {\n var compressed = info.array.slice(inOffset.value, inOffset.value + dwaHeader.rleCompressedSize)\n var data = unzlibSync(compressed)\n var rleBuffer = decodeRunLength(data.buffer)\n\n inOffset.value += dwaHeader.rleCompressedSize\n }\n\n // Prepare outbuffer data offset\n var outBufferEnd = 0\n var rowOffsets = new Array(channelData.length)\n for (var i = 0; i < rowOffsets.length; ++i) {\n rowOffsets[i] = new Array()\n }\n\n for (var y = 0; y < info.lines; ++y) {\n for (var chan = 0; chan < channelData.length; ++chan) {\n rowOffsets[chan].push(outBufferEnd)\n outBufferEnd += channelData[chan].width * info.type * INT16_SIZE\n }\n }\n\n // Lossy DCT decode RGB channels\n lossyDctDecode(cscSet, rowOffsets, channelData, acBuffer, dcBuffer, outBuffer)\n\n // Decode other channels\n for (var i = 0; i < channelData.length; ++i) {\n var cd = channelData[i]\n\n if (cd.decoded) continue\n\n switch (cd.compression) {\n case RLE:\n var row = 0\n var rleOffset = 0\n\n for (var y = 0; y < info.lines; ++y) {\n var rowOffsetBytes = rowOffsets[i][row]\n\n for (var x = 0; x < cd.width; ++x) {\n for (var byte = 0; byte < INT16_SIZE * cd.type; ++byte) {\n outBuffer[rowOffsetBytes++] = rleBuffer[rleOffset + byte * cd.width * cd.height]\n }\n\n rleOffset++\n }\n\n row++\n }\n\n break\n\n case LOSSY_DCT: // skip\n\n default:\n throw 'EXRLoader.parse: unsupported channel compression'\n }\n }\n\n return new DataView(outBuffer.buffer)\n }\n\n function parseNullTerminatedString(buffer, offset) {\n var uintBuffer = new Uint8Array(buffer)\n var endOffset = 0\n\n while (uintBuffer[offset.value + endOffset] != 0) {\n endOffset += 1\n }\n\n var stringValue = new TextDecoder().decode(uintBuffer.slice(offset.value, offset.value + endOffset))\n\n offset.value = offset.value + endOffset + 1\n\n return stringValue\n }\n\n function parseFixedLengthString(buffer, offset, size) {\n var stringValue = new TextDecoder().decode(new Uint8Array(buffer).slice(offset.value, offset.value + size))\n\n offset.value = offset.value + size\n\n return stringValue\n }\n\n function parseRational(dataView, offset) {\n var x = parseInt32(dataView, offset)\n var y = parseUint32(dataView, offset)\n\n return [x, y]\n }\n\n function parseTimecode(dataView, offset) {\n var x = parseUint32(dataView, offset)\n var y = parseUint32(dataView, offset)\n\n return [x, y]\n }\n\n function parseInt32(dataView, offset) {\n var Int32 = dataView.getInt32(offset.value, true)\n\n offset.value = offset.value + INT32_SIZE\n\n return Int32\n }\n\n function parseUint32(dataView, offset) {\n var Uint32 = dataView.getUint32(offset.value, true)\n\n offset.value = offset.value + INT32_SIZE\n\n return Uint32\n }\n\n function parseUint8Array(uInt8Array, offset) {\n var Uint8 = uInt8Array[offset.value]\n\n offset.value = offset.value + INT8_SIZE\n\n return Uint8\n }\n\n function parseUint8(dataView, offset) {\n var Uint8 = dataView.getUint8(offset.value)\n\n offset.value = offset.value + INT8_SIZE\n\n return Uint8\n }\n\n const parseInt64 = function (dataView, offset) {\n let int\n\n if ('getBigInt64' in DataView.prototype) {\n int = Number(dataView.getBigInt64(offset.value, true))\n } else {\n int = dataView.getUint32(offset.value + 4, true) + Number(dataView.getUint32(offset.value, true) << 32)\n }\n\n offset.value += ULONG_SIZE\n\n return int\n }\n\n function parseFloat32(dataView, offset) {\n var float = dataView.getFloat32(offset.value, true)\n\n offset.value += FLOAT32_SIZE\n\n return float\n }\n\n function decodeFloat32(dataView, offset) {\n return DataUtils.toHalfFloat(parseFloat32(dataView, offset))\n }\n\n // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript\n function decodeFloat16(binary) {\n var exponent = (binary & 0x7c00) >> 10,\n fraction = binary & 0x03ff\n\n return (\n (binary >> 15 ? -1 : 1) *\n (exponent\n ? exponent === 0x1f\n ? fraction\n ? NaN\n : Infinity\n : Math.pow(2, exponent - 15) * (1 + fraction / 0x400)\n : 6.103515625e-5 * (fraction / 0x400))\n )\n }\n\n function parseUint16(dataView, offset) {\n var Uint16 = dataView.getUint16(offset.value, true)\n\n offset.value += INT16_SIZE\n\n return Uint16\n }\n\n function parseFloat16(buffer, offset) {\n return decodeFloat16(parseUint16(buffer, offset))\n }\n\n function parseChlist(dataView, buffer, offset, size) {\n var startOffset = offset.value\n var channels = []\n\n while (offset.value < startOffset + size - 1) {\n var name = parseNullTerminatedString(buffer, offset)\n var pixelType = parseInt32(dataView, offset)\n var pLinear = parseUint8(dataView, offset)\n offset.value += 3 // reserved, three chars\n var xSampling = parseInt32(dataView, offset)\n var ySampling = parseInt32(dataView, offset)\n\n channels.push({\n name: name,\n pixelType: pixelType,\n pLinear: pLinear,\n xSampling: xSampling,\n ySampling: ySampling,\n })\n }\n\n offset.value += 1\n\n return channels\n }\n\n function parseChromaticities(dataView, offset) {\n var redX = parseFloat32(dataView, offset)\n var redY = parseFloat32(dataView, offset)\n var greenX = parseFloat32(dataView, offset)\n var greenY = parseFloat32(dataView, offset)\n var blueX = parseFloat32(dataView, offset)\n var blueY = parseFloat32(dataView, offset)\n var whiteX = parseFloat32(dataView, offset)\n var whiteY = parseFloat32(dataView, offset)\n\n return {\n redX: redX,\n redY: redY,\n greenX: greenX,\n greenY: greenY,\n blueX: blueX,\n blueY: blueY,\n whiteX: whiteX,\n whiteY: whiteY,\n }\n }\n\n function parseCompression(dataView, offset) {\n var compressionCodes = [\n 'NO_COMPRESSION',\n 'RLE_COMPRESSION',\n 'ZIPS_COMPRESSION',\n 'ZIP_COMPRESSION',\n 'PIZ_COMPRESSION',\n 'PXR24_COMPRESSION',\n 'B44_COMPRESSION',\n 'B44A_COMPRESSION',\n 'DWAA_COMPRESSION',\n 'DWAB_COMPRESSION',\n ]\n\n var compression = parseUint8(dataView, offset)\n\n return compressionCodes[compression]\n }\n\n function parseBox2i(dataView, offset) {\n var xMin = parseUint32(dataView, offset)\n var yMin = parseUint32(dataView, offset)\n var xMax = parseUint32(dataView, offset)\n var yMax = parseUint32(dataView, offset)\n\n return { xMin: xMin, yMin: yMin, xMax: xMax, yMax: yMax }\n }\n\n function parseLineOrder(dataView, offset) {\n var lineOrders = ['INCREASING_Y']\n\n var lineOrder = parseUint8(dataView, offset)\n\n return lineOrders[lineOrder]\n }\n\n function parseV2f(dataView, offset) {\n var x = parseFloat32(dataView, offset)\n var y = parseFloat32(dataView, offset)\n\n return [x, y]\n }\n\n function parseV3f(dataView, offset) {\n var x = parseFloat32(dataView, offset)\n var y = parseFloat32(dataView, offset)\n var z = parseFloat32(dataView, offset)\n\n return [x, y, z]\n }\n\n function parseValue(dataView, buffer, offset, type, size) {\n if (type === 'string' || type === 'stringvector' || type === 'iccProfile') {\n return parseFixedLengthString(buffer, offset, size)\n } else if (type === 'chlist') {\n return parseChlist(dataView, buffer, offset, size)\n } else if (type === 'chromaticities') {\n return parseChromaticities(dataView, offset)\n } else if (type === 'compression') {\n return parseCompression(dataView, offset)\n } else if (type === 'box2i') {\n return parseBox2i(dataView, offset)\n } else if (type === 'lineOrder') {\n return parseLineOrder(dataView, offset)\n } else if (type === 'float') {\n return parseFloat32(dataView, offset)\n } else if (type === 'v2f') {\n return parseV2f(dataView, offset)\n } else if (type === 'v3f') {\n return parseV3f(dataView, offset)\n } else if (type === 'int') {\n return parseInt32(dataView, offset)\n } else if (type === 'rational') {\n return parseRational(dataView, offset)\n } else if (type === 'timecode') {\n return parseTimecode(dataView, offset)\n } else if (type === 'preview') {\n offset.value += size\n return 'skipped'\n } else {\n offset.value += size\n return undefined\n }\n }\n\n function parseHeader(dataView, buffer, offset) {\n const EXRHeader = {}\n\n if (dataView.getUint32(0, true) != 20000630) {\n // magic\n throw \"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.\"\n }\n\n EXRHeader.version = dataView.getUint8(4)\n\n const spec = dataView.getUint8(5) // fullMask\n\n EXRHeader.spec = {\n singleTile: !!(spec & 2),\n longName: !!(spec & 4),\n deepFormat: !!(spec & 8),\n multiPart: !!(spec & 16),\n }\n\n // start of header\n\n offset.value = 8 // start at 8 - after pre-amble\n\n var keepReading = true\n\n while (keepReading) {\n var attributeName = parseNullTerminatedString(buffer, offset)\n\n if (attributeName == 0) {\n keepReading = false\n } else {\n var attributeType = parseNullTerminatedString(buffer, offset)\n var attributeSize = parseUint32(dataView, offset)\n var attributeValue = parseValue(dataView, buffer, offset, attributeType, attributeSize)\n\n if (attributeValue === undefined) {\n console.warn(`EXRLoader.parse: skipped unknown header attribute type \\'${attributeType}\\'.`)\n } else {\n EXRHeader[attributeName] = attributeValue\n }\n }\n }\n\n if ((spec & ~0x04) != 0) {\n // unsupported tiled, deep-image, multi-part\n console.error('EXRHeader:', EXRHeader)\n throw 'THREE.EXRLoader: provided file is currently unsupported.'\n }\n\n return EXRHeader\n }\n\n function setupDecoder(EXRHeader, dataView, uInt8Array, offset, outputType) {\n const EXRDecoder = {\n size: 0,\n viewer: dataView,\n array: uInt8Array,\n offset: offset,\n width: EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1,\n height: EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1,\n channels: EXRHeader.channels.length,\n bytesPerLine: null,\n lines: null,\n inputSize: null,\n type: EXRHeader.channels[0].pixelType,\n uncompress: null,\n getter: null,\n format: null,\n [hasColorSpace ? 'colorSpace' : 'encoding']: null,\n }\n\n switch (EXRHeader.compression) {\n case 'NO_COMPRESSION':\n EXRDecoder.lines = 1\n EXRDecoder.uncompress = uncompressRAW\n break\n\n case 'RLE_COMPRESSION':\n EXRDecoder.lines = 1\n EXRDecoder.uncompress = uncompressRLE\n break\n\n case 'ZIPS_COMPRESSION':\n EXRDecoder.lines = 1\n EXRDecoder.uncompress = uncompressZIP\n break\n\n case 'ZIP_COMPRESSION':\n EXRDecoder.lines = 16\n EXRDecoder.uncompress = uncompressZIP\n break\n\n case 'PIZ_COMPRESSION':\n EXRDecoder.lines = 32\n EXRDecoder.uncompress = uncompressPIZ\n break\n\n case 'PXR24_COMPRESSION':\n EXRDecoder.lines = 16\n EXRDecoder.uncompress = uncompressPXR\n break\n\n case 'DWAA_COMPRESSION':\n EXRDecoder.lines = 32\n EXRDecoder.uncompress = uncompressDWA\n break\n\n case 'DWAB_COMPRESSION':\n EXRDecoder.lines = 256\n EXRDecoder.uncompress = uncompressDWA\n break\n\n default:\n throw 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported'\n }\n\n EXRDecoder.scanlineBlockSize = EXRDecoder.lines\n\n if (EXRDecoder.type == 1) {\n // half\n switch (outputType) {\n case FloatType:\n EXRDecoder.getter = parseFloat16\n EXRDecoder.inputSize = INT16_SIZE\n break\n\n case HalfFloatType:\n EXRDecoder.getter = parseUint16\n EXRDecoder.inputSize = INT16_SIZE\n break\n }\n } else if (EXRDecoder.type == 2) {\n // float\n switch (outputType) {\n case FloatType:\n EXRDecoder.getter = parseFloat32\n EXRDecoder.inputSize = FLOAT32_SIZE\n break\n\n case HalfFloatType:\n EXRDecoder.getter = decodeFloat32\n EXRDecoder.inputSize = FLOAT32_SIZE\n }\n } else {\n throw 'EXRLoader.parse: unsupported pixelType ' + EXRDecoder.type + ' for ' + EXRHeader.compression + '.'\n }\n\n EXRDecoder.blockCount = (EXRHeader.dataWindow.yMax + 1) / EXRDecoder.scanlineBlockSize\n\n for (var i = 0; i < EXRDecoder.blockCount; i++) parseInt64(dataView, offset) // scanlineOffset\n\n // we should be passed the scanline offset table, ready to start reading pixel data.\n\n // RGB images will be converted to RGBA format, preventing software emulation in select devices.\n EXRDecoder.outputChannels = EXRDecoder.channels == 3 ? 4 : EXRDecoder.channels\n const size = EXRDecoder.width * EXRDecoder.height * EXRDecoder.outputChannels\n\n switch (outputType) {\n case FloatType:\n EXRDecoder.byteArray = new Float32Array(size)\n\n // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten\n if (EXRDecoder.channels < EXRDecoder.outputChannels) EXRDecoder.byteArray.fill(1, 0, size)\n\n break\n\n case HalfFloatType:\n EXRDecoder.byteArray = new Uint16Array(size)\n\n if (EXRDecoder.channels < EXRDecoder.outputChannels) EXRDecoder.byteArray.fill(0x3c00, 0, size) // Uint16Array holds half float data, 0x3C00 is 1\n\n break\n\n default:\n console.error('THREE.EXRLoader: unsupported type: ', outputType)\n break\n }\n\n EXRDecoder.bytesPerLine = EXRDecoder.width * EXRDecoder.inputSize * EXRDecoder.channels\n\n if (EXRDecoder.outputChannels == 4) EXRDecoder.format = RGBAFormat\n else EXRDecoder.format = RedFormat\n\n if (hasColorSpace) EXRDecoder.colorSpace = 'srgb-linear'\n else EXRDecoder.encoding = 3000 // LinearEncoding\n\n return EXRDecoder\n }\n\n // start parsing file [START]\n\n const bufferDataView = new DataView(buffer)\n const uInt8Array = new Uint8Array(buffer)\n const offset = { value: 0 }\n\n // get header information and validate format.\n const EXRHeader = parseHeader(bufferDataView, buffer, offset)\n\n // get input compression information and prepare decoding.\n const EXRDecoder = setupDecoder(EXRHeader, bufferDataView, uInt8Array, offset, this.type)\n\n const tmpOffset = { value: 0 }\n const channelOffsets = { R: 0, G: 1, B: 2, A: 3, Y: 0 }\n\n for (\n let scanlineBlockIdx = 0;\n scanlineBlockIdx < EXRDecoder.height / EXRDecoder.scanlineBlockSize;\n scanlineBlockIdx++\n ) {\n const line = parseUint32(bufferDataView, offset) // line_no\n EXRDecoder.size = parseUint32(bufferDataView, offset) // data_len\n EXRDecoder.lines =\n line + EXRDecoder.scanlineBlockSize > EXRDecoder.height\n ? EXRDecoder.height - line\n : EXRDecoder.scanlineBlockSize\n\n const isCompressed = EXRDecoder.size < EXRDecoder.lines * EXRDecoder.bytesPerLine\n const viewer = isCompressed ? EXRDecoder.uncompress(EXRDecoder) : uncompressRAW(EXRDecoder)\n\n offset.value += EXRDecoder.size\n\n for (let line_y = 0; line_y < EXRDecoder.scanlineBlockSize; line_y++) {\n const true_y = line_y + scanlineBlockIdx * EXRDecoder.scanlineBlockSize\n if (true_y >= EXRDecoder.height) break\n\n for (let channelID = 0; channelID < EXRDecoder.channels; channelID++) {\n const cOff = channelOffsets[EXRHeader.channels[channelID].name]\n\n for (let x = 0; x < EXRDecoder.width; x++) {\n tmpOffset.value =\n (line_y * (EXRDecoder.channels * EXRDecoder.width) + channelID * EXRDecoder.width + x) *\n EXRDecoder.inputSize\n const outIndex =\n (EXRDecoder.height - 1 - true_y) * (EXRDecoder.width * EXRDecoder.outputChannels) +\n x * EXRDecoder.outputChannels +\n cOff\n EXRDecoder.byteArray[outIndex] = EXRDecoder.getter(viewer, tmpOffset)\n }\n }\n }\n }\n\n return {\n header: EXRHeader,\n width: EXRDecoder.width,\n height: EXRDecoder.height,\n data: EXRDecoder.byteArray,\n format: EXRDecoder.format,\n [hasColorSpace ? 'colorSpace' : 'encoding']: EXRDecoder[hasColorSpace ? 'colorSpace' : 'encoding'],\n type: this.type,\n }\n }\n\n setDataType(value) {\n this.type = value\n return this\n }\n\n load(url, onLoad, onProgress, onError) {\n function onLoadCallback(texture, texData) {\n if (hasColorSpace) texture.colorSpace = texData.colorSpace\n else texture.encoding = texData.encoding\n texture.minFilter = LinearFilter\n texture.magFilter = LinearFilter\n texture.generateMipmaps = false\n texture.flipY = false\n\n if (onLoad) onLoad(texture, texData)\n }\n\n return super.load(url, onLoadCallback, onProgress, onError)\n }\n}\n\nexport { EXRLoader }\n", "import {\n CompressedTexture,\n FileLoader,\n LinearFilter,\n LinearMipmapLinearFilter,\n Loader,\n RGBAFormat,\n RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format,\n RGB_ETC1_Format,\n RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format,\n UnsignedByteType,\n} from 'three'\n\n/**\n * Loader for Basis Universal GPU Texture Codec.\n *\n * Basis Universal is a \"supercompressed\" GPU texture and texture video\n * compression system that outputs a highly compressed intermediate file format\n * (.basis) that can be quickly transcoded to a wide variety of GPU texture\n * compression formats.\n *\n * This loader parallelizes the transcoding process across a configurable number\n * of web workers, before transferring the transcoded compressed texture back\n * to the main thread.\n */\n\nconst _taskCache = new WeakMap()\n\nclass BasisTextureLoader extends Loader {\n /* CONSTANTS */\n\n static BasisFormat = {\n ETC1S: 0,\n UASTC_4x4: 1,\n }\n\n static TranscoderFormat = {\n ETC1: 0,\n ETC2: 1,\n BC1: 2,\n BC3: 3,\n BC4: 4,\n BC5: 5,\n BC7_M6_OPAQUE_ONLY: 6,\n BC7_M5: 7,\n PVRTC1_4_RGB: 8,\n PVRTC1_4_RGBA: 9,\n ASTC_4x4: 10,\n ATC_RGB: 11,\n ATC_RGBA_INTERPOLATED_ALPHA: 12,\n RGBA32: 13,\n RGB565: 14,\n BGR565: 15,\n RGBA4444: 16,\n }\n\n static EngineFormat = {\n RGBAFormat: RGBAFormat,\n RGBA_ASTC_4x4_Format: RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format: RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format: RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format: RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format: RGBA_S3TC_DXT5_Format,\n RGB_ETC1_Format: RGB_ETC1_Format,\n RGB_ETC2_Format: RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format: RGB_S3TC_DXT1_Format,\n }\n\n /* WEB WORKER */\n\n static BasisWorker = function () {\n let config\n let transcoderPending\n let BasisModule\n\n const EngineFormat = _EngineFormat\n const TranscoderFormat = _TranscoderFormat\n const BasisFormat = _BasisFormat\n\n onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'init':\n config = message.config\n init(message.transcoderBinary)\n break\n\n case 'transcode':\n transcoderPending.then(() => {\n try {\n const { width, height, hasAlpha, mipmaps, format } = message.taskConfig.lowLevel\n ? transcodeLowLevel(message.taskConfig)\n : transcode(message.buffers[0])\n\n const buffers = []\n\n for (let i = 0; i < mipmaps.length; ++i) {\n buffers.push(mipmaps[i].data.buffer)\n }\n\n self.postMessage({ type: 'transcode', id: message.id, width, height, hasAlpha, mipmaps, format }, buffers)\n } catch (error) {\n console.error(error)\n\n self.postMessage({ type: 'error', id: message.id, error: error.message })\n }\n })\n break\n }\n }\n\n function init(wasmBinary) {\n transcoderPending = new Promise((resolve) => {\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve }\n BASIS(BasisModule)\n }).then(() => {\n BasisModule.initializeBasis()\n })\n }\n\n function transcodeLowLevel(taskConfig) {\n const { basisFormat, width, height, hasAlpha } = taskConfig\n\n const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha)\n\n const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat)\n\n assert(BasisModule.isFormatSupported(transcoderFormat), 'THREE.BasisTextureLoader: Unsupported format.')\n\n const mipmaps = []\n\n if (basisFormat === BasisFormat.ETC1S) {\n const transcoder = new BasisModule.LowLevelETC1SImageTranscoder()\n\n const { endpointCount, endpointsData, selectorCount, selectorsData, tablesData } = taskConfig.globalData\n\n try {\n let ok\n\n ok = transcoder.decodePalettes(endpointCount, endpointsData, selectorCount, selectorsData)\n\n assert(ok, 'THREE.BasisTextureLoader: decodePalettes() failed.')\n\n ok = transcoder.decodeTables(tablesData)\n\n assert(ok, 'THREE.BasisTextureLoader: decodeTables() failed.')\n\n for (let i = 0; i < taskConfig.levels.length; i++) {\n const level = taskConfig.levels[i]\n const imageDesc = taskConfig.globalData.imageDescs[i]\n\n const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height)\n const dst = new Uint8Array(dstByteLength)\n\n ok = transcoder.transcodeImage(\n transcoderFormat,\n dst,\n dstByteLength / blockByteLength,\n level.data,\n getWidthInBlocks(transcoderFormat, level.width),\n getHeightInBlocks(transcoderFormat, level.height),\n level.width,\n level.height,\n level.index,\n imageDesc.rgbSliceByteOffset,\n imageDesc.rgbSliceByteLength,\n imageDesc.alphaSliceByteOffset,\n imageDesc.alphaSliceByteLength,\n imageDesc.imageFlags,\n hasAlpha,\n false,\n 0,\n 0,\n )\n\n assert(ok, 'THREE.BasisTextureLoader: transcodeImage() failed for level ' + level.index + '.')\n\n mipmaps.push({ data: dst, width: level.width, height: level.height })\n }\n } finally {\n transcoder.delete()\n }\n } else {\n for (let i = 0; i < taskConfig.levels.length; i++) {\n const level = taskConfig.levels[i]\n\n const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height)\n const dst = new Uint8Array(dstByteLength)\n\n const ok = BasisModule.transcodeUASTCImage(\n transcoderFormat,\n dst,\n dstByteLength / blockByteLength,\n level.data,\n getWidthInBlocks(transcoderFormat, level.width),\n getHeightInBlocks(transcoderFormat, level.height),\n level.width,\n level.height,\n level.index,\n 0,\n level.data.byteLength,\n 0,\n hasAlpha,\n false,\n 0,\n 0,\n -1,\n -1,\n )\n\n assert(ok, 'THREE.BasisTextureLoader: transcodeUASTCImage() failed for level ' + level.index + '.')\n\n mipmaps.push({ data: dst, width: level.width, height: level.height })\n }\n }\n\n return { width, height, hasAlpha, mipmaps, format: engineFormat }\n }\n\n function transcode(buffer) {\n const basisFile = new BasisModule.BasisFile(new Uint8Array(buffer))\n\n const basisFormat = basisFile.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S\n const width = basisFile.getImageWidth(0, 0)\n const height = basisFile.getImageHeight(0, 0)\n const levels = basisFile.getNumLevels(0)\n const hasAlpha = basisFile.getHasAlpha()\n\n function cleanup() {\n basisFile.close()\n basisFile.delete()\n }\n\n const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha)\n\n if (!width || !height || !levels) {\n cleanup()\n throw new Error('THREE.BasisTextureLoader:\tInvalid texture')\n }\n\n if (!basisFile.startTranscoding()) {\n cleanup()\n throw new Error('THREE.BasisTextureLoader: .startTranscoding failed')\n }\n\n const mipmaps = []\n\n for (let mip = 0; mip < levels; mip++) {\n const mipWidth = basisFile.getImageWidth(0, mip)\n const mipHeight = basisFile.getImageHeight(0, mip)\n const dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, transcoderFormat))\n\n const status = basisFile.transcodeImage(dst, 0, mip, transcoderFormat, 0, hasAlpha)\n\n if (!status) {\n cleanup()\n throw new Error('THREE.BasisTextureLoader: .transcodeImage failed.')\n }\n\n mipmaps.push({ data: dst, width: mipWidth, height: mipHeight })\n }\n\n cleanup()\n\n return { width, height, hasAlpha, mipmaps, format: engineFormat }\n }\n\n //\n\n // Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC),\n // device capabilities, and texture dimensions. The list below ranks the formats separately\n // for ETC1S and UASTC.\n //\n // In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at\n // significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently\n // chooses RGBA32 only as a last resort and does not expose that option to the caller.\n const FORMAT_OPTIONS = [\n {\n if: 'astcSupported',\n basisFormat: [BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],\n engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],\n priorityETC1S: Infinity,\n priorityUASTC: 1,\n needsPowerOfTwo: false,\n },\n {\n if: 'bptcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],\n engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],\n priorityETC1S: 3,\n priorityUASTC: 2,\n needsPowerOfTwo: false,\n },\n {\n if: 'dxtSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],\n engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],\n priorityETC1S: 4,\n priorityUASTC: 5,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc2Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],\n engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],\n priorityETC1S: 1,\n priorityUASTC: 3,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc1Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC1],\n engineFormat: [EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format],\n priorityETC1S: 2,\n priorityUASTC: 4,\n needsPowerOfTwo: false,\n },\n {\n if: 'pvrtcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],\n engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],\n priorityETC1S: 5,\n priorityUASTC: 6,\n needsPowerOfTwo: true,\n },\n ]\n\n const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityETC1S - b.priorityETC1S\n })\n const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityUASTC - b.priorityUASTC\n })\n\n function getTranscoderFormat(basisFormat, width, height, hasAlpha) {\n let transcoderFormat\n let engineFormat\n\n const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS\n\n for (let i = 0; i < options.length; i++) {\n const opt = options[i]\n\n if (!config[opt.if]) continue\n if (!opt.basisFormat.includes(basisFormat)) continue\n if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height))) continue\n\n transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0]\n engineFormat = opt.engineFormat[hasAlpha ? 1 : 0]\n\n return { transcoderFormat, engineFormat }\n }\n\n console.warn('THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32.')\n\n transcoderFormat = TranscoderFormat.RGBA32\n engineFormat = EngineFormat.RGBAFormat\n\n return { transcoderFormat, engineFormat }\n }\n\n function assert(ok, message) {\n if (!ok) throw new Error(message)\n }\n\n function getWidthInBlocks(transcoderFormat, width) {\n return Math.ceil(width / BasisModule.getFormatBlockWidth(transcoderFormat))\n }\n\n function getHeightInBlocks(transcoderFormat, height) {\n return Math.ceil(height / BasisModule.getFormatBlockHeight(transcoderFormat))\n }\n\n function getTranscodedImageByteLength(transcoderFormat, width, height) {\n const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat)\n\n if (BasisModule.formatIsUncompressed(transcoderFormat)) {\n return width * height * blockByteLength\n }\n\n if (transcoderFormat === TranscoderFormat.PVRTC1_4_RGB || transcoderFormat === TranscoderFormat.PVRTC1_4_RGBA) {\n // GL requires extra padding for very small textures:\n // https://www.khronos.org/registry/OpenGL/extensions/IMG/IMG_texture_compression_pvrtc.txt\n const paddedWidth = (width + 3) & ~3\n const paddedHeight = (height + 3) & ~3\n\n return (Math.max(8, paddedWidth) * Math.max(8, paddedHeight) * 4 + 7) / 8\n }\n\n return getWidthInBlocks(transcoderFormat, width) * getHeightInBlocks(transcoderFormat, height) * blockByteLength\n }\n\n function isPowerOfTwo(value) {\n if (value <= 2) return true\n\n return (value & (value - 1)) === 0 && value !== 0\n }\n }\n\n constructor(manager) {\n super(manager)\n\n this.transcoderPath = ''\n this.transcoderBinary = null\n this.transcoderPending = null\n\n this.workerLimit = 4\n this.workerPool = []\n this.workerNextTaskID = 1\n this.workerSourceURL = ''\n this.workerConfig = null\n }\n\n setTranscoderPath(path) {\n this.transcoderPath = path\n\n return this\n }\n\n setWorkerLimit(workerLimit) {\n this.workerLimit = workerLimit\n\n return this\n }\n\n detectSupport(renderer) {\n this.workerConfig = {\n astcSupported: renderer.extensions.has('WEBGL_compressed_texture_astc'),\n etc1Supported: renderer.extensions.has('WEBGL_compressed_texture_etc1'),\n etc2Supported: renderer.extensions.has('WEBGL_compressed_texture_etc'),\n dxtSupported: renderer.extensions.has('WEBGL_compressed_texture_s3tc'),\n bptcSupported: renderer.extensions.has('EXT_texture_compression_bptc'),\n pvrtcSupported:\n renderer.extensions.has('WEBGL_compressed_texture_pvrtc') ||\n renderer.extensions.has('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n }\n\n return this\n }\n\n load(url, onLoad, onProgress, onError) {\n const loader = new FileLoader(this.manager)\n\n loader.setResponseType('arraybuffer')\n loader.setWithCredentials(this.withCredentials)\n\n const texture = new CompressedTexture()\n\n loader.load(\n url,\n (buffer) => {\n // Check for an existing task using this buffer. A transferred buffer cannot be transferred\n // again from this thread.\n if (_taskCache.has(buffer)) {\n const cachedTask = _taskCache.get(buffer)\n\n return cachedTask.promise.then(onLoad).catch(onError)\n }\n\n this._createTexture([buffer])\n .then(function (_texture) {\n texture.copy(_texture)\n texture.needsUpdate = true\n\n if (onLoad) onLoad(texture)\n })\n .catch(onError)\n },\n onProgress,\n onError,\n )\n\n return texture\n }\n\n /** Low-level transcoding API, exposed for use by KTX2Loader. */\n parseInternalAsync(options) {\n const { levels } = options\n\n const buffers = new Set()\n\n for (let i = 0; i < levels.length; i++) {\n buffers.add(levels[i].data.buffer)\n }\n\n return this._createTexture(Array.from(buffers), { ...options, lowLevel: true })\n }\n\n /**\n * @param {ArrayBuffer[]} buffers\n * @param {object?} config\n * @return {Promise}\n */\n _createTexture(buffers, config = {}) {\n let worker\n let taskID\n\n const taskConfig = config\n let taskCost = 0\n\n for (let i = 0; i < buffers.length; i++) {\n taskCost += buffers[i].byteLength\n }\n\n const texturePending = this._allocateWorker(taskCost)\n .then((_worker) => {\n worker = _worker\n taskID = this.workerNextTaskID++\n\n return new Promise((resolve, reject) => {\n worker._callbacks[taskID] = { resolve, reject }\n\n worker.postMessage({ type: 'transcode', id: taskID, buffers: buffers, taskConfig: taskConfig }, buffers)\n })\n })\n .then((message) => {\n const { mipmaps, width, height, format } = message\n\n const texture = new CompressedTexture(mipmaps, width, height, format, UnsignedByteType)\n texture.minFilter = mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter\n texture.magFilter = LinearFilter\n texture.generateMipmaps = false\n texture.needsUpdate = true\n\n return texture\n })\n\n // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)\n texturePending\n .catch(() => true)\n .then(() => {\n if (worker && taskID) {\n worker._taskLoad -= taskCost\n delete worker._callbacks[taskID]\n }\n })\n\n // Cache the task result.\n _taskCache.set(buffers[0], { promise: texturePending })\n\n return texturePending\n }\n\n _initTranscoder() {\n if (!this.transcoderPending) {\n // Load transcoder wrapper.\n const jsLoader = new FileLoader(this.manager)\n jsLoader.setPath(this.transcoderPath)\n jsLoader.setWithCredentials(this.withCredentials)\n const jsContent = new Promise((resolve, reject) => {\n jsLoader.load('basis_transcoder.js', resolve, undefined, reject)\n })\n\n // Load transcoder WASM binary.\n const binaryLoader = new FileLoader(this.manager)\n binaryLoader.setPath(this.transcoderPath)\n binaryLoader.setResponseType('arraybuffer')\n binaryLoader.setWithCredentials(this.withCredentials)\n const binaryContent = new Promise((resolve, reject) => {\n binaryLoader.load('basis_transcoder.wasm', resolve, undefined, reject)\n })\n\n this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent, binaryContent]) => {\n const fn = BasisTextureLoader.BasisWorker.toString()\n\n const body = [\n '/* constants */',\n 'let _EngineFormat = ' + JSON.stringify(BasisTextureLoader.EngineFormat),\n 'let _TranscoderFormat = ' + JSON.stringify(BasisTextureLoader.TranscoderFormat),\n 'let _BasisFormat = ' + JSON.stringify(BasisTextureLoader.BasisFormat),\n '/* basis_transcoder.js */',\n jsContent,\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}')),\n ].join('\\n')\n\n this.workerSourceURL = URL.createObjectURL(new Blob([body]))\n this.transcoderBinary = binaryContent\n })\n }\n\n return this.transcoderPending\n }\n\n _allocateWorker(taskCost) {\n return this._initTranscoder().then(() => {\n if (this.workerPool.length < this.workerLimit) {\n const worker = new Worker(this.workerSourceURL)\n\n worker._callbacks = {}\n worker._taskLoad = 0\n\n worker.postMessage({\n type: 'init',\n config: this.workerConfig,\n transcoderBinary: this.transcoderBinary,\n })\n\n worker.onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'transcode':\n worker._callbacks[message.id].resolve(message)\n break\n\n case 'error':\n worker._callbacks[message.id].reject(message)\n break\n\n default:\n console.error('THREE.BasisTextureLoader: Unexpected message, \"' + message.type + '\"')\n }\n }\n\n this.workerPool.push(worker)\n } else {\n this.workerPool.sort(function (a, b) {\n return a._taskLoad > b._taskLoad ? -1 : 1\n })\n }\n\n const worker = this.workerPool[this.workerPool.length - 1]\n\n worker._taskLoad += taskCost\n\n return worker\n })\n }\n\n dispose() {\n for (let i = 0; i < this.workerPool.length; i++) {\n this.workerPool[i].terminate()\n }\n\n this.workerPool.length = 0\n\n return this\n }\n}\n\nexport { BasisTextureLoader }\n", "import {\n BufferAttribute,\n BufferGeometry,\n Color,\n FileLoader,\n Group,\n LineBasicMaterial,\n LineSegments,\n Loader,\n Matrix4,\n Mesh,\n MeshStandardMaterial,\n ShaderMaterial,\n UniformsLib,\n UniformsUtils,\n Vector3,\n Ray,\n REVISION,\n} from 'three'\n\n// Special surface finish tag types.\n// Note: \"MATERIAL\" tag (e.g. GLITTER, SPECKLE) is not implemented\nconst FINISH_TYPE_DEFAULT = 0\nconst FINISH_TYPE_CHROME = 1\nconst FINISH_TYPE_PEARLESCENT = 2\nconst FINISH_TYPE_RUBBER = 3\nconst FINISH_TYPE_MATTE_METALLIC = 4\nconst FINISH_TYPE_METAL = 5\n\n// State machine to search a subobject path.\n// The LDraw standard establishes these various possible subfolders.\nconst FILE_LOCATION_AS_IS = 0\nconst FILE_LOCATION_TRY_PARTS = 1\nconst FILE_LOCATION_TRY_P = 2\nconst FILE_LOCATION_TRY_MODELS = 3\nconst FILE_LOCATION_TRY_RELATIVE = 4\nconst FILE_LOCATION_TRY_ABSOLUTE = 5\nconst FILE_LOCATION_NOT_FOUND = 6\n\nconst MAIN_COLOUR_CODE = '16'\nconst MAIN_EDGE_COLOUR_CODE = '24'\n\nconst _tempVec0 = new Vector3()\nconst _tempVec1 = new Vector3()\n\nclass LDrawConditionalLineMaterial extends ShaderMaterial {\n constructor(parameters) {\n super({\n uniforms: UniformsUtils.merge([\n UniformsLib.fog,\n {\n diffuse: {\n value: new Color(),\n },\n opacity: {\n value: 1.0,\n },\n },\n ]),\n\n vertexShader: /* glsl */ `\n attribute vec3 control0;\n attribute vec3 control1;\n attribute vec3 direction;\n varying float discardFlag;\n\n #include \n #include \n #include \n #include \n #include \n\n void main() {\n #include \n\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n // Transform the line segment ends and control points into camera clip space\n vec4 c0 = projectionMatrix * modelViewMatrix * vec4(control0, 1.0);\n vec4 c1 = projectionMatrix * modelViewMatrix * vec4(control1, 1.0);\n vec4 p0 = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n vec4 p1 = projectionMatrix * modelViewMatrix * vec4(position + direction, 1.0);\n\n c0.xy /= c0.w;\n c1.xy /= c1.w;\n p0.xy /= p0.w;\n p1.xy /= p1.w;\n\n // Get the direction of the segment and an orthogonal vector\n vec2 dir = p1.xy - p0.xy;\n vec2 norm = vec2(-dir.y, dir.x);\n\n // Get control point directions from the line\n vec2 c0dir = c0.xy - p1.xy;\n vec2 c1dir = c1.xy - p1.xy;\n\n // If the vectors to the controls points are pointed in different directions away\n // from the line segment then the line should not be drawn.\n float d0 = dot(normalize(norm), normalize(c0dir));\n float d1 = dot(normalize(norm), normalize(c1dir));\n discardFlag = float(sign(d0) != sign(d1));\n\n #include \n #include \n #include \n }\n `,\n\n fragmentShader: /* glsl */ `\n uniform vec3 diffuse;\n uniform float opacity;\n varying float discardFlag;\n\n #include \n #include \n #include \n #include \n #include \n\n void main() {\n if (discardFlag > 0.5) discard;\n\n #include \n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include \n #include \n outgoingLight = diffuseColor.rgb; // simple shader\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include <${parseInt(REVISION.replace(/\\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n #include \n #include \n }\n `,\n })\n\n Object.defineProperties(this, {\n opacity: {\n get: function () {\n return this.uniforms.opacity.value\n },\n\n set: function (value) {\n this.uniforms.opacity.value = value\n },\n },\n\n color: {\n get: function () {\n return this.uniforms.diffuse.value\n },\n },\n })\n\n this.setValues(parameters)\n this.isLDrawConditionalLineMaterial = true\n }\n}\n\nclass ConditionalLineSegments extends LineSegments {\n constructor(geometry, material) {\n super(geometry, material)\n this.isConditionalLine = true\n }\n}\n\nfunction generateFaceNormals(faces) {\n for (let i = 0, l = faces.length; i < l; i++) {\n const face = faces[i]\n const vertices = face.vertices\n const v0 = vertices[0]\n const v1 = vertices[1]\n const v2 = vertices[2]\n\n _tempVec0.subVectors(v1, v0)\n _tempVec1.subVectors(v2, v1)\n face.faceNormal = new Vector3().crossVectors(_tempVec0, _tempVec1).normalize()\n }\n}\n\nconst _ray = new Ray()\nfunction smoothNormals(faces, lineSegments, checkSubSegments = false) {\n // NOTE: 1e2 is pretty coarse but was chosen to quantize the resulting value because\n // it allows edges to be smoothed as expected (see minifig arms).\n // --\n // And the vector values are initialize multiplied by 1 + 1e-10 to account for floating\n // point errors on vertices along quantization boundaries. Ie after matrix multiplication\n // vertices that should be merged might be set to \"1.7\" and \"1.6999...\" meaning they won't\n // get merged. This added epsilon attempts to push these error values to the same quantized\n // value for the sake of hashing. See \"AT-ST mini\" dishes. See mrdoob/three#23169.\n\n const hashMultiplier = (1 + 1e-10) * 1e2\n function hashVertex(v) {\n const x = ~~(v.x * hashMultiplier)\n const y = ~~(v.y * hashMultiplier)\n const z = ~~(v.z * hashMultiplier)\n\n return `${x},${y},${z}`\n }\n\n function hashEdge(v0, v1) {\n return `${hashVertex(v0)}_${hashVertex(v1)}`\n }\n\n // converts the two vertices to a ray with a normalized direction and origin of 0, 0, 0 projected\n // onto the original line.\n function toNormalizedRay(v0, v1, targetRay) {\n targetRay.direction.subVectors(v1, v0).normalize()\n\n const scalar = v0.dot(targetRay.direction)\n targetRay.origin.copy(v0).addScaledVector(targetRay.direction, -scalar)\n\n return targetRay\n }\n\n function hashRay(ray) {\n return hashEdge(ray.origin, ray.direction)\n }\n\n const hardEdges = new Set()\n const hardEdgeRays = new Map()\n const halfEdgeList = {}\n const normals = []\n\n // Save the list of hard edges by hash\n for (let i = 0, l = lineSegments.length; i < l; i++) {\n const ls = lineSegments[i]\n const vertices = ls.vertices\n const v0 = vertices[0]\n const v1 = vertices[1]\n hardEdges.add(hashEdge(v0, v1))\n hardEdges.add(hashEdge(v1, v0))\n\n // only generate the hard edge ray map if we're checking subsegments because it's more expensive to check\n // and requires more memory.\n if (checkSubSegments) {\n // add both ray directions to the map\n const ray = toNormalizedRay(v0, v1, new Ray())\n const rh1 = hashRay(ray)\n if (!hardEdgeRays.has(rh1)) {\n toNormalizedRay(v1, v0, ray)\n const rh2 = hashRay(ray)\n\n const info = {\n ray,\n distances: [],\n }\n\n hardEdgeRays.set(rh1, info)\n hardEdgeRays.set(rh2, info)\n }\n\n // store both segments ends in min, max order in the distances array to check if a face edge is a\n // subsegment later.\n const info = hardEdgeRays.get(rh1)\n let d0 = info.ray.direction.dot(v0)\n let d1 = info.ray.direction.dot(v1)\n if (d0 > d1) {\n ;[d0, d1] = [d1, d0]\n }\n\n info.distances.push(d0, d1)\n }\n }\n\n // track the half edges associated with each triangle\n for (let i = 0, l = faces.length; i < l; i++) {\n const tri = faces[i]\n const vertices = tri.vertices\n const vertCount = vertices.length\n for (let i2 = 0; i2 < vertCount; i2++) {\n const index = i2\n const next = (i2 + 1) % vertCount\n const v0 = vertices[index]\n const v1 = vertices[next]\n const hash = hashEdge(v0, v1)\n\n // don't add the triangle if the edge is supposed to be hard\n if (hardEdges.has(hash)) {\n continue\n }\n\n // if checking subsegments then check to see if this edge lies on a hard edge ray and whether its within any ray bounds\n if (checkSubSegments) {\n toNormalizedRay(v0, v1, _ray)\n\n const rayHash = hashRay(_ray)\n if (hardEdgeRays.has(rayHash)) {\n const info = hardEdgeRays.get(rayHash)\n const { ray, distances } = info\n let d0 = ray.direction.dot(v0)\n let d1 = ray.direction.dot(v1)\n\n if (d0 > d1) {\n ;[d0, d1] = [d1, d0]\n }\n\n // return early if the face edge is found to be a subsegment of a line edge meaning the edge will have \"hard\" normals\n let found = false\n for (let i = 0, l = distances.length; i < l; i += 2) {\n if (d0 >= distances[i] && d1 <= distances[i + 1]) {\n found = true\n break\n }\n }\n\n if (found) {\n continue\n }\n }\n }\n\n const info = {\n index: index,\n tri: tri,\n }\n halfEdgeList[hash] = info\n }\n }\n\n // Iterate until we've tried to connect all faces to share normals\n while (true) {\n // Stop if there are no more faces left\n let halfEdge = null\n for (const key in halfEdgeList) {\n halfEdge = halfEdgeList[key]\n break\n }\n\n if (halfEdge === null) {\n break\n }\n\n // Exhaustively find all connected faces\n const queue = [halfEdge]\n while (queue.length > 0) {\n // initialize all vertex normals in this triangle\n const tri = queue.pop().tri\n const vertices = tri.vertices\n const vertNormals = tri.normals\n const faceNormal = tri.faceNormal\n\n // Check if any edge is connected to another triangle edge\n const vertCount = vertices.length\n for (let i2 = 0; i2 < vertCount; i2++) {\n const index = i2\n const next = (i2 + 1) % vertCount\n const v0 = vertices[index]\n const v1 = vertices[next]\n\n // delete this triangle from the list so it won't be found again\n const hash = hashEdge(v0, v1)\n delete halfEdgeList[hash]\n\n const reverseHash = hashEdge(v1, v0)\n const otherInfo = halfEdgeList[reverseHash]\n if (otherInfo) {\n const otherTri = otherInfo.tri\n const otherIndex = otherInfo.index\n const otherNormals = otherTri.normals\n const otherVertCount = otherNormals.length\n const otherFaceNormal = otherTri.faceNormal\n\n // NOTE: If the angle between faces is > 67.5 degrees then assume it's\n // hard edge. There are some cases where the line segments do not line up exactly\n // with or span multiple triangle edges (see Lunar Vehicle wheels).\n if (Math.abs(otherTri.faceNormal.dot(tri.faceNormal)) < 0.25) {\n continue\n }\n\n // if this triangle has already been traversed then it won't be in\n // the halfEdgeList. If it has not then add it to the queue and delete\n // it so it won't be found again.\n if (reverseHash in halfEdgeList) {\n queue.push(otherInfo)\n delete halfEdgeList[reverseHash]\n }\n\n // share the first normal\n const otherNext = (otherIndex + 1) % otherVertCount\n if (vertNormals[index] && otherNormals[otherNext] && vertNormals[index] !== otherNormals[otherNext]) {\n otherNormals[otherNext].norm.add(vertNormals[index].norm)\n vertNormals[index].norm = otherNormals[otherNext].norm\n }\n\n let sharedNormal1 = vertNormals[index] || otherNormals[otherNext]\n if (sharedNormal1 === null) {\n // it's possible to encounter an edge of a triangle that has already been traversed meaning\n // both edges already have different normals defined and shared. To work around this we create\n // a wrapper object so when those edges are merged the normals can be updated everywhere.\n sharedNormal1 = { norm: new Vector3() }\n normals.push(sharedNormal1.norm)\n }\n\n if (vertNormals[index] === null) {\n vertNormals[index] = sharedNormal1\n sharedNormal1.norm.add(faceNormal)\n }\n\n if (otherNormals[otherNext] === null) {\n otherNormals[otherNext] = sharedNormal1\n sharedNormal1.norm.add(otherFaceNormal)\n }\n\n // share the second normal\n if (vertNormals[next] && otherNormals[otherIndex] && vertNormals[next] !== otherNormals[otherIndex]) {\n otherNormals[otherIndex].norm.add(vertNormals[next].norm)\n vertNormals[next].norm = otherNormals[otherIndex].norm\n }\n\n let sharedNormal2 = vertNormals[next] || otherNormals[otherIndex]\n if (sharedNormal2 === null) {\n sharedNormal2 = { norm: new Vector3() }\n normals.push(sharedNormal2.norm)\n }\n\n if (vertNormals[next] === null) {\n vertNormals[next] = sharedNormal2\n sharedNormal2.norm.add(faceNormal)\n }\n\n if (otherNormals[otherIndex] === null) {\n otherNormals[otherIndex] = sharedNormal2\n sharedNormal2.norm.add(otherFaceNormal)\n }\n }\n }\n }\n }\n\n // The normals of each face have been added up so now we average them by normalizing the vector.\n for (let i = 0, l = normals.length; i < l; i++) {\n normals[i].normalize()\n }\n}\n\nfunction isPartType(type) {\n return type === 'Part' || type === 'Unofficial_Part'\n}\n\nfunction isPrimitiveType(type) {\n return /primitive/i.test(type) || type === 'Subpart'\n}\n\nclass LineParser {\n constructor(line, lineNumber) {\n this.line = line\n this.lineLength = line.length\n this.currentCharIndex = 0\n this.currentChar = ' '\n this.lineNumber = lineNumber\n }\n\n seekNonSpace() {\n while (this.currentCharIndex < this.lineLength) {\n this.currentChar = this.line.charAt(this.currentCharIndex)\n\n if (this.currentChar !== ' ' && this.currentChar !== '\\t') {\n return\n }\n\n this.currentCharIndex++\n }\n }\n\n getToken() {\n const pos0 = this.currentCharIndex++\n\n // Seek space\n while (this.currentCharIndex < this.lineLength) {\n this.currentChar = this.line.charAt(this.currentCharIndex)\n\n if (this.currentChar === ' ' || this.currentChar === '\\t') {\n break\n }\n\n this.currentCharIndex++\n }\n\n const pos1 = this.currentCharIndex\n\n this.seekNonSpace()\n\n return this.line.substring(pos0, pos1)\n }\n\n getVector() {\n return new Vector3(parseFloat(this.getToken()), parseFloat(this.getToken()), parseFloat(this.getToken()))\n }\n\n getRemainingString() {\n return this.line.substring(this.currentCharIndex, this.lineLength)\n }\n\n isAtTheEnd() {\n return this.currentCharIndex >= this.lineLength\n }\n\n setToEnd() {\n this.currentCharIndex = this.lineLength\n }\n\n getLineNumberString() {\n return this.lineNumber >= 0 ? ' at line ' + this.lineNumber : ''\n }\n}\n\n// Fetches and parses an intermediate representation of LDraw parts files.\nclass LDrawParsedCache {\n constructor(loader) {\n this.loader = loader\n this._cache = {}\n }\n\n cloneResult(original) {\n const result = {}\n\n // vertices are transformed and normals computed before being converted to geometry\n // so these pieces must be cloned.\n result.faces = original.faces.map((face) => {\n return {\n colorCode: face.colorCode,\n material: face.material,\n vertices: face.vertices.map((v) => v.clone()),\n normals: face.normals.map(() => null),\n faceNormal: null,\n }\n })\n\n result.conditionalSegments = original.conditionalSegments.map((face) => {\n return {\n colorCode: face.colorCode,\n material: face.material,\n vertices: face.vertices.map((v) => v.clone()),\n controlPoints: face.controlPoints.map((v) => v.clone()),\n }\n })\n\n result.lineSegments = original.lineSegments.map((face) => {\n return {\n colorCode: face.colorCode,\n material: face.material,\n vertices: face.vertices.map((v) => v.clone()),\n }\n })\n\n // none if this is subsequently modified\n result.type = original.type\n result.category = original.category\n result.keywords = original.keywords\n result.subobjects = original.subobjects\n result.totalFaces = original.totalFaces\n result.startingConstructionStep = original.startingConstructionStep\n result.materials = original.materials\n result.group = null\n return result\n }\n\n async fetchData(fileName) {\n let triedLowerCase = false\n let locationState = FILE_LOCATION_AS_IS\n while (locationState !== FILE_LOCATION_NOT_FOUND) {\n let subobjectURL = fileName\n switch (locationState) {\n case FILE_LOCATION_AS_IS:\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_PARTS:\n subobjectURL = 'parts/' + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_P:\n subobjectURL = 'p/' + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_MODELS:\n subobjectURL = 'models/' + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_RELATIVE:\n subobjectURL = fileName.substring(0, fileName.lastIndexOf('/') + 1) + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_ABSOLUTE:\n if (triedLowerCase) {\n // Try absolute path\n locationState = FILE_LOCATION_NOT_FOUND\n } else {\n // Next attempt is lower case\n fileName = fileName.toLowerCase()\n subobjectURL = fileName\n triedLowerCase = true\n locationState = FILE_LOCATION_AS_IS\n }\n\n break\n }\n\n const loader = this.loader\n const fileLoader = new FileLoader(loader.manager)\n fileLoader.setPath(loader.partsLibraryPath)\n fileLoader.setRequestHeader(loader.requestHeader)\n fileLoader.setWithCredentials(loader.withCredentials)\n\n try {\n const text = await fileLoader.loadAsync(subobjectURL)\n return text\n } catch {\n continue\n }\n }\n\n throw new Error('LDrawLoader: Subobject \"' + fileName + '\" could not be loaded.')\n }\n\n parse(text, fileName = null) {\n const loader = this.loader\n\n // final results\n const faces = []\n const lineSegments = []\n const conditionalSegments = []\n const subobjects = []\n const materials = {}\n\n const getLocalMaterial = (colorCode) => {\n return materials[colorCode] || null\n }\n\n let type = 'Model'\n let category = null\n let keywords = null\n let totalFaces = 0\n\n // split into lines\n if (text.indexOf('\\r\\n') !== -1) {\n // This is faster than String.split with regex that splits on both\n text = text.replace(/\\r\\n/g, '\\n')\n }\n\n const lines = text.split('\\n')\n const numLines = lines.length\n\n let parsingEmbeddedFiles = false\n let currentEmbeddedFileName = null\n let currentEmbeddedText = null\n\n let bfcCertified = false\n let bfcCCW = true\n let bfcInverted = false\n let bfcCull = true\n\n let startingConstructionStep = false\n\n // Parse all line commands\n for (let lineIndex = 0; lineIndex < numLines; lineIndex++) {\n const line = lines[lineIndex]\n\n if (line.length === 0) continue\n\n if (parsingEmbeddedFiles) {\n if (line.startsWith('0 FILE ')) {\n // Save previous embedded file in the cache\n this.setData(currentEmbeddedFileName, currentEmbeddedText)\n\n // New embedded text file\n currentEmbeddedFileName = line.substring(7)\n currentEmbeddedText = ''\n } else {\n currentEmbeddedText += line + '\\n'\n }\n\n continue\n }\n\n const lp = new LineParser(line, lineIndex + 1)\n lp.seekNonSpace()\n\n if (lp.isAtTheEnd()) {\n // Empty line\n continue\n }\n\n // Parse the line type\n const lineType = lp.getToken()\n\n let material\n let colorCode\n let segment\n let ccw\n let doubleSided\n let v0, v1, v2, v3, c0, c1\n\n switch (lineType) {\n // Line type 0: Comment or META\n case '0':\n // Parse meta directive\n const meta = lp.getToken()\n\n if (meta) {\n switch (meta) {\n case '!LDRAW_ORG':\n type = lp.getToken()\n break\n\n case '!COLOUR':\n material = loader.parseColorMetaDirective(lp)\n if (material) {\n materials[material.userData.code] = material\n } else {\n console.warn('LDrawLoader: Error parsing material' + lp.getLineNumberString())\n }\n\n break\n\n case '!CATEGORY':\n category = lp.getToken()\n break\n\n case '!KEYWORDS':\n const newKeywords = lp.getRemainingString().split(',')\n if (newKeywords.length > 0) {\n if (!keywords) {\n keywords = []\n }\n\n newKeywords.forEach(function (keyword) {\n keywords.push(keyword.trim())\n })\n }\n\n break\n\n case 'FILE':\n if (lineIndex > 0) {\n // Start embedded text files parsing\n parsingEmbeddedFiles = true\n currentEmbeddedFileName = lp.getRemainingString()\n currentEmbeddedText = ''\n\n bfcCertified = false\n bfcCCW = true\n }\n\n break\n\n case 'BFC':\n // Changes to the backface culling state\n while (!lp.isAtTheEnd()) {\n const token = lp.getToken()\n\n switch (token) {\n case 'CERTIFY':\n case 'NOCERTIFY':\n bfcCertified = token === 'CERTIFY'\n bfcCCW = true\n\n break\n\n case 'CW':\n case 'CCW':\n bfcCCW = token === 'CCW'\n\n break\n\n case 'INVERTNEXT':\n bfcInverted = true\n\n break\n\n case 'CLIP':\n case 'NOCLIP':\n bfcCull = token === 'CLIP'\n\n break\n\n default:\n console.warn('THREE.LDrawLoader: BFC directive \"' + token + '\" is unknown.')\n\n break\n }\n }\n\n break\n\n case 'STEP':\n startingConstructionStep = true\n\n break\n\n default:\n // Other meta directives are not implemented\n break\n }\n }\n\n break\n\n // Line type 1: Sub-object file\n case '1':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n\n const posX = parseFloat(lp.getToken())\n const posY = parseFloat(lp.getToken())\n const posZ = parseFloat(lp.getToken())\n const m0 = parseFloat(lp.getToken())\n const m1 = parseFloat(lp.getToken())\n const m2 = parseFloat(lp.getToken())\n const m3 = parseFloat(lp.getToken())\n const m4 = parseFloat(lp.getToken())\n const m5 = parseFloat(lp.getToken())\n const m6 = parseFloat(lp.getToken())\n const m7 = parseFloat(lp.getToken())\n const m8 = parseFloat(lp.getToken())\n\n const matrix = new Matrix4().set(m0, m1, m2, posX, m3, m4, m5, posY, m6, m7, m8, posZ, 0, 0, 0, 1)\n\n let fileName = lp.getRemainingString().trim().replace(/\\\\/g, '/')\n\n if (loader.fileMap[fileName]) {\n // Found the subobject path in the preloaded file path map\n fileName = loader.fileMap[fileName]\n } else {\n // Standardized subfolders\n if (fileName.startsWith('s/')) {\n fileName = 'parts/' + fileName\n } else if (fileName.startsWith('48/')) {\n fileName = 'p/' + fileName\n }\n }\n\n subobjects.push({\n material: material,\n colorCode: colorCode,\n matrix: matrix,\n fileName: fileName,\n inverted: bfcInverted,\n startingConstructionStep: startingConstructionStep,\n })\n\n bfcInverted = false\n\n break\n\n // Line type 2: Line segment\n case '2':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n v0 = lp.getVector()\n v1 = lp.getVector()\n\n segment = {\n material: material,\n colorCode: colorCode,\n vertices: [v0, v1],\n }\n\n lineSegments.push(segment)\n\n break\n\n // Line type 5: Conditional Line segment\n case '5':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n v0 = lp.getVector()\n v1 = lp.getVector()\n c0 = lp.getVector()\n c1 = lp.getVector()\n\n segment = {\n material: material,\n colorCode: colorCode,\n vertices: [v0, v1],\n controlPoints: [c0, c1],\n }\n\n conditionalSegments.push(segment)\n\n break\n\n // Line type 3: Triangle\n case '3':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n ccw = bfcCCW\n doubleSided = !bfcCertified || !bfcCull\n\n if (ccw === true) {\n v0 = lp.getVector()\n v1 = lp.getVector()\n v2 = lp.getVector()\n } else {\n v2 = lp.getVector()\n v1 = lp.getVector()\n v0 = lp.getVector()\n }\n\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v0, v1, v2],\n normals: [null, null, null],\n })\n totalFaces++\n\n if (doubleSided === true) {\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v2, v1, v0],\n normals: [null, null, null],\n })\n totalFaces++\n }\n\n break\n\n // Line type 4: Quadrilateral\n case '4':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n ccw = bfcCCW\n doubleSided = !bfcCertified || !bfcCull\n\n if (ccw === true) {\n v0 = lp.getVector()\n v1 = lp.getVector()\n v2 = lp.getVector()\n v3 = lp.getVector()\n } else {\n v3 = lp.getVector()\n v2 = lp.getVector()\n v1 = lp.getVector()\n v0 = lp.getVector()\n }\n\n // specifically place the triangle diagonal in the v0 and v1 slots so we can\n // account for the doubling of vertices later when smoothing normals.\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v0, v1, v2, v3],\n normals: [null, null, null, null],\n })\n totalFaces += 2\n\n if (doubleSided === true) {\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v3, v2, v1, v0],\n normals: [null, null, null, null],\n })\n totalFaces += 2\n }\n\n break\n\n default:\n throw new Error('LDrawLoader: Unknown line type \"' + lineType + '\"' + lp.getLineNumberString() + '.')\n }\n }\n\n if (parsingEmbeddedFiles) {\n this.setData(currentEmbeddedFileName, currentEmbeddedText)\n }\n\n return {\n faces,\n conditionalSegments,\n lineSegments,\n type,\n category,\n keywords,\n subobjects,\n totalFaces,\n startingConstructionStep,\n materials,\n fileName,\n group: null,\n }\n }\n\n // returns an (optionally cloned) instance of the data\n getData(fileName, clone = true) {\n const key = fileName.toLowerCase()\n const result = this._cache[key]\n if (result === null || result instanceof Promise) {\n return null\n }\n\n if (clone) {\n return this.cloneResult(result)\n } else {\n return result\n }\n }\n\n // kicks off a fetch and parse of the requested data if it hasn't already been loaded. Returns when\n // the data is ready to use and can be retrieved synchronously with \"getData\".\n async ensureDataLoaded(fileName) {\n const key = fileName.toLowerCase()\n if (!(key in this._cache)) {\n // replace the promise with a copy of the parsed data for immediate processing\n this._cache[key] = this.fetchData(fileName).then((text) => {\n const info = this.parse(text, fileName)\n this._cache[key] = info\n return info\n })\n }\n\n await this._cache[key]\n }\n\n // sets the data in the cache from parsed data\n setData(fileName, text) {\n const key = fileName.toLowerCase()\n this._cache[key] = this.parse(text, fileName)\n }\n}\n\n// returns the material for an associated color code. If the color code is 16 for a face or 24 for\n// an edge then the passthroughColorCode is used.\nfunction getMaterialFromCode(colorCode, parentColorCode, materialHierarchy, forEdge) {\n const isPassthrough = (!forEdge && colorCode === MAIN_COLOUR_CODE) || (forEdge && colorCode === MAIN_EDGE_COLOUR_CODE)\n if (isPassthrough) {\n colorCode = parentColorCode\n }\n\n return materialHierarchy[colorCode] || null\n}\n\n// Class used to parse and build LDraw parts as three.js objects and cache them if they're a \"Part\" type.\nclass LDrawPartsGeometryCache {\n constructor(loader) {\n this.loader = loader\n this.parseCache = new LDrawParsedCache(loader)\n this._cache = {}\n }\n\n // Convert the given file information into a mesh by processing subobjects.\n async processIntoMesh(info) {\n const loader = this.loader\n const parseCache = this.parseCache\n const faceMaterials = new Set()\n\n // Processes the part subobject information to load child parts and merge geometry onto part\n // piece object.\n const processInfoSubobjects = async (info, subobject = null) => {\n const subobjects = info.subobjects\n const promises = []\n\n // Trigger load of all subobjects. If a subobject isn't a primitive then load it as a separate\n // group which lets instruction steps apply correctly.\n for (let i = 0, l = subobjects.length; i < l; i++) {\n const subobject = subobjects[i]\n const promise = parseCache.ensureDataLoaded(subobject.fileName).then(() => {\n const subobjectInfo = parseCache.getData(subobject.fileName, false)\n if (!isPrimitiveType(subobjectInfo.type)) {\n return this.loadModel(subobject.fileName).catch((error) => {\n console.warn(error)\n return null\n })\n }\n\n return processInfoSubobjects(parseCache.getData(subobject.fileName), subobject)\n })\n\n promises.push(promise)\n }\n\n const group = new Group()\n group.userData.category = info.category\n group.userData.keywords = info.keywords\n info.group = group\n\n const subobjectInfos = await Promise.all(promises)\n for (let i = 0, l = subobjectInfos.length; i < l; i++) {\n const subobject = info.subobjects[i]\n const subobjectInfo = subobjectInfos[i]\n\n if (subobjectInfo === null) {\n // the subobject failed to load\n continue\n }\n\n // if the subobject was loaded as a separate group then apply the parent scopes materials\n if (subobjectInfo.isGroup) {\n const subobjectGroup = subobjectInfo\n subobject.matrix.decompose(subobjectGroup.position, subobjectGroup.quaternion, subobjectGroup.scale)\n subobjectGroup.userData.startingConstructionStep = subobject.startingConstructionStep\n subobjectGroup.name = subobject.fileName\n\n loader.applyMaterialsToMesh(subobjectGroup, subobject.colorCode, info.materials)\n\n group.add(subobjectGroup)\n continue\n }\n\n // add the subobject group if it has children in case it has both children and primitives\n if (subobjectInfo.group.children.length) {\n group.add(subobjectInfo.group)\n }\n\n // transform the primitives into the local space of the parent piece and append them to\n // to the parent primitives list.\n const parentLineSegments = info.lineSegments\n const parentConditionalSegments = info.conditionalSegments\n const parentFaces = info.faces\n\n const lineSegments = subobjectInfo.lineSegments\n const conditionalSegments = subobjectInfo.conditionalSegments\n\n const faces = subobjectInfo.faces\n const matrix = subobject.matrix\n const inverted = subobject.inverted\n const matrixScaleInverted = matrix.determinant() < 0\n const colorCode = subobject.colorCode\n\n const lineColorCode = colorCode === MAIN_COLOUR_CODE ? MAIN_EDGE_COLOUR_CODE : colorCode\n for (let i = 0, l = lineSegments.length; i < l; i++) {\n const ls = lineSegments[i]\n const vertices = ls.vertices\n vertices[0].applyMatrix4(matrix)\n vertices[1].applyMatrix4(matrix)\n ls.colorCode = ls.colorCode === MAIN_EDGE_COLOUR_CODE ? lineColorCode : ls.colorCode\n ls.material = ls.material || getMaterialFromCode(ls.colorCode, ls.colorCode, info.materials, true)\n\n parentLineSegments.push(ls)\n }\n\n for (let i = 0, l = conditionalSegments.length; i < l; i++) {\n const os = conditionalSegments[i]\n const vertices = os.vertices\n const controlPoints = os.controlPoints\n vertices[0].applyMatrix4(matrix)\n vertices[1].applyMatrix4(matrix)\n controlPoints[0].applyMatrix4(matrix)\n controlPoints[1].applyMatrix4(matrix)\n os.colorCode = os.colorCode === MAIN_EDGE_COLOUR_CODE ? lineColorCode : os.colorCode\n os.material = os.material || getMaterialFromCode(os.colorCode, os.colorCode, info.materials, true)\n\n parentConditionalSegments.push(os)\n }\n\n for (let i = 0, l = faces.length; i < l; i++) {\n const tri = faces[i]\n const vertices = tri.vertices\n for (let i = 0, l = vertices.length; i < l; i++) {\n vertices[i].applyMatrix4(matrix)\n }\n\n tri.colorCode = tri.colorCode === MAIN_COLOUR_CODE ? colorCode : tri.colorCode\n tri.material = tri.material || getMaterialFromCode(tri.colorCode, colorCode, info.materials, false)\n faceMaterials.add(tri.colorCode)\n\n // If the scale of the object is negated then the triangle winding order\n // needs to be flipped.\n if (matrixScaleInverted !== inverted) {\n vertices.reverse()\n }\n\n parentFaces.push(tri)\n }\n\n info.totalFaces += subobjectInfo.totalFaces\n }\n\n // Apply the parent subobjects pass through material code to this object. This is done several times due\n // to material scoping.\n if (subobject) {\n loader.applyMaterialsToMesh(group, subobject.colorCode, info.materials)\n }\n\n return info\n }\n\n // Track material use to see if we need to use the normal smooth slow path for hard edges.\n for (let i = 0, l = info.faces; i < l; i++) {\n faceMaterials.add(info.faces[i].colorCode)\n }\n\n await processInfoSubobjects(info)\n\n if (loader.smoothNormals) {\n const checkSubSegments = faceMaterials.size > 1\n generateFaceNormals(info.faces)\n smoothNormals(info.faces, info.lineSegments, checkSubSegments)\n }\n\n // Add the primitive objects and metadata.\n const group = info.group\n if (info.faces.length > 0) {\n group.add(createObject(info.faces, 3, false, info.totalFaces))\n }\n\n if (info.lineSegments.length > 0) {\n group.add(createObject(info.lineSegments, 2))\n }\n\n if (info.conditionalSegments.length > 0) {\n group.add(createObject(info.conditionalSegments, 2, true))\n }\n\n return group\n }\n\n hasCachedModel(fileName) {\n return fileName !== null && fileName.toLowerCase() in this._cache\n }\n\n async getCachedModel(fileName) {\n if (fileName !== null && this.hasCachedModel(fileName)) {\n const key = fileName.toLowerCase()\n const group = await this._cache[key]\n return group.clone()\n } else {\n return null\n }\n }\n\n // Loads and parses the model with the given file name. Returns a cached copy if available.\n async loadModel(fileName) {\n const parseCache = this.parseCache\n const key = fileName.toLowerCase()\n if (this.hasCachedModel(fileName)) {\n // Return cached model if available.\n return this.getCachedModel(fileName)\n } else {\n // Otherwise parse a new model.\n // Ensure the file data is loaded and pre parsed.\n await parseCache.ensureDataLoaded(fileName)\n\n const info = parseCache.getData(fileName)\n const promise = this.processIntoMesh(info)\n\n // Now that the file has loaded it's possible that another part parse has been waiting in parallel\n // so check the cache again to see if it's been added since the last async operation so we don't\n // do unnecessary work.\n if (this.hasCachedModel(fileName)) {\n return this.getCachedModel(fileName)\n }\n\n // Cache object if it's a part so it can be reused later.\n if (isPartType(info.type)) {\n this._cache[key] = promise\n }\n\n // return a copy\n const group = await promise\n return group.clone()\n }\n }\n\n // parses the given model text into a renderable object. Returns cached copy if available.\n async parseModel(text) {\n const parseCache = this.parseCache\n const info = parseCache.parse(text)\n if (isPartType(info.type) && this.hasCachedModel(info.fileName)) {\n return this.getCachedModel(info.fileName)\n }\n\n return this.processIntoMesh(info)\n }\n}\n\nfunction sortByMaterial(a, b) {\n if (a.colorCode === b.colorCode) {\n return 0\n }\n\n if (a.colorCode < b.colorCode) {\n return -1\n }\n\n return 1\n}\n\nfunction createObject(elements, elementSize, isConditionalSegments = false, totalElements = null) {\n // Creates a LineSegments (elementSize = 2) or a Mesh (elementSize = 3 )\n // With per face / segment material, implemented with mesh groups and materials array\n\n // Sort the faces or line segments by color code to make later the mesh groups\n elements.sort(sortByMaterial)\n\n if (totalElements === null) {\n totalElements = elements.length\n }\n\n const positions = new Float32Array(elementSize * totalElements * 3)\n const normals = elementSize === 3 ? new Float32Array(elementSize * totalElements * 3) : null\n const materials = []\n\n const quadArray = new Array(6)\n const bufferGeometry = new BufferGeometry()\n let prevMaterial = null\n let index0 = 0\n let numGroupVerts = 0\n let offset = 0\n\n for (let iElem = 0, nElem = elements.length; iElem < nElem; iElem++) {\n const elem = elements[iElem]\n let vertices = elem.vertices\n if (vertices.length === 4) {\n quadArray[0] = vertices[0]\n quadArray[1] = vertices[1]\n quadArray[2] = vertices[2]\n quadArray[3] = vertices[0]\n quadArray[4] = vertices[2]\n quadArray[5] = vertices[3]\n vertices = quadArray\n }\n\n for (let j = 0, l = vertices.length; j < l; j++) {\n const v = vertices[j]\n const index = offset + j * 3\n positions[index + 0] = v.x\n positions[index + 1] = v.y\n positions[index + 2] = v.z\n }\n\n // create the normals array if this is a set of faces\n if (elementSize === 3) {\n if (!elem.faceNormal) {\n const v0 = vertices[0]\n const v1 = vertices[1]\n const v2 = vertices[2]\n _tempVec0.subVectors(v1, v0)\n _tempVec1.subVectors(v2, v1)\n elem.faceNormal = new Vector3().crossVectors(_tempVec0, _tempVec1).normalize()\n }\n\n let elemNormals = elem.normals\n if (elemNormals.length === 4) {\n quadArray[0] = elemNormals[0]\n quadArray[1] = elemNormals[1]\n quadArray[2] = elemNormals[2]\n quadArray[3] = elemNormals[0]\n quadArray[4] = elemNormals[2]\n quadArray[5] = elemNormals[3]\n elemNormals = quadArray\n }\n\n for (let j = 0, l = elemNormals.length; j < l; j++) {\n // use face normal if a vertex normal is not provided\n let n = elem.faceNormal\n if (elemNormals[j]) {\n n = elemNormals[j].norm\n }\n\n const index = offset + j * 3\n normals[index + 0] = n.x\n normals[index + 1] = n.y\n normals[index + 2] = n.z\n }\n }\n\n if (prevMaterial !== elem.colorCode) {\n if (prevMaterial !== null) {\n bufferGeometry.addGroup(index0, numGroupVerts, materials.length - 1)\n }\n\n const material = elem.material\n if (material !== null) {\n if (elementSize === 3) {\n materials.push(material)\n } else if (elementSize === 2) {\n if (material !== null) {\n if (isConditionalSegments) {\n materials.push(material.userData.edgeMaterial.userData.conditionalEdgeMaterial)\n } else {\n materials.push(material.userData.edgeMaterial)\n }\n } else {\n materials.push(null)\n }\n }\n } else {\n // If a material has not been made available yet then keep the color code string in the material array\n // to save the spot for the material once a parent scopes materials are being applied to the object.\n materials.push(elem.colorCode)\n }\n\n prevMaterial = elem.colorCode\n index0 = offset / 3\n numGroupVerts = vertices.length\n } else {\n numGroupVerts += vertices.length\n }\n\n offset += 3 * vertices.length\n }\n\n if (numGroupVerts > 0) {\n bufferGeometry.addGroup(index0, Infinity, materials.length - 1)\n }\n\n bufferGeometry.setAttribute('position', new BufferAttribute(positions, 3))\n\n if (normals !== null) {\n bufferGeometry.setAttribute('normal', new BufferAttribute(normals, 3))\n }\n\n let object3d = null\n\n if (elementSize === 2) {\n if (isConditionalSegments) {\n object3d = new ConditionalLineSegments(bufferGeometry, materials.length === 1 ? materials[0] : materials)\n } else {\n object3d = new LineSegments(bufferGeometry, materials.length === 1 ? materials[0] : materials)\n }\n } else if (elementSize === 3) {\n object3d = new Mesh(bufferGeometry, materials.length === 1 ? materials[0] : materials)\n }\n\n if (isConditionalSegments) {\n object3d.isConditionalLine = true\n\n const controlArray0 = new Float32Array(elements.length * 3 * 2)\n const controlArray1 = new Float32Array(elements.length * 3 * 2)\n const directionArray = new Float32Array(elements.length * 3 * 2)\n for (let i = 0, l = elements.length; i < l; i++) {\n const os = elements[i]\n const vertices = os.vertices\n const controlPoints = os.controlPoints\n const c0 = controlPoints[0]\n const c1 = controlPoints[1]\n const v0 = vertices[0]\n const v1 = vertices[1]\n const index = i * 3 * 2\n controlArray0[index + 0] = c0.x\n controlArray0[index + 1] = c0.y\n controlArray0[index + 2] = c0.z\n controlArray0[index + 3] = c0.x\n controlArray0[index + 4] = c0.y\n controlArray0[index + 5] = c0.z\n\n controlArray1[index + 0] = c1.x\n controlArray1[index + 1] = c1.y\n controlArray1[index + 2] = c1.z\n controlArray1[index + 3] = c1.x\n controlArray1[index + 4] = c1.y\n controlArray1[index + 5] = c1.z\n\n directionArray[index + 0] = v1.x - v0.x\n directionArray[index + 1] = v1.y - v0.y\n directionArray[index + 2] = v1.z - v0.z\n directionArray[index + 3] = v1.x - v0.x\n directionArray[index + 4] = v1.y - v0.y\n directionArray[index + 5] = v1.z - v0.z\n }\n\n bufferGeometry.setAttribute('control0', new BufferAttribute(controlArray0, 3, false))\n bufferGeometry.setAttribute('control1', new BufferAttribute(controlArray1, 3, false))\n bufferGeometry.setAttribute('direction', new BufferAttribute(directionArray, 3, false))\n }\n\n return object3d\n}\n\n//\n\nclass LDrawLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n // Array of THREE.Material\n this.materials = []\n this.materialLibrary = {}\n\n // This also allows to handle the embedded text files (\"0 FILE\" lines)\n this.partsCache = new LDrawPartsGeometryCache(this)\n\n // This object is a map from file names to paths. It agilizes the paths search. If it is not set then files will be searched by trial and error.\n this.fileMap = {}\n\n // Initializes the materials library with default materials\n this.setMaterials([])\n\n // If this flag is set to true the vertex normals will be smoothed.\n this.smoothNormals = true\n\n // The path to load parts from the LDraw parts library from.\n this.partsLibraryPath = ''\n }\n\n setPartsLibraryPath(path) {\n this.partsLibraryPath = path\n return this\n }\n\n async preloadMaterials(url) {\n const fileLoader = new FileLoader(this.manager)\n fileLoader.setPath(this.path)\n fileLoader.setRequestHeader(this.requestHeader)\n fileLoader.setWithCredentials(this.withCredentials)\n\n const text = await fileLoader.loadAsync(url)\n const colorLineRegex = /^0 !COLOUR/\n const lines = text.split(/[\\n\\r]/g)\n const materials = []\n for (let i = 0, l = lines.length; i < l; i++) {\n const line = lines[i]\n if (colorLineRegex.test(line)) {\n const directive = line.replace(colorLineRegex, '')\n const material = this.parseColorMetaDirective(new LineParser(directive))\n materials.push(material)\n }\n }\n\n this.setMaterials(materials)\n }\n\n load(url, onLoad, onProgress, onError) {\n const fileLoader = new FileLoader(this.manager)\n fileLoader.setPath(this.path)\n fileLoader.setRequestHeader(this.requestHeader)\n fileLoader.setWithCredentials(this.withCredentials)\n fileLoader.load(\n url,\n (text) => {\n this.partsCache\n .parseModel(text, this.materialLibrary)\n .then((group) => {\n this.applyMaterialsToMesh(group, MAIN_COLOUR_CODE, this.materialLibrary, true)\n this.computeConstructionSteps(group)\n onLoad(group)\n })\n .catch(onError)\n },\n onProgress,\n onError,\n )\n }\n\n parse(text, onLoad) {\n this.partsCache.parseModel(text, this.materialLibrary).then((group) => {\n this.computeConstructionSteps(group)\n onLoad(group)\n })\n }\n\n setMaterials(materials) {\n this.materialLibrary = {}\n this.materials = []\n for (let i = 0, l = materials.length; i < l; i++) {\n this.addMaterial(materials[i])\n }\n\n // Add default main triangle and line edge materials (used in pieces that can be colored with a main color)\n this.addMaterial(this.parseColorMetaDirective(new LineParser('Main_Colour CODE 16 VALUE #FF8080 EDGE #333333')))\n this.addMaterial(this.parseColorMetaDirective(new LineParser('Edge_Colour CODE 24 VALUE #A0A0A0 EDGE #333333')))\n\n return this\n }\n\n setFileMap(fileMap) {\n this.fileMap = fileMap\n\n return this\n }\n\n addMaterial(material) {\n // Adds a material to the material library which is on top of the parse scopes stack. And also to the materials array\n\n const matLib = this.materialLibrary\n if (!matLib[material.userData.code]) {\n this.materials.push(material)\n matLib[material.userData.code] = material\n }\n\n return this\n }\n\n getMaterial(colorCode) {\n if (colorCode.startsWith('0x2')) {\n // Special 'direct' material value (RGB color)\n const color = colorCode.substring(3)\n\n return this.parseColorMetaDirective(\n new LineParser('Direct_Color_' + color + ' CODE -1 VALUE #' + color + ' EDGE #' + color + ''),\n )\n }\n\n return this.materialLibrary[colorCode] || null\n }\n\n // Applies the appropriate materials to a prebuilt hierarchy of geometry. Assumes that color codes are present\n // in the material array if they need to be filled in.\n applyMaterialsToMesh(group, parentColorCode, materialHierarchy, finalMaterialPass = false) {\n // find any missing materials as indicated by a color code string and replace it with a material from the current material lib\n const loader = this\n const parentIsPassthrough = parentColorCode === MAIN_COLOUR_CODE\n group.traverse((c) => {\n if (c.isMesh || c.isLineSegments) {\n if (Array.isArray(c.material)) {\n for (let i = 0, l = c.material.length; i < l; i++) {\n if (!c.material[i].isMaterial) {\n c.material[i] = getMaterial(c, c.material[i])\n }\n }\n } else if (!c.material.isMaterial) {\n c.material = getMaterial(c, c.material)\n }\n }\n })\n\n // Returns the appropriate material for the object (line or face) given color code. If the code is \"pass through\"\n // (24 for lines, 16 for edges) then the pass through color code is used. If that is also pass through then it's\n // simply returned for the subsequent material application.\n function getMaterial(c, colorCode) {\n // if our parent is a passthrough color code and we don't have the current material color available then\n // return early.\n if (parentIsPassthrough && !(colorCode in materialHierarchy) && !finalMaterialPass) {\n return colorCode\n }\n\n const forEdge = c.isLineSegments || c.isConditionalLine\n const isPassthrough =\n (!forEdge && colorCode === MAIN_COLOUR_CODE) || (forEdge && colorCode === MAIN_EDGE_COLOUR_CODE)\n if (isPassthrough) {\n colorCode = parentColorCode\n }\n\n let material = null\n if (colorCode in materialHierarchy) {\n material = materialHierarchy[colorCode]\n } else if (finalMaterialPass) {\n // see if we can get the final material from from the \"getMaterial\" function which will attempt to\n // parse the \"direct\" colors\n material = loader.getMaterial(colorCode)\n if (material === null) {\n // otherwise throw an error if this is final opportunity to set the material\n throw new Error(`LDrawLoader: Material properties for code ${colorCode} not available.`)\n }\n } else {\n return colorCode\n }\n\n if (c.isLineSegments) {\n material = material.userData.edgeMaterial\n\n if (c.isConditionalLine) {\n material = material.userData.conditionalEdgeMaterial\n }\n }\n\n return material\n }\n }\n\n getMainMaterial() {\n return this.getMaterial(MAIN_COLOUR_CODE)\n }\n\n getMainEdgeMaterial() {\n return this.getMaterial(MAIN_EDGE_COLOUR_CODE)\n }\n\n parseColorMetaDirective(lineParser) {\n // Parses a color definition and returns a THREE.Material\n\n let code = null\n\n // Triangle and line colors\n let color = 0xff00ff\n let edgeColor = 0xff00ff\n\n // Transparency\n let alpha = 1\n let isTransparent = false\n // Self-illumination:\n let luminance = 0\n\n let finishType = FINISH_TYPE_DEFAULT\n\n let edgeMaterial = null\n\n const name = lineParser.getToken()\n if (!name) {\n throw new Error(\n 'LDrawLoader: Material name was expected after \"!COLOUR tag' + lineParser.getLineNumberString() + '.',\n )\n }\n\n // Parse tag tokens and their parameters\n let token = null\n while (true) {\n token = lineParser.getToken()\n\n if (!token) {\n break\n }\n\n switch (token.toUpperCase()) {\n case 'CODE':\n code = lineParser.getToken()\n break\n\n case 'VALUE':\n color = lineParser.getToken()\n if (color.startsWith('0x')) {\n color = '#' + color.substring(2)\n } else if (!color.startsWith('#')) {\n throw new Error(\n 'LDrawLoader: Invalid color while parsing material' + lineParser.getLineNumberString() + '.',\n )\n }\n\n break\n\n case 'EDGE':\n edgeColor = lineParser.getToken()\n if (edgeColor.startsWith('0x')) {\n edgeColor = '#' + edgeColor.substring(2)\n } else if (!edgeColor.startsWith('#')) {\n // Try to see if edge color is a color code\n edgeMaterial = this.getMaterial(edgeColor)\n if (!edgeMaterial) {\n throw new Error(\n 'LDrawLoader: Invalid edge color while parsing material' + lineParser.getLineNumberString() + '.',\n )\n }\n\n // Get the edge material for this triangle material\n edgeMaterial = edgeMaterial.userData.edgeMaterial\n }\n\n break\n\n case 'ALPHA':\n alpha = parseInt(lineParser.getToken())\n\n if (isNaN(alpha)) {\n throw new Error(\n 'LDrawLoader: Invalid alpha value in material definition' + lineParser.getLineNumberString() + '.',\n )\n }\n\n alpha = Math.max(0, Math.min(1, alpha / 255))\n\n if (alpha < 1) {\n isTransparent = true\n }\n\n break\n\n case 'LUMINANCE':\n luminance = parseInt(lineParser.getToken())\n\n if (isNaN(luminance)) {\n throw new Error(\n 'LDrawLoader: Invalid luminance value in material definition' + LineParser.getLineNumberString() + '.',\n )\n }\n\n luminance = Math.max(0, Math.min(1, luminance / 255))\n\n break\n\n case 'CHROME':\n finishType = FINISH_TYPE_CHROME\n break\n\n case 'PEARLESCENT':\n finishType = FINISH_TYPE_PEARLESCENT\n break\n\n case 'RUBBER':\n finishType = FINISH_TYPE_RUBBER\n break\n\n case 'MATTE_METALLIC':\n finishType = FINISH_TYPE_MATTE_METALLIC\n break\n\n case 'METAL':\n finishType = FINISH_TYPE_METAL\n break\n\n case 'MATERIAL':\n // Not implemented\n lineParser.setToEnd()\n break\n\n default:\n throw new Error(\n 'LDrawLoader: Unknown token \"' +\n token +\n '\" while parsing material' +\n lineParser.getLineNumberString() +\n '.',\n )\n }\n }\n\n let material = null\n\n switch (finishType) {\n case FINISH_TYPE_DEFAULT:\n material = new MeshStandardMaterial({ color: color, roughness: 0.3, metalness: 0 })\n break\n\n case FINISH_TYPE_PEARLESCENT:\n // Try to imitate pearlescency by making the surface glossy\n material = new MeshStandardMaterial({ color: color, roughness: 0.3, metalness: 0.25 })\n break\n\n case FINISH_TYPE_CHROME:\n // Mirror finish surface\n material = new MeshStandardMaterial({ color: color, roughness: 0, metalness: 1 })\n break\n\n case FINISH_TYPE_RUBBER:\n // Rubber finish\n material = new MeshStandardMaterial({ color: color, roughness: 0.9, metalness: 0 })\n break\n\n case FINISH_TYPE_MATTE_METALLIC:\n // Brushed metal finish\n material = new MeshStandardMaterial({ color: color, roughness: 0.8, metalness: 0.4 })\n break\n\n case FINISH_TYPE_METAL:\n // Average metal finish\n material = new MeshStandardMaterial({ color: color, roughness: 0.2, metalness: 0.85 })\n break\n\n default:\n // Should not happen\n break\n }\n\n material.transparent = isTransparent\n material.premultipliedAlpha = true\n material.opacity = alpha\n material.depthWrite = !isTransparent\n\n material.polygonOffset = true\n material.polygonOffsetFactor = 1\n\n if (luminance !== 0) {\n material.emissive.set(material.color).multiplyScalar(luminance)\n }\n\n if (!edgeMaterial) {\n // This is the material used for edges\n edgeMaterial = new LineBasicMaterial({\n color: edgeColor,\n transparent: isTransparent,\n opacity: alpha,\n depthWrite: !isTransparent,\n })\n edgeMaterial.userData.code = code\n edgeMaterial.name = name + ' - Edge'\n\n // This is the material used for conditional edges\n edgeMaterial.userData.conditionalEdgeMaterial = new LDrawConditionalLineMaterial({\n fog: true,\n transparent: isTransparent,\n depthWrite: !isTransparent,\n color: edgeColor,\n opacity: alpha,\n })\n }\n\n material.userData.code = code\n material.name = name\n\n material.userData.edgeMaterial = edgeMaterial\n\n this.addMaterial(material)\n\n return material\n }\n\n computeConstructionSteps(model) {\n // Sets userdata.constructionStep number in Group objects and userData.numConstructionSteps number in the root Group object.\n\n let stepNumber = 0\n\n model.traverse((c) => {\n if (c.isGroup) {\n if (c.userData.startingConstructionStep) {\n stepNumber++\n }\n\n c.userData.constructionStep = stepNumber\n }\n })\n\n model.userData.numConstructionSteps = stepNumber + 1\n }\n}\n\nexport { LDrawLoader }\n", "import {\n BufferGeometry,\n FileLoader,\n Float32BufferAttribute,\n Group,\n LineBasicMaterial,\n LineSegments,\n Loader,\n Material,\n Mesh,\n MeshPhongMaterial,\n Points,\n PointsMaterial,\n Vector3,\n} from 'three'\n\n// o object_name | g group_name\nconst _object_pattern = /^[og]\\s*(.+)?/\n// mtllib file_reference\nconst _material_library_pattern = /^mtllib /\n// usemtl material_name\nconst _material_use_pattern = /^usemtl /\n// usemap map_name\nconst _map_use_pattern = /^usemap /\n\nconst _vA = new Vector3()\nconst _vB = new Vector3()\nconst _vC = new Vector3()\n\nconst _ab = new Vector3()\nconst _cb = new Vector3()\n\nfunction ParserState() {\n const state = {\n objects: [],\n object: {},\n\n vertices: [],\n normals: [],\n colors: [],\n uvs: [],\n\n materials: {},\n materialLibraries: [],\n\n startObject: function (name, fromDeclaration) {\n // If the current object (initial from reset) is not from a g/o declaration in the parsed\n // file. We need to use it for the first parsed g/o to keep things in sync.\n if (this.object && this.object.fromDeclaration === false) {\n this.object.name = name\n this.object.fromDeclaration = fromDeclaration !== false\n return\n }\n\n const previousMaterial =\n this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined\n\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true)\n }\n\n this.object = {\n name: name || '',\n fromDeclaration: fromDeclaration !== false,\n\n geometry: {\n vertices: [],\n normals: [],\n colors: [],\n uvs: [],\n hasUVIndices: false,\n },\n materials: [],\n smooth: true,\n\n startMaterial: function (name, libraries) {\n const previous = this._finalize(false)\n\n // New usemtl declaration overwrites an inherited material, except if faces were declared\n // after the material, then it must be preserved for proper MultiMaterial continuation.\n if (previous && (previous.inherited || previous.groupCount <= 0)) {\n this.materials.splice(previous.index, 1)\n }\n\n const material = {\n index: this.materials.length,\n name: name || '',\n mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : '',\n smooth: previous !== undefined ? previous.smooth : this.smooth,\n groupStart: previous !== undefined ? previous.groupEnd : 0,\n groupEnd: -1,\n groupCount: -1,\n inherited: false,\n\n clone: function (index) {\n const cloned = {\n index: typeof index === 'number' ? index : this.index,\n name: this.name,\n mtllib: this.mtllib,\n smooth: this.smooth,\n groupStart: 0,\n groupEnd: -1,\n groupCount: -1,\n inherited: false,\n }\n cloned.clone = this.clone.bind(cloned)\n return cloned\n },\n }\n\n this.materials.push(material)\n\n return material\n },\n\n currentMaterial: function () {\n if (this.materials.length > 0) {\n return this.materials[this.materials.length - 1]\n }\n\n return undefined\n },\n\n _finalize: function (end) {\n const lastMultiMaterial = this.currentMaterial()\n if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {\n lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3\n lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart\n lastMultiMaterial.inherited = false\n }\n\n // Ignore objects tail materials if no face declarations followed them before a new o/g started.\n if (end && this.materials.length > 1) {\n for (let mi = this.materials.length - 1; mi >= 0; mi--) {\n if (this.materials[mi].groupCount <= 0) {\n this.materials.splice(mi, 1)\n }\n }\n }\n\n // Guarantee at least one empty material, this makes the creation later more straight forward.\n if (end && this.materials.length === 0) {\n this.materials.push({\n name: '',\n smooth: this.smooth,\n })\n }\n\n return lastMultiMaterial\n },\n }\n\n // Inherit previous objects material.\n // Spec tells us that a declared material must be set to all objects until a new material is declared.\n // If a usemtl declaration is encountered while this new object is being parsed, it will\n // overwrite the inherited material. Exception being that there was already face declarations\n // to the inherited material, then it will be preserved for proper MultiMaterial continuation.\n\n if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {\n const declared = previousMaterial.clone(0)\n declared.inherited = true\n this.object.materials.push(declared)\n }\n\n this.objects.push(this.object)\n },\n\n finalize: function () {\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true)\n }\n },\n\n parseVertexIndex: function (value, len) {\n const index = parseInt(value, 10)\n return (index >= 0 ? index - 1 : index + len / 3) * 3\n },\n\n parseNormalIndex: function (value, len) {\n const index = parseInt(value, 10)\n return (index >= 0 ? index - 1 : index + len / 3) * 3\n },\n\n parseUVIndex: function (value, len) {\n const index = parseInt(value, 10)\n return (index >= 0 ? index - 1 : index + len / 2) * 2\n },\n\n addVertex: function (a, b, c) {\n const src = this.vertices\n const dst = this.object.geometry.vertices\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n dst.push(src[b + 0], src[b + 1], src[b + 2])\n dst.push(src[c + 0], src[c + 1], src[c + 2])\n },\n\n addVertexPoint: function (a) {\n const src = this.vertices\n const dst = this.object.geometry.vertices\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n },\n\n addVertexLine: function (a) {\n const src = this.vertices\n const dst = this.object.geometry.vertices\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n },\n\n addNormal: function (a, b, c) {\n const src = this.normals\n const dst = this.object.geometry.normals\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n dst.push(src[b + 0], src[b + 1], src[b + 2])\n dst.push(src[c + 0], src[c + 1], src[c + 2])\n },\n\n addFaceNormal: function (a, b, c) {\n const src = this.vertices\n const dst = this.object.geometry.normals\n\n _vA.fromArray(src, a)\n _vB.fromArray(src, b)\n _vC.fromArray(src, c)\n\n _cb.subVectors(_vC, _vB)\n _ab.subVectors(_vA, _vB)\n _cb.cross(_ab)\n\n _cb.normalize()\n\n dst.push(_cb.x, _cb.y, _cb.z)\n dst.push(_cb.x, _cb.y, _cb.z)\n dst.push(_cb.x, _cb.y, _cb.z)\n },\n\n addColor: function (a, b, c) {\n const src = this.colors\n const dst = this.object.geometry.colors\n\n if (src[a] !== undefined) dst.push(src[a + 0], src[a + 1], src[a + 2])\n if (src[b] !== undefined) dst.push(src[b + 0], src[b + 1], src[b + 2])\n if (src[c] !== undefined) dst.push(src[c + 0], src[c + 1], src[c + 2])\n },\n\n addUV: function (a, b, c) {\n const src = this.uvs\n const dst = this.object.geometry.uvs\n\n dst.push(src[a + 0], src[a + 1])\n dst.push(src[b + 0], src[b + 1])\n dst.push(src[c + 0], src[c + 1])\n },\n\n addDefaultUV: function () {\n const dst = this.object.geometry.uvs\n\n dst.push(0, 0)\n dst.push(0, 0)\n dst.push(0, 0)\n },\n\n addUVLine: function (a) {\n const src = this.uvs\n const dst = this.object.geometry.uvs\n\n dst.push(src[a + 0], src[a + 1])\n },\n\n addFace: function (a, b, c, ua, ub, uc, na, nb, nc) {\n const vLen = this.vertices.length\n\n let ia = this.parseVertexIndex(a, vLen)\n let ib = this.parseVertexIndex(b, vLen)\n let ic = this.parseVertexIndex(c, vLen)\n\n this.addVertex(ia, ib, ic)\n this.addColor(ia, ib, ic)\n\n // normals\n\n if (na !== undefined && na !== '') {\n const nLen = this.normals.length\n\n ia = this.parseNormalIndex(na, nLen)\n ib = this.parseNormalIndex(nb, nLen)\n ic = this.parseNormalIndex(nc, nLen)\n\n this.addNormal(ia, ib, ic)\n } else {\n this.addFaceNormal(ia, ib, ic)\n }\n\n // uvs\n\n if (ua !== undefined && ua !== '') {\n const uvLen = this.uvs.length\n\n ia = this.parseUVIndex(ua, uvLen)\n ib = this.parseUVIndex(ub, uvLen)\n ic = this.parseUVIndex(uc, uvLen)\n\n this.addUV(ia, ib, ic)\n\n this.object.geometry.hasUVIndices = true\n } else {\n // add placeholder values (for inconsistent face definitions)\n\n this.addDefaultUV()\n }\n },\n\n addPointGeometry: function (vertices) {\n this.object.geometry.type = 'Points'\n\n const vLen = this.vertices.length\n\n for (let vi = 0, l = vertices.length; vi < l; vi++) {\n const index = this.parseVertexIndex(vertices[vi], vLen)\n\n this.addVertexPoint(index)\n this.addColor(index)\n }\n },\n\n addLineGeometry: function (vertices, uvs) {\n this.object.geometry.type = 'Line'\n\n const vLen = this.vertices.length\n const uvLen = this.uvs.length\n\n for (let vi = 0, l = vertices.length; vi < l; vi++) {\n this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen))\n }\n\n for (let uvi = 0, l = uvs.length; uvi < l; uvi++) {\n this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen))\n }\n },\n }\n\n state.startObject('', false)\n\n return state\n}\n\n//\n\nclass OBJLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n this.materials = null\n }\n\n load(url, onLoad, onProgress, onError) {\n const scope = this\n\n const loader = new FileLoader(this.manager)\n loader.setPath(this.path)\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n loader.load(\n url,\n function (text) {\n try {\n onLoad(scope.parse(text))\n } catch (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n scope.manager.itemError(url)\n }\n },\n onProgress,\n onError,\n )\n }\n\n setMaterials(materials) {\n this.materials = materials\n\n return this\n }\n\n parse(text) {\n const state = new ParserState()\n\n if (text.indexOf('\\r\\n') !== -1) {\n // This is faster than String.split with regex that splits on both\n text = text.replace(/\\r\\n/g, '\\n')\n }\n\n if (text.indexOf('\\\\\\n') !== -1) {\n // join lines separated by a line continuation character (\\)\n text = text.replace(/\\\\\\n/g, '')\n }\n\n const lines = text.split('\\n')\n let line = '',\n lineFirstChar = ''\n let lineLength = 0\n let result = []\n\n // Faster to just trim left side of the line. Use if available.\n const trimLeft = typeof ''.trimLeft === 'function'\n\n for (let i = 0, l = lines.length; i < l; i++) {\n line = lines[i]\n\n line = trimLeft ? line.trimLeft() : line.trim()\n\n lineLength = line.length\n\n if (lineLength === 0) continue\n\n lineFirstChar = line.charAt(0)\n\n // @todo invoke passed in handler if any\n if (lineFirstChar === '#') continue\n\n if (lineFirstChar === 'v') {\n const data = line.split(/\\s+/)\n\n switch (data[0]) {\n case 'v':\n state.vertices.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]))\n if (data.length >= 7) {\n state.colors.push(parseFloat(data[4]), parseFloat(data[5]), parseFloat(data[6]))\n } else {\n // if no colors are defined, add placeholders so color and vertex indices match\n\n state.colors.push(undefined, undefined, undefined)\n }\n\n break\n case 'vn':\n state.normals.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]))\n break\n case 'vt':\n state.uvs.push(parseFloat(data[1]), parseFloat(data[2]))\n break\n }\n } else if (lineFirstChar === 'f') {\n const lineData = line.substr(1).trim()\n const vertexData = lineData.split(/\\s+/)\n const faceVertices = []\n\n // Parse the face vertex data into an easy to work with format\n\n for (let j = 0, jl = vertexData.length; j < jl; j++) {\n const vertex = vertexData[j]\n\n if (vertex.length > 0) {\n const vertexParts = vertex.split('/')\n faceVertices.push(vertexParts)\n }\n }\n\n // Draw an edge between the first vertex and all subsequent vertices to form an n-gon\n\n const v1 = faceVertices[0]\n\n for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) {\n const v2 = faceVertices[j]\n const v3 = faceVertices[j + 1]\n\n state.addFace(v1[0], v2[0], v3[0], v1[1], v2[1], v3[1], v1[2], v2[2], v3[2])\n }\n } else if (lineFirstChar === 'l') {\n const lineParts = line.substring(1).trim().split(' ')\n let lineVertices = []\n const lineUVs = []\n\n if (line.indexOf('/') === -1) {\n lineVertices = lineParts\n } else {\n for (let li = 0, llen = lineParts.length; li < llen; li++) {\n const parts = lineParts[li].split('/')\n\n if (parts[0] !== '') lineVertices.push(parts[0])\n if (parts[1] !== '') lineUVs.push(parts[1])\n }\n }\n\n state.addLineGeometry(lineVertices, lineUVs)\n } else if (lineFirstChar === 'p') {\n const lineData = line.substr(1).trim()\n const pointData = lineData.split(' ')\n\n state.addPointGeometry(pointData)\n } else if ((result = _object_pattern.exec(line)) !== null) {\n // o object_name\n // or\n // g group_name\n\n // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869\n // let name = result[ 0 ].substr( 1 ).trim();\n const name = (' ' + result[0].substr(1).trim()).substr(1)\n\n state.startObject(name)\n } else if (_material_use_pattern.test(line)) {\n // material\n\n state.object.startMaterial(line.substring(7).trim(), state.materialLibraries)\n } else if (_material_library_pattern.test(line)) {\n // mtl file\n\n state.materialLibraries.push(line.substring(7).trim())\n } else if (_map_use_pattern.test(line)) {\n // the line is parsed but ignored since the loader assumes textures are defined MTL files\n // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method)\n\n console.warn(\n 'THREE.OBJLoader: Rendering identifier \"usemap\" not supported. Textures must be defined in MTL files.',\n )\n } else if (lineFirstChar === 's') {\n result = line.split(' ')\n\n // smooth shading\n\n // @todo Handle files that have varying smooth values for a set of faces inside one geometry,\n // but does not define a usemtl for each face set.\n // This should be detected and a dummy material created (later MultiMaterial and geometry groups).\n // This requires some care to not create extra material on each smooth value for \"normal\" obj files.\n // where explicit usemtl defines geometry groups.\n // Example asset: examples/models/obj/cerberus/Cerberus.obj\n\n /*\n * http://paulbourke.net/dataformats/obj/\n * or\n * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf\n *\n * From chapter \"Grouping\" Syntax explanation \"s group_number\":\n * \"group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.\n * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form\n * surfaces, smoothing groups are either turned on or off; there is no difference between values greater\n * than 0.\"\n */\n if (result.length > 1) {\n const value = result[1].trim().toLowerCase()\n state.object.smooth = value !== '0' && value !== 'off'\n } else {\n // ZBrush can produce \"s\" lines #11707\n state.object.smooth = true\n }\n\n const material = state.object.currentMaterial()\n if (material) material.smooth = state.object.smooth\n } else {\n // Handle null terminated files without exception\n if (line === '\\0') continue\n\n console.warn('THREE.OBJLoader: Unexpected line: \"' + line + '\"')\n }\n }\n\n state.finalize()\n\n const container = new Group()\n container.materialLibraries = [].concat(state.materialLibraries)\n\n const hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0)\n\n if (hasPrimitives === true) {\n for (let i = 0, l = state.objects.length; i < l; i++) {\n const object = state.objects[i]\n const geometry = object.geometry\n const materials = object.materials\n const isLine = geometry.type === 'Line'\n const isPoints = geometry.type === 'Points'\n let hasVertexColors = false\n\n // Skip o/g line declarations that did not follow with any faces\n if (geometry.vertices.length === 0) continue\n\n const buffergeometry = new BufferGeometry()\n\n buffergeometry.setAttribute('position', new Float32BufferAttribute(geometry.vertices, 3))\n\n if (geometry.normals.length > 0) {\n buffergeometry.setAttribute('normal', new Float32BufferAttribute(geometry.normals, 3))\n }\n\n if (geometry.colors.length > 0) {\n hasVertexColors = true\n buffergeometry.setAttribute('color', new Float32BufferAttribute(geometry.colors, 3))\n }\n\n if (geometry.hasUVIndices === true) {\n buffergeometry.setAttribute('uv', new Float32BufferAttribute(geometry.uvs, 2))\n }\n\n // Create materials\n\n const createdMaterials = []\n\n for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {\n const sourceMaterial = materials[mi]\n const materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors\n let material = state.materials[materialHash]\n\n if (this.materials !== null) {\n material = this.materials.create(sourceMaterial.name)\n\n // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.\n if (isLine && material && !(material instanceof LineBasicMaterial)) {\n const materialLine = new LineBasicMaterial()\n Material.prototype.copy.call(materialLine, material)\n materialLine.color.copy(material.color)\n material = materialLine\n } else if (isPoints && material && !(material instanceof PointsMaterial)) {\n const materialPoints = new PointsMaterial({ size: 10, sizeAttenuation: false })\n Material.prototype.copy.call(materialPoints, material)\n materialPoints.color.copy(material.color)\n materialPoints.map = material.map\n material = materialPoints\n }\n }\n\n if (material === undefined) {\n if (isLine) {\n material = new LineBasicMaterial()\n } else if (isPoints) {\n material = new PointsMaterial({ size: 1, sizeAttenuation: false })\n } else {\n material = new MeshPhongMaterial()\n }\n\n material.name = sourceMaterial.name\n material.flatShading = sourceMaterial.smooth ? false : true\n material.vertexColors = hasVertexColors\n\n state.materials[materialHash] = material\n }\n\n createdMaterials.push(material)\n }\n\n // Create mesh\n\n let mesh\n\n if (createdMaterials.length > 1) {\n for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {\n const sourceMaterial = materials[mi]\n buffergeometry.addGroup(sourceMaterial.groupStart, sourceMaterial.groupCount, mi)\n }\n\n if (isLine) {\n mesh = new LineSegments(buffergeometry, createdMaterials)\n } else if (isPoints) {\n mesh = new Points(buffergeometry, createdMaterials)\n } else {\n mesh = new Mesh(buffergeometry, createdMaterials)\n }\n } else {\n if (isLine) {\n mesh = new LineSegments(buffergeometry, createdMaterials[0])\n } else if (isPoints) {\n mesh = new Points(buffergeometry, createdMaterials[0])\n } else {\n mesh = new Mesh(buffergeometry, createdMaterials[0])\n }\n }\n\n mesh.name = object.name\n\n container.add(mesh)\n }\n } else {\n // if there is only the default parser state object with no geometry data, interpret data as point cloud\n\n if (state.vertices.length > 0) {\n const material = new PointsMaterial({ size: 1, sizeAttenuation: false })\n\n const buffergeometry = new BufferGeometry()\n\n buffergeometry.setAttribute('position', new Float32BufferAttribute(state.vertices, 3))\n\n if (state.colors.length > 0 && state.colors[0] !== undefined) {\n buffergeometry.setAttribute('color', new Float32BufferAttribute(state.colors, 3))\n material.vertexColors = true\n }\n\n const points = new Points(buffergeometry, material)\n container.add(points)\n }\n }\n\n return container\n }\n}\n\nexport { OBJLoader }\n", "import { CompressedTextureLoader } from 'three'\n\n/**\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\n *\n * ported from https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.khronosTextureContainer.ts\n */\n\nclass KTXLoader extends CompressedTextureLoader {\n constructor(manager) {\n super(manager)\n }\n\n parse(buffer, loadMipmaps) {\n const ktx = new KhronosTextureContainer(buffer, 1)\n\n return {\n mipmaps: ktx.mipmaps(loadMipmaps),\n width: ktx.pixelWidth,\n height: ktx.pixelHeight,\n format: ktx.glInternalFormat,\n isCubemap: ktx.numberOfFaces === 6,\n mipmapCount: ktx.numberOfMipmapLevels,\n }\n }\n}\n\nconst HEADER_LEN = 12 + 13 * 4 // identifier + header elements (not including key value meta-data pairs)\n// load types\nconst COMPRESSED_2D = 0 // uses a gl.compressedTexImage2D()\n//const COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\n//const TEX_2D = 2; // uses a gl.texImage2D()\n//const TEX_3D = 3; // uses a gl.texImage3D()\n\nclass KhronosTextureContainer {\n /**\n * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file\n * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or\n * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented\n * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented\n */\n constructor(arrayBuffer, facesExpected /*, threeDExpected, textureArrayExpected */) {\n this.arrayBuffer = arrayBuffer\n\n // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is:\n // '´', 'K', 'T', 'X', ' ', '1', '1', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A\n const identifier = new Uint8Array(this.arrayBuffer, 0, 12)\n if (\n identifier[0] !== 0xab ||\n identifier[1] !== 0x4b ||\n identifier[2] !== 0x54 ||\n identifier[3] !== 0x58 ||\n identifier[4] !== 0x20 ||\n identifier[5] !== 0x31 ||\n identifier[6] !== 0x31 ||\n identifier[7] !== 0xbb ||\n identifier[8] !== 0x0d ||\n identifier[9] !== 0x0a ||\n identifier[10] !== 0x1a ||\n identifier[11] !== 0x0a\n ) {\n console.error('texture missing KTX identifier')\n return\n }\n\n // load the reset of the header in native 32 bit uint\n const dataSize = Uint32Array.BYTES_PER_ELEMENT\n const headerDataView = new DataView(this.arrayBuffer, 12, 13 * dataSize)\n const endianness = headerDataView.getUint32(0, true)\n const littleEndian = endianness === 0x04030201\n\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian) // must be 0 for compressed textures\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian) // must be 1 for compressed textures\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian) // must be 0 for compressed textures\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian) // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian) // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian) // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian) // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian) // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian) // used for texture arrays\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian) // used for cubemap textures, should either be 1 or 6\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian) // number of levels; disregard possibility of 0 for compressed textures\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian) // the amount of space after the header for meta-data\n\n // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing.\n if (this.glType !== 0) {\n console.warn('only compressed formats currently supported')\n return\n } else {\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels)\n }\n\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\n console.warn('only 2D textures currently supported')\n return\n }\n\n if (this.numberOfArrayElements !== 0) {\n console.warn('texture arrays not currently supported')\n return\n }\n\n if (this.numberOfFaces !== facesExpected) {\n console.warn('number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces)\n return\n }\n\n // we now have a completely validated file, so could use existence of loadType as success\n // would need to make this more elaborate & adjust checks above to support more than one load type\n this.loadType = COMPRESSED_2D\n }\n\n mipmaps(loadMipmaps) {\n const mipmaps = []\n\n // initialize width & height for level 1\n let dataOffset = HEADER_LEN + this.bytesOfKeyValueData\n let width = this.pixelWidth\n let height = this.pixelHeight\n const mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1\n\n for (let level = 0; level < mipmapCount; level++) {\n const imageSize = new Int32Array(this.arrayBuffer, dataOffset, 1)[0] // size per face, since not supporting array cubemaps\n dataOffset += 4 // size of the image + 4 for the imageSize field\n\n for (let face = 0; face < this.numberOfFaces; face++) {\n const byteArray = new Uint8Array(this.arrayBuffer, dataOffset, imageSize)\n\n mipmaps.push({ data: byteArray, width: width, height: height })\n\n dataOffset += imageSize\n dataOffset += 3 - ((imageSize + 3) % 4) // add padding for odd sized image\n }\n\n width = Math.max(1.0, width * 0.5)\n height = Math.max(1.0, height * 0.5)\n }\n\n return mipmaps\n }\n}\n\nexport { KTXLoader }\n", "import { BufferAttribute, BufferGeometry, FileLoader, Loader } from 'three'\n\nconst _taskCache = new WeakMap()\n\nclass DRACOLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n this.decoderPath = ''\n this.decoderConfig = {}\n this.decoderBinary = null\n this.decoderPending = null\n\n this.workerLimit = 4\n this.workerPool = []\n this.workerNextTaskID = 1\n this.workerSourceURL = ''\n\n this.defaultAttributeIDs = {\n position: 'POSITION',\n normal: 'NORMAL',\n color: 'COLOR',\n uv: 'TEX_COORD',\n }\n this.defaultAttributeTypes = {\n position: 'Float32Array',\n normal: 'Float32Array',\n color: 'Float32Array',\n uv: 'Float32Array',\n }\n }\n\n setDecoderPath(path) {\n this.decoderPath = path\n\n return this\n }\n\n setDecoderConfig(config) {\n this.decoderConfig = config\n\n return this\n }\n\n setWorkerLimit(workerLimit) {\n this.workerLimit = workerLimit\n\n return this\n }\n\n load(url, onLoad, onProgress, onError) {\n const loader = new FileLoader(this.manager)\n\n loader.setPath(this.path)\n loader.setResponseType('arraybuffer')\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n (buffer) => {\n const taskConfig = {\n attributeIDs: this.defaultAttributeIDs,\n attributeTypes: this.defaultAttributeTypes,\n useUniqueIDs: false,\n }\n\n this.decodeGeometry(buffer, taskConfig).then(onLoad).catch(onError)\n },\n onProgress,\n onError,\n )\n }\n\n /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */\n decodeDracoFile(buffer, callback, attributeIDs, attributeTypes) {\n const taskConfig = {\n attributeIDs: attributeIDs || this.defaultAttributeIDs,\n attributeTypes: attributeTypes || this.defaultAttributeTypes,\n useUniqueIDs: !!attributeIDs,\n }\n\n this.decodeGeometry(buffer, taskConfig).then(callback)\n }\n\n decodeGeometry(buffer, taskConfig) {\n // TODO: For backward-compatibility, support 'attributeTypes' objects containing\n // references (rather than names) to typed array constructors. These must be\n // serialized before sending them to the worker.\n for (const attribute in taskConfig.attributeTypes) {\n const type = taskConfig.attributeTypes[attribute]\n\n if (type.BYTES_PER_ELEMENT !== undefined) {\n taskConfig.attributeTypes[attribute] = type.name\n }\n }\n\n //\n\n const taskKey = JSON.stringify(taskConfig)\n\n // Check for an existing task using this buffer. A transferred buffer cannot be transferred\n // again from this thread.\n if (_taskCache.has(buffer)) {\n const cachedTask = _taskCache.get(buffer)\n\n if (cachedTask.key === taskKey) {\n return cachedTask.promise\n } else if (buffer.byteLength === 0) {\n // Technically, it would be possible to wait for the previous task to complete,\n // transfer the buffer back, and decode again with the second configuration. That\n // is complex, and I don't know of any reason to decode a Draco buffer twice in\n // different ways, so this is left unimplemented.\n throw new Error(\n 'THREE.DRACOLoader: Unable to re-decode a buffer with different ' +\n 'settings. Buffer has already been transferred.',\n )\n }\n }\n\n //\n\n let worker\n const taskID = this.workerNextTaskID++\n const taskCost = buffer.byteLength\n\n // Obtain a worker and assign a task, and construct a geometry instance\n // when the task completes.\n const geometryPending = this._getWorker(taskID, taskCost)\n .then((_worker) => {\n worker = _worker\n\n return new Promise((resolve, reject) => {\n worker._callbacks[taskID] = { resolve, reject }\n\n worker.postMessage({ type: 'decode', id: taskID, taskConfig, buffer }, [buffer])\n\n // this.debug();\n })\n })\n .then((message) => this._createGeometry(message.geometry))\n\n // Remove task from the task list.\n // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)\n geometryPending\n .catch(() => true)\n .then(() => {\n if (worker && taskID) {\n this._releaseTask(worker, taskID)\n\n // this.debug();\n }\n })\n\n // Cache the task result.\n _taskCache.set(buffer, {\n key: taskKey,\n promise: geometryPending,\n })\n\n return geometryPending\n }\n\n _createGeometry(geometryData) {\n const geometry = new BufferGeometry()\n\n if (geometryData.index) {\n geometry.setIndex(new BufferAttribute(geometryData.index.array, 1))\n }\n\n for (let i = 0; i < geometryData.attributes.length; i++) {\n const attribute = geometryData.attributes[i]\n const name = attribute.name\n const array = attribute.array\n const itemSize = attribute.itemSize\n\n geometry.setAttribute(name, new BufferAttribute(array, itemSize))\n }\n\n return geometry\n }\n\n _loadLibrary(url, responseType) {\n const loader = new FileLoader(this.manager)\n loader.setPath(this.decoderPath)\n loader.setResponseType(responseType)\n loader.setWithCredentials(this.withCredentials)\n\n return new Promise((resolve, reject) => {\n loader.load(url, resolve, undefined, reject)\n })\n }\n\n preload() {\n this._initDecoder()\n\n return this\n }\n\n _initDecoder() {\n if (this.decoderPending) return this.decoderPending\n\n const useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js'\n const librariesPending = []\n\n if (useJS) {\n librariesPending.push(this._loadLibrary('draco_decoder.js', 'text'))\n } else {\n librariesPending.push(this._loadLibrary('draco_wasm_wrapper.js', 'text'))\n librariesPending.push(this._loadLibrary('draco_decoder.wasm', 'arraybuffer'))\n }\n\n this.decoderPending = Promise.all(librariesPending).then((libraries) => {\n const jsContent = libraries[0]\n\n if (!useJS) {\n this.decoderConfig.wasmBinary = libraries[1]\n }\n\n const fn = DRACOWorker.toString()\n\n const body = [\n '/* draco decoder */',\n jsContent,\n '',\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}')),\n ].join('\\n')\n\n this.workerSourceURL = URL.createObjectURL(new Blob([body]))\n })\n\n return this.decoderPending\n }\n\n _getWorker(taskID, taskCost) {\n return this._initDecoder().then(() => {\n if (this.workerPool.length < this.workerLimit) {\n const worker = new Worker(this.workerSourceURL)\n\n worker._callbacks = {}\n worker._taskCosts = {}\n worker._taskLoad = 0\n\n worker.postMessage({ type: 'init', decoderConfig: this.decoderConfig })\n\n worker.onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'decode':\n worker._callbacks[message.id].resolve(message)\n break\n\n case 'error':\n worker._callbacks[message.id].reject(message)\n break\n\n default:\n console.error('THREE.DRACOLoader: Unexpected message, \"' + message.type + '\"')\n }\n }\n\n this.workerPool.push(worker)\n } else {\n this.workerPool.sort(function (a, b) {\n return a._taskLoad > b._taskLoad ? -1 : 1\n })\n }\n\n const worker = this.workerPool[this.workerPool.length - 1]\n worker._taskCosts[taskID] = taskCost\n worker._taskLoad += taskCost\n return worker\n })\n }\n\n _releaseTask(worker, taskID) {\n worker._taskLoad -= worker._taskCosts[taskID]\n delete worker._callbacks[taskID]\n delete worker._taskCosts[taskID]\n }\n\n debug() {\n console.log(\n 'Task load: ',\n this.workerPool.map((worker) => worker._taskLoad),\n )\n }\n\n dispose() {\n for (let i = 0; i < this.workerPool.length; ++i) {\n this.workerPool[i].terminate()\n }\n\n this.workerPool.length = 0\n\n return this\n }\n}\n\n/* WEB WORKER */\n\nfunction DRACOWorker() {\n let decoderConfig\n let decoderPending\n\n onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'init':\n decoderConfig = message.decoderConfig\n decoderPending = new Promise(function (resolve /*, reject*/) {\n decoderConfig.onModuleLoaded = function (draco) {\n // Module is Promise-like. Wrap before resolving to avoid loop.\n resolve({ draco: draco })\n }\n\n DracoDecoderModule(decoderConfig)\n })\n break\n\n case 'decode':\n const buffer = message.buffer\n const taskConfig = message.taskConfig\n decoderPending.then((module) => {\n const draco = module.draco\n const decoder = new draco.Decoder()\n const decoderBuffer = new draco.DecoderBuffer()\n decoderBuffer.Init(new Int8Array(buffer), buffer.byteLength)\n\n try {\n const geometry = decodeGeometry(draco, decoder, decoderBuffer, taskConfig)\n\n const buffers = geometry.attributes.map((attr) => attr.array.buffer)\n\n if (geometry.index) buffers.push(geometry.index.array.buffer)\n\n self.postMessage({ type: 'decode', id: message.id, geometry }, buffers)\n } catch (error) {\n console.error(error)\n\n self.postMessage({ type: 'error', id: message.id, error: error.message })\n } finally {\n draco.destroy(decoderBuffer)\n draco.destroy(decoder)\n }\n })\n break\n }\n }\n\n function decodeGeometry(draco, decoder, decoderBuffer, taskConfig) {\n const attributeIDs = taskConfig.attributeIDs\n const attributeTypes = taskConfig.attributeTypes\n\n let dracoGeometry\n let decodingStatus\n\n const geometryType = decoder.GetEncodedGeometryType(decoderBuffer)\n\n if (geometryType === draco.TRIANGULAR_MESH) {\n dracoGeometry = new draco.Mesh()\n decodingStatus = decoder.DecodeBufferToMesh(decoderBuffer, dracoGeometry)\n } else if (geometryType === draco.POINT_CLOUD) {\n dracoGeometry = new draco.PointCloud()\n decodingStatus = decoder.DecodeBufferToPointCloud(decoderBuffer, dracoGeometry)\n } else {\n throw new Error('THREE.DRACOLoader: Unexpected geometry type.')\n }\n\n if (!decodingStatus.ok() || dracoGeometry.ptr === 0) {\n throw new Error('THREE.DRACOLoader: Decoding failed: ' + decodingStatus.error_msg())\n }\n\n const geometry = { index: null, attributes: [] }\n\n // Gather all vertex attributes.\n for (const attributeName in attributeIDs) {\n const attributeType = self[attributeTypes[attributeName]]\n\n let attribute\n let attributeID\n\n // A Draco file may be created with default vertex attributes, whose attribute IDs\n // are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,\n // a Draco file may contain a custom set of attributes, identified by known unique\n // IDs. glTF files always do the latter, and `.drc` files typically do the former.\n if (taskConfig.useUniqueIDs) {\n attributeID = attributeIDs[attributeName]\n attribute = decoder.GetAttributeByUniqueId(dracoGeometry, attributeID)\n } else {\n attributeID = decoder.GetAttributeId(dracoGeometry, draco[attributeIDs[attributeName]])\n\n if (attributeID === -1) continue\n\n attribute = decoder.GetAttribute(dracoGeometry, attributeID)\n }\n\n geometry.attributes.push(decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute))\n }\n\n // Add index.\n if (geometryType === draco.TRIANGULAR_MESH) {\n geometry.index = decodeIndex(draco, decoder, dracoGeometry)\n }\n\n draco.destroy(dracoGeometry)\n\n return geometry\n }\n\n function decodeIndex(draco, decoder, dracoGeometry) {\n const numFaces = dracoGeometry.num_faces()\n const numIndices = numFaces * 3\n const byteLength = numIndices * 4\n\n const ptr = draco._malloc(byteLength)\n decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr)\n const index = new Uint32Array(draco.HEAPF32.buffer, ptr, numIndices).slice()\n draco._free(ptr)\n\n return { array: index, itemSize: 1 }\n }\n\n function decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute) {\n const numComponents = attribute.num_components()\n const numPoints = dracoGeometry.num_points()\n const numValues = numPoints * numComponents\n const byteLength = numValues * attributeType.BYTES_PER_ELEMENT\n const dataType = getDracoDataType(draco, attributeType)\n\n const ptr = draco._malloc(byteLength)\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, dataType, byteLength, ptr)\n const array = new attributeType(draco.HEAPF32.buffer, ptr, numValues).slice()\n draco._free(ptr)\n\n return {\n name: attributeName,\n array: array,\n itemSize: numComponents,\n }\n }\n\n function getDracoDataType(draco, attributeType) {\n switch (attributeType) {\n case Float32Array:\n return draco.DT_FLOAT32\n case Int8Array:\n return draco.DT_INT8\n case Int16Array:\n return draco.DT_INT16\n case Int32Array:\n return draco.DT_INT32\n case Uint8Array:\n return draco.DT_UINT8\n case Uint16Array:\n return draco.DT_UINT16\n case Uint32Array:\n return draco.DT_UINT32\n }\n }\n}\n\nexport { DRACOLoader }\n", "class LWO2Parser {\n constructor(IFFParser) {\n this.IFF = IFFParser\n }\n\n parseBlock() {\n this.IFF.debugger.offset = this.IFF.reader.offset\n this.IFF.debugger.closeForms()\n\n const blockID = this.IFF.reader.getIDTag()\n let length = this.IFF.reader.getUint32() // size of data in bytes\n if (length > this.IFF.reader.dv.byteLength - this.IFF.reader.offset) {\n this.IFF.reader.offset -= 4\n length = this.IFF.reader.getUint16()\n }\n\n this.IFF.debugger.dataOffset = this.IFF.reader.offset\n this.IFF.debugger.length = length\n\n // Data types may be found in either LWO2 OR LWO3 spec\n switch (blockID) {\n case 'FORM': // form blocks may consist of sub -chunks or sub-forms\n this.IFF.parseForm(length)\n break\n\n // SKIPPED CHUNKS\n // if break; is called directly, the position in the lwoTree is not created\n // any sub chunks and forms are added to the parent form instead\n // MISC skipped\n case 'ICON': // Thumbnail Icon Image\n case 'VMPA': // Vertex Map Parameter\n case 'BBOX': // bounding box\n // case 'VMMD':\n // case 'VTYP':\n\n // normal maps can be specified, normally on models imported from other applications. Currently ignored\n case 'NORM':\n\n // ENVL FORM skipped\n case 'PRE ':\n case 'POST':\n case 'KEY ':\n case 'SPAN':\n\n // CLIP FORM skipped\n case 'TIME':\n case 'CLRS':\n case 'CLRA':\n case 'FILT':\n case 'DITH':\n case 'CONT':\n case 'BRIT':\n case 'SATR':\n case 'HUE ':\n case 'GAMM':\n case 'NEGA':\n case 'IFLT':\n case 'PFLT':\n\n // Image Map Layer skipped\n case 'PROJ':\n case 'AXIS':\n case 'AAST':\n case 'PIXB':\n case 'AUVO':\n case 'STCK':\n\n // Procedural Textures skipped\n case 'PROC':\n case 'VALU':\n case 'FUNC':\n\n // Gradient Textures skipped\n case 'PNAM':\n case 'INAM':\n case 'GRST':\n case 'GREN':\n case 'GRPT':\n case 'FKEY':\n case 'IKEY':\n\n // Texture Mapping Form skipped\n case 'CSYS':\n\n // Surface CHUNKs skipped\n case 'OPAQ': // top level 'opacity' checkbox\n case 'CMAP': // clip map\n\n // Surface node CHUNKS skipped\n // These mainly specify the node editor setup in LW\n case 'NLOC':\n case 'NZOM':\n case 'NVER':\n case 'NSRV':\n case 'NVSK': // unknown\n case 'NCRD':\n case 'WRPW': // image wrap w ( for cylindrical and spherical projections)\n case 'WRPH': // image wrap h\n case 'NMOD':\n case 'NSEL':\n case 'NPRW':\n case 'NPLA':\n case 'NODS':\n case 'VERS':\n case 'ENUM':\n case 'TAG ':\n case 'OPAC':\n\n // Car Material CHUNKS\n case 'CGMD':\n case 'CGTY':\n case 'CGST':\n case 'CGEN':\n case 'CGTS':\n case 'CGTE':\n case 'OSMP':\n case 'OMDE':\n case 'OUTR':\n case 'FLAG':\n\n case 'TRNL':\n case 'GLOW':\n case 'GVAL': // glow intensity\n case 'SHRP':\n case 'RFOP':\n case 'RSAN':\n case 'TROP':\n case 'RBLR':\n case 'TBLR':\n case 'CLRH':\n case 'CLRF':\n case 'ADTR':\n case 'LINE':\n case 'ALPH':\n case 'VCOL':\n case 'ENAB':\n this.IFF.debugger.skipped = true\n this.IFF.reader.skip(length)\n break\n\n case 'SURF':\n this.IFF.parseSurfaceLwo2(length)\n break\n\n case 'CLIP':\n this.IFF.parseClipLwo2(length)\n break\n\n // Texture node chunks (not in spec)\n case 'IPIX': // usePixelBlending\n case 'IMIP': // useMipMaps\n case 'IMOD': // imageBlendingMode\n case 'AMOD': // unknown\n case 'IINV': // imageInvertAlpha\n case 'INCR': // imageInvertColor\n case 'IAXS': // imageAxis ( for non-UV maps)\n case 'IFOT': // imageFallofType\n case 'ITIM': // timing for animated textures\n case 'IWRL':\n case 'IUTI':\n case 'IINX':\n case 'IINY':\n case 'IINZ':\n case 'IREF': // possibly a VX for reused texture nodes\n if (length === 4) this.IFF.currentNode[blockID] = this.IFF.reader.getInt32()\n else this.IFF.reader.skip(length)\n break\n\n case 'OTAG':\n this.IFF.parseObjectTag()\n break\n\n case 'LAYR':\n this.IFF.parseLayer(length)\n break\n\n case 'PNTS':\n this.IFF.parsePoints(length)\n break\n\n case 'VMAP':\n this.IFF.parseVertexMapping(length)\n break\n\n case 'AUVU':\n case 'AUVN':\n this.IFF.reader.skip(length - 1)\n this.IFF.reader.getVariableLengthIndex() // VX\n break\n\n case 'POLS':\n this.IFF.parsePolygonList(length)\n break\n\n case 'TAGS':\n this.IFF.parseTagStrings(length)\n break\n\n case 'PTAG':\n this.IFF.parsePolygonTagMapping(length)\n break\n\n case 'VMAD':\n this.IFF.parseVertexMapping(length, true)\n break\n\n // Misc CHUNKS\n case 'DESC': // Description Line\n this.IFF.currentForm.description = this.IFF.reader.getString()\n break\n\n case 'TEXT':\n case 'CMNT':\n case 'NCOM':\n this.IFF.currentForm.comment = this.IFF.reader.getString()\n break\n\n // Envelope Form\n case 'NAME':\n this.IFF.currentForm.channelName = this.IFF.reader.getString()\n break\n\n // Image Map Layer\n case 'WRAP':\n this.IFF.currentForm.wrap = { w: this.IFF.reader.getUint16(), h: this.IFF.reader.getUint16() }\n break\n\n case 'IMAG':\n const index = this.IFF.reader.getVariableLengthIndex()\n this.IFF.currentForm.imageIndex = index\n break\n\n // Texture Mapping Form\n case 'OREF':\n this.IFF.currentForm.referenceObject = this.IFF.reader.getString()\n break\n\n case 'ROID':\n this.IFF.currentForm.referenceObjectID = this.IFF.reader.getUint32()\n break\n\n // Surface Blocks\n case 'SSHN':\n this.IFF.currentSurface.surfaceShaderName = this.IFF.reader.getString()\n break\n\n case 'AOVN':\n this.IFF.currentSurface.surfaceCustomAOVName = this.IFF.reader.getString()\n break\n\n // Nodal Blocks\n case 'NSTA':\n this.IFF.currentForm.disabled = this.IFF.reader.getUint16()\n break\n\n case 'NRNM':\n this.IFF.currentForm.realName = this.IFF.reader.getString()\n break\n\n case 'NNME':\n this.IFF.currentForm.refName = this.IFF.reader.getString()\n this.IFF.currentSurface.nodes[this.IFF.currentForm.refName] = this.IFF.currentForm\n break\n\n // Nodal Blocks : connections\n case 'INME':\n if (!this.IFF.currentForm.nodeName) this.IFF.currentForm.nodeName = []\n this.IFF.currentForm.nodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINN':\n if (!this.IFF.currentForm.inputNodeName) this.IFF.currentForm.inputNodeName = []\n this.IFF.currentForm.inputNodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINM':\n if (!this.IFF.currentForm.inputName) this.IFF.currentForm.inputName = []\n this.IFF.currentForm.inputName.push(this.IFF.reader.getString())\n break\n\n case 'IONM':\n if (!this.IFF.currentForm.inputOutputName) this.IFF.currentForm.inputOutputName = []\n this.IFF.currentForm.inputOutputName.push(this.IFF.reader.getString())\n break\n\n case 'FNAM':\n this.IFF.currentForm.fileName = this.IFF.reader.getString()\n break\n\n case 'CHAN': // NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored\n if (length === 4) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag()\n else this.IFF.reader.skip(length)\n break\n\n // LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format\n case 'SMAN':\n const maxSmoothingAngle = this.IFF.reader.getFloat32()\n this.IFF.currentSurface.attributes.smooth = maxSmoothingAngle < 0 ? false : true\n break\n\n // LWO2: Basic Surface Parameters\n case 'COLR':\n this.IFF.currentSurface.attributes.Color = { value: this.IFF.reader.getFloat32Array(3) }\n this.IFF.reader.skip(2) // VX: envelope\n break\n\n case 'LUMI':\n this.IFF.currentSurface.attributes.Luminosity = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'SPEC':\n this.IFF.currentSurface.attributes.Specular = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'DIFF':\n this.IFF.currentSurface.attributes.Diffuse = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'REFL':\n this.IFF.currentSurface.attributes.Reflection = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'GLOS':\n this.IFF.currentSurface.attributes.Glossiness = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'TRAN':\n this.IFF.currentSurface.attributes.opacity = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'BUMP':\n this.IFF.currentSurface.attributes.bumpStrength = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'SIDE':\n this.IFF.currentSurface.attributes.side = this.IFF.reader.getUint16()\n break\n\n case 'RIMG':\n this.IFF.currentSurface.attributes.reflectionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'RIND':\n this.IFF.currentSurface.attributes.refractiveIndex = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'TIMG':\n this.IFF.currentSurface.attributes.refractionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'IMAP':\n this.IFF.reader.skip(2)\n break\n\n case 'TMAP':\n this.IFF.debugger.skipped = true\n this.IFF.reader.skip(length) // needs implementing\n break\n\n case 'IUVI': // uv channel name\n this.IFF.currentNode.UVChannel = this.IFF.reader.getString(length)\n break\n\n case 'IUTL': // widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge\n this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32()\n break\n case 'IVTL': // heightWrappingMode\n this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32()\n break\n\n // LWO2 USE\n case 'BLOK':\n // skip\n break\n\n default:\n this.IFF.parseUnknownCHUNK(blockID, length)\n }\n\n if (blockID != 'FORM') {\n this.IFF.debugger.node = 1\n this.IFF.debugger.nodeID = blockID\n this.IFF.debugger.log()\n }\n\n if (this.IFF.reader.offset >= this.IFF.currentFormEnd) {\n this.IFF.currentForm = this.IFF.parentForm\n }\n }\n}\n\nexport { LWO2Parser }\n", "class LWO3Parser {\n constructor(IFFParser) {\n this.IFF = IFFParser\n }\n\n parseBlock() {\n this.IFF.debugger.offset = this.IFF.reader.offset\n this.IFF.debugger.closeForms()\n\n const blockID = this.IFF.reader.getIDTag()\n const length = this.IFF.reader.getUint32() // size of data in bytes\n\n this.IFF.debugger.dataOffset = this.IFF.reader.offset\n this.IFF.debugger.length = length\n\n // Data types may be found in either LWO2 OR LWO3 spec\n switch (blockID) {\n case 'FORM': // form blocks may consist of sub -chunks or sub-forms\n this.IFF.parseForm(length)\n break\n\n // SKIPPED CHUNKS\n // MISC skipped\n case 'ICON': // Thumbnail Icon Image\n case 'VMPA': // Vertex Map Parameter\n case 'BBOX': // bounding box\n // case 'VMMD':\n // case 'VTYP':\n\n // normal maps can be specified, normally on models imported from other applications. Currently ignored\n case 'NORM':\n\n // ENVL FORM skipped\n case 'PRE ': // Pre-loop behavior for the keyframe\n case 'POST': // Post-loop behavior for the keyframe\n case 'KEY ':\n case 'SPAN':\n\n // CLIP FORM skipped\n case 'TIME':\n case 'CLRS':\n case 'CLRA':\n case 'FILT':\n case 'DITH':\n case 'CONT':\n case 'BRIT':\n case 'SATR':\n case 'HUE ':\n case 'GAMM':\n case 'NEGA':\n case 'IFLT':\n case 'PFLT':\n\n // Image Map Layer skipped\n case 'PROJ':\n case 'AXIS':\n case 'AAST':\n case 'PIXB':\n case 'STCK':\n\n // Procedural Textures skipped\n case 'VALU':\n\n // Gradient Textures skipped\n case 'PNAM':\n case 'INAM':\n case 'GRST':\n case 'GREN':\n case 'GRPT':\n case 'FKEY':\n case 'IKEY':\n\n // Texture Mapping Form skipped\n case 'CSYS':\n\n // Surface CHUNKs skipped\n case 'OPAQ': // top level 'opacity' checkbox\n case 'CMAP': // clip map\n\n // Surface node CHUNKS skipped\n // These mainly specify the node editor setup in LW\n case 'NLOC':\n case 'NZOM':\n case 'NVER':\n case 'NSRV':\n case 'NCRD':\n case 'NMOD':\n case 'NSEL':\n case 'NPRW':\n case 'NPLA':\n case 'VERS':\n case 'ENUM':\n case 'TAG ':\n\n // Car Material CHUNKS\n case 'CGMD':\n case 'CGTY':\n case 'CGST':\n case 'CGEN':\n case 'CGTS':\n case 'CGTE':\n case 'OSMP':\n case 'OMDE':\n case 'OUTR':\n case 'FLAG':\n\n case 'TRNL':\n case 'SHRP':\n case 'RFOP':\n case 'RSAN':\n case 'TROP':\n case 'RBLR':\n case 'TBLR':\n case 'CLRH':\n case 'CLRF':\n case 'ADTR':\n case 'GLOW':\n case 'LINE':\n case 'ALPH':\n case 'VCOL':\n case 'ENAB':\n this.IFF.debugger.skipped = true\n this.IFF.reader.skip(length)\n break\n\n // Texture node chunks (not in spec)\n case 'IPIX': // usePixelBlending\n case 'IMIP': // useMipMaps\n case 'IMOD': // imageBlendingMode\n case 'AMOD': // unknown\n case 'IINV': // imageInvertAlpha\n case 'INCR': // imageInvertColor\n case 'IAXS': // imageAxis ( for non-UV maps)\n case 'IFOT': // imageFallofType\n case 'ITIM': // timing for animated textures\n case 'IWRL':\n case 'IUTI':\n case 'IINX':\n case 'IINY':\n case 'IINZ':\n case 'IREF': // possibly a VX for reused texture nodes\n if (length === 4) this.IFF.currentNode[blockID] = this.IFF.reader.getInt32()\n else this.IFF.reader.skip(length)\n break\n\n case 'OTAG':\n this.IFF.parseObjectTag()\n break\n\n case 'LAYR':\n this.IFF.parseLayer(length)\n break\n\n case 'PNTS':\n this.IFF.parsePoints(length)\n break\n\n case 'VMAP':\n this.IFF.parseVertexMapping(length)\n break\n\n case 'POLS':\n this.IFF.parsePolygonList(length)\n break\n\n case 'TAGS':\n this.IFF.parseTagStrings(length)\n break\n\n case 'PTAG':\n this.IFF.parsePolygonTagMapping(length)\n break\n\n case 'VMAD':\n this.IFF.parseVertexMapping(length, true)\n break\n\n // Misc CHUNKS\n case 'DESC': // Description Line\n this.IFF.currentForm.description = this.IFF.reader.getString()\n break\n\n case 'TEXT':\n case 'CMNT':\n case 'NCOM':\n this.IFF.currentForm.comment = this.IFF.reader.getString()\n break\n\n // Envelope Form\n case 'NAME':\n this.IFF.currentForm.channelName = this.IFF.reader.getString()\n break\n\n // Image Map Layer\n case 'WRAP':\n this.IFF.currentForm.wrap = { w: this.IFF.reader.getUint16(), h: this.IFF.reader.getUint16() }\n break\n\n case 'IMAG':\n const index = this.IFF.reader.getVariableLengthIndex()\n this.IFF.currentForm.imageIndex = index\n break\n\n // Texture Mapping Form\n case 'OREF':\n this.IFF.currentForm.referenceObject = this.IFF.reader.getString()\n break\n\n case 'ROID':\n this.IFF.currentForm.referenceObjectID = this.IFF.reader.getUint32()\n break\n\n // Surface Blocks\n case 'SSHN':\n this.IFF.currentSurface.surfaceShaderName = this.IFF.reader.getString()\n break\n\n case 'AOVN':\n this.IFF.currentSurface.surfaceCustomAOVName = this.IFF.reader.getString()\n break\n\n // Nodal Blocks\n case 'NSTA':\n this.IFF.currentForm.disabled = this.IFF.reader.getUint16()\n break\n\n case 'NRNM':\n this.IFF.currentForm.realName = this.IFF.reader.getString()\n break\n\n case 'NNME':\n this.IFF.currentForm.refName = this.IFF.reader.getString()\n this.IFF.currentSurface.nodes[this.IFF.currentForm.refName] = this.IFF.currentForm\n break\n\n // Nodal Blocks : connections\n case 'INME':\n if (!this.IFF.currentForm.nodeName) this.IFF.currentForm.nodeName = []\n this.IFF.currentForm.nodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINN':\n if (!this.IFF.currentForm.inputNodeName) this.IFF.currentForm.inputNodeName = []\n this.IFF.currentForm.inputNodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINM':\n if (!this.IFF.currentForm.inputName) this.IFF.currentForm.inputName = []\n this.IFF.currentForm.inputName.push(this.IFF.reader.getString())\n break\n\n case 'IONM':\n if (!this.IFF.currentForm.inputOutputName) this.IFF.currentForm.inputOutputName = []\n this.IFF.currentForm.inputOutputName.push(this.IFF.reader.getString())\n break\n\n case 'FNAM':\n this.IFF.currentForm.fileName = this.IFF.reader.getString()\n break\n\n case 'CHAN': // NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored\n if (length === 4) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag()\n else this.IFF.reader.skip(length)\n break\n\n // LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format\n case 'SMAN':\n const maxSmoothingAngle = this.IFF.reader.getFloat32()\n this.IFF.currentSurface.attributes.smooth = maxSmoothingAngle < 0 ? false : true\n break\n\n // LWO2: Basic Surface Parameters\n case 'COLR':\n this.IFF.currentSurface.attributes.Color = { value: this.IFF.reader.getFloat32Array(3) }\n this.IFF.reader.skip(2) // VX: envelope\n break\n\n case 'LUMI':\n this.IFF.currentSurface.attributes.Luminosity = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'SPEC':\n this.IFF.currentSurface.attributes.Specular = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'DIFF':\n this.IFF.currentSurface.attributes.Diffuse = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'REFL':\n this.IFF.currentSurface.attributes.Reflection = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'GLOS':\n this.IFF.currentSurface.attributes.Glossiness = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'TRAN':\n this.IFF.currentSurface.attributes.opacity = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'BUMP':\n this.IFF.currentSurface.attributes.bumpStrength = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'SIDE':\n this.IFF.currentSurface.attributes.side = this.IFF.reader.getUint16()\n break\n\n case 'RIMG':\n this.IFF.currentSurface.attributes.reflectionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'RIND':\n this.IFF.currentSurface.attributes.refractiveIndex = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'TIMG':\n this.IFF.currentSurface.attributes.refractionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'IMAP':\n this.IFF.currentSurface.attributes.imageMapIndex = this.IFF.reader.getUint32()\n break\n\n case 'IUVI': // uv channel name\n this.IFF.currentNode.UVChannel = this.IFF.reader.getString(length)\n break\n\n case 'IUTL': // widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge\n this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32()\n break\n case 'IVTL': // heightWrappingMode\n this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32()\n break\n\n default:\n this.IFF.parseUnknownCHUNK(blockID, length)\n }\n\n if (blockID != 'FORM') {\n this.IFF.debugger.node = 1\n this.IFF.debugger.nodeID = blockID\n this.IFF.debugger.log()\n }\n\n if (this.IFF.reader.offset >= this.IFF.currentFormEnd) {\n this.IFF.currentForm = this.IFF.parentForm\n }\n }\n}\n\nexport { LWO3Parser }\n", "import {\n Box3,\n Float32BufferAttribute,\n InstancedBufferGeometry,\n InstancedInterleavedBuffer,\n InterleavedBufferAttribute,\n Sphere,\n Vector3,\n WireframeGeometry,\n} from 'three'\n\nconst _box = new Box3()\nconst _vector = new Vector3()\n\nclass LineSegmentsGeometry extends InstancedBufferGeometry {\n constructor() {\n super()\n\n this.isLineSegmentsGeometry = true\n\n this.type = 'LineSegmentsGeometry'\n\n const positions = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0]\n const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2]\n const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]\n\n this.setIndex(index)\n this.setAttribute('position', new Float32BufferAttribute(positions, 3))\n this.setAttribute('uv', new Float32BufferAttribute(uvs, 2))\n }\n\n applyMatrix4(matrix) {\n const start = this.attributes.instanceStart\n const end = this.attributes.instanceEnd\n\n if (start !== undefined) {\n start.applyMatrix4(matrix)\n\n end.applyMatrix4(matrix)\n\n start.needsUpdate = true\n }\n\n if (this.boundingBox !== null) {\n this.computeBoundingBox()\n }\n\n if (this.boundingSphere !== null) {\n this.computeBoundingSphere()\n }\n\n return this\n }\n\n setPositions(array) {\n let lineSegments\n\n if (array instanceof Float32Array) {\n lineSegments = array\n } else if (Array.isArray(array)) {\n lineSegments = new Float32Array(array)\n }\n\n const instanceBuffer = new InstancedInterleavedBuffer(lineSegments, 6, 1) // xyz, xyz\n\n this.setAttribute('instanceStart', new InterleavedBufferAttribute(instanceBuffer, 3, 0)) // xyz\n this.setAttribute('instanceEnd', new InterleavedBufferAttribute(instanceBuffer, 3, 3)) // xyz\n\n //\n\n this.computeBoundingBox()\n this.computeBoundingSphere()\n\n return this\n }\n\n setColors(array, itemSize = 3) {\n let colors\n\n if (array instanceof Float32Array) {\n colors = array\n } else if (Array.isArray(array)) {\n colors = new Float32Array(array)\n }\n\n const instanceColorBuffer = new InstancedInterleavedBuffer(colors, itemSize * 2, 1) // rgb(a), rgb(a)\n\n this.setAttribute('instanceColorStart', new InterleavedBufferAttribute(instanceColorBuffer, itemSize, 0)) // rgb(a)\n this.setAttribute('instanceColorEnd', new InterleavedBufferAttribute(instanceColorBuffer, itemSize, itemSize)) // rgb(a)\n\n return this\n }\n\n fromWireframeGeometry(geometry) {\n this.setPositions(geometry.attributes.position.array)\n\n return this\n }\n\n fromEdgesGeometry(geometry) {\n this.setPositions(geometry.attributes.position.array)\n\n return this\n }\n\n fromMesh(mesh) {\n this.fromWireframeGeometry(new WireframeGeometry(mesh.geometry))\n\n // set colors, maybe\n\n return this\n }\n\n fromLineSegments(lineSegments) {\n const geometry = lineSegments.geometry\n\n this.setPositions(geometry.attributes.position.array) // assumes non-indexed\n\n // set colors, maybe\n\n return this\n }\n\n computeBoundingBox() {\n if (this.boundingBox === null) {\n this.boundingBox = new Box3()\n }\n\n const start = this.attributes.instanceStart\n const end = this.attributes.instanceEnd\n\n if (start !== undefined && end !== undefined) {\n this.boundingBox.setFromBufferAttribute(start)\n\n _box.setFromBufferAttribute(end)\n\n this.boundingBox.union(_box)\n }\n }\n\n computeBoundingSphere() {\n if (this.boundingSphere === null) {\n this.boundingSphere = new Sphere()\n }\n\n if (this.boundingBox === null) {\n this.computeBoundingBox()\n }\n\n const start = this.attributes.instanceStart\n const end = this.attributes.instanceEnd\n\n if (start !== undefined && end !== undefined) {\n const center = this.boundingSphere.center\n\n this.boundingBox.getCenter(center)\n\n let maxRadiusSq = 0\n\n for (let i = 0, il = start.count; i < il; i++) {\n _vector.fromBufferAttribute(start, i)\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector))\n\n _vector.fromBufferAttribute(end, i)\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector))\n }\n\n this.boundingSphere.radius = Math.sqrt(maxRadiusSq)\n\n if (isNaN(this.boundingSphere.radius)) {\n console.error(\n 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.',\n this,\n )\n }\n }\n }\n\n toJSON() {\n // todo\n }\n\n applyMatrix(matrix) {\n console.warn('THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().')\n\n return this.applyMatrix4(matrix)\n }\n}\n\nexport { LineSegmentsGeometry }\n", "import { InstancedInterleavedBuffer, InterleavedBufferAttribute, Mesh, Vector3 } from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nconst _start = new Vector3()\nconst _end = new Vector3()\n\nclass Wireframe extends Mesh {\n constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isWireframe = true\n\n this.type = 'Wireframe'\n }\n\n // for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n computeLineDistances() {\n const geometry = this.geometry\n\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n const lineDistances = new Float32Array(2 * instanceStart.count)\n\n for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {\n _start.fromBufferAttribute(instanceStart, i)\n _end.fromBufferAttribute(instanceEnd, i)\n\n lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1]\n lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end)\n }\n\n const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1) // d0, d1\n\n geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)) // d0\n geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)) // d1\n\n return this\n }\n}\n\nexport { Wireframe }\n", "import {\n Box3,\n InstancedInterleavedBuffer,\n InterleavedBufferAttribute,\n Line3,\n MathUtils,\n Matrix4,\n Mesh,\n Sphere,\n Vector3,\n Vector4,\n} from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nconst _start = new Vector3()\nconst _end = new Vector3()\n\nconst _start4 = new Vector4()\nconst _end4 = new Vector4()\n\nconst _ssOrigin = new Vector4()\nconst _ssOrigin3 = new Vector3()\nconst _mvMatrix = new Matrix4()\nconst _line = new Line3()\nconst _closestPoint = new Vector3()\n\nconst _box = new Box3()\nconst _sphere = new Sphere()\nconst _clipToWorldVector = new Vector4()\n\nlet _ray, _instanceStart, _instanceEnd, _lineWidth\n\n// Returns the margin required to expand by in world space given the distance from the camera,\n// line width, resolution, and camera projection\nfunction getWorldSpaceHalfWidth(camera, distance, resolution) {\n // transform into clip space, adjust the x and y values by the pixel width offset, then\n // transform back into world space to get world offset. Note clip space is [-1, 1] so full\n // width does not need to be halved.\n _clipToWorldVector.set(0, 0, -distance, 1.0).applyMatrix4(camera.projectionMatrix)\n _clipToWorldVector.multiplyScalar(1.0 / _clipToWorldVector.w)\n _clipToWorldVector.x = _lineWidth / resolution.width\n _clipToWorldVector.y = _lineWidth / resolution.height\n _clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse)\n _clipToWorldVector.multiplyScalar(1.0 / _clipToWorldVector.w)\n\n return Math.abs(Math.max(_clipToWorldVector.x, _clipToWorldVector.y))\n}\n\nfunction raycastWorldUnits(lineSegments, intersects) {\n for (let i = 0, l = _instanceStart.count; i < l; i++) {\n _line.start.fromBufferAttribute(_instanceStart, i)\n _line.end.fromBufferAttribute(_instanceEnd, i)\n\n const pointOnLine = new Vector3()\n const point = new Vector3()\n\n _ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine)\n const isInside = point.distanceTo(pointOnLine) < _lineWidth * 0.5\n\n if (isInside) {\n intersects.push({\n point,\n pointOnLine,\n distance: _ray.origin.distanceTo(point),\n object: lineSegments,\n face: null,\n faceIndex: i,\n uv: null,\n uv2: null,\n })\n }\n }\n}\n\nfunction raycastScreenSpace(lineSegments, camera, intersects) {\n const projectionMatrix = camera.projectionMatrix\n const material = lineSegments.material\n const resolution = material.resolution\n const matrixWorld = lineSegments.matrixWorld\n\n const geometry = lineSegments.geometry\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n\n const near = -camera.near\n\n //\n\n // pick a point 1 unit out along the ray to avoid the ray origin\n // sitting at the camera origin which will cause \"w\" to be 0 when\n // applying the projection matrix.\n _ray.at(1, _ssOrigin)\n\n // ndc space [ - 1.0, 1.0 ]\n _ssOrigin.w = 1\n _ssOrigin.applyMatrix4(camera.matrixWorldInverse)\n _ssOrigin.applyMatrix4(projectionMatrix)\n _ssOrigin.multiplyScalar(1 / _ssOrigin.w)\n\n // screen space\n _ssOrigin.x *= resolution.x / 2\n _ssOrigin.y *= resolution.y / 2\n _ssOrigin.z = 0\n\n _ssOrigin3.copy(_ssOrigin)\n\n _mvMatrix.multiplyMatrices(camera.matrixWorldInverse, matrixWorld)\n\n for (let i = 0, l = instanceStart.count; i < l; i++) {\n _start4.fromBufferAttribute(instanceStart, i)\n _end4.fromBufferAttribute(instanceEnd, i)\n\n _start4.w = 1\n _end4.w = 1\n\n // camera space\n _start4.applyMatrix4(_mvMatrix)\n _end4.applyMatrix4(_mvMatrix)\n\n // skip the segment if it's entirely behind the camera\n const isBehindCameraNear = _start4.z > near && _end4.z > near\n if (isBehindCameraNear) {\n continue\n }\n\n // trim the segment if it extends behind camera near\n if (_start4.z > near) {\n const deltaDist = _start4.z - _end4.z\n const t = (_start4.z - near) / deltaDist\n _start4.lerp(_end4, t)\n } else if (_end4.z > near) {\n const deltaDist = _end4.z - _start4.z\n const t = (_end4.z - near) / deltaDist\n _end4.lerp(_start4, t)\n }\n\n // clip space\n _start4.applyMatrix4(projectionMatrix)\n _end4.applyMatrix4(projectionMatrix)\n\n // ndc space [ - 1.0, 1.0 ]\n _start4.multiplyScalar(1 / _start4.w)\n _end4.multiplyScalar(1 / _end4.w)\n\n // screen space\n _start4.x *= resolution.x / 2\n _start4.y *= resolution.y / 2\n\n _end4.x *= resolution.x / 2\n _end4.y *= resolution.y / 2\n\n // create 2d segment\n _line.start.copy(_start4)\n _line.start.z = 0\n\n _line.end.copy(_end4)\n _line.end.z = 0\n\n // get closest point on ray to segment\n const param = _line.closestPointToPointParameter(_ssOrigin3, true)\n _line.at(param, _closestPoint)\n\n // check if the intersection point is within clip space\n const zPos = MathUtils.lerp(_start4.z, _end4.z, param)\n const isInClipSpace = zPos >= -1 && zPos <= 1\n\n const isInside = _ssOrigin3.distanceTo(_closestPoint) < _lineWidth * 0.5\n\n if (isInClipSpace && isInside) {\n _line.start.fromBufferAttribute(instanceStart, i)\n _line.end.fromBufferAttribute(instanceEnd, i)\n\n _line.start.applyMatrix4(matrixWorld)\n _line.end.applyMatrix4(matrixWorld)\n\n const pointOnLine = new Vector3()\n const point = new Vector3()\n\n _ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine)\n\n intersects.push({\n point: point,\n pointOnLine: pointOnLine,\n distance: _ray.origin.distanceTo(point),\n object: lineSegments,\n face: null,\n faceIndex: i,\n uv: null,\n uv2: null,\n })\n }\n }\n}\n\nclass LineSegments2 extends Mesh {\n constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isLineSegments2 = true\n\n this.type = 'LineSegments2'\n }\n\n // for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n computeLineDistances() {\n const geometry = this.geometry\n\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n const lineDistances = new Float32Array(2 * instanceStart.count)\n\n for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {\n _start.fromBufferAttribute(instanceStart, i)\n _end.fromBufferAttribute(instanceEnd, i)\n\n lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1]\n lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end)\n }\n\n const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1) // d0, d1\n\n geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)) // d0\n geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)) // d1\n\n return this\n }\n\n raycast(raycaster, intersects) {\n const worldUnits = this.material.worldUnits\n const camera = raycaster.camera\n\n if (camera === null && !worldUnits) {\n console.error(\n 'LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.',\n )\n }\n\n const threshold = raycaster.params.Line2 !== undefined ? raycaster.params.Line2.threshold || 0 : 0\n\n _ray = raycaster.ray\n\n const matrixWorld = this.matrixWorld\n const geometry = this.geometry\n const material = this.material\n\n _lineWidth = material.linewidth + threshold\n\n _instanceStart = geometry.attributes.instanceStart\n _instanceEnd = geometry.attributes.instanceEnd\n\n // check if we intersect the sphere bounds\n if (geometry.boundingSphere === null) {\n geometry.computeBoundingSphere()\n }\n\n _sphere.copy(geometry.boundingSphere).applyMatrix4(matrixWorld)\n\n // increase the sphere bounds by the worst case line screen space width\n let sphereMargin\n if (worldUnits) {\n sphereMargin = _lineWidth * 0.5\n } else {\n const distanceToSphere = Math.max(camera.near, _sphere.distanceToPoint(_ray.origin))\n sphereMargin = getWorldSpaceHalfWidth(camera, distanceToSphere, material.resolution)\n }\n\n _sphere.radius += sphereMargin\n\n if (_ray.intersectsSphere(_sphere) === false) {\n return\n }\n\n // check if we intersect the box bounds\n if (geometry.boundingBox === null) {\n geometry.computeBoundingBox()\n }\n\n _box.copy(geometry.boundingBox).applyMatrix4(matrixWorld)\n\n // increase the box bounds by the worst case line width\n let boxMargin\n if (worldUnits) {\n boxMargin = _lineWidth * 0.5\n } else {\n const distanceToBox = Math.max(camera.near, _box.distanceToPoint(_ray.origin))\n boxMargin = getWorldSpaceHalfWidth(camera, distanceToBox, material.resolution)\n }\n\n _box.expandByScalar(boxMargin)\n\n if (_ray.intersectsBox(_box) === false) {\n return\n }\n\n if (worldUnits) {\n raycastWorldUnits(this, intersects)\n } else {\n raycastScreenSpace(this, camera, intersects)\n }\n }\n}\n\nexport { LineSegments2 }\n", "import { BufferGeometry, Float32BufferAttribute, LineSegments, LineBasicMaterial, Vector3 } from 'three'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\n\nclass VertexTangentsHelper extends LineSegments {\n constructor(object, size = 1, color = 0x00ffff) {\n const geometry = new BufferGeometry()\n\n const nTangents = object.geometry.attributes.tangent.count\n const positions = new Float32BufferAttribute(nTangents * 2 * 3, 3)\n\n geometry.setAttribute('position', positions)\n\n super(geometry, new LineBasicMaterial({ color, toneMapped: false }))\n\n this.object = object\n this.size = size\n this.type = 'VertexTangentsHelper'\n\n //\n\n this.matrixAutoUpdate = false\n\n this.update()\n }\n\n update() {\n this.object.updateMatrixWorld(true)\n\n const matrixWorld = this.object.matrixWorld\n\n const position = this.geometry.attributes.position\n\n //\n\n const objGeometry = this.object.geometry\n\n const objPos = objGeometry.attributes.position\n\n const objTan = objGeometry.attributes.tangent\n\n let idx = 0\n\n // for simplicity, ignore index and drawcalls, and render every tangent\n\n for (let j = 0, jl = objPos.count; j < jl; j++) {\n _v1.fromBufferAttribute(objPos, j).applyMatrix4(matrixWorld)\n\n _v2.fromBufferAttribute(objTan, j)\n\n _v2.transformDirection(matrixWorld).multiplyScalar(this.size).add(_v1)\n\n position.setXYZ(idx, _v1.x, _v1.y, _v1.z)\n\n idx = idx + 1\n\n position.setXYZ(idx, _v2.x, _v2.y, _v2.z)\n\n idx = idx + 1\n }\n\n position.needsUpdate = true\n }\n\n dispose() {\n this.geometry.dispose()\n this.material.dispose()\n }\n}\n\nexport { VertexTangentsHelper }\n", "import { BufferGeometry, Float32BufferAttribute, LineSegments, LineBasicMaterial, Matrix3, Vector3 } from 'three'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\nconst _normalMatrix = new Matrix3()\n\nclass VertexNormalsHelper extends LineSegments {\n constructor(object, size = 1, color = 0xff0000) {\n const geometry = new BufferGeometry()\n\n const nNormals = object.geometry.attributes.normal.count\n const positions = new Float32BufferAttribute(nNormals * 2 * 3, 3)\n\n geometry.setAttribute('position', positions)\n\n super(geometry, new LineBasicMaterial({ color, toneMapped: false }))\n\n this.object = object\n this.size = size\n this.type = 'VertexNormalsHelper'\n\n //\n\n this.matrixAutoUpdate = false\n\n this.update()\n }\n\n update() {\n this.object.updateMatrixWorld(true)\n\n _normalMatrix.getNormalMatrix(this.object.matrixWorld)\n\n const matrixWorld = this.object.matrixWorld\n\n const position = this.geometry.attributes.position\n\n //\n\n const objGeometry = this.object.geometry\n\n if (objGeometry) {\n const objPos = objGeometry.attributes.position\n\n const objNorm = objGeometry.attributes.normal\n\n let idx = 0\n\n // for simplicity, ignore index and drawcalls, and render every normal\n\n for (let j = 0, jl = objPos.count; j < jl; j++) {\n _v1.fromBufferAttribute(objPos, j).applyMatrix4(matrixWorld)\n\n _v2.fromBufferAttribute(objNorm, j)\n\n _v2.applyMatrix3(_normalMatrix).normalize().multiplyScalar(this.size).add(_v1)\n\n position.setXYZ(idx, _v1.x, _v1.y, _v1.z)\n\n idx = idx + 1\n\n position.setXYZ(idx, _v2.x, _v2.y, _v2.z)\n\n idx = idx + 1\n }\n }\n\n position.needsUpdate = true\n }\n\n dispose() {\n this.geometry.dispose()\n this.material.dispose()\n }\n}\n\nexport { VertexNormalsHelper }\n", "import {\n Box3,\n BufferAttribute,\n BufferGeometry,\n Color,\n EventDispatcher,\n Float32BufferAttribute,\n Matrix3,\n Matrix4,\n MathUtils,\n Object3D,\n Sphere,\n Vector2,\n Vector3,\n} from 'three'\n\nconst _m1 = new Matrix4()\nconst _obj = new Object3D()\nconst _offset = new Vector3()\n\nclass Geometry extends EventDispatcher {\n static createBufferGeometryFromObject(object) {\n let buffergeometry = new BufferGeometry()\n\n const geometry = object.geometry\n\n if (object.isPoints || object.isLine) {\n const positions = new Float32BufferAttribute(geometry.vertices.length * 3, 3)\n const colors = new Float32BufferAttribute(geometry.colors.length * 3, 3)\n\n buffergeometry.setAttribute('position', positions.copyVector3sArray(geometry.vertices))\n buffergeometry.setAttribute('color', colors.copyColorsArray(geometry.colors))\n\n if (geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length) {\n const lineDistances = new Float32BufferAttribute(geometry.lineDistances.length, 1)\n\n buffergeometry.setAttribute('lineDistance', lineDistances.copyArray(geometry.lineDistances))\n }\n\n if (geometry.boundingSphere !== null) {\n buffergeometry.boundingSphere = geometry.boundingSphere.clone()\n }\n\n if (geometry.boundingBox !== null) {\n buffergeometry.boundingBox = geometry.boundingBox.clone()\n }\n } else if (object.isMesh) {\n buffergeometry = geometry.toBufferGeometry()\n }\n\n return buffergeometry\n }\n\n constructor() {\n super()\n this.isGeometry = true\n this.uuid = MathUtils.generateUUID()\n\n this.name = ''\n this.type = 'Geometry'\n\n this.vertices = []\n this.colors = []\n this.faces = []\n this.faceVertexUvs = [[]]\n\n this.morphTargets = []\n this.morphNormals = []\n\n this.skinWeights = []\n this.skinIndices = []\n\n this.lineDistances = []\n\n this.boundingBox = null\n this.boundingSphere = null\n\n // update flags\n\n this.elementsNeedUpdate = false\n this.verticesNeedUpdate = false\n this.uvsNeedUpdate = false\n this.normalsNeedUpdate = false\n this.colorsNeedUpdate = false\n this.lineDistancesNeedUpdate = false\n this.groupsNeedUpdate = false\n }\n\n applyMatrix4(matrix) {\n const normalMatrix = new Matrix3().getNormalMatrix(matrix)\n\n for (let i = 0, il = this.vertices.length; i < il; i++) {\n const vertex = this.vertices[i]\n vertex.applyMatrix4(matrix)\n }\n\n for (let i = 0, il = this.faces.length; i < il; i++) {\n const face = this.faces[i]\n face.normal.applyMatrix3(normalMatrix).normalize()\n\n for (let j = 0, jl = face.vertexNormals.length; j < jl; j++) {\n face.vertexNormals[j].applyMatrix3(normalMatrix).normalize()\n }\n }\n\n if (this.boundingBox !== null) {\n this.computeBoundingBox()\n }\n\n if (this.boundingSphere !== null) {\n this.computeBoundingSphere()\n }\n\n this.verticesNeedUpdate = true\n this.normalsNeedUpdate = true\n\n return this\n }\n\n rotateX(angle) {\n // rotate geometry around world x-axis\n\n _m1.makeRotationX(angle)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n rotateY(angle) {\n // rotate geometry around world y-axis\n\n _m1.makeRotationY(angle)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n rotateZ(angle) {\n // rotate geometry around world z-axis\n\n _m1.makeRotationZ(angle)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n translate(x, y, z) {\n // translate geometry\n\n _m1.makeTranslation(x, y, z)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n scale(x, y, z) {\n // scale geometry\n\n _m1.makeScale(x, y, z)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n lookAt(vector) {\n _obj.lookAt(vector)\n\n _obj.updateMatrix()\n\n this.applyMatrix4(_obj.matrix)\n\n return this\n }\n\n fromBufferGeometry(geometry) {\n const scope = this\n\n const index = geometry.index !== null ? geometry.index : undefined\n const attributes = geometry.attributes\n\n if (attributes.position === undefined) {\n console.error('THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.')\n return this\n }\n\n const position = attributes.position\n const normal = attributes.normal\n const color = attributes.color\n const uv = attributes.uv\n const uv2 = attributes.uv2\n\n if (uv2 !== undefined) this.faceVertexUvs[1] = []\n\n for (let i = 0; i < position.count; i++) {\n scope.vertices.push(new Vector3().fromBufferAttribute(position, i))\n\n if (color !== undefined) {\n scope.colors.push(new Color().fromBufferAttribute(color, i))\n }\n }\n\n function addFace(a, b, c, materialIndex) {\n const vertexColors =\n color === undefined ? [] : [scope.colors[a].clone(), scope.colors[b].clone(), scope.colors[c].clone()]\n\n const vertexNormals =\n normal === undefined\n ? []\n : [\n new Vector3().fromBufferAttribute(normal, a),\n new Vector3().fromBufferAttribute(normal, b),\n new Vector3().fromBufferAttribute(normal, c),\n ]\n\n const face = new Face3(a, b, c, vertexNormals, vertexColors, materialIndex)\n\n scope.faces.push(face)\n\n if (uv !== undefined) {\n scope.faceVertexUvs[0].push([\n new Vector2().fromBufferAttribute(uv, a),\n new Vector2().fromBufferAttribute(uv, b),\n new Vector2().fromBufferAttribute(uv, c),\n ])\n }\n\n if (uv2 !== undefined) {\n scope.faceVertexUvs[1].push([\n new Vector2().fromBufferAttribute(uv2, a),\n new Vector2().fromBufferAttribute(uv2, b),\n new Vector2().fromBufferAttribute(uv2, c),\n ])\n }\n }\n\n const groups = geometry.groups\n\n if (groups.length > 0) {\n for (let i = 0; i < groups.length; i++) {\n const group = groups[i]\n\n const start = group.start\n const count = group.count\n\n for (let j = start, jl = start + count; j < jl; j += 3) {\n if (index !== undefined) {\n addFace(index.getX(j), index.getX(j + 1), index.getX(j + 2), group.materialIndex)\n } else {\n addFace(j, j + 1, j + 2, group.materialIndex)\n }\n }\n }\n } else {\n if (index !== undefined) {\n for (let i = 0; i < index.count; i += 3) {\n addFace(index.getX(i), index.getX(i + 1), index.getX(i + 2))\n }\n } else {\n for (let i = 0; i < position.count; i += 3) {\n addFace(i, i + 1, i + 2)\n }\n }\n }\n\n this.computeFaceNormals()\n\n if (geometry.boundingBox !== null) {\n this.boundingBox = geometry.boundingBox.clone()\n }\n\n if (geometry.boundingSphere !== null) {\n this.boundingSphere = geometry.boundingSphere.clone()\n }\n\n return this\n }\n\n center() {\n this.computeBoundingBox()\n\n this.boundingBox.getCenter(_offset).negate()\n\n this.translate(_offset.x, _offset.y, _offset.z)\n\n return this\n }\n\n normalize() {\n this.computeBoundingSphere()\n\n const center = this.boundingSphere.center\n const radius = this.boundingSphere.radius\n\n const s = radius === 0 ? 1 : 1.0 / radius\n\n const matrix = new Matrix4()\n matrix.set(s, 0, 0, -s * center.x, 0, s, 0, -s * center.y, 0, 0, s, -s * center.z, 0, 0, 0, 1)\n\n this.applyMatrix4(matrix)\n\n return this\n }\n\n computeFaceNormals() {\n const cb = new Vector3(),\n ab = new Vector3()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vA = this.vertices[face.a]\n const vB = this.vertices[face.b]\n const vC = this.vertices[face.c]\n\n cb.subVectors(vC, vB)\n ab.subVectors(vA, vB)\n cb.cross(ab)\n\n cb.normalize()\n\n face.normal.copy(cb)\n }\n }\n\n computeVertexNormals(areaWeighted = true) {\n const vertices = new Array(this.vertices.length)\n\n for (let v = 0, vl = this.vertices.length; v < vl; v++) {\n vertices[v] = new Vector3()\n }\n\n if (areaWeighted) {\n // vertex normals weighted by triangle areas\n // http://www.iquilezles.org/www/articles/normals/normals.htm\n\n const cb = new Vector3(),\n ab = new Vector3()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vA = this.vertices[face.a]\n const vB = this.vertices[face.b]\n const vC = this.vertices[face.c]\n\n cb.subVectors(vC, vB)\n ab.subVectors(vA, vB)\n cb.cross(ab)\n\n vertices[face.a].add(cb)\n vertices[face.b].add(cb)\n vertices[face.c].add(cb)\n }\n } else {\n this.computeFaceNormals()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n vertices[face.a].add(face.normal)\n vertices[face.b].add(face.normal)\n vertices[face.c].add(face.normal)\n }\n }\n\n for (let v = 0, vl = this.vertices.length; v < vl; v++) {\n vertices[v].normalize()\n }\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vertexNormals = face.vertexNormals\n\n if (vertexNormals.length === 3) {\n vertexNormals[0].copy(vertices[face.a])\n vertexNormals[1].copy(vertices[face.b])\n vertexNormals[2].copy(vertices[face.c])\n } else {\n vertexNormals[0] = vertices[face.a].clone()\n vertexNormals[1] = vertices[face.b].clone()\n vertexNormals[2] = vertices[face.c].clone()\n }\n }\n\n if (this.faces.length > 0) {\n this.normalsNeedUpdate = true\n }\n }\n\n computeFlatVertexNormals() {\n this.computeFaceNormals()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vertexNormals = face.vertexNormals\n\n if (vertexNormals.length === 3) {\n vertexNormals[0].copy(face.normal)\n vertexNormals[1].copy(face.normal)\n vertexNormals[2].copy(face.normal)\n } else {\n vertexNormals[0] = face.normal.clone()\n vertexNormals[1] = face.normal.clone()\n vertexNormals[2] = face.normal.clone()\n }\n }\n\n if (this.faces.length > 0) {\n this.normalsNeedUpdate = true\n }\n }\n\n computeMorphNormals() {\n // save original normals\n // - create temp variables on first access\n // otherwise just copy (for faster repeated calls)\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n if (!face.__originalFaceNormal) {\n face.__originalFaceNormal = face.normal.clone()\n } else {\n face.__originalFaceNormal.copy(face.normal)\n }\n\n if (!face.__originalVertexNormals) face.__originalVertexNormals = []\n\n for (let i = 0, il = face.vertexNormals.length; i < il; i++) {\n if (!face.__originalVertexNormals[i]) {\n face.__originalVertexNormals[i] = face.vertexNormals[i].clone()\n } else {\n face.__originalVertexNormals[i].copy(face.vertexNormals[i])\n }\n }\n }\n\n // use temp geometry to compute face and vertex normals for each morph\n\n const tmpGeo = new Geometry()\n tmpGeo.faces = this.faces\n\n for (let i = 0, il = this.morphTargets.length; i < il; i++) {\n // create on first access\n\n if (!this.morphNormals[i]) {\n this.morphNormals[i] = {}\n this.morphNormals[i].faceNormals = []\n this.morphNormals[i].vertexNormals = []\n\n const dstNormalsFace = this.morphNormals[i].faceNormals\n const dstNormalsVertex = this.morphNormals[i].vertexNormals\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const faceNormal = new Vector3()\n const vertexNormals = {\n a: new Vector3(),\n b: new Vector3(),\n c: new Vector3(),\n }\n\n dstNormalsFace.push(faceNormal)\n dstNormalsVertex.push(vertexNormals)\n }\n }\n\n const morphNormals = this.morphNormals[i]\n\n // set vertices to morph target\n\n tmpGeo.vertices = this.morphTargets[i].vertices\n\n // compute morph normals\n\n tmpGeo.computeFaceNormals()\n tmpGeo.computeVertexNormals()\n\n // store morph normals\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const faceNormal = morphNormals.faceNormals[f]\n const vertexNormals = morphNormals.vertexNormals[f]\n\n faceNormal.copy(face.normal)\n\n vertexNormals.a.copy(face.vertexNormals[0])\n vertexNormals.b.copy(face.vertexNormals[1])\n vertexNormals.c.copy(face.vertexNormals[2])\n }\n }\n\n // restore original normals\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n face.normal = face.__originalFaceNormal\n face.vertexNormals = face.__originalVertexNormals\n }\n }\n\n computeBoundingBox() {\n if (this.boundingBox === null) {\n this.boundingBox = new Box3()\n }\n\n this.boundingBox.setFromPoints(this.vertices)\n }\n\n computeBoundingSphere() {\n if (this.boundingSphere === null) {\n this.boundingSphere = new Sphere()\n }\n\n this.boundingSphere.setFromPoints(this.vertices)\n }\n\n merge(geometry, matrix, materialIndexOffset = 0) {\n if (!(geometry && geometry.isGeometry)) {\n console.error('THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry)\n return\n }\n\n let normalMatrix\n const vertexOffset = this.vertices.length,\n vertices1 = this.vertices,\n vertices2 = geometry.vertices,\n faces1 = this.faces,\n faces2 = geometry.faces,\n colors1 = this.colors,\n colors2 = geometry.colors\n\n if (matrix !== undefined) {\n normalMatrix = new Matrix3().getNormalMatrix(matrix)\n }\n\n // vertices\n\n for (let i = 0, il = vertices2.length; i < il; i++) {\n const vertex = vertices2[i]\n\n const vertexCopy = vertex.clone()\n\n if (matrix !== undefined) vertexCopy.applyMatrix4(matrix)\n\n vertices1.push(vertexCopy)\n }\n\n // colors\n\n for (let i = 0, il = colors2.length; i < il; i++) {\n colors1.push(colors2[i].clone())\n }\n\n // faces\n\n for (let i = 0, il = faces2.length; i < il; i++) {\n const face = faces2[i]\n let normal, color\n const faceVertexNormals = face.vertexNormals,\n faceVertexColors = face.vertexColors\n\n const faceCopy = new Face3(face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset)\n faceCopy.normal.copy(face.normal)\n\n if (normalMatrix !== undefined) {\n faceCopy.normal.applyMatrix3(normalMatrix).normalize()\n }\n\n for (let j = 0, jl = faceVertexNormals.length; j < jl; j++) {\n normal = faceVertexNormals[j].clone()\n\n if (normalMatrix !== undefined) {\n normal.applyMatrix3(normalMatrix).normalize()\n }\n\n faceCopy.vertexNormals.push(normal)\n }\n\n faceCopy.color.copy(face.color)\n\n for (let j = 0, jl = faceVertexColors.length; j < jl; j++) {\n color = faceVertexColors[j]\n faceCopy.vertexColors.push(color.clone())\n }\n\n faceCopy.materialIndex = face.materialIndex + materialIndexOffset\n\n faces1.push(faceCopy)\n }\n\n // uvs\n\n for (let i = 0, il = geometry.faceVertexUvs.length; i < il; i++) {\n const faceVertexUvs2 = geometry.faceVertexUvs[i]\n\n if (this.faceVertexUvs[i] === undefined) this.faceVertexUvs[i] = []\n\n for (let j = 0, jl = faceVertexUvs2.length; j < jl; j++) {\n const uvs2 = faceVertexUvs2[j],\n uvsCopy = []\n\n for (let k = 0, kl = uvs2.length; k < kl; k++) {\n uvsCopy.push(uvs2[k].clone())\n }\n\n this.faceVertexUvs[i].push(uvsCopy)\n }\n }\n }\n\n mergeMesh(mesh) {\n if (!(mesh && mesh.isMesh)) {\n console.error('THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh)\n return\n }\n\n if (mesh.matrixAutoUpdate) mesh.updateMatrix()\n\n this.merge(mesh.geometry, mesh.matrix)\n }\n\n /*\n * Checks for duplicate vertices with hashmap.\n * Duplicated vertices are removed\n * and faces' vertices are updated.\n */\n\n mergeVertices(precisionPoints = 4) {\n const verticesMap = {} // Hashmap for looking up vertices by position coordinates (and making sure they are unique)\n const unique = [],\n changes = []\n\n const precision = Math.pow(10, precisionPoints)\n\n for (let i = 0, il = this.vertices.length; i < il; i++) {\n const v = this.vertices[i]\n const key = `${Math.round(v.x * precision)}_${Math.round(v.y * precision)}_${Math.round(v.z * precision)}`\n\n if (verticesMap[key] === undefined) {\n verticesMap[key] = i\n unique.push(this.vertices[i])\n changes[i] = unique.length - 1\n } else {\n //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);\n changes[i] = changes[verticesMap[key]]\n }\n }\n\n // if faces are completely degenerate after merging vertices, we\n // have to remove them from the geometry.\n const faceIndicesToRemove = []\n\n for (let i = 0, il = this.faces.length; i < il; i++) {\n const face = this.faces[i]\n\n face.a = changes[face.a]\n face.b = changes[face.b]\n face.c = changes[face.c]\n\n const indices = [face.a, face.b, face.c]\n\n // if any duplicate vertices are found in a Face3\n // we have to remove the face as nothing can be saved\n for (let n = 0; n < 3; n++) {\n if (indices[n] === indices[(n + 1) % 3]) {\n faceIndicesToRemove.push(i)\n break\n }\n }\n }\n\n for (let i = faceIndicesToRemove.length - 1; i >= 0; i--) {\n const idx = faceIndicesToRemove[i]\n\n this.faces.splice(idx, 1)\n\n for (let j = 0, jl = this.faceVertexUvs.length; j < jl; j++) {\n this.faceVertexUvs[j].splice(idx, 1)\n }\n }\n\n // Use unique set of vertices\n\n const diff = this.vertices.length - unique.length\n this.vertices = unique\n return diff\n }\n\n setFromPoints(points) {\n this.vertices = []\n\n for (let i = 0, l = points.length; i < l; i++) {\n const point = points[i]\n this.vertices.push(new Vector3(point.x, point.y, point.z || 0))\n }\n\n return this\n }\n\n sortFacesByMaterialIndex() {\n const faces = this.faces\n const length = faces.length\n\n // tag faces\n\n for (let i = 0; i < length; i++) {\n faces[i]._id = i\n }\n\n // sort faces\n\n function materialIndexSort(a, b) {\n return a.materialIndex - b.materialIndex\n }\n\n faces.sort(materialIndexSort)\n\n // sort uvs\n\n const uvs1 = this.faceVertexUvs[0]\n const uvs2 = this.faceVertexUvs[1]\n\n let newUvs1, newUvs2\n\n if (uvs1 && uvs1.length === length) newUvs1 = []\n if (uvs2 && uvs2.length === length) newUvs2 = []\n\n for (let i = 0; i < length; i++) {\n const id = faces[i]._id\n\n if (newUvs1) newUvs1.push(uvs1[id])\n if (newUvs2) newUvs2.push(uvs2[id])\n }\n\n if (newUvs1) this.faceVertexUvs[0] = newUvs1\n if (newUvs2) this.faceVertexUvs[1] = newUvs2\n }\n\n toJSON() {\n const data = {\n metadata: {\n version: 4.5,\n type: 'Geometry',\n generator: 'Geometry.toJSON',\n },\n }\n\n // standard Geometry serialization\n\n data.uuid = this.uuid\n data.type = this.type\n if (this.name !== '') data.name = this.name\n\n if (this.parameters !== undefined) {\n const parameters = this.parameters\n\n for (let key in parameters) {\n if (parameters[key] !== undefined) data[key] = parameters[key]\n }\n\n return data\n }\n\n const vertices = []\n\n for (let i = 0; i < this.vertices.length; i++) {\n const vertex = this.vertices[i]\n vertices.push(vertex.x, vertex.y, vertex.z)\n }\n\n const faces = []\n const normals = []\n const normalsHash = {}\n const colors = []\n const colorsHash = {}\n const uvs = []\n const uvsHash = {}\n\n for (let i = 0; i < this.faces.length; i++) {\n const face = this.faces[i]\n\n const hasMaterial = true\n const hasFaceUv = false // deprecated\n const hasFaceVertexUv = this.faceVertexUvs[0][i] !== undefined\n const hasFaceNormal = face.normal.length() > 0\n const hasFaceVertexNormal = face.vertexNormals.length > 0\n const hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1\n const hasFaceVertexColor = face.vertexColors.length > 0\n\n let faceType = 0\n\n faceType = setBit(faceType, 0, 0) // isQuad\n faceType = setBit(faceType, 1, hasMaterial)\n faceType = setBit(faceType, 2, hasFaceUv)\n faceType = setBit(faceType, 3, hasFaceVertexUv)\n faceType = setBit(faceType, 4, hasFaceNormal)\n faceType = setBit(faceType, 5, hasFaceVertexNormal)\n faceType = setBit(faceType, 6, hasFaceColor)\n faceType = setBit(faceType, 7, hasFaceVertexColor)\n\n faces.push(faceType)\n faces.push(face.a, face.b, face.c)\n faces.push(face.materialIndex)\n\n if (hasFaceVertexUv) {\n const faceVertexUvs = this.faceVertexUvs[0][i]\n\n faces.push(getUvIndex(faceVertexUvs[0]), getUvIndex(faceVertexUvs[1]), getUvIndex(faceVertexUvs[2]))\n }\n\n if (hasFaceNormal) {\n faces.push(getNormalIndex(face.normal))\n }\n\n if (hasFaceVertexNormal) {\n const vertexNormals = face.vertexNormals\n\n faces.push(getNormalIndex(vertexNormals[0]), getNormalIndex(vertexNormals[1]), getNormalIndex(vertexNormals[2]))\n }\n\n if (hasFaceColor) {\n faces.push(getColorIndex(face.color))\n }\n\n if (hasFaceVertexColor) {\n const vertexColors = face.vertexColors\n\n faces.push(getColorIndex(vertexColors[0]), getColorIndex(vertexColors[1]), getColorIndex(vertexColors[2]))\n }\n }\n\n function setBit(value, position, enabled) {\n return enabled ? value | (1 << position) : value & ~(1 << position)\n }\n\n function getNormalIndex(normal) {\n const hash = normal.x.toString() + normal.y.toString() + normal.z.toString()\n\n if (normalsHash[hash] !== undefined) {\n return normalsHash[hash]\n }\n\n normalsHash[hash] = normals.length / 3\n normals.push(normal.x, normal.y, normal.z)\n\n return normalsHash[hash]\n }\n\n function getColorIndex(color) {\n const hash = color.r.toString() + color.g.toString() + color.b.toString()\n\n if (colorsHash[hash] !== undefined) {\n return colorsHash[hash]\n }\n\n colorsHash[hash] = colors.length\n colors.push(color.getHex())\n\n return colorsHash[hash]\n }\n\n function getUvIndex(uv) {\n const hash = uv.x.toString() + uv.y.toString()\n\n if (uvsHash[hash] !== undefined) {\n return uvsHash[hash]\n }\n\n uvsHash[hash] = uvs.length / 2\n uvs.push(uv.x, uv.y)\n\n return uvsHash[hash]\n }\n\n data.data = {}\n\n data.data.vertices = vertices\n data.data.normals = normals\n if (colors.length > 0) data.data.colors = colors\n if (uvs.length > 0) data.data.uvs = [uvs] // temporal backward compatibility\n data.data.faces = faces\n\n return data\n }\n\n clone() {\n /*\n\t\t // Handle primitives\n\n\t\t const parameters = this.parameters;\n\n\t\t if ( parameters !== undefined ) {\n\n\t\t const values = [];\n\n\t\t for ( const key in parameters ) {\n\n\t\t values.push( parameters[ key ] );\n\n\t\t }\n\n\t\t const geometry = Object.create( this.constructor.prototype );\n\t\t this.constructor.apply( geometry, values );\n\t\t return geometry;\n\n\t\t }\n\n\t\t return new this.constructor().copy( this );\n\t\t */\n\n return new Geometry().copy(this)\n }\n\n copy(source) {\n // reset\n\n this.vertices = []\n this.colors = []\n this.faces = []\n this.faceVertexUvs = [[]]\n this.morphTargets = []\n this.morphNormals = []\n this.skinWeights = []\n this.skinIndices = []\n this.lineDistances = []\n this.boundingBox = null\n this.boundingSphere = null\n\n // name\n\n this.name = source.name\n\n // vertices\n\n const vertices = source.vertices\n\n for (let i = 0, il = vertices.length; i < il; i++) {\n this.vertices.push(vertices[i].clone())\n }\n\n // colors\n\n const colors = source.colors\n\n for (let i = 0, il = colors.length; i < il; i++) {\n this.colors.push(colors[i].clone())\n }\n\n // faces\n\n const faces = source.faces\n\n for (let i = 0, il = faces.length; i < il; i++) {\n this.faces.push(faces[i].clone())\n }\n\n // face vertex uvs\n\n for (let i = 0, il = source.faceVertexUvs.length; i < il; i++) {\n const faceVertexUvs = source.faceVertexUvs[i]\n\n if (this.faceVertexUvs[i] === undefined) {\n this.faceVertexUvs[i] = []\n }\n\n for (let j = 0, jl = faceVertexUvs.length; j < jl; j++) {\n const uvs = faceVertexUvs[j],\n uvsCopy = []\n\n for (let k = 0, kl = uvs.length; k < kl; k++) {\n const uv = uvs[k]\n\n uvsCopy.push(uv.clone())\n }\n\n this.faceVertexUvs[i].push(uvsCopy)\n }\n }\n\n // morph targets\n\n const morphTargets = source.morphTargets\n\n for (let i = 0, il = morphTargets.length; i < il; i++) {\n const morphTarget = {}\n morphTarget.name = morphTargets[i].name\n\n // vertices\n\n if (morphTargets[i].vertices !== undefined) {\n morphTarget.vertices = []\n\n for (let j = 0, jl = morphTargets[i].vertices.length; j < jl; j++) {\n morphTarget.vertices.push(morphTargets[i].vertices[j].clone())\n }\n }\n\n // normals\n\n if (morphTargets[i].normals !== undefined) {\n morphTarget.normals = []\n\n for (let j = 0, jl = morphTargets[i].normals.length; j < jl; j++) {\n morphTarget.normals.push(morphTargets[i].normals[j].clone())\n }\n }\n\n this.morphTargets.push(morphTarget)\n }\n\n // morph normals\n\n const morphNormals = source.morphNormals\n\n for (let i = 0, il = morphNormals.length; i < il; i++) {\n const morphNormal = {}\n\n // vertex normals\n\n if (morphNormals[i].vertexNormals !== undefined) {\n morphNormal.vertexNormals = []\n\n for (let j = 0, jl = morphNormals[i].vertexNormals.length; j < jl; j++) {\n const srcVertexNormal = morphNormals[i].vertexNormals[j]\n const destVertexNormal = {}\n\n destVertexNormal.a = srcVertexNormal.a.clone()\n destVertexNormal.b = srcVertexNormal.b.clone()\n destVertexNormal.c = srcVertexNormal.c.clone()\n\n morphNormal.vertexNormals.push(destVertexNormal)\n }\n }\n\n // face normals\n\n if (morphNormals[i].faceNormals !== undefined) {\n morphNormal.faceNormals = []\n\n for (let j = 0, jl = morphNormals[i].faceNormals.length; j < jl; j++) {\n morphNormal.faceNormals.push(morphNormals[i].faceNormals[j].clone())\n }\n }\n\n this.morphNormals.push(morphNormal)\n }\n\n // skin weights\n\n const skinWeights = source.skinWeights\n\n for (let i = 0, il = skinWeights.length; i < il; i++) {\n this.skinWeights.push(skinWeights[i].clone())\n }\n\n // skin indices\n\n const skinIndices = source.skinIndices\n\n for (let i = 0, il = skinIndices.length; i < il; i++) {\n this.skinIndices.push(skinIndices[i].clone())\n }\n\n // line distances\n\n const lineDistances = source.lineDistances\n\n for (let i = 0, il = lineDistances.length; i < il; i++) {\n this.lineDistances.push(lineDistances[i])\n }\n\n // bounding box\n\n const boundingBox = source.boundingBox\n\n if (boundingBox !== null) {\n this.boundingBox = boundingBox.clone()\n }\n\n // bounding sphere\n\n const boundingSphere = source.boundingSphere\n\n if (boundingSphere !== null) {\n this.boundingSphere = boundingSphere.clone()\n }\n\n // update flags\n\n this.elementsNeedUpdate = source.elementsNeedUpdate\n this.verticesNeedUpdate = source.verticesNeedUpdate\n this.uvsNeedUpdate = source.uvsNeedUpdate\n this.normalsNeedUpdate = source.normalsNeedUpdate\n this.colorsNeedUpdate = source.colorsNeedUpdate\n this.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate\n this.groupsNeedUpdate = source.groupsNeedUpdate\n\n return this\n }\n\n toBufferGeometry() {\n const geometry = new DirectGeometry().fromGeometry(this)\n\n const buffergeometry = new BufferGeometry()\n\n const positions = new Float32Array(geometry.vertices.length * 3)\n buffergeometry.setAttribute('position', new BufferAttribute(positions, 3).copyVector3sArray(geometry.vertices))\n\n if (geometry.normals.length > 0) {\n const normals = new Float32Array(geometry.normals.length * 3)\n buffergeometry.setAttribute('normal', new BufferAttribute(normals, 3).copyVector3sArray(geometry.normals))\n }\n\n if (geometry.colors.length > 0) {\n const colors = new Float32Array(geometry.colors.length * 3)\n buffergeometry.setAttribute('color', new BufferAttribute(colors, 3).copyColorsArray(geometry.colors))\n }\n\n if (geometry.uvs.length > 0) {\n const uvs = new Float32Array(geometry.uvs.length * 2)\n buffergeometry.setAttribute('uv', new BufferAttribute(uvs, 2).copyVector2sArray(geometry.uvs))\n }\n\n if (geometry.uvs2.length > 0) {\n const uvs2 = new Float32Array(geometry.uvs2.length * 2)\n buffergeometry.setAttribute('uv2', new BufferAttribute(uvs2, 2).copyVector2sArray(geometry.uvs2))\n }\n\n // groups\n\n buffergeometry.groups = geometry.groups\n\n // morphs\n\n for (let name in geometry.morphTargets) {\n const array = []\n const morphTargets = geometry.morphTargets[name]\n\n for (let i = 0, l = morphTargets.length; i < l; i++) {\n const morphTarget = morphTargets[i]\n\n const attribute = new Float32BufferAttribute(morphTarget.data.length * 3, 3)\n attribute.name = morphTarget.name\n\n array.push(attribute.copyVector3sArray(morphTarget.data))\n }\n\n buffergeometry.morphAttributes[name] = array\n }\n\n // skinning\n\n if (geometry.skinIndices.length > 0) {\n const skinIndices = new Float32BufferAttribute(geometry.skinIndices.length * 4, 4)\n buffergeometry.setAttribute('skinIndex', skinIndices.copyVector4sArray(geometry.skinIndices))\n }\n\n if (geometry.skinWeights.length > 0) {\n const skinWeights = new Float32BufferAttribute(geometry.skinWeights.length * 4, 4)\n buffergeometry.setAttribute('skinWeight', skinWeights.copyVector4sArray(geometry.skinWeights))\n }\n\n //\n\n if (geometry.boundingSphere !== null) {\n buffergeometry.boundingSphere = geometry.boundingSphere.clone()\n }\n\n if (geometry.boundingBox !== null) {\n buffergeometry.boundingBox = geometry.boundingBox.clone()\n }\n\n return buffergeometry\n }\n\n computeTangents() {\n console.error('THREE.Geometry: .computeTangents() has been removed.')\n }\n\n computeLineDistances() {\n console.error(\n 'THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.',\n )\n }\n\n applyMatrix(matrix) {\n console.warn('THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().')\n return this.applyMatrix4(matrix)\n }\n\n dispose() {\n this.dispatchEvent({ type: 'dispose' })\n }\n}\n\nclass DirectGeometry {\n constructor() {\n this.vertices = []\n this.normals = []\n this.colors = []\n this.uvs = []\n this.uvs2 = []\n\n this.groups = []\n\n this.morphTargets = {}\n\n this.skinWeights = []\n this.skinIndices = []\n\n // this.lineDistances = [];\n\n this.boundingBox = null\n this.boundingSphere = null\n\n // update flags\n\n this.verticesNeedUpdate = false\n this.normalsNeedUpdate = false\n this.colorsNeedUpdate = false\n this.uvsNeedUpdate = false\n this.groupsNeedUpdate = false\n }\n\n computeGroups(geometry) {\n const groups = []\n\n let group, i\n let materialIndex = undefined\n\n const faces = geometry.faces\n\n for (i = 0; i < faces.length; i++) {\n const face = faces[i]\n\n // materials\n\n if (face.materialIndex !== materialIndex) {\n materialIndex = face.materialIndex\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n group = {\n start: i * 3,\n materialIndex,\n }\n }\n }\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n this.groups = groups\n }\n\n fromGeometry(geometry) {\n const faces = geometry.faces\n const vertices = geometry.vertices\n const faceVertexUvs = geometry.faceVertexUvs\n\n const hasFaceVertexUv = faceVertexUvs[0] && faceVertexUvs[0].length > 0\n const hasFaceVertexUv2 = faceVertexUvs[1] && faceVertexUvs[1].length > 0\n\n // morphs\n\n const morphTargets = geometry.morphTargets\n const morphTargetsLength = morphTargets.length\n\n let morphTargetsPosition\n\n if (morphTargetsLength > 0) {\n morphTargetsPosition = []\n\n for (let i = 0; i < morphTargetsLength; i++) {\n morphTargetsPosition[i] = {\n name: morphTargets[i].name,\n data: [],\n }\n }\n\n this.morphTargets.position = morphTargetsPosition\n }\n\n const morphNormals = geometry.morphNormals\n const morphNormalsLength = morphNormals.length\n\n let morphTargetsNormal\n\n if (morphNormalsLength > 0) {\n morphTargetsNormal = []\n\n for (let i = 0; i < morphNormalsLength; i++) {\n morphTargetsNormal[i] = {\n name: morphNormals[i].name,\n data: [],\n }\n }\n\n this.morphTargets.normal = morphTargetsNormal\n }\n\n // skins\n\n const skinIndices = geometry.skinIndices\n const skinWeights = geometry.skinWeights\n\n const hasSkinIndices = skinIndices.length === vertices.length\n const hasSkinWeights = skinWeights.length === vertices.length\n\n //\n\n if (vertices.length > 0 && faces.length === 0) {\n console.error('THREE.DirectGeometry: Faceless geometries are not supported.')\n }\n\n for (let i = 0; i < faces.length; i++) {\n const face = faces[i]\n\n this.vertices.push(vertices[face.a], vertices[face.b], vertices[face.c])\n\n const vertexNormals = face.vertexNormals\n\n if (vertexNormals.length === 3) {\n this.normals.push(vertexNormals[0], vertexNormals[1], vertexNormals[2])\n } else {\n const normal = face.normal\n\n this.normals.push(normal, normal, normal)\n }\n\n const vertexColors = face.vertexColors\n\n if (vertexColors.length === 3) {\n this.colors.push(vertexColors[0], vertexColors[1], vertexColors[2])\n } else {\n const color = face.color\n\n this.colors.push(color, color, color)\n }\n\n if (hasFaceVertexUv === true) {\n const vertexUvs = faceVertexUvs[0][i]\n\n if (vertexUvs !== undefined) {\n this.uvs.push(vertexUvs[0], vertexUvs[1], vertexUvs[2])\n } else {\n console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i)\n\n this.uvs.push(new Vector2(), new Vector2(), new Vector2())\n }\n }\n\n if (hasFaceVertexUv2 === true) {\n const vertexUvs = faceVertexUvs[1][i]\n\n if (vertexUvs !== undefined) {\n this.uvs2.push(vertexUvs[0], vertexUvs[1], vertexUvs[2])\n } else {\n console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i)\n\n this.uvs2.push(new Vector2(), new Vector2(), new Vector2())\n }\n }\n\n // morphs\n\n for (let j = 0; j < morphTargetsLength; j++) {\n const morphTarget = morphTargets[j].vertices\n\n morphTargetsPosition[j].data.push(morphTarget[face.a], morphTarget[face.b], morphTarget[face.c])\n }\n\n for (let j = 0; j < morphNormalsLength; j++) {\n const morphNormal = morphNormals[j].vertexNormals[i]\n\n morphTargetsNormal[j].data.push(morphNormal.a, morphNormal.b, morphNormal.c)\n }\n\n // skins\n\n if (hasSkinIndices) {\n this.skinIndices.push(skinIndices[face.a], skinIndices[face.b], skinIndices[face.c])\n }\n\n if (hasSkinWeights) {\n this.skinWeights.push(skinWeights[face.a], skinWeights[face.b], skinWeights[face.c])\n }\n }\n\n this.computeGroups(geometry)\n\n this.verticesNeedUpdate = geometry.verticesNeedUpdate\n this.normalsNeedUpdate = geometry.normalsNeedUpdate\n this.colorsNeedUpdate = geometry.colorsNeedUpdate\n this.uvsNeedUpdate = geometry.uvsNeedUpdate\n this.groupsNeedUpdate = geometry.groupsNeedUpdate\n\n if (geometry.boundingSphere !== null) {\n this.boundingSphere = geometry.boundingSphere.clone()\n }\n\n if (geometry.boundingBox !== null) {\n this.boundingBox = geometry.boundingBox.clone()\n }\n\n return this\n }\n}\n\nclass Face3 {\n constructor(a, b, c, normal, color, materialIndex = 0) {\n this.a = a\n this.b = b\n this.c = c\n\n this.normal = normal && normal.isVector3 ? normal : new Vector3()\n this.vertexNormals = Array.isArray(normal) ? normal : []\n\n this.color = color && color.isColor ? color : new Color()\n this.vertexColors = Array.isArray(color) ? color : []\n\n this.materialIndex = materialIndex\n }\n\n clone() {\n return new this.constructor().copy(this)\n }\n\n copy(source) {\n this.a = source.a\n this.b = source.b\n this.c = source.c\n\n this.normal.copy(source.normal)\n this.color.copy(source.color)\n\n this.materialIndex = source.materialIndex\n\n for (let i = 0, il = source.vertexNormals.length; i < il; i++) {\n this.vertexNormals[i] = source.vertexNormals[i].clone()\n }\n\n for (let i = 0, il = source.vertexColors.length; i < il; i++) {\n this.vertexColors[i] = source.vertexColors[i].clone()\n }\n\n return this\n }\n}\n\nexport { Face3, Geometry }\n", "// This file is part of meshoptimizer library and is distributed under the terms of MIT License.\n// Copyright (C) 2016-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\n\ntype API = {\n ready: Promise\n supported: boolean\n decodeVertexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, filter?: string) => void\n decodeIndexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void\n decodeIndexSequence: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void\n decodeGltfBuffer: (\n target: Uint8Array,\n count: number,\n size: number,\n source: Uint8Array,\n mode: string,\n filter?: string,\n ) => void\n}\n\nlet generated: API\n\nconst MeshoptDecoder = () => {\n if (generated) return generated\n\n // Built with clang version 11.0.0 (https://github.com/llvm/llvm-project.git 0160ad802e899c2922bc9b29564080c22eb0908c)\n // Built from meshoptimizer 0.14\n const wasm_base =\n 'B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtC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DnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB'\n\n // Uses bulk-memory and simd extensions\n const 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\n // Used to unpack wasm\n const wasmpack = new Uint8Array([\n 32,\n 0,\n 65,\n 253,\n 3,\n 1,\n 2,\n 34,\n 4,\n 106,\n 6,\n 5,\n 11,\n 8,\n 7,\n 20,\n 13,\n 33,\n 12,\n 16,\n 128,\n 9,\n 116,\n 64,\n 19,\n 113,\n 127,\n 15,\n 10,\n 21,\n 22,\n 14,\n 255,\n 66,\n 24,\n 54,\n 136,\n 107,\n 18,\n 23,\n 192,\n 26,\n 114,\n 118,\n 132,\n 17,\n 77,\n 101,\n 130,\n 144,\n 27,\n 87,\n 131,\n 44,\n 45,\n 74,\n 156,\n 154,\n 70,\n 167,\n ])\n\n if (typeof WebAssembly !== 'object') {\n // This module requires WebAssembly to function\n return {\n supported: false,\n }\n }\n\n let wasm = wasm_base\n\n if (WebAssembly.validate(detector)) {\n wasm = wasm_simd\n }\n\n let instance: any // WebAssembly.Instance\n\n const promise = WebAssembly.instantiate(unpack(wasm), {}).then((result) => {\n instance = result.instance\n instance.exports.__wasm_call_ctors()\n })\n\n function unpack(data: string) {\n const result = new Uint8Array(data.length)\n for (let i = 0; i < data.length; ++i) {\n const ch = data.charCodeAt(i)\n result[i] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62\n }\n let write = 0\n for (let i = 0; i < data.length; ++i) {\n result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i]\n }\n return result.buffer.slice(0, write)\n }\n\n function decode(\n fun: Function,\n target: Uint8Array,\n count: number,\n size: number,\n source: Uint8Array,\n filter?: Function,\n ) {\n const sbrk = instance.exports.sbrk\n const count4 = (count + 3) & ~3 // pad for SIMD filter\n const tp = sbrk(count4 * size)\n const sp = sbrk(source.length)\n const heap = new Uint8Array(instance.exports.memory.buffer)\n heap.set(source, sp)\n const res = fun(tp, count, size, sp, source.length)\n if (res === 0 && filter) {\n filter(tp, count4, size)\n }\n target.set(heap.subarray(tp, tp + count * size))\n sbrk(tp - sbrk(0))\n if (res !== 0) {\n throw new Error(`Malformed buffer data: ${res}`)\n }\n }\n\n const filters = {\n // legacy index-based enums for glTF\n 0: '',\n 1: 'meshopt_decodeFilterOct',\n 2: 'meshopt_decodeFilterQuat',\n 3: 'meshopt_decodeFilterExp',\n // string-based enums for glTF\n NONE: '',\n OCTAHEDRAL: 'meshopt_decodeFilterOct',\n QUATERNION: 'meshopt_decodeFilterQuat',\n EXPONENTIAL: 'meshopt_decodeFilterExp',\n }\n\n const decoders = {\n // legacy index-based enums for glTF\n 0: 'meshopt_decodeVertexBuffer',\n 1: 'meshopt_decodeIndexBuffer',\n 2: 'meshopt_decodeIndexSequence',\n // string-based enums for glTF\n ATTRIBUTES: 'meshopt_decodeVertexBuffer',\n TRIANGLES: 'meshopt_decodeIndexBuffer',\n INDICES: 'meshopt_decodeIndexSequence',\n }\n\n generated = {\n ready: promise,\n supported: true,\n decodeVertexBuffer(target, count, size, source, filter) {\n decode(\n instance.exports.meshopt_decodeVertexBuffer,\n target,\n count,\n size,\n source,\n instance.exports[filters[filter as keyof typeof filters]],\n )\n },\n decodeIndexBuffer(target, count, size, source) {\n decode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source)\n },\n decodeIndexSequence(target, count, size, source) {\n decode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source)\n },\n decodeGltfBuffer(target, count, size, source, mode, filter) {\n decode(\n instance.exports[decoders[mode as keyof typeof decoders]],\n target,\n count,\n size,\n source,\n instance.exports[filters[filter as keyof typeof filters]],\n )\n },\n }\n\n return generated\n}\n\nexport { MeshoptDecoder }\n", "// @ts-nocheck\n/* eslint-disable */\n\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 'use strict';\n\n // Built with clang version 14.0.4\n // Built from meshoptimizer 0.18\n var wasm_base =\n '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 =\n '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;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg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avcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9: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 var detector = new Uint8Array([\n 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,\n 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11\n ]);\n var wasmpack = new Uint8Array([\n 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,\n 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,\n 29, 73, 115\n ]);\n\n if (typeof WebAssembly !== 'object') {\n return {\n supported: false\n };\n }\n\n var wasm = WebAssembly.validate(detector) ? wasm_simd : wasm_base;\n\n var instance;\n\n var ready = WebAssembly.instantiate(unpack(wasm), {}).then(function (result) {\n instance = result.instance;\n instance.exports.__wasm_call_ctors();\n });\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) {\n result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];\n }\n return result.buffer.slice(0, write);\n }\n\n function decode(fun, target, count, size, source, filter) {\n var sbrk = instance.exports.sbrk;\n var count4 = (count + 3) & ~3;\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) {\n filter(tp, count4, size);\n }\n target.set(heap.subarray(tp, tp + count * size));\n sbrk(tp - sbrk(0));\n if (res != 0) {\n throw new Error('Malformed buffer data: ' + res);\n }\n }\n\n var filters = {\n NONE: '',\n OCTAHEDRAL: 'meshopt_decodeFilterOct',\n QUATERNION: 'meshopt_decodeFilterQuat',\n EXPONENTIAL: 'meshopt_decodeFilterExp'\n };\n\n var decoders = {\n ATTRIBUTES: 'meshopt_decodeVertexBuffer',\n TRIANGLES: 'meshopt_decodeIndexBuffer',\n INDICES: 'meshopt_decodeIndexSequence'\n };\n\n var workers = [];\n var requestId = 0;\n\n function createWorker(url) {\n var worker = {\n object: new Worker(url),\n pending: 0,\n requests: {}\n };\n\n worker.object.onmessage = function (event) {\n var data = event.data;\n\n worker.pending -= data.count;\n worker.requests[data.id][data.action](data.value);\n\n delete worker.requests[data.id];\n };\n\n return worker;\n }\n\n function initWorkers(count) {\n var source =\n 'var instance; var ready = WebAssembly.instantiate(new Uint8Array([' +\n new Uint8Array(unpack(wasm)) +\n ']), {})' +\n '.then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });' +\n 'self.onmessage = workerProcess;' +\n decode.toString() +\n workerProcess.toString();\n\n var blob = new Blob([source], { type: 'text/javascript' });\n var url = URL.createObjectURL(blob);\n\n for (var i = 0; i < count; ++i) {\n workers[i] = createWorker(url);\n }\n\n URL.revokeObjectURL(url);\n }\n\n function decodeWorker(count, size, source, mode, filter) {\n var worker = workers[0];\n\n for (var i = 1; i < workers.length; ++i) {\n if (workers[i].pending < worker.pending) {\n worker = workers[i];\n }\n }\n\n return new Promise(function (resolve, reject) {\n var data = new Uint8Array(source);\n var id = requestId++;\n\n worker.pending += count;\n worker.requests[id] = { resolve: resolve, reject: reject };\n worker.object.postMessage({ id: id, count: count, size: size, source: data, mode: mode, filter: filter }, [\n data.buffer\n ]);\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({ id: data.id, count: data.count, action: 'resolve', value: target }, [target.buffer]);\n } catch (error) {\n self.postMessage({ id: data.id, count: data.count, action: 'reject', 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(\n instance.exports.meshopt_decodeVertexBuffer,\n target,\n count,\n size,\n source,\n instance.exports[filters[filter]]\n );\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) {\n return decodeWorker(count, size, source, decoders[mode], filters[filter]);\n }\n\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\nexport { MeshoptDecoder };\n"], - "mappings": ";iqBAAA,IAAAA,GAAAC,EAAAC,GAAA,KAAAF,GAAA,CAAC,ICAD,IAAAG,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Ac,CAAE,MAAO,CAAE,EACzB,UAAW,CAAE,MAAO,EAAM,EAC1B,QAAS,CAAE,MAAO,EAAM,CAC1B,EAEA,aAAc,CACZ,oBAEA,gBAEA,aACA,2EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,qCACA,0CACA,yBACA,sBACA,0BACA,uBACA,yBACA,4BACA,8BACA,yBACA,6BACA,4BACA,8BACA,wBACA,yBACA,yBACA,yBACA,yBACA,uBACA,wBACA,qBACA,wBACA,0BACA,4BACA,oBACA,0BACA,yBAEA,6CAGA,mCAEA,IAEA,oCAGA,iCAEA,IAEA,2BAGA,+EAEA,IAEA,4GAGA,uDACA,wBAEA,+BAEA,8CAEA,0CAEA,8CAEA,yBACA,qGACA,wFACA,MAEA,uCAEA,2CACA,+EACA,wDAEA,yCAEA,gEACA,uCACA,uCACA,kCACA,6FAEA,KAEA,sBAEA,IAEA,gBAGA,gBACA,YACA,YACA,YACA,YACA,gBACA,gBACA,gBACA,gBAEA,KAEA,iCAGA,gFACA,0EACA,wCACA,+BAEA,yCAEA,wCACA,mEACA,6EAEA,KAEA,kCACA,eAEA,IAEA,6EAGA,sDAEA,yBAEA,mCACA,mCACA,mCACA,mCAEA,8BAEA,mCACA,mCACA,mCACA,mCAEA,YAEA,mCACA,mCACA,mCACA,mCAEA,KAEA,gFACA,gFACA,gFACA,gFACA,sEACA,uEACA,uEACA,uEACA,iCAEA,eAEA,IAEA,+EAGA,WAGA,0DACA,iCACA,2EACA,0EACA,6DACA,mEACA,yDACA,gHACA,2GACA,qDACA,sGAGA,iBACA,yDACA,yDAGA,2BAEA,+CACA,8EACA,0CACA,0CAEA,KAGA,sFACA,gFACA,wCACA,wCACA,sCACA,sCACA,0DACA,0DAEA,aAEA,IAEA,mDAGA,4CACA,mCACA,gDACA,6CACA,qDACA,6CACA,oDACA,uCACA,mDACA,uCACA,YACA,mCACA,KAEA,IAEA,gBAEA,sBAGA,oDACA,gCACA,uDAGA,kEACA,kEACA,kEACA,y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EA,aACA,6EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,uBACA,yBAEA,4BACA,4BAEA,oBAEA,gBAEA,0CAEA,mCAEA,gFAEA,uBACA,yBAEA,GAAA,EACA,KAAK;CAAI,CACb,cCtCO,IAAMC,GAAa,CACxB,SAAU,CACR,SAAU,CAAE,MAAO,IAAK,EACxB,WAAY,CAAE,MAAO,IAAIC,GAAQ,EAAI,KAAM,EAAI,GAAG,CAAE,CACtD,EAEA,aAAc,CACZ,oBAEA,gBAEA,aACA,6EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,yBACA,GACA,8BACA,GACA,2BACA,GACA,oBACA,GACA,6FACA,GACA,uFACA,kEACA,wBACA,uCACA,+CACA,KACA,uEACA,KACA,wEACA,wEACA,cACA,uEACA,sEACA,0EACA,4EACA,6EACA,oEACA,wEACA,sEACA,KACA,0EACA,uEACA,wEACA,uEACA,2EACA,yEACA,wEACA,yEACA,kEACA,2EACA,0EACA,KACA,uFACA,GACA,oBACA,0BACA,iCACA,GACA,+BACA,GACA,iFACA,0BACA,SACA,kDACA,4DACA,yEACA,SACA,gCACA,SACA,iFACA,wBACA,8BACA,SACA,iFACA,wBACA,8BACA,SACA,iFACA,sBACA,4BACA,SACA,iFACA,sBACA,4BACA,SACA,iFACA,sBACA,4BACA,SACA,iFACA,6BACA,SACA,2CACA,sEACA,mEACA,8DACA,SACA,6EACA,2EACA,SACA,oDACA,wCACA,wCACA,iEACA,gDACA,SACA,iBACA,kBACA,SACA,mCACA,SACA,iFACA,0BACA,SACA,+CACA,6DACA,4EACA,yEACA,iCACA,SACA,iBACA,kBACA,SACA,gCACA,SACA,iFACA,uBACA,SACA,6CACA,6DACA,SACA,wDACA,yEACA,mEACA,SACA,6BACA,SACA,iFACA,iCACA,SACA,iCACA,SACA,gDACA,2CACA,SACA,gCACA,2CACA,aACA,+BACA,2CACA,aACA,gCACA,2CACA,aACA,qCACA,2CACA,aACA,SACA,iFACA,6BACA,SACA,oDACA,4DACA,SACA,6BACA,uCACA,aACA,gCACA,uCACA,aACA,+BACA,uCACA,aACA,iCACA,uCACA,aACA,SACA,GACA,GACA,iFACA,sDACA,iFACA,qEACA,iFACA,8BACA,SACA,oCACA,uEACA,uDACA,mEACA,SACA,iBACA,iFACA,2EACA,iFACA,8CACA,SACA,eACA,iFACA,8EACA,8DACA,gEACA,kEACA,6DACA,SACA,qCACA,SACA,GACA,GACA,iFACA,GACA,oDACA,GACA,iFACA,GACA,iFACA,4DACA,iFACA,kCACA,gCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,GACA,iFACA,yDACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,mCACA,SACA,GACA,iFACA,sDACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,mCACA,SACA,GACA,GACA,GACA,iFACA,GACA,8CACA,GACA,iFACA,2EACA,4BACA,kCACA,8BACA,8BACA,8BACA,8BACA,6BACA,6BACA,6BACA,6BACA,6BACA,4CACA,gCACA,QACA,4BACA,mCACA,8BACA,gCACA,gCACA,gCACA,4BACA,8BACA,8BACA,8BACA,qCACA,SACA,iFACA,2BACA,kDACA,kEACA,SACA,iFACA,2BACA,mBACA,uBACA,uBACA,iDACA,6DACA,uDACA,wCACA,0EACA,YACA,2EACA,aACA,oCACA,wDACA,6DACA,4EACA,6DACA,4EACA,aACA,SACA,iFACA,2BACA,2CACA,qDACA,oEACA,oCACA,wDACA,6DACA,4EACA,6DACA,4EACA,aACA,SACA,iFACA,yBACA,8BACA,gCACA,gEACA,4EACA,SACA,iFACA,yBACA,4BACA,4DACA,iEACA,0EACA,SACA,iFACA,yBACA,4BACA,4DACA,iEACA,0EACA,+DACA,wEACA,+DACA,wEACA,SACA,GACA,GACA,iFACA,2DACA,iFACA,gCACA,6DACA,QACA,6DACA,SACA,GACA,GACA,GACA,GACA,iFACA,GACA,kDACA,GACA,iFACA,qBACA,iFACA,8BACA,SACA,oFACA,gCACA,sBACA,SACA,sEACA,oFACA,qCACA,sCACA,oCACA,SACA,8BACA,4DACA,sCACA,iEACA,mBACA,SACA,iEACA,4EACA,+DACA,4DACA,8CACA,SACA,iEACA,4EACA,+DACA,4DACA,8CACA,SACA,oCACA,+CACA,wCACA,yCACA,sCACA,SACA,oCACA,+CACA,oEACA,mCACA,gCACA,gCACA,wCACA,yCACA,wCACA,yCACA,yCACA,SACA,oCACA,kDACA,+CACA,0CACA,2CACA,0CACA,2CACA,0CACA,SACA,oCACA,+DACA,+CACA,0CACA,2CACA,0CACA,2CACA,6CACA,SACA,oCACA,yDACA,gDACA,0DACA,oCACA,uCACA,8CACA,yEACA,6BACA,iCACA,mCACA,SACA,oCACA,iEACA,gDACA,2EACA,uCACA,+BACA,2BACA,gCACA,qCACA,0CACA,SACA,oCACA,qEACA,gDACA,oDACA,iFACA,0CACA,2CACA,sDACA,4CACA,+CACA,uDACA,wDACA,wEACA,6CACA,SACA,oCACA,iEACA,gDACA,oEACA,wDACA,2CACA,iEACA,yEACA,4DACA,uCACA,yBACA,qEACA,0CACA,SACA,oCACA,iEACA,gDACA,oEACA,wDACA,2CACA,6DACA,yEACA,+EACA,+CACA,kEACA,qDACA,0CACA,SACA,oCACA,qEACA,gDACA,oDACA,+EACA,sDACA,qCACA,+DACA,oDACA,0BACA,oDACA,sDACA,4CACA,+CACA,uDACA,wDACA,wEACA,6CACA,SACA,oDACA,yDACA,0EACA,2DACA,iDACA,wCACA,MACA,iFACA,uBACA,sBACA,sBACA,oCACA,kCACA,wDACA,4CACA,wCACA,oBACA,wCACA,qBACA,iBACA,wCACA,4DACA,iFACA,gBACA,4DACA,iFACA,iBACA,kCACA,qCACA,iBACA,iCACA,iCACA,kCACA,kCACA,iCACA,iCACA,YACA,oDACA,wCACA,oCACA,gBACA,oCACA,iBACA,mCACA,8GACA,8GACA,8GACA,8GACA,gBACA,wGACA,wGACA,wGACA,wGACA,iBACA,aACA,iFACA,2CACA,2CACA,4CACA,4CACA,2CACA,2CACA,+CACA,+CACA,sEACA,6CACA,oFACA,oDACA,iFACA,oBACA,kCACA,2BACA,gBACA,4BACA,iBACA,iFACA,oCACA,mCACA,+GACA,+GACA,+GACA,+GACA,gBACA,yGACA,yGACA,yGACA,yGACA,iBACA,YACA,uGACA,uGACA,aACA,iFACA,wCACA,wCACA,4CACA,8CACA,qDACA,qDACA,iFACA,4CACA,4CACA,uDACA,uDACA,iFACA,4CACA,4CACA,qEACA,qEACA,uDACA,uDACA,uDACA,uDACA,iFACA,sDACA,oDACA,gDACA,6DACA,iFACA,mCACA,mCACA,uDACA,0DACA,iFACA,2CACA,2CACA,wCACA,wCACA,yDACA,gEACA,0CACA,kEACA,iFACA,uBACA,uBACA,uBACA,wBACA,2DACA,2DACA,gDACA,gDACA,iFACA,uBACA,mDACA,mDACA,uBACA,mDACA,mDACA,kDACA,4DACA,6CACA,4DACA,iFACA,kCACA,qDACA,+CACA,6CACA,2CACA,iFACA,gCACA,gCACA,wDACA,wDACA,sDACA,sDACA,8CACA,sDACA,sDACA,iFACA,mBACA,oEACA,oEACA,yDACA,yDACA,mDACA,mDACA,0DACA,0DACA,yCACA,0DACA,0DACA,iFACA,oCACA,uBACA,wEACA,wEACA,6DACA,6DACA,uDACA,uDACA,8DACA,8DACA,6CACA,8DACA,8DACA,iFACA,wCACA,2BACA,4EACA,4EACA,iEACA,iEACA,2DACA,2DACA,kEACA,kEACA,iDACA,kEACA,kEACA,iFACA,4CACA,+BACA,gFACA,gFACA,qEACA,qEACA,+DACA,+DACA,sEACA,sEACA,qDACA,sEACA,sEACA,iFACA,gDACA,mCACA,oFACA,oFACA,yEACA,yEACA,mEACA,mEACA,0EACA,0EACA,yDACA,0EACA,0EACA,iFACA,oDACA,uCACA,wFACA,wFACA,6EACA,6EACA,uEACA,uEACA,8EACA,8EACA,6DACA,8EACA,8EACA,iFACA,gCACA,mBACA,oEACA,oEACA,yDACA,yDACA,mDACA,mDACA,0DACA,0DACA,yCACA,0DACA,0DACA,iFACA,oCACA,uBACA,wEACA,wEACA,6DACA,6DACA,uDACA,uDACA,8DACA,8DACA,6CACA,8DACA,8DACA,iFACA,yCACA,2BACA,4EACA,4EACA,iEACA,iEACA,2DACA,2DACA,mEACA,mEACA,iDACA,mEACA,mEACA,iFACA,6CACA,+BACA,gFACA,gFACA,qEACA,qEACA,+DACA,+DACA,uEACA,uEACA,qDACA,uEACA,uEACA,iFACA,iDACA,mCACA,oFACA,oFACA,yEACA,yEACA,mEACA,mEACA,2EACA,2EACA,yDACA,2EACA,2EACA,iFACA,wBACA,6BACA,iFACA,oBACA,yBACA,iFACA,gBACA,qBACA,iFACA,YACA,iBACA,iFACA,QACA,aACA,iFACA,4BACA,iCACA,iFACA,wBACA,6BACA,iFACA,oBACA,yBACA,iFACA,gBACA,qBACA,iFACA,YACA,iBACA,iFACA,QACA,iFACA,wCACA,wCACA,4CACA,4CACA,iFACA,4DACA,4CACA,4DACA,gDACA,iFACA,yCACA,uCACA,8DACA,6CACA,8DACA,uDACA,iFACA,gEACA,mEACA,8DACA,8DACA,8BACA,wCACA,YACA,+DACA,aACA,IACA,iFACA,SACA,GACA,gBACA,oCACA,WACA,iBACA,gBACA,gBACA,gBACA,kBACA,iBACA,iBACA,iBACA,YACA,aACA,cACA,WACA,WACA,WACA,gBACA,OACA,GACA,wDACA,iDACA,GAAA,EACA,KAAK;CAAI,CACb,EC7kCOC,IAAAC,IAAAC,IAAA,IAAMC,GAAc,CACzB,SAAU,CACR,SAAU,CAAE,MAAO,IAAK,EACxB,YAAa,CAAE,MAAO,IAAK,EAC3B,aAAc,CAAE,MAAO,IAAK,EAC5B,eAAgB,CAAE,MAAO,GAAK,EAC9B,WAAY,CAAE,MAAO,MAAQ,CAC/B,EAEA,aAAc,CACZ,oBAEA,gBAEA,aACA,6EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,6BACA,8BACA,gCACA,4BAEA,8BAEA,oBAEA,gBAEA,8BACA,yBACA,aACA,kBAEA,kDAEA,6CACA,wCAEA,oEAEA,iFAEA,qFACA,sCAEA,qFACA,sCAEA,sFACA,sCAEA,sFACA,sCAEA,uFACA,sCAEA,uFACA,sCAEA,sFACA,sCAEA,wDACA,gGAEA,iFAEA,GAAA,EACA,KAAK;CAAI,CACb,cCvEO,IAAMC,GAAiB,CAC5B,SAAU,CACR,SAAU,CAAE,MAAO,IAAK,EACxB,OAAQ,CAAE,MAAO,IAAIC,GAAQ,IAAK,GAAG,CAAE,CACzC,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,OACA,QACA,UACA,WACA,KACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,cACA,YACA,eACA,cACA,aACA,YACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,YACA,MACA,aACA,aACA,aACA,OACA,WACA,WACA,MACA,SACA,UACA,WACA,cACA,eACA,gBACA,gBACA,iBACA,KACA,KACA,SACA,SACA,YACA,iBACA,YACA,SACA,iBACA,eACA,gBACA,iBACA,WACA,cACA,eACA,QACA,QACA,aACA,QACA,SACA,QACA,YACA,WACA,OACA,UACA,eACA,SACA,QACA,SACA,KACA,cACA,SACA,SACA,KACA,eACA,KACA,WACA,SACA,SACA,KACA,aACA,cACA,aACA,KACA,YACA,MACA,UACA,YACA,QACA,aACA,SACA,YACA,SACA,QACA,gBACA,cACA,aACA,QACA,MACA,WACA,gBACA,YACA,SACA,cACA,YACA,SACA,QACA,SACA,WACA,SACA,cACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,YACA,SACA,SACA,cACA,YACA,SACA,QACA,SACA,WACA,SACA,cACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,YACA,SACA,cACA,oBACA,iBACA,iBACA,iBACA,aACA,oBACA,qBACA,SACA,iBACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,gBACA,sBACA,iBACA,gBACA,YACA,YACA,eACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,KACA,MACA,MACA,oBACA,qBACA,kBACA,iBACA,aACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,gBACA,YACA,SACA,aACA,kBACA,eACA,cACA,cACA,cACA,gBACA,aACA,aACA,iBACA,cACA,aACA,iBACA,cACA,YACA,eACA,oBACA,YACA,eACA,cACA,eACA,WACA,YACA,eACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,iBACA,iBACA,gBACA,cACA,cACA,mBACA,cACA,iBACA,aACA,UACA,gBACA,cACA,cACA,mBACA,iBACA,cACA,cACA,mBACA,iBACA,WACA,cACA,cACA,cACA,mBACA,cACA,iBACA,UACA,cACA,cACA,cACA,mBACA,iBACA,cACA,aACA,iBACA,UACA,UACA,UACA,UACA,QACA,OACA,OACA,QACA,SACA,UACA,QACA,UACD,EAEGC,GAAsB,CACxB,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,QACA,SACA,WACA,aACA,SACA,UACA,YACA,aACA,YACA,aACA,WACA,OACA,QACA,SACA,SACA,QACA,OACA,MACA,MACA,QACA,OACA,OACA,MACA,QACA,QACA,OACA,QACA,YACA,OACA,QACA,UACA,WACA,KACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,cACA,YACA,eACA,cACA,aACA,YACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,YACA,MACA,aACA,aACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,aACA,OACA,WACA,WACA,MACA,SACA,UACA,WACA,cACA,eACA,gBACA,gBACA,iBACA,KACA,KACA,GACA,SACA,SACA,YACA,iBACA,GACA,YACA,SACA,iBACA,eACA,gBACA,iBACA,WACA,cACA,GACA,eACA,GACA,QACA,QACA,aACA,QACA,SACA,QACA,YACA,WACA,GACA,OACA,UACA,GACA,eACA,SACA,QACA,SACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,KACA,GACA,cACA,GACA,GACA,GACA,GACA,SACA,SACA,KACA,eACA,GACA,GACA,GACA,GACA,GACA,KACA,GACA,GACA,GACA,WACA,GACA,GACA,SACA,SACA,KACA,YACD,EAEGC,GAAoB,CACtB,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,QACA,cACA,oBACA,GACA,iBACA,iBACA,iBACA,aACA,oBACA,qBACA,iBACA,iBACA,QACA,SACA,SACA,WACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,QACA,YACA,gBACA,sBACA,iBACA,gBACA,GACA,YACA,YACA,eACA,YACA,YACA,GACA,GACA,YACA,GACA,GACA,YACA,YACA,YACA,YACA,GACA,GACA,YACA,YACA,YACA,GACA,KACA,KACA,KACA,MACA,MACA,oBACA,GACA,qBACA,kBACA,iBACA,aACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,gBACA,YACA,SACA,aACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,kBACA,eACA,cACA,GACA,GACA,cACA,cACA,gBACA,aACA,aACA,GACA,iBACA,GACA,GACA,cACA,GACA,GACA,aACA,iBACA,GACA,GACA,cACA,YACA,eACA,GACA,GACA,GACA,aACA,UACA,gBACA,oBACA,YACA,eACA,cACA,eACA,WACA,YACA,GACA,GACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,iBACA,iBACA,gBACA,cACA,cACA,mBACA,cACA,iBACA,aACA,UACA,gBACA,cACA,cACA,mBACA,iBACA,cACA,cACA,mBACA,iBACA,WACA,cACA,cACA,cACA,mBACA,cACA,iBACA,UACA,cACA,cACA,cACA,mBACA,iBACA,cACA,aACA,gBACD,EAEGC,GAAgB,CAClB,UACA,QACA,mBACA,QACA,SACA,WACA,aACA,SACA,UACA,YACA,cACA,YACA,aACA,WACA,OACA,QACA,SACA,SACA,QACA,OACA,MACA,MACA,QACA,OACA,OACA,MACA,QACA,QACA,OACA,QACA,YACA,OACA,QACA,UACA,WACA,KACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,cACA,YACA,eACA,cACA,aACA,QACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,YACA,MACA,aACA,aACA,YACA,QACA,WACA,SACA,SACA,YACA,YACA,SACA,SACA,cACA,YACA,SACA,QACA,WACA,SACA,SACA,cACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,OACA,WACA,UACA,SACA,YACA,aACA,aACA,YACA,YACA,QACA,WACA,WACA,KACA,SACA,WACA,YACA,YACA,eACA,MACA,KACA,cACA,YACA,UACA,KACA,WACA,cACA,eACA,QACA,KACA,SACA,eACA,aACA,aACA,UACA,SACA,cACA,QACA,gBACA,iBACA,WACA,mBACA,SACA,SACA,SACA,KACA,KACA,SACA,SACA,eACA,gBACA,YACA,aACA,SACA,UACA,YACA,YACA,WACA,WACA,gBACA,iBACA,KACA,KACA,YACA,iBACA,iBACA,eACA,cACA,cACA,cACA,SACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,cACA,QACA,SACA,SACA,cACA,SACA,WACA,aACA,QACA,SACA,QACA,YACA,OACA,UACA,eACA,SACA,QACA,SACA,SACA,SACA,SACA,SACA,SACA,YACA,MACA,MACA,SACA,SACA,QACA,QACA,QACA,WACA,cACA,cACA,gBACA,UACA,aACA,gBACA,QACA,SACA,SACA,aACA,WACA,WACA,SACA,SACA,SACA,SACA,QACD,EAWD,SAASC,GAAgBC,EAAM,CAC7B,KAAK,KAAOA,CACb,CAEDD,GAAgB,UAAU,iBAAmB,SAAUzN,EAAG,CACxD,IAAIoM,EAAOpM,EAAE,YAAY,CAAC,EACtBuM,EAAS,KAAK,KAAK,OACvB,GAAIA,GACF,QAAS/P,EAAI,EAAGA,EAAI+P,EAAO,OAAQ/P,GAAK,EAEtC,QADImQ,EAAQJ,EAAO,IAAI/P,CAAC,EACf0G,EAAI,EAAGA,EAAIyJ,EAAM,SAAS,OAAQzJ,GAAK,EAC9C,GAAIyJ,EAAM,SAASzJ,CAAC,IAAMkJ,EACxB,OAAO5P,EAKf,OAAO,IACR,EAQD,SAASmR,GAAa7C,EAAM,CAC1B,KAAK,KAAOA,CACb,CAMD6C,GAAa,UAAU,iBAAmB,SAAU3N,EAAG,CACrD,OAAO,KAAK,KAAK,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,EAAMC,EAAQoB,EAAMnB,EAAQ,CAClE,OAAIS,EAAQ,OAAS,EACZS,EAAarB,EAAOC,EAAMC,EAAQS,EAASW,CAAI,EAAGZ,EAAQP,CAAM,CAAC,EAGnEb,EAAM,KAAK,UAAY,CAC5B,IAAIS,EAAS,IAAI,WAAWC,EAAQC,CAAI,EACxC,OAAAJ,EAAOR,EAAS,QAAQsB,EAASW,CAAI,CAAC,EAAGvB,EAAQC,EAAOC,EAAMC,EAAQb,EAAS,QAAQqB,EAAQP,CAAM,CAAC,CAAC,EAChGJ,CACT,CAAC,CACH,CACF,CACF,EAAG,EpJjKI,IAAM4B,GAAqBC,GAChC,WAA6DA,CAAW,GAgL1E,IAAMC,GAAS,IAAIC,GACnBD,GAAO,kBAAkBE,EAAc,EAEvC,IAAMC,GAAc,IAAIC,GACxBD,GAAY,eAAe,yDAAyD,EACpFH,GAAO,eAAeG,EAAW,EHvNjC,IAAOE,GAAQC,GAAO,CACpB,KAAM,QACN,WAAYC,GAAkB,UAAU,EACxC,SAAU,wBACZ,CAAC,EFJDC,GAAO,UAAU,CACf,MAAAC,GACA,cAAe,QACf,UAAW,EACb,CAAC", + "sourcesContent": ["", "", "", "export default __REACT__;\nconst { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version } = __REACT__;\nexport { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version };", "/**\n * @license React\n * react-reconciler-constants.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';exports.ConcurrentRoot=1;exports.ContinuousEventPriority=4;exports.DefaultEventPriority=16;exports.DiscreteEventPriority=1;exports.IdleEventPriority=536870912;exports.LegacyRoot=0;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-reconciler-constants.production.min.js');\n} else {\n module.exports = require('./cjs/react-reconciler-constants.development.js');\n}\n", "/**\n * @license React\n * scheduler.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';function f(a,b){var c=a.length;a.push(b);a:for(;0>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n", "/**\n * @license React\n * react-reconciler.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nmodule.exports = function $$$reconciler($$$hostConfig) {\n var exports = {};\n'use strict';var aa=require(\"react\"),ba=require(\"scheduler\"),ca=Object.assign;function n(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;ch||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{bc=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?ac(a):\"\"}var dc=Object.prototype.hasOwnProperty,ec=[],fc=-1;function gc(a){return{current:a}}\nfunction x(a){0>fc||(a.current=ec[fc],ec[fc]=null,fc--)}function y(a,b){fc++;ec[fc]=a.current;a.current=b}var hc={},A=gc(hc),B=gc(!1),ic=hc;function jc(a,b){var c=a.type.contextTypes;if(!c)return hc;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction C(a){a=a.childContextTypes;return null!==a&&void 0!==a}function kc(){x(B);x(A)}function lc(a,b,c){if(A.current!==hc)throw Error(n(168));y(A,b);y(B,c)}function mc(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(n(108,xa(a)||\"Unknown\",e));return ca({},c,d)}\nfunction nc(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||hc;ic=A.current;y(A,a);y(B,B.current);return!0}function oc(a,b,c){var d=a.stateNode;if(!d)throw Error(n(169));c?(a=mc(a,b,ic),d.__reactInternalMemoizedMergedChildContext=a,x(B),x(A),y(A,a)):x(B);y(B,c)}var qc=Math.clz32?Math.clz32:pc,rc=Math.log,sc=Math.LN2;function pc(a){a>>>=0;return 0===a?32:31-(rc(a)/sc|0)|0}var tc=64,uc=4194304;\nfunction vc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function wc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=vc(h):(f&=g,0!==f&&(d=vc(f)))}else g=c&~e,0!==g?d=vc(g):0!==f&&(d=vc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}function Bc(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-qc(b);a[b]=c}\nfunction Cc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0>=g;e-=g;Nd=1<<32-qc(b)+e|c<u?(t=w,w=null):t=w.sibling;var q=r(e,w,h[u],k);if(null===q){null===w&&(w=t);break}a&&w&&null===q.alternate&&b(e,w);g=f(q,g,u);null===m?l=q:m.sibling=q;m=q;w=t}if(u===h.length)return c(e,w),I&&Pd(e,u),l;if(null===w){for(;uu?(q=m,m=null):q=m.sibling;var V=r(e,m,t.value,k);if(null===V){null===m&&(m=q);break}a&&m&&null===V.alternate&&b(e,m);g=f(V,g,u);null===w?l=V:w.sibling=V;w=V;m=q}if(t.done)return c(e,\nm),I&&Pd(e,u),l;if(null===m){for(;!t.done;u++,t=h.next())t=v(e,t.value,k),null!==t&&(g=f(t,g,u),null===w?l=t:w.sibling=t,w=t);I&&Pd(e,u);return l}for(m=d(e,m);!t.done;u++,t=h.next())t=z(m,e,u,t.value,k),null!==t&&(a&&null!==t.alternate&&m.delete(null===t.key?u:t.key),g=f(t,g,u),null===w?l=t:w.sibling=t,w=t);a&&m.forEach(function(a){return b(e,a)});I&&Pd(e,u);return l}function da(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ia&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==\nf){switch(f.$$typeof){case fa:a:{for(var k=f.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ia){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===ra&&he(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=fe(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ia?(d=ne(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=le(f.type,f.key,f.props,null,a.mode,h),h.ref=fe(a,d,f),h.return=\na,a=h)}return g(a);case ha:a:{for(l=f.key;null!==d;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=me(f,a.mode,h);d.return=a;a=d}return g(a);case ra:return l=f._init,da(a,d,l(f._payload),h)}if(Ea(f))return q(a,d,f,h);if(ua(f))return N(a,d,f,h);ge(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&\n6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=ke(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return da}var oe=ie(!0),pe=ie(!1),qe={},re=gc(qe),se=gc(qe),te=gc(qe);function ue(a){if(a===qe)throw Error(n(174));return a}function ve(a,b){y(te,b);y(se,a);y(re,qe);a=Ga(b);x(re);y(re,a)}function we(){x(re);x(se);x(te)}function xe(a){var b=ue(te.current),c=ue(re.current);b=Ha(c,a.type,b);c!==b&&(y(se,a),y(re,b))}function ye(a){se.current===a&&(x(re),x(se))}var J=gc(0);\nfunction ze(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||Ib(c)||Jb(c)))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var Ae=[];\nfunction Be(){for(var a=0;ac?c:4;a(!0);var d=De.transition;De.transition={};try{a(!1),b()}finally{D=c,De.transition=d}}function rf(){return Re().memoizedState}function sf(a,b,c){var d=zd(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};tf(a)?uf(b,c):(vf(a,b,c),c=H(),a=Ad(a,d,c),null!==a&&wf(a,b,d))}\nfunction df(a,b,c){var d=zd(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(tf(a))uf(b,e);else{vf(a,b,e);var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(Rc(h,g))return}catch(k){}finally{}c=H();a=Ad(a,d,c);null!==a&&wf(a,b,d)}}function tf(a){var b=a.alternate;return a===K||null!==b&&b===K}\nfunction uf(a,b){Ge=Fe=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function vf(a,b,c){null!==F&&0!==(a.mode&1)&&0===(G&2)?(a=b.interleaved,null===a?(c.next=c,null===md?md=[b]:md.push(b)):(c.next=a.next,a.next=c),b.interleaved=c):(a=b.pending,null===a?c.next=c:(c.next=a.next,a.next=c),b.pending=c)}function wf(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Dc(a,c)}}\nvar Oe={readContext:ld,useCallback:O,useContext:O,useEffect:O,useImperativeHandle:O,useInsertionEffect:O,useLayoutEffect:O,useMemo:O,useReducer:O,useRef:O,useState:O,useDebugValue:O,useDeferredValue:O,useTransition:O,useMutableSource:O,useSyncExternalStore:O,useId:O,unstable_isNewReconciler:!1},Le={readContext:ld,useCallback:function(a,b){Qe().memoizedState=[a,void 0===b?null:b];return a},useContext:ld,useEffect:hf,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ff(4194308,\n4,lf.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ff(4194308,4,a,b)},useInsertionEffect:function(a,b){return ff(4,2,a,b)},useMemo:function(a,b){var c=Qe();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Qe();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=sf.bind(null,K,a);return[d.memoizedState,a]},useRef:function(a){var b=\nQe();a={current:a};return b.memoizedState=a},useState:cf,useDebugValue:nf,useDeferredValue:function(a){var b=cf(a),c=b[0],d=b[1];hf(function(){var b=De.transition;De.transition={};try{d(a)}finally{De.transition=b}},[a]);return c},useTransition:function(){var a=cf(!1),b=a[0];a=qf.bind(null,a[1]);Qe().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=K,e=Qe();if(I){if(void 0===c)throw Error(n(407));c=c()}else{c=b();if(null===F)throw Error(n(349));\n0!==(Ee&30)||af(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;hf(Ye.bind(null,d,f,a),[a]);d.flags|=2048;Ze(9,$e.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Qe(),b=F.identifierPrefix;if(I){var c=Od;var d=Nd;c=(d&~(1<<32-qc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=He++;0Uf&&(b.flags|=128,d=!0,Qf(e,!1),b.lanes=4194304)}else{if(!d)if(a=ze(f),null!==a){if(b.flags|=128,d=!0,a=a.updateQueue,null!==a&&(b.updateQueue=a,b.flags|=4),Qf(e,!0),null===e.tail&&\"hidden\"===e.tailMode&&!f.alternate&&!I)return P(b),null}else 2*E()-e.renderingStartTime>Uf&&1073741824!==c&&(b.flags|=128,d=!0,Qf(e,!1),b.lanes=4194304);e.isBackwards?(f.sibling=b.child,b.child=f):(a=e.last,null!==a?a.sibling=f:b.child=f,e.last=f)}if(null!==\ne.tail)return b=e.tail,e.rendering=b,e.tail=b.sibling,e.renderingStartTime=E(),b.sibling=null,a=J.current,y(J,d?a&1|2:a&1),b;P(b);return null;case 22:case 23:return Vf(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(Wf&1073741824)&&(P(b),Ua&&b.subtreeFlags&6&&(b.flags|=8192)):P(b),null;case 24:return null;case 25:return null}throw Error(n(156,b.tag));}var Xf=ea.ReactCurrentOwner,kd=!1;\nfunction R(a,b,c,d){b.child=null===a?pe(b,null,c,d):oe(b,a.child,c,d)}function Yf(a,b,c,d,e){c=c.render;var f=b.ref;jd(b,e);d=Ke(a,b,c,d,f,e);c=Pe();if(null!==a&&!kd)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Zf(a,b,e);I&&c&&Rd(b);b.flags|=1;R(a,b,d,e);return b.child}\nfunction $f(a,b,c,d,e){if(null===a){var f=c.type;if(\"function\"===typeof f&&!ag(f)&&void 0===f.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=f,bg(a,b,f,d,e);a=le(c.type,null,d,b,b.mode,e);a.ref=b.ref;a.return=b;return b.child=a}f=a.child;if(0===(a.lanes&e)){var g=f.memoizedProps;c=c.compare;c=null!==c?c:Zc;if(c(g,d)&&a.ref===b.ref)return Zf(a,b,e)}b.flags|=1;a=je(f,d);a.ref=b.ref;a.return=b;return b.child=a}\nfunction bg(a,b,c,d,e){if(null!==a&&Zc(a.memoizedProps,d)&&a.ref===b.ref)if(kd=!1,0!==(a.lanes&e))0!==(a.flags&131072)&&(kd=!0);else return b.lanes=a.lanes,Zf(a,b,e);return cg(a,b,c,d,e)}\nfunction dg(a,b,c){var d=b.pendingProps,e=d.children,f=null!==a?a.memoizedState:null;if(\"hidden\"===d.mode)if(0===(b.mode&1))b.memoizedState={baseLanes:0,cachePool:null},y(eg,Wf),Wf|=c;else if(0!==(c&1073741824))b.memoizedState={baseLanes:0,cachePool:null},d=null!==f?f.baseLanes:c,y(eg,Wf),Wf|=d;else return a=null!==f?f.baseLanes|c:c,b.lanes=b.childLanes=1073741824,b.memoizedState={baseLanes:a,cachePool:null},b.updateQueue=null,y(eg,Wf),Wf|=a,null;else null!==f?(d=f.baseLanes|c,b.memoizedState=null):\nd=c,y(eg,Wf),Wf|=d;R(a,b,e,c);return b.child}function fg(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.flags|=512,b.flags|=2097152}function cg(a,b,c,d,e){var f=C(c)?ic:A.current;f=jc(b,f);jd(b,e);c=Ke(a,b,c,d,f,e);d=Pe();if(null!==a&&!kd)return b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~e,Zf(a,b,e);I&&d&&Rd(b);b.flags|=1;R(a,b,c,e);return b.child}\nfunction gg(a,b,c,d,e){if(C(c)){var f=!0;nc(b)}else f=!1;jd(b,e);if(null===b.stateNode)null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),Dd(b,c,d),Fd(b,c,d,e),d=!0;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,l=c.contextType;\"object\"===typeof l&&null!==l?l=ld(l):(l=C(c)?ic:A.current,l=jc(b,l));var m=c.getDerivedStateFromProps,v=\"function\"===typeof m||\"function\"===typeof g.getSnapshotBeforeUpdate;v||\"function\"!==typeof g.UNSAFE_componentWillReceiveProps&&\"function\"!==\ntypeof g.componentWillReceiveProps||(h!==d||k!==l)&&Ed(b,g,d,l);nd=!1;var r=b.memoizedState;g.state=r;ud(b,d,g,e);k=b.memoizedState;h!==d||r!==k||B.current||nd?(\"function\"===typeof m&&(yd(b,c,m,d),k=b.memoizedState),(h=nd||Cd(b,c,h,d,r,k,l))?(v||\"function\"!==typeof g.UNSAFE_componentWillMount&&\"function\"!==typeof g.componentWillMount||(\"function\"===typeof g.componentWillMount&&g.componentWillMount(),\"function\"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),\"function\"===typeof g.componentDidMount&&\n(b.flags|=4194308)):(\"function\"===typeof g.componentDidMount&&(b.flags|=4194308),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=l,d=h):(\"function\"===typeof g.componentDidMount&&(b.flags|=4194308),d=!1)}else{g=b.stateNode;pd(a,b);h=b.memoizedProps;l=b.type===b.elementType?h:ad(b.type,h);g.props=l;v=b.pendingProps;r=g.context;k=c.contextType;\"object\"===typeof k&&null!==k?k=ld(k):(k=C(c)?ic:A.current,k=jc(b,k));var z=c.getDerivedStateFromProps;(m=\"function\"===typeof z||\"function\"===\ntypeof g.getSnapshotBeforeUpdate)||\"function\"!==typeof g.UNSAFE_componentWillReceiveProps&&\"function\"!==typeof g.componentWillReceiveProps||(h!==v||r!==k)&&Ed(b,g,d,k);nd=!1;r=b.memoizedState;g.state=r;ud(b,d,g,e);var q=b.memoizedState;h!==v||r!==q||B.current||nd?(\"function\"===typeof z&&(yd(b,c,z,d),q=b.memoizedState),(l=nd||Cd(b,c,l,d,r,q,k)||!1)?(m||\"function\"!==typeof g.UNSAFE_componentWillUpdate&&\"function\"!==typeof g.componentWillUpdate||(\"function\"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,\nq,k),\"function\"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,q,k)),\"function\"===typeof g.componentDidUpdate&&(b.flags|=4),\"function\"===typeof g.getSnapshotBeforeUpdate&&(b.flags|=1024)):(\"function\"!==typeof g.componentDidUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=4),\"function\"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),b.memoizedProps=d,b.memoizedState=q),g.props=d,g.state=q,g.context=k,d=l):(\"function\"!==\ntypeof g.componentDidUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=4),\"function\"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&r===a.memoizedState||(b.flags|=1024),d=!1)}return hg(a,b,c,d,f,e)}\nfunction hg(a,b,c,d,e,f){fg(a,b);var g=0!==(b.flags&128);if(!d&&!g)return e&&oc(b,c,!1),Zf(a,b,f);d=b.stateNode;Xf.current=b;var h=g&&\"function\"!==typeof c.getDerivedStateFromError?null:d.render();b.flags|=1;null!==a&&g?(b.child=oe(b,a.child,null,f),b.child=oe(b,null,h,f)):R(a,b,h,f);b.memoizedState=d.state;e&&oc(b,c,!0);return b.child}function ig(a){var b=a.stateNode;b.pendingContext?lc(a,b.pendingContext,b.pendingContext!==b.context):b.context&&lc(a,b.context,!1);ve(a,b.containerInfo)}\nfunction jg(a,b,c,d,e){de();ee(e);b.flags|=256;R(a,b,c,d);return b.child}var kg={dehydrated:null,treeContext:null,retryLane:0};function lg(a){return{baseLanes:a,cachePool:null}}\nfunction mg(a,b,c){var d=b.pendingProps,e=J.current,f=!1,g=0!==(b.flags&128),h;(h=g)||(h=null!==a&&null===a.memoizedState?!1:0!==(e&2));if(h)f=!0,b.flags&=-129;else if(null===a||null!==a.memoizedState)e|=1;y(J,e&1);if(null===a){ae(b);a=b.memoizedState;if(null!==a&&(a=a.dehydrated,null!==a))return 0===(b.mode&1)?b.lanes=1:Jb(a)?b.lanes=8:b.lanes=1073741824,null;e=d.children;a=d.fallback;return f?(d=b.mode,f=b.child,e={mode:\"hidden\",children:e},0===(d&1)&&null!==f?(f.childLanes=0,f.pendingProps=e):\nf=ng(e,d,0,null),a=ne(a,d,c,null),f.return=b,a.return=b,f.sibling=a,b.child=f,b.child.memoizedState=lg(c),b.memoizedState=kg,a):og(b,e)}e=a.memoizedState;if(null!==e){h=e.dehydrated;if(null!==h){if(g){if(b.flags&256)return b.flags&=-257,pg(a,b,c,Error(n(422)));if(null!==b.memoizedState)return b.child=a.child,b.flags|=128,null;f=d.fallback;e=b.mode;d=ng({mode:\"visible\",children:d.children},e,0,null);f=ne(f,e,c,null);f.flags|=2;d.return=b;f.return=b;d.sibling=f;b.child=d;0!==(b.mode&1)&&oe(b,a.child,\nnull,c);b.child.memoizedState=lg(c);b.memoizedState=kg;return f}if(0===(b.mode&1))b=pg(a,b,c,null);else if(Jb(h))b=pg(a,b,c,Error(n(419)));else if(d=0!==(c&a.childLanes),kd||d){d=F;if(null!==d){switch(c&-c){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=\n268435456;break;default:f=0}d=0!==(f&(d.suspendedLanes|c))?0:f;0!==d&&d!==e.retryLane&&(e.retryLane=d,Ad(a,d,-1))}Tf();b=pg(a,b,c,Error(n(421)))}else Ib(h)?(b.flags|=128,b.child=a.child,b=qg.bind(null,a),Kb(h,b),b=null):(c=e.treeContext,p&&(Ud=Ob(h),Td=b,I=!0,Wd=null,Vd=!1,null!==c&&(Kd[Ld++]=Nd,Kd[Ld++]=Od,Kd[Ld++]=Md,Nd=c.id,Od=c.overflow,Md=b)),b=og(b,b.pendingProps.children),b.flags|=4096);return b}if(f)return d=rg(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=\nnull===e?lg(c):{baseLanes:e.baseLanes|c,cachePool:null},f.childLanes=a.childLanes&~c,b.memoizedState=kg,d;c=sg(a,b,d.children,c);b.memoizedState=null;return c}if(f)return d=rg(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=null===e?lg(c):{baseLanes:e.baseLanes|c,cachePool:null},f.childLanes=a.childLanes&~c,b.memoizedState=kg,d;c=sg(a,b,d.children,c);b.memoizedState=null;return c}\nfunction og(a,b){b=ng({mode:\"visible\",children:b},a.mode,0,null);b.return=a;return a.child=b}function sg(a,b,c,d){var e=a.child;a=e.sibling;c=je(e,{mode:\"visible\",children:c});0===(b.mode&1)&&(c.lanes=d);c.return=b;c.sibling=null;null!==a&&(d=b.deletions,null===d?(b.deletions=[a],b.flags|=16):d.push(a));return b.child=c}\nfunction rg(a,b,c,d,e){var f=b.mode;a=a.child;var g=a.sibling,h={mode:\"hidden\",children:c};0===(f&1)&&b.child!==a?(c=b.child,c.childLanes=0,c.pendingProps=h,b.deletions=null):(c=je(a,h),c.subtreeFlags=a.subtreeFlags&14680064);null!==g?d=je(g,d):(d=ne(d,f,e,null),d.flags|=2);d.return=b;c.return=b;c.sibling=d;b.child=c;return d}function pg(a,b,c,d){null!==d&&ee(d);oe(b,a.child,null,c);a=og(b,b.pendingProps.children);a.flags|=2;b.memoizedState=null;return a}\nfunction tg(a,b,c){a.lanes|=b;var d=a.alternate;null!==d&&(d.lanes|=b);id(a.return,b,c)}function ug(a,b,c,d,e){var f=a.memoizedState;null===f?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e}:(f.isBackwards=b,f.rendering=null,f.renderingStartTime=0,f.last=d,f.tail=c,f.tailMode=e)}\nfunction vg(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;R(a,b,d.children,c);d=J.current;if(0!==(d&2))d=d&1|2,b.flags|=128;else{if(null!==a&&0!==(a.flags&128))a:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&tg(a,c,b);else if(19===a.tag)tg(a,c,b);else if(null!==a.child){a.child.return=a;a=a.child;continue}if(a===b)break a;for(;null===a.sibling;){if(null===a.return||a.return===b)break a;a=a.return}a.sibling.return=a.return;a=a.sibling}d&=1}y(J,d);if(0===(b.mode&1))b.memoizedState=\nnull;else switch(e){case \"forwards\":c=b.child;for(e=null;null!==c;)a=c.alternate,null!==a&&null===ze(a)&&(e=c),c=c.sibling;c=e;null===c?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null);ug(b,!1,e,c,f);break;case \"backwards\":c=null;e=b.child;for(b.child=null;null!==e;){a=e.alternate;if(null!==a&&null===ze(a)){b.child=e;break}a=e.sibling;e.sibling=c;c=e;e=a}ug(b,!0,c,null,f);break;case \"together\":ug(b,!1,null,null,void 0);break;default:b.memoizedState=null}return b.child}\nfunction Zf(a,b,c){null!==a&&(b.dependencies=a.dependencies);vd|=b.lanes;if(0===(c&b.childLanes))return null;if(null!==a&&b.child!==a.child)throw Error(n(153));if(null!==b.child){a=b.child;c=je(a,a.pendingProps);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=je(a,a.pendingProps),c.return=b;c.sibling=null}return b.child}\nfunction wg(a,b,c){switch(b.tag){case 3:ig(b);de();break;case 5:xe(b);break;case 1:C(b.type)&&nc(b);break;case 4:ve(b,b.stateNode.containerInfo);break;case 10:gd(b,b.type._context,b.memoizedProps.value);break;case 13:var d=b.memoizedState;if(null!==d){if(null!==d.dehydrated)return y(J,J.current&1),b.flags|=128,null;if(0!==(c&b.child.childLanes))return mg(a,b,c);y(J,J.current&1);a=Zf(a,b,c);return null!==a?a.sibling:null}y(J,J.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&128)){if(d)return vg(a,\nb,c);b.flags|=128}var e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);y(J,J.current);if(d)break;else return null;case 22:case 23:return b.lanes=0,dg(a,b,c)}return Zf(a,b,c)}\nfunction xg(a,b){Sd(b);switch(b.tag){case 1:return C(b.type)&&kc(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return we(),x(B),x(A),Be(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return ye(b),null;case 13:x(J);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(n(340));de()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return x(J),null;case 4:return we(),null;case 10:return hd(b.type._context),null;case 22:case 23:return Vf(),\nnull;case 24:return null;default:return null}}var yg=!1,zg=!1,Ag=\"function\"===typeof WeakSet?WeakSet:Set,S=null;function Bg(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){T(a,b,d)}else c.current=null}function Cg(a,b,c){try{c()}catch(d){T(a,b,d)}}var Dg=!1;\nfunction Eg(a,b){Ia(a.containerInfo);for(S=b;null!==S;)if(a=S,b=a.child,0!==(a.subtreeFlags&1028)&&null!==b)b.return=a,S=b;else for(;null!==S;){a=S;try{var c=a.alternate;if(0!==(a.flags&1024))switch(a.tag){case 0:case 11:case 15:break;case 1:if(null!==c){var d=c.memoizedProps,e=c.memoizedState,f=a.stateNode,g=f.getSnapshotBeforeUpdate(a.elementType===a.type?d:ad(a.type,d),e);f.__reactInternalSnapshotBeforeUpdate=g}break;case 3:Ua&&xb(a.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;\ndefault:throw Error(n(163));}}catch(h){T(a,a.return,h)}b=a.sibling;if(null!==b){b.return=a.return;S=b;break}S=a.return}c=Dg;Dg=!1;return c}function Fg(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Cg(b,c,f)}e=e.next}while(e!==d)}}function Gg(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}\nfunction Hg(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=Fa(c);break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Ig(a,b,c){if(Oc&&\"function\"===typeof Oc.onCommitFiberUnmount)try{Oc.onCommitFiberUnmount(Nc,b)}catch(g){}switch(b.tag){case 0:case 11:case 14:case 15:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var d=a=a.next;do{var e=d,f=e.destroy;e=e.tag;void 0!==f&&(0!==(e&2)?Cg(b,c,f):0!==(e&4)&&Cg(b,c,f));d=d.next}while(d!==a)}break;case 1:Bg(b,c);a=b.stateNode;if(\"function\"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount()}catch(g){T(b,\nc,g)}break;case 5:Bg(b,c);break;case 4:Ua?Jg(a,b,c):Va&&Va&&(b=b.stateNode.containerInfo,c=zb(b),Cb(b,c))}}function Kg(a,b,c){for(var d=b;;)if(Ig(a,d,c),null===d.child||Ua&&4===d.tag){if(d===b)break;for(;null===d.sibling;){if(null===d.return||d.return===b)return;d=d.return}d.sibling.return=d.return;d=d.sibling}else d.child.return=d,d=d.child}\nfunction Lg(a){var b=a.alternate;null!==b&&(a.alternate=null,Lg(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&Za(b));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Mg(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Ng(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Mg(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Og(a){if(Ua){a:{for(var b=a.return;null!==b;){if(Mg(b))break a;b=b.return}throw Error(n(160));}var c=b;switch(c.tag){case 5:b=c.stateNode;c.flags&32&&(sb(b),c.flags&=-33);c=Ng(a);Pg(a,c,b);break;case 3:case 4:b=c.stateNode.containerInfo;c=Ng(a);Qg(a,c,b);break;default:throw Error(n(161));}}}function Qg(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?pb(c,a,b):kb(c,a);else if(4!==d&&(a=a.child,null!==a))for(Qg(a,b,c),a=a.sibling;null!==a;)Qg(a,b,c),a=a.sibling}\nfunction Pg(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?ob(c,a,b):jb(c,a);else if(4!==d&&(a=a.child,null!==a))for(Pg(a,b,c),a=a.sibling;null!==a;)Pg(a,b,c),a=a.sibling}\nfunction Jg(a,b,c){for(var d=b,e=!1,f,g;;){if(!e){e=d.return;a:for(;;){if(null===e)throw Error(n(160));f=e.stateNode;switch(e.tag){case 5:g=!1;break a;case 3:f=f.containerInfo;g=!0;break a;case 4:f=f.containerInfo;g=!0;break a}e=e.return}e=!0}if(5===d.tag||6===d.tag)Kg(a,d,c),g?rb(f,d.stateNode):qb(f,d.stateNode);else if(18===d.tag)g?Wb(f,d.stateNode):Vb(f,d.stateNode);else if(4===d.tag){if(null!==d.child){f=d.stateNode.containerInfo;g=!0;d.child.return=d;d=d.child;continue}}else if(Ig(a,d,c),null!==\nd.child){d.child.return=d;d=d.child;continue}if(d===b)break;for(;null===d.sibling;){if(null===d.return||d.return===b)return;d=d.return;4===d.tag&&(e=!1)}d.sibling.return=d.return;d=d.sibling}}\nfunction Rg(a,b){if(Ua){switch(b.tag){case 0:case 11:case 14:case 15:Fg(3,b,b.return);Gg(3,b);Fg(5,b,b.return);return;case 1:return;case 5:var c=b.stateNode;if(null!=c){var d=b.memoizedProps;a=null!==a?a.memoizedProps:d;var e=b.type,f=b.updateQueue;b.updateQueue=null;null!==f&&nb(c,f,e,a,d,b)}return;case 6:if(null===b.stateNode)throw Error(n(162));c=b.memoizedProps;lb(b.stateNode,null!==a?a.memoizedProps:c,c);return;case 3:p&&null!==a&&a.memoizedState.isDehydrated&&Tb(b.stateNode.containerInfo);return;\ncase 12:return;case 13:Sg(b);return;case 19:Sg(b);return;case 17:return}throw Error(n(163));}switch(b.tag){case 0:case 11:case 14:case 15:Fg(3,b,b.return);Gg(3,b);Fg(5,b,b.return);return;case 12:return;case 13:Sg(b);return;case 19:Sg(b);return;case 3:p&&null!==a&&a.memoizedState.isDehydrated&&Tb(b.stateNode.containerInfo);break;case 22:case 23:return}a:if(Va){switch(b.tag){case 1:case 5:case 6:break a;case 3:case 4:b=b.stateNode;Cb(b.containerInfo,b.pendingChildren);break a}throw Error(n(163));}}\nfunction Sg(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Ag);b.forEach(function(b){var d=Tg.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction Ug(a,b){for(S=b;null!==S;){b=S;var c=b.deletions;if(null!==c)for(var d=0;d\";case bh:return\":has(\"+(ih(a)||\"\")+\")\";case ch:return'[role=\"'+a.value+'\"]';case eh:return'\"'+a.value+'\"';case dh:return'[data-testname=\"'+a.value+'\"]';default:throw Error(n(365));}}\nfunction jh(a,b){var c=[];a=[a,0];for(var d=0;de&&(e=g);d&=~f}d=e;d=E()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lh(d/1960))-d;if(10a?16:a;if(null===uh)var d=!1;else{a=uh;uh=null;vh=0;if(0!==(G&6))throw Error(n(331));var e=G;G|=4;for(S=a.current;null!==S;){var f=S,g=f.child;if(0!==(S.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kE()-Vg?Ih(a,0):qh|=c);Z(a,b)}function Vh(a,b){0===b&&(0===(a.mode&1)?b=1:(b=uc,uc<<=1,0===(uc&130023424)&&(uc=4194304)));var c=H();a=Ah(a,b);null!==a&&(Bc(a,b,c),Z(a,c))}function qg(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Vh(a,c)}\nfunction Tg(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(n(314));}null!==d&&d.delete(b);Vh(a,c)}var Sh;\nSh=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||B.current)kd=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return kd=!1,wg(a,b,c);kd=0!==(a.flags&131072)?!0:!1}else kd=!1,I&&0!==(b.flags&1048576)&&Qd(b,Jd,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;var e=jc(b,A.current);jd(b,c);e=Ke(null,b,d,a,e,c);var f=Pe();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?\n(b.tag=1,b.memoizedState=null,b.updateQueue=null,C(d)?(f=!0,nc(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,od(b),e.updater=Bd,b.stateNode=e,e._reactInternals=b,Fd(b,d,a,c),b=hg(null,b,d,!0,f,c)):(b.tag=0,I&&f&&Rd(b),R(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Wh(d);a=ad(d,a);switch(e){case 0:b=cg(null,b,d,a,c);break a;case 1:b=gg(null,b,d,\na,c);break a;case 11:b=Yf(null,b,d,a,c);break a;case 14:b=$f(null,b,d,ad(d.type,a),c);break a}throw Error(n(306,d,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),cg(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),gg(a,b,d,e,c);case 3:a:{ig(b);if(null===a)throw Error(n(387));d=b.pendingProps;f=b.memoizedState;e=f.element;pd(a,b);ud(b,d,null,c);var g=b.memoizedState;d=g.element;if(p&&f.isDehydrated)if(f={element:d,isDehydrated:!1,\ncache:g.cache,transitions:g.transitions},b.updateQueue.baseState=f,b.memoizedState=f,b.flags&256){e=Error(n(423));b=jg(a,b,d,c,e);break a}else if(d!==e){e=Error(n(424));b=jg(a,b,d,c,e);break a}else for(p&&(Ud=Nb(b.stateNode.containerInfo),Td=b,I=!0,Wd=null,Vd=!1),c=pe(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{de();if(d===e){b=Zf(a,b,c);break a}R(a,b,d,c)}b=b.child}return b;case 5:return xe(b),null===a&&ae(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,\nOa(d,e)?g=null:null!==f&&Oa(d,f)&&(b.flags|=32),fg(a,b),R(a,b,g,c),b.child;case 6:return null===a&&ae(b),null;case 13:return mg(a,b,c);case 4:return ve(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=oe(b,null,d,c):R(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),Yf(a,b,d,e,c);case 7:return R(a,b,b.pendingProps,c),b.child;case 8:return R(a,b,b.pendingProps.children,c),b.child;case 12:return R(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=\nb.type._context;e=b.pendingProps;f=b.memoizedProps;g=e.value;gd(b,d,g);if(null!==f)if(Rc(f.value,g)){if(f.children===e.children&&!B.current){b=Zf(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=qd(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=\nc);id(f.return,c,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(n(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);id(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}R(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,jd(b,c),e=ld(e),d=d(e),b.flags|=\n1,R(a,b,d,c),b.child;case 14:return d=b.type,e=ad(d,b.pendingProps),e=ad(d.type,e),$f(a,b,d,e,c);case 15:return bg(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:ad(d,e),null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),b.tag=1,C(d)?(a=!0,nc(b)):a=!1,jd(b,c),Dd(b,d,e),Fd(b,d,e,c),hg(null,b,d,!0,a,c);case 19:return vg(a,b,c);case 22:return dg(a,b,c)}throw Error(n(156,b.tag));};function Dh(a,b){return Fc(a,b)}\nfunction Xh(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Yd(a,b,c,d){return new Xh(a,b,c,d)}function ag(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction Wh(a){if(\"function\"===typeof a)return ag(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===na)return 11;if(a===qa)return 14}return 2}\nfunction je(a,b){var c=a.alternate;null===c?(c=Yd(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction le(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)ag(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ia:return ne(c.children,e,f,b);case ja:g=8;e|=8;break;case ka:return a=Yd(12,c,b,e|2),a.elementType=ka,a.lanes=f,a;case oa:return a=Yd(13,c,b,e),a.elementType=oa,a.lanes=f,a;case pa:return a=Yd(19,c,b,e),a.elementType=pa,a.lanes=f,a;case sa:return ng(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case la:g=10;break a;case ma:g=9;break a;case na:g=11;\nbreak a;case qa:g=14;break a;case ra:g=16;d=null;break a}throw Error(n(130,null==a?a:typeof a,\"\"));}b=Yd(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function ne(a,b,c,d){a=Yd(7,a,d,b);a.lanes=c;return a}function ng(a,b,c,d){a=Yd(22,a,d,b);a.elementType=sa;a.lanes=c;a.stateNode={};return a}function ke(a,b,c){a=Yd(6,a,null,b);a.lanes=c;return a}\nfunction me(a,b,c){b=Yd(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction Yh(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=Sa;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=Ac(0);this.expirationTimes=Ac(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=Ac(0);this.identifierPrefix=d;this.onRecoverableError=e;p&&(this.mutableSourceEagerHydrationData=\nnull)}function Zh(a,b,c,d,e,f,g,h,k){a=new Yh(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Yd(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null};od(f);return a}\nfunction $h(a){if(!a)return hc;a=a._reactInternals;a:{if(ya(a)!==a||1!==a.tag)throw Error(n(170));var b=a;do{switch(b.tag){case 3:b=b.stateNode.context;break a;case 1:if(C(b.type)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}}b=b.return}while(null!==b);throw Error(n(171));}if(1===a.tag){var c=a.type;if(C(c))return mc(a,c,b)}return b}\nfunction ai(a){var b=a._reactInternals;if(void 0===b){if(\"function\"===typeof a.render)throw Error(n(188));a=Object.keys(a).join(\",\");throw Error(n(268,a));}a=Ba(b);return null===a?null:a.stateNode}function bi(a,b){a=a.memoizedState;if(null!==a&&null!==a.dehydrated){var c=a.retryLane;a.retryLane=0!==c&&c=l&&f>=v&&e<=m&&g<=r){a.splice(b,1);break}else if(!(d!==l||c.width!==k.width||rg)){v>f&&(k.height+=v-f,k.y=f);re)){l>d&&(k.width+=\nl-d,k.x=d);mc&&(c=g)),g \")+\"\\n\\nNo matching component was found for:\\n \")+a.join(\" > \")}return null};\nexports.getPublicRootInstance=function(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return Fa(a.child.stateNode);default:return a.child.stateNode}};\nexports.injectIntoDevTools=function(a){a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ea.ReactCurrentDispatcher,findHostInstanceByFiber:di,findFiberByHostInstance:a.findFiberByHostInstance||\nei,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:\"18.0.0-fc46dba67-20220329\"};if(\"undefined\"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)a=!1;else{var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)a=!0;else{try{Nc=b.inject(a),Oc=b}catch(c){}a=b.checkDCE?!0:!1}}return a};exports.isAlreadyRendering=function(){return!1};\nexports.observeVisibleRects=function(a,b,c,d){if(!bb)throw Error(n(363));a=kh(a,b);var e=ib(a,c,d).disconnect;return{disconnect:function(){e()}}};exports.registerMutableSourceForHydration=function(a,b){var c=b._getVersion;c=c(b._source);null==a.mutableSourceEagerHydrationData?a.mutableSourceEagerHydrationData=[b,c]:a.mutableSourceEagerHydrationData.push(b,c)};exports.runWithPriority=function(a,b){var c=D;try{return D=a,b()}finally{D=c}};exports.shouldError=function(){return null};\nexports.shouldSuspend=function(){return!1};exports.updateContainer=function(a,b,c,d){var e=b.current,f=H(),g=zd(e);c=$h(c);null===b.context?b.context=c:b.pendingContext=c;b=qd(f,g);b.payload={element:a};d=void 0===d?null:d;null!==d&&(b.callback=d);rd(e,b);a=Ad(e,g,f);null!==a&&sd(a,e,g);return g};\n\n return exports;\n};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-reconciler.production.min.js');\n} else {\n module.exports = require('./cjs/react-reconciler.development.js');\n}\n", "/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n", "/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n\n var debounced = function(){\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n \n debounced.flush = function() {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n \n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n};\n\n// Adds compatibility for ES modules\ndebounce.debounce = debounce;\n\nmodule.exports = debounce;\n", "import '/home/runner/work/visage/visage/.storybook/manager.js';", "import { addons } from '@storybook/addons';\nimport theme from './theme';\n\naddons.setConfig({\n theme,\n panelPosition: 'right',\n showPanel: true\n});\n", "export default __STORYBOOKADDONS__;\nconst { addons, types, mockChannel } = __STORYBOOKADDONS__;\nexport { addons, types, mockChannel };", "import { create } from '@storybook/theming';\nimport { getStoryAssetPath } from '../src/services';\n\nexport default create({\n base: 'light',\n brandImage: getStoryAssetPath('logo.png'),\n brandUrl: 'https://readyplayer.me'\n});\n", "export default __STORYBOOKTHEMING__;\nconst { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create, createCache, createGlobal, createReset, css, darken, ensure, ignoreSsrWarning, isPropValid, jsx, keyframes, lighten, styled, themes, typography, useTheme, withTheme } = __STORYBOOKTHEMING__;\nexport { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create, createCache, createGlobal, createReset, css, darken, ensure, ignoreSsrWarning, isPropValid, jsx, keyframes, lighten, styled, themes, typography, useTheme, withTheme };", "export * from './Models.service';\n", "import React, { useEffect, useCallback, useRef } from 'react';\nimport {\n LinearFilter,\n MeshStandardMaterial,\n Material,\n Vector2,\n Object3D,\n SkinnedMesh,\n Euler,\n Vector3,\n BufferGeometry,\n Skeleton,\n Group\n} from 'three';\nimport { useFrame } from '@react-three/fiber';\nimport type { ObjectMap, SkinnedMeshProps } from '@react-three/fiber';\nimport { GLTF, GLTFLoader, DRACOLoader } from 'three-stdlib';\nimport { suspend } from 'suspend-react';\nimport { Emotion } from 'src/components/Avatar/Avatar.component';\nimport { BloomConfiguration, MaterialConfiguration } from 'src/types';\nimport { MeshoptDecoder } from './meshopt_decoder';\n\nexport interface CustomNode extends Object3D {\n geometry: BufferGeometry;\n material: Material;\n skeleton: Skeleton;\n isMesh: boolean;\n morphTargetInfluences?: number[];\n}\n\nexport interface Nodes {\n [node: string]: Object3D;\n}\n\ntype Source = string | string[] | Blob | undefined | null;\n\nexport const getStoryAssetPath = (publicAsset: string) =>\n `${process.env.NODE_ENV === 'production' ? '/visage' : ''}/${publicAsset}`;\n\nconst validateSource = (source: Source): boolean => {\n if (Array.isArray(source)) {\n return source.length > 0 && source.every(validateSource);\n }\n\n if (typeof source === 'string') {\n const fileEndExpression = new RegExp(/(.glb|.fbx|.fbx[?].*|.glb[?].*)$/g);\n const uploadFileExpression = new RegExp(/^data:application\\/octet-stream;base64,/g);\n const gltfModelExpression = new RegExp(/^data:model\\/gltf-binary;base64,/g);\n return fileEndExpression.test(source) || uploadFileExpression.test(source) || gltfModelExpression.test(source);\n }\n\n if (source instanceof Blob) {\n return source.type === 'model/gltf-binary';\n }\n\n return false;\n};\n\nexport const isValidFormat = (source: Source): source is Blob | string => {\n const isValid = validateSource(source);\n\n if (source && !isValid) {\n console.warn(\n 'Provided GLB/FBX is invalid. Check docs for supported formats: https://github.com/readyplayerme/visage'\n );\n }\n\n return isValid;\n};\n\nexport const clamp = (value: number, max: number, min: number): number => Math.min(Math.max(min, value), max);\n\nexport const lerp = (start: number, end: number, time = 0.05): number => start * (1 - time) + end * time;\n\n/**\n * Avoid texture pixelation and add depth effect.\n */\nexport const normaliseMaterialsConfig = (\n materials: Record,\n bloomConfig?: BloomConfiguration,\n materialConfig?: MaterialConfiguration\n) => {\n Object.values(materials).forEach((material) => {\n const mat = material as MeshStandardMaterial;\n if (mat.map) {\n mat.map.minFilter = LinearFilter;\n mat.depthWrite = true;\n }\n\n if (mat.name.toLowerCase().includes('hair')) {\n mat.roughness = 0.9;\n }\n\n if (mat.emissiveMap) {\n mat.emissiveIntensity = bloomConfig?.materialIntensity ?? materialConfig?.emissiveIntensity ?? 3.3;\n }\n });\n};\n\ninterface UseHeadMovement {\n nodes: Nodes;\n isHalfBody?: boolean;\n distance?: number;\n activeRotation?: number;\n rotationMargin?: Vector2;\n enabled?: boolean;\n}\n\n/**\n * Avatar head movement relative to cursor.\n * When the model isn't a standard Ready Player Me avatar, the head movement won't take effect.\n */\nexport const useHeadMovement = ({\n nodes,\n isHalfBody = false,\n distance = 2,\n activeRotation = 0.2,\n rotationMargin = new Vector2(5, 10),\n enabled = false\n}: UseHeadMovement) => {\n const rad = Math.PI / 180;\n const currentPos = new Vector2(0, 0);\n const targetPos = new Vector2(0, 0);\n const activeDistance = distance - (isHalfBody ? 1 : 0);\n const eyeRotationOffsetX = isHalfBody ? 90 * rad : 0;\n const neckBoneRotationOffsetX = (isHalfBody ? -5 : 10) * rad;\n const mapRange = (value: number, inMin: number, inMax: number, outMin: number, outMax: number) =>\n ((clamp(value, inMax, inMin) - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;\n\n useFrame((state) => {\n if (!enabled || !nodes.Neck || !nodes.Head || !nodes.RightEye || !nodes.LeftEye) {\n return;\n }\n\n const cameraToHeadDistance = state.camera.position.distanceTo(nodes.Head.position);\n const cameraRotation = Math.abs(state.camera.rotation.z);\n\n if (cameraToHeadDistance < activeDistance && cameraRotation < activeRotation) {\n targetPos.x = mapRange(state.mouse.y, -0.5, 1, rotationMargin.x * rad, -rotationMargin.x * rad);\n targetPos.y = mapRange(state.mouse.x, -0.5, 0.5, -rotationMargin.y * rad, rotationMargin.y * rad);\n } else {\n targetPos.set(0, 0);\n }\n\n currentPos.x = lerp(currentPos.x, targetPos.x);\n currentPos.y = lerp(currentPos.y, targetPos.y);\n /* eslint-disable no-param-reassign */\n nodes.Neck.rotation.x = currentPos.x + neckBoneRotationOffsetX;\n nodes.Neck.rotation.y = currentPos.y;\n\n nodes.Head.rotation.x = currentPos.x;\n nodes.Head.rotation.y = currentPos.y;\n\n nodes.RightEye.rotation.x = currentPos.x - eyeRotationOffsetX;\n nodes.LeftEye.rotation.x = currentPos.x - eyeRotationOffsetX;\n\n if (isHalfBody) {\n nodes.RightEye.rotation.z = currentPos.y * 2 + Math.PI;\n nodes.LeftEye.rotation.z = currentPos.y * 2 + Math.PI;\n } else {\n nodes.RightEye.rotation.y = currentPos.y * 2;\n nodes.LeftEye.rotation.y = currentPos.y * 2;\n }\n });\n};\n\n/**\n * Transfers Bone positions from source to target.\n * @param targetNodes {object} - object that will be mutated\n * @param sourceNodes {object} - object that will be used as reference\n */\nexport const mutatePose = (targetNodes?: ObjectMap['nodes'], sourceNodes?: ObjectMap['nodes']) => {\n if (targetNodes && sourceNodes) {\n Object.keys(targetNodes).forEach((key) => {\n if (targetNodes[key].type === 'Bone' && sourceNodes[key]) {\n /* eslint-disable no-param-reassign */\n const pos = sourceNodes[key].position;\n targetNodes[key].position.set(pos.x, pos.y, pos.z);\n\n const rot = sourceNodes[key].rotation;\n targetNodes[key].rotation.set(rot.x, rot.y, rot.z);\n }\n });\n }\n};\n\nexport const useEmotion = (nodes: ObjectMap['nodes'], emotion?: Emotion) => {\n // @ts-ignore\n const meshes = Object.values(nodes).filter((item: SkinnedMesh) => item?.morphTargetInfluences) as SkinnedMesh[];\n\n const resetEmotions = (resetMeshes: Array) => {\n resetMeshes.forEach((mesh) => {\n mesh?.morphTargetInfluences?.forEach((_, index) => {\n mesh!.morphTargetInfluences![index] = 0;\n });\n });\n };\n\n useFrame(() => {\n if (emotion) {\n resetEmotions(meshes);\n\n meshes.forEach((mesh) => {\n Object.entries(emotion).forEach(([shape, value]) => {\n const shapeId = mesh?.morphTargetDictionary?.[shape];\n\n if (shapeId) {\n mesh!.morphTargetInfluences![shapeId] = value;\n }\n });\n });\n } else {\n resetEmotions(meshes);\n }\n });\n};\n\nconst loader = new GLTFLoader();\nloader.setMeshoptDecoder(MeshoptDecoder);\n\nconst dracoLoader = new DRACOLoader();\ndracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.5/');\nloader.setDRACOLoader(dracoLoader);\n\nexport const useGltfLoader = (source: Blob | string): GLTF =>\n suspend(\n async () => {\n if (source instanceof Blob) {\n const buffer = await source.arrayBuffer();\n return (await loader.parseAsync(buffer, '')) as unknown as GLTF;\n }\n\n return loader.loadAsync(source);\n },\n [source],\n { lifespan: 100 }\n );\n\nexport const useGltfCachedLoader = (source: Blob | string): GLTF => {\n const cachedGltf = useRef>(new Map());\n\n return suspend(async (): Promise => {\n if (cachedGltf.current.has(source as string)) {\n return cachedGltf.current.get(source as string)!;\n }\n let result: GLTF;\n if (source instanceof Blob) {\n const buffer = await source.arrayBuffer();\n result = (await loader.parseAsync(buffer, '')) as GLTF;\n } else {\n result = await loader.loadAsync(source);\n }\n\n cachedGltf.current.set(source as string, result);\n return result;\n }, [source]);\n};\n\nexport function usePersistantRotation(scene: Group) {\n const refToPreviousScene = useRef(scene);\n\n useEffect(() => {\n if (refToPreviousScene.current !== scene) {\n // eslint-disable-next-line no-param-reassign\n scene.rotation.y = refToPreviousScene.current.rotation.y;\n refToPreviousScene.current = scene;\n }\n }, [scene]);\n}\n\nexport class Transform {\n constructor() {\n this.scale = new Vector3(1, 1, 1);\n this.rotation = new Euler(0, 0, 0);\n this.position = new Vector3(0, 0, 0);\n }\n\n scale: Vector3;\n\n rotation: Euler;\n\n position: Vector3;\n}\n\n/**\n * Builds a fallback model for given nodes.\n * Useful for displaying as the suspense fallback object.\n */\nfunction buildFallback(nodes: Nodes, transform: Transform = new Transform()): JSX.Element {\n return (\n \n {Object.keys(nodes).map((key) => {\n const node = nodes[key] as CustomNode;\n if (node.type === 'SkinnedMesh') {\n return (\n \n );\n }\n\n if (node.type === 'Mesh') {\n return (\n {\n parent.add(self);\n self.parent = node.parent;\n return () => parent.remove(self);\n }}\n castShadow\n receiveShadow\n key={node.name}\n scale={node.scale}\n position={node.position}\n rotation={node.rotation}\n geometry={node.geometry}\n material={node.material}\n morphTargetInfluences={node.morphTargetInfluences || []}\n />\n );\n }\n\n return null;\n })}\n \n );\n}\n\nexport const useFallback = (nodes: Nodes, setter?: (fallback: JSX.Element) => void) =>\n useEffect(() => {\n if (typeof setter === 'function') {\n setter(buildFallback(nodes));\n }\n }, [setter, nodes]);\n\nexport const triggerCallback = (callback?: () => void) => {\n if (typeof callback === 'function') {\n callback();\n }\n};\n\nexport const expressions = {\n blink: [\n {\n morphTarget: 'eyesClosed',\n morphTargetIndex: -1,\n offset: 0,\n duration: 0.2\n },\n {\n morphTarget: 'eyeSquintLeft',\n morphTargetIndex: -1,\n offset: 0,\n duration: 0.2\n },\n {\n morphTarget: 'eyeSquintRight',\n morphTargetIndex: -1,\n offset: 0,\n duration: 0.2\n }\n ]\n};\n\n/**\n * Animates avatars facial expressions when morphTargets=ARKit,Eyes Extra is provided with the avatar.\n */\nexport const useIdleExpression = (expression: keyof typeof expressions, nodes: Nodes) => {\n const headMesh = (nodes.Wolf3D_Head || nodes.Wolf3D_Avatar || nodes.head) as unknown as SkinnedMeshProps;\n const selectedExpression = expression in expressions ? expressions[expression] : undefined;\n const timeout = useRef();\n const duration = useRef(Number.POSITIVE_INFINITY);\n\n useEffect(() => {\n if (headMesh?.morphTargetDictionary && selectedExpression) {\n for (let i = 0; i < selectedExpression.length; i++) {\n selectedExpression[i].morphTargetIndex = headMesh.morphTargetDictionary[selectedExpression[i].morphTarget];\n }\n }\n }, [selectedExpression, headMesh?.morphTargetDictionary]);\n\n const animateExpression = useCallback(\n (delta: number) => {\n if (headMesh?.morphTargetInfluences && selectedExpression) {\n duration.current += delta;\n\n for (let i = 0; i < selectedExpression.length; i++) {\n const section = selectedExpression[i];\n\n if (duration.current < section.duration + section.offset) {\n if (duration.current > section.offset) {\n const pivot = ((duration.current - section.offset) / section.duration) * Math.PI;\n const morphInfluence = Math.sin(pivot);\n headMesh.morphTargetInfluences[section.morphTargetIndex] = morphInfluence;\n }\n } else {\n headMesh.morphTargetInfluences[section.morphTargetIndex] = 0;\n }\n }\n }\n },\n [headMesh?.morphTargetInfluences, selectedExpression, duration.current, timeout.current]\n );\n\n const setNextInterval = () => {\n duration.current = 0;\n const delay = Math.random() * 3000 + 3000;\n\n clearTimeout(timeout.current);\n timeout.current = setTimeout(setNextInterval, delay);\n };\n\n useEffect(() => {\n if (selectedExpression) {\n timeout.current = setTimeout(setNextInterval, 3000);\n }\n\n return () => {\n clearTimeout(timeout.current);\n };\n }, [selectedExpression]);\n\n useFrame((_, delta) => {\n if (headMesh && selectedExpression) {\n animateExpression(delta);\n }\n });\n};\n", "/**\n * @license\n * Copyright 2010-2024 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '166';\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 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 ConstantColorFactor = 211;\nconst OneMinusConstantColorFactor = 212;\nconst ConstantAlphaFactor = 213;\nconst OneMinusConstantAlphaFactor = 214;\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;\nconst AgXToneMapping = 6;\nconst NeutralToneMapping = 7;\nconst AttachedBindMode = 'attached';\nconst DetachedBindMode = 'detached';\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 UnsignedInt5999Type = 35902;\nconst AlphaFormat = 1021;\nconst RGBFormat = 1022;\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 RGBIntegerFormat = 1032;\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 RGB_BPTC_SIGNED_Format = 36494;\nconst RGB_BPTC_UNSIGNED_Format = 36495;\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;\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';\nconst LinearDisplayP3ColorSpace = 'display-p3-linear';\n\nconst LinearTransfer = 'linear';\nconst SRGBTransfer = 'srgb';\n\nconst Rec709Primaries = 'rec709';\nconst P3Primaries = '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 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 = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( 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\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\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 probeAsync( gl, sync, interval ) {\n\n\treturn new Promise( function ( resolve, reject ) {\n\n\t\tfunction probe() {\n\n\t\t\tswitch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {\n\n\t\t\t\tcase gl.WAIT_FAILED:\n\t\t\t\t\treject();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase gl.TIMEOUT_EXPIRED:\n\t\t\t\t\tsetTimeout( probe, interval );\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tresolve();\n\n\t\t\t}\n\n\t\t}\n\n\t\tsetTimeout( probe, interval );\n\n\t} );\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().set(\n\t0.8224621, 0.177538, 0.0,\n\t0.0331941, 0.9668058, 0.0,\n\t0.0170827, 0.0723974, 0.9105199,\n);\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\n\t1.2249401, - 0.2249404, 0.0,\n\t- 0.0420569, 1.0420571, 0.0,\n\t- 0.0196376, - 0.0786361, 1.0982735\n);\n\n/**\n * Defines supported color spaces by transfer function and primaries,\n * and provides conversions to/from the Linear-sRGB reference space.\n */\nconst COLOR_SPACES = {\n\t[ LinearSRGBColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color,\n\t\tfromReference: ( color ) => color,\n\t},\n\t[ SRGBColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\n\t},\n\t[ LinearDisplayP3ColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\n\t},\n\t[ DisplayP3ColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\n\t},\n};\n\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\t_workingColorSpace: LinearSRGBColorSpace,\n\n\tget workingColorSpace() {\n\n\t\treturn this._workingColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\n\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\n\n\t\t}\n\n\t\tthis._workingColorSpace = colorSpace;\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 sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\n\n\t\treturn targetFromReference( sourceToReference( 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\tgetPrimaries: function ( colorSpace ) {\n\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\n\n\t},\n\n\tgetTransfer: function ( colorSpace ) {\n\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\n\n\t},\n\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\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\t\tthis.dataReady = true;\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\tthis.colorSpace = colorSpace;\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.pmremVersion = 0; // 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\tset needsPMREMUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.pmremVersion ++;\n\n\t\t}\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\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\t\tthis.w = e[ 15 ];\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 = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( 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\toptions = Object.assign( {\n\t\t\tgenerateMipmaps: false,\n\t\t\tinternalFormat: null,\n\t\t\tminFilter: LinearFilter,\n\t\t\tdepthBuffer: true,\n\t\t\tstencilBuffer: false,\n\t\t\tresolveDepthBuffer: true,\n\t\t\tresolveStencilBuffer: true,\n\t\t\tdepthTexture: null,\n\t\t\tsamples: 0,\n\t\t\tcount: 1\n\t\t}, options );\n\n\t\tconst texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\ttexture.flipY = false;\n\t\ttexture.generateMipmaps = options.generateMipmaps;\n\t\ttexture.internalFormat = options.internalFormat;\n\n\t\tthis.textures = [];\n\n\t\tconst count = options.count;\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.textures[ i ] = texture.clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\tthis.depthBuffer = options.depthBuffer;\n\t\tthis.stencilBuffer = options.stencilBuffer;\n\n\t\tthis.resolveDepthBuffer = options.resolveDepthBuffer;\n\t\tthis.resolveStencilBuffer = options.resolveStencilBuffer;\n\n\t\tthis.depthTexture = options.depthTexture;\n\n\t\tthis.samples = options.samples;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures[ 0 ];\n\n\t}\n\n\tset texture( value ) {\n\n\t\tthis.textures[ 0 ] = value;\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.textures.length; i < il; i ++ ) {\n\n\t\t\t\tthis.textures[ i ].image.width = width;\n\t\t\t\tthis.textures[ i ].image.height = height;\n\t\t\t\tthis.textures[ 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\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.textures.length = 0;\n\n\t\tfor ( let i = 0, il = source.textures.length; i < il; i ++ ) {\n\n\t\t\tthis.textures[ i ] = source.textures[ i ].clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\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\tthis.resolveDepthBuffer = source.resolveDepthBuffer;\n\t\tthis.resolveStencilBuffer = source.resolveStencilBuffer;\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\tthis.layerUpdates = new Set();\n\n\t}\n\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\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, options = {} ) {\n\n\t\tsuper( width, height, options );\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 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 = true ) {\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 === true ) 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(); // normalize calls _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// sets this quaternion to a uniform random unit quaternnion\n\n\t\t// Ken Shoemake\n\t\t// Uniform random rotations\n\t\t// D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.\n\n\t\tconst theta1 = 2 * Math.PI * Math.random();\n\t\tconst theta2 = 2 * Math.PI * Math.random();\n\n\t\tconst x0 = Math.random();\n\t\tconst r1 = Math.sqrt( 1 - x0 );\n\t\tconst r2 = Math.sqrt( x0 );\n\n\t\treturn this.set(\n\t\t\tr1 * Math.sin( theta1 ),\n\t\t\tr1 * Math.cos( theta1 ),\n\t\t\tr2 * Math.sin( theta2 ),\n\t\t\tr2 * Math.cos( theta2 ),\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\tthis._onChangeCallback();\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\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\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 = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( 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$c.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$c );\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$c.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// https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst theta = Math.random() * Math.PI * 2;\n\t\tconst u = Math.random() * 2 - 1;\n\t\tconst c = Math.sqrt( 1 - u * u );\n\n\t\tthis.x = c * Math.cos( theta );\n\t\tthis.y = u;\n\t\tthis.z = c * Math.sin( theta );\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$c = /*@__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$b.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$b.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$b.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\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$b );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector$b.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector$b.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector$b );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\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$4.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box$4.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box$4 );\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$b );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$b.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$b ).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$b ).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$b = /*@__PURE__*/ new Vector3();\n\nconst _box$4 = /*@__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$3 = /*@__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.isSphere = true;\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$3.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$a = /*@__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$a ) );\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$a.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$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$a.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$a.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$a.dot( this.direction );\n\t\tconst d2 = _vector$a.dot( _vector$a ) - 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$a ) !== 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$4.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$4.elements[ 0 ] *= invSX;\n\t\t_m1$4.elements[ 1 ] *= invSX;\n\t\t_m1$4.elements[ 2 ] *= invSX;\n\n\t\t_m1$4.elements[ 4 ] *= invSY;\n\t\t_m1$4.elements[ 5 ] *= invSY;\n\t\t_m1$4.elements[ 6 ] *= invSY;\n\n\t\t_m1$4.elements[ 8 ] *= invSZ;\n\t\t_m1$4.elements[ 9 ] *= invSZ;\n\t\t_m1$4.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$4 );\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$4 = /*@__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$2 = /*@__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$2.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix$2, 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$3 = /*@__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\nconst _childaddedEvent = { type: 'childadded', child: null };\nconst _childremovedEvent = { type: 'childremoved', child: null };\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\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\t\tthis.matrixWorldNeedsUpdate = false;\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\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\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$3.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$3.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$3.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$3 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$3.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$3 );\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\tobject.removeFromParent();\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t\t_childaddedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t\t_childaddedEvent.child = null;\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\t_childremovedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childremovedEvent );\n\t\t\t_childremovedEvent.child = null;\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\treturn this.remove( ... this.children );\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$3.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$3.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$3 );\n\n\t\tobject.removeFromParent();\n\t\tobject.parent = this;\n\t\tthis.children.push( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t_childaddedEvent.child = object;\n\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t_childaddedEvent.child = null;\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, result = [] ) {\n\n\t\tif ( this[ name ] === value ) result.push( 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 ].getObjectsByProperty( name, value, result );\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.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\tif ( this.parent === null ) {\n\n\t\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t\t}\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// make sure descendants are updated if required\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\tchild.updateMatrixWorld( force );\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 ) {\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.matrixWorldAutoUpdate === true ) {\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}\n\n\t\t// make sure descendants are updated\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\tchild.updateWorldMatrix( false, true );\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\tif ( this.isBatchedMesh ) {\n\n\t\t\tobject.type = 'BatchedMesh';\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\t\tobject.sortObjects = this.sortObjects;\n\n\t\t\tobject.drawRanges = this._drawRanges;\n\t\t\tobject.reservedRanges = this._reservedRanges;\n\n\t\t\tobject.visibility = this._visibility;\n\t\t\tobject.active = this._active;\n\t\t\tobject.bounds = this._bounds.map( bound => ( {\n\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\tboxMin: bound.box.min.toArray(),\n\t\t\t\tboxMax: bound.box.max.toArray(),\n\n\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\tsphereRadius: bound.sphere.radius,\n\t\t\t\tsphereCenter: bound.sphere.center.toArray()\n\t\t\t} ) );\n\n\t\t\tobject.maxInstanceCount = this._maxInstanceCount;\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\n\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\n\t\t\tobject.geometryCount = this._geometryCount;\n\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\n\n\t\t\tif ( this._colorsTexture !== null ) object.colorsTexture = this._colorsTexture.toJSON( meta );\n\n\t\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\t\tobject.boundingSphere = {\n\t\t\t\t\tcenter: object.boundingSphere.center.toArray(),\n\t\t\t\t\tradius: object.boundingSphere.radius\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tif ( this.boundingBox !== null ) {\n\n\t\t\t\tobject.boundingBox = {\n\t\t\t\t\tmin: object.boundingBox.min.toArray(),\n\t\t\t\t\tmax: object.boundingBox.max.toArray()\n\t\t\t\t};\n\n\t\t\t}\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\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\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$2 = /*@__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\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\ttarget.set( 0, 0, 0 );\n\t\t\treturn null;\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\t// if the triangle is degenerate then we can't contain a point\n\t\tif ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {\n\n\t\t\ttarget.x = 0;\n\t\t\ttarget.y = 0;\n\t\t\tif ( 'z' in target ) target.z = 0;\n\t\t\tif ( 'w' in target ) target.w = 0;\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$2.x );\n\t\ttarget.addScaledVector( v2, _v3$2.y );\n\t\ttarget.addScaledVector( v3, _v3$2.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\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\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\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\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\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\t\tthis.blendColor = new Color( 0, 0, 0 );\n\t\tthis.blendAlpha = 0;\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\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 !== undefined && 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.dispersion !== undefined ) data.dispersion = this.dispersion;\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.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();\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 === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\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 = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\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 = true;\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\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\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\tonBuild( /* shaderobject, renderer */ ) {\n\n\t\tconsole.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166\n\n\t}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {\n\n\t\tconsole.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166\n\n\t}\n\n\n}\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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$9 = /*@__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.updateRanges = [];\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\tget updateRange() {\n\n\t\twarnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\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$9.fromBufferAttribute( this, i );\n\t\t\t\t_vector$9.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.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\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\nlet _id$2 = 0;\n\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$8 = /*@__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$2 ++ } );\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$2.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\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$2.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\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.', 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$2.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.min, _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.max, _box$2.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.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.', 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$2.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$8.addVectors( _box$2.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.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$2.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$8.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\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$8.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$8.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\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 positionAttribute = attributes.position;\n\t\tconst normalAttribute = attributes.normal;\n\t\tconst uvAttribute = attributes.uv;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );\n\n\t\t}\n\n\t\tconst tangentAttribute = this.getAttribute( 'tangent' );\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < positionAttribute.count; 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.fromBufferAttribute( positionAttribute, a );\n\t\t\tvB.fromBufferAttribute( positionAttribute, b );\n\t\t\tvC.fromBufferAttribute( positionAttribute, c );\n\n\t\t\tuvA.fromBufferAttribute( uvAttribute, a );\n\t\t\tuvB.fromBufferAttribute( uvAttribute, b );\n\t\t\tuvC.fromBufferAttribute( uvAttribute, c );\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: index.count\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\tindex.getX( j + 0 ),\n\t\t\t\t\tindex.getX( j + 1 ),\n\t\t\t\t\tindex.getX( 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.fromBufferAttribute( normalAttribute, v );\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\ttangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, 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( index.getX( j + 0 ) );\n\t\t\t\thandleVertex( index.getX( j + 1 ) );\n\t\t\t\thandleVertex( index.getX( 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$8.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$8.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.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$6 = /*@__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 = Array.isArray( source.material ) ? source.material.slice() : 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$6.copy( geometry.boundingSphere );\n\t\t_sphere$6.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$6.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$6, _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$1( 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$1( 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\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\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\tif ( currentRenderTarget === 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\t// https://github.com/mrdoob/three.js/issues/27868\n\tif ( currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\treturn currentRenderTarget.texture.colorSpace;\n\n\t}\n\n\treturn ColorManagement.workingColorSpace;\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\tclipCullDistance: false, // set to use vertex shader clipping\n\t\t\tmultiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID\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\treturn super.getWorldDirection( target ).negate();\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\nconst _v3$1 = /*@__PURE__*/ new Vector3();\nconst _minTarget = /*@__PURE__*/ new Vector2();\nconst _maxTarget = /*@__PURE__*/ new Vector2();\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 * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.\n\t */\n\tgetViewBounds( distance, minTarget, maxTarget ) {\n\n\t\t_v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tminTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t\t_v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tmaxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t}\n\n\t/**\n\t * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Copies the result into the target Vector2, where x is width and y is height.\n\t */\n\tgetViewSize( distance, target ) {\n\n\t\tthis.getViewBounds( distance, _minTarget, _maxTarget );\n\n\t\treturn target.subVectors( _maxTarget, _minTarget );\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\t\tthis.activeMipmapLevel = 0;\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, activeMipmapLevel } = this;\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\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\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, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\t// mipmaps are generated during the last call of render()\n\t\t// at this point, all sides of the cube render target are defined\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\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\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$5 = /*@__PURE__*/ new Sphere();\nconst _vector$7 = /*@__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$5.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$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$5.center.set( 0, 0, 0 );\n\t\t_sphere$5.radius = 0.7071067811865476;\n\t\t_sphere$5.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$5 );\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$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$7 ) < 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 ) {\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\t\tconst size = array.byteLength;\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\ttype = gl.HALF_FLOAT;\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\tsize: size\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; // @deprecated, r159\n\t\tconst updateRanges = attribute.updateRanges;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 && updateRanges.length === 0 ) {\n\n\t\t\t// Not using update ranges\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t}\n\n\t\tif ( updateRanges.length !== 0 ) {\n\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\n\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, range.start, range.count );\n\n\t\t\t}\n\n\t\t\tattribute.clearUpdateRanges();\n\n\t\t}\n\n\t\t// @deprecated, r159\n\t\tif ( updateRange.count !== - 1 ) {\n\n\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\tarray, updateRange.offset, updateRange.count );\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\tif ( data.size !== attribute.array.byteLength ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );\n\n\t\t\t}\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\\t#ifdef ALPHA_TO_COVERAGE\\n\\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\\n\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n\\t#endif\\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_CLEARCOAT ) \\n\\t\\tclearcoatSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_SHEEN ) \\n\\t\\tsheenSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\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 batching_pars_vertex = \"#ifdef USE_BATCHING\\n\\t#if ! defined( GL_ANGLE_multi_draw )\\n\\t#define gl_DrawID _gl_DrawID\\n\\tuniform int _gl_DrawID;\\n\\t#endif\\n\\tuniform highp sampler2D batchingTexture;\\n\\tuniform highp usampler2D batchingIdTexture;\\n\\tmat4 getBatchingMatrix( const in float i ) {\\n\\t\\tint size = textureSize( batchingTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n\\tfloat getIndirectIndex( const in int i ) {\\n\\t\\tint size = textureSize( batchingIdTexture, 0 ).x;\\n\\t\\tint x = i % size;\\n\\t\\tint y = i / size;\\n\\t\\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\\n\\t}\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tuniform sampler2D batchingColorTexture;\\n\\tvec3 getBatchingColor( const in float i ) {\\n\\t\\tint size = textureSize( batchingColorTexture, 0 ).x;\\n\\t\\tint j = int( i );\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\\n\\t}\\n#endif\";\n\nvar batching_vertex = \"#ifdef USE_BATCHING\\n\\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\\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 = normalize( dFdx( surf_pos.xyz ) );\\n\\t\\tvec3 vSigmaY = normalize( 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#ifdef ALPHA_TO_COVERAGE\\n\\t\\tfloat distanceToPlane, distanceGradient;\\n\\t\\tfloat clipOpacity = 1.0;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\tif ( clipOpacity == 0.0 ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tfloat unionClipOpacity = 1.0;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\t\\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tclipOpacity *= 1.0 - unionClipOpacity;\\n\\t\\t#endif\\n\\t\\tdiffuseColor.a *= clipOpacity;\\n\\t\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tbool clipped = true;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tif ( clipped ) discard;\\n\\t\\t#endif\\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 ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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#ifdef USE_BATCHING_COLOR\\n\\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\\n\\tvColor.xyz *= batchingColor.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};\\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_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\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_TANGENT\\n\\tvec3 transformedTangent = objectTangent;\\n#endif\\n#ifdef USE_BATCHING\\n\\tmat3 bm = mat3( batchingMatrix );\\n\\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\\n\\ttransformedNormal = bm * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = bm * transformedTangent;\\n\\t#endif\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmat3 im = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\\n\\ttransformedNormal = im * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = im * transformedTangent;\\n\\t#endif\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 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 = \"\\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\\n\\tvec3( 0.8224621, 0.177538, 0.0 ),\\n\\tvec3( 0.0331941, 0.9668058, 0.0 ),\\n\\tvec3( 0.0170827, 0.0723974, 0.9105199 )\\n);\\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.2249401, - 0.2249404, 0.0 ),\\n\\tvec3( - 0.0420569, 1.0420571, 0.0 ),\\n\\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\\n);\\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\\n}\\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\\n}\\nvec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 sRGBTransferOETF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\\nvec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 LinearTosRGB( in vec4 value ) {\\n\\treturn sRGBTransferOETF( value );\\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, envMapRotation * 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\\tuniform mat3 envMapRotation;\\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_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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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;\\n#if defined( USE_LIGHT_PROBES )\\n\\tuniform vec3 lightProbe[ 9 ];\\n#endif\\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\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t}\\n\\treturn distanceFalloff;\\n}\\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, 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 vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometryPosition;\\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 vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometryPosition;\\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, envMapRotation * 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, envMapRotation * 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\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_DISPERSION\\n\\tmaterial.dispersion = dispersion;\\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\\tif( material.anisotropy == 0.0 ) {\\n\\t\\tanisotropyV = vec2( 1.0, 0.0 );\\n\\t} else {\\n\\t\\tanisotropyV /= material.anisotropy;\\n\\t\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\t}\\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\\tfloat dispersion;\\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 clearcoatSpecularDirect = vec3( 0.0 );\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\nvec3 sheenSpecularIndirect = 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometryNormal;\\n\\t\\tvec3 viewDir = geometryViewDir;\\n\\t\\tvec3 position = geometryPosition;\\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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, 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( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, 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 = \"\\nvec3 geometryPosition = - vViewPosition;\\nvec3 geometryNormal = normal;\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\n#ifdef USE_CLEARCOAT\\n\\tgeometryClearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\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, geometryPosition, 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.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, 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.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, 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.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\\t#if defined( USE_LIGHT_PROBES )\\n\\t\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\n\\t#endif\\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 ], geometryNormal );\\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( geometryNormal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvFragDepth = 1.0 + gl_Position.w;\\n\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\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 morphinstance_vertex = \"#ifdef USE_INSTANCING_MORPH\\n\\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\\n\\t}\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS )\\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\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\t#ifndef USE_INSTANCING_MORPH\\n\\t\\tuniform float morphTargetBaseInfluence;\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t#endif\\n\\tuniform sampler2DArray morphTargetsTexture;\\n\\tuniform ivec2 morphTargetsTextureSize;\\n\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t}\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\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 nonPerturbedNormal = 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 = nonPerturbedNormal;\\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_BATCHING\\n\\tmvPosition = batchingMatrix * mvPosition;\\n#endif\\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 shadowIntensity;\\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 shadowIntensity;\\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 shadowIntensity;\\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 shadowIntensity, 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 mix( 1.0, shadow, shadowIntensity );\\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\t\\n\\t\\tfloat lightToPositionLength = length( lightToPosition );\\n\\t\\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\\n\\t\\t\\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\t\\tdp += shadowBias;\\n\\t\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\t\\tshadow = (\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\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 shadowIntensity;\\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 shadowIntensity;\\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 shadowIntensity;\\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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tint size = textureSize( boneTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\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}\\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.6605, - 0.1246, - 0.0182 ),\\n\\tvec3( - 0.5876, 1.1329, - 0.1006 ),\\n\\tvec3( - 0.0728, - 0.0083, 1.1187 )\\n);\\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\\n\\tvec3( 0.6274, 0.0691, 0.0164 ),\\n\\tvec3( 0.3293, 0.9195, 0.0880 ),\\n\\tvec3( 0.0433, 0.0113, 0.8956 )\\n);\\nvec3 agxDefaultContrastApprox( vec3 x ) {\\n\\tvec3 x2 = x * x;\\n\\tvec3 x4 = x2 * x2;\\n\\treturn + 15.5 * x4 * x2\\n\\t\\t- 40.14 * x4 * x\\n\\t\\t+ 31.96 * x4\\n\\t\\t- 6.868 * x2 * x\\n\\t\\t+ 0.4298 * x2\\n\\t\\t+ 0.1191 * x\\n\\t\\t- 0.00232;\\n}\\nvec3 AgXToneMapping( vec3 color ) {\\n\\tconst mat3 AgXInsetMatrix = mat3(\\n\\t\\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\\n\\t\\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\\n\\t\\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\\n\\t);\\n\\tconst mat3 AgXOutsetMatrix = mat3(\\n\\t\\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\\n\\t\\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\\n\\t\\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\\n\\t);\\n\\tconst float AgxMinEv = - 12.47393;\\tconst float AgxMaxEv = 4.026069;\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\n\\tcolor = AgXInsetMatrix * color;\\n\\tcolor = max( color, 1e-10 );\\tcolor = log2( color );\\n\\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\tcolor = agxDefaultContrastApprox( color );\\n\\tcolor = AgXOutsetMatrix * color;\\n\\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\\n\\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\treturn color;\\n}\\nvec3 NeutralToneMapping( vec3 color ) {\\n\\tconst float StartCompression = 0.8 - 0.04;\\n\\tconst float Desaturation = 0.15;\\n\\tcolor *= toneMappingExposure;\\n\\tfloat x = min( color.r, min( color.g, color.b ) );\\n\\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\\n\\tcolor -= offset;\\n\\tfloat peak = max( color.r, max( color.g, color.b ) );\\n\\tif ( peak < StartCompression ) return color;\\n\\tfloat d = 1. - StartCompression;\\n\\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\\n\\tcolor *= newPeak / peak;\\n\\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\\n\\treturn mix( color, vec3( newPeak ), g );\\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.dispersion, 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 dispersion, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec4 transmittedLight;\\n\\t\\tvec3 transmittance;\\n\\t\\t#ifdef USE_DISPERSION\\n\\t\\t\\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\\n\\t\\t\\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\\n\\t\\t\\tfor ( int i = 0; i < 3; i ++ ) {\\n\\t\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\\n\\t\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\n\\t\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\n\\t\\t\\t\\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\\n\\t\\t\\t\\ttransmittedLight[ i ] = transmissionSample[ i ];\\n\\t\\t\\t\\ttransmittedLight.a += transmissionSample.a;\\n\\t\\t\\t\\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\\n\\t\\t\\t}\\n\\t\\t\\ttransmittedLight.a /= 3.0;\\n\\t\\t\\n\\t\\t#else\\n\\t\\t\\n\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\t\\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\t\\n\\t\\t#endif\\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_BATCHING\\n\\t\\tworldPosition = batchingMatrix * worldPosition;\\n\\t#endif\\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\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\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;\\nuniform mat3 backgroundRotation;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * 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 \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\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\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\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 \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\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\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\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 \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\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\\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\\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 \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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 \\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\\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\\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\\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 \\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#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\\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\\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 \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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 \\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\\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_DISPERSION\\n\\tuniform float dispersion;\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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 + sheenSpecularDirect + sheenSpecularIndirect;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * 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 \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\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\\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\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 \\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}\";\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\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\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\tbatching_pars_vertex: batching_pars_vertex,\n\tbatching_vertex: batching_vertex,\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_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\tmorphinstance_vertex: morphinstance_vertex,\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\tenvMapRotation: { value: /*@__PURE__*/ new Matrix3() },\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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 }\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\tbackgroundRotation: { value: /*@__PURE__*/ new Matrix3() }\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\tdispersion: { value: 0 },\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 };\nconst _e1$1 = /*@__PURE__*/ new Euler();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\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 getBackground( scene ) {\n\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\treturn background;\n\n\t}\n\n\tfunction render( scene ) {\n\n\t\tlet forceClear = false;\n\t\tconst background = getBackground( scene );\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 environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\n\n\t\tif ( environmentBlendMode === 'additive' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\t// buffers might not be writable which is required to ensure a correct clear\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\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t}\n\n\tfunction addToRenderList( renderList, scene ) {\n\n\t\tconst background = getBackground( scene );\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\t_e1$1.copy( scene.backgroundRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;\n\n\t\t\tif ( background.isCubeTexture && background.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1$1.y *= - 1;\n\t\t\t\t_e1$1.z *= - 1;\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.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\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 = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\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\t\taddToRenderList: addToRenderList\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, attributes ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\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\tconst state = getBindingState( geometry, program, material );\n\n\t\tif ( currentState !== state ) {\n\n\t\t\tcurrentState = state;\n\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t}\n\n\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\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\treturn gl.createVertexArray();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\treturn gl.bindVertexArray( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\treturn gl.deleteVertexArray( 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\tgl.vertexAttribDivisor( 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\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\n\n\t\t\t\t\tconst integer = ( 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 ) {\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\tgl.drawArraysInstanced( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\t}\n\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\n\n\t\t\t\trenderInstances( starts[ i ], counts[ i ], primcount[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\n\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters, utils ) {\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 textureFormatReadable( textureFormat ) {\n\n\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfunction textureTypeReadable( textureType ) {\n\n\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );\n\n\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\ttextureType !== FloatType && ! halfFloatSupportedByExt ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\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\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 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\n\tconst maxSamples = gl.getParameter( gl.MAX_SAMPLES );\n\n\treturn {\n\n\t\tisWebGL2: true, // keeping this for backwards compatibility\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\ttextureFormatReadable: textureFormatReadable,\n\t\ttextureTypeReadable: textureTypeReadable,\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\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 ) {\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 );\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;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\nlet _oldXrEnabled = false;\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( - PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\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\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\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\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 * The smallest supported equirectangular image size is 64 x 32.\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 * The smallest supported cube size is 16 x 16.\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, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\tthis._renderer.xr.enabled = _oldXrEnabled;\n\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\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\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\t\tconst n = this._lodPlanes.length;\n\n\t\tfor ( let i = 1; i < n; 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[ ( n - 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\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\tconst currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {\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\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\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 ( renderTarget !== undefined ) {\n\n\t\t\t\t\t\treturn renderTarget.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\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\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 () {\n\n\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\t\t\tgetExtension( 'WEBGL_clip_cull_distance' );\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\t\t\tgetExtension( 'WEBGL_render_shared_exponent' );\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\twarnOnce( '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 ) {\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\tgl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\n\t}\n\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\n\n\t\t\t\trenderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\n\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\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 WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\t// the following encodes morph targets into an array of data textures. Each layer represents a single morph target.\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 entry = morphTextures.get( geometry );\n\n\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\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 vertexDataCount = 0;\n\n\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\tlet height = 1;\n\n\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t}\n\n\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\ttexture.type = FloatType;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\t// fill buffer\n\n\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tentry = {\n\t\t\t\tcount: morphTargetsCount,\n\t\t\t\ttexture: texture,\n\t\t\t\tsize: new Vector2( width, height )\n\t\t\t};\n\n\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\tfunction disposeTexture() {\n\n\t\t\t\ttexture.dispose();\n\n\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t}\n\n\t\t//\n\t\tif ( object.isInstancedMesh === true && object.morphTexture !== null ) {\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );\n\n\t\t} else {\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\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t}\n\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\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\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, 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\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();\n\nconst emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );\n\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\tlet emptyTexture2D;\n\n\tif ( this.type === gl.SAMPLER_2D_SHADOW ) {\n\n\t\temptyShadowTexture.compareFunction = LessEqualCompare; // #28670\n\t\temptyTexture2D = emptyShadowTexture;\n\n\t} else {\n\n\t\temptyTexture2D = emptyTexture;\n\n\t}\n\n\ttextures.setTexture2D( v || emptyTexture2D, 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.type = activeInfo.type;\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.type = activeInfo.type;\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\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\nconst COMPLETION_STATUS_KHR = 0x91B1;\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\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\tconst encodingPrimaries = ColorManagement.getPrimaries( colorSpace );\n\n\tlet gamutMapping;\n\n\tif ( workingPrimaries === encodingPrimaries ) {\n\n\t\tgamutMapping = '';\n\n\t} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {\n\n\t\tgamutMapping = 'LinearDisplayP3ToLinearSRGB';\n\n\t} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {\n\n\t\tgamutMapping = 'LinearSRGBToLinearDisplayP3';\n\n\t}\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\tcase LinearDisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t\tcase SRGBColorSpace:\n\t\tcase DisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'sRGBTransferOETF' ];\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\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 ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;\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 AgXToneMapping:\n\t\t\ttoneMappingName = 'AgX';\n\t\t\tbreak;\n\n\t\tcase NeutralToneMapping:\n\t\t\ttoneMappingName = 'Neutral';\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 generateVertexExtensions( parameters ) {\n\n\tconst chunks = [\n\t\tparameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',\n\t\tparameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',\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\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;\n\tprecision ${parameters.precision} int;\n\tprecision ${parameters.precision} sampler2D;\n\tprecision ${parameters.precision} samplerCube;\n\tprecision ${parameters.precision} sampler3D;\n\tprecision ${parameters.precision} sampler2DArray;\n\tprecision ${parameters.precision} sampler2DShadow;\n\tprecision ${parameters.precision} samplerCubeShadow;\n\tprecision ${parameters.precision} sampler2DArrayShadow;\n\tprecision ${parameters.precision} isampler2D;\n\tprecision ${parameters.precision} isampler3D;\n\tprecision ${parameters.precision} isamplerCube;\n\tprecision ${parameters.precision} isampler2DArray;\n\tprecision ${parameters.precision} usampler2D;\n\tprecision ${parameters.precision} usampler3D;\n\tprecision ${parameters.precision} usamplerCube;\n\tprecision ${parameters.precision} usampler2DArray;\n\t`;\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 customVertexExtensions = generateVertexExtensions( 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\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.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',\n\t\t\tparameters.batching ? '#define USE_BATCHING' : '',\n\t\t\tparameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\t\t\tparameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',\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.anisotropy ? '#define USE_ANISOTROPY' : '',\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 ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#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.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\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'#ifdef USE_INSTANCING_MORPH',\n\n\t\t\t'\tuniform sampler2D morphTexture;',\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'#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\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.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',\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.dispersion ? '#define USE_DISPERSION' : '',\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 || parameters.batchingColor ? '#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.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\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.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\tcustomVertexExtensions,\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\tfunction onFirstUse( self ) {\n\n\t\t// check for link errors\n\t\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\t\tlet runnable = true;\n\t\t\tlet haveDiagnostics = true;\n\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\t\trunnable = false;\n\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// default error reporting\n\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t\t'Material Name: ' + self.name + '\\n' +\n\t\t\t\t\t\t'Material Type: ' + self.type + '\\n\\n' +\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\t\tfragmentErrors\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t} else if ( programLog !== '' ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\t\thaveDiagnostics = false;\n\n\t\t\t}\n\n\t\t\tif ( haveDiagnostics ) {\n\n\t\t\t\tself.diagnostics = {\n\n\t\t\t\t\trunnable: runnable,\n\n\t\t\t\t\tprogramLog: programLog,\n\n\t\t\t\t\tvertexShader: {\n\n\t\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t\t},\n\n\t\t\t\t\tfragmentShader: {\n\n\t\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\t\tprefix: prefixFragment\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\t// Clean up\n\n\t\t// Crashes in iOS9 and iOS10. #18402\n\t\t// gl.detachShader( program, glVertexShader );\n\t\t// gl.detachShader( program, glFragmentShader );\n\n\t\tgl.deleteShader( glVertexShader );\n\t\tgl.deleteShader( glFragmentShader );\n\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t}\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\t// Populates cachedUniforms and cachedAttributes\n\t\t\tonFirstUse( this );\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\t// Populates cachedAttributes and cachedUniforms\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\n\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\n\n\tthis.isReady = function () {\n\n\t\tif ( programReady === false ) {\n\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\n\n\t\t}\n\n\t\treturn programReady;\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$1 = 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$1 ++;\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 _activeChannels = new Set();\n\tconst programs = [];\n\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\t_activeChannels.add( 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\t\tconst IS_BATCHEDMESH = object.isBatchedMesh === 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_DISPERSION = material.dispersion > 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\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\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\tbatching: IS_BATCHEDMESH,\n\t\t\tbatchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\t\t\tinstancingMorph: IS_INSTANCEDMESH && object.morphTexture !== 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\t\t\talphaToCoverage: !! material.alphaToCoverage,\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\tdispersion: HAS_DISPERSION,\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 && material.alphaToCoverage === false,\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\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\tnumLightProbes: lights.numLightProbes,\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\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\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\textensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),\n\t\t\textensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),\n\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\t// the usage of getChannel() determines the active texture channels for this shader\n\n\t\tparameters.vertexUv1s = _activeChannels.has( 1 );\n\t\tparameters.vertexUv2s = _activeChannels.has( 2 );\n\t\tparameters.vertexUv3s = _activeChannels.has( 3 );\n\n\t\t_activeChannels.clear();\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.numLightProbes );\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.supportsVertexTextures )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingMorph )\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\t\tif ( parameters.alphaHash )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.batching )\n\t\t\t_programLayers.enable( 19 );\n\t\tif ( parameters.dispersion )\n\t\t\t_programLayers.enable( 20 );\n\t\tif ( parameters.batchingColor )\n\t\t\t_programLayers.enable( 21 );\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.doubleSided )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.decodeVideoTexture )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.alphaToCoverage )\n\t\t\t_programLayers.enable( 19 );\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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\tshadowIntensity: 1,\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 ) {\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\n\t\t\tnumLightProbes: - 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\t\tnumLightProbes: 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 ) {\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\tlet numLightProbes = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\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;\n\t\t\t\tg += color.g * intensity;\n\t\t\t\tb += color.b * intensity;\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\tnumLightProbes ++;\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 );\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.shadowIntensity = shadow.intensity;\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 );\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.shadowIntensity = shadow.intensity;\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 );\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.shadowIntensity = shadow.intensity;\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 );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity );\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 ( extensions.has( 'OES_texture_float_linear' ) === true ) {\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\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\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\t\t\thash.numLightProbes !== numLightProbes ) {\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\t\t\tstate.numLightProbes = numLightProbes;\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\thash.numLightProbes = numLightProbes;\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 ) {\n\n\tconst lights = new WebGLLights( extensions );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init( camera ) {\n\n\t\tstate.camera = camera;\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() {\n\n\t\tlights.setup( lightsArray );\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\tcamera: null,\n\n\t\tlights: lights,\n\n\t\ttransmissionRenderTarget: {}\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 ) {\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 );\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 );\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\trenderer.setRenderTarget( shadow.map );\n\t\t\trenderer.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\trenderer.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\trenderer.setRenderTarget( shadow.mapPass );\n\t\trenderer.clear();\n\t\trenderer.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\trenderer.setRenderTarget( shadow.map );\n\t\trenderer.clear();\n\t\trenderer.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\t\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\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\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, 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\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, 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\tfunction onMaterialDispose( event ) {\n\n\t\tconst material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t// make sure to remove the unique distance/depth materials used for shadow map rendering\n\n\t\tfor ( const id in _materialCache ) {\n\n\t\t\tconst cache = _materialCache[ id ];\n\n\t\t\tconst uuid = event.target.uuid;\n\n\t\t\tif ( uuid in cache ) {\n\n\t\t\t\tconst shadowMaterial = cache[ uuid ];\n\t\t\t\tshadowMaterial.dispose();\n\t\t\t\tdelete cache[ uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl ) {\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 currentBlendColor = new Color( 0, 0, 0 );\n\tlet currentBlendAlpha = 0;\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 ( 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\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\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\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\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\tconst textures = renderTarget.textures;\n\n\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t}\n\n\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\tneedsUpdate = true;\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\tgl.drawBuffers( drawBuffers );\n\n\t\t}\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\tequationToGL[ MinEquation ] = gl.MIN;\n\tequationToGL[ MaxEquation ] = gl.MAX;\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\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, 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\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\n\t\t\t\tcurrentBlendAlpha = 0;\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\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\n\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\n\n\t\t\tcurrentBlendColor.copy( blendColor );\n\t\t\tcurrentBlendAlpha = blendAlpha;\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.blendColor, material.blendAlpha, 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\t\tgl.blendColor( 0, 0, 0, 0 );\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\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\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\tcurrentBlendColor = new Color( 0, 0, 0 );\n\t\tcurrentBlendAlpha = 0;\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 contain( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t} else {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t}\n\n\treturn texture;\n\n}\n\nfunction cover( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t} else {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t}\n\n\treturn texture;\n\n}\n\nfunction fill( texture ) {\n\n\ttexture.repeat.x = 1;\n\ttexture.repeat.y = 1;\n\n\ttexture.offset.x = 0;\n\ttexture.offset.y = 0;\n\n\treturn texture;\n\n}\n\n\n\n/**\n * Given the width, height, format, and type of a texture. Determines how many\n * bytes must be used to represent the texture.\n */\nfunction getByteLength( width, height, format, type ) {\n\n\tconst typeByteLength = getTextureTypeByteLength( type );\n\n\tswitch ( format ) {\n\n\t\t// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml\n\t\tcase AlphaFormat:\n\t\t\treturn width * height;\n\t\tcase LuminanceFormat:\n\t\t\treturn width * height;\n\t\tcase LuminanceAlphaFormat:\n\t\t\treturn width * height * 2;\n\t\tcase RedFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RedIntegerFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGIntegerFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBFormat:\n\t\t\treturn ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAIntegerFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/\n\t\tcase RGB_S3TC_DXT1_Format:\n\t\tcase RGBA_S3TC_DXT1_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_S3TC_DXT3_Format:\n\t\tcase RGBA_S3TC_DXT5_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/\n\t\tcase RGB_PVRTC_2BPPV1_Format:\n\t\tcase RGBA_PVRTC_2BPPV1_Format:\n\t\t\treturn ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;\n\t\tcase RGB_PVRTC_4BPPV1_Format:\n\t\tcase RGBA_PVRTC_4BPPV1_Format:\n\t\t\treturn ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/\n\t\tcase RGB_ETC1_Format:\n\t\tcase RGB_ETC2_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_ETC2_EAC_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/\n\t\tcase RGBA_ASTC_4x4_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x4_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x5_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x5_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x6_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x5_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_8x6_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x8_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x5_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_10x6_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_10x8_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x10_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x10_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x12_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/\n\t\tcase RGBA_BPTC_Format:\n\t\tcase RGB_BPTC_SIGNED_Format:\n\t\tcase RGB_BPTC_UNSIGNED_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/\n\t\tcase RED_RGTC1_Format:\n\t\tcase SIGNED_RED_RGTC1_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;\n\t\tcase RED_GREEN_RGTC2_Format:\n\t\tcase SIGNED_RED_GREEN_RGTC2_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t}\n\n\tthrow new Error(\n\t\t`Unable to determine texture byte length for ${format} format.`,\n\t);\n\n}\n\nfunction getTextureTypeByteLength( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase UnsignedByteType:\n\t\tcase ByteType:\n\t\t\treturn { byteLength: 1, components: 1 };\n\t\tcase UnsignedShortType:\n\t\tcase ShortType:\n\t\tcase HalfFloatType:\n\t\t\treturn { byteLength: 2, components: 1 };\n\t\tcase UnsignedShort4444Type:\n\t\tcase UnsignedShort5551Type:\n\t\t\treturn { byteLength: 2, components: 4 };\n\t\tcase UnsignedIntType:\n\t\tcase IntType:\n\t\tcase FloatType:\n\t\t\treturn { byteLength: 4, components: 1 };\n\t\tcase UnsignedInt5999Type:\n\t\t\treturn { byteLength: 4, components: 3 };\n\n\t}\n\n\tthrow new Error( `Unknown texture type ${type}.` );\n\n}\n\nconst TextureUtils = {\n\tcontain,\n\tcover,\n\tfill,\n\tgetByteLength\n};\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\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 _imageDimensions = new Vector2();\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, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\tconst dimensions = getDimensions( image );\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( dimensions.width > maxSize || dimensions.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( dimensions.width, dimensions.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 ) {\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\t\t\t\t( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {\n\n\t\t\t\tconst width = Math.floor( scale * dimensions.width );\n\t\t\t\tconst height = Math.floor( scale * dimensions.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 (' + dimensions.width + 'x' + dimensions.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 (' + dimensions.width + 'x' + dimensions.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 textureNeedsGenerateMipmaps( texture ) {\n\n\t\treturn texture.generateMipmaps && texture.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 ( 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.RG_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RG32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGB ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\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 = ( transfer === SRGBTransfer ) ? _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 getInternalDepthFormat( useStencil, depthType ) {\n\n\t\tlet glInternalFormat;\n\t\tif ( useStencil ) {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH32F_STENCIL8;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\t\t\t\tconsole.warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn glInternalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture ) === 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//\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 renderTargetProperties = properties.get( renderTarget );\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\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\tinfo.memory.textures --;\n\n\t\t\t}\n\n\t\t\tproperties.remove( textures[ i ] );\n\n\t\t}\n\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 >= capabilities.maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.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 ) {\n\n\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&\n\t\t\t( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||\n\t\t\ttexture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\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\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\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\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\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\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, unpackConversion );\n\n\t\t\tlet image = resizeImage( texture.image, false, capabilities.maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tconst glType = utils.convert( texture.type );\n\t\t\tlet glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );\n\n\t\t\tsetTextureParameters( textureType, texture );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tconst levels = getMipLevels( texture, image );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\tglInternalFormat = getInternalDepthFormat( texture.format === DepthStencilFormat, texture.type );\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 ) {\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\tif ( dataReady ) {\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}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tconst layerData = mipmap.data.subarray(\n\t\t\t\t\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData, 0, 0 );\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\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\t\t}\n\n\t\t\t\t\t\t\t\t\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\tconst layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\tconst layerData = image.data.subarray(\n\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t} else {\n\n\t\t\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\t\t}\n\n\t\t\t\t\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tconst dimensions = getDimensions( mipmaps[ 0 ] );\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.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\tif ( dataReady ) {\n\n\t\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\t}\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\tconst dimensions = getDimensions( image );\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t\t}\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 ) ) {\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\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\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, unpackConversion );\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 ], true, capabilities.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\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 = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tlet levels = getMipLevels( texture, image );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tconst dimensions = getDimensions( cubeImage[ 0 ] );\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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\tif ( dataReady ) {\n\n\t\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\t}\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 ) ) {\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\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 ) {\n\n\t\t\t// retrieve the depth attachment types\n\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\tconst depthType = depthTexture && depthTexture.isDepthTexture ? depthTexture.type : null;\n\t\t\tconst glInternalFormat = getInternalDepthFormat( renderTarget.stencilBuffer, depthType );\n\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t// set up the attachment\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\tconst isUseMultisampledRTT = useMultisampledRTT( renderTarget );\n\t\t\tif ( isUseMultisampledRTT ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( isMultisample ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\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, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.textures;\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\tconst textures = renderTarget.textures;\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\tif ( ! isMultipleRenderTargets ) {\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\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 ( 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 ( 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\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\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 );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( 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 ) ) {\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\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 );\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 ) ) {\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\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture );\n\n\t\t\tif ( 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 ) ) {\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 textures = renderTarget.textures;\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 ) ) {\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\tconst invalidationArrayRead = [];\n\tconst invalidationArrayDraw = [];\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( renderTarget.samples > 0 ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = renderTarget.textures;\n\t\t\t\tconst width = renderTarget.width;\n\t\t\t\tconst height = renderTarget.height;\n\t\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\t\t\t// If MRT we need to remove FBO attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\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\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTarget.resolveDepthBuffer ) {\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\n\t\t\t\t\t\t// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)\n\n\t\t\t\t\t\tif ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\t\tif ( supportsInvalidateFramebuffer === true ) {\n\n\t\t\t\t\t\tinvalidationArrayRead.length = 0;\n\t\t\t\t\t\tinvalidationArrayDraw.length = 0;\n\n\t\t\t\t\t\tinvalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false ) {\n\n\t\t\t\t\t\t\tinvalidationArrayRead.push( depthStyle );\n\t\t\t\t\t\t\tinvalidationArrayDraw.push( depthStyle );\n\n\t\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\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\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t} else {\n\n\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( capabilities.maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn 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.isVideoTexture === true ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\n\n\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\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\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\tfunction getDimensions( image ) {\n\n\t\tif ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {\n\n\t\t\t// if intrinsic data are not available, fallback to width/height\n\n\t\t\t_imageDimensions.width = image.naturalWidth || image.width;\n\t\t\t_imageDimensions.height = image.naturalHeight || image.height;\n\n\t\t} else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {\n\n\t\t\t_imageDimensions.width = image.displayWidth;\n\t\t\t_imageDimensions.height = image.displayHeight;\n\n\t\t} else {\n\n\t\t\t_imageDimensions.width = image.width;\n\t\t\t_imageDimensions.height = image.height;\n\n\t\t}\n\n\t\treturn _imageDimensions;\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 ) {\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\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\t\tif ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;\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\t\tif ( p === HalfFloatType ) return gl.HALF_FLOAT;\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBFormat ) return gl.RGB;\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// 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 ( transfer === SRGBTransfer ) {\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// ETC\n\n\t\tif ( p === RGB_ETC1_Format || 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_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? 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 ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? 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 || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_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 ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_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 ) return gl.UNSIGNED_INT_24_8;\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\nconst _occlusion_vertex = `\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}`;\n\nconst _occlusion_fragment = `\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}`;\n\nclass WebXRDepthSensing {\n\n\tconstructor() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t\tthis.depthNear = 0;\n\t\tthis.depthFar = 0;\n\n\t}\n\n\tinit( renderer, depthData, renderState ) {\n\n\t\tif ( this.texture === null ) {\n\n\t\t\tconst texture = new Texture();\n\n\t\t\tconst texProps = renderer.properties.get( texture );\n\t\t\ttexProps.__webglTexture = depthData.texture;\n\n\t\t\tif ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {\n\n\t\t\t\tthis.depthNear = depthData.depthNear;\n\t\t\t\tthis.depthFar = depthData.depthFar;\n\n\t\t\t}\n\n\t\t\tthis.texture = texture;\n\n\t\t}\n\n\t}\n\n\tgetMesh( cameraXR ) {\n\n\t\tif ( this.texture !== null ) {\n\n\t\t\tif ( this.mesh === null ) {\n\n\t\t\t\tconst viewport = cameraXR.cameras[ 0 ].viewport;\n\t\t\t\tconst material = new ShaderMaterial( {\n\t\t\t\t\tvertexShader: _occlusion_vertex,\n\t\t\t\t\tfragmentShader: _occlusion_fragment,\n\t\t\t\t\tuniforms: {\n\t\t\t\t\t\tdepthColor: { value: this.texture },\n\t\t\t\t\t\tdepthWidth: { value: viewport.z },\n\t\t\t\t\t\tdepthHeight: { value: viewport.w }\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tthis.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this.mesh;\n\n\t}\n\n\treset() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t}\n\n\tgetDepthTexture() {\n\n\t\treturn this.texture;\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\n\t\tconst depthSensing = new WebXRDepthSensing();\n\t\tconst attributes = gl.getContextAttributes();\n\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\tconst currentSize = new Vector2();\n\t\tlet currentPixelRatio = null;\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\tdepthSensing.reset();\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\trenderer.setPixelRatio( currentPixelRatio );\n\t\t\trenderer.setSize( currentSize.width, currentSize.height, 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\tcurrentPixelRatio = renderer.getPixelRatio();\n\t\t\t\trenderer.getSize( currentSize );\n\n\t\t\t\tif ( session.renderState.layers === undefined ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: attributes.antialias,\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\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );\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\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );\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\tresolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )\n\t\t\t\t\t\t} );\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\tthis.getDepthTexture = function () {\n\n\t\t\treturn depthSensing.getDepthTexture();\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\tif ( depthSensing.texture !== null ) {\n\n\t\t\t\tcamera.near = depthSensing.depthNear;\n\t\t\t\tcamera.far = depthSensing.depthFar;\n\n\t\t\t}\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\tcameraL.near = _currentDepthNear;\n\t\t\t\tcameraL.far = _currentDepthFar;\n\t\t\t\tcameraR.near = _currentDepthNear;\n\t\t\t\tcameraR.far = _currentDepthFar;\n\n\t\t\t\tcameraL.updateProjectionMatrix();\n\t\t\t\tcameraR.updateProjectionMatrix();\n\t\t\t\tcamera.updateProjectionMatrix();\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\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\tthis.hasDepthSensing = function () {\n\n\t\t\treturn depthSensing.texture !== null;\n\n\t\t};\n\n\t\tthis.getDepthSensingMesh = function () {\n\n\t\t\treturn depthSensing.getMesh( cameraXR );\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\t//\n\n\t\t\t\tconst enabledFeatures = session.enabledFeatures;\n\n\t\t\t\tif ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {\n\n\t\t\t\t\tconst depthData = glBinding.getDepthInformation( views[ 0 ] );\n\n\t\t\t\t\tif ( depthData && depthData.isValid && depthData.texture ) {\n\n\t\t\t\t\t\tdepthSensing.init( renderer, depthData, session.renderState );\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\nconst _e1 = /*@__PURE__*/ new Euler();\nconst _m1 = /*@__PURE__*/ new Matrix4();\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 materialProperties = properties.get( material );\n\n\t\tconst envMap = materialProperties.envMap;\n\t\tconst envMapRotation = materialProperties.envMapRotation;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\t_e1.copy( envMapRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;\n\n\t\t\tif ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1.y *= - 1;\n\t\t\t\t_e1.z *= - 1;\n\n\t\t\t}\n\n\t\t\tuniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );\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\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\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\tif ( material.envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\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.dispersion > 0 ) {\n\n\t\t\tuniforms.dispersion.value = material.dispersion;\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 = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // 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 uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tif ( hasUniformChanged( uniform, i, j, cache ) === true ) {\n\n\t\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\t\tfor ( let k = 0; k < values.length; k ++ ) {\n\n\t\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t\t// TODO add integer and struct support\n\t\t\t\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\t\tuniform.__data[ 3 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\t\tuniform.__data[ 7 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\t\tuniform.__data[ 11 ] = 0;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t\t}\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, indexArray, cache ) {\n\n\t\tconst value = uniform.value;\n\t\tconst indexString = index + '_' + indexArray;\n\n\t\tif ( cache[ indexString ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tcache[ indexString ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tcache[ indexString ] = value.clone();\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\tconst cachedObject = cache[ indexString ];\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tif ( cachedObject !== value ) {\n\n\t\t\t\t\tcache[ indexString ] = 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\tif ( cachedObject.equals( value ) === false ) {\n\n\t\t\t\t\tcachedObject.copy( value );\n\t\t\t\t\treturn true;\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\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tfor ( let k = 0, kl = values.length; k < kl; k ++ ) {\n\n\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t// Calculate the chunk offset\n\t\t\t\t\tconst chunkOffsetUniform = offset % chunkSize;\n\n\t\t\t\t\t// Check for chunk overflow\n\t\t\t\t\tif ( chunkOffsetUniform !== 0 && ( chunkSize - chunkOffsetUniform ) < info.boundary ) {\n\n\t\t\t\t\t\t// Add padding and adjust offset\n\t\t\t\t\t\toffset += ( chunkSize - chunkOffsetUniform );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following two properties will be used for partial buffer updates\n\n\t\t\t\t\tuniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\t\t\tuniform.__offset = offset;\n\n\n\t\t\t\t\t// Update the global offset\n\t\t\t\t\toffset += info.storage;\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tconst chunkOffset = 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' || typeof value === 'boolean' ) {\n\n\t\t\t// float/int/bool\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\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 = false,\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\tif ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );\n\n\t\t\t}\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// 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// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _vector4 = new Vector4();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tlet _renderBackground = false;\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( contextName, contextAttributes ) {\n\n\t\t\treturn canvas.getContext( contextName, contextAttributes );\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 contextName = 'webgl2';\n\n\t\t\t\t_gl = getContext( contextName, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextName ) ) {\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} 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\t\t\textensions.init();\n\n\t\t\tutils = new WebGLUtils( _gl, extensions );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );\n\n\t\t\tstate = new WebGLState( _gl );\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 );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, attributes );\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 );\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 );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );\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 ).round() );\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 ).round() );\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 ) {\n\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\n\n\t\t\t}\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\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.isBatchedMesh ) {\n\n\t\t\t\tif ( object._multiDrawInstances !== null ) {\n\n\t\t\t\t\trenderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( ! extensions.get( 'WEBGL_multi_draw' ) ) {\n\n\t\t\t\t\t\tconst starts = object._multiDrawStarts;\n\t\t\t\t\t\tconst counts = object._multiDrawCounts;\n\t\t\t\t\t\tconst drawCount = object._multiDrawCount;\n\t\t\t\t\t\tconst bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;\n\t\t\t\t\t\tconst uniforms = properties.get( material ).currentProgram.getUniforms();\n\t\t\t\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\t\t\t\tuniforms.setValue( _gl, '_gl_DrawID', i );\n\t\t\t\t\t\t\trenderer.render( starts[ i ] / bytesPerElement, counts[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\trenderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( 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\tfunction prepareMaterial( material, scene, object ) {\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\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\n\n\t\t\tif ( targetScene === null ) targetScene = scene;\n\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\n\t\t\tcurrentRenderState.init( camera );\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\n\n\t\t\ttargetScene.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\tif ( scene !== targetScene ) {\n\n\t\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\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\tcurrentRenderState.setupLights();\n\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\n\n\t\t\tconst materials = new Set();\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\tprepareMaterial( material2, targetScene, object );\n\t\t\t\t\t\t\tmaterials.add( material2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\n\t\t\t\t\t\tmaterials.add( material );\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\treturn materials;\n\n\t\t};\n\n\t\t// compileAsync\n\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\n\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\n\n\t\t\t// Wait for all the materials in the new object to indicate that they're\n\t\t\t// ready to be used before resolving the promise.\n\n\t\t\treturn new Promise( ( resolve ) => {\n\n\t\t\t\tfunction checkMaterialsReady() {\n\n\t\t\t\t\tmaterials.forEach( function ( material ) {\n\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\n\n\t\t\t\t\t\tif ( program.isReady() ) {\n\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\n\t\t\t\t\t\t\tmaterials.delete( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\n\n\t\t\t\t\tif ( materials.size === 0 ) {\n\n\t\t\t\t\t\tresolve( scene );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\n\n\t\t\t\t\t// If we can check the compilation status of the materials without\n\t\t\t\t\t// blocking then do so right away.\n\n\t\t\t\t\tcheckMaterialsReady();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\n\t\t\t\t\t// initialized a chance to finish.\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\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 ) {\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( camera );\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\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tconst depthSensingMesh = _this.xr.getDepthSensingMesh();\n\n\t\t\t\tif ( depthSensingMesh !== null ) {\n\n\t\t\t\t\tprojectObject( depthSensingMesh, camera, - Infinity, _this.sortObjects );\n\n\t\t\t\t}\n\n\t\t\t}\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_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;\n\t\t\tif ( _renderBackground ) {\n\n\t\t\t\tbackground.addToRenderList( currentRenderList, scene );\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\t\t\t// render scene\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\n\t\t\tcurrentRenderState.setupLights();\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tif ( transmissiveObjects.length > 0 ) {\n\n\t\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\t\trenderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( _renderBackground ) background.render( scene );\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\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\t\tif ( _renderBackground ) background.render( scene );\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\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );\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_vector4.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, _vector4.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_vector4.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_vector4.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector4\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, _vector4.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, _vector4.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 ( 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 overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tif ( overrideMaterial !== null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {\n\n\t\t\t\tcurrentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: 4,\n\t\t\t\t\tstencilBuffer: stencil,\n\t\t\t\t\tresolveDepthBuffer: false,\n\t\t\t\t\tresolveStencilBuffer: false,\n\t\t\t\t\tcolorSpace: ColorManagement.workingColorSpace,\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\tconst transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];\n\n\t\t\tconst activeViewport = camera.viewport || _currentViewport;\n\t\t\ttransmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );\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\tif ( _renderBackground ) {\n\n\t\t\t\tbackground.render( scene );\n\n\t\t\t} else {\n\n\t\t\t\t_this.clear();\n\n\t\t\t}\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\t// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).\n\t\t\t// Transmission render pass requires viewport to match the transmissionRenderTarget.\n\t\t\tconst currentCameraViewport = camera.viewport;\n\t\t\tif ( camera.viewport !== undefined ) camera.viewport = undefined;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\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\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === false ) { // see #28131\n\n\t\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\t\tconst object = renderItem.object;\n\t\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\t\tconst material = renderItem.material;\n\t\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\t\t}\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\tif ( currentCameraViewport !== undefined ) camera.viewport = currentCameraViewport;\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\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\t\t\tmaterialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;\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.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\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = null;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction getUniformList( materialProperties ) {\n\n\t\t\tif ( materialProperties.uniformsList === null ) {\n\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\n\n\t\t\t}\n\n\t\t\treturn materialProperties.uniformsList;\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.batching = parameters.batching;\n\t\t\tmaterialProperties.batchingColor = parameters.batchingColor;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.instancingMorph = parameters.instancingMorph;\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.isBatchedMesh && materialProperties.batching === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null ) {\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 ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== 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 ( 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\t// common camera uniforms\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\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\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\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 ( _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}\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 ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingIdTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingColorTexture' );\n\t\t\t\tif ( object._colorsTexture !== null ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'batchingColorTexture', object._colorsTexture, textures );\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 ) ) {\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 ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {\n\n\t\t\t\tm_uniforms.envMapIntensity.value = scene.environmentIntensity;\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, currentRenderState.state.transmissionRenderTarget[ camera.id ] );\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), 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, getUniformList( materialProperties ), 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\tconst group = groups[ i ];\n\n\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\tuniformsGroups.bind( group, program );\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\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\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\trenderTargetProperties.__useRenderToTexture = false;\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 ( ( 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 && 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 ( ! capabilities.textureFormatReadable( textureFormat ) ) {\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\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\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.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\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 ( ! capabilities.textureFormatReadable( textureFormat ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );\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\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\tconst glBuffer = _gl.createBuffer();\n\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t\t_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );\n\t\t\t\t\t\t_gl.flush();\n\n\t\t\t\t\t\t// check if the commands have finished every 8 ms\n\t\t\t\t\t\tconst sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );\n\t\t\t\t\t\tawait probeAsync( _gl, sync, 4 );\n\n\t\t\t\t\t\ttry {\n\n\t\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t\t\t_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );\n\n\t\t\t\t\t\t} finally {\n\n\t\t\t\t\t\t\t_gl.deleteBuffer( glBuffer );\n\t\t\t\t\t\t\t_gl.deleteSync( sync );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn 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 ( texture, position = null, level = 0 ) {\n\n\t\t\t// support previous signature with position first\n\t\t\tif ( texture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\tconsole.warn( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );\n\n\t\t\t\tposition = arguments[ 0 ] || null;\n\t\t\t\ttexture = arguments[ 1 ];\n\n\t\t\t}\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\tconst x = position !== null ? position.x : 0;\n\t\t\tconst y = position !== null ? position.y : 0;\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, x, y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\n\n\t\t\t// support previous signature with dstPosition first\n\t\t\tif ( srcTexture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\tconsole.warn( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );\n\n\t\t\t\tdstPosition = arguments[ 0 ] || null;\n\t\t\t\tsrcTexture = arguments[ 1 ];\n\t\t\t\tdstTexture = arguments[ 2 ];\n\t\t\t\tlevel = arguments[ 3 ] || 0;\n\t\t\t\tsrcRegion = null;\n\n\t\t\t}\n\n\t\t\tlet width, height, minX, minY;\n\t\t\tlet dstX, dstY;\n\t\t\tif ( srcRegion !== null ) {\n\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\n\t\t\t\tminX = srcRegion.min.x;\n\t\t\t\tminY = srcRegion.min.y;\n\n\t\t\t} else {\n\n\t\t\t\twidth = srcTexture.image.width;\n\t\t\t\theight = srcTexture.image.height;\n\t\t\t\tminX = 0;\n\t\t\t\tminY = 0;\n\n\t\t\t}\n\n\t\t\tif ( dstPosition !== null ) {\n\n\t\t\t\tdstX = dstPosition.x;\n\t\t\t\tdstY = dstPosition.y;\n\n\t\t\t} else {\n\n\t\t\t\tdstX = 0;\n\t\t\t\tdstY = 0;\n\n\t\t\t}\n\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\tconst currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : 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, minX );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, 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, dstX, dstY, image.width, image.height, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, 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, currentUnpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\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 ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\n\n\t\t\t// support previous signature with source box first\n\t\t\tif ( srcTexture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\tconsole.warn( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );\n\n\t\t\t\tsrcRegion = arguments[ 0 ] || null;\n\t\t\t\tdstPosition = arguments[ 1 ] || null;\n\t\t\t\tsrcTexture = arguments[ 2 ];\n\t\t\t\tdstTexture = arguments[ 3 ];\n\t\t\t\tlevel = arguments[ 4 ] || 0;\n\n\t\t\t}\n\n\t\t\tlet width, height, depth, minX, minY, minZ;\n\t\t\tlet dstX, dstY, dstZ;\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\n\t\t\tif ( srcRegion !== null ) {\n\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\n\t\t\t\tdepth = srcRegion.max.z - srcRegion.min.z;\n\t\t\t\tminX = srcRegion.min.x;\n\t\t\t\tminY = srcRegion.min.y;\n\t\t\t\tminZ = srcRegion.min.z;\n\n\t\t\t} else {\n\n\t\t\t\twidth = image.width;\n\t\t\t\theight = image.height;\n\t\t\t\tdepth = image.depth;\n\t\t\t\tminX = 0;\n\t\t\t\tminY = 0;\n\t\t\t\tminZ = 0;\n\n\t\t\t}\n\n\t\t\tif ( dstPosition !== null ) {\n\n\t\t\t\tdstX = dstPosition.x;\n\t\t\t\tdstY = dstPosition.y;\n\t\t\t\tdstZ = dstPosition.z;\n\n\t\t\t} else {\n\n\t\t\t\tdstX = 0;\n\t\t\t\tdstY = 0;\n\t\t\t\tdstZ = 0;\n\n\t\t\t}\n\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 || dstTexture.isCompressedArrayTexture ) {\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 currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\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, minX );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, 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, currentUnpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\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.initRenderTarget = function ( target ) {\n\n\t\t\tif ( properties.get( target ).__webglFramebuffer === undefined ) {\n\n\t\t\t\ttextures.setupRenderTarget( target );\n\n\t\t\t}\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 outputColorSpace() {\n\n\t\treturn this._outputColorSpace;\n\n\t}\n\n\tset outputColorSpace( colorSpace ) {\n\n\t\tthis._outputColorSpace = colorSpace;\n\n\t\tconst gl = this.getContext();\n\t\tgl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\t\tgl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\n\t}\n\n}\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\tname: this.name,\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\tname: this.name,\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\t\tthis.backgroundRotation = new Euler();\n\n\t\tthis.environmentIntensity = 1;\n\t\tthis.environmentRotation = new Euler();\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\t\tthis.backgroundRotation.copy( source.backgroundRotation );\n\n\t\tthis.environmentIntensity = source.environmentIntensity;\n\t\tthis.environmentRotation.copy( source.environmentRotation );\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\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\t\tdata.object.backgroundRotation = this.backgroundRotation.toArray();\n\n\t\tif ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;\n\t\tdata.object.environmentRotation = this.environmentRotation.toArray();\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\t\tthis.updateRanges = [];\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\tget updateRange() {\n\n\t\twarnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\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$6 = /*@__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$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.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$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.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$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.data.stride + this.offset + 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.data.array[ index * this.data.stride + this.offset + component ] = value;\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 = new SpriteMaterial() ) {\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;\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$4 = /*@__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 = AttachedBindMode;\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\tthis.getVertexPosition( 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\tthis.getVertexPosition( 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$4.copy( this.boundingSphere );\n\t\t_sphere$4.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$4 ) === 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 === AttachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\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}\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$1 = /*@__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\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$1;\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 = Math.ceil( size / 4 ) * 4;\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\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$1 = /*@__PURE__*/ new Mesh();\nconst _sphere$3 = /*@__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\t\tthis.morphTexture = 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$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$3 );\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.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();\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\tgetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tconst len = objectInfluences.length + 1; // All influences + the baseInfluenceSum\n\n\t\tconst dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tobjectInfluences[ i ] = array[ dataIndex + i ];\n\n\t\t}\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$1.geometry = this.geometry;\n\t\t_mesh$1.material = this.material;\n\n\t\tif ( _mesh$1.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$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// 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$1.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh$1.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\tsetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst len = objectInfluences.length + 1; // morphBaseInfluence + all influences\n\n\t\tif ( this.morphTexture === null ) {\n\n\t\t\tthis.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );\n\n\t\t}\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tlet morphInfluencesSum = 0;\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t}\n\n\t\tconst morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\tconst dataIndex = len * index;\n\n\t\tarray[ dataIndex ] = morphBaseInfluence;\n\n\t\tarray.set( objectInfluences, dataIndex + 1 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\tif ( this.morphTexture !== null ) {\n\n\t\t\tthis.morphTexture.dispose();\n\t\t\tthis.morphTexture = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction sortOpaque( a, b ) {\n\n\treturn a.z - b.z;\n\n}\n\nfunction sortTransparent( a, b ) {\n\n\treturn b.z - a.z;\n\n}\n\nclass MultiDrawRenderList {\n\n\tconstructor() {\n\n\t\tthis.index = 0;\n\t\tthis.pool = [];\n\t\tthis.list = [];\n\n\t}\n\n\tpush( drawRange, z, index ) {\n\n\t\tconst pool = this.pool;\n\t\tconst list = this.list;\n\t\tif ( this.index >= pool.length ) {\n\n\t\t\tpool.push( {\n\n\t\t\t\tstart: - 1,\n\t\t\t\tcount: - 1,\n\t\t\t\tz: - 1,\n\t\t\t\tindex: - 1,\n\n\t\t\t} );\n\n\t\t}\n\n\t\tconst item = pool[ this.index ];\n\t\tlist.push( item );\n\t\tthis.index ++;\n\n\t\titem.start = drawRange.start;\n\t\titem.count = drawRange.count;\n\t\titem.z = z;\n\t\titem.index = index;\n\n\t}\n\n\treset() {\n\n\t\tthis.list.length = 0;\n\t\tthis.index = 0;\n\n\t}\n\n}\n\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\nconst _invMatrixWorld = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\nconst _whiteColor = /*@__PURE__*/ new Color( 1, 1, 1 );\nconst _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _frustum = /*@__PURE__*/ new Frustum();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\nconst _vector$5 = /*@__PURE__*/ new Vector3();\nconst _forward = /*@__PURE__*/ new Vector3();\nconst _temp = /*@__PURE__*/ new Vector3();\nconst _renderList = /*@__PURE__*/ new MultiDrawRenderList();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _batchIntersects = [];\n\n// @TODO: SkinnedMesh support?\n// @TODO: geometry.groups support?\n// @TODO: geometry.drawRange support?\n// @TODO: geometry.morphAttributes support?\n// @TODO: Support uniform parameter per geometry\n// @TODO: Add an \"optimize\" function to pack geometry and remove data gaps\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData( src, target, targetOffset = 0 ) {\n\n\tconst itemSize = target.itemSize;\n\tif ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {\n\n\t\t// use the component getters and setters if the array data cannot\n\t\t// be copied directly\n\t\tconst vertexCount = src.count;\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\ttarget.setComponent( i + targetOffset, c, src.getComponent( i, c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// faster copy approach using typed array set function\n\t\ttarget.array.set( src.array, targetOffset * itemSize );\n\n\t}\n\n\ttarget.needsUpdate = true;\n\n}\n\nclass BatchedMesh extends Mesh {\n\n\tget maxInstanceCount() {\n\n\t\treturn this._maxInstanceCount;\n\n\t}\n\n\tconstructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {\n\n\t\tsuper( new BufferGeometry(), material );\n\n\t\tthis.isBatchedMesh = true;\n\t\tthis.perObjectFrustumCulled = true;\n\t\tthis.sortObjects = true;\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\t\tthis.customSort = null;\n\n\t\t// stores visible, active, and geometry id per object\n\t\tthis._drawInfo = [];\n\n\t\t// geometry information\n\t\tthis._drawRanges = [];\n\t\tthis._reservedRanges = [];\n\t\tthis._bounds = [];\n\n\t\tthis._maxInstanceCount = maxInstanceCount;\n\t\tthis._maxVertexCount = maxVertexCount;\n\t\tthis._maxIndexCount = maxIndexCount;\n\n\t\tthis._geometryInitialized = false;\n\t\tthis._geometryCount = 0;\n\t\tthis._multiDrawCounts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawStarts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawCount = 0;\n\t\tthis._multiDrawInstances = null;\n\t\tthis._visibilityChanged = true;\n\n\t\t// Local matrix per geometry by using data texture\n\t\tthis._matricesTexture = null;\n\t\tthis._indirectTexture = null;\n\t\tthis._colorsTexture = null;\n\n\t\tthis._initMatricesTexture();\n\t\tthis._initIndirectTexture();\n\n\t}\n\n\t_initMatricesTexture() {\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 matrices * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tconst matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );\n\n\t\tthis._matricesTexture = matricesTexture;\n\n\t}\n\n\t_initIndirectTexture() {\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\n\t\tsize = Math.ceil( size );\n\n\t\tconst indirectArray = new Uint32Array( size * size );\n\t\tconst indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );\n\n\t\tthis._indirectTexture = indirectTexture;\n\n\t}\n\n\t_initColorsTexture() {\n\n\t\tlet size = Math.sqrt( this._maxIndexCount );\n\t\tsize = Math.ceil( size );\n\n\t\t// 4 floats per RGBA pixel initialized to white\n\t\tconst colorsArray = new Float32Array( size * size * 4 ).fill( 1 );\n\t\tconst colorsTexture = new DataTexture( colorsArray, size, size, RGBAFormat, FloatType );\n\t\tcolorsTexture.colorSpace = ColorManagement.workingColorSpace;\n\n\t\tthis._colorsTexture = colorsTexture;\n\n\t}\n\n\t_initializeGeometry( reference ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst maxVertexCount = this._maxVertexCount;\n\t\tconst maxIndexCount = this._maxIndexCount;\n\t\tif ( this._geometryInitialized === false ) {\n\n\t\t\tfor ( const attributeName in reference.attributes ) {\n\n\t\t\t\tconst srcAttribute = reference.getAttribute( attributeName );\n\t\t\t\tconst { array, itemSize, normalized } = srcAttribute;\n\n\t\t\t\tconst dstArray = new array.constructor( maxVertexCount * itemSize );\n\t\t\t\tconst dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );\n\n\t\t\t\tgeometry.setAttribute( attributeName, dstAttribute );\n\n\t\t\t}\n\n\t\t\tif ( reference.getIndex() !== null ) {\n\n\t\t\t\t// Reserve last u16 index for primitive restart.\n\t\t\t\tconst indexArray = maxVertexCount > 65535\n\t\t\t\t\t? new Uint32Array( maxIndexCount )\n\t\t\t\t\t: new Uint16Array( maxIndexCount );\n\n\t\t\t\tgeometry.setIndex( new BufferAttribute( indexArray, 1 ) );\n\n\t\t\t}\n\n\t\t\tthis._geometryInitialized = true;\n\n\t\t}\n\n\t}\n\n\t// Make sure the geometry is compatible with the existing combined geometry attributes\n\t_validateGeometry( geometry ) {\n\n\t\t// check to ensure the geometries are using consistent attributes and indices\n\t\tconst batchGeometry = this.geometry;\n\t\tif ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: All geometries must consistently have \"index\".' );\n\n\t\t}\n\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( ! geometry.hasAttribute( attributeName ) ) {\n\n\t\t\t\tthrow new Error( `BatchedMesh: Added geometry missing \"${ attributeName }\". All geometries must have consistent attributes.` );\n\n\t\t\t}\n\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tif ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {\n\n\t\t\t\tthrow new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tsetCustomSort( func ) {\n\n\t\tthis.customSort = func;\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 geometryCount = this._geometryCount;\n\t\tconst boundingBox = this.boundingBox;\n\t\tconst drawInfo = this._drawInfo;\n\n\t\tboundingBox.makeEmpty();\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingBox.union( _box$1 );\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 boundingSphere = this.boundingSphere;\n\t\tconst drawInfo = this._drawInfo;\n\n\t\tboundingSphere.makeEmpty();\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\taddInstance( geometryId ) {\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\n\n\t\t}\n\n\t\tthis._drawInfo.push( {\n\n\t\t\tvisible: true,\n\t\t\tactive: true,\n\t\t\tgeometryIndex: geometryId,\n\n\t\t} );\n\n\t\t// initialize the matrix\n\t\tconst drawId = this._drawInfo.length - 1;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = matricesTexture.image.data;\n\t\t_identityMatrix.toArray( matricesArray, drawId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\tconst colorsTexture = this._colorsTexture;\n\t\tif ( colorsTexture ) {\n\n\t\t\t_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );\n\t\t\tcolorsTexture.needsUpdate = true;\n\n\t\t}\n\n\t\treturn drawId;\n\n\t}\n\n\taddGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {\n\n\t\tthis._initializeGeometry( geometry );\n\n\t\tthis._validateGeometry( geometry );\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\n\n\t\t}\n\n\t\t// get the necessary range fo the geometry\n\t\tconst reservedRange = {\n\t\t\tvertexStart: - 1,\n\t\t\tvertexCount: - 1,\n\t\t\tindexStart: - 1,\n\t\t\tindexCount: - 1,\n\t\t};\n\n\t\tlet lastRange = null;\n\t\tconst reservedRanges = this._reservedRanges;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst bounds = this._bounds;\n\t\tif ( this._geometryCount !== 0 ) {\n\n\t\t\tlastRange = reservedRanges[ reservedRanges.length - 1 ];\n\n\t\t}\n\n\t\tif ( vertexCount === - 1 ) {\n\n\t\t\treservedRange.vertexCount = geometry.getAttribute( 'position' ).count;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexCount = vertexCount;\n\n\t\t}\n\n\t\tif ( lastRange === null ) {\n\n\t\t\treservedRange.vertexStart = 0;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;\n\n\t\t}\n\n\t\tconst index = geometry.getIndex();\n\t\tconst hasIndex = index !== null;\n\t\tif ( hasIndex ) {\n\n\t\t\tif ( indexCount\t=== - 1 ) {\n\n\t\t\t\treservedRange.indexCount = index.count;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexCount = indexCount;\n\n\t\t\t}\n\n\t\t\tif ( lastRange === null ) {\n\n\t\t\t\treservedRange.indexStart = 0;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif (\n\t\t\treservedRange.indexStart !== - 1 &&\n\t\t\treservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||\n\t\t\treservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );\n\n\t\t}\n\n\t\t// update id\n\t\tconst geometryId = this._geometryCount;\n\t\tthis._geometryCount ++;\n\n\t\t// add the reserved range and draw range objects\n\t\treservedRanges.push( reservedRange );\n\t\tdrawRanges.push( {\n\t\t\tstart: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,\n\t\t\tcount: - 1\n\t\t} );\n\t\tbounds.push( {\n\t\t\tboxInitialized: false,\n\t\t\tbox: new Box3(),\n\n\t\t\tsphereInitialized: false,\n\t\t\tsphere: new Sphere()\n\t\t} );\n\n\t\t// update the geometry\n\t\tthis.setGeometryAt( geometryId, geometry );\n\n\t\treturn geometryId;\n\n\t}\n\n\tsetGeometryAt( geometryId, geometry ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\tthis._validateGeometry( geometry );\n\n\t\tconst batchGeometry = this.geometry;\n\t\tconst hasIndex = batchGeometry.getIndex() !== null;\n\t\tconst dstIndex = batchGeometry.getIndex();\n\t\tconst srcIndex = geometry.getIndex();\n\t\tconst reservedRange = this._reservedRanges[ geometryId ];\n\t\tif (\n\t\t\thasIndex &&\n\t\t\tsrcIndex.count > reservedRange.indexCount ||\n\t\t\tgeometry.attributes.position.count > reservedRange.vertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );\n\n\t\t}\n\n\t\t// copy geometry over\n\t\tconst vertexStart = reservedRange.vertexStart;\n\t\tconst vertexCount = reservedRange.vertexCount;\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\t// copy attribute data\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tcopyAttributeData( srcAttribute, dstAttribute, vertexStart );\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tconst itemSize = srcAttribute.itemSize;\n\t\t\tfor ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {\n\n\t\t\t\tconst index = vertexStart + i;\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\t\tdstAttribute.setComponent( index, c, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdstAttribute.needsUpdate = true;\n\t\t\tdstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );\n\n\t\t}\n\n\t\t// copy index\n\t\tif ( hasIndex ) {\n\n\t\t\tconst indexStart = reservedRange.indexStart;\n\n\t\t\t// copy index data over\n\t\t\tfor ( let i = 0; i < srcIndex.count; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );\n\n\t\t\t}\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tfor ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart );\n\n\t\t\t}\n\n\t\t\tdstIndex.needsUpdate = true;\n\t\t\tdstIndex.addUpdateRange( indexStart, reservedRange.indexCount );\n\n\t\t}\n\n\t\t// store the bounding boxes\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tbound.box.copy( geometry.boundingBox );\n\t\t\tbound.boxInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.boxInitialized = false;\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tbound.sphere.copy( geometry.boundingSphere );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.sphereInitialized = false;\n\n\t\t}\n\n\t\t// set drawRange count\n\t\tconst drawRange = this._drawRanges[ geometryId ];\n\t\tconst posAttr = geometry.getAttribute( 'position' );\n\t\tdrawRange.count = hasIndex ? srcIndex.count : posAttr.count;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn geometryId;\n\n\t}\n\n\t/*\n\tdeleteGeometry( geometryId ) {\n\n\t\t// TODO: delete geometry and associated instances\n\n\t}\n\t*/\n\n\t/*\n\tdeleteInstance( instanceId ) {\n\n\t\t// Note: User needs to call optimize() afterward to pack the data.\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tdrawInfo[ instanceId ].active = false;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\t*/\n\n\t// get bounding box and compute it if it doesn't exist\n\tgetBoundingBoxAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding box\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tconst box = bound.box;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.boxInitialized === false ) {\n\n\t\t\tbox.makeEmpty();\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\tbox.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );\n\n\t\t\t}\n\n\t\t\tbound.boxInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( box );\n\t\treturn target;\n\n\t}\n\n\t// get bounding sphere and compute it if it doesn't exist\n\tgetBoundingSphereAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding sphere\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tconst sphere = bound.sphere;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.sphereInitialized === false ) {\n\n\t\t\tsphere.makeEmpty();\n\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 );\n\t\t\t_box$1.getCenter( sphere.center );\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\n\n\t\t\tlet maxRadiusSq = 0;\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\t_vector$5.fromBufferAttribute( position, iv );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );\n\n\t\t\t}\n\n\t\t\tsphere.radius = Math.sqrt( maxRadiusSq );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( sphere );\n\t\treturn target;\n\n\t}\n\n\tsetMatrixAt( instanceId, matrix ) {\n\n\t\t// @TODO: Map geometryId to index of the arrays because\n\t\t// optimize() can make geometryId mismatch the index\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tmatrix.toArray( matricesArray, instanceId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetMatrixAt( instanceId, matrix ) {\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn matrix.fromArray( matricesArray, instanceId * 16 );\n\n\t}\n\n\tsetColorAt( instanceId, color ) {\n\n\t\tif ( this._colorsTexture === null ) {\n\n\t\t\tthis._initColorsTexture();\n\n\t\t}\n\n\t\t// @TODO: Map id to index of the arrays because\n\t\t// optimize() can make id mismatch the index\n\n\t\tconst colorsTexture = this._colorsTexture;\n\t\tconst colorsArray = this._colorsTexture.image.data;\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tcolor.toArray( colorsArray, instanceId * 4 );\n\t\tcolorsTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( instanceId, color ) {\n\n\t\tconst colorsArray = this._colorsTexture.image.data;\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn color.fromArray( colorsArray, instanceId * 4 );\n\n\t}\n\n\tsetVisibleAt( instanceId, value ) {\n\n\t\t// if the geometry is out of range, not active, or visibility state\n\t\t// does not change then return early\n\t\tconst drawInfo = this._drawInfo;\n\t\tif (\n\t\t\tinstanceId >= drawInfo.length ||\n\t\t\tdrawInfo[ instanceId ].active === false ||\n\t\t\tdrawInfo[ instanceId ].visible === value\n\t\t) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tdrawInfo[ instanceId ].visible = value;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetVisibleAt( instanceId ) {\n\n\t\t// return early if the geometry is out of range or not active\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn drawInfo[ instanceId ].visible;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst batchGeometry = this.geometry;\n\n\t\t// iterate over each geometry\n\t\t_mesh.material = this.material;\n\t\t_mesh.geometry.index = batchGeometry.index;\n\t\t_mesh.geometry.attributes = batchGeometry.attributes;\n\t\tif ( _mesh.geometry.boundingBox === null ) {\n\n\t\t\t_mesh.geometry.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( _mesh.geometry.boundingSphere === null ) {\n\n\t\t\t_mesh.geometry.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( ! drawInfo[ i ].visible || ! drawInfo[ i ].active ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tconst drawRange = drawRanges[ geometryId ];\n\t\t\t_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );\n\n\t\t\t// ge the intersects\n\t\t\tthis.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );\n\t\t\tthis.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );\n\t\t\tthis.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );\n\t\t\t_mesh.raycast( raycaster, _batchIntersects );\n\n\t\t\t// add batch id to the intersects\n\t\t\tfor ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {\n\n\t\t\t\tconst intersect = _batchIntersects[ j ];\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersect.batchId = i;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_batchIntersects.length = 0;\n\n\t\t}\n\n\t\t_mesh.material = null;\n\t\t_mesh.geometry.index = null;\n\t\t_mesh.geometry.attributes = {};\n\t\t_mesh.geometry.setDrawRange( 0, Infinity );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.geometry = source.geometry.clone();\n\t\tthis.perObjectFrustumCulled = source.perObjectFrustumCulled;\n\t\tthis.sortObjects = source.sortObjects;\n\t\tthis.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;\n\t\tthis.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;\n\n\t\tthis._drawRanges = source._drawRanges.map( range => ( { ...range } ) );\n\t\tthis._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );\n\n\t\tthis._drawInfo = source._drawInfo.map( inf => ( { ...inf } ) );\n\t\tthis._bounds = source._bounds.map( bound => ( {\n\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\tbox: bound.box.clone(),\n\n\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\tsphere: bound.sphere.clone()\n\t\t} ) );\n\n\t\tthis._maxInstanceCount = source._maxInstanceCount;\n\t\tthis._maxVertexCount = source._maxVertexCount;\n\t\tthis._maxIndexCount = source._maxIndexCount;\n\n\t\tthis._geometryInitialized = source._geometryInitialized;\n\t\tthis._geometryCount = source._geometryCount;\n\t\tthis._multiDrawCounts = source._multiDrawCounts.slice();\n\t\tthis._multiDrawStarts = source._multiDrawStarts.slice();\n\n\t\tthis._matricesTexture = source._matricesTexture.clone();\n\t\tthis._matricesTexture.image.data = this._matricesTexture.image.slice();\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture = source._colorsTexture.clone();\n\t\t\tthis._colorsTexture.image.data = this._colorsTexture.image.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\t// Assuming the geometry is not shared with other meshes\n\t\tthis.geometry.dispose();\n\n\t\tthis._matricesTexture.dispose();\n\t\tthis._matricesTexture = null;\n\n\t\tthis._indirectTexture.dispose();\n\t\tthis._indirectTexture = null;\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture.dispose();\n\t\t\tthis._colorsTexture = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tonBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {\n\n\t\t// if visibility has not changed and frustum culling and object sorting is not required\n\t\t// then skip iterating over all items\n\t\tif ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// the indexed version of the multi draw function requires specifying the start\n\t\t// offset in bytes.\n\t\tconst index = geometry.getIndex();\n\t\tconst bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst multiDrawStarts = this._multiDrawStarts;\n\t\tconst multiDrawCounts = this._multiDrawCounts;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\tconst indirectTexture = this._indirectTexture;\n\t\tconst indirectArray = indirectTexture.image.data;\n\n\t\t// prepare the frustum in the local frame\n\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t_projScreenMatrix$2\n\t\t\t\t.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )\n\t\t\t\t.multiply( this.matrixWorld );\n\t\t\t_frustum.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$2,\n\t\t\t\trenderer.coordinateSystem\n\t\t\t);\n\n\t\t}\n\n\t\tlet count = 0;\n\t\tif ( this.sortObjects ) {\n\n\t\t\t// get the camera position in the local frame\n\t\t\t_invMatrixWorld.copy( this.matrixWorld ).invert();\n\t\t\t_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );\n\t\t\t_forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );\n\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\t// get the distance from camera used for sorting\n\t\t\t\t\t\tconst z = _temp.subVectors( _sphere$2.center, _vector$5 ).dot( _forward );\n\t\t\t\t\t\t_renderList.push( drawRanges[ geometryId ], z, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Sort the draw ranges and prep for rendering\n\t\t\tconst list = _renderList.list;\n\t\t\tconst customSort = this.customSort;\n\t\t\tif ( customSort === null ) {\n\n\t\t\t\tlist.sort( material.transparent ? sortTransparent : sortOpaque );\n\n\t\t\t} else {\n\n\t\t\t\tcustomSort.call( this, list, camera );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = list.length; i < l; i ++ ) {\n\n\t\t\t\tconst item = list[ i ];\n\t\t\t\tmultiDrawStarts[ count ] = item.start * bytesPerElement;\n\t\t\t\tmultiDrawCounts[ count ] = item.count;\n\t\t\t\tindirectArray[ count ] = item.index;\n\t\t\t\tcount ++;\n\n\t\t\t}\n\n\t\t\t_renderList.reset();\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\tconst range = drawRanges[ geometryId ];\n\t\t\t\t\t\tmultiDrawStarts[ count ] = range.start * bytesPerElement;\n\t\t\t\t\t\tmultiDrawCounts[ count ] = range.count;\n\t\t\t\t\t\tindirectArray[ count ] = i;\n\t\t\t\t\t\tcount ++;\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\tindirectTexture.needsUpdate = true;\n\t\tthis._multiDrawCount = count;\n\t\tthis._visibilityChanged = false;\n\n\t}\n\n\tonBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {\n\n\t\tthis.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );\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 _vStart = /*@__PURE__*/ new Vector3();\nconst _vEnd = /*@__PURE__*/ new Vector3();\n\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nconst _intersectPointOnRay = /*@__PURE__*/ new Vector3();\nconst _intersectPointOnSegment = /*@__PURE__*/ new Vector3();\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 = Array.isArray( source.material ) ? source.material.slice() : 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_vStart.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_vEnd.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _vStart.distanceTo( _vEnd );\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 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\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst a = index.getX( end - 1 );\n\t\t\t\tconst b = index.getX( start );\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\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\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\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\nfunction checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {\n\n\tconst positionAttribute = object.geometry.attributes.position;\n\n\t_vStart.fromBufferAttribute( positionAttribute, a );\n\t_vEnd.fromBufferAttribute( positionAttribute, b );\n\n\tconst distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );\n\n\tif ( distSq > thresholdSq ) return;\n\n\t_intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\treturn {\n\n\t\tdistance: distance,\n\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t// point: raycaster.ray.at( distance ),\n\t\tpoint: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),\n\t\tindex: a,\n\t\tface: null,\n\t\tfaceIndex: null,\n\t\tobject: object\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 = Array.isArray( source.material ) ? source.material.slice() : 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\tthis.layerUpdates = new Set();\n\n\t}\n\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\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 = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\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\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\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\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 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\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\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// (\u00B11, \u00B11, \u00B11)\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, \u00B11/\u03C6, \u00B1\u03C6)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (\u00B11/\u03C6, \u00B1\u03C6, 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// (\u00B1\u03C6, 0, \u00B11/\u03C6)\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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._dispersion = 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 dispersion() {\n\n\t\treturn this._dispersion;\n\n\t}\n\n\tset dispersion( value ) {\n\n\t\tif ( this._dispersion > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._dispersion = 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.dispersion = source.dispersion;\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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.envMapRotation = new Euler();\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.envMapRotation.copy( source.envMapRotation );\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// 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 = referenceTrack.values.slice( 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 = referenceTrack.values.slice( 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 = interpolant.resultBuffer.slice( 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\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 = times.slice( from, to );\n\t\t\tthis.values = this.values.slice( 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 = this.times.slice(),\n\t\t\tvalues = this.values.slice(),\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 = times.slice( 0, writeIndex );\n\t\t\tthis.values = values.slice( 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 = this.times.slice();\n\t\tconst values = this.values.slice();\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\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\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\n// DefaultInterpolation is inherited;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {\n\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\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( 'X-File-Size' ) || response.headers.get( 'Content-Length' );\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}, ( e ) => {\n\n\t\t\t\t\t\t\t\t\tcontroller.error( e );\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.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}\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\t\tif ( this.target !== undefined ) data.object.target = this.target.uuid;\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.intensity = 1;\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.intensity = source.intensity;\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.intensity !== 1 ) object.intensity = this.intensity;\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) = \u03C0 * 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 \u03C0 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 ); // \u03C0 * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * \u03C0 / 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 ); // ( \u03C0 / 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 ); // ( \u03C0 / 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 ) ); // ( \u03C0 / 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.dispersion !== undefined ) material.dispersion = json.dispersion;\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.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\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\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\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\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\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 !== undefined ) 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.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );\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 ) { // @deprecated, r165\n\n\t\tconsole.warn( 'THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.' );\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\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\t\tthis.bindLightTargets( object );\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\t\tthis.bindLightTargets( object );\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\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\tif ( data.fog.name !== '' ) {\n\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\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\t\t\t\tif ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );\n\n\t\t\t\tif ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;\n\t\t\t\tif ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );\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\t\t\t\tobject.target = data.target ||\u00A0'';\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\t\t\t\tobject.target = data.target ||\u00A0'';\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 'BatchedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );\n\t\t\t\tobject.geometry = geometry;\n\t\t\t\tobject.perObjectFrustumCulled = data.perObjectFrustumCulled;\n\t\t\t\tobject.sortObjects = data.sortObjects;\n\n\t\t\t\tobject._drawRanges = data.drawRanges;\n\t\t\t\tobject._reservedRanges = data.reservedRanges;\n\n\t\t\t\tobject._visibility = data.visibility;\n\t\t\t\tobject._active = data.active;\n\t\t\t\tobject._bounds = data.bounds.map( bound => {\n\n\t\t\t\t\tconst box = new Box3();\n\t\t\t\t\tbox.min.fromArray( bound.boxMin );\n\t\t\t\t\tbox.max.fromArray( bound.boxMax );\n\n\t\t\t\t\tconst sphere = new Sphere();\n\t\t\t\t\tsphere.radius = bound.sphereRadius;\n\t\t\t\t\tsphere.center.fromArray( bound.sphereCenter );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\t\t\tbox: box,\n\n\t\t\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\t\t\tsphere: sphere\n\t\t\t\t\t};\n\n\t\t\t\t} );\n\n\t\t\t\tobject._maxInstanceCount = data.maxInstanceCount;\n\t\t\t\tobject._maxVertexCount = data.maxVertexCount;\n\t\t\t\tobject._maxIndexCount = data.maxIndexCount;\n\n\t\t\t\tobject._geometryInitialized = data.geometryInitialized;\n\t\t\t\tobject._geometryCount = data.geometryCount;\n\n\t\t\t\tobject._matricesTexture = getTexture( data.matricesTexture.uuid );\n\t\t\t\tif ( data.colorsTexture !== undefined ) object._colorsTexture = getTexture( data.colorsTexture.uuid );\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.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;\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\tbindLightTargets( object ) {\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isDirectionalLight ||\u00A0child.isSpotLight ) {\n\n\t\t\t\tconst uuid = child.target;\n\n\t\t\t\tconst target = object.getObjectByProperty( 'uuid', uuid );\n\n\t\t\t\tif ( target !== undefined ) {\n\n\t\t\t\t\tchild.target = target;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.target = new Object3D();\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\t// If cached is a promise, wait for it to resolve\n\t\t\tif ( cached.then ) {\n\n\t\t\t\tcached.then( imageBitmap => {\n\n\t\t\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t} ).catch( e => {\n\n\t\t\t\t\tif ( onError ) onError( e );\n\n\t\t\t\t} );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t// If cached is not a promise (i.e., it's already an imageBitmap)\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\tconst promise = fetch( 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\treturn imageBitmap;\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tCache.remove( url );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tCache.add( url, promise );\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} ).catch( 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\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._connected === false ) {\n\n\t\t\treturn;\n\n\t\t}\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.isPlaying === true && this.source.detune !== undefined ) {\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\tconst uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];\n\n\t\t\tfor ( let j = 0; j < uniforms.length; j ++ ) {\n\n\t\t\t\tthis.uniforms.push( uniforms[ j ].clone() );\n\n\t\t\t}\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\nconst _matrix = /*@__PURE__*/ new Matrix4();\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\tsetFromXRController( controller ) {\n\n\t\t_matrix.identity().extractRotation( controller.matrixWorld );\n\n\t\tthis.ray.origin.setFromMatrixPosition( controller.matrixWorld );\n\t\tthis.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );\n\n\t\treturn this;\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersect( 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\tintersect( 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 intersect( object, raycaster, intersects, recursive ) {\n\n\tlet propagate = true;\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tconst result = object.raycast( raycaster, intersects );\n\n\t\tif ( result === false ) propagate = false;\n\n\t}\n\n\tif ( propagate === true && 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\tintersect( 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 * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.\n * theta (the azimuthal angle) is measured from the positive z-axis.\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.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\t// update the local matrix based on the parent and light target transforms\n\t\tif ( this.parent ) {\n\n\t\t\tthis.parent.updateWorldMatrix( true );\n\n\t\t\tthis.matrix\n\t\t\t\t.copy( this.parent.matrixWorld )\n\t\t\t\t.invert()\n\t\t\t\t.multiply( this.light.matrixWorld );\n\n\t\t} else {\n\n\t\t\tthis.matrix.copy( this.light.matrixWorld );\n\n\t\t}\n\n\t\tthis.matrixWorld.copy( this.light.matrixWorld );\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\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tconsole.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the \"count\" parameter to enable MRT.' );\n\n\t\tsuper( width, height, { ...options, count } );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures;\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, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, 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, ConstantAlphaFactor, ConstantColorFactor, 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, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, 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, LinearDisplayP3ColorSpace, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, 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, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, 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, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, 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, TextureUtils, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, createCanvasElement };\n", "import { c as createEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-99983b2d.esm.js';\nexport { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-99983b2d.esm.js';\nimport * as React from 'react';\nimport * as THREE from 'three';\nimport useMeasure from 'react-use-measure';\nimport { FiberProvider, useContextBridge } from 'its-fine';\nimport { jsx } from 'react/jsx-runtime';\nimport 'react-reconciler/constants';\nimport 'zustand';\nimport 'react-reconciler';\nimport 'scheduler';\nimport 'suspend-react';\n\nconst DOM_EVENTS = {\n onClick: ['click', false],\n onContextMenu: ['contextmenu', false],\n onDoubleClick: ['dblclick', false],\n onWheel: ['wheel', true],\n onPointerDown: ['pointerdown', true],\n onPointerUp: ['pointerup', true],\n onPointerLeave: ['pointerleave', true],\n onPointerMove: ['pointermove', true],\n onPointerCancel: ['pointercancel', true],\n onLostPointerCapture: ['lostpointercapture', true]\n};\n\n/** Default R3F event manager for web */\nfunction createPointerEvents(store) {\n const {\n handlePointer\n } = createEvents(store);\n return {\n priority: 1,\n enabled: true,\n compute(event, state, previous) {\n // https://github.com/pmndrs/react-three-fiber/pull/782\n // Events trigger outside of canvas when moved, use offsetX/Y by default and allow overrides\n state.pointer.set(event.offsetX / state.size.width * 2 - 1, -(event.offsetY / state.size.height) * 2 + 1);\n state.raycaster.setFromCamera(state.pointer, state.camera);\n },\n connected: undefined,\n handlers: Object.keys(DOM_EVENTS).reduce((acc, key) => ({\n ...acc,\n [key]: handlePointer(key)\n }), {}),\n update: () => {\n var _internal$lastEvent;\n const {\n events,\n internal\n } = store.getState();\n if ((_internal$lastEvent = internal.lastEvent) != null && _internal$lastEvent.current && events.handlers) events.handlers.onPointerMove(internal.lastEvent.current);\n },\n connect: target => {\n var _events$handlers;\n const {\n set,\n events\n } = store.getState();\n events.disconnect == null ? void 0 : events.disconnect();\n set(state => ({\n events: {\n ...state.events,\n connected: target\n }\n }));\n Object.entries((_events$handlers = events.handlers) != null ? _events$handlers : []).forEach(([name, event]) => {\n const [eventName, passive] = DOM_EVENTS[name];\n target.addEventListener(eventName, event, {\n passive\n });\n });\n },\n disconnect: () => {\n const {\n set,\n events\n } = store.getState();\n if (events.connected) {\n var _events$handlers2;\n Object.entries((_events$handlers2 = events.handlers) != null ? _events$handlers2 : []).forEach(([name, event]) => {\n if (events && events.connected instanceof HTMLElement) {\n const [eventName] = DOM_EVENTS[name];\n events.connected.removeEventListener(eventName, event);\n }\n });\n set(state => ({\n events: {\n ...state.events,\n connected: undefined\n }\n }));\n }\n }\n };\n}\n\nconst CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({\n children,\n fallback,\n resize,\n style,\n gl,\n events = createPointerEvents,\n eventSource,\n eventPrefix,\n shadows,\n linear,\n flat,\n legacy,\n orthographic,\n frameloop,\n dpr,\n performance,\n raycaster,\n camera,\n scene,\n onPointerMissed,\n onCreated,\n ...props\n}, forwardedRef) {\n // Create a known catalogue of Threejs-native elements\n // This will include the entire THREE namespace by default, users can extend\n // their own elements by using the createRoot API instead\n React.useMemo(() => extend(THREE), []);\n const Bridge = useContextBridge();\n const [containerRef, containerRect] = useMeasure({\n scroll: true,\n debounce: {\n scroll: 50,\n resize: 0\n },\n ...resize\n });\n const canvasRef = React.useRef(null);\n const divRef = React.useRef(null);\n React.useImperativeHandle(forwardedRef, () => canvasRef.current);\n const handlePointerMissed = useMutableCallback(onPointerMissed);\n const [block, setBlock] = React.useState(false);\n const [error, setError] = React.useState(false);\n\n // Suspend this component if block is a promise (2nd run)\n if (block) throw block;\n // Throw exception outwards if anything within canvas throws\n if (error) throw error;\n const root = React.useRef(null);\n useIsomorphicLayoutEffect(() => {\n const canvas = canvasRef.current;\n if (containerRect.width > 0 && containerRect.height > 0 && canvas) {\n if (!root.current) root.current = createRoot(canvas);\n root.current.configure({\n gl,\n events,\n shadows,\n linear,\n flat,\n legacy,\n orthographic,\n frameloop,\n dpr,\n performance,\n raycaster,\n camera,\n scene,\n size: containerRect,\n // Pass mutable reference to onPointerMissed so it's free to update\n onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),\n onCreated: state => {\n // Connect to event source\n state.events.connect == null ? void 0 : state.events.connect(eventSource ? isRef(eventSource) ? eventSource.current : eventSource : divRef.current);\n // Set up compute function\n if (eventPrefix) {\n state.setEvents({\n compute: (event, state) => {\n const x = event[eventPrefix + 'X'];\n const y = event[eventPrefix + 'Y'];\n state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);\n state.raycaster.setFromCamera(state.pointer, state.camera);\n }\n });\n }\n // Call onCreated callback\n onCreated == null ? void 0 : onCreated(state);\n }\n });\n root.current.render( /*#__PURE__*/jsx(Bridge, {\n children: /*#__PURE__*/jsx(ErrorBoundary, {\n set: setError,\n children: /*#__PURE__*/jsx(React.Suspense, {\n fallback: /*#__PURE__*/jsx(Block, {\n set: setBlock\n }),\n children: children\n })\n })\n }));\n }\n });\n React.useEffect(() => {\n const canvas = canvasRef.current;\n if (canvas) return () => unmountComponentAtNode(canvas);\n }, []);\n\n // When the event source is not this div, we need to set pointer-events to none\n // Or else the canvas will block events from reaching the event source\n const pointerEvents = eventSource ? 'none' : 'auto';\n return /*#__PURE__*/jsx(\"div\", {\n ref: divRef,\n style: {\n position: 'relative',\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n pointerEvents,\n ...style\n },\n ...props,\n children: /*#__PURE__*/jsx(\"div\", {\n ref: containerRef,\n style: {\n width: '100%',\n height: '100%'\n },\n children: /*#__PURE__*/jsx(\"canvas\", {\n ref: canvasRef,\n style: {\n display: 'block'\n },\n children: fallback\n })\n })\n });\n});\n\n/**\r\n * A DOM canvas which accepts threejs elements as children.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/canvas\r\n */\nconst Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {\n return /*#__PURE__*/jsx(FiberProvider, {\n children: /*#__PURE__*/jsx(CanvasImpl, {\n ...props,\n ref: ref\n })\n });\n});\n\nexport { Canvas, createPointerEvents as events };\n", "import * as THREE from 'three';\nimport * as React from 'react';\nimport { DefaultEventPriority, ContinuousEventPriority, DiscreteEventPriority, ConcurrentRoot } from 'react-reconciler/constants';\nimport create from 'zustand';\nimport Reconciler from 'react-reconciler';\nimport { unstable_scheduleCallback, unstable_IdlePriority } from 'scheduler';\nimport { suspend, preload, clear } from 'suspend-react';\nimport { jsx, Fragment } from 'react/jsx-runtime';\n\nvar threeTypes = /*#__PURE__*/Object.freeze({\n __proto__: null\n});\n\nconst catalogue = {};\nconst extend = objects => void Object.assign(catalogue, objects);\nfunction createRenderer(_roots, _getEventPriority) {\n function createInstance(type, {\n args = [],\n attach,\n ...props\n }, root) {\n let name = `${type[0].toUpperCase()}${type.slice(1)}`;\n let instance;\n if (type === 'primitive') {\n if (props.object === undefined) throw new Error(\"R3F: Primitives without 'object' are invalid!\");\n const object = props.object;\n instance = prepare(object, {\n type,\n root,\n attach,\n primitive: true\n });\n } else {\n const target = catalogue[name];\n if (!target) {\n throw new Error(`R3F: ${name} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);\n }\n\n // Throw if an object or literal was passed for args\n if (!Array.isArray(args)) throw new Error('R3F: The args prop must be an array!');\n\n // Instanciate new object, link it to the root\n // Append memoized props with args so it's not forgotten\n instance = prepare(new target(...args), {\n type,\n root,\n attach,\n // Save args in case we need to reconstruct later for HMR\n memoizedProps: {\n args\n }\n });\n }\n\n // Auto-attach geometries and materials\n if (instance.__r3f.attach === undefined) {\n if (instance instanceof THREE.BufferGeometry) instance.__r3f.attach = 'geometry';else if (instance instanceof THREE.Material) instance.__r3f.attach = 'material';\n }\n\n // It should NOT call onUpdate on object instanciation, because it hasn't been added to the\n // view yet. If the callback relies on references for instance, they won't be ready yet, this is\n // why it passes \"true\" here\n // There is no reason to apply props to injects\n if (name !== 'inject') applyProps$1(instance, props);\n return instance;\n }\n function appendChild(parentInstance, child) {\n let added = false;\n if (child) {\n var _child$__r3f, _parentInstance$__r3f;\n // The attach attribute implies that the object attaches itself on the parent\n if ((_child$__r3f = child.__r3f) != null && _child$__r3f.attach) {\n attach(parentInstance, child, child.__r3f.attach);\n } else if (child.isObject3D && parentInstance.isObject3D) {\n // add in the usual parent-child way\n parentInstance.add(child);\n added = true;\n }\n // This is for anything that used attach, and for non-Object3Ds that don't get attached to props;\n // that is, anything that's a child in React but not a child in the scenegraph.\n if (!added) (_parentInstance$__r3f = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f.objects.push(child);\n if (!child.__r3f) prepare(child, {});\n child.__r3f.parent = parentInstance;\n updateInstance(child);\n invalidateInstance(child);\n }\n }\n function insertBefore(parentInstance, child, beforeChild) {\n let added = false;\n if (child) {\n var _child$__r3f2, _parentInstance$__r3f2;\n if ((_child$__r3f2 = child.__r3f) != null && _child$__r3f2.attach) {\n attach(parentInstance, child, child.__r3f.attach);\n } else if (child.isObject3D && parentInstance.isObject3D) {\n child.parent = parentInstance;\n child.dispatchEvent({\n type: 'added'\n });\n parentInstance.dispatchEvent({\n type: 'childadded',\n child\n });\n const restSiblings = parentInstance.children.filter(sibling => sibling !== child);\n const index = restSiblings.indexOf(beforeChild);\n parentInstance.children = [...restSiblings.slice(0, index), child, ...restSiblings.slice(index)];\n added = true;\n }\n if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);\n if (!child.__r3f) prepare(child, {});\n child.__r3f.parent = parentInstance;\n updateInstance(child);\n invalidateInstance(child);\n }\n }\n function removeRecursive(array, parent, dispose = false) {\n if (array) [...array].forEach(child => removeChild(parent, child, dispose));\n }\n function removeChild(parentInstance, child, dispose) {\n if (child) {\n var _parentInstance$__r3f3, _child$__r3f3, _child$__r3f5;\n // Clear the parent reference\n if (child.__r3f) child.__r3f.parent = null;\n // Remove child from the parents objects\n if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child);\n // Remove attachment\n if ((_child$__r3f3 = child.__r3f) != null && _child$__r3f3.attach) {\n detach(parentInstance, child, child.__r3f.attach);\n } else if (child.isObject3D && parentInstance.isObject3D) {\n var _child$__r3f4;\n parentInstance.remove(child);\n // @ts-expect-error\n // Remove interactivity on the initial root\n if ((_child$__r3f4 = child.__r3f) != null && _child$__r3f4.root) {\n removeInteractivity(findInitialRoot(child), child);\n }\n }\n\n // Allow objects to bail out of recursive dispose altogether by passing dispose={null}\n // Never dispose of primitives because their state may be kept outside of React!\n // In order for an object to be able to dispose it has to have\n // - a dispose method,\n // - it cannot be a \n // - it cannot be a THREE.Scene, because three has broken it's own api\n //\n // Since disposal is recursive, we can check the optional dispose arg, which will be undefined\n // when the reconciler calls it, but then carry our own check recursively\n const isPrimitive = (_child$__r3f5 = child.__r3f) == null ? void 0 : _child$__r3f5.primitive;\n const shouldDispose = !isPrimitive && (dispose === undefined ? child.dispose !== null : dispose);\n\n // Remove nested child objects. Primitives should not have objects and children that are\n // attached to them declaratively ...\n if (!isPrimitive) {\n var _child$__r3f6;\n removeRecursive((_child$__r3f6 = child.__r3f) == null ? void 0 : _child$__r3f6.objects, child, shouldDispose);\n removeRecursive(child.children, child, shouldDispose);\n }\n\n // Remove references\n delete child.__r3f;\n\n // Dispose item whenever the reconciler feels like it\n if (shouldDispose && child.dispose && child.type !== 'Scene') {\n const callback = () => {\n try {\n child.dispose();\n } catch (e) {\n /* ... */\n }\n };\n\n // Schedule async at runtime, flush sync in testing\n if (typeof IS_REACT_ACT_ENVIRONMENT === 'undefined') {\n unstable_scheduleCallback(unstable_IdlePriority, callback);\n } else {\n callback();\n }\n }\n invalidateInstance(parentInstance);\n }\n }\n function switchInstance(instance, type, newProps, fiber) {\n var _instance$__r3f;\n const parent = (_instance$__r3f = instance.__r3f) == null ? void 0 : _instance$__r3f.parent;\n if (!parent) return;\n const newInstance = createInstance(type, newProps, instance.__r3f.root);\n\n // https://github.com/pmndrs/react-three-fiber/issues/1348\n // When args change the instance has to be re-constructed, which then\n // forces r3f to re-parent the children and non-scene objects\n if (instance.children) {\n for (const child of instance.children) {\n if (child.__r3f) appendChild(newInstance, child);\n }\n instance.children = instance.children.filter(child => !child.__r3f);\n }\n instance.__r3f.objects.forEach(child => appendChild(newInstance, child));\n instance.__r3f.objects = [];\n if (!instance.__r3f.autoRemovedBeforeAppend) {\n removeChild(parent, instance);\n }\n if (newInstance.parent) {\n newInstance.__r3f.autoRemovedBeforeAppend = true;\n }\n appendChild(parent, newInstance);\n\n // Re-bind event handlers on the initial root\n if (newInstance.raycast && newInstance.__r3f.eventCount) {\n const rootState = findInitialRoot(newInstance).getState();\n rootState.internal.interaction.push(newInstance);\n }\n [fiber, fiber.alternate].forEach(fiber => {\n if (fiber !== null) {\n fiber.stateNode = newInstance;\n if (fiber.ref) {\n if (typeof fiber.ref === 'function') fiber.ref(newInstance);else fiber.ref.current = newInstance;\n }\n }\n });\n }\n\n // Don't handle text instances, warn on undefined behavior\n const handleTextInstance = () => console.warn('Text is not allowed in the R3F tree! This could be stray whitespace or characters.');\n const reconciler = Reconciler({\n createInstance,\n removeChild,\n appendChild,\n appendInitialChild: appendChild,\n insertBefore,\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n noTimeout: -1,\n appendChildToContainer: (container, child) => {\n if (!child) return;\n\n // Don't append to unmounted container\n const scene = container.getState().scene;\n if (!scene.__r3f) return;\n\n // Link current root to the default scene\n scene.__r3f.root = container;\n appendChild(scene, child);\n },\n removeChildFromContainer: (container, child) => {\n if (!child) return;\n removeChild(container.getState().scene, child);\n },\n insertInContainerBefore: (container, child, beforeChild) => {\n if (!child || !beforeChild) return;\n\n // Don't append to unmounted container\n const scene = container.getState().scene;\n if (!scene.__r3f) return;\n insertBefore(scene, child, beforeChild);\n },\n getRootHostContext: () => null,\n getChildHostContext: parentHostContext => parentHostContext,\n finalizeInitialChildren(instance) {\n var _instance$__r3f2;\n const localState = (_instance$__r3f2 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f2 : {};\n // https://github.com/facebook/react/issues/20271\n // Returning true will trigger commitMount\n return Boolean(localState.handlers);\n },\n prepareUpdate(instance, _type, oldProps, newProps) {\n var _instance$__r3f3;\n const localState = (_instance$__r3f3 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f3 : {};\n\n // Create diff-sets\n if (localState.primitive && newProps.object && newProps.object !== instance) {\n return [true];\n } else {\n // This is a data object, let's extract critical information about it\n const {\n args: argsNew = [],\n children: cN,\n ...restNew\n } = newProps;\n const {\n args: argsOld = [],\n children: cO,\n ...restOld\n } = oldProps;\n\n // Throw if an object or literal was passed for args\n if (!Array.isArray(argsNew)) throw new Error('R3F: the args prop must be an array!');\n\n // If it has new props or arguments, then it needs to be re-instantiated\n if (argsNew.some((value, index) => value !== argsOld[index])) return [true];\n // Create a diff-set, flag if there are any changes\n const diff = diffProps(instance, restNew, restOld, true);\n if (diff.changes.length) return [false, diff];\n\n // Otherwise do not touch the instance\n return null;\n }\n },\n commitUpdate(instance, [reconstruct, diff], type, _oldProps, newProps, fiber) {\n // Reconstruct when args or instance,\n prepareForCommit: () => null,\n preparePortalMount: container => prepare(container.getState().scene),\n resetAfterCommit: () => {},\n shouldSetTextContent: () => false,\n clearContainer: () => false,\n hideInstance(instance) {\n var _instance$__r3f5;\n // Detach while the instance is hidden\n const {\n attach: type,\n parent\n } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};\n if (type && parent) detach(parent, instance, type);\n if (instance.isObject3D) instance.visible = false;\n invalidateInstance(instance);\n },\n unhideInstance(instance, props) {\n var _instance$__r3f6;\n // Re-attach when the instance is unhidden\n const {\n attach: type,\n parent\n } = (_instance$__r3f6 = instance.__r3f) != null ? _instance$__r3f6 : {};\n if (type && parent) attach(parent, instance, type);\n if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;\n invalidateInstance(instance);\n },\n createTextInstance: handleTextInstance,\n hideTextInstance: handleTextInstance,\n unhideTextInstance: handleTextInstance,\n // https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n // @ts-expect-error\n getCurrentEventPriority: () => _getEventPriority ? _getEventPriority() : DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n now: typeof performance !== 'undefined' && is.fun(performance.now) ? performance.now : is.fun(Date.now) ? Date.now : () => 0,\n // https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r920883503\n scheduleTimeout: is.fun(setTimeout) ? setTimeout : undefined,\n cancelTimeout: is.fun(clearTimeout) ? clearTimeout : undefined\n });\n return {\n reconciler,\n applyProps: applyProps$1\n };\n}\n\nvar _window$document, _window$navigator;\n/**\r\n * Returns `true` with correct TS type inference if an object has a configurable color space (since r152).\r\n */\nconst hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;\n/**\r\n * The current THREE.ColorManagement instance, if present.\r\n */\nconst getColorManagement = () => {\n var _ColorManagement;\n return (_ColorManagement = catalogue.ColorManagement) != null ? _ColorManagement : null;\n};\nconst isOrthographicCamera = def => def && def.isOrthographicCamera;\nconst isRef = obj => obj && obj.hasOwnProperty('current');\n\n/**\r\n * An SSR-friendly useLayoutEffect.\r\n *\r\n * React currently throws a warning when using useLayoutEffect on the server.\r\n * To get around it, we can conditionally useEffect on the server (no-op) and\r\n * useLayoutEffect elsewhere.\r\n *\r\n * @see https://github.com/facebook/react/issues/14927\r\n */\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' && ((_window$document = window.document) != null && _window$document.createElement || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === 'ReactNative') ? React.useLayoutEffect : React.useEffect;\nfunction useMutableCallback(fn) {\n const ref = React.useRef(fn);\n useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);\n return ref;\n}\nfunction Block({\n set\n}) {\n useIsomorphicLayoutEffect(() => {\n set(new Promise(() => null));\n return () => set(false);\n }, [set]);\n return null;\n}\nclass ErrorBoundary extends React.Component {\n constructor(...args) {\n super(...args);\n this.state = {\n error: false\n };\n }\n componentDidCatch(err) {\n this.props.set(err);\n }\n render() {\n return this.state.error ? null : this.props.children;\n }\n}\nErrorBoundary.getDerivedStateFromError = () => ({\n error: true\n});\nconst DEFAULT = '__default';\nconst DEFAULTS = new Map();\nconst isDiffSet = def => def && !!def.memoized && !!def.changes;\nfunction calculateDpr(dpr) {\n var _window$devicePixelRa;\n // Err on the side of progress by assuming 2x dpr if we can't detect it\n // This will happen in workers where window is defined but dpr isn't.\n const target = typeof window !== 'undefined' ? (_window$devicePixelRa = window.devicePixelRatio) != null ? _window$devicePixelRa : 2 : 1;\n return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;\n}\n\n/**\r\n * Returns instance root state\r\n */\nconst getRootState = obj => {\n var _r3f;\n return (_r3f = obj.__r3f) == null ? void 0 : _r3f.root.getState();\n};\n\n/**\r\n * Returns the instances initial (outmost) root\r\n */\nfunction findInitialRoot(child) {\n let root = child.__r3f.root;\n while (root.getState().previousRoot) root = root.getState().previousRoot;\n return root;\n}\n// A collection of compare functions\nconst is = {\n obj: a => a === Object(a) && !is.arr(a) && typeof a !== 'function',\n fun: a => typeof a === 'function',\n str: a => typeof a === 'string',\n num: a => typeof a === 'number',\n boo: a => typeof a === 'boolean',\n und: a => a === void 0,\n arr: a => Array.isArray(a),\n equ(a, b, {\n arrays = 'shallow',\n objects = 'reference',\n strict = true\n } = {}) {\n // Wrong type or one of the two undefined, doesn't match\n if (typeof a !== typeof b || !!a !== !!b) return false;\n // Atomic, just compare a against b\n if (is.str(a) || is.num(a) || is.boo(a)) return a === b;\n const isObj = is.obj(a);\n if (isObj && objects === 'reference') return a === b;\n const isArr = is.arr(a);\n if (isArr && arrays === 'reference') return a === b;\n // Array or Object, shallow compare first to see if it's a match\n if ((isArr || isObj) && a === b) return true;\n // Last resort, go through keys\n let i;\n // Check if a has all the keys of b\n for (i in a) if (!(i in b)) return false;\n // Check if values between keys match\n if (isObj && arrays === 'shallow' && objects === 'shallow') {\n for (i in strict ? b : a) if (!is.equ(a[i], b[i], {\n strict,\n objects: 'reference'\n })) return false;\n } else {\n for (i in strict ? b : a) if (a[i] !== b[i]) return false;\n }\n // If i is undefined\n if (is.und(i)) {\n // If both arrays are empty we consider them equal\n if (isArr && a.length === 0 && b.length === 0) return true;\n // If both objects are empty we consider them equal\n if (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;\n // Otherwise match them by value\n if (a !== b) return false;\n }\n return true;\n }\n};\n\n/**\r\n * Collects nodes and materials from a THREE.Object3D.\r\n */\nfunction buildGraph(object) {\n const data = {\n nodes: {},\n materials: {}\n };\n if (object) {\n object.traverse(obj => {\n if (obj.name) data.nodes[obj.name] = obj;\n if (obj.material && !data.materials[obj.material.name]) data.materials[obj.material.name] = obj.material;\n });\n }\n return data;\n}\n\n// Disposes an object and all its properties\nfunction dispose(obj) {\n if (obj.dispose && obj.type !== 'Scene') obj.dispose();\n for (const p in obj) {\n p.dispose == null ? void 0 : p.dispose();\n delete obj[p];\n }\n}\n\n// Each object in the scene carries a small LocalState descriptor\nfunction prepare(object, state) {\n const instance = object;\n instance.__r3f = {\n type: '',\n root: null,\n previousAttach: null,\n memoizedProps: {},\n eventCount: 0,\n handlers: {},\n objects: [],\n parent: null,\n ...state\n };\n return object;\n}\nfunction resolve(instance, key) {\n let target = instance;\n if (key.includes('-')) {\n const entries = key.split('-');\n const last = entries.pop();\n target = entries.reduce((acc, key) => acc[key], instance);\n return {\n target,\n key: last\n };\n } else return {\n target,\n key\n };\n}\n\n// Checks if a dash-cased string ends with an integer\nconst INDEX_REGEX = /-\\d+$/;\nfunction attach(parent, child, type) {\n if (is.str(type)) {\n // If attaching into an array (foo-0), create one\n if (INDEX_REGEX.test(type)) {\n const root = type.replace(INDEX_REGEX, '');\n const {\n target,\n key\n } = resolve(parent, root);\n if (!Array.isArray(target[key])) target[key] = [];\n }\n const {\n target,\n key\n } = resolve(parent, type);\n child.__r3f.previousAttach = target[key];\n target[key] = child;\n } else child.__r3f.previousAttach = type(parent, child);\n}\nfunction detach(parent, child, type) {\n var _child$__r3f, _child$__r3f2;\n if (is.str(type)) {\n const {\n target,\n key\n } = resolve(parent, type);\n const previous = child.__r3f.previousAttach;\n // When the previous value was undefined, it means the value was never set to begin with\n if (previous === undefined) delete target[key];\n // Otherwise set the previous value\n else target[key] = previous;\n } else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);\n (_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;\n}\n// This function prepares a set of changes to be applied to the instance\nfunction diffProps(instance, {\n children: cN,\n key: kN,\n ref: rN,\n ...props\n}, {\n children: cP,\n key: kP,\n ref: rP,\n ...previous\n} = {}, remove = false) {\n const localState = instance.__r3f;\n const entries = Object.entries(props);\n const changes = [];\n\n // Catch removed props, prepend them so they can be reset or removed\n if (remove) {\n const previousKeys = Object.keys(previous);\n for (let i = 0; i < previousKeys.length; i++) {\n if (!props.hasOwnProperty(previousKeys[i])) entries.unshift([previousKeys[i], DEFAULT + 'remove']);\n }\n }\n entries.forEach(([key, value]) => {\n var _instance$__r3f;\n // Bail out on primitive object\n if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;\n // When props match bail out\n if (is.equ(value, previous[key])) return;\n // Collect handlers and bail out\n if (/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(key)) return changes.push([key, value, true, []]);\n // Split dashed props\n let entries = [];\n if (key.includes('-')) entries = key.split('-');\n changes.push([key, value, false, entries]);\n\n // Reset pierced props\n for (const prop in props) {\n const value = props[prop];\n if (prop.startsWith(`${key}-`)) changes.push([prop, value, false, prop.split('-')]);\n }\n });\n const memoized = {\n ...props\n };\n if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;\n if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;\n return {\n memoized,\n changes\n };\n}\nconst __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'production';\n\n// This function applies a set of changes to the instance\nfunction applyProps$1(instance, data) {\n var _instance$__r3f2;\n // Filter equals, events and reserved props\n const localState = instance.__r3f;\n const root = localState == null ? void 0 : localState.root;\n const rootState = root == null ? void 0 : root.getState == null ? void 0 : root.getState();\n const {\n memoized,\n changes\n } = isDiffSet(data) ? data : diffProps(instance, data);\n const prevHandlers = localState == null ? void 0 : localState.eventCount;\n\n // Prepare memoized props\n if (instance.__r3f) instance.__r3f.memoizedProps = memoized;\n for (let i = 0; i < changes.length; i++) {\n let [key, value, isEvent, keys] = changes[i];\n\n // Alias (output)encoding => (output)colorSpace (since r152)\n // https://github.com/pmndrs/react-three-fiber/pull/2829\n if (hasColorSpace(instance)) {\n const sRGBEncoding = 3001;\n const SRGBColorSpace = 'srgb';\n const LinearSRGBColorSpace = 'srgb-linear';\n if (key === 'encoding') {\n key = 'colorSpace';\n value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n } else if (key === 'outputEncoding') {\n key = 'outputColorSpace';\n value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n }\n }\n let currentInstance = instance;\n let targetProp = currentInstance[key];\n\n // Revolve dashed props\n if (keys.length) {\n targetProp = keys.reduce((acc, key) => acc[key], instance);\n // If the target is atomic, it forces us to switch the root\n if (!(targetProp && targetProp.set)) {\n const [name, ...reverseEntries] = keys.reverse();\n currentInstance = reverseEntries.reverse().reduce((acc, key) => acc[key], instance);\n key = name;\n }\n }\n\n // https://github.com/mrdoob/three.js/issues/21209\n // HMR/fast-refresh relies on the ability to cancel out props, but threejs\n // has no means to do this. Hence we curate a small collection of value-classes\n // with their respective constructor/set arguments\n // For removed props, try to set default values, if possible\n if (value === DEFAULT + 'remove') {\n if (currentInstance.constructor) {\n // create a blank slate of the instance and copy the particular parameter.\n let ctor = DEFAULTS.get(currentInstance.constructor);\n if (!ctor) {\n // @ts-expect-error\n ctor = new currentInstance.constructor();\n DEFAULTS.set(currentInstance.constructor, ctor);\n }\n value = ctor[key];\n } else {\n // instance does not have constructor, just set it to 0\n value = 0;\n }\n }\n\n // Deal with pointer events ...\n if (isEvent && localState) {\n if (value) localState.handlers[key] = value;else delete localState.handlers[key];\n localState.eventCount = Object.keys(localState.handlers).length;\n }\n // Special treatment for objects with support for set/copy, and layers\n else if (targetProp && targetProp.set && (targetProp.copy || targetProp instanceof THREE.Layers)) {\n // If value is an array\n if (Array.isArray(value)) {\n if (targetProp.fromArray) targetProp.fromArray(value);else targetProp.set(...value);\n }\n // Test again target.copy(class) next ...\n else if (targetProp.copy && value && value.constructor && (\n // Some environments may break strict identity checks by duplicating versions of three.js.\n // Loosen to unminified names, ignoring descendents.\n // https://github.com/pmndrs/react-three-fiber/issues/2856\n // TODO: fix upstream and remove in v9\n __DEV__ ? targetProp.constructor.name === value.constructor.name : targetProp.constructor === value.constructor)) {\n targetProp.copy(value);\n }\n // If nothing else fits, just set the single value, ignore undefined\n // https://github.com/pmndrs/react-three-fiber/issues/274\n else if (value !== undefined) {\n const isColor = targetProp instanceof THREE.Color;\n // Allow setting array scalars\n if (!isColor && targetProp.setScalar) targetProp.setScalar(value);\n // Layers have no copy function, we must therefore copy the mask property\n else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers) targetProp.mask = value.mask;\n // Otherwise just set ...\n else targetProp.set(value);\n // For versions of three which don't support THREE.ColorManagement,\n // Auto-convert sRGB colors\n // https://github.com/pmndrs/react-three-fiber/issues/344\n if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();\n }\n // Else, just overwrite the value\n } else {\n currentInstance[key] = value;\n\n // Auto-convert sRGB textures, for now ...\n // https://github.com/pmndrs/react-three-fiber/issues/344\n if (currentInstance[key] instanceof THREE.Texture &&\n // sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129\n currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType && rootState) {\n const texture = currentInstance[key];\n if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;\n }\n }\n invalidateInstance(instance);\n }\n if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {\n // Get the initial root state's internals\n const internal = findInitialRoot(instance).getState().internal;\n // Pre-emptively remove the instance from the interaction manager\n const index = internal.interaction.indexOf(instance);\n if (index > -1) internal.interaction.splice(index, 1);\n // Add the instance to the interaction manager only when it has handlers\n if (localState.eventCount) internal.interaction.push(instance);\n }\n\n // Call the update lifecycle when it is being updated, but only when it is part of the scene.\n // Skip updates to the `onUpdate` prop itself\n const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';\n if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);\n return instance;\n}\nfunction invalidateInstance(instance) {\n var _instance$__r3f3, _instance$__r3f3$root;\n const state = (_instance$__r3f3 = instance.__r3f) == null ? void 0 : (_instance$__r3f3$root = _instance$__r3f3.root) == null ? void 0 : _instance$__r3f3$root.getState == null ? void 0 : _instance$__r3f3$root.getState();\n if (state && state.internal.frames === 0) state.invalidate();\n}\nfunction updateInstance(instance) {\n instance.onUpdate == null ? void 0 : instance.onUpdate(instance);\n}\nfunction updateCamera(camera, size) {\n // https://github.com/pmndrs/react-three-fiber/issues/92\n // Do not mess with the camera if it belongs to the user\n if (!camera.manual) {\n if (isOrthographicCamera(camera)) {\n camera.left = size.width / -2;\n camera.right = size.width / 2;\n camera.top = size.height / 2;\n camera.bottom = size.height / -2;\n } else {\n camera.aspect = size.width / size.height;\n }\n camera.updateProjectionMatrix();\n // https://github.com/pmndrs/react-three-fiber/issues/178\n // Update matrix world since the renderer is a frame late\n camera.updateMatrixWorld();\n }\n}\n\nfunction makeId(event) {\n return (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;\n}\n\n// https://github.com/facebook/react/tree/main/packages/react-reconciler#getcurrenteventpriority\n// Gives React a clue as to how import the current interaction is\nfunction getEventPriority() {\n var _globalScope$event;\n // Get a handle to the current global scope in window and worker contexts if able\n // https://github.com/pmndrs/react-three-fiber/pull/2493\n const globalScope = typeof self !== 'undefined' && self || typeof window !== 'undefined' && window;\n if (!globalScope) return DefaultEventPriority;\n const name = (_globalScope$event = globalScope.event) == null ? void 0 : _globalScope$event.type;\n switch (name) {\n case 'click':\n case 'contextmenu':\n case 'dblclick':\n case 'pointercancel':\n case 'pointerdown':\n case 'pointerup':\n return DiscreteEventPriority;\n case 'pointermove':\n case 'pointerout':\n case 'pointerover':\n case 'pointerenter':\n case 'pointerleave':\n case 'wheel':\n return ContinuousEventPriority;\n default:\n return DefaultEventPriority;\n }\n}\n\n/**\r\n * Release pointer captures.\r\n * This is called by releasePointerCapture in the API, and when an object is removed.\r\n */\nfunction releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {\n const captureData = captures.get(obj);\n if (captureData) {\n captures.delete(obj);\n // If this was the last capturing object for this pointer\n if (captures.size === 0) {\n capturedMap.delete(pointerId);\n captureData.target.releasePointerCapture(pointerId);\n }\n }\n}\nfunction removeInteractivity(store, object) {\n const {\n internal\n } = store.getState();\n // Removes every trace of an object from the data store\n internal.interaction = internal.interaction.filter(o => o !== object);\n internal.initialHits = internal.initialHits.filter(o => o !== object);\n internal.hovered.forEach((value, key) => {\n if (value.eventObject === object || value.object === object) {\n // Clear out intersects, they are outdated by now\n internal.hovered.delete(key);\n }\n });\n internal.capturedMap.forEach((captures, pointerId) => {\n releaseInternalPointerCapture(internal.capturedMap, object, captures, pointerId);\n });\n}\nfunction createEvents(store) {\n /** Calculates delta */\n function calculateDistance(event) {\n const {\n internal\n } = store.getState();\n const dx = event.offsetX - internal.initialClick[0];\n const dy = event.offsetY - internal.initialClick[1];\n return Math.round(Math.sqrt(dx * dx + dy * dy));\n }\n\n /** Returns true if an instance has a valid pointer-event registered, this excludes scroll, clicks etc */\n function filterPointerEvents(objects) {\n return objects.filter(obj => ['Move', 'Over', 'Enter', 'Out', 'Leave'].some(name => {\n var _r3f;\n return (_r3f = obj.__r3f) == null ? void 0 : _r3f.handlers['onPointer' + name];\n }));\n }\n function intersect(event, filter) {\n const state = store.getState();\n const duplicates = new Set();\n const intersections = [];\n // Allow callers to eliminate event objects\n const eventsObjects = filter ? filter(state.internal.interaction) : state.internal.interaction;\n // Reset all raycaster cameras to undefined\n for (let i = 0; i < eventsObjects.length; i++) {\n const state = getRootState(eventsObjects[i]);\n if (state) {\n state.raycaster.camera = undefined;\n }\n }\n if (!state.previousRoot) {\n // Make sure root-level pointer and ray are set up\n state.events.compute == null ? void 0 : state.events.compute(event, state);\n }\n function handleRaycast(obj) {\n const state = getRootState(obj);\n // Skip event handling when noEvents is set, or when the raycasters camera is null\n if (!state || !state.events.enabled || state.raycaster.camera === null) return [];\n\n // When the camera is undefined we have to call the event layers update function\n if (state.raycaster.camera === undefined) {\n var _state$previousRoot;\n state.events.compute == null ? void 0 : state.events.compute(event, state, (_state$previousRoot = state.previousRoot) == null ? void 0 : _state$previousRoot.getState());\n // If the camera is still undefined we have to skip this layer entirely\n if (state.raycaster.camera === undefined) state.raycaster.camera = null;\n }\n\n // Intersect object by object\n return state.raycaster.camera ? state.raycaster.intersectObject(obj, true) : [];\n }\n\n // Collect events\n let hits = eventsObjects\n // Intersect objects\n .flatMap(handleRaycast)\n // Sort by event priority and distance\n .sort((a, b) => {\n const aState = getRootState(a.object);\n const bState = getRootState(b.object);\n if (!aState || !bState) return a.distance - b.distance;\n return bState.events.priority - aState.events.priority || a.distance - b.distance;\n })\n // Filter out duplicates\n .filter(item => {\n const id = makeId(item);\n if (duplicates.has(id)) return false;\n duplicates.add(id);\n return true;\n });\n\n // https://github.com/mrdoob/three.js/issues/16031\n // Allow custom userland intersect sort order, this likely only makes sense on the root filter\n if (state.events.filter) hits = state.events.filter(hits, state);\n\n // Bubble up the events, find the event source (eventObject)\n for (const hit of hits) {\n let eventObject = hit.object;\n // Bubble event up\n while (eventObject) {\n var _r3f2;\n if ((_r3f2 = eventObject.__r3f) != null && _r3f2.eventCount) intersections.push({\n ...hit,\n eventObject\n });\n eventObject = eventObject.parent;\n }\n }\n\n // If the interaction is captured, make all capturing targets part of the intersect.\n if ('pointerId' in event && state.internal.capturedMap.has(event.pointerId)) {\n for (let captureData of state.internal.capturedMap.get(event.pointerId).values()) {\n if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);\n }\n }\n return intersections;\n }\n\n /** Handles intersections by forwarding them to handlers */\n function handleIntersects(intersections, event, delta, callback) {\n const rootState = store.getState();\n\n // If anything has been found, forward it to the event listeners\n if (intersections.length) {\n const localState = {\n stopped: false\n };\n for (const hit of intersections) {\n const state = getRootState(hit.object) || rootState;\n const {\n raycaster,\n pointer,\n camera,\n internal\n } = state;\n const unprojectedPoint = new THREE.Vector3(pointer.x, pointer.y, 0).unproject(camera);\n const hasPointerCapture = id => {\n var _internal$capturedMap, _internal$capturedMap2;\n return (_internal$capturedMap = (_internal$capturedMap2 = internal.capturedMap.get(id)) == null ? void 0 : _internal$capturedMap2.has(hit.eventObject)) != null ? _internal$capturedMap : false;\n };\n const setPointerCapture = id => {\n const captureData = {\n intersection: hit,\n target: event.target\n };\n if (internal.capturedMap.has(id)) {\n // if the pointerId was previously captured, we add the hit to the\n // event capturedMap.\n internal.capturedMap.get(id).set(hit.eventObject, captureData);\n } else {\n // if the pointerId was not previously captured, we create a map\n // containing the hitObject, and the hit. hitObject is used for\n // faster access.\n internal.capturedMap.set(id, new Map([[hit.eventObject, captureData]]));\n }\n event.target.setPointerCapture(id);\n };\n const releasePointerCapture = id => {\n const captures = internal.capturedMap.get(id);\n if (captures) {\n releaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);\n }\n };\n\n // Add native event props\n let extractEventProps = {};\n // This iterates over the event's properties including the inherited ones. Native PointerEvents have most of their props as getters which are inherited, but polyfilled PointerEvents have them all as their own properties (i.e. not inherited). We can't use Object.keys() or Object.entries() as they only return \"own\" properties; nor Object.getPrototypeOf(event) as that *doesn't* return \"own\" properties, only inherited ones.\n for (let prop in event) {\n let property = event[prop];\n // Only copy over atomics, leave functions alone as these should be\n // called as event.nativeEvent.fn()\n if (typeof property !== 'function') extractEventProps[prop] = property;\n }\n let raycastEvent = {\n ...hit,\n ...extractEventProps,\n pointer,\n intersections,\n stopped: localState.stopped,\n delta,\n unprojectedPoint,\n ray: raycaster.ray,\n camera: camera,\n // Hijack stopPropagation, which just sets a flag\n stopPropagation() {\n // https://github.com/pmndrs/react-three-fiber/issues/596\n // Events are not allowed to stop propagation if the pointer has been captured\n const capturesForPointer = 'pointerId' in event && internal.capturedMap.get(event.pointerId);\n\n // We only authorize stopPropagation...\n if (\n // ...if this pointer hasn't been captured\n !capturesForPointer ||\n // ... or if the hit object is capturing the pointer\n capturesForPointer.has(hit.eventObject)) {\n raycastEvent.stopped = localState.stopped = true;\n // Propagation is stopped, remove all other hover records\n // An event handler is only allowed to flush other handlers if it is hovered itself\n if (internal.hovered.size && Array.from(internal.hovered.values()).find(i => i.eventObject === hit.eventObject)) {\n // Objects cannot flush out higher up objects that have already caught the event\n const higher = intersections.slice(0, intersections.indexOf(hit));\n cancelPointer([...higher, hit]);\n }\n }\n },\n // there should be a distinction between target and currentTarget\n target: {\n hasPointerCapture,\n setPointerCapture,\n releasePointerCapture\n },\n currentTarget: {\n hasPointerCapture,\n setPointerCapture,\n releasePointerCapture\n },\n nativeEvent: event\n };\n\n // Call subscribers\n callback(raycastEvent);\n // Event bubbling may be interrupted by stopPropagation\n if (localState.stopped === true) break;\n }\n }\n return intersections;\n }\n function cancelPointer(intersections) {\n const {\n internal\n } = store.getState();\n for (const hoveredObj of internal.hovered.values()) {\n // When no objects were hit or the the hovered object wasn't found underneath the cursor\n // we call onPointerOut and delete the object from the hovered-elements map\n if (!intersections.length || !intersections.find(hit => hit.object === hoveredObj.object && hit.index === hoveredObj.index && hit.instanceId === hoveredObj.instanceId)) {\n const eventObject = hoveredObj.eventObject;\n const instance = eventObject.__r3f;\n const handlers = instance == null ? void 0 : instance.handlers;\n internal.hovered.delete(makeId(hoveredObj));\n if (instance != null && instance.eventCount) {\n // Clear out intersects, they are outdated by now\n const data = {\n ...hoveredObj,\n intersections\n };\n handlers.onPointerOut == null ? void 0 : handlers.onPointerOut(data);\n handlers.onPointerLeave == null ? void 0 : handlers.onPointerLeave(data);\n }\n }\n }\n }\n function pointerMissed(event, objects) {\n for (let i = 0; i < objects.length; i++) {\n const instance = objects[i].__r3f;\n instance == null ? void 0 : instance.handlers.onPointerMissed == null ? void 0 : instance.handlers.onPointerMissed(event);\n }\n }\n function handlePointer(name) {\n // Deal with cancelation\n switch (name) {\n case 'onPointerLeave':\n case 'onPointerCancel':\n return () => cancelPointer([]);\n case 'onLostPointerCapture':\n return event => {\n const {\n internal\n } = store.getState();\n if ('pointerId' in event && internal.capturedMap.has(event.pointerId)) {\n // If the object event interface had onLostPointerCapture, we'd call it here on every\n // object that's getting removed. We call it on the next frame because onLostPointerCapture\n // fires before onPointerUp. Otherwise pointerUp would never be called if the event didn't\n // happen in the object it originated from, leaving components in a in-between state.\n requestAnimationFrame(() => {\n // Only release if pointer-up didn't do it already\n if (internal.capturedMap.has(event.pointerId)) {\n internal.capturedMap.delete(event.pointerId);\n cancelPointer([]);\n }\n });\n }\n };\n }\n\n // Any other pointer goes here ...\n return function handleEvent(event) {\n const {\n onPointerMissed,\n internal\n } = store.getState();\n\n // prepareRay(event)\n internal.lastEvent.current = event;\n\n // Get fresh intersects\n const isPointerMove = name === 'onPointerMove';\n const isClickEvent = name === 'onClick' || name === 'onContextMenu' || name === 'onDoubleClick';\n const filter = isPointerMove ? filterPointerEvents : undefined;\n const hits = intersect(event, filter);\n const delta = isClickEvent ? calculateDistance(event) : 0;\n\n // Save initial coordinates on pointer-down\n if (name === 'onPointerDown') {\n internal.initialClick = [event.offsetX, event.offsetY];\n internal.initialHits = hits.map(hit => hit.eventObject);\n }\n\n // If a click yields no results, pass it back to the user as a miss\n // Missed events have to come first in order to establish user-land side-effect clean up\n if (isClickEvent && !hits.length) {\n if (delta <= 2) {\n pointerMissed(event, internal.interaction);\n if (onPointerMissed) onPointerMissed(event);\n }\n }\n // Take care of unhover\n if (isPointerMove) cancelPointer(hits);\n function onIntersect(data) {\n const eventObject = data.eventObject;\n const instance = eventObject.__r3f;\n const handlers = instance == null ? void 0 : instance.handlers;\n\n // Check presence of handlers\n if (!(instance != null && instance.eventCount)) return;\n\n /*\r\n MAYBE TODO, DELETE IF NOT: \r\n Check if the object is captured, captured events should not have intersects running in parallel\r\n But wouldn't it be better to just replace capturedMap with a single entry?\r\n Also, are we OK with straight up making picking up multiple objects impossible?\r\n \r\n const pointerId = (data as ThreeEvent).pointerId \r\n if (pointerId !== undefined) {\r\n const capturedMeshSet = internal.capturedMap.get(pointerId)\r\n if (capturedMeshSet) {\r\n const captured = capturedMeshSet.get(eventObject)\r\n if (captured && captured.localState.stopped) return\r\n }\r\n }*/\n\n if (isPointerMove) {\n // Move event ...\n if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {\n // When enter or out is present take care of hover-state\n const id = makeId(data);\n const hoveredItem = internal.hovered.get(id);\n if (!hoveredItem) {\n // If the object wasn't previously hovered, book it and call its handler\n internal.hovered.set(id, data);\n handlers.onPointerOver == null ? void 0 : handlers.onPointerOver(data);\n handlers.onPointerEnter == null ? void 0 : handlers.onPointerEnter(data);\n } else if (hoveredItem.stopped) {\n // If the object was previously hovered and stopped, we shouldn't allow other items to proceed\n data.stopPropagation();\n }\n }\n // Call mouse move\n handlers.onPointerMove == null ? void 0 : handlers.onPointerMove(data);\n } else {\n // All other events ...\n const handler = handlers[name];\n if (handler) {\n // Forward all events back to their respective handlers with the exception of click events,\n // which must use the initial target\n if (!isClickEvent || internal.initialHits.includes(eventObject)) {\n // Missed events have to come first\n pointerMissed(event, internal.interaction.filter(object => !internal.initialHits.includes(object)));\n // Now call the handler\n handler(data);\n }\n } else {\n // Trigger onPointerMissed on all elements that have pointer over/out handlers, but not click and weren't hit\n if (isClickEvent && internal.initialHits.includes(eventObject)) {\n pointerMissed(event, internal.interaction.filter(object => !internal.initialHits.includes(object)));\n }\n }\n }\n }\n handleIntersects(hits, event, delta, onIntersect);\n };\n }\n return {\n handlePointer\n };\n}\n\n// Keys that shouldn't be copied between R3F stores\nconst privateKeys = ['set', 'get', 'setSize', 'setFrameloop', 'setDpr', 'events', 'invalidate', 'advance', 'size', 'viewport'];\nconst isRenderer = def => !!(def != null && def.render);\nconst context = /*#__PURE__*/React.createContext(null);\nconst createStore = (invalidate, advance) => {\n const rootState = create((set, get) => {\n const position = new THREE.Vector3();\n const defaultTarget = new THREE.Vector3();\n const tempTarget = new THREE.Vector3();\n function getCurrentViewport(camera = get().camera, target = defaultTarget, size = get().size) {\n const {\n width,\n height,\n top,\n left\n } = size;\n const aspect = width / height;\n if (target instanceof THREE.Vector3) tempTarget.copy(target);else tempTarget.set(...target);\n const distance = camera.getWorldPosition(position).distanceTo(tempTarget);\n if (isOrthographicCamera(camera)) {\n return {\n width: width / camera.zoom,\n height: height / camera.zoom,\n top,\n left,\n factor: 1,\n distance,\n aspect\n };\n } else {\n const fov = camera.fov * Math.PI / 180; // convert vertical fov to radians\n const h = 2 * Math.tan(fov / 2) * distance; // visible height\n const w = h * (width / height);\n return {\n width: w,\n height: h,\n top,\n left,\n factor: width / w,\n distance,\n aspect\n };\n }\n }\n let performanceTimeout = undefined;\n const setPerformanceCurrent = current => set(state => ({\n performance: {\n ...state.performance,\n current\n }\n }));\n const pointer = new THREE.Vector2();\n const rootState = {\n set,\n get,\n // Mock objects that have to be configured\n gl: null,\n camera: null,\n raycaster: null,\n events: {\n priority: 1,\n enabled: true,\n connected: false\n },\n xr: null,\n scene: null,\n invalidate: (frames = 1) => invalidate(get(), frames),\n advance: (timestamp, runGlobalEffects) => advance(timestamp, runGlobalEffects, get()),\n legacy: false,\n linear: false,\n flat: false,\n controls: null,\n clock: new THREE.Clock(),\n pointer,\n mouse: pointer,\n frameloop: 'always',\n onPointerMissed: undefined,\n performance: {\n current: 1,\n min: 0.5,\n max: 1,\n debounce: 200,\n regress: () => {\n const state = get();\n // Clear timeout\n if (performanceTimeout) clearTimeout(performanceTimeout);\n // Set lower bound performance\n if (state.performance.current !== state.performance.min) setPerformanceCurrent(state.performance.min);\n // Go back to upper bound performance after a while unless something regresses meanwhile\n performanceTimeout = setTimeout(() => setPerformanceCurrent(get().performance.max), state.performance.debounce);\n }\n },\n size: {\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n updateStyle: false\n },\n viewport: {\n initialDpr: 0,\n dpr: 0,\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n aspect: 0,\n distance: 0,\n factor: 0,\n getCurrentViewport\n },\n setEvents: events => set(state => ({\n ...state,\n events: {\n ...state.events,\n ...events\n }\n })),\n setSize: (width, height, updateStyle, top, left) => {\n const camera = get().camera;\n const size = {\n width,\n height,\n top: top || 0,\n left: left || 0,\n updateStyle\n };\n set(state => ({\n size,\n viewport: {\n ...state.viewport,\n ...getCurrentViewport(camera, defaultTarget, size)\n }\n }));\n },\n setDpr: dpr => set(state => {\n const resolved = calculateDpr(dpr);\n return {\n viewport: {\n ...state.viewport,\n dpr: resolved,\n initialDpr: state.viewport.initialDpr || resolved\n }\n };\n }),\n setFrameloop: (frameloop = 'always') => {\n const clock = get().clock;\n\n // if frameloop === \"never\" clock.elapsedTime is updated using advance(timestamp)\n clock.stop();\n clock.elapsedTime = 0;\n if (frameloop !== 'never') {\n clock.start();\n clock.elapsedTime = 0;\n }\n set(() => ({\n frameloop\n }));\n },\n previousRoot: undefined,\n internal: {\n active: false,\n priority: 0,\n frames: 0,\n lastEvent: /*#__PURE__*/React.createRef(),\n interaction: [],\n hovered: new Map(),\n subscribers: [],\n initialClick: [0, 0],\n initialHits: [],\n capturedMap: new Map(),\n subscribe: (ref, priority, store) => {\n const internal = get().internal;\n // If this subscription was given a priority, it takes rendering into its own hands\n // For that reason we switch off automatic rendering and increase the manual flag\n // As long as this flag is positive there can be no internal rendering at all\n // because there could be multiple render subscriptions\n internal.priority = internal.priority + (priority > 0 ? 1 : 0);\n internal.subscribers.push({\n ref,\n priority,\n store\n });\n // Register subscriber and sort layers from lowest to highest, meaning,\n // highest priority renders last (on top of the other frames)\n internal.subscribers = internal.subscribers.sort((a, b) => a.priority - b.priority);\n return () => {\n const internal = get().internal;\n if (internal != null && internal.subscribers) {\n // Decrease manual flag if this subscription had a priority\n internal.priority = internal.priority - (priority > 0 ? 1 : 0);\n // Remove subscriber from list\n internal.subscribers = internal.subscribers.filter(s => s.ref !== ref);\n }\n };\n }\n }\n };\n return rootState;\n });\n const state = rootState.getState();\n let oldSize = state.size;\n let oldDpr = state.viewport.dpr;\n let oldCamera = state.camera;\n rootState.subscribe(() => {\n const {\n camera,\n size,\n viewport,\n gl,\n set\n } = rootState.getState();\n\n // Resize camera and renderer on changes to size and pixelratio\n if (size.width !== oldSize.width || size.height !== oldSize.height || viewport.dpr !== oldDpr) {\n var _size$updateStyle;\n oldSize = size;\n oldDpr = viewport.dpr;\n // Update camera & renderer\n updateCamera(camera, size);\n gl.setPixelRatio(viewport.dpr);\n const updateStyle = (_size$updateStyle = size.updateStyle) != null ? _size$updateStyle : typeof HTMLCanvasElement !== 'undefined' && gl.domElement instanceof HTMLCanvasElement;\n gl.setSize(size.width, size.height, updateStyle);\n }\n\n // Update viewport once the camera changes\n if (camera !== oldCamera) {\n oldCamera = camera;\n // Update viewport\n set(state => ({\n viewport: {\n ...state.viewport,\n ...state.viewport.getCurrentViewport(camera)\n }\n }));\n }\n });\n\n // Invalidate on any change\n rootState.subscribe(state => invalidate(state));\n\n // Return root state\n return rootState;\n};\n\nfunction createSubs(callback, subs) {\n const sub = {\n callback\n };\n subs.add(sub);\n return () => void subs.delete(sub);\n}\nlet i;\nlet globalEffects = new Set();\nlet globalAfterEffects = new Set();\nlet globalTailEffects = new Set();\n\n/**\r\n * Adds a global render callback which is called each frame.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect\r\n */\nconst addEffect = callback => createSubs(callback, globalEffects);\n\n/**\r\n * Adds a global after-render callback which is called each frame.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect\r\n */\nconst addAfterEffect = callback => createSubs(callback, globalAfterEffects);\n\n/**\r\n * Adds a global callback which is called when rendering stops.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail\r\n */\nconst addTail = callback => createSubs(callback, globalTailEffects);\nfunction run(effects, timestamp) {\n if (!effects.size) return;\n for (const {\n callback\n } of effects.values()) {\n callback(timestamp);\n }\n}\nfunction flushGlobalEffects(type, timestamp) {\n switch (type) {\n case 'before':\n return run(globalEffects, timestamp);\n case 'after':\n return run(globalAfterEffects, timestamp);\n case 'tail':\n return run(globalTailEffects, timestamp);\n }\n}\nlet subscribers;\nlet subscription;\nfunction render$1(timestamp, state, frame) {\n // Run local effects\n let delta = state.clock.getDelta();\n // In frameloop='never' mode, clock times are updated using the provided timestamp\n if (state.frameloop === 'never' && typeof timestamp === 'number') {\n delta = timestamp - state.clock.elapsedTime;\n state.clock.oldTime = state.clock.elapsedTime;\n state.clock.elapsedTime = timestamp;\n }\n // Call subscribers (useFrame)\n subscribers = state.internal.subscribers;\n for (i = 0; i < subscribers.length; i++) {\n subscription = subscribers[i];\n subscription.ref.current(subscription.store.getState(), delta, frame);\n }\n // Render content\n if (!state.internal.priority && state.gl.render) state.gl.render(state.scene, state.camera);\n // Decrease frame count\n state.internal.frames = Math.max(0, state.internal.frames - 1);\n return state.frameloop === 'always' ? 1 : state.internal.frames;\n}\nfunction createLoop(roots) {\n let running = false;\n let useFrameInProgress = false;\n let repeat;\n let frame;\n let state;\n function loop(timestamp) {\n frame = requestAnimationFrame(loop);\n running = true;\n repeat = 0;\n\n // Run effects\n flushGlobalEffects('before', timestamp);\n\n // Render all roots\n useFrameInProgress = true;\n for (const root of roots.values()) {\n var _state$gl$xr;\n state = root.store.getState();\n // If the frameloop is invalidated, do not run another frame\n if (state.internal.active && (state.frameloop === 'always' || state.internal.frames > 0) && !((_state$gl$xr = state.gl.xr) != null && _state$gl$xr.isPresenting)) {\n repeat += render$1(timestamp, state);\n }\n }\n useFrameInProgress = false;\n\n // Run after-effects\n flushGlobalEffects('after', timestamp);\n\n // Stop the loop if nothing invalidates it\n if (repeat === 0) {\n // Tail call effects, they are called when rendering stops\n flushGlobalEffects('tail', timestamp);\n\n // Flag end of operation\n running = false;\n return cancelAnimationFrame(frame);\n }\n }\n function invalidate(state, frames = 1) {\n var _state$gl$xr2;\n if (!state) return roots.forEach(root => invalidate(root.store.getState(), frames));\n if ((_state$gl$xr2 = state.gl.xr) != null && _state$gl$xr2.isPresenting || !state.internal.active || state.frameloop === 'never') return;\n if (frames > 1) {\n // legacy support for people using frames parameters\n // Increase frames, do not go higher than 60\n state.internal.frames = Math.min(60, state.internal.frames + frames);\n } else {\n if (useFrameInProgress) {\n //called from within a useFrame, it means the user wants an additional frame\n state.internal.frames = 2;\n } else {\n //the user need a new frame, no need to increment further than 1\n state.internal.frames = 1;\n }\n }\n\n // If the render-loop isn't active, start it\n if (!running) {\n running = true;\n requestAnimationFrame(loop);\n }\n }\n function advance(timestamp, runGlobalEffects = true, state, frame) {\n if (runGlobalEffects) flushGlobalEffects('before', timestamp);\n if (!state) for (const root of roots.values()) render$1(timestamp, root.store.getState());else render$1(timestamp, state, frame);\n if (runGlobalEffects) flushGlobalEffects('after', timestamp);\n }\n return {\n loop,\n invalidate,\n advance\n };\n}\n\n/**\r\n * Exposes an object's {@link LocalState}.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle\r\n *\r\n * **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.\r\n */\nfunction useInstanceHandle(ref) {\n const instance = React.useRef(null);\n useIsomorphicLayoutEffect(() => void (instance.current = ref.current.__r3f), [ref]);\n return instance;\n}\nfunction useStore() {\n const store = React.useContext(context);\n if (!store) throw new Error('R3F: Hooks can only be used within the Canvas component!');\n return store;\n}\n\n/**\r\n * Accesses R3F's internal state, containing renderer, canvas, scene, etc.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree\r\n */\nfunction useThree(selector = state => state, equalityFn) {\n return useStore()(selector, equalityFn);\n}\n\n/**\r\n * Executes a callback before render in a shared frame loop.\r\n * Can order effects with render priority or manually render with a positive priority.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe\r\n */\nfunction useFrame(callback, renderPriority = 0) {\n const store = useStore();\n const subscribe = store.getState().internal.subscribe;\n // Memoize ref\n const ref = useMutableCallback(callback);\n // Subscribe on mount, unsubscribe on unmount\n useIsomorphicLayoutEffect(() => subscribe(ref, renderPriority, store), [renderPriority, subscribe, store]);\n return null;\n}\n\n/**\r\n * Returns a node graph of an object with named nodes & materials.\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph\r\n */\nfunction useGraph(object) {\n return React.useMemo(() => buildGraph(object), [object]);\n}\nconst memoizedLoaders = new WeakMap();\nfunction loadingFn(extensions, onProgress) {\n return function (Proto, ...input) {\n // Construct new loader and run extensions\n let loader = memoizedLoaders.get(Proto);\n if (!loader) {\n loader = new Proto();\n memoizedLoaders.set(Proto, loader);\n }\n if (extensions) extensions(loader);\n // Go through the urls and load them\n return Promise.all(input.map(input => new Promise((res, reject) => loader.load(input, data => {\n if (data.scene) Object.assign(data, buildGraph(data.scene));\n res(data);\n }, onProgress, error => reject(new Error(`Could not load ${input}: ${error == null ? void 0 : error.message}`))))));\n };\n}\n/**\r\n * Synchronously loads and caches assets with a three loader.\r\n *\r\n * Note: this hook's caller must be wrapped with `React.Suspense`\r\n * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader\r\n */\nfunction useLoader(Proto, input, extensions, onProgress) {\n // Use suspense to load async assets\n const keys = Array.isArray(input) ? input : [input];\n const results = suspend(loadingFn(extensions, onProgress), [Proto, ...keys], {\n equal: is.equ\n });\n // Return the object/s\n return Array.isArray(input) ? results : results[0];\n}\n\n/**\r\n * Preloads an asset into cache as a side-effect.\r\n */\nuseLoader.preload = function (Proto, input, extensions) {\n const keys = Array.isArray(input) ? input : [input];\n return preload(loadingFn(extensions), [Proto, ...keys]);\n};\n\n/**\r\n * Removes a loaded asset from cache.\r\n */\nuseLoader.clear = function (Proto, input) {\n const keys = Array.isArray(input) ? input : [input];\n return clear([Proto, ...keys]);\n};\n\nconst roots = new Map();\nconst {\n invalidate,\n advance\n} = createLoop(roots);\nconst {\n reconciler,\n applyProps\n} = createRenderer(roots, getEventPriority);\nconst shallowLoose = {\n objects: 'shallow',\n strict: false\n};\nconst createRendererInstance = (gl, canvas) => {\n const customRenderer = typeof gl === 'function' ? gl(canvas) : gl;\n if (isRenderer(customRenderer)) return customRenderer;else return new THREE.WebGLRenderer({\n powerPreference: 'high-performance',\n canvas: canvas,\n antialias: true,\n alpha: true,\n ...gl\n });\n};\nfunction computeInitialSize(canvas, defaultSize) {\n const defaultStyle = typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement;\n if (defaultSize) {\n const {\n width,\n height,\n top,\n left,\n updateStyle = defaultStyle\n } = defaultSize;\n return {\n width,\n height,\n top,\n left,\n updateStyle\n };\n } else if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement && canvas.parentElement) {\n const {\n width,\n height,\n top,\n left\n } = canvas.parentElement.getBoundingClientRect();\n return {\n width,\n height,\n top,\n left,\n updateStyle: defaultStyle\n };\n } else if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {\n return {\n width: canvas.width,\n height: canvas.height,\n top: 0,\n left: 0,\n updateStyle: defaultStyle\n };\n }\n return {\n width: 0,\n height: 0,\n top: 0,\n left: 0\n };\n}\nfunction createRoot(canvas) {\n // Check against mistaken use of createRoot\n const prevRoot = roots.get(canvas);\n const prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;\n const prevStore = prevRoot == null ? void 0 : prevRoot.store;\n if (prevRoot) console.warn('R3F.createRoot should only be called once!');\n\n // Report when an error was detected in a previous render\n // https://github.com/pmndrs/react-three-fiber/pull/2261\n const logRecoverableError = typeof reportError === 'function' ?\n // In modern browsers, reportError will dispatch an error event,\n // emulating an uncaught JavaScript error.\n reportError :\n // In older browsers and test environments, fallback to console.error.\n console.error;\n\n // Create store\n const store = prevStore || createStore(invalidate, advance);\n // Create renderer\n const fiber = prevFiber || reconciler.createContainer(store, ConcurrentRoot, null, false, null, '', logRecoverableError, null);\n // Map it\n if (!prevRoot) roots.set(canvas, {\n fiber,\n store\n });\n\n // Locals\n let onCreated;\n let configured = false;\n let lastCamera;\n return {\n configure(props = {}) {\n let {\n gl: glConfig,\n size: propsSize,\n scene: sceneOptions,\n events,\n onCreated: onCreatedCallback,\n shadows = false,\n linear = false,\n flat = false,\n legacy = false,\n orthographic = false,\n frameloop = 'always',\n dpr = [1, 2],\n performance,\n raycaster: raycastOptions,\n camera: cameraOptions,\n onPointerMissed\n } = props;\n let state = store.getState();\n\n // Set up renderer (one time only!)\n let gl = state.gl;\n if (!state.gl) state.set({\n gl: gl = createRendererInstance(glConfig, canvas)\n });\n\n // Set up raycaster (one time only!)\n let raycaster = state.raycaster;\n if (!raycaster) state.set({\n raycaster: raycaster = new THREE.Raycaster()\n });\n\n // Set raycaster options\n const {\n params,\n ...options\n } = raycastOptions || {};\n if (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, {\n ...options\n });\n if (!is.equ(params, raycaster.params, shallowLoose)) applyProps(raycaster, {\n params: {\n ...raycaster.params,\n ...params\n }\n });\n\n // Create default camera, don't overwrite any user-set state\n if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {\n lastCamera = cameraOptions;\n const isCamera = cameraOptions instanceof THREE.Camera;\n const camera = isCamera ? cameraOptions : orthographic ? new THREE.OrthographicCamera(0, 0, 0, 0, 0.1, 1000) : new THREE.PerspectiveCamera(75, 0, 0.1, 1000);\n if (!isCamera) {\n camera.position.z = 5;\n if (cameraOptions) {\n applyProps(camera, cameraOptions);\n // Preserve user-defined frustum if possible\n // https://github.com/pmndrs/react-three-fiber/issues/3160\n if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {\n camera.manual = true;\n camera.updateProjectionMatrix();\n }\n }\n // Always look at center by default\n if (!state.camera && !(cameraOptions != null && cameraOptions.rotation)) camera.lookAt(0, 0, 0);\n }\n state.set({\n camera\n });\n\n // Configure raycaster\n // https://github.com/pmndrs/react-xr/issues/300\n raycaster.camera = camera;\n }\n\n // Set up scene (one time only!)\n if (!state.scene) {\n let scene;\n if (sceneOptions instanceof THREE.Scene) {\n scene = sceneOptions;\n } else {\n scene = new THREE.Scene();\n if (sceneOptions) applyProps(scene, sceneOptions);\n }\n state.set({\n scene: prepare(scene)\n });\n }\n\n // Set up XR (one time only!)\n if (!state.xr) {\n var _gl$xr;\n // Handle frame behavior in WebXR\n const handleXRFrame = (timestamp, frame) => {\n const state = store.getState();\n if (state.frameloop === 'never') return;\n advance(timestamp, true, state, frame);\n };\n\n // Toggle render switching on session\n const handleSessionChange = () => {\n const state = store.getState();\n state.gl.xr.enabled = state.gl.xr.isPresenting;\n state.gl.xr.setAnimationLoop(state.gl.xr.isPresenting ? handleXRFrame : null);\n if (!state.gl.xr.isPresenting) invalidate(state);\n };\n\n // WebXR session manager\n const xr = {\n connect() {\n const gl = store.getState().gl;\n gl.xr.addEventListener('sessionstart', handleSessionChange);\n gl.xr.addEventListener('sessionend', handleSessionChange);\n },\n disconnect() {\n const gl = store.getState().gl;\n gl.xr.removeEventListener('sessionstart', handleSessionChange);\n gl.xr.removeEventListener('sessionend', handleSessionChange);\n }\n };\n\n // Subscribe to WebXR session events\n if (typeof ((_gl$xr = gl.xr) == null ? void 0 : _gl$xr.addEventListener) === 'function') xr.connect();\n state.set({\n xr\n });\n }\n\n // Set shadowmap\n if (gl.shadowMap) {\n const oldEnabled = gl.shadowMap.enabled;\n const oldType = gl.shadowMap.type;\n gl.shadowMap.enabled = !!shadows;\n if (is.boo(shadows)) {\n gl.shadowMap.type = THREE.PCFSoftShadowMap;\n } else if (is.str(shadows)) {\n var _types$shadows;\n const types = {\n basic: THREE.BasicShadowMap,\n percentage: THREE.PCFShadowMap,\n soft: THREE.PCFSoftShadowMap,\n variance: THREE.VSMShadowMap\n };\n gl.shadowMap.type = (_types$shadows = types[shadows]) != null ? _types$shadows : THREE.PCFSoftShadowMap;\n } else if (is.obj(shadows)) {\n Object.assign(gl.shadowMap, shadows);\n }\n if (oldEnabled !== gl.shadowMap.enabled || oldType !== gl.shadowMap.type) gl.shadowMap.needsUpdate = true;\n }\n\n // Safely set color management if available.\n // Avoid accessing THREE.ColorManagement to play nice with older versions\n const ColorManagement = getColorManagement();\n if (ColorManagement) {\n if ('enabled' in ColorManagement) ColorManagement.enabled = !legacy;else if ('legacyMode' in ColorManagement) ColorManagement.legacyMode = legacy;\n }\n if (!configured) {\n // Set color space and tonemapping preferences, once\n const LinearEncoding = 3000;\n const sRGBEncoding = 3001;\n applyProps(gl, {\n outputEncoding: linear ? LinearEncoding : sRGBEncoding,\n toneMapping: flat ? THREE.NoToneMapping : THREE.ACESFilmicToneMapping\n });\n }\n\n // Update color management state\n if (state.legacy !== legacy) state.set(() => ({\n legacy\n }));\n if (state.linear !== linear) state.set(() => ({\n linear\n }));\n if (state.flat !== flat) state.set(() => ({\n flat\n }));\n\n // Set gl props\n if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, gl, shallowLoose)) applyProps(gl, glConfig);\n // Store events internally\n if (events && !state.events.handlers) state.set({\n events: events(store)\n });\n // Check size, allow it to take on container bounds initially\n const size = computeInitialSize(canvas, propsSize);\n if (!is.equ(size, state.size, shallowLoose)) {\n state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);\n }\n // Check pixelratio\n if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr);\n // Check frameloop\n if (state.frameloop !== frameloop) state.setFrameloop(frameloop);\n // Check pointer missed\n if (!state.onPointerMissed) state.set({\n onPointerMissed\n });\n // Check performance\n if (performance && !is.equ(performance, state.performance, shallowLoose)) state.set(state => ({\n performance: {\n ...state.performance,\n ...performance\n }\n }));\n\n // Set locals\n onCreated = onCreatedCallback;\n configured = true;\n return this;\n },\n render(children) {\n // The root has to be configured before it can be rendered\n if (!configured) this.configure();\n reconciler.updateContainer( /*#__PURE__*/jsx(Provider, {\n store: store,\n children: children,\n onCreated: onCreated,\n rootElement: canvas\n }), fiber, null, () => undefined);\n return store;\n },\n unmount() {\n unmountComponentAtNode(canvas);\n }\n };\n}\nfunction render(children, canvas, config) {\n console.warn('R3F.render is no longer supported in React 18. Use createRoot instead!');\n const root = createRoot(canvas);\n root.configure(config);\n return root.render(children);\n}\nfunction Provider({\n store,\n children,\n onCreated,\n rootElement\n}) {\n useIsomorphicLayoutEffect(() => {\n const state = store.getState();\n // Flag the canvas active, rendering will now begin\n state.set(state => ({\n internal: {\n ...state.internal,\n active: true\n }\n }));\n // Notifiy that init is completed, the scene graph exists, but nothing has yet rendered\n if (onCreated) onCreated(state);\n // Connect events to the targets parent, this is done to ensure events are registered on\n // a shared target, and not on the canvas itself\n if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return /*#__PURE__*/jsx(context.Provider, {\n value: store,\n children: children\n });\n}\nfunction unmountComponentAtNode(canvas, callback) {\n const root = roots.get(canvas);\n const fiber = root == null ? void 0 : root.fiber;\n if (fiber) {\n const state = root == null ? void 0 : root.store.getState();\n if (state) state.internal.active = false;\n reconciler.updateContainer(null, fiber, null, () => {\n if (state) {\n setTimeout(() => {\n try {\n var _state$gl, _state$gl$renderLists, _state$gl2, _state$gl3;\n state.events.disconnect == null ? void 0 : state.events.disconnect();\n (_state$gl = state.gl) == null ? void 0 : (_state$gl$renderLists = _state$gl.renderLists) == null ? void 0 : _state$gl$renderLists.dispose == null ? void 0 : _state$gl$renderLists.dispose();\n (_state$gl2 = state.gl) == null ? void 0 : _state$gl2.forceContextLoss == null ? void 0 : _state$gl2.forceContextLoss();\n if ((_state$gl3 = state.gl) != null && _state$gl3.xr) state.xr.disconnect();\n dispose(state);\n roots.delete(canvas);\n if (callback) callback(canvas);\n } catch (e) {\n /* ... */\n }\n }, 500);\n }\n });\n }\n}\nfunction createPortal(children, container, state) {\n return /*#__PURE__*/jsx(Portal, {\n children: children,\n container: container,\n state: state\n }, container.uuid);\n}\nfunction Portal({\n state = {},\n children,\n container\n}) {\n /** This has to be a component because it would not be able to call useThree/useStore otherwise since\r\n * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger\r\n * the \"R3F hooks can only be used within the Canvas component!\" warning:\r\n * \r\n * {createPortal(...)} */\n const {\n events,\n size,\n ...rest\n } = state;\n const previousRoot = useStore();\n const [raycaster] = React.useState(() => new THREE.Raycaster());\n const [pointer] = React.useState(() => new THREE.Vector2());\n const inject = React.useCallback((rootState, injectState) => {\n const intersect = {\n ...rootState\n }; // all prev state props\n\n // Only the fields of \"rootState\" that do not differ from injectState\n // Some props should be off-limits\n // Otherwise filter out the props that are different and let the inject layer take precedence\n Object.keys(rootState).forEach(key => {\n if (\n // Some props should be off-limits\n privateKeys.includes(key) ||\n // Otherwise filter out the props that are different and let the inject layer take precedence\n // Unless the inject layer props is undefined, then we keep the root layer\n rootState[key] !== injectState[key] && injectState[key]) {\n delete intersect[key];\n }\n });\n let viewport = undefined;\n if (injectState && size) {\n const camera = injectState.camera;\n // Calculate the override viewport, if present\n viewport = rootState.viewport.getCurrentViewport(camera, new THREE.Vector3(), size);\n // Update the portal camera, if it differs from the previous layer\n if (camera !== rootState.camera) updateCamera(camera, size);\n }\n return {\n // The intersect consists of the previous root state\n ...intersect,\n // Portals have their own scene, which forms the root, a raycaster and a pointer\n scene: container,\n raycaster,\n pointer,\n mouse: pointer,\n // Their previous root is the layer before it\n previousRoot,\n // Events, size and viewport can be overridden by the inject layer\n events: {\n ...rootState.events,\n ...(injectState == null ? void 0 : injectState.events),\n ...events\n },\n size: {\n ...rootState.size,\n ...size\n },\n viewport: {\n ...rootState.viewport,\n ...viewport\n },\n ...rest\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [state]);\n const [usePortalStore] = React.useState(() => {\n // Create a mirrored store, based on the previous root with a few overrides ...\n const previousState = previousRoot.getState();\n const store = create((set, get) => ({\n ...previousState,\n scene: container,\n raycaster,\n pointer,\n mouse: pointer,\n previousRoot,\n events: {\n ...previousState.events,\n ...events\n },\n size: {\n ...previousState.size,\n ...size\n },\n ...rest,\n // Set and get refer to this root-state\n set,\n get,\n // Layers are allowed to override events\n setEvents: events => set(state => ({\n ...state,\n events: {\n ...state.events,\n ...events\n }\n }))\n }));\n return store;\n });\n React.useEffect(() => {\n // Subscribe to previous root-state and copy changes over to the mirrored portal-state\n const unsub = previousRoot.subscribe(prev => usePortalStore.setState(state => inject(prev, state)));\n return () => {\n unsub();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inject]);\n React.useEffect(() => {\n usePortalStore.setState(injectState => inject(previousRoot.getState(), injectState));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inject]);\n React.useEffect(() => {\n return () => {\n usePortalStore.destroy();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return /*#__PURE__*/jsx(Fragment, {\n children: reconciler.createPortal( /*#__PURE__*/jsx(context.Provider, {\n value: usePortalStore,\n children: children\n }), usePortalStore, null)\n });\n}\nreconciler.injectIntoDevTools({\n bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,\n rendererPackageName: '@react-three/fiber',\n version: React.version\n});\nconst act = React.unstable_act;\n\nexport { useThree as A, Block as B, useFrame as C, useGraph as D, ErrorBoundary as E, useLoader as F, useIsomorphicLayoutEffect as a, createRoot as b, createEvents as c, unmountComponentAtNode as d, extend as e, context as f, createPortal as g, reconciler as h, isRef as i, applyProps as j, dispose as k, invalidate as l, advance as m, addEffect as n, addAfterEffect as o, addTail as p, flushGlobalEffects as q, render as r, getRootState as s, threeTypes as t, useMutableCallback as u, act as v, buildGraph as w, roots as x, useInstanceHandle as y, useStore as z };\n", "import { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect } from 'react';\n\nfunction createStore(createState) {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (nextState !== state) {\n const previousState = state;\n state = replace ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const subscribeWithSelector = (listener, selector = getState, equalityFn = Object.is) => {\n console.warn(\"[DEPRECATED] Please use `subscribeWithSelector` middleware\");\n let currentSlice = selector(state);\n function listenerToAdd() {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n listener(currentSlice = nextSlice, previousSlice);\n }\n }\n listeners.add(listenerToAdd);\n return () => listeners.delete(listenerToAdd);\n };\n const subscribe = (listener, selector, equalityFn) => {\n if (selector || equalityFn) {\n return subscribeWithSelector(listener, selector, equalityFn);\n }\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => listeners.clear();\n const api = { setState, getState, subscribe, destroy };\n state = createState(setState, getState, api);\n return api;\n}\n\nconst isSSR = typeof window === \"undefined\" || !window.navigator || /ServerSideRendering|^Deno\\//.test(window.navigator.userAgent);\nconst useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;\nfunction create(createState) {\n const api = typeof createState === \"function\" ? createStore(createState) : createState;\n const useStore = (selector = api.getState, equalityFn = Object.is) => {\n const [, forceUpdate] = useReducer((c) => c + 1, 0);\n const state = api.getState();\n const stateRef = useRef(state);\n const selectorRef = useRef(selector);\n const equalityFnRef = useRef(equalityFn);\n const erroredRef = useRef(false);\n const currentSliceRef = useRef();\n if (currentSliceRef.current === void 0) {\n currentSliceRef.current = selector(state);\n }\n let newStateSlice;\n let hasNewStateSlice = false;\n if (stateRef.current !== state || selectorRef.current !== selector || equalityFnRef.current !== equalityFn || erroredRef.current) {\n newStateSlice = selector(state);\n hasNewStateSlice = !equalityFn(currentSliceRef.current, newStateSlice);\n }\n useIsomorphicLayoutEffect(() => {\n if (hasNewStateSlice) {\n currentSliceRef.current = newStateSlice;\n }\n stateRef.current = state;\n selectorRef.current = selector;\n equalityFnRef.current = equalityFn;\n erroredRef.current = false;\n });\n const stateBeforeSubscriptionRef = useRef(state);\n useIsomorphicLayoutEffect(() => {\n const listener = () => {\n try {\n const nextState = api.getState();\n const nextStateSlice = selectorRef.current(nextState);\n if (!equalityFnRef.current(currentSliceRef.current, nextStateSlice)) {\n stateRef.current = nextState;\n currentSliceRef.current = nextStateSlice;\n forceUpdate();\n }\n } catch (error) {\n erroredRef.current = true;\n forceUpdate();\n }\n };\n const unsubscribe = api.subscribe(listener);\n if (api.getState() !== stateBeforeSubscriptionRef.current) {\n listener();\n }\n return unsubscribe;\n }, []);\n const sliceToReturn = hasNewStateSlice ? newStateSlice : currentSliceRef.current;\n useDebugValue(sliceToReturn);\n return sliceToReturn;\n };\n Object.assign(useStore, api);\n useStore[Symbol.iterator] = function() {\n console.warn(\"[useStore, api] = create() is deprecated and will be removed in v4\");\n const items = [useStore, api];\n return {\n next() {\n const done = items.length <= 0;\n return { value: items.shift(), done };\n }\n };\n };\n return useStore;\n}\n\nexport { create as default };\n", "const isPromise = promise => typeof promise === 'object' && typeof promise.then === 'function';\n\nconst globalCache = [];\n\nfunction shallowEqualArrays(arrA, arrB, equal = (a, b) => a === b) {\n if (arrA === arrB) return true;\n if (!arrA || !arrB) return false;\n const len = arrA.length;\n if (arrB.length !== len) return false;\n\n for (let i = 0; i < len; i++) if (!equal(arrA[i], arrB[i])) return false;\n\n return true;\n}\n\nfunction query(fn, keys = null, preload = false, config = {}) {\n // If no keys were given, the function is the key\n if (keys === null) keys = [fn];\n\n for (const entry of globalCache) {\n // Find a match\n if (shallowEqualArrays(keys, entry.keys, entry.equal)) {\n // If we're pre-loading and the element is present, just return\n if (preload) return undefined; // If an error occurred, throw\n\n if (Object.prototype.hasOwnProperty.call(entry, 'error')) throw entry.error; // If a response was successful, return\n\n if (Object.prototype.hasOwnProperty.call(entry, 'response')) {\n if (config.lifespan && config.lifespan > 0) {\n if (entry.timeout) clearTimeout(entry.timeout);\n entry.timeout = setTimeout(entry.remove, config.lifespan);\n }\n\n return entry.response;\n } // If the promise is still unresolved, throw\n\n\n if (!preload) throw entry.promise;\n }\n } // The request is new or has changed.\n\n\n const entry = {\n keys,\n equal: config.equal,\n remove: () => {\n const index = globalCache.indexOf(entry);\n if (index !== -1) globalCache.splice(index, 1);\n },\n promise: // Execute the promise\n (isPromise(fn) ? fn : fn(...keys) // When it resolves, store its value\n ).then(response => {\n entry.response = response; // Remove the entry in time if a lifespan was given\n\n if (config.lifespan && config.lifespan > 0) {\n entry.timeout = setTimeout(entry.remove, config.lifespan);\n }\n }) // Store caught errors, they will be thrown in the render-phase to bubble into an error-bound\n .catch(error => entry.error = error)\n }; // Register the entry\n\n globalCache.push(entry); // And throw the promise, this yields control back to React\n\n if (!preload) throw entry.promise;\n return undefined;\n}\n\nconst suspend = (fn, keys, config) => query(fn, keys, false, config);\n\nconst preload = (fn, keys, config) => void query(fn, keys, true, config);\n\nconst peek = keys => {\n var _globalCache$find;\n\n return (_globalCache$find = globalCache.find(entry => shallowEqualArrays(keys, entry.keys, entry.equal))) == null ? void 0 : _globalCache$find.response;\n};\n\nconst clear = keys => {\n if (keys === undefined || keys.length === 0) globalCache.splice(0, globalCache.length);else {\n const entry = globalCache.find(entry => shallowEqualArrays(keys, entry.keys, entry.equal));\n if (entry) entry.remove();\n }\n};\n\nexport { clear, peek, preload, suspend };\n", "import { useState, useRef, useEffect, useMemo } from 'react';\nimport createDebounce from 'debounce';\n\nfunction useMeasure(_temp) {\n let {\n debounce,\n scroll,\n polyfill,\n offsetSize\n } = _temp === void 0 ? {\n debounce: 0,\n scroll: false,\n offsetSize: false\n } : _temp;\n const ResizeObserver = polyfill || (typeof window === 'undefined' ? class ResizeObserver {} : window.ResizeObserver);\n\n if (!ResizeObserver) {\n throw new Error('This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills');\n }\n\n const [bounds, set] = useState({\n left: 0,\n top: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n x: 0,\n y: 0\n }); // keep all state in a ref\n\n const state = useRef({\n element: null,\n scrollContainers: null,\n resizeObserver: null,\n lastBounds: bounds\n }); // set actual debounce values early, so effects know if they should react accordingly\n\n const scrollDebounce = debounce ? typeof debounce === 'number' ? debounce : debounce.scroll : null;\n const resizeDebounce = debounce ? typeof debounce === 'number' ? debounce : debounce.resize : null; // make sure to update state only as long as the component is truly mounted\n\n const mounted = useRef(false);\n useEffect(() => {\n mounted.current = true;\n return () => void (mounted.current = false);\n }); // memoize handlers, so event-listeners know when they should update\n\n const [forceRefresh, resizeChange, scrollChange] = useMemo(() => {\n const callback = () => {\n if (!state.current.element) return;\n const {\n left,\n top,\n width,\n height,\n bottom,\n right,\n x,\n y\n } = state.current.element.getBoundingClientRect();\n const size = {\n left,\n top,\n width,\n height,\n bottom,\n right,\n x,\n y\n };\n\n if (state.current.element instanceof HTMLElement && offsetSize) {\n size.height = state.current.element.offsetHeight;\n size.width = state.current.element.offsetWidth;\n }\n\n Object.freeze(size);\n if (mounted.current && !areBoundsEqual(state.current.lastBounds, size)) set(state.current.lastBounds = size);\n };\n\n return [callback, resizeDebounce ? createDebounce(callback, resizeDebounce) : callback, scrollDebounce ? createDebounce(callback, scrollDebounce) : callback];\n }, [set, offsetSize, scrollDebounce, resizeDebounce]); // cleanup current scroll-listeners / observers\n\n function removeListeners() {\n if (state.current.scrollContainers) {\n state.current.scrollContainers.forEach(element => element.removeEventListener('scroll', scrollChange, true));\n state.current.scrollContainers = null;\n }\n\n if (state.current.resizeObserver) {\n state.current.resizeObserver.disconnect();\n state.current.resizeObserver = null;\n }\n } // add scroll-listeners / observers\n\n\n function addListeners() {\n if (!state.current.element) return;\n state.current.resizeObserver = new ResizeObserver(scrollChange);\n state.current.resizeObserver.observe(state.current.element);\n\n if (scroll && state.current.scrollContainers) {\n state.current.scrollContainers.forEach(scrollContainer => scrollContainer.addEventListener('scroll', scrollChange, {\n capture: true,\n passive: true\n }));\n }\n } // the ref we expose to the user\n\n\n const ref = node => {\n if (!node || node === state.current.element) return;\n removeListeners();\n state.current.element = node;\n state.current.scrollContainers = findScrollContainers(node);\n addListeners();\n }; // add general event listeners\n\n\n useOnWindowScroll(scrollChange, Boolean(scroll));\n useOnWindowResize(resizeChange); // respond to changes that are relevant for the listeners\n\n useEffect(() => {\n removeListeners();\n addListeners();\n }, [scroll, scrollChange, resizeChange]); // remove all listeners when the components unmounts\n\n useEffect(() => removeListeners, []);\n return [ref, bounds, forceRefresh];\n} // Adds native resize listener to window\n\n\nfunction useOnWindowResize(onWindowResize) {\n useEffect(() => {\n const cb = onWindowResize;\n window.addEventListener('resize', cb);\n return () => void window.removeEventListener('resize', cb);\n }, [onWindowResize]);\n}\n\nfunction useOnWindowScroll(onScroll, enabled) {\n useEffect(() => {\n if (enabled) {\n const cb = onScroll;\n window.addEventListener('scroll', cb, {\n capture: true,\n passive: true\n });\n return () => void window.removeEventListener('scroll', cb, true);\n }\n }, [onScroll, enabled]);\n} // Returns a list of scroll offsets\n\n\nfunction findScrollContainers(element) {\n const result = [];\n if (!element || element === document.body) return result;\n const {\n overflow,\n overflowX,\n overflowY\n } = window.getComputedStyle(element);\n if ([overflow, overflowX, overflowY].some(prop => prop === 'auto' || prop === 'scroll')) result.push(element);\n return [...result, ...findScrollContainers(element.parentElement)];\n} // Checks if element boundaries are equal\n\n\nconst keys = ['x', 'y', 'top', 'bottom', 'left', 'right', 'width', 'height'];\n\nconst areBoundsEqual = (a, b) => keys.every(key => a[key] === b[key]);\n\nexport { useMeasure as default };\n", "import * as React from 'react'\nimport type ReactReconciler from 'react-reconciler'\n\n/**\n * Represents a react-internal Fiber node.\n */\nexport type Fiber = Omit & { stateNode: T }\n\n/**\n * Represents a {@link Fiber} node selector for traversal.\n */\nexport type FiberSelector = (\n /** The current {@link Fiber} node. */\n node: Fiber,\n) => boolean | void\n\n/**\n * Traverses up or down a {@link Fiber}, return `true` to stop and select a node.\n */\nexport function traverseFiber(\n /** Input {@link Fiber} to traverse. */\n fiber: Fiber | undefined,\n /** Whether to ascend and walk up the tree. Will walk down if `false`. */\n ascending: boolean,\n /** A {@link Fiber} node selector, returns the first match when `true` is passed. */\n selector: FiberSelector,\n): Fiber | undefined {\n if (!fiber) return\n if (selector(fiber) === true) return fiber\n\n let child = ascending ? fiber.return : fiber.child\n while (child) {\n const match = traverseFiber(child, ascending, selector)\n if (match) return match\n\n child = ascending ? null : child.sibling\n }\n}\n\n// In development, React will warn about using contexts between renderers.\n// Hide the warning because its-fine fixes this issue\n// https://github.com/facebook/react/pull/12779\nfunction wrapContext(context: React.Context): React.Context {\n try {\n return Object.defineProperties(context, {\n _currentRenderer: {\n get() {\n return null\n },\n set() {},\n },\n _currentRenderer2: {\n get() {\n return null\n },\n set() {},\n },\n })\n } catch (_) {\n return context\n }\n}\n\nconst FiberContext = wrapContext(React.createContext(null!))\n\n/**\n * A react-internal {@link Fiber} provider. This component binds React children to the React Fiber tree. Call its-fine hooks within this.\n */\nexport class FiberProvider extends React.Component<{ children?: React.ReactNode }> {\n private _reactInternals!: Fiber\n\n render() {\n return {this.props.children}\n }\n}\n\ninterface ReactInternal {\n __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {\n ReactCurrentOwner: React.RefObject\n ReactCurrentDispatcher: React.RefObject<{ readContext(context: React.Context): T }>\n }\n}\n\nconst { ReactCurrentOwner, ReactCurrentDispatcher } = (React as unknown as ReactInternal)\n .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n\n/**\n * Returns the current react-internal {@link Fiber}. This is an implementation detail of [react-reconciler](https://github.com/facebook/react/tree/main/packages/react-reconciler).\n */\nexport function useFiber(): Fiber | undefined {\n const root = React.useContext(FiberContext)\n if (root === null) throw new Error('its-fine: useFiber must be called within a !')\n\n // In development mode, React will expose the current component's Fiber as ReactCurrentOwner.\n // In production, we don't have this luxury and must traverse from FiberProvider via useId\n const id = React.useId()\n const fiber = React.useMemo(() => {\n for (const maybeFiber of [ReactCurrentOwner?.current, root, root?.alternate]) {\n if (!maybeFiber) continue\n const fiber = traverseFiber(maybeFiber, false, (node) => {\n let state = node.memoizedState\n while (state) {\n if (state.memoizedState === id) return true\n state = state.next\n }\n })\n if (fiber) return fiber\n }\n }, [root, id])\n\n return fiber\n}\n\n/**\n * Represents a react-reconciler container instance.\n */\nexport interface ContainerInstance {\n containerInfo: T\n}\n\n/**\n * Returns the current react-reconciler container info passed to {@link ReactReconciler.Reconciler.createContainer}.\n *\n * In react-dom, a container will point to the root DOM element; in react-three-fiber, it will point to the root Zustand store.\n */\nexport function useContainer(): T | undefined {\n const fiber = useFiber()\n const root = React.useMemo(\n () => traverseFiber>(fiber, true, (node) => node.stateNode?.containerInfo != null),\n [fiber],\n )\n\n return root?.stateNode.containerInfo\n}\n\n/**\n * Returns the nearest react-reconciler child instance or the node created from {@link ReactReconciler.HostConfig.createInstance}.\n *\n * In react-dom, this would be a DOM element; in react-three-fiber this would be an instance descriptor.\n */\nexport function useNearestChild(\n /** An optional element type to filter to. */\n type?: keyof JSX.IntrinsicElements,\n): React.MutableRefObject {\n const fiber = useFiber()\n const childRef = React.useRef()\n\n React.useLayoutEffect(() => {\n childRef.current = traverseFiber(\n fiber,\n false,\n (node) => typeof node.type === 'string' && (type === undefined || node.type === type),\n )?.stateNode\n }, [fiber])\n\n return childRef\n}\n\n/**\n * Returns the nearest react-reconciler parent instance or the node created from {@link ReactReconciler.HostConfig.createInstance}.\n *\n * In react-dom, this would be a DOM element; in react-three-fiber this would be an instance descriptor.\n */\nexport function useNearestParent(\n /** An optional element type to filter to. */\n type?: keyof JSX.IntrinsicElements,\n): React.MutableRefObject {\n const fiber = useFiber()\n const parentRef = React.useRef()\n\n React.useLayoutEffect(() => {\n parentRef.current = traverseFiber(\n fiber,\n true,\n (node) => typeof node.type === 'string' && (type === undefined || node.type === type),\n )?.stateNode\n }, [fiber])\n\n return parentRef\n}\n\nexport type ContextMap = Map, any> & {\n get(context: React.Context): T | undefined\n}\n\n/**\n * Returns a map of all contexts and their values.\n */\nexport function useContextMap(): ContextMap {\n const fiber = useFiber()\n const [contextMap] = React.useState(() => new Map, any>())\n\n // Collect live context\n contextMap.clear()\n let node = fiber\n while (node) {\n const context = node.type?._context\n if (context && context !== FiberContext && !contextMap.has(context)) {\n contextMap.set(context, ReactCurrentDispatcher?.current?.readContext(wrapContext(context)))\n }\n node = node.return!\n }\n\n return contextMap\n}\n\n/**\n * Represents a react-context bridge provider component.\n */\nexport type ContextBridge = React.FC>\n\n/**\n * React Context currently cannot be shared across [React renderers](https://reactjs.org/docs/codebase-overview.html#renderers) but explicitly forwarded between providers (see [react#17275](https://github.com/facebook/react/issues/17275)). This hook returns a {@link ContextBridge} of live context providers to pierce Context across renderers.\n *\n * Pass {@link ContextBridge} as a component to a secondary renderer to enable context-sharing within its children.\n */\nexport function useContextBridge(): ContextBridge {\n const contextMap = useContextMap()\n\n // Flatten context and their memoized values into a `ContextBridge` provider\n return React.useMemo(\n () =>\n Array.from(contextMap.keys()).reduce(\n (Prev, context) => (props) =>\n (\n \n \n \n ),\n (props) => ,\n ),\n [contextMap],\n )\n}\n", "import { MD2CharacterComplex } from \"./misc/MD2CharacterComplex.js\";\nimport { ConvexObjectBreaker } from \"./misc/ConvexObjectBreaker.js\";\nimport { MorphBlendMesh } from \"./misc/MorphBlendMesh.js\";\nimport { GPUComputationRenderer } from \"./misc/GPUComputationRenderer.js\";\nimport { Gyroscope } from \"./misc/Gyroscope.js\";\nimport { MorphAnimMesh } from \"./misc/MorphAnimMesh.js\";\nimport { RollerCoasterGeometry, RollerCoasterLiftersGeometry, RollerCoasterShadowGeometry, SkyGeometry, TreesGeometry } from \"./misc/RollerCoaster.js\";\nimport { Timer } from \"./misc/Timer.js\";\nimport { getErrorMessage, getWebGL2ErrorMessage, getWebGLErrorMessage, isWebGL2Available, isWebGLAvailable } from \"./misc/WebGL.js\";\nimport { MD2Character } from \"./misc/MD2Character.js\";\nimport { VolumeSlice } from \"./misc/VolumeSlice.js\";\nimport { TubePainter } from \"./misc/TubePainter.js\";\nimport { Volume } from \"./misc/Volume.js\";\nimport { ProgressiveLightMap } from \"./misc/ProgressiveLightmap.js\";\nimport { CSS2DObject, CSS2DRenderer } from \"./renderers/CSS2DRenderer.js\";\nimport { CSS3DObject, CSS3DRenderer, CSS3DSprite } from \"./renderers/CSS3DRenderer.js\";\nimport { Projector, RenderableFace, RenderableLine, RenderableObject, RenderableSprite, RenderableVertex } from \"./renderers/Projector.js\";\nimport { SVGObject, SVGRenderer } from \"./renderers/SVGRenderer.js\";\nimport { FlakesTexture } from \"./textures/FlakesTexture.js\";\nimport { Flow, InstancedFlow, getUniforms, initSplineTexture, modifyShader, updateSplineTexture } from \"./modifiers/CurveModifier.js\";\nimport { SimplifyModifier } from \"./modifiers/SimplifyModifier.js\";\nimport { EdgeSplitModifier } from \"./modifiers/EdgeSplitModifier.js\";\nimport { TessellateModifier } from \"./modifiers/TessellateModifier.js\";\nimport { GLTFExporter } from \"./exporters/GLTFExporter.js\";\nimport { USDZExporter } from \"./exporters/USDZExporter.js\";\nimport { PLYExporter } from \"./exporters/PLYExporter.js\";\nimport { DRACOExporter } from \"./exporters/DRACOExporter.js\";\nimport { ColladaExporter } from \"./exporters/ColladaExporter.js\";\nimport { MMDExporter } from \"./exporters/MMDExporter.js\";\nimport { STLExporter } from \"./exporters/STLExporter.js\";\nimport { OBJExporter } from \"./exporters/OBJExporter.js\";\nimport { RoomEnvironment } from \"./environments/RoomEnvironment.js\";\nimport { AnimationClipCreator } from \"./animation/AnimationClipCreator.js\";\nimport { CCDIKHelper, CCDIKSolver } from \"./animation/CCDIKSolver.js\";\nimport { MMDPhysics } from \"./animation/MMDPhysics.js\";\nimport { MMDAnimationHelper } from \"./animation/MMDAnimationHelper.js\";\nimport { BatchedMesh } from \"./objects/BatchedMesh.js\";\nimport { Reflector } from \"./objects/Reflector.js\";\nimport { Refractor } from \"./objects/Refractor.js\";\nimport { ShadowMesh } from \"./objects/ShadowMesh.js\";\nimport { Lensflare, LensflareElement } from \"./objects/Lensflare.js\";\nimport { Water } from \"./objects/Water.js\";\nimport { MarchingCubes, edgeTable, triTable } from \"./objects/MarchingCubes.js\";\nimport { LightningStorm } from \"./objects/LightningStorm.js\";\nimport { ReflectorRTT } from \"./objects/ReflectorRTT.js\";\nimport { ReflectorForSSRPass } from \"./objects/ReflectorForSSRPass.js\";\nimport { Sky } from \"./objects/Sky.js\";\nimport { Water2 } from \"./objects/Water2.js\";\nimport { GroundProjectedEnv } from \"./objects/GroundProjectedEnv.js\";\nimport { SceneUtils } from \"./utils/SceneUtils.js\";\nimport { UVsDebug } from \"./utils/UVsDebug.js\";\nimport { GeometryUtils } from \"./utils/GeometryUtils.js\";\nimport { RoughnessMipmapper } from \"./utils/RoughnessMipmapper.js\";\nimport { SkeletonUtils } from \"./utils/SkeletonUtils.js\";\nimport { ShadowMapViewer } from \"./utils/ShadowMapViewer.js\";\nimport { computeMorphedAttributes, estimateBytesUsed, interleaveAttributes, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, toCreasedNormals, toTrianglesDrawMode } from \"./utils/BufferGeometryUtils.js\";\nimport { GeometryCompressionUtils, PackedPhongMaterial } from \"./utils/GeometryCompressionUtils.js\";\nimport { CinematicCamera } from \"./cameras/CinematicCamera.js\";\nimport { ConvexHull, Face, HalfEdge, VertexList, VertexNode } from \"./math/ConvexHull.js\";\nimport { MeshSurfaceSampler } from \"./math/MeshSurfaceSampler.js\";\nimport { SimplexNoise } from \"./math/SimplexNoise.js\";\nimport { OBB } from \"./math/OBB.js\";\nimport { Capsule } from \"./math/Capsule.js\";\nimport { ColorConverter } from \"./math/ColorConverter.js\";\nimport { ImprovedNoise } from \"./math/ImprovedNoise.js\";\nimport { Octree } from \"./math/Octree.js\";\nimport { ColorMapKeywords, Lut } from \"./math/Lut.js\";\nimport { CameraControls, MapControlsExp, OrbitControlsExp, STATE, TrackballControlsExp } from \"./controls/experimental/CameraControls.js\";\nimport { FirstPersonControls } from \"./controls/FirstPersonControls.js\";\nimport { TransformControls, TransformControlsGizmo, TransformControlsPlane } from \"./controls/TransformControls.js\";\nimport { DragControls } from \"./controls/DragControls.js\";\nimport { PointerLockControls } from \"./controls/PointerLockControls.js\";\nimport { DeviceOrientationControls } from \"./controls/DeviceOrientationControls.js\";\nimport { TrackballControls } from \"./controls/TrackballControls.js\";\nimport { MapControls, OrbitControls } from \"./controls/OrbitControls.js\";\nimport { ArcballControls } from \"./controls/ArcballControls.js\";\nimport { FlyControls } from \"./controls/FlyControls.js\";\nimport { LUTPass } from \"./postprocessing/LUTPass.js\";\nimport { ClearPass } from \"./postprocessing/ClearPass.js\";\nimport { GlitchPass } from \"./postprocessing/GlitchPass.js\";\nimport { HalftonePass } from \"./postprocessing/HalftonePass.js\";\nimport { SMAAPass } from \"./postprocessing/SMAAPass.js\";\nimport { FilmPass } from \"./postprocessing/FilmPass.js\";\nimport { OutlinePass } from \"./postprocessing/OutlinePass.js\";\nimport { SSAOPass } from \"./postprocessing/SSAOPass.js\";\nimport { SavePass } from \"./postprocessing/SavePass.js\";\nimport { BokehPass } from \"./postprocessing/BokehPass.js\";\nimport { FullScreenQuad, Pass } from \"./postprocessing/Pass.js\";\nimport { TexturePass } from \"./postprocessing/TexturePass.js\";\nimport { AdaptiveToneMappingPass } from \"./postprocessing/AdaptiveToneMappingPass.js\";\nimport { UnrealBloomPass } from \"./postprocessing/UnrealBloomPass.js\";\nimport { CubeTexturePass } from \"./postprocessing/CubeTexturePass.js\";\nimport { SAOPass } from \"./postprocessing/SAOPass.js\";\nimport { AfterimagePass } from \"./postprocessing/AfterimagePass.js\";\nimport { ClearMaskPass, MaskPass } from \"./postprocessing/MaskPass.js\";\nimport { EffectComposer } from \"./postprocessing/EffectComposer.js\";\nimport { DotScreenPass } from \"./postprocessing/DotScreenPass.js\";\nimport { SSRPass } from \"./postprocessing/SSRPass.js\";\nimport { TAARenderPass } from \"./postprocessing/TAARenderPass.js\";\nimport { ShaderPass } from \"./postprocessing/ShaderPass.js\";\nimport { SSAARenderPass } from \"./postprocessing/SSAARenderPass.js\";\nimport { RenderPass } from \"./postprocessing/RenderPass.js\";\nimport { RenderPixelatedPass } from \"./postprocessing/RenderPixelatedPass.js\";\nimport { BloomPass } from \"./postprocessing/BloomPass.js\";\nimport { WaterPass } from \"./postprocessing/WaterPass.js\";\nimport { ARButton } from \"./webxr/ARButton.js\";\nimport { OculusHandModel } from \"./webxr/OculusHandModel.js\";\nimport { OculusHandPointerModel } from \"./webxr/OculusHandPointerModel.js\";\nimport { createText } from \"./webxr/Text2D.js\";\nimport { VRButton } from \"./webxr/VRButton.js\";\nimport { XRControllerModelFactory } from \"./webxr/XRControllerModelFactory.js\";\nimport { XREstimatedLight } from \"./webxr/XREstimatedLight.js\";\nimport { XRHandMeshModel } from \"./webxr/XRHandMeshModel.js\";\nimport { XRHandModelFactory } from \"./webxr/XRHandModelFactory.js\";\nimport { XRHandPrimitiveModel } from \"./webxr/XRHandPrimitiveModel.js\";\nimport { ParametricGeometries } from \"./geometries/ParametricGeometries.js\";\nimport { ParametricGeometry } from \"./geometries/ParametricGeometry.js\";\nimport { ConvexGeometry } from \"./geometries/ConvexGeometry.js\";\nimport { LightningStrike } from \"./geometries/LightningStrike.js\";\nimport { RoundedBoxGeometry } from \"./geometries/RoundedBoxGeometry.js\";\nimport { BoxLineGeometry } from \"./geometries/BoxLineGeometry.js\";\nimport { DecalGeometry, DecalVertex } from \"./geometries/DecalGeometry.js\";\nimport { TeapotGeometry } from \"./geometries/TeapotGeometry.js\";\nimport { TextGeometry, TextGeometry as TextGeometry2 } from \"./geometries/TextGeometry.js\";\nimport { CSM } from \"./csm/CSM.js\";\nimport { CSMFrustum } from \"./csm/CSMFrustum.js\";\nimport { CSMHelper } from \"./csm/CSMHelper.js\";\nimport { CSMShader } from \"./csm/CSMShader.js\";\nimport { ACESFilmicToneMappingShader } from \"./shaders/ACESFilmicToneMappingShader.js\";\nimport { AfterimageShader } from \"./shaders/AfterimageShader.js\";\nimport { BasicShader } from \"./shaders/BasicShader.js\";\nimport { BleachBypassShader } from \"./shaders/BleachBypassShader.js\";\nimport { BlendShader } from \"./shaders/BlendShader.js\";\nimport { BokehShader } from \"./shaders/BokehShader.js\";\nimport { BokehDepthShader, BokehShader2 } from \"./shaders/BokehShader2.js\";\nimport { BrightnessContrastShader } from \"./shaders/BrightnessContrastShader.js\";\nimport { ColorCorrectionShader } from \"./shaders/ColorCorrectionShader.js\";\nimport { ColorifyShader } from \"./shaders/ColorifyShader.js\";\nimport { ConvolutionShader } from \"./shaders/ConvolutionShader.js\";\nimport { CopyShader } from \"./shaders/CopyShader.js\";\nimport { DOFMipMapShader } from \"./shaders/DOFMipMapShader.js\";\nimport { BlurShaderUtils, DepthLimitedBlurShader } from \"./shaders/DepthLimitedBlurShader.js\";\nimport { DigitalGlitch } from \"./shaders/DigitalGlitch.js\";\nimport { DotScreenShader } from \"./shaders/DotScreenShader.js\";\nimport { FXAAShader } from \"./shaders/FXAAShader.js\";\nimport { FilmShader } from \"./shaders/FilmShader.js\";\nimport { FocusShader } from \"./shaders/FocusShader.js\";\nimport { FreiChenShader } from \"./shaders/FreiChenShader.js\";\nimport { FresnelShader } from \"./shaders/FresnelShader.js\";\nimport { GammaCorrectionShader } from \"./shaders/GammaCorrectionShader.js\";\nimport { GodRaysCombineShader, GodRaysDepthMaskShader, GodRaysFakeSunShader, GodRaysGenerateShader } from \"./shaders/GodRaysShader.js\";\nimport { HalftoneShader } from \"./shaders/HalftoneShader.js\";\nimport { HorizontalBlurShader } from \"./shaders/HorizontalBlurShader.js\";\nimport { HorizontalTiltShiftShader } from \"./shaders/HorizontalTiltShiftShader.js\";\nimport { HueSaturationShader } from \"./shaders/HueSaturationShader.js\";\nimport { KaleidoShader } from \"./shaders/KaleidoShader.js\";\nimport { LuminosityHighPassShader } from \"./shaders/LuminosityHighPassShader.js\";\nimport { LuminosityShader } from \"./shaders/LuminosityShader.js\";\nimport { MirrorShader } from \"./shaders/MirrorShader.js\";\nimport { NormalMapShader } from \"./shaders/NormalMapShader.js\";\nimport { ParallaxShader } from \"./shaders/ParallaxShader.js\";\nimport { PixelShader } from \"./shaders/PixelShader.js\";\nimport { RGBShiftShader } from \"./shaders/RGBShiftShader.js\";\nimport { SAOShader } from \"./shaders/SAOShader.js\";\nimport { SMAABlendShader, SMAAEdgesShader, SMAAWeightsShader } from \"./shaders/SMAAShader.js\";\nimport { SSAOBlurShader, SSAODepthShader, SSAOShader } from \"./shaders/SSAOShader.js\";\nimport { SSRBlurShader, SSRDepthShader, SSRShader } from \"./shaders/SSRShader.js\";\nimport { SepiaShader } from \"./shaders/SepiaShader.js\";\nimport { SobelOperatorShader } from \"./shaders/SobelOperatorShader.js\";\nimport { SubsurfaceScatteringShader } from \"./shaders/SubsurfaceScatteringShader.js\";\nimport { TechnicolorShader } from \"./shaders/TechnicolorShader.js\";\nimport { ToneMapShader } from \"./shaders/ToneMapShader.js\";\nimport { ToonShader1, ToonShader2, ToonShaderDotted, ToonShaderHatching } from \"./shaders/ToonShader.js\";\nimport { TriangleBlurShader } from \"./shaders/TriangleBlurShader.js\";\nimport { UnpackDepthRGBAShader } from \"./shaders/UnpackDepthRGBAShader.js\";\nimport { VerticalBlurShader } from \"./shaders/VerticalBlurShader.js\";\nimport { VerticalTiltShiftShader } from \"./shaders/VerticalTiltShiftShader.js\";\nimport { VignetteShader } from \"./shaders/VignetteShader.js\";\nimport { VolumeRenderShader1 } from \"./shaders/VolumeShader.js\";\nimport { WaterRefractionShader } from \"./shaders/WaterRefractionShader.js\";\nimport { HTMLMesh } from \"./interactive/HTMLMesh.js\";\nimport { InteractiveGroup } from \"./interactive/InteractiveGroup.js\";\nimport { SelectionHelper } from \"./interactive/SelectionHelper.js\";\nimport { SelectionBox } from \"./interactive/SelectionBox.js\";\nimport { AmmoPhysics } from \"./physics/AmmoPhysics.js\";\nimport { ParallaxBarrierEffect } from \"./effects/ParallaxBarrierEffect.js\";\nimport { PeppersGhostEffect } from \"./effects/PeppersGhostEffect.js\";\nimport { OutlineEffect } from \"./effects/OutlineEffect.js\";\nimport { AnaglyphEffect } from \"./effects/AnaglyphEffect.js\";\nimport { AsciiEffect } from \"./effects/AsciiEffect.js\";\nimport { StereoEffect } from \"./effects/StereoEffect.js\";\nimport { FBXLoader } from \"./loaders/FBXLoader.js\";\nimport { Font, FontLoader } from \"./loaders/FontLoader.js\";\nimport { TGALoader } from \"./loaders/TGALoader.js\";\nimport { LUTCubeLoader } from \"./loaders/LUTCubeLoader.js\";\nimport { NRRDLoader } from \"./loaders/NRRDLoader.js\";\nimport { STLLoader } from \"./loaders/STLLoader.js\";\nimport { MTLLoader } from \"./loaders/MTLLoader.js\";\nimport { XLoader } from \"./loaders/XLoader.js\";\nimport { BVHLoader } from \"./loaders/BVHLoader.js\";\nimport { KMZLoader } from \"./loaders/KMZLoader.js\";\nimport { VRMLoader } from \"./loaders/VRMLoader.js\";\nimport { VRMLLoader } from \"./loaders/VRMLLoader.js\";\nimport { KTX2Loader } from \"./loaders/KTX2Loader.js\";\nimport { LottieLoader } from \"./loaders/LottieLoader.js\";\nimport { TTFLoader } from \"./loaders/TTFLoader.js\";\nimport { RGBELoader } from \"./loaders/RGBELoader.js\";\nimport { AssimpLoader } from \"./loaders/AssimpLoader.js\";\nimport { ColladaLoader } from \"./loaders/ColladaLoader.js\";\nimport { MDDLoader } from \"./loaders/MDDLoader.js\";\nimport { EXRLoader } from \"./loaders/EXRLoader.js\";\nimport { ThreeMFLoader } from \"./loaders/3MFLoader.js\";\nimport { XYZLoader } from \"./loaders/XYZLoader.js\";\nimport { VTKLoader } from \"./loaders/VTKLoader.js\";\nimport { LUT3dlLoader } from \"./loaders/LUT3dlLoader.js\";\nimport { DDSLoader } from \"./loaders/DDSLoader.js\";\nimport { PVRLoader } from \"./loaders/PVRLoader.js\";\nimport { GCodeLoader } from \"./loaders/GCodeLoader.js\";\nimport { BasisTextureLoader } from \"./loaders/BasisTextureLoader.js\";\nimport { TDSLoader } from \"./loaders/TDSLoader.js\";\nimport { LDrawLoader } from \"./loaders/LDrawLoader.js\";\nimport { GLTFLoader } from \"./loaders/GLTFLoader.js\";\nimport { SVGLoader } from \"./loaders/SVGLoader.js\";\nimport { Rhino3dmLoader } from \"./loaders/3DMLoader.js\";\nimport { OBJLoader } from \"./loaders/OBJLoader.js\";\nimport { AMFLoader } from \"./loaders/AMFLoader.js\";\nimport { MMDLoader } from \"./loaders/MMDLoader.js\";\nimport { MD2Loader } from \"./loaders/MD2Loader.js\";\nimport { KTXLoader } from \"./loaders/KTXLoader.js\";\nimport { TiltLoader } from \"./loaders/TiltLoader.js\";\nimport { DRACOLoader } from \"./loaders/DRACOLoader.js\";\nimport { HDRCubeTextureLoader } from \"./loaders/HDRCubeTextureLoader.js\";\nimport { PDBLoader } from \"./loaders/PDBLoader.js\";\nimport { PRWMLoader } from \"./loaders/PRWMLoader.js\";\nimport { RGBMLoader } from \"./loaders/RGBMLoader.js\";\nimport { VOXData3DTexture, VOXLoader, VOXMesh } from \"./loaders/VOXLoader.js\";\nimport { PCDLoader } from \"./loaders/PCDLoader.js\";\nimport { LWOLoader } from \"./loaders/LWOLoader.js\";\nimport { PLYLoader } from \"./loaders/PLYLoader.js\";\nimport { LineSegmentsGeometry } from \"./lines/LineSegmentsGeometry.js\";\nimport { LineGeometry } from \"./lines/LineGeometry.js\";\nimport { Wireframe } from \"./lines/Wireframe.js\";\nimport { WireframeGeometry2 } from \"./lines/WireframeGeometry2.js\";\nimport { Line2 } from \"./lines/Line2.js\";\nimport { LineMaterial } from \"./lines/LineMaterial.js\";\nimport { LineSegments2 } from \"./lines/LineSegments2.js\";\nimport { LightProbeHelper } from \"./helpers/LightProbeHelper.js\";\nimport { VertexTangentsHelper } from \"./helpers/VertexTangentsHelper.js\";\nimport { PositionalAudioHelper } from \"./helpers/PositionalAudioHelper.js\";\nimport { VertexNormalsHelper } from \"./helpers/VertexNormalsHelper.js\";\nimport { RectAreaLightHelper } from \"./helpers/RectAreaLightHelper.js\";\nimport { RectAreaLightUniformsLib } from \"./lights/RectAreaLightUniformsLib.js\";\nimport { LightProbeGenerator } from \"./lights/LightProbeGenerator.js\";\nimport { calcBSplineDerivatives, calcBSplinePoint, calcBasisFunctionDerivatives, calcBasisFunctions, calcKoverI, calcNURBSDerivatives, calcRationalCurveDerivatives, calcSurfacePoint, findSpan } from \"./curves/NURBSUtils.js\";\nimport { NURBSCurve } from \"./curves/NURBSCurve.js\";\nimport { NURBSSurface } from \"./curves/NURBSSurface.js\";\nimport { CinquefoilKnot, DecoratedTorusKnot4a, DecoratedTorusKnot4b, DecoratedTorusKnot5a, DecoratedTorusKnot5c, FigureEightPolynomialKnot, GrannyKnot, HeartCurve, HelixCurve, KnotCurve, TorusKnot, TrefoilKnot, TrefoilPolynomialKnot, VivianiCurve } from \"./curves/CurveExtras.js\";\nimport { Face3, Geometry } from \"./deprecated/Geometry.js\";\nimport { MeshoptDecoder } from \"./libs/MeshoptDecoder.js\";\nimport { MotionController, MotionControllerConstants, fetchProfile, fetchProfilesList } from \"./libs/MotionControllers.js\";\nexport {\n ACESFilmicToneMappingShader,\n AMFLoader,\n ARButton,\n AdaptiveToneMappingPass,\n AfterimagePass,\n AfterimageShader,\n AmmoPhysics,\n AnaglyphEffect,\n AnimationClipCreator,\n ArcballControls,\n AsciiEffect,\n AssimpLoader,\n BVHLoader,\n BasicShader,\n BasisTextureLoader,\n BatchedMesh,\n BleachBypassShader,\n BlendShader,\n BloomPass,\n BlurShaderUtils,\n BokehDepthShader,\n BokehPass,\n BokehShader,\n BokehShader2,\n BoxLineGeometry,\n BrightnessContrastShader,\n CCDIKHelper,\n CCDIKSolver,\n CSM,\n CSMFrustum,\n CSMHelper,\n CSMShader,\n CSS2DObject,\n CSS2DRenderer,\n CSS3DObject,\n CSS3DRenderer,\n CSS3DSprite,\n CameraControls,\n Capsule,\n CinematicCamera,\n CinquefoilKnot,\n ClearMaskPass,\n ClearPass,\n ColladaExporter,\n ColladaLoader,\n ColorConverter,\n ColorCorrectionShader,\n ColorMapKeywords,\n ColorifyShader,\n ConvexGeometry,\n ConvexHull,\n ConvexObjectBreaker,\n ConvolutionShader,\n CopyShader,\n CubeTexturePass,\n DDSLoader,\n DOFMipMapShader,\n DRACOExporter,\n DRACOLoader,\n DecalGeometry,\n DecalVertex,\n DecoratedTorusKnot4a,\n DecoratedTorusKnot4b,\n DecoratedTorusKnot5a,\n DecoratedTorusKnot5c,\n DepthLimitedBlurShader,\n DeviceOrientationControls,\n DigitalGlitch,\n DotScreenPass,\n DotScreenShader,\n DragControls,\n EXRLoader,\n EdgeSplitModifier,\n EffectComposer,\n FBXLoader,\n FXAAShader,\n Face,\n Face3,\n FigureEightPolynomialKnot,\n FilmPass,\n FilmShader,\n FirstPersonControls,\n FlakesTexture,\n Flow,\n FlyControls,\n FocusShader,\n Font,\n FontLoader,\n FreiChenShader,\n FresnelShader,\n FullScreenQuad,\n GCodeLoader,\n GLTFExporter,\n GLTFLoader,\n GPUComputationRenderer,\n GammaCorrectionShader,\n Geometry,\n GeometryCompressionUtils,\n GeometryUtils,\n GlitchPass,\n GodRaysCombineShader,\n GodRaysDepthMaskShader,\n GodRaysFakeSunShader,\n GodRaysGenerateShader,\n GrannyKnot,\n GroundProjectedEnv,\n Gyroscope,\n HDRCubeTextureLoader,\n HTMLMesh,\n HalfEdge,\n HalftonePass,\n HalftoneShader,\n HeartCurve,\n HelixCurve,\n HorizontalBlurShader,\n HorizontalTiltShiftShader,\n HueSaturationShader,\n ImprovedNoise,\n InstancedFlow,\n InteractiveGroup,\n KMZLoader,\n KTX2Loader,\n KTXLoader,\n KaleidoShader,\n KnotCurve,\n LDrawLoader,\n LUT3dlLoader,\n LUTCubeLoader,\n LUTPass,\n LWOLoader,\n Lensflare,\n LensflareElement,\n LightProbeGenerator,\n LightProbeHelper,\n LightningStorm,\n LightningStrike,\n Line2,\n LineGeometry,\n LineMaterial,\n LineSegments2,\n LineSegmentsGeometry,\n LottieLoader,\n LuminosityHighPassShader,\n LuminosityShader,\n Lut,\n MD2Character,\n MD2CharacterComplex,\n MD2Loader,\n MDDLoader,\n MMDAnimationHelper,\n MMDExporter,\n MMDLoader,\n MMDPhysics,\n MTLLoader,\n MapControls,\n MapControlsExp,\n MarchingCubes,\n MaskPass,\n MeshSurfaceSampler,\n MeshoptDecoder,\n MirrorShader,\n MorphAnimMesh,\n MorphBlendMesh,\n MotionController,\n MotionControllerConstants,\n NRRDLoader,\n NURBSCurve,\n NURBSSurface,\n NormalMapShader,\n OBB,\n OBJExporter,\n OBJLoader,\n Octree,\n OculusHandModel,\n OculusHandPointerModel,\n OrbitControls,\n OrbitControlsExp,\n OutlineEffect,\n OutlinePass,\n PCDLoader,\n PDBLoader,\n PLYExporter,\n PLYLoader,\n PRWMLoader,\n PVRLoader,\n PackedPhongMaterial,\n ParallaxBarrierEffect,\n ParallaxShader,\n ParametricGeometries,\n ParametricGeometry,\n Pass,\n PeppersGhostEffect,\n PixelShader,\n PointerLockControls,\n PositionalAudioHelper,\n ProgressiveLightMap,\n Projector,\n RGBELoader,\n RGBMLoader,\n RGBShiftShader,\n RectAreaLightHelper,\n RectAreaLightUniformsLib,\n Reflector,\n ReflectorForSSRPass,\n ReflectorRTT,\n Refractor,\n RenderPass,\n RenderPixelatedPass,\n RenderableFace,\n RenderableLine,\n RenderableObject,\n RenderableSprite,\n RenderableVertex,\n Rhino3dmLoader,\n RollerCoasterGeometry,\n RollerCoasterLiftersGeometry,\n RollerCoasterShadowGeometry,\n RoomEnvironment,\n RoughnessMipmapper,\n RoundedBoxGeometry,\n SAOPass,\n SAOShader,\n SMAABlendShader,\n SMAAEdgesShader,\n SMAAPass,\n SMAAWeightsShader,\n SSAARenderPass,\n SSAOBlurShader,\n SSAODepthShader,\n SSAOPass,\n SSAOShader,\n SSRBlurShader,\n SSRDepthShader,\n SSRPass,\n SSRShader,\n STATE,\n STLExporter,\n STLLoader,\n SVGLoader,\n SVGObject,\n SVGRenderer,\n SavePass,\n SceneUtils,\n SelectionBox,\n SelectionHelper,\n SepiaShader,\n ShaderPass,\n ShadowMapViewer,\n ShadowMesh,\n SimplexNoise,\n SimplifyModifier,\n SkeletonUtils,\n Sky,\n SkyGeometry,\n SobelOperatorShader,\n StereoEffect,\n SubsurfaceScatteringShader,\n TAARenderPass,\n TDSLoader,\n TGALoader,\n TTFLoader,\n TeapotGeometry,\n TechnicolorShader,\n TessellateModifier,\n TextGeometry as TextBufferGeometry,\n TextGeometry2 as TextGeometry,\n TexturePass,\n ThreeMFLoader,\n TiltLoader,\n Timer,\n ToneMapShader,\n ToonShader1,\n ToonShader2,\n ToonShaderDotted,\n ToonShaderHatching,\n TorusKnot,\n TrackballControls,\n TrackballControlsExp,\n TransformControls,\n TransformControlsGizmo,\n TransformControlsPlane,\n TreesGeometry,\n TrefoilKnot,\n TrefoilPolynomialKnot,\n TriangleBlurShader,\n TubePainter,\n USDZExporter,\n UVsDebug,\n UnpackDepthRGBAShader,\n UnrealBloomPass,\n VOXData3DTexture,\n VOXLoader,\n VOXMesh,\n VRButton,\n VRMLLoader,\n VRMLoader,\n VTKLoader,\n VertexList,\n VertexNode,\n VertexNormalsHelper,\n VertexTangentsHelper,\n VerticalBlurShader,\n VerticalTiltShiftShader,\n VignetteShader,\n VivianiCurve,\n Volume,\n VolumeRenderShader1,\n VolumeSlice,\n Water,\n Water2,\n WaterPass,\n WaterRefractionShader,\n Wireframe,\n WireframeGeometry2,\n XLoader,\n XRControllerModelFactory,\n XREstimatedLight,\n XRHandMeshModel,\n XRHandModelFactory,\n XRHandPrimitiveModel,\n XYZLoader,\n calcBSplineDerivatives,\n calcBSplinePoint,\n calcBasisFunctionDerivatives,\n calcBasisFunctions,\n calcKoverI,\n calcNURBSDerivatives,\n calcRationalCurveDerivatives,\n calcSurfacePoint,\n computeMorphedAttributes,\n createText,\n edgeTable,\n estimateBytesUsed,\n fetchProfile,\n fetchProfilesList,\n findSpan,\n getErrorMessage,\n getUniforms,\n getWebGL2ErrorMessage,\n getWebGLErrorMessage,\n initSplineTexture,\n interleaveAttributes,\n isWebGL2Available,\n isWebGLAvailable,\n mergeBufferAttributes,\n mergeBufferGeometries,\n mergeVertices,\n modifyShader,\n toCreasedNormals,\n toTrianglesDrawMode,\n triTable,\n updateSplineTexture\n};\n//# sourceMappingURL=index.js.map\n", "import { Line3, Plane, Triangle, Vector3 } from 'three'\n\n/**\n * Ported from: https://github.com/maurizzzio/quickhull3d/ by Mauricio Poppe (https://github.com/maurizzzio)\n */\n\nconst Visible = 0\nconst Deleted = 1\n\nconst _v1 = new Vector3()\nconst _line3 = new Line3()\nconst _plane = new Plane()\nconst _closestPoint = new Vector3()\nconst _triangle = new Triangle()\n\nclass ConvexHull {\n constructor() {\n this.tolerance = -1\n\n this.faces = [] // the generated faces of the convex hull\n this.newFaces = [] // this array holds the faces that are generated within a single iteration\n\n // the vertex lists work as follows:\n //\n // let 'a' and 'b' be 'Face' instances\n // let 'v' be points wrapped as instance of 'Vertex'\n //\n // [v, v, ..., v, v, v, ...]\n // ^ ^\n // | |\n // a.outside b.outside\n //\n this.assigned = new VertexList()\n this.unassigned = new VertexList()\n\n this.vertices = [] // vertices of the hull (internal representation of given geometry data)\n }\n\n setFromPoints(points) {\n // The algorithm needs at least four points.\n\n if (points.length >= 4) {\n this.makeEmpty()\n\n for (let i = 0, l = points.length; i < l; i++) {\n this.vertices.push(new VertexNode(points[i]))\n }\n\n this.compute()\n }\n\n return this\n }\n\n setFromObject(object) {\n const points = []\n\n object.updateMatrixWorld(true)\n\n object.traverse(function (node) {\n const geometry = node.geometry\n\n if (geometry !== undefined) {\n const attribute = geometry.attributes.position\n\n if (attribute !== undefined) {\n for (let i = 0, l = attribute.count; i < l; i++) {\n const point = new Vector3()\n\n point.fromBufferAttribute(attribute, i).applyMatrix4(node.matrixWorld)\n\n points.push(point)\n }\n }\n }\n })\n\n return this.setFromPoints(points)\n }\n\n containsPoint(point) {\n const faces = this.faces\n\n for (let i = 0, l = faces.length; i < l; i++) {\n const face = faces[i]\n\n // compute signed distance and check on what half space the point lies\n\n if (face.distanceToPoint(point) > this.tolerance) return false\n }\n\n return true\n }\n\n intersectRay(ray, target) {\n // based on \"Fast Ray-Convex Polyhedron Intersection\" by Eric Haines, GRAPHICS GEMS II\n\n const faces = this.faces\n\n let tNear = -Infinity\n let tFar = Infinity\n\n for (let i = 0, l = faces.length; i < l; i++) {\n const face = faces[i]\n\n // interpret faces as planes for the further computation\n\n const vN = face.distanceToPoint(ray.origin)\n const vD = face.normal.dot(ray.direction)\n\n // if the origin is on the positive side of a plane (so the plane can \"see\" the origin) and\n // the ray is turned away or parallel to the plane, there is no intersection\n\n if (vN > 0 && vD >= 0) return null\n\n // compute the distance from the ray’s origin to the intersection with the plane\n\n const t = vD !== 0 ? -vN / vD : 0\n\n // only proceed if the distance is positive. a negative distance means the intersection point\n // lies \"behind\" the origin\n\n if (t <= 0) continue\n\n // now categorized plane as front-facing or back-facing\n\n if (vD > 0) {\n // plane faces away from the ray, so this plane is a back-face\n\n tFar = Math.min(t, tFar)\n } else {\n // front-face\n\n tNear = Math.max(t, tNear)\n }\n\n if (tNear > tFar) {\n // if tNear ever is greater than tFar, the ray must miss the convex hull\n\n return null\n }\n }\n\n // evaluate intersection point\n\n // always try tNear first since its the closer intersection point\n\n if (tNear !== -Infinity) {\n ray.at(tNear, target)\n } else {\n ray.at(tFar, target)\n }\n\n return target\n }\n\n intersectsRay(ray) {\n return this.intersectRay(ray, _v1) !== null\n }\n\n makeEmpty() {\n this.faces = []\n this.vertices = []\n\n return this\n }\n\n // Adds a vertex to the 'assigned' list of vertices and assigns it to the given face\n\n addVertexToFace(vertex, face) {\n vertex.face = face\n\n if (face.outside === null) {\n this.assigned.append(vertex)\n } else {\n this.assigned.insertBefore(face.outside, vertex)\n }\n\n face.outside = vertex\n\n return this\n }\n\n // Removes a vertex from the 'assigned' list of vertices and from the given face\n\n removeVertexFromFace(vertex, face) {\n if (vertex === face.outside) {\n // fix face.outside link\n\n if (vertex.next !== null && vertex.next.face === face) {\n // face has at least 2 outside vertices, move the 'outside' reference\n\n face.outside = vertex.next\n } else {\n // vertex was the only outside vertex that face had\n\n face.outside = null\n }\n }\n\n this.assigned.remove(vertex)\n\n return this\n }\n\n // Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertex list\n\n removeAllVerticesFromFace(face) {\n if (face.outside !== null) {\n // reference to the first and last vertex of this face\n\n const start = face.outside\n let end = face.outside\n\n while (end.next !== null && end.next.face === face) {\n end = end.next\n }\n\n this.assigned.removeSubList(start, end)\n\n // fix references\n\n start.prev = end.next = null\n face.outside = null\n\n return start\n }\n }\n\n // Removes all the visible vertices that 'face' is able to see\n\n deleteFaceVertices(face, absorbingFace) {\n const faceVertices = this.removeAllVerticesFromFace(face)\n\n if (faceVertices !== undefined) {\n if (absorbingFace === undefined) {\n // mark the vertices to be reassigned to some other face\n\n this.unassigned.appendChain(faceVertices)\n } else {\n // if there's an absorbing face try to assign as many vertices as possible to it\n\n let vertex = faceVertices\n\n do {\n // we need to buffer the subsequent vertex at this point because the 'vertex.next' reference\n // will be changed by upcoming method calls\n\n const nextVertex = vertex.next\n\n const distance = absorbingFace.distanceToPoint(vertex.point)\n\n // check if 'vertex' is able to see 'absorbingFace'\n\n if (distance > this.tolerance) {\n this.addVertexToFace(vertex, absorbingFace)\n } else {\n this.unassigned.append(vertex)\n }\n\n // now assign next vertex\n\n vertex = nextVertex\n } while (vertex !== null)\n }\n }\n\n return this\n }\n\n // Reassigns as many vertices as possible from the unassigned list to the new faces\n\n resolveUnassignedPoints(newFaces) {\n if (this.unassigned.isEmpty() === false) {\n let vertex = this.unassigned.first()\n\n do {\n // buffer 'next' reference, see .deleteFaceVertices()\n\n const nextVertex = vertex.next\n\n let maxDistance = this.tolerance\n\n let maxFace = null\n\n for (let i = 0; i < newFaces.length; i++) {\n const face = newFaces[i]\n\n if (face.mark === Visible) {\n const distance = face.distanceToPoint(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n maxFace = face\n }\n\n if (maxDistance > 1000 * this.tolerance) break\n }\n }\n\n // 'maxFace' can be null e.g. if there are identical vertices\n\n if (maxFace !== null) {\n this.addVertexToFace(vertex, maxFace)\n }\n\n vertex = nextVertex\n } while (vertex !== null)\n }\n\n return this\n }\n\n // Computes the extremes of a simplex which will be the initial hull\n\n computeExtremes() {\n const min = new Vector3()\n const max = new Vector3()\n\n const minVertices = []\n const maxVertices = []\n\n // initially assume that the first vertex is the min/max\n\n for (let i = 0; i < 3; i++) {\n minVertices[i] = maxVertices[i] = this.vertices[0]\n }\n\n min.copy(this.vertices[0].point)\n max.copy(this.vertices[0].point)\n\n // compute the min/max vertex on all six directions\n\n for (let i = 0, l = this.vertices.length; i < l; i++) {\n const vertex = this.vertices[i]\n const point = vertex.point\n\n // update the min coordinates\n\n for (let j = 0; j < 3; j++) {\n if (point.getComponent(j) < min.getComponent(j)) {\n min.setComponent(j, point.getComponent(j))\n minVertices[j] = vertex\n }\n }\n\n // update the max coordinates\n\n for (let j = 0; j < 3; j++) {\n if (point.getComponent(j) > max.getComponent(j)) {\n max.setComponent(j, point.getComponent(j))\n maxVertices[j] = vertex\n }\n }\n }\n\n // use min/max vectors to compute an optimal epsilon\n\n this.tolerance =\n 3 *\n Number.EPSILON *\n (Math.max(Math.abs(min.x), Math.abs(max.x)) +\n Math.max(Math.abs(min.y), Math.abs(max.y)) +\n Math.max(Math.abs(min.z), Math.abs(max.z)))\n\n return { min: minVertices, max: maxVertices }\n }\n\n // Computes the initial simplex assigning to its faces all the points\n // that are candidates to form part of the hull\n\n computeInitialHull() {\n const vertices = this.vertices\n const extremes = this.computeExtremes()\n const min = extremes.min\n const max = extremes.max\n\n // 1. Find the two vertices 'v0' and 'v1' with the greatest 1d separation\n // (max.x - min.x)\n // (max.y - min.y)\n // (max.z - min.z)\n\n let maxDistance = 0\n let index = 0\n\n for (let i = 0; i < 3; i++) {\n const distance = max[i].point.getComponent(i) - min[i].point.getComponent(i)\n\n if (distance > maxDistance) {\n maxDistance = distance\n index = i\n }\n }\n\n const v0 = min[index]\n const v1 = max[index]\n let v2\n let v3\n\n // 2. The next vertex 'v2' is the one farthest to the line formed by 'v0' and 'v1'\n\n maxDistance = 0\n _line3.set(v0.point, v1.point)\n\n for (let i = 0, l = this.vertices.length; i < l; i++) {\n const vertex = vertices[i]\n\n if (vertex !== v0 && vertex !== v1) {\n _line3.closestPointToPoint(vertex.point, true, _closestPoint)\n\n const distance = _closestPoint.distanceToSquared(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n v2 = vertex\n }\n }\n }\n\n // 3. The next vertex 'v3' is the one farthest to the plane 'v0', 'v1', 'v2'\n\n maxDistance = -1\n _plane.setFromCoplanarPoints(v0.point, v1.point, v2.point)\n\n for (let i = 0, l = this.vertices.length; i < l; i++) {\n const vertex = vertices[i]\n\n if (vertex !== v0 && vertex !== v1 && vertex !== v2) {\n const distance = Math.abs(_plane.distanceToPoint(vertex.point))\n\n if (distance > maxDistance) {\n maxDistance = distance\n v3 = vertex\n }\n }\n }\n\n const faces = []\n\n if (_plane.distanceToPoint(v3.point) < 0) {\n // the face is not able to see the point so 'plane.normal' is pointing outside the tetrahedron\n\n faces.push(Face.create(v0, v1, v2), Face.create(v3, v1, v0), Face.create(v3, v2, v1), Face.create(v3, v0, v2))\n\n // set the twin edge\n\n for (let i = 0; i < 3; i++) {\n const j = (i + 1) % 3\n\n // join face[ i ] i > 0, with the first face\n\n faces[i + 1].getEdge(2).setTwin(faces[0].getEdge(j))\n\n // join face[ i ] with face[ i + 1 ], 1 <= i <= 3\n\n faces[i + 1].getEdge(1).setTwin(faces[j + 1].getEdge(0))\n }\n } else {\n // the face is able to see the point so 'plane.normal' is pointing inside the tetrahedron\n\n faces.push(Face.create(v0, v2, v1), Face.create(v3, v0, v1), Face.create(v3, v1, v2), Face.create(v3, v2, v0))\n\n // set the twin edge\n\n for (let i = 0; i < 3; i++) {\n const j = (i + 1) % 3\n\n // join face[ i ] i > 0, with the first face\n\n faces[i + 1].getEdge(2).setTwin(faces[0].getEdge((3 - i) % 3))\n\n // join face[ i ] with face[ i + 1 ]\n\n faces[i + 1].getEdge(0).setTwin(faces[j + 1].getEdge(1))\n }\n }\n\n // the initial hull is the tetrahedron\n\n for (let i = 0; i < 4; i++) {\n this.faces.push(faces[i])\n }\n\n // initial assignment of vertices to the faces of the tetrahedron\n\n for (let i = 0, l = vertices.length; i < l; i++) {\n const vertex = vertices[i]\n\n if (vertex !== v0 && vertex !== v1 && vertex !== v2 && vertex !== v3) {\n maxDistance = this.tolerance\n let maxFace = null\n\n for (let j = 0; j < 4; j++) {\n const distance = this.faces[j].distanceToPoint(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n maxFace = this.faces[j]\n }\n }\n\n if (maxFace !== null) {\n this.addVertexToFace(vertex, maxFace)\n }\n }\n }\n\n return this\n }\n\n // Removes inactive faces\n\n reindexFaces() {\n const activeFaces = []\n\n for (let i = 0; i < this.faces.length; i++) {\n const face = this.faces[i]\n\n if (face.mark === Visible) {\n activeFaces.push(face)\n }\n }\n\n this.faces = activeFaces\n\n return this\n }\n\n // Finds the next vertex to create faces with the current hull\n\n nextVertexToAdd() {\n // if the 'assigned' list of vertices is empty, no vertices are left. return with 'undefined'\n\n if (this.assigned.isEmpty() === false) {\n let eyeVertex,\n maxDistance = 0\n\n // grap the first available face and start with the first visible vertex of that face\n\n const eyeFace = this.assigned.first().face\n let vertex = eyeFace.outside\n\n // now calculate the farthest vertex that face can see\n\n do {\n const distance = eyeFace.distanceToPoint(vertex.point)\n\n if (distance > maxDistance) {\n maxDistance = distance\n eyeVertex = vertex\n }\n\n vertex = vertex.next\n } while (vertex !== null && vertex.face === eyeFace)\n\n return eyeVertex\n }\n }\n\n // Computes a chain of half edges in CCW order called the 'horizon'.\n // For an edge to be part of the horizon it must join a face that can see\n // 'eyePoint' and a face that cannot see 'eyePoint'.\n\n computeHorizon(eyePoint, crossEdge, face, horizon) {\n // moves face's vertices to the 'unassigned' vertex list\n\n this.deleteFaceVertices(face)\n\n face.mark = Deleted\n\n let edge\n\n if (crossEdge === null) {\n edge = crossEdge = face.getEdge(0)\n } else {\n // start from the next edge since 'crossEdge' was already analyzed\n // (actually 'crossEdge.twin' was the edge who called this method recursively)\n\n edge = crossEdge.next\n }\n\n do {\n const twinEdge = edge.twin\n const oppositeFace = twinEdge.face\n\n if (oppositeFace.mark === Visible) {\n if (oppositeFace.distanceToPoint(eyePoint) > this.tolerance) {\n // the opposite face can see the vertex, so proceed with next edge\n\n this.computeHorizon(eyePoint, twinEdge, oppositeFace, horizon)\n } else {\n // the opposite face can't see the vertex, so this edge is part of the horizon\n\n horizon.push(edge)\n }\n }\n\n edge = edge.next\n } while (edge !== crossEdge)\n\n return this\n }\n\n // Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' in CCW order\n\n addAdjoiningFace(eyeVertex, horizonEdge) {\n // all the half edges are created in ccw order thus the face is always pointing outside the hull\n\n const face = Face.create(eyeVertex, horizonEdge.tail(), horizonEdge.head())\n\n this.faces.push(face)\n\n // join face.getEdge( - 1 ) with the horizon's opposite edge face.getEdge( - 1 ) = face.getEdge( 2 )\n\n face.getEdge(-1).setTwin(horizonEdge.twin)\n\n return face.getEdge(0) // the half edge whose vertex is the eyeVertex\n }\n\n // Adds 'horizon.length' faces to the hull, each face will be linked with the\n // horizon opposite face and the face on the left/right\n\n addNewFaces(eyeVertex, horizon) {\n this.newFaces = []\n\n let firstSideEdge = null\n let previousSideEdge = null\n\n for (let i = 0; i < horizon.length; i++) {\n const horizonEdge = horizon[i]\n\n // returns the right side edge\n\n const sideEdge = this.addAdjoiningFace(eyeVertex, horizonEdge)\n\n if (firstSideEdge === null) {\n firstSideEdge = sideEdge\n } else {\n // joins face.getEdge( 1 ) with previousFace.getEdge( 0 )\n\n sideEdge.next.setTwin(previousSideEdge)\n }\n\n this.newFaces.push(sideEdge.face)\n previousSideEdge = sideEdge\n }\n\n // perform final join of new faces\n\n firstSideEdge.next.setTwin(previousSideEdge)\n\n return this\n }\n\n // Adds a vertex to the hull\n\n addVertexToHull(eyeVertex) {\n const horizon = []\n\n this.unassigned.clear()\n\n // remove 'eyeVertex' from 'eyeVertex.face' so that it can't be added to the 'unassigned' vertex list\n\n this.removeVertexFromFace(eyeVertex, eyeVertex.face)\n\n this.computeHorizon(eyeVertex.point, null, eyeVertex.face, horizon)\n\n this.addNewFaces(eyeVertex, horizon)\n\n // reassign 'unassigned' vertices to the new faces\n\n this.resolveUnassignedPoints(this.newFaces)\n\n return this\n }\n\n cleanup() {\n this.assigned.clear()\n this.unassigned.clear()\n this.newFaces = []\n\n return this\n }\n\n compute() {\n let vertex\n\n this.computeInitialHull()\n\n // add all available vertices gradually to the hull\n\n while ((vertex = this.nextVertexToAdd()) !== undefined) {\n this.addVertexToHull(vertex)\n }\n\n this.reindexFaces()\n\n this.cleanup()\n\n return this\n }\n}\n\n//\n\nclass Face {\n constructor() {\n this.normal = new Vector3()\n this.midpoint = new Vector3()\n this.area = 0\n\n this.constant = 0 // signed distance from face to the origin\n this.outside = null // reference to a vertex in a vertex list this face can see\n this.mark = Visible\n this.edge = null\n }\n\n static create(a, b, c) {\n const face = new Face()\n\n const e0 = new HalfEdge(a, face)\n const e1 = new HalfEdge(b, face)\n const e2 = new HalfEdge(c, face)\n\n // join edges\n\n e0.next = e2.prev = e1\n e1.next = e0.prev = e2\n e2.next = e1.prev = e0\n\n // main half edge reference\n\n face.edge = e0\n\n return face.compute()\n }\n\n getEdge(i) {\n let edge = this.edge\n\n while (i > 0) {\n edge = edge.next\n i--\n }\n\n while (i < 0) {\n edge = edge.prev\n i++\n }\n\n return edge\n }\n\n compute() {\n const a = this.edge.tail()\n const b = this.edge.head()\n const c = this.edge.next.head()\n\n _triangle.set(a.point, b.point, c.point)\n\n _triangle.getNormal(this.normal)\n _triangle.getMidpoint(this.midpoint)\n this.area = _triangle.getArea()\n\n this.constant = this.normal.dot(this.midpoint)\n\n return this\n }\n\n distanceToPoint(point) {\n return this.normal.dot(point) - this.constant\n }\n}\n\n// Entity for a Doubly-Connected Edge List (DCEL).\n\nclass HalfEdge {\n constructor(vertex, face) {\n this.vertex = vertex\n this.prev = null\n this.next = null\n this.twin = null\n this.face = face\n }\n\n head() {\n return this.vertex\n }\n\n tail() {\n return this.prev ? this.prev.vertex : null\n }\n\n length() {\n const head = this.head()\n const tail = this.tail()\n\n if (tail !== null) {\n return tail.point.distanceTo(head.point)\n }\n\n return -1\n }\n\n lengthSquared() {\n const head = this.head()\n const tail = this.tail()\n\n if (tail !== null) {\n return tail.point.distanceToSquared(head.point)\n }\n\n return -1\n }\n\n setTwin(edge) {\n this.twin = edge\n edge.twin = this\n\n return this\n }\n}\n\n// A vertex as a double linked list node.\n\nclass VertexNode {\n constructor(point) {\n this.point = point\n this.prev = null\n this.next = null\n this.face = null // the face that is able to see this vertex\n }\n}\n\n// A double linked list that contains vertex nodes.\n\nclass VertexList {\n constructor() {\n this.head = null\n this.tail = null\n }\n\n first() {\n return this.head\n }\n\n last() {\n return this.tail\n }\n\n clear() {\n this.head = this.tail = null\n\n return this\n }\n\n // Inserts a vertex before the target vertex\n\n insertBefore(target, vertex) {\n vertex.prev = target.prev\n vertex.next = target\n\n if (vertex.prev === null) {\n this.head = vertex\n } else {\n vertex.prev.next = vertex\n }\n\n target.prev = vertex\n\n return this\n }\n\n // Inserts a vertex after the target vertex\n\n insertAfter(target, vertex) {\n vertex.prev = target\n vertex.next = target.next\n\n if (vertex.next === null) {\n this.tail = vertex\n } else {\n vertex.next.prev = vertex\n }\n\n target.next = vertex\n\n return this\n }\n\n // Appends a vertex to the end of the linked list\n\n append(vertex) {\n if (this.head === null) {\n this.head = vertex\n } else {\n this.tail.next = vertex\n }\n\n vertex.prev = this.tail\n vertex.next = null // the tail has no subsequent vertex\n\n this.tail = vertex\n\n return this\n }\n\n // Appends a chain of vertices where 'vertex' is the head.\n\n appendChain(vertex) {\n if (this.head === null) {\n this.head = vertex\n } else {\n this.tail.next = vertex\n }\n\n vertex.prev = this.tail\n\n // ensure that the 'tail' reference points to the last vertex of the chain\n\n while (vertex.next !== null) {\n vertex = vertex.next\n }\n\n this.tail = vertex\n\n return this\n }\n\n // Removes a vertex from the linked list\n\n remove(vertex) {\n if (vertex.prev === null) {\n this.head = vertex.next\n } else {\n vertex.prev.next = vertex.next\n }\n\n if (vertex.next === null) {\n this.tail = vertex.prev\n } else {\n vertex.next.prev = vertex.prev\n }\n\n return this\n }\n\n // Removes a list of vertices whose 'head' is 'a' and whose 'tail' is b\n\n removeSubList(a, b) {\n if (a.prev === null) {\n this.head = b.next\n } else {\n a.prev.next = b.next\n }\n\n if (b.next === null) {\n this.tail = a.prev\n } else {\n b.next.prev = a.prev\n }\n\n return this\n }\n\n isEmpty() {\n return this.head === null\n }\n}\n\nexport { ConvexHull, Face, HalfEdge, VertexNode, VertexList }\n", "import { Line3, Mesh, Plane, Vector3 } from 'three'\nimport { ConvexGeometry } from '../geometries/ConvexGeometry'\n\n/**\n * @fileoverview This class can be used to subdivide a convex Geometry object into pieces.\n *\n * Usage:\n *\n * Use the function prepareBreakableObject to prepare a Mesh object to be broken.\n *\n * Then, call the various functions to subdivide the object (subdivideByImpact, cutByPlane)\n *\n * Sub-objects that are product of subdivision don't need prepareBreakableObject to be called on them.\n *\n * Requisites for the object:\n *\n * - Mesh object must have a buffer geometry and a material\n *\n * - Vertex normals must be planar (not smoothed)\n *\n * - The geometry must be convex (this is not checked in the library). You can create convex\n * geometries with ConvexGeometry. The BoxGeometry, SphereGeometry and other convex primitives\n * can also be used.\n *\n * Note: This lib adds member variables to object's userData member (see prepareBreakableObject function)\n * Use with caution and read the code when using with other libs.\n *\n * @param {double} minSizeForBreak Min size a debris can have to break.\n * @param {double} smallDelta Max distance to consider that a point belongs to a plane.\n *\n */\n\nconst _v1 = new Vector3()\n\nclass ConvexObjectBreaker {\n constructor(minSizeForBreak = 1.4, smallDelta = 0.0001) {\n this.minSizeForBreak = minSizeForBreak\n this.smallDelta = smallDelta\n\n this.tempLine1 = new Line3()\n this.tempPlane1 = new Plane()\n this.tempPlane2 = new Plane()\n this.tempPlane_Cut = new Plane()\n this.tempCM1 = new Vector3()\n this.tempCM2 = new Vector3()\n this.tempVector3 = new Vector3()\n this.tempVector3_2 = new Vector3()\n this.tempVector3_3 = new Vector3()\n this.tempVector3_P0 = new Vector3()\n this.tempVector3_P1 = new Vector3()\n this.tempVector3_P2 = new Vector3()\n this.tempVector3_N0 = new Vector3()\n this.tempVector3_N1 = new Vector3()\n this.tempVector3_AB = new Vector3()\n this.tempVector3_CB = new Vector3()\n this.tempResultObjects = { object1: null, object2: null }\n\n this.segments = []\n const n = 30 * 30\n for (let i = 0; i < n; i++) this.segments[i] = false\n }\n\n prepareBreakableObject(object, mass, velocity, angularVelocity, breakable) {\n // object is a Object3d (normally a Mesh), must have a buffer geometry, and it must be convex.\n // Its material property is propagated to its children (sub-pieces)\n // mass must be > 0\n\n const userData = object.userData\n userData.mass = mass\n userData.velocity = velocity.clone()\n userData.angularVelocity = angularVelocity.clone()\n userData.breakable = breakable\n }\n\n /*\n * @param {int} maxRadialIterations Iterations for radial cuts.\n * @param {int} maxRandomIterations Max random iterations for not-radial cuts\n *\n * Returns the array of pieces\n */\n subdivideByImpact(object, pointOfImpact, normal, maxRadialIterations, maxRandomIterations) {\n const debris = []\n\n const tempPlane1 = this.tempPlane1\n const tempPlane2 = this.tempPlane2\n\n this.tempVector3.addVectors(pointOfImpact, normal)\n tempPlane1.setFromCoplanarPoints(pointOfImpact, object.position, this.tempVector3)\n\n const maxTotalIterations = maxRandomIterations + maxRadialIterations\n\n const scope = this\n\n function subdivideRadial(subObject, startAngle, endAngle, numIterations) {\n if (Math.random() < numIterations * 0.05 || numIterations > maxTotalIterations) {\n debris.push(subObject)\n\n return\n }\n\n let angle = Math.PI\n\n if (numIterations === 0) {\n tempPlane2.normal.copy(tempPlane1.normal)\n tempPlane2.constant = tempPlane1.constant\n } else {\n if (numIterations <= maxRadialIterations) {\n angle = (endAngle - startAngle) * (0.2 + 0.6 * Math.random()) + startAngle\n\n // Rotate tempPlane2 at impact point around normal axis and the angle\n scope.tempVector3_2.copy(object.position).sub(pointOfImpact).applyAxisAngle(normal, angle).add(pointOfImpact)\n tempPlane2.setFromCoplanarPoints(pointOfImpact, scope.tempVector3, scope.tempVector3_2)\n } else {\n angle = (0.5 * (numIterations & 1) + 0.2 * (2 - Math.random())) * Math.PI\n\n // Rotate tempPlane2 at object position around normal axis and the angle\n scope.tempVector3_2\n .copy(pointOfImpact)\n .sub(subObject.position)\n .applyAxisAngle(normal, angle)\n .add(subObject.position)\n scope.tempVector3_3.copy(normal).add(subObject.position)\n tempPlane2.setFromCoplanarPoints(subObject.position, scope.tempVector3_3, scope.tempVector3_2)\n }\n }\n\n // Perform the cut\n scope.cutByPlane(subObject, tempPlane2, scope.tempResultObjects)\n\n const obj1 = scope.tempResultObjects.object1\n const obj2 = scope.tempResultObjects.object2\n\n if (obj1) {\n subdivideRadial(obj1, startAngle, angle, numIterations + 1)\n }\n\n if (obj2) {\n subdivideRadial(obj2, angle, endAngle, numIterations + 1)\n }\n }\n\n subdivideRadial(object, 0, 2 * Math.PI, 0)\n\n return debris\n }\n\n cutByPlane(object, plane, output) {\n // Returns breakable objects in output.object1 and output.object2 members, the resulting 2 pieces of the cut.\n // object2 can be null if the plane doesn't cut the object.\n // object1 can be null only in case of internal error\n // Returned value is number of pieces, 0 for error.\n\n const geometry = object.geometry\n const coords = geometry.attributes.position.array\n const normals = geometry.attributes.normal.array\n\n const numPoints = coords.length / 3\n let numFaces = numPoints / 3\n\n let indices = geometry.getIndex()\n\n if (indices) {\n indices = indices.array\n numFaces = indices.length / 3\n }\n\n function getVertexIndex(faceIdx, vert) {\n // vert = 0, 1 or 2.\n\n const idx = faceIdx * 3 + vert\n\n return indices ? indices[idx] : idx\n }\n\n const points1 = []\n const points2 = []\n\n const delta = this.smallDelta\n\n // Reset segments mark\n const numPointPairs = numPoints * numPoints\n for (let i = 0; i < numPointPairs; i++) this.segments[i] = false\n\n const p0 = this.tempVector3_P0\n const p1 = this.tempVector3_P1\n const n0 = this.tempVector3_N0\n const n1 = this.tempVector3_N1\n\n // Iterate through the faces to mark edges shared by coplanar faces\n for (let i = 0; i < numFaces - 1; i++) {\n const a1 = getVertexIndex(i, 0)\n const b1 = getVertexIndex(i, 1)\n const c1 = getVertexIndex(i, 2)\n\n // Assuming all 3 vertices have the same normal\n n0.set(normals[a1], normals[a1] + 1, normals[a1] + 2)\n\n for (let j = i + 1; j < numFaces; j++) {\n const a2 = getVertexIndex(j, 0)\n const b2 = getVertexIndex(j, 1)\n const c2 = getVertexIndex(j, 2)\n\n // Assuming all 3 vertices have the same normal\n n1.set(normals[a2], normals[a2] + 1, normals[a2] + 2)\n\n const coplanar = 1 - n0.dot(n1) < delta\n\n if (coplanar) {\n if (a1 === a2 || a1 === b2 || a1 === c2) {\n if (b1 === a2 || b1 === b2 || b1 === c2) {\n this.segments[a1 * numPoints + b1] = true\n this.segments[b1 * numPoints + a1] = true\n } else {\n this.segments[c1 * numPoints + a1] = true\n this.segments[a1 * numPoints + c1] = true\n }\n } else if (b1 === a2 || b1 === b2 || b1 === c2) {\n this.segments[c1 * numPoints + b1] = true\n this.segments[b1 * numPoints + c1] = true\n }\n }\n }\n }\n\n // Transform the plane to object local space\n const localPlane = this.tempPlane_Cut\n object.updateMatrix()\n ConvexObjectBreaker.transformPlaneToLocalSpace(plane, object.matrix, localPlane)\n\n // Iterate through the faces adding points to both pieces\n for (let i = 0; i < numFaces; i++) {\n const va = getVertexIndex(i, 0)\n const vb = getVertexIndex(i, 1)\n const vc = getVertexIndex(i, 2)\n\n for (let segment = 0; segment < 3; segment++) {\n const i0 = segment === 0 ? va : segment === 1 ? vb : vc\n const i1 = segment === 0 ? vb : segment === 1 ? vc : va\n\n const segmentState = this.segments[i0 * numPoints + i1]\n\n if (segmentState) continue // The segment already has been processed in another face\n\n // Mark segment as processed (also inverted segment)\n this.segments[i0 * numPoints + i1] = true\n this.segments[i1 * numPoints + i0] = true\n\n p0.set(coords[3 * i0], coords[3 * i0 + 1], coords[3 * i0 + 2])\n p1.set(coords[3 * i1], coords[3 * i1 + 1], coords[3 * i1 + 2])\n\n // mark: 1 for negative side, 2 for positive side, 3 for coplanar point\n let mark0 = 0\n\n let d = localPlane.distanceToPoint(p0)\n\n if (d > delta) {\n mark0 = 2\n points2.push(p0.clone())\n } else if (d < -delta) {\n mark0 = 1\n points1.push(p0.clone())\n } else {\n mark0 = 3\n points1.push(p0.clone())\n points2.push(p0.clone())\n }\n\n // mark: 1 for negative side, 2 for positive side, 3 for coplanar point\n let mark1 = 0\n\n d = localPlane.distanceToPoint(p1)\n\n if (d > delta) {\n mark1 = 2\n points2.push(p1.clone())\n } else if (d < -delta) {\n mark1 = 1\n points1.push(p1.clone())\n } else {\n mark1 = 3\n points1.push(p1.clone())\n points2.push(p1.clone())\n }\n\n if ((mark0 === 1 && mark1 === 2) || (mark0 === 2 && mark1 === 1)) {\n // Intersection of segment with the plane\n\n this.tempLine1.start.copy(p0)\n this.tempLine1.end.copy(p1)\n\n let intersection = new Vector3()\n intersection = localPlane.intersectLine(this.tempLine1, intersection)\n\n if (intersection === null) {\n // Shouldn't happen\n console.error('Internal error: segment does not intersect plane.')\n output.segmentedObject1 = null\n output.segmentedObject2 = null\n return 0\n }\n\n points1.push(intersection)\n points2.push(intersection.clone())\n }\n }\n }\n\n // Calculate debris mass (very fast and imprecise):\n const newMass = object.userData.mass * 0.5\n\n // Calculate debris Center of Mass (again fast and imprecise)\n this.tempCM1.set(0, 0, 0)\n let radius1 = 0\n const numPoints1 = points1.length\n\n if (numPoints1 > 0) {\n for (let i = 0; i < numPoints1; i++) this.tempCM1.add(points1[i])\n\n this.tempCM1.divideScalar(numPoints1)\n for (let i = 0; i < numPoints1; i++) {\n const p = points1[i]\n p.sub(this.tempCM1)\n radius1 = Math.max(radius1, p.x, p.y, p.z)\n }\n\n this.tempCM1.add(object.position)\n }\n\n this.tempCM2.set(0, 0, 0)\n let radius2 = 0\n const numPoints2 = points2.length\n if (numPoints2 > 0) {\n for (let i = 0; i < numPoints2; i++) this.tempCM2.add(points2[i])\n\n this.tempCM2.divideScalar(numPoints2)\n for (let i = 0; i < numPoints2; i++) {\n const p = points2[i]\n p.sub(this.tempCM2)\n radius2 = Math.max(radius2, p.x, p.y, p.z)\n }\n\n this.tempCM2.add(object.position)\n }\n\n let object1 = null\n let object2 = null\n\n let numObjects = 0\n\n if (numPoints1 > 4) {\n object1 = new Mesh(new ConvexGeometry(points1), object.material)\n object1.position.copy(this.tempCM1)\n object1.quaternion.copy(object.quaternion)\n\n this.prepareBreakableObject(\n object1,\n newMass,\n object.userData.velocity,\n object.userData.angularVelocity,\n 2 * radius1 > this.minSizeForBreak,\n )\n\n numObjects++\n }\n\n if (numPoints2 > 4) {\n object2 = new Mesh(new ConvexGeometry(points2), object.material)\n object2.position.copy(this.tempCM2)\n object2.quaternion.copy(object.quaternion)\n\n this.prepareBreakableObject(\n object2,\n newMass,\n object.userData.velocity,\n object.userData.angularVelocity,\n 2 * radius2 > this.minSizeForBreak,\n )\n\n numObjects++\n }\n\n output.object1 = object1\n output.object2 = object2\n\n return numObjects\n }\n\n static transformFreeVector(v, m) {\n // input:\n // vector interpreted as a free vector\n // THREE.Matrix4 orthogonal matrix (matrix without scale)\n\n const x = v.x,\n y = v.y,\n z = v.z\n const e = m.elements\n\n v.x = e[0] * x + e[4] * y + e[8] * z\n v.y = e[1] * x + e[5] * y + e[9] * z\n v.z = e[2] * x + e[6] * y + e[10] * z\n\n return v\n }\n\n static transformFreeVectorInverse(v, m) {\n // input:\n // vector interpreted as a free vector\n // THREE.Matrix4 orthogonal matrix (matrix without scale)\n\n const x = v.x,\n y = v.y,\n z = v.z\n const e = m.elements\n\n v.x = e[0] * x + e[1] * y + e[2] * z\n v.y = e[4] * x + e[5] * y + e[6] * z\n v.z = e[8] * x + e[9] * y + e[10] * z\n\n return v\n }\n\n static transformTiedVectorInverse(v, m) {\n // input:\n // vector interpreted as a tied (ordinary) vector\n // THREE.Matrix4 orthogonal matrix (matrix without scale)\n\n const x = v.x,\n y = v.y,\n z = v.z\n const e = m.elements\n\n v.x = e[0] * x + e[1] * y + e[2] * z - e[12]\n v.y = e[4] * x + e[5] * y + e[6] * z - e[13]\n v.z = e[8] * x + e[9] * y + e[10] * z - e[14]\n\n return v\n }\n\n static transformPlaneToLocalSpace(plane, m, resultPlane) {\n resultPlane.normal.copy(plane.normal)\n resultPlane.constant = plane.constant\n\n const referencePoint = ConvexObjectBreaker.transformTiedVectorInverse(plane.coplanarPoint(_v1), m)\n\n ConvexObjectBreaker.transformFreeVectorInverse(resultPlane.normal, m)\n\n // recalculate constant (like in setFromNormalAndCoplanarPoint)\n resultPlane.constant = -referencePoint.dot(resultPlane.normal)\n }\n}\n\nexport { ConvexObjectBreaker }\n", "import { Object3D, Quaternion, Vector3 } from 'three'\n\nconst _translationObject = new Vector3()\nconst _quaternionObject = new Quaternion()\nconst _scaleObject = new Vector3()\n\nconst _translationWorld = new Vector3()\nconst _quaternionWorld = new Quaternion()\nconst _scaleWorld = new Vector3()\n\nclass Gyroscope extends Object3D {\n constructor() {\n super()\n }\n\n updateMatrixWorld(force) {\n this.matrixAutoUpdate && this.updateMatrix()\n\n // update matrixWorld\n\n if (this.matrixWorldNeedsUpdate || force) {\n if (this.parent !== null) {\n this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)\n\n this.matrixWorld.decompose(_translationWorld, _quaternionWorld, _scaleWorld)\n this.matrix.decompose(_translationObject, _quaternionObject, _scaleObject)\n\n this.matrixWorld.compose(_translationWorld, _quaternionObject, _scaleWorld)\n } else {\n this.matrixWorld.copy(this.matrix)\n }\n\n this.matrixWorldNeedsUpdate = false\n\n force = true\n }\n\n // update children\n\n for (let i = 0, l = this.children.length; i < l; i++) {\n this.children[i].updateMatrixWorld(force)\n }\n }\n}\n\nexport { Gyroscope }\n", "let webGLAvailable: boolean, webGL2Available: boolean\n\nexport function isWebGLAvailable(): boolean {\n if (webGLAvailable !== undefined) return webGLAvailable\n try {\n let gl\n const canvas = document.createElement('canvas')\n webGLAvailable = !!(window.WebGLRenderingContext && (gl = canvas.getContext('webgl')))\n if (gl) gl.getExtension('WEBGL_lose_context')?.loseContext()\n return webGLAvailable\n } catch (e) {\n return (webGLAvailable = false)\n }\n}\n\nexport function isWebGL2Available(): boolean {\n if (webGL2Available !== undefined) return webGL2Available\n try {\n let gl\n const canvas = document.createElement('canvas')\n webGL2Available = !!(window.WebGL2RenderingContext && (gl = canvas.getContext('webgl2')))\n if (gl) gl.getExtension('WEBGL_lose_context')?.loseContext()\n return webGL2Available\n } catch (e) {\n return (webGL2Available = false)\n }\n}\n\nexport function getWebGLErrorMessage(): HTMLDivElement {\n return getErrorMessage(1)\n}\n\nexport function getWebGL2ErrorMessage(): HTMLDivElement {\n return getErrorMessage(2)\n}\n\nexport function getErrorMessage(version: 1 | 2): HTMLDivElement {\n const names = {\n 1: 'WebGL',\n 2: 'WebGL 2',\n }\n\n const contexts = {\n 1: window.WebGLRenderingContext,\n 2: window.WebGL2RenderingContext,\n }\n\n const element = document.createElement('div')\n element.id = 'webglmessage'\n element.style.fontFamily = 'monospace'\n element.style.fontSize = '13px'\n element.style.fontWeight = 'normal'\n element.style.textAlign = 'center'\n element.style.background = '#fff'\n element.style.color = '#000'\n element.style.padding = '1.5em'\n element.style.width = '400px'\n element.style.margin = '5em auto 0'\n\n let message =\n 'Your $0 does not seem to support $1'\n\n if (contexts[version]) {\n message = message.replace('$0', 'graphics card')\n } else {\n message = message.replace('$0', 'browser')\n }\n\n message = message.replace('$1', names[version])\n element.innerHTML = message\n return element\n}\n", "\nexport default function potpack(boxes) {\n\n // calculate total box area and maximum box width\n let area = 0;\n let maxWidth = 0;\n\n for (const box of boxes) {\n area += box.w * box.h;\n maxWidth = Math.max(maxWidth, box.w);\n }\n\n // sort the boxes for insertion by height, descending\n boxes.sort((a, b) => b.h - a.h);\n\n // aim for a squarish resulting container,\n // slightly adjusted for sub-100% space utilization\n const startWidth = Math.max(Math.ceil(Math.sqrt(area / 0.95)), maxWidth);\n\n // start with a single empty space, unbounded at the bottom\n const spaces = [{x: 0, y: 0, w: startWidth, h: Infinity}];\n\n let width = 0;\n let height = 0;\n\n for (const box of boxes) {\n // look through spaces backwards so that we check smaller spaces first\n for (let i = spaces.length - 1; i >= 0; i--) {\n const space = spaces[i];\n\n // look for empty spaces that can accommodate the current box\n if (box.w > space.w || box.h > space.h) continue;\n\n // found the space; add the box to its top-left corner\n // |-------|-------|\n // | box | |\n // |_______| |\n // | space |\n // |_______________|\n box.x = space.x;\n box.y = space.y;\n\n height = Math.max(height, box.y + box.h);\n width = Math.max(width, box.x + box.w);\n\n if (box.w === space.w && box.h === space.h) {\n // space matches the box exactly; remove it\n const last = spaces.pop();\n if (i < spaces.length) spaces[i] = last;\n\n } else if (box.h === space.h) {\n // space matches the box height; update it accordingly\n // |-------|---------------|\n // | box | updated space |\n // |_______|_______________|\n space.x += box.w;\n space.w -= box.w;\n\n } else if (box.w === space.w) {\n // space matches the box width; update it accordingly\n // |---------------|\n // | box |\n // |_______________|\n // | updated space |\n // |_______________|\n space.y += box.h;\n space.h -= box.h;\n\n } else {\n // otherwise the box splits the space into two spaces\n // |-------|-----------|\n // | box | new space |\n // |_______|___________|\n // | updated space |\n // |___________________|\n spaces.push({\n x: space.x + box.w,\n y: space.y,\n w: space.w - box.w,\n h: box.h\n });\n space.y += box.h;\n space.h -= box.h;\n }\n break;\n }\n }\n\n return {\n w: width, // container width\n h: height, // container height\n fill: (area / (width * height)) || 0 // space utilization\n };\n}\n", "import { Matrix4, Object3D, Vector2, Vector3 } from 'three'\n\nclass CSS2DObject extends Object3D {\n constructor(element = document.createElement('div')) {\n super()\n\n this.isCSS2DObject = true\n\n this.element = element\n\n this.element.style.position = 'absolute'\n this.element.style.userSelect = 'none'\n\n this.element.setAttribute('draggable', false)\n\n this.center = new Vector2(0.5, 0.5) // ( 0, 0 ) is the lower left; ( 1, 1 ) is the top right\n\n this.addEventListener('removed', function () {\n this.traverse(function (object) {\n if (object.element instanceof Element && object.element.parentNode !== null) {\n object.element.parentNode.removeChild(object.element)\n }\n })\n })\n }\n\n copy(source, recursive) {\n super.copy(source, recursive)\n\n this.element = source.element.cloneNode(true)\n\n this.center = source.center\n\n return this\n }\n}\n\nconst _vector = new Vector3()\nconst _viewMatrix = new Matrix4()\nconst _viewProjectionMatrix = new Matrix4()\nconst _a = new Vector3()\nconst _b = new Vector3()\n\nclass CSS2DRenderer {\n constructor(parameters = {}) {\n const _this = this\n\n let _width, _height\n let _widthHalf, _heightHalf\n\n const cache = {\n objects: new WeakMap(),\n }\n\n const domElement = parameters.element !== undefined ? parameters.element : document.createElement('div')\n\n domElement.style.overflow = 'hidden'\n\n this.domElement = domElement\n\n this.getSize = function () {\n return {\n width: _width,\n height: _height,\n }\n }\n\n this.render = function (scene, camera) {\n if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld()\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld()\n\n _viewMatrix.copy(camera.matrixWorldInverse)\n _viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix)\n\n renderObject(scene, scene, camera)\n zOrder(scene)\n }\n\n this.setSize = function (width, height) {\n _width = width\n _height = height\n\n _widthHalf = _width / 2\n _heightHalf = _height / 2\n\n domElement.style.width = width + 'px'\n domElement.style.height = height + 'px'\n }\n\n function renderObject(object, scene, camera) {\n if (object.isCSS2DObject) {\n _vector.setFromMatrixPosition(object.matrixWorld)\n _vector.applyMatrix4(_viewProjectionMatrix)\n\n const visible =\n object.visible === true && _vector.z >= -1 && _vector.z <= 1 && object.layers.test(camera.layers) === true\n object.element.style.display = visible === true ? '' : 'none'\n\n if (visible === true) {\n object.onBeforeRender(_this, scene, camera)\n\n const element = object.element\n\n element.style.transform =\n 'translate(' +\n -100 * object.center.x +\n '%,' +\n -100 * object.center.y +\n '%)' +\n 'translate(' +\n (_vector.x * _widthHalf + _widthHalf) +\n 'px,' +\n (-_vector.y * _heightHalf + _heightHalf) +\n 'px)'\n\n if (element.parentNode !== domElement) {\n domElement.appendChild(element)\n }\n\n object.onAfterRender(_this, scene, camera)\n }\n\n const objectData = {\n distanceToCameraSquared: getDistanceToSquared(camera, object),\n }\n\n cache.objects.set(object, objectData)\n }\n\n for (let i = 0, l = object.children.length; i < l; i++) {\n renderObject(object.children[i], scene, camera)\n }\n }\n\n function getDistanceToSquared(object1, object2) {\n _a.setFromMatrixPosition(object1.matrixWorld)\n _b.setFromMatrixPosition(object2.matrixWorld)\n\n return _a.distanceToSquared(_b)\n }\n\n function filterAndFlatten(scene) {\n const result = []\n\n scene.traverse(function (object) {\n if (object.isCSS2DObject) result.push(object)\n })\n\n return result\n }\n\n function zOrder(scene) {\n const sorted = filterAndFlatten(scene).sort(function (a, b) {\n if (a.renderOrder !== b.renderOrder) {\n return b.renderOrder - a.renderOrder\n }\n\n const distanceA = cache.objects.get(a).distanceToCameraSquared\n const distanceB = cache.objects.get(b).distanceToCameraSquared\n\n return distanceA - distanceB\n })\n\n const zMax = sorted.length\n\n for (let i = 0, l = sorted.length; i < l; i++) {\n sorted[i].element.style.zIndex = zMax - i\n }\n }\n }\n}\n\nexport { CSS2DObject, CSS2DRenderer }\n", "import { Matrix4, Object3D, Quaternion, Vector3 } from 'three'\n\n/**\n * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n */\n\nconst _position = new Vector3()\nconst _quaternion = new Quaternion()\nconst _scale = new Vector3()\n\nclass CSS3DObject extends Object3D {\n constructor(element = document.createElement('div')) {\n super()\n\n this.isCSS3DObject = true\n\n this.element = element\n this.element.style.position = 'absolute'\n this.element.style.pointerEvents = 'auto'\n this.element.style.userSelect = 'none'\n\n this.element.setAttribute('draggable', false)\n\n this.addEventListener('removed', function () {\n this.traverse(function (object) {\n if (object.element instanceof Element && object.element.parentNode !== null) {\n object.element.parentNode.removeChild(object.element)\n }\n })\n })\n }\n\n copy(source, recursive) {\n super.copy(source, recursive)\n\n this.element = source.element.cloneNode(true)\n\n return this\n }\n}\n\nclass CSS3DSprite extends CSS3DObject {\n constructor(element) {\n super(element)\n\n this.isCSS3DSprite = true\n\n this.rotation2D = 0\n }\n\n copy(source, recursive) {\n super.copy(source, recursive)\n\n this.rotation2D = source.rotation2D\n\n return this\n }\n}\n\n//\n\nconst _matrix = new Matrix4()\nconst _matrix2 = new Matrix4()\n\nclass CSS3DRenderer {\n constructor(parameters = {}) {\n const _this = this\n\n let _width, _height\n let _widthHalf, _heightHalf\n\n const cache = {\n camera: { style: '' },\n objects: new WeakMap(),\n }\n\n const domElement = parameters.element !== undefined ? parameters.element : document.createElement('div')\n\n domElement.style.overflow = 'hidden'\n\n this.domElement = domElement\n\n const viewElement = document.createElement('div')\n viewElement.style.transformOrigin = '0 0'\n viewElement.style.pointerEvents = 'none'\n domElement.appendChild(viewElement)\n\n const cameraElement = document.createElement('div')\n\n cameraElement.style.transformStyle = 'preserve-3d'\n\n viewElement.appendChild(cameraElement)\n\n this.getSize = function () {\n return {\n width: _width,\n height: _height,\n }\n }\n\n this.render = function (scene, camera) {\n const fov = camera.projectionMatrix.elements[5] * _heightHalf\n\n if (camera.view && camera.view.enabled) {\n // view offset\n viewElement.style.transform = `translate( ${-camera.view.offsetX * (_width / camera.view.width)}px, ${\n -camera.view.offsetY * (_height / camera.view.height)\n }px )`\n\n // view fullWidth and fullHeight, view width and height\n viewElement.style.transform += `scale( ${camera.view.fullWidth / camera.view.width}, ${\n camera.view.fullHeight / camera.view.height\n } )`\n } else {\n viewElement.style.transform = ''\n }\n\n if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld()\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld()\n\n let tx, ty\n\n if (camera.isOrthographicCamera) {\n tx = -(camera.right + camera.left) / 2\n ty = (camera.top + camera.bottom) / 2\n }\n\n const scaleByViewOffset = camera.view && camera.view.enabled ? camera.view.height / camera.view.fullHeight : 1\n const cameraCSSMatrix = camera.isOrthographicCamera\n ? `scale( ${scaleByViewOffset} )` +\n 'scale(' +\n fov +\n ')' +\n 'translate(' +\n epsilon(tx) +\n 'px,' +\n epsilon(ty) +\n 'px)' +\n getCameraCSSMatrix(camera.matrixWorldInverse)\n : `scale( ${scaleByViewOffset} )` + 'translateZ(' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse)\n const perspective = camera.isPerspectiveCamera ? 'perspective(' + fov + 'px) ' : ''\n\n const style = perspective + cameraCSSMatrix + 'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)'\n\n if (cache.camera.style !== style) {\n cameraElement.style.transform = style\n\n cache.camera.style = style\n }\n\n renderObject(scene, scene, camera, cameraCSSMatrix)\n }\n\n this.setSize = function (width, height) {\n _width = width\n _height = height\n _widthHalf = _width / 2\n _heightHalf = _height / 2\n\n domElement.style.width = width + 'px'\n domElement.style.height = height + 'px'\n\n viewElement.style.width = width + 'px'\n viewElement.style.height = height + 'px'\n\n cameraElement.style.width = width + 'px'\n cameraElement.style.height = height + 'px'\n }\n\n function epsilon(value) {\n return Math.abs(value) < 1e-10 ? 0 : value\n }\n\n function getCameraCSSMatrix(matrix) {\n const elements = matrix.elements\n\n return (\n 'matrix3d(' +\n epsilon(elements[0]) +\n ',' +\n epsilon(-elements[1]) +\n ',' +\n epsilon(elements[2]) +\n ',' +\n epsilon(elements[3]) +\n ',' +\n epsilon(elements[4]) +\n ',' +\n epsilon(-elements[5]) +\n ',' +\n epsilon(elements[6]) +\n ',' +\n epsilon(elements[7]) +\n ',' +\n epsilon(elements[8]) +\n ',' +\n epsilon(-elements[9]) +\n ',' +\n epsilon(elements[10]) +\n ',' +\n epsilon(elements[11]) +\n ',' +\n epsilon(elements[12]) +\n ',' +\n epsilon(-elements[13]) +\n ',' +\n epsilon(elements[14]) +\n ',' +\n epsilon(elements[15]) +\n ')'\n )\n }\n\n function getObjectCSSMatrix(matrix) {\n const elements = matrix.elements\n const matrix3d =\n 'matrix3d(' +\n epsilon(elements[0]) +\n ',' +\n epsilon(elements[1]) +\n ',' +\n epsilon(elements[2]) +\n ',' +\n epsilon(elements[3]) +\n ',' +\n epsilon(-elements[4]) +\n ',' +\n epsilon(-elements[5]) +\n ',' +\n epsilon(-elements[6]) +\n ',' +\n epsilon(-elements[7]) +\n ',' +\n epsilon(elements[8]) +\n ',' +\n epsilon(elements[9]) +\n ',' +\n epsilon(elements[10]) +\n ',' +\n epsilon(elements[11]) +\n ',' +\n epsilon(elements[12]) +\n ',' +\n epsilon(elements[13]) +\n ',' +\n epsilon(elements[14]) +\n ',' +\n epsilon(elements[15]) +\n ')'\n\n return 'translate(-50%,-50%)' + matrix3d\n }\n\n function renderObject(object, scene, camera, cameraCSSMatrix) {\n if (object.isCSS3DObject) {\n const visible = object.visible === true && object.layers.test(camera.layers) === true\n object.element.style.display = visible === true ? '' : 'none'\n\n if (visible === true) {\n object.onBeforeRender(_this, scene, camera)\n\n let style\n\n if (object.isCSS3DSprite) {\n // http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\n _matrix.copy(camera.matrixWorldInverse)\n _matrix.transpose()\n\n if (object.rotation2D !== 0) _matrix.multiply(_matrix2.makeRotationZ(object.rotation2D))\n\n object.matrixWorld.decompose(_position, _quaternion, _scale)\n _matrix.setPosition(_position)\n _matrix.scale(_scale)\n\n _matrix.elements[3] = 0\n _matrix.elements[7] = 0\n _matrix.elements[11] = 0\n _matrix.elements[15] = 1\n\n style = getObjectCSSMatrix(_matrix)\n } else {\n style = getObjectCSSMatrix(object.matrixWorld)\n }\n\n const element = object.element\n const cachedObject = cache.objects.get(object)\n\n if (cachedObject === undefined || cachedObject.style !== style) {\n element.style.transform = style\n\n const objectData = { style: style }\n cache.objects.set(object, objectData)\n }\n\n if (element.parentNode !== cameraElement) {\n cameraElement.appendChild(element)\n }\n\n object.onAfterRender(_this, scene, camera)\n }\n }\n\n for (let i = 0, l = object.children.length; i < l; i++) {\n renderObject(object.children[i], scene, camera, cameraCSSMatrix)\n }\n }\n }\n}\n\nexport { CSS3DObject, CSS3DSprite, CSS3DRenderer }\n", "class FlakesTexture {\n constructor(width = 512, height = 512) {\n const canvas = document.createElement('canvas')\n canvas.width = width\n canvas.height = height\n\n const context = canvas.getContext('2d') as CanvasRenderingContext2D\n context.fillStyle = 'rgb(127,127,255)'\n context.fillRect(0, 0, width, height)\n\n for (let i = 0; i < 4000; i++) {\n const x = Math.random() * width\n const y = Math.random() * height\n const r = Math.random() * 3 + 3\n\n let nx = Math.random() * 2 - 1\n let ny = Math.random() * 2 - 1\n let nz = 1.5\n\n const l = Math.sqrt(nx * nx + ny * ny + nz * nz)\n\n nx /= l\n ny /= l\n nz /= l\n\n context.fillStyle = 'rgb(' + (nx * 127 + 127) + ',' + (ny * 127 + 127) + ',' + nz * 255 + ')'\n context.beginPath()\n context.arc(x, y, r, 0, Math.PI * 2)\n context.fill()\n }\n\n return canvas\n }\n}\n\nexport { FlakesTexture }\n", "// Original src: https://github.com/zz85/threejs-path-flow\nconst CHANNELS = 4\nconst TEXTURE_WIDTH = 1024\nconst TEXTURE_HEIGHT = 4\n\nimport {\n DataTexture,\n RGBAFormat,\n FloatType,\n RepeatWrapping,\n Mesh,\n InstancedMesh,\n NearestFilter,\n DynamicDrawUsage,\n Matrix4,\n Material,\n Curve,\n BufferGeometry,\n} from 'three'\n\nimport type { IUniform } from 'three'\n\n/**\n * Make a new DataTexture to store the descriptions of the curves.\n *\n * @param { number } numberOfCurves the number of curves needed to be described by this texture.\n */\nexport const initSplineTexture = (numberOfCurves = 1): DataTexture => {\n const dataArray = new Float32Array(TEXTURE_WIDTH * TEXTURE_HEIGHT * numberOfCurves * CHANNELS)\n const dataTexture = new DataTexture(dataArray, TEXTURE_WIDTH, TEXTURE_HEIGHT * numberOfCurves, RGBAFormat, FloatType)\n\n dataTexture.wrapS = RepeatWrapping\n dataTexture.wrapT = RepeatWrapping\n dataTexture.magFilter = NearestFilter\n dataTexture.needsUpdate = true\n\n return dataTexture\n}\n\n/**\n * Write the curve description to the data texture\n *\n * @param { DataTexture } texture The DataTexture to write to\n * @param { Curve } splineCurve The curve to describe\n * @param { number } offset Which curve slot to write to\n */\nexport const updateSplineTexture = >(\n texture: DataTexture,\n splineCurve: TCurve,\n offset = 0,\n): void => {\n const numberOfPoints = Math.floor(TEXTURE_WIDTH * (TEXTURE_HEIGHT / 4))\n splineCurve.arcLengthDivisions = numberOfPoints / 2\n splineCurve.updateArcLengths()\n const points = splineCurve.getSpacedPoints(numberOfPoints)\n const frenetFrames = splineCurve.computeFrenetFrames(numberOfPoints, true)\n\n for (let i = 0; i < numberOfPoints; i++) {\n const rowOffset = Math.floor(i / TEXTURE_WIDTH)\n const rowIndex = i % TEXTURE_WIDTH\n\n let pt = points[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 0 + rowOffset + TEXTURE_HEIGHT * offset)\n pt = frenetFrames.tangents[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 1 + rowOffset + TEXTURE_HEIGHT * offset)\n pt = frenetFrames.normals[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 2 + rowOffset + TEXTURE_HEIGHT * offset)\n pt = frenetFrames.binormals[i]\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 3 + rowOffset + TEXTURE_HEIGHT * offset)\n }\n\n texture.needsUpdate = true\n}\n\nconst setTextureValue = (texture: DataTexture, index: number, x: number, y: number, z: number, o: number): void => {\n const image = texture.image\n const { data } = image\n const i = CHANNELS * TEXTURE_WIDTH * o // Row Offset\n data[index * CHANNELS + i + 0] = x\n data[index * CHANNELS + i + 1] = y\n data[index * CHANNELS + i + 2] = z\n data[index * CHANNELS + i + 3] = 1\n}\n\nexport interface INumericUniform extends IUniform {\n type: 'f' | 'i'\n value: number\n}\n\nexport type CurveModifierUniforms = {\n spineTexture: IUniform\n pathOffset: INumericUniform\n pathSegment: INumericUniform\n spineOffset: INumericUniform\n spineLength: INumericUniform\n flow: INumericUniform\n}\n\n/**\n * Create a new set of uniforms for describing the curve modifier\n *\n * @param { DataTexture } Texture which holds the curve description\n */\nexport const getUniforms = (splineTexture: DataTexture): CurveModifierUniforms => ({\n spineTexture: { value: splineTexture },\n pathOffset: { type: 'f', value: 0 }, // time of path curve\n pathSegment: { type: 'f', value: 1 }, // fractional length of path\n spineOffset: { type: 'f', value: 161 },\n spineLength: { type: 'f', value: 400 },\n flow: { type: 'i', value: 1 },\n})\n\nexport type ModifiedMaterial = TMaterial & {\n __ok: boolean\n}\n\nexport function modifyShader(\n material: ModifiedMaterial,\n uniforms: CurveModifierUniforms,\n numberOfCurves = 1,\n): void {\n if (material.__ok) return\n material.__ok = true\n\n material.onBeforeCompile = (shader: { vertexShader: string; uniforms: { [uniform: string]: IUniform } }): void => {\n if ((shader as any).__modified) return\n ;(shader as any).__modified = true\n\n Object.assign(shader.uniforms, uniforms)\n\n const vertexShader = /* glsl */ `\n\t\tuniform sampler2D spineTexture;\n\t\tuniform float pathOffset;\n\t\tuniform float pathSegment;\n\t\tuniform float spineOffset;\n\t\tuniform float spineLength;\n\t\tuniform int flow;\n\n\t\tfloat textureLayers = ${TEXTURE_HEIGHT * numberOfCurves}.;\n\t\tfloat textureStacks = ${TEXTURE_HEIGHT / 4}.;\n\n\t\t${shader.vertexShader}\n\t\t`\n // chunk import moved in front of modified shader below\n .replace('#include ', '')\n\n // vec3 transformedNormal declaration overriden below\n .replace('#include ', '')\n\n // vec3 transformed declaration overriden below\n .replace('#include ', '')\n\n // shader override\n .replace(\n /void\\s*main\\s*\\(\\)\\s*\\{/,\n /* glsl */ `\n void main() {\n #include \n\n vec4 worldPos = modelMatrix * vec4(position, 1.);\n\n bool bend = flow > 0;\n float xWeight = bend ? 0. : 1.;\n\n #ifdef USE_INSTANCING\n float pathOffsetFromInstanceMatrix = instanceMatrix[3][2];\n float spineLengthFromInstanceMatrix = instanceMatrix[3][0];\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLengthFromInstanceMatrix : 0.;\n float mt = (spinePortion * pathSegment + pathOffset + pathOffsetFromInstanceMatrix)*textureStacks;\n #else\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLength : 0.;\n float mt = (spinePortion * pathSegment + pathOffset)*textureStacks;\n #endif\n\n mt = mod(mt, textureStacks);\n float rowOffset = floor(mt);\n\n #ifdef USE_INSTANCING\n rowOffset += instanceMatrix[3][1] * ${TEXTURE_HEIGHT}.;\n #endif\n\n vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 a = texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 b = texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 c = texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;\n mat3 basis = mat3(a, b, c);\n\n vec3 transformed = basis\n * vec3(worldPos.x * xWeight, worldPos.y * 1., worldPos.z * 1.)\n + spinePos;\n\n vec3 transformedNormal = normalMatrix * (basis * objectNormal);\n\t\t\t`,\n )\n .replace(\n '#include ',\n /* glsl */ `vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;`,\n )\n\n shader.vertexShader = vertexShader\n }\n}\n\n/**\n * A helper class for making meshes bend aroudn curves\n */\nexport class Flow {\n public curveArray: Curve[]\n public curveLengthArray: number[]\n\n public object3D: TMesh\n public splineTexure: DataTexture\n public uniforms: CurveModifierUniforms\n\n /**\n * @param {Mesh} mesh The mesh to clone and modify to bend around the curve\n * @param {number} numberOfCurves The amount of space that should preallocated for additional curves\n */\n constructor(mesh: TMesh, numberOfCurves = 1) {\n const obj3D = mesh.clone() as TMesh\n const splineTexure = initSplineTexture(numberOfCurves)\n const uniforms = getUniforms(splineTexure)\n\n obj3D.traverse((child) => {\n if (child instanceof Mesh || child instanceof InstancedMesh) {\n child.material = child.material.clone()\n modifyShader(child.material, uniforms, numberOfCurves)\n }\n })\n\n this.curveArray = new Array(numberOfCurves)\n this.curveLengthArray = new Array(numberOfCurves)\n\n this.object3D = obj3D\n this.splineTexure = splineTexure\n this.uniforms = uniforms\n }\n\n public updateCurve>(index: number, curve: TCurve): void {\n if (index >= this.curveArray.length) throw Error('Index out of range for Flow')\n const curveLength = curve.getLength()\n this.uniforms.spineLength.value = curveLength\n this.curveLengthArray[index] = curveLength\n this.curveArray[index] = curve\n updateSplineTexture(this.splineTexure, curve, index)\n }\n\n public moveAlongCurve(amount: number): void {\n this.uniforms.pathOffset.value += amount\n }\n}\nconst matrix = new Matrix4()\n\n/**\n * A helper class for creating instanced versions of flow, where the instances are placed on the curve.\n */\nexport class InstancedFlow<\n TGeometry extends BufferGeometry = BufferGeometry,\n TMaterial extends Material = Material\n> extends Flow> {\n public offsets: number[]\n public whichCurve: number[]\n\n /**\n *\n * @param {number} count The number of instanced elements\n * @param {number} curveCount The number of curves to preallocate for\n * @param {Geometry} geometry The geometry to use for the instanced mesh\n * @param {Material} material The material to use for the instanced mesh\n */\n constructor(count: number, curveCount: number, geometry: TGeometry, material: TMaterial) {\n const mesh = new InstancedMesh(geometry, material, count)\n mesh.instanceMatrix.setUsage(DynamicDrawUsage)\n mesh.frustumCulled = false\n super(mesh, curveCount)\n\n this.offsets = new Array(count).fill(0)\n this.whichCurve = new Array(count).fill(0)\n }\n\n /**\n * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects\n * This writes that information to the matrix and marks it as needing update.\n *\n * @param {number} index of the instanced element to update\n */\n private writeChanges(index: number): void {\n matrix.makeTranslation(this.curveLengthArray[this.whichCurve[index]], this.whichCurve[index], this.offsets[index])\n this.object3D.setMatrixAt(index, matrix)\n this.object3D.instanceMatrix.needsUpdate = true\n }\n\n /**\n * Move an individual element along the curve by a specific amount\n *\n * @param {number} index Which element to update\n * @param {number} offset Move by how much\n */\n public moveIndividualAlongCurve(index: number, offset: number): void {\n this.offsets[index] += offset\n this.writeChanges(index)\n }\n\n /**\n * Select which curve to use for an element\n *\n * @param {number} index the index of the instanced element to update\n * @param {number} curveNo the index of the curve it should use\n */\n public setCurve(index: number, curveNo: number): void {\n if (isNaN(curveNo)) throw Error('curve index being set is Not a Number (NaN)')\n this.whichCurve[index] = curveNo\n this.writeChanges(index)\n }\n}\n", "export const getWithKey = (obj: T, key: K): T[K] => obj[key]\n", "import {\n BufferAttribute,\n BufferGeometry,\n Float32BufferAttribute,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n TriangleFanDrawMode,\n TriangleStripDrawMode,\n TrianglesDrawMode,\n Vector3,\n Mesh,\n Line,\n Points,\n Material,\n SkinnedMesh,\n} from 'three'\n\nimport { getWithKey } from '../types/helpers'\nimport type { TypedArrayConstructors, TypedArray } from '../types/shared'\n\n/**\n * @param {Array} geometries\n * @param {Boolean} useGroups\n * @return {BufferGeometry}\n */\nexport const mergeBufferGeometries = (geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry | null => {\n const isIndexed = geometries[0].index !== null\n\n const attributesUsed = new Set(Object.keys(geometries[0].attributes))\n const morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes))\n\n const attributes: { [key: string]: Array } = {}\n const morphAttributes: { [key: string]: Array[] } = {}\n\n const morphTargetsRelative = geometries[0].morphTargetsRelative\n\n const mergedGeometry = new BufferGeometry()\n\n let offset = 0\n\n geometries.forEach((geom, i) => {\n let attributesCount = 0\n\n // ensure that all geometries are indexed, or none\n\n if (isIndexed !== (geom.index !== null)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.',\n )\n return null\n }\n\n // gather attributes, exit early if they're different\n\n for (let name in geom.attributes) {\n if (!attributesUsed.has(name)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. All geometries must have compatible attributes; make sure \"' +\n name +\n '\" attribute exists among all geometries, or in none of them.',\n )\n return null\n }\n\n if (attributes[name] === undefined) {\n attributes[name] = []\n }\n\n attributes[name].push(geom.attributes[name])\n\n attributesCount++\n }\n\n // ensure geometries have the same number of attributes\n\n if (attributesCount !== attributesUsed.size) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. Make sure all geometries have the same number of attributes.',\n )\n return null\n }\n\n // gather morph attributes, exit early if they're different\n\n if (morphTargetsRelative !== geom.morphTargetsRelative) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. .morphTargetsRelative must be consistent throughout all geometries.',\n )\n return null\n }\n\n for (let name in geom.morphAttributes) {\n if (!morphAttributesUsed.has(name)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. .morphAttributes must be consistent throughout all geometries.',\n )\n return null\n }\n\n if (morphAttributes[name] === undefined) morphAttributes[name] = []\n\n morphAttributes[name].push(geom.morphAttributes[name])\n }\n\n // gather .userData\n\n mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || []\n mergedGeometry.userData.mergedUserData.push(geom.userData)\n\n if (useGroups) {\n let count\n\n if (geom.index) {\n count = geom.index.count\n } else if (geom.attributes.position !== undefined) {\n count = geom.attributes.position.count\n } else {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. The geometry must have either an index or a position attribute',\n )\n return null\n }\n\n mergedGeometry.addGroup(offset, count, i)\n\n offset += count\n }\n })\n\n // merge indices\n\n if (isIndexed) {\n let indexOffset = 0\n const mergedIndex: number[] = []\n\n geometries.forEach((geom) => {\n const index = geom.index as BufferAttribute\n\n for (let j = 0; j < index.count; ++j) {\n mergedIndex.push(index.getX(j) + indexOffset)\n }\n\n indexOffset += geom.attributes.position.count\n })\n\n mergedGeometry.setIndex(mergedIndex)\n }\n\n // merge attributes\n\n for (let name in attributes) {\n const mergedAttribute = mergeBufferAttributes(attributes[name] as BufferAttribute[])\n\n if (!mergedAttribute) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' attribute.',\n )\n return null\n }\n\n mergedGeometry.setAttribute(name, mergedAttribute)\n }\n\n // merge morph attributes\n\n for (let name in morphAttributes) {\n const numMorphTargets = morphAttributes[name][0].length\n\n if (numMorphTargets === 0) break\n\n mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {}\n mergedGeometry.morphAttributes[name] = []\n\n for (let i = 0; i < numMorphTargets; ++i) {\n const morphAttributesToMerge = []\n\n for (let j = 0; j < morphAttributes[name].length; ++j) {\n morphAttributesToMerge.push(morphAttributes[name][j][i])\n }\n\n const mergedMorphAttribute = mergeBufferAttributes(morphAttributesToMerge as BufferAttribute[])\n\n if (!mergedMorphAttribute) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' +\n name +\n ' morphAttribute.',\n )\n return null\n }\n\n mergedGeometry.morphAttributes[name].push(mergedMorphAttribute)\n }\n }\n\n return mergedGeometry\n}\n\n/**\n * @param {Array} attributes\n * @return {BufferAttribute}\n */\nexport const mergeBufferAttributes = (attributes: BufferAttribute[]): BufferAttribute | null | undefined => {\n let TypedArray: TypedArrayConstructors | undefined = undefined\n let itemSize: number | undefined = undefined\n let normalized: boolean | undefined = undefined\n let arrayLength = 0\n\n attributes.forEach((attr) => {\n if (TypedArray === undefined) {\n TypedArray = attr.array.constructor\n }\n if (TypedArray !== attr.array.constructor) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.',\n )\n return null\n }\n\n if (itemSize === undefined) itemSize = attr.itemSize\n if (itemSize !== attr.itemSize) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.',\n )\n return null\n }\n\n if (normalized === undefined) normalized = attr.normalized\n if (normalized !== attr.normalized) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.',\n )\n return null\n }\n\n arrayLength += attr.array.length\n })\n\n if (TypedArray && itemSize) {\n // @ts-ignore this works in JS and TS is complaining but it's such a tiny thing I can live with the guilt\n const array = new TypedArray(arrayLength)\n let offset = 0\n\n attributes.forEach((attr) => {\n array.set(attr.array, offset)\n offset += attr.array.length\n })\n\n return new BufferAttribute(array, itemSize, normalized)\n }\n}\n\n/**\n * @param {Array} attributes\n * @return {Array}\n */\nexport const interleaveAttributes = (attributes: BufferAttribute[]): InterleavedBufferAttribute[] | null => {\n // Interleaves the provided attributes into an InterleavedBuffer and returns\n // a set of InterleavedBufferAttributes for each attribute\n let TypedArray: TypedArrayConstructors | undefined = undefined\n let arrayLength = 0\n let stride = 0\n\n // calculate the the length and type of the interleavedBuffer\n for (let i = 0, l = attributes.length; i < l; ++i) {\n const attribute = attributes[i]\n\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\n arrayLength += attribute.array.length\n stride += attribute.itemSize\n }\n\n // Create the set of buffer attributes\n // @ts-ignore this works in JS and TS is complaining but it's such a tiny thing I can live with the guilt\n const interleavedBuffer = new InterleavedBuffer(new TypedArray(arrayLength), stride)\n let offset = 0\n const res = []\n const getters = ['getX', 'getY', 'getZ', 'getW']\n const setters = ['setX', 'setY', 'setZ', '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 InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized)\n res.push(iba)\n\n offset += itemSize\n\n // Move the data for each attribute into the new interleavedBuffer\n // at the appropriate offset\n for (let c = 0; c < count; c++) {\n for (let k = 0; k < itemSize; k++) {\n const set = getWithKey(iba, setters[k] as keyof InterleavedBufferAttribute) as InterleavedBufferAttribute[\n | 'setX'\n | 'setY'\n | 'setZ'\n | 'setW']\n const get = getWithKey(attribute, getters[k] as keyof BufferAttribute) as BufferAttribute[\n | 'getX'\n | 'getY'\n | 'getZ'\n | 'getW']\n set(c, get(c))\n }\n }\n }\n\n return res\n}\n\n/**\n * @param {Array} geometry\n * @return {number}\n */\nexport function estimateBytesUsed(geometry: BufferGeometry): number {\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 (let name in geometry.attributes) {\n const attr = geometry.getAttribute(name)\n mem += attr.count * attr.itemSize * (attr.array as TypedArray).BYTES_PER_ELEMENT\n }\n\n const indices = geometry.getIndex()\n mem += indices ? indices.count * indices.itemSize * (indices.array as TypedArray).BYTES_PER_ELEMENT : 0\n return mem\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} tolerance\n * @return {BufferGeometry>}\n */\nexport function mergeVertices(geometry: BufferGeometry, tolerance = 1e-4): BufferGeometry {\n tolerance = Math.max(tolerance, Number.EPSILON)\n\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 [key: string]: number\n } = {}\n const indices = geometry.getIndex()\n const positions = geometry.getAttribute('position')\n const vertexCount = indices ? indices.count : positions.count\n\n // next value for triangle indices\n let nextIndex = 0\n\n // attributes and new attribute arrays\n const attributeNames = Object.keys(geometry.attributes)\n const attrArrays: {\n [key: string]: []\n } = {}\n const morphAttrsArrays: {\n [key: string]: Array>\n } = {}\n const newIndices = []\n const getters = ['getX', 'getY', 'getZ', 'getW']\n\n // initialize the arrays\n for (let i = 0, l = attributeNames.length; i < l; i++) {\n const name = attributeNames[i]\n\n attrArrays[name] = []\n\n const morphAttr = geometry.morphAttributes[name]\n if (morphAttr) {\n morphAttrsArrays[name] = new Array(morphAttr.length).fill(0).map(() => [])\n }\n }\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\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\n for (let k = 0; k < itemSize; k++) {\n // double tilde truncates the decimal value\n // @ts-ignore no\n hash += `${~~(attribute[getters[k]](index) * shiftMultiplier)},`\n }\n }\n\n // Add another reference to the vertex if it's already\n // used by another index\n if (hash in hashToIndex) {\n newIndices.push(hashToIndex[hash])\n } else {\n // copy data to the new index in the attribute arrays\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 = attrArrays[name]\n const newMorphArrays = morphAttrsArrays[name]\n\n for (let k = 0; k < itemSize; k++) {\n const getterFunc = getters[k]\n // @ts-ignore\n newarray.push(attribute[getterFunc](index))\n\n if (morphAttr) {\n for (let m = 0, ml = morphAttr.length; m < ml; m++) {\n // @ts-ignore\n newMorphArrays[m].push(morphAttr[m][getterFunc](index))\n }\n }\n }\n }\n\n hashToIndex[hash] = nextIndex\n newIndices.push(nextIndex)\n nextIndex++\n }\n }\n\n // Generate typed arrays from new attribute arrays and update\n // the attributeBuffers\n const result = geometry.clone()\n for (let i = 0, l = attributeNames.length; i < l; i++) {\n const name = attributeNames[i]\n const oldAttribute = geometry.getAttribute(name)\n //@ts-expect-error something to do with functions and constructors and new\n const buffer = new (oldAttribute.array as TypedArray).constructor(attrArrays[name])\n const attribute = new BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized)\n\n result.setAttribute(name, attribute)\n\n // Update the attribute arrays\n if (name in morphAttrsArrays) {\n for (let j = 0; j < morphAttrsArrays[name].length; j++) {\n const oldMorphAttribute = geometry.morphAttributes[name][j]\n //@ts-expect-error something to do with functions and constructors and new\n const buffer = new (oldMorphAttribute.array as TypedArray).constructor(morphAttrsArrays[name][j])\n const morphAttribute = new BufferAttribute(buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized)\n result.morphAttributes[name][j] = morphAttribute\n }\n }\n }\n\n // indices\n\n result.setIndex(newIndices)\n\n return result\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} drawMode\n * @return {BufferGeometry}\n */\nexport function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: number): BufferGeometry {\n if (drawMode === TrianglesDrawMode) {\n console.warn('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.')\n return geometry\n }\n\n if (drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode) {\n let index = geometry.getIndex()\n\n // generate index if not present\n\n if (index === null) {\n const indices = []\n\n const position = geometry.getAttribute('position')\n\n if (position !== undefined) {\n for (let i = 0; i < position.count; i++) {\n indices.push(i)\n }\n\n geometry.setIndex(indices)\n index = geometry.getIndex()\n } else {\n console.error(\n 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.',\n )\n return geometry\n }\n }\n\n //\n\n const numberOfTriangles = (index as BufferAttribute).count - 2\n const newIndices = []\n\n if (index) {\n if (drawMode === TriangleFanDrawMode) {\n // gl.TRIANGLE_FAN\n\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\n for (let i = 0; i < numberOfTriangles; i++) {\n 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 }\n }\n\n if (newIndices.length / 3 !== numberOfTriangles) {\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.')\n }\n\n // build final geometry\n\n const newGeometry = geometry.clone()\n newGeometry.setIndex(newIndices)\n newGeometry.clearGroups()\n\n return newGeometry\n } else {\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode)\n return geometry\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 */\nexport type ComputedMorphedAttribute = {\n positionAttribute: BufferAttribute | InterleavedBufferAttribute\n normalAttribute: BufferAttribute | InterleavedBufferAttribute\n morphedPositionAttribute: Float32BufferAttribute\n morphedNormalAttribute: Float32BufferAttribute\n}\n\nexport function computeMorphedAttributes(object: Mesh | Line | Points): ComputedMorphedAttribute | null {\n if (object.geometry.isBufferGeometry !== true) {\n console.error('THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.')\n return null\n }\n\n const _vA = new Vector3()\n const _vB = new Vector3()\n const _vC = new Vector3()\n\n const _tempA = new Vector3()\n const _tempB = new Vector3()\n const _tempC = new Vector3()\n\n const _morphA = new Vector3()\n const _morphB = new Vector3()\n const _morphC = new Vector3()\n\n function _calculateMorphedAttributeData(\n object: Mesh | Line | Points,\n material: Material,\n attribute: BufferAttribute | InterleavedBufferAttribute,\n morphAttribute: (BufferAttribute | InterleavedBufferAttribute)[],\n morphTargetsRelative: boolean,\n a: number,\n b: number,\n c: number,\n modifiedAttributeArray: Float32Array,\n ): void {\n _vA.fromBufferAttribute(attribute, a)\n _vB.fromBufferAttribute(attribute, b)\n _vC.fromBufferAttribute(attribute, c)\n\n const morphInfluences = object.morphTargetInfluences\n\n if (\n // @ts-ignore\n material.morphTargets &&\n morphAttribute &&\n morphInfluences\n ) {\n _morphA.set(0, 0, 0)\n _morphB.set(0, 0, 0)\n _morphC.set(0, 0, 0)\n\n for (let i = 0, il = morphAttribute.length; i < il; i++) {\n const influence = morphInfluences[i]\n const morph = morphAttribute[i]\n\n if (influence === 0) continue\n\n _tempA.fromBufferAttribute(morph, a)\n _tempB.fromBufferAttribute(morph, b)\n _tempC.fromBufferAttribute(morph, c)\n\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\n _vA.add(_morphA)\n _vB.add(_morphB)\n _vC.add(_morphC)\n }\n\n if ((object as SkinnedMesh).isSkinnedMesh) {\n // @ts-ignore – https://github.com/three-types/three-ts-types/issues/37\n object.boneTransform(a, _vA)\n // @ts-ignore – https://github.com/three-types/three-ts-types/issues/37\n object.boneTransform(b, _vB)\n // @ts-ignore – https://github.com/three-types/three-ts-types/issues/37\n object.boneTransform(c, _vC)\n }\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\n const geometry = object.geometry\n const material = object.material\n\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\n const groups = geometry.groups\n const drawRange = geometry.drawRange\n let i, j, il, jl\n let group, groupMaterial\n let start, end\n\n const modifiedPosition = new Float32Array(positionAttribute.count * positionAttribute.itemSize)\n const modifiedNormal = new Float32Array(normalAttribute.count * normalAttribute.itemSize)\n\n if (index !== null) {\n // indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (i = 0, il = groups.length; i < il; i++) {\n group = groups[i]\n groupMaterial = material[group.materialIndex as number]\n\n start = Math.max(group.start, drawRange.start)\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count)\n\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\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n } else {\n start = Math.max(0, drawRange.start)\n end = Math.min(index.count, drawRange.start + drawRange.count)\n\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\n _calculateMorphedAttributeData(\n object,\n material,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n material,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n } else if (positionAttribute !== undefined) {\n // non-indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (i = 0, il = groups.length; i < il; i++) {\n group = groups[i]\n groupMaterial = material[group.materialIndex as number]\n\n start = Math.max(group.start, drawRange.start)\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count)\n\n for (j = start, jl = end; j < jl; j += 3) {\n a = j\n b = j + 1\n c = j + 2\n\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n } else {\n start = Math.max(0, drawRange.start)\n end = Math.min(positionAttribute.count, drawRange.start + drawRange.count)\n\n for (i = start, il = end; i < il; i += 3) {\n a = i\n b = i + 1\n c = i + 2\n\n _calculateMorphedAttributeData(\n object,\n material,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedPosition,\n )\n\n _calculateMorphedAttributeData(\n object,\n material,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a,\n b,\n c,\n modifiedNormal,\n )\n }\n }\n }\n\n const morphedPositionAttribute = new Float32BufferAttribute(modifiedPosition, 3)\n const morphedNormalAttribute = new Float32BufferAttribute(modifiedNormal, 3)\n\n return {\n positionAttribute: positionAttribute,\n normalAttribute: normalAttribute,\n morphedPositionAttribute: morphedPositionAttribute,\n morphedNormalAttribute: morphedNormalAttribute,\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 * Backwards compatible with code such as @react-three/drei's ``\n * which uses this method to operate on the original geometry.\n *\n * As of this writing, BufferGeometry.toNonIndexed() warns if the geometry is\n * non-indexed and returns `this`, i.e. the same geometry on which it was called:\n * `BufferGeometry is already non-indexed.`\n *\n * @param geometry\n * @param creaseAngle\n */\nexport function toCreasedNormals(geometry: BufferGeometry, creaseAngle = Math.PI / 3 /* 60 degrees */): BufferGeometry {\n const creaseDot = Math.cos(creaseAngle)\n const hashMultiplier = (1 + 1e-10) * 1e2\n\n // reusable vectors\n const verts = [new Vector3(), new Vector3(), new Vector3()]\n const tempVec1 = new Vector3()\n const tempVec2 = new Vector3()\n const tempNorm = new Vector3()\n const tempNorm2 = new Vector3()\n\n // hashes a vector\n function hashVertex(v: Vector3): string {\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\n const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry\n const posAttr = resultGeometry.attributes.position\n const vertexMap: { [key: string]: Vector3[] } = {}\n\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\n tempVec1.subVectors(c, b)\n tempVec2.subVectors(a, b)\n\n // add the normal to the map for all vertices\n const normal = new 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)) {\n vertexMap[hash] = []\n }\n\n vertexMap[hash].push(normal)\n }\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 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\n tempVec1.subVectors(c, b)\n tempVec2.subVectors(a, b)\n\n tempNorm.crossVectors(tempVec1, tempVec2).normalize()\n\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\n for (let k = 0, lk = otherNormals.length; k < lk; k++) {\n const otherNorm = otherNormals[k]\n if (tempNorm.dot(otherNorm) > creaseDot) {\n tempNorm2.add(otherNorm)\n }\n }\n\n tempNorm2.normalize()\n normAttr.setXYZ(i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z)\n }\n }\n\n resultGeometry.setAttribute('normal', normAttr)\n return resultGeometry\n}\n", "import { BufferGeometry, Float32BufferAttribute, Vector3 } from 'three'\nimport * as BufferGeometryUtils from '../utils/BufferGeometryUtils'\n\nconst cb = new Vector3()\nconst ab = new Vector3()\n\nfunction pushIfUnique(array: TItem[], object: TItem): void {\n if (array.indexOf(object) === -1) array.push(object)\n}\n\nfunction removeFromArray(array: TItem[], object: TItem): void {\n const k = array.indexOf(object)\n if (k > -1) array.splice(k, 1)\n}\n\nclass Vertex {\n public position: Vector3\n private id: number\n\n public faces: Triangle[]\n public neighbors: Vertex[]\n\n public collapseCost: number\n public collapseNeighbor: null | Vertex\n\n public minCost: number = 0\n public totalCost: number = 0\n public costCount: number = 0\n\n constructor(v: Vector3, id: number) {\n this.position = v\n this.id = id // old index id\n\n this.faces = [] // faces vertex is connected\n this.neighbors = [] // neighbouring vertices aka \"adjacentVertices\"\n\n // these will be computed in computeEdgeCostAtVertex()\n this.collapseCost = 0 // cost of collapsing this vertex, the less the better. aka objdist\n this.collapseNeighbor = null // best candinate for collapsing\n }\n\n public addUniqueNeighbor(vertex: Vertex): void {\n pushIfUnique(this.neighbors, vertex)\n }\n\n public removeIfNonNeighbor(n: Vertex): void {\n const neighbors = this.neighbors\n const faces = this.faces\n\n const offset = neighbors.indexOf(n)\n if (offset === -1) return\n for (let i = 0; i < faces.length; i++) {\n if (faces[i].hasVertex(n)) return\n }\n\n neighbors.splice(offset, 1)\n }\n}\n\n// we use a triangle class to represent structure of face slightly differently\nclass Triangle {\n private a: number\n private b: number\n private c: Number\n\n public v1: Vertex\n public v2: Vertex\n public v3: Vertex\n\n public normal = new Vector3()\n\n constructor(v1: Vertex, v2: Vertex, v3: Vertex, a: number, b: number, c: number) {\n this.a = a\n this.b = b\n this.c = c\n\n this.v1 = v1\n this.v2 = v2\n this.v3 = v3\n\n this.computeNormal()\n\n v1.faces.push(this)\n v1.addUniqueNeighbor(v2)\n v1.addUniqueNeighbor(v3)\n\n v2.faces.push(this)\n v2.addUniqueNeighbor(v1)\n v2.addUniqueNeighbor(v3)\n\n v3.faces.push(this)\n v3.addUniqueNeighbor(v1)\n v3.addUniqueNeighbor(v2)\n }\n\n private computeNormal(): void {\n const vA = this.v1.position\n const vB = this.v2.position\n const vC = this.v3.position\n\n cb.subVectors(vC, vB)\n ab.subVectors(vA, vB)\n cb.cross(ab).normalize()\n\n this.normal.copy(cb)\n }\n\n public hasVertex(v: Vertex): boolean {\n return v === this.v1 || v === this.v2 || v === this.v3\n }\n\n public replaceVertex(oldv: Vertex, newv: Vertex): void {\n if (oldv === this.v1) this.v1 = newv\n else if (oldv === this.v2) this.v2 = newv\n else if (oldv === this.v3) this.v3 = newv\n\n removeFromArray(oldv.faces, this)\n newv.faces.push(this)\n\n oldv.removeIfNonNeighbor(this.v1)\n this.v1.removeIfNonNeighbor(oldv)\n\n oldv.removeIfNonNeighbor(this.v2)\n this.v2.removeIfNonNeighbor(oldv)\n\n oldv.removeIfNonNeighbor(this.v3)\n this.v3.removeIfNonNeighbor(oldv)\n\n this.v1.addUniqueNeighbor(this.v2)\n this.v1.addUniqueNeighbor(this.v3)\n\n this.v2.addUniqueNeighbor(this.v1)\n this.v2.addUniqueNeighbor(this.v3)\n\n this.v3.addUniqueNeighbor(this.v1)\n this.v3.addUniqueNeighbor(this.v2)\n\n this.computeNormal()\n }\n}\n\n/**\n *\tSimplification Geometry Modifier\n * - based on code and technique\n *\t - by Stan Melax in 1998\n *\t - Progressive Mesh type Polygon Reduction Algorithm\n * - http://www.melax.com/polychop/\n */\n\nclass SimplifyModifier {\n constructor() {}\n\n private computeEdgeCollapseCost = (u: Vertex, v: Vertex): number => {\n // if we collapse edge uv by moving u to v then how\n // much different will the model change, i.e. the \"error\".\n\n const edgelength = v.position.distanceTo(u.position)\n let curvature = 0\n\n const sideFaces = []\n let i,\n il = u.faces.length,\n face,\n sideFace\n\n // find the \"sides\" triangles that are on the edge uv\n for (i = 0; i < il; i++) {\n face = u.faces[i]\n\n if (face.hasVertex(v)) {\n sideFaces.push(face)\n }\n }\n\n // use the triangle facing most away from the sides\n // to determine our curvature term\n for (i = 0; i < il; i++) {\n let minCurvature = 1\n face = u.faces[i]\n\n for (let j = 0; j < sideFaces.length; j++) {\n sideFace = sideFaces[j]\n // use dot product of face normals.\n const dotProd = face.normal.dot(sideFace.normal)\n minCurvature = Math.min(minCurvature, (1.001 - dotProd) / 2)\n }\n\n curvature = Math.max(curvature, minCurvature)\n }\n\n // crude approach in attempt to preserve borders\n // though it seems not to be totally correct\n const borders = 0\n if (sideFaces.length < 2) {\n // we add some arbitrary cost for borders,\n // borders += 10;\n curvature = 1\n }\n\n const amt = edgelength * curvature + borders\n\n return amt\n }\n\n private removeVertex(v: Vertex, vertices: Vertex[]): void {\n console.assert(v.faces.length === 0)\n\n while (v.neighbors.length) {\n const n = v.neighbors.pop() as Vertex\n removeFromArray(n.neighbors, v)\n }\n\n removeFromArray(vertices, v)\n }\n\n private computeEdgeCostAtVertex = (v: Vertex): void => {\n // compute the edge collapse cost for all edges that start\n // from vertex v. Since we are only interested in reducing\n // the object by selecting the min cost edge at each step, we\n // only cache the cost of the least cost edge at this vertex\n // (in member variable collapse) as well as the value of the\n // cost (in member variable collapseCost).\n\n if (v.neighbors.length === 0) {\n // collapse if no neighbors.\n v.collapseNeighbor = null\n v.collapseCost = -0.01\n\n return\n }\n\n v.collapseCost = 100000\n v.collapseNeighbor = null\n\n // search all neighboring edges for \"least cost\" edge\n for (let i = 0; i < v.neighbors.length; i++) {\n const collapseCost = this.computeEdgeCollapseCost(v, v.neighbors[i])\n\n if (!v.collapseNeighbor) {\n v.collapseNeighbor = v.neighbors[i]\n v.collapseCost = collapseCost\n v.minCost = collapseCost\n v.totalCost = 0\n v.costCount = 0\n }\n\n v.costCount++\n v.totalCost += collapseCost\n\n if (collapseCost < v.minCost) {\n v.collapseNeighbor = v.neighbors[i]\n v.minCost = collapseCost\n }\n }\n\n // we average the cost of collapsing at this vertex\n v.collapseCost = v.totalCost / v.costCount\n // v.collapseCost = v.minCost;\n }\n\n private removeFace = (f: Triangle, faces: Triangle[]): void => {\n removeFromArray(faces, f)\n\n if (f.v1) removeFromArray(f.v1.faces, f)\n if (f.v2) removeFromArray(f.v2.faces, f)\n if (f.v3) removeFromArray(f.v3.faces, f)\n\n // TODO optimize this!\n const vs = [f.v1, f.v2, f.v3]\n let v1, v2\n\n for (let i = 0; i < 3; i++) {\n v1 = vs[i]\n v2 = vs[(i + 1) % 3]\n\n if (!v1 || !v2) continue\n\n v1.removeIfNonNeighbor(v2)\n v2.removeIfNonNeighbor(v1)\n }\n }\n\n private collapse = (vertices: Vertex[], faces: Triangle[], u: Vertex, v: Vertex): void => {\n // u and v are pointers to vertices of an edge\n\n // Collapse the edge uv by moving vertex u onto v\n\n if (!v) {\n // u is a vertex all by itself so just delete it..\n this.removeVertex(u, vertices)\n return\n }\n\n let i\n const tmpVertices = []\n\n for (i = 0; i < u.neighbors.length; i++) {\n tmpVertices.push(u.neighbors[i])\n }\n\n // delete triangles on edge uv:\n for (i = u.faces.length - 1; i >= 0; i--) {\n if (u.faces[i].hasVertex(v)) {\n this.removeFace(u.faces[i], faces)\n }\n }\n\n // update remaining triangles to have v instead of u\n for (i = u.faces.length - 1; i >= 0; i--) {\n u.faces[i].replaceVertex(u, v)\n }\n\n this.removeVertex(u, vertices)\n\n // recompute the edge collapse costs in neighborhood\n for (i = 0; i < tmpVertices.length; i++) {\n this.computeEdgeCostAtVertex(tmpVertices[i])\n }\n }\n\n private minimumCostEdge = (vertices: Vertex[]): Vertex => {\n // O(n * n) approach. TODO optimize this\n\n let least = vertices[0]\n\n for (let i = 0; i < vertices.length; i++) {\n if (vertices[i].collapseCost < least.collapseCost) {\n least = vertices[i]\n }\n }\n\n return least\n }\n\n public modify = (geometry: BufferGeometry, count: number): BufferGeometry => {\n geometry = geometry.clone()\n const attributes = geometry.attributes\n\n // this modifier can only process indexed and non-indexed geomtries with a position attribute\n\n for (let name in attributes) {\n if (name !== 'position') geometry.deleteAttribute(name)\n }\n\n geometry = BufferGeometryUtils.mergeVertices(geometry)\n\n //\n // put data of original geometry in different data structures\n //\n\n const vertices = []\n const faces = []\n\n // add vertices\n\n const positionAttribute = geometry.getAttribute('position')\n\n for (let i = 0; i < positionAttribute.count; i++) {\n const v = new Vector3().fromBufferAttribute(positionAttribute, i)\n\n const vertex = new Vertex(v, i)\n vertices.push(vertex)\n }\n\n // add faces\n\n const geomIndex = geometry.getIndex()\n\n if (geomIndex !== null) {\n for (let i = 0; i < geomIndex.count; i += 3) {\n const a = geomIndex.getX(i)\n const b = geomIndex.getX(i + 1)\n const c = geomIndex.getX(i + 2)\n\n const triangle = new Triangle(vertices[a], vertices[b], vertices[c], a, b, c)\n faces.push(triangle)\n }\n } else {\n for (let i = 0; i < positionAttribute.count; i += 3) {\n const a = i\n const b = i + 1\n const c = i + 2\n\n const triangle = new Triangle(vertices[a], vertices[b], vertices[c], a, b, c)\n faces.push(triangle)\n }\n }\n\n // compute all edge collapse costs\n\n for (let i = 0, il = vertices.length; i < il; i++) {\n this.computeEdgeCostAtVertex(vertices[i])\n }\n\n let nextVertex\n\n let z = count\n\n while (z--) {\n nextVertex = this.minimumCostEdge(vertices)\n\n if (!nextVertex) {\n console.log('THREE.SimplifyModifier: No next vertex')\n break\n } else {\n this.collapse(vertices, faces, nextVertex, nextVertex.collapseNeighbor as Vertex)\n }\n }\n\n //\n\n const simplifiedGeometry = new BufferGeometry()\n const position = []\n let index = []\n\n //\n\n for (let i = 0; i < vertices.length; i++) {\n const vertex = vertices[i].position\n position.push(vertex.x, vertex.y, vertex.z)\n }\n\n //\n\n for (let i = 0; i < faces.length; i++) {\n const face = faces[i]\n\n const a = vertices.indexOf(face.v1)\n const b = vertices.indexOf(face.v2)\n const c = vertices.indexOf(face.v3)\n\n index.push(a, b, c)\n }\n\n //\n\n simplifiedGeometry.setAttribute('position', new Float32BufferAttribute(position, 3))\n simplifiedGeometry.setIndex(index)\n\n return simplifiedGeometry\n }\n}\n\nexport { SimplifyModifier }\n", "import { REVISION } from 'three'\n\nexport const version = parseInt(REVISION.replace(/\\D+/g, ''))\n", "import {\n REVISION,\n BufferAttribute,\n ClampToEdgeWrapping,\n Color,\n DoubleSide,\n InterpolateDiscrete,\n InterpolateLinear,\n LinearFilter,\n LinearMipmapLinearFilter,\n LinearMipmapNearestFilter,\n MathUtils,\n Matrix4,\n MirroredRepeatWrapping,\n NearestFilter,\n NearestMipmapLinearFilter,\n NearestMipmapNearestFilter,\n PropertyBinding,\n RGBAFormat,\n RepeatWrapping,\n Scene,\n Texture,\n CompressedTexture,\n Vector3,\n PlaneGeometry,\n ShaderMaterial,\n Uniform,\n Mesh,\n PerspectiveCamera,\n WebGLRenderer,\n} from 'three'\nimport { version } from '../_polyfill/constants'\n\nasync function readAsDataURL(blob) {\n const buffer = await blob.arrayBuffer()\n const data = btoa(String.fromCharCode(...new Uint8Array(buffer)))\n return `data:${blob.type || ''};base64,${data}`\n}\n\nlet _renderer\nlet fullscreenQuadGeometry\nlet fullscreenQuadMaterial\nlet fullscreenQuad\n\nfunction decompress(texture, maxTextureSize = Infinity, renderer = null) {\n if (!fullscreenQuadGeometry) fullscreenQuadGeometry = new PlaneGeometry(2, 2, 1, 1)\n if (!fullscreenQuadMaterial)\n fullscreenQuadMaterial = new ShaderMaterial({\n uniforms: { blitTexture: new Uniform(texture) },\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = vec4(position.xy * 1.0,0.,.999999);\n }\n `,\n fragmentShader: /* glsl */ `\n uniform sampler2D blitTexture; \n varying vec2 vUv;\n\n void main(){ \n gl_FragColor = vec4(vUv.xy, 0, 1);\n \n #ifdef IS_SRGB\n gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n #else\n gl_FragColor = texture2D( blitTexture, vUv);\n #endif\n }\n `,\n })\n\n fullscreenQuadMaterial.uniforms.blitTexture.value = texture\n fullscreenQuadMaterial.defines.IS_SRGB =\n 'colorSpace' in texture ? texture.colorSpace === 'srgb' : texture.encoding === 3001\n fullscreenQuadMaterial.needsUpdate = true\n\n if (!fullscreenQuad) {\n fullscreenQuad = new Mesh(fullscreenQuadGeometry, fullscreenQuadMaterial)\n fullscreenQuad.frustrumCulled = false\n }\n\n const _camera = new PerspectiveCamera()\n const _scene = new Scene()\n _scene.add(fullscreenQuad)\n\n if (!renderer) {\n renderer = _renderer = new WebGLRenderer({ antialias: false })\n }\n\n renderer.setSize(Math.min(texture.image.width, maxTextureSize), Math.min(texture.image.height, maxTextureSize))\n renderer.clear()\n renderer.render(_scene, _camera)\n\n const readableTexture = new Texture(renderer.domElement)\n\n readableTexture.minFilter = texture.minFilter\n readableTexture.magFilter = texture.magFilter\n readableTexture.wrapS = texture.wrapS\n readableTexture.wrapT = texture.wrapT\n readableTexture.name = texture.name\n\n if (_renderer) {\n _renderer.dispose()\n _renderer = null\n }\n\n return readableTexture\n}\n\n/**\n * The KHR_mesh_quantization extension allows these extra attribute component types\n *\n * @see https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md#extending-mesh-attributes\n */\nconst KHR_mesh_quantization_ExtraAttrTypes = {\n POSITION: [\n 'byte',\n 'byte normalized',\n 'unsigned byte',\n 'unsigned byte normalized',\n 'short',\n 'short normalized',\n 'unsigned short',\n 'unsigned short normalized',\n ],\n NORMAL: ['byte normalized', 'short normalized'],\n TANGENT: ['byte normalized', 'short normalized'],\n TEXCOORD: ['byte', 'byte normalized', 'unsigned byte', 'short', 'short normalized', 'unsigned short'],\n}\n\nclass GLTFExporter {\n /**\n * Static utility functions\n */\n static Utils = {\n insertKeyframe: function (track, time) {\n const tolerance = 0.001 // 1ms\n const valueSize = track.getValueSize()\n\n const times = new track.TimeBufferType(track.times.length + 1)\n const values = new track.ValueBufferType(track.values.length + valueSize)\n const interpolant = track.createInterpolant(new track.ValueBufferType(valueSize))\n\n let index\n\n if (track.times.length === 0) {\n times[0] = time\n\n for (let i = 0; i < valueSize; i++) {\n values[i] = 0\n }\n\n index = 0\n } else if (time < track.times[0]) {\n if (Math.abs(track.times[0] - time) < tolerance) return 0\n\n times[0] = time\n times.set(track.times, 1)\n\n values.set(interpolant.evaluate(time), 0)\n values.set(track.values, valueSize)\n\n index = 0\n } else if (time > track.times[track.times.length - 1]) {\n if (Math.abs(track.times[track.times.length - 1] - time) < tolerance) {\n return track.times.length - 1\n }\n\n times[times.length - 1] = time\n times.set(track.times, 0)\n\n values.set(track.values, 0)\n values.set(interpolant.evaluate(time), track.values.length)\n\n index = times.length - 1\n } else {\n for (let i = 0; i < track.times.length; i++) {\n if (Math.abs(track.times[i] - time) < tolerance) return i\n\n if (track.times[i] < time && track.times[i + 1] > time) {\n times.set(track.times.slice(0, i + 1), 0)\n times[i + 1] = time\n times.set(track.times.slice(i + 1), i + 2)\n\n values.set(track.values.slice(0, (i + 1) * valueSize), 0)\n values.set(interpolant.evaluate(time), (i + 1) * valueSize)\n values.set(track.values.slice((i + 1) * valueSize), (i + 2) * valueSize)\n\n index = i + 1\n\n break\n }\n }\n }\n\n track.times = times\n track.values = values\n\n return index\n },\n\n mergeMorphTargetTracks: function (clip, root) {\n const tracks = []\n const mergedTracks = {}\n const sourceTracks = clip.tracks\n\n for (let i = 0; i < sourceTracks.length; ++i) {\n let sourceTrack = sourceTracks[i]\n const sourceTrackBinding = PropertyBinding.parseTrackName(sourceTrack.name)\n const sourceTrackNode = PropertyBinding.findNode(root, sourceTrackBinding.nodeName)\n\n if (\n sourceTrackBinding.propertyName !== 'morphTargetInfluences' ||\n sourceTrackBinding.propertyIndex === undefined\n ) {\n // Tracks that don't affect morph targets, or that affect all morph targets together, can be left as-is.\n tracks.push(sourceTrack)\n continue\n }\n\n if (\n sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodDiscrete &&\n sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodLinear\n ) {\n if (sourceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {\n // This should never happen, because glTF morph target animations\n // affect all targets already.\n throw new Error('THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.')\n }\n\n console.warn('THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.')\n\n sourceTrack = sourceTrack.clone()\n sourceTrack.setInterpolation(InterpolateLinear)\n }\n\n const targetCount = sourceTrackNode.morphTargetInfluences.length\n const targetIndex = sourceTrackNode.morphTargetDictionary[sourceTrackBinding.propertyIndex]\n\n if (targetIndex === undefined) {\n throw new Error('THREE.GLTFExporter: Morph target name not found: ' + sourceTrackBinding.propertyIndex)\n }\n\n let mergedTrack\n\n // If this is the first time we've seen this object, create a new\n // track to store merged keyframe data for each morph target.\n if (mergedTracks[sourceTrackNode.uuid] === undefined) {\n mergedTrack = sourceTrack.clone()\n\n const values = new mergedTrack.ValueBufferType(targetCount * mergedTrack.times.length)\n\n for (let j = 0; j < mergedTrack.times.length; j++) {\n values[j * targetCount + targetIndex] = mergedTrack.values[j]\n }\n\n // We need to take into consideration the intended target node\n // of our original un-merged morphTarget animation.\n mergedTrack.name = (sourceTrackBinding.nodeName || '') + '.morphTargetInfluences'\n mergedTrack.values = values\n\n mergedTracks[sourceTrackNode.uuid] = mergedTrack\n tracks.push(mergedTrack)\n\n continue\n }\n\n const sourceInterpolant = sourceTrack.createInterpolant(new sourceTrack.ValueBufferType(1))\n\n mergedTrack = mergedTracks[sourceTrackNode.uuid]\n\n // For every existing keyframe of the merged track, write a (possibly\n // interpolated) value from the source track.\n for (let j = 0; j < mergedTrack.times.length; j++) {\n mergedTrack.values[j * targetCount + targetIndex] = sourceInterpolant.evaluate(mergedTrack.times[j])\n }\n\n // For every existing keyframe of the source track, write a (possibly\n // new) keyframe to the merged track. Values from the previous loop may\n // be written again, but keyframes are de-duplicated.\n for (let j = 0; j < sourceTrack.times.length; j++) {\n const keyframeIndex = this.insertKeyframe(mergedTrack, sourceTrack.times[j])\n mergedTrack.values[keyframeIndex * targetCount + targetIndex] = sourceTrack.values[j]\n }\n }\n\n clip.tracks = tracks\n\n return clip\n },\n }\n\n constructor() {\n this.pluginCallbacks = []\n\n this.register(function (writer) {\n return new GLTFLightExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsUnlitExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsTransmissionExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsVolumeExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsIorExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsSpecularExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsClearcoatExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsIridescenceExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsSheenExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsAnisotropyExtension(writer)\n })\n\n this.register(function (writer) {\n return new GLTFMaterialsEmissiveStrengthExtension(writer)\n })\n }\n\n register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) {\n this.pluginCallbacks.push(callback)\n }\n\n return this\n }\n\n unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) {\n this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1)\n }\n\n return this\n }\n\n /**\n * Parse scenes and generate GLTF output\n * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes\n * @param {Function} onDone Callback on completed\n * @param {Function} onError Callback on errors\n * @param {Object} options options\n */\n parse(input, onDone, onError, options) {\n const writer = new GLTFWriter()\n const plugins = []\n\n for (let i = 0, il = this.pluginCallbacks.length; i < il; i++) {\n plugins.push(this.pluginCallbacks[i](writer))\n }\n\n writer.setPlugins(plugins)\n writer.write(input, onDone, options).catch(onError)\n }\n\n parseAsync(input, options) {\n const scope = this\n\n return new Promise(function (resolve, reject) {\n scope.parse(input, resolve, reject, options)\n })\n }\n}\n\n//------------------------------------------------------------------------------\n// Constants\n//------------------------------------------------------------------------------\n\nconst WEBGL_CONSTANTS = {\n POINTS: 0x0000,\n LINES: 0x0001,\n LINE_LOOP: 0x0002,\n LINE_STRIP: 0x0003,\n TRIANGLES: 0x0004,\n TRIANGLE_STRIP: 0x0005,\n TRIANGLE_FAN: 0x0006,\n\n BYTE: 0x1400,\n UNSIGNED_BYTE: 0x1401,\n SHORT: 0x1402,\n UNSIGNED_SHORT: 0x1403,\n INT: 0x1404,\n UNSIGNED_INT: 0x1405,\n FLOAT: 0x1406,\n\n ARRAY_BUFFER: 0x8892,\n ELEMENT_ARRAY_BUFFER: 0x8893,\n\n NEAREST: 0x2600,\n LINEAR: 0x2601,\n NEAREST_MIPMAP_NEAREST: 0x2700,\n LINEAR_MIPMAP_NEAREST: 0x2701,\n NEAREST_MIPMAP_LINEAR: 0x2702,\n LINEAR_MIPMAP_LINEAR: 0x2703,\n\n CLAMP_TO_EDGE: 33071,\n MIRRORED_REPEAT: 33648,\n REPEAT: 10497,\n}\n\nconst KHR_MESH_QUANTIZATION = 'KHR_mesh_quantization'\n\nconst THREE_TO_WEBGL = {}\n\nTHREE_TO_WEBGL[NearestFilter] = WEBGL_CONSTANTS.NEAREST\nTHREE_TO_WEBGL[NearestMipmapNearestFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST\nTHREE_TO_WEBGL[NearestMipmapLinearFilter] = WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR\nTHREE_TO_WEBGL[LinearFilter] = WEBGL_CONSTANTS.LINEAR\nTHREE_TO_WEBGL[LinearMipmapNearestFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST\nTHREE_TO_WEBGL[LinearMipmapLinearFilter] = WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR\n\nTHREE_TO_WEBGL[ClampToEdgeWrapping] = WEBGL_CONSTANTS.CLAMP_TO_EDGE\nTHREE_TO_WEBGL[RepeatWrapping] = WEBGL_CONSTANTS.REPEAT\nTHREE_TO_WEBGL[MirroredRepeatWrapping] = WEBGL_CONSTANTS.MIRRORED_REPEAT\n\nconst PATH_PROPERTIES = {\n scale: 'scale',\n position: 'translation',\n quaternion: 'rotation',\n morphTargetInfluences: 'weights',\n}\n\nconst DEFAULT_SPECULAR_COLOR = new Color()\n\n// GLB constants\n// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification\n\nconst GLB_HEADER_BYTES = 12\nconst GLB_HEADER_MAGIC = 0x46546c67\nconst GLB_VERSION = 2\n\nconst GLB_CHUNK_PREFIX_BYTES = 8\nconst GLB_CHUNK_TYPE_JSON = 0x4e4f534a\nconst GLB_CHUNK_TYPE_BIN = 0x004e4942\n\n//------------------------------------------------------------------------------\n// Utility functions\n//------------------------------------------------------------------------------\n\n/**\n * Compare two arrays\n * @param {Array} array1 Array 1 to compare\n * @param {Array} array2 Array 2 to compare\n * @return {Boolean} Returns true if both arrays are equal\n */\nfunction equalArray(array1, array2) {\n return (\n array1.length === array2.length &&\n array1.every(function (element, index) {\n return element === array2[index]\n })\n )\n}\n\n/**\n * Converts a string to an ArrayBuffer.\n * @param {string} text\n * @return {ArrayBuffer}\n */\nfunction stringToArrayBuffer(text) {\n return new TextEncoder().encode(text).buffer\n}\n\n/**\n * Is identity matrix\n *\n * @param {Matrix4} matrix\n * @returns {Boolean} Returns true, if parameter is identity matrix\n */\nfunction isIdentityMatrix(matrix) {\n return equalArray(matrix.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])\n}\n\n/**\n * Get the min and max vectors from the given attribute\n * @param {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count\n * @param {Integer} start\n * @param {Integer} count\n * @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components)\n */\nfunction getMinMax(attribute, start, count) {\n const output = {\n min: new Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),\n max: new Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY),\n }\n\n for (let i = start; i < start + count; i++) {\n for (let a = 0; a < attribute.itemSize; a++) {\n let value\n\n if (attribute.itemSize > 4) {\n // no support for interleaved data for itemSize > 4\n\n value = attribute.array[i * attribute.itemSize + a]\n } else {\n if (a === 0) value = attribute.getX(i)\n else if (a === 1) value = attribute.getY(i)\n else if (a === 2) value = attribute.getZ(i)\n else if (a === 3) value = attribute.getW(i)\n\n if (attribute.normalized === true) {\n value = MathUtils.normalize(value, attribute.array)\n }\n }\n\n output.min[a] = Math.min(output.min[a], value)\n output.max[a] = Math.max(output.max[a], value)\n }\n }\n\n return output\n}\n\n/**\n * Get the required size + padding for a buffer, rounded to the next 4-byte boundary.\n * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#data-alignment\n *\n * @param {Integer} bufferSize The size the original buffer.\n * @returns {Integer} new buffer size with required padding.\n *\n */\nfunction getPaddedBufferSize(bufferSize) {\n return Math.ceil(bufferSize / 4) * 4\n}\n\n/**\n * Returns a buffer aligned to 4-byte boundary.\n *\n * @param {ArrayBuffer} arrayBuffer Buffer to pad\n * @param {Integer} paddingByte (Optional)\n * @returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer\n */\nfunction getPaddedArrayBuffer(arrayBuffer, paddingByte = 0) {\n const paddedLength = getPaddedBufferSize(arrayBuffer.byteLength)\n\n if (paddedLength !== arrayBuffer.byteLength) {\n const array = new Uint8Array(paddedLength)\n array.set(new Uint8Array(arrayBuffer))\n\n if (paddingByte !== 0) {\n for (let i = arrayBuffer.byteLength; i < paddedLength; i++) {\n array[i] = paddingByte\n }\n }\n\n return array.buffer\n }\n\n return arrayBuffer\n}\n\nfunction getCanvas() {\n if (typeof document === 'undefined' && typeof OffscreenCanvas !== 'undefined') {\n return new OffscreenCanvas(1, 1)\n }\n\n return document.createElement('canvas')\n}\n\nfunction getToBlobPromise(canvas, mimeType) {\n if (canvas.toBlob !== undefined) {\n return new Promise((resolve) => canvas.toBlob(resolve, mimeType))\n }\n\n let quality\n\n // Blink's implementation of convertToBlob seems to default to a quality level of 100%\n // Use the Blink default quality levels of toBlob instead so that file sizes are comparable.\n if (mimeType === 'image/jpeg') {\n quality = 0.92\n } else if (mimeType === 'image/webp') {\n quality = 0.8\n }\n\n return canvas.convertToBlob({\n type: mimeType,\n quality: quality,\n })\n}\n\n/**\n * Writer\n */\nclass GLTFWriter {\n constructor() {\n this.plugins = []\n\n this.options = {}\n this.pending = []\n this.buffers = []\n\n this.byteOffset = 0\n this.buffers = []\n this.nodeMap = new Map()\n this.skins = []\n\n this.extensionsUsed = {}\n this.extensionsRequired = {}\n\n this.uids = new Map()\n this.uid = 0\n\n this.json = {\n asset: {\n version: '2.0',\n generator: 'THREE.GLTFExporter',\n },\n }\n\n this.cache = {\n meshes: new Map(),\n attributes: new Map(),\n attributesNormalized: new Map(),\n materials: new Map(),\n textures: new Map(),\n images: new Map(),\n }\n }\n\n setPlugins(plugins) {\n this.plugins = plugins\n }\n\n /**\n * Parse scenes and generate GLTF output\n * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes\n * @param {Function} onDone Callback on completed\n * @param {Object} options options\n */\n async write(input, onDone, options = {}) {\n this.options = Object.assign(\n {\n // default options\n binary: false,\n trs: false,\n onlyVisible: true,\n maxTextureSize: Infinity,\n animations: [],\n includeCustomExtensions: false,\n },\n options,\n )\n\n if (this.options.animations.length > 0) {\n // Only TRS properties, and not matrices, may be targeted by animation.\n this.options.trs = true\n }\n\n this.processInput(input)\n\n await Promise.all(this.pending)\n\n const writer = this\n const buffers = writer.buffers\n const json = writer.json\n options = writer.options\n\n const extensionsUsed = writer.extensionsUsed\n const extensionsRequired = writer.extensionsRequired\n\n // Merge buffers.\n const blob = new Blob(buffers, { type: 'application/octet-stream' })\n\n // Declare extensions.\n const extensionsUsedList = Object.keys(extensionsUsed)\n const extensionsRequiredList = Object.keys(extensionsRequired)\n\n if (extensionsUsedList.length > 0) json.extensionsUsed = extensionsUsedList\n if (extensionsRequiredList.length > 0) json.extensionsRequired = extensionsRequiredList\n\n // Update bytelength of the single buffer.\n if (json.buffers && json.buffers.length > 0) json.buffers[0].byteLength = blob.size\n\n if (options.binary === true) {\n // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification\n\n blob.arrayBuffer().then((result) => {\n // Binary chunk.\n const binaryChunk = getPaddedArrayBuffer(result)\n const binaryChunkPrefix = new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES))\n binaryChunkPrefix.setUint32(0, binaryChunk.byteLength, true)\n binaryChunkPrefix.setUint32(4, GLB_CHUNK_TYPE_BIN, true)\n\n // JSON chunk.\n const jsonChunk = getPaddedArrayBuffer(stringToArrayBuffer(JSON.stringify(json)), 0x20)\n const jsonChunkPrefix = new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES))\n jsonChunkPrefix.setUint32(0, jsonChunk.byteLength, true)\n jsonChunkPrefix.setUint32(4, GLB_CHUNK_TYPE_JSON, true)\n\n // GLB header.\n const header = new ArrayBuffer(GLB_HEADER_BYTES)\n const headerView = new DataView(header)\n headerView.setUint32(0, GLB_HEADER_MAGIC, true)\n headerView.setUint32(4, GLB_VERSION, true)\n const totalByteLength =\n GLB_HEADER_BYTES +\n jsonChunkPrefix.byteLength +\n jsonChunk.byteLength +\n binaryChunkPrefix.byteLength +\n binaryChunk.byteLength\n headerView.setUint32(8, totalByteLength, true)\n\n const glbBlob = new Blob([header, jsonChunkPrefix, jsonChunk, binaryChunkPrefix, binaryChunk], {\n type: 'application/octet-stream',\n })\n\n glbBlob.arrayBuffer().then(onDone)\n })\n } else {\n if (json.buffers && json.buffers.length > 0) {\n readAsDataURL(blob).then((uri) => {\n json.buffers[0].uri = uri\n onDone(json)\n })\n } else {\n onDone(json)\n }\n }\n }\n\n /**\n * Serializes a userData.\n *\n * @param {THREE.Object3D|THREE.Material} object\n * @param {Object} objectDef\n */\n serializeUserData(object, objectDef) {\n if (Object.keys(object.userData).length === 0) return\n\n const options = this.options\n const extensionsUsed = this.extensionsUsed\n\n try {\n const json = JSON.parse(JSON.stringify(object.userData))\n\n if (options.includeCustomExtensions && json.gltfExtensions) {\n if (objectDef.extensions === undefined) objectDef.extensions = {}\n\n for (const extensionName in json.gltfExtensions) {\n objectDef.extensions[extensionName] = json.gltfExtensions[extensionName]\n extensionsUsed[extensionName] = true\n }\n\n delete json.gltfExtensions\n }\n\n if (Object.keys(json).length > 0) objectDef.extras = json\n } catch (error) {\n console.warn(\n \"THREE.GLTFExporter: userData of '\" +\n object.name +\n \"' \" +\n \"won't be serialized because of JSON.stringify error - \" +\n error.message,\n )\n }\n }\n\n /**\n * Returns ids for buffer attributes.\n * @param {Object} object\n * @return {Integer}\n */\n getUID(attribute, isRelativeCopy = false) {\n if (this.uids.has(attribute) === false) {\n const uids = new Map()\n\n uids.set(true, this.uid++)\n uids.set(false, this.uid++)\n\n this.uids.set(attribute, uids)\n }\n\n const uids = this.uids.get(attribute)\n\n return uids.get(isRelativeCopy)\n }\n\n /**\n * Checks if normal attribute values are normalized.\n *\n * @param {BufferAttribute} normal\n * @returns {Boolean}\n */\n isNormalizedNormalAttribute(normal) {\n const cache = this.cache\n\n if (cache.attributesNormalized.has(normal)) return false\n\n const v = new Vector3()\n\n for (let i = 0, il = normal.count; i < il; i++) {\n // 0.0005 is from glTF-validator\n if (Math.abs(v.fromBufferAttribute(normal, i).length() - 1.0) > 0.0005) return false\n }\n\n return true\n }\n\n /**\n * Creates normalized normal buffer attribute.\n *\n * @param {BufferAttribute} normal\n * @returns {BufferAttribute}\n *\n */\n createNormalizedNormalAttribute(normal) {\n const cache = this.cache\n\n if (cache.attributesNormalized.has(normal)) return cache.attributesNormalized.get(normal)\n\n const attribute = normal.clone()\n const v = new Vector3()\n\n for (let i = 0, il = attribute.count; i < il; i++) {\n v.fromBufferAttribute(attribute, i)\n\n if (v.x === 0 && v.y === 0 && v.z === 0) {\n // if values can't be normalized set (1, 0, 0)\n v.setX(1.0)\n } else {\n v.normalize()\n }\n\n attribute.setXYZ(i, v.x, v.y, v.z)\n }\n\n cache.attributesNormalized.set(normal, attribute)\n\n return attribute\n }\n\n /**\n * Applies a texture transform, if present, to the map definition. Requires\n * the KHR_texture_transform extension.\n *\n * @param {Object} mapDef\n * @param {THREE.Texture} texture\n */\n applyTextureTransform(mapDef, texture) {\n let didTransform = false\n const transformDef = {}\n\n if (texture.offset.x !== 0 || texture.offset.y !== 0) {\n transformDef.offset = texture.offset.toArray()\n didTransform = true\n }\n\n if (texture.rotation !== 0) {\n transformDef.rotation = texture.rotation\n didTransform = true\n }\n\n if (texture.repeat.x !== 1 || texture.repeat.y !== 1) {\n transformDef.scale = texture.repeat.toArray()\n didTransform = true\n }\n\n if (didTransform) {\n mapDef.extensions = mapDef.extensions || {}\n mapDef.extensions['KHR_texture_transform'] = transformDef\n this.extensionsUsed['KHR_texture_transform'] = true\n }\n }\n\n buildMetalRoughTexture(metalnessMap, roughnessMap) {\n if (metalnessMap === roughnessMap) return metalnessMap\n\n function getEncodingConversion(map) {\n if ('colorSpace' in map ? map.colorSpace === 'srgb' : map.encoding === 3001) {\n return function SRGBToLinear(c) {\n return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4)\n }\n }\n\n return function LinearToLinear(c) {\n return c\n }\n }\n\n console.warn('THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.')\n\n if (metalnessMap instanceof CompressedTexture) {\n metalnessMap = decompress(metalnessMap)\n }\n\n if (roughnessMap instanceof CompressedTexture) {\n roughnessMap = decompress(roughnessMap)\n }\n\n const metalness = metalnessMap ? metalnessMap.image : null\n const roughness = roughnessMap ? roughnessMap.image : null\n\n const width = Math.max(metalness ? metalness.width : 0, roughness ? roughness.width : 0)\n const height = Math.max(metalness ? metalness.height : 0, roughness ? roughness.height : 0)\n\n const canvas = getCanvas()\n canvas.width = width\n canvas.height = height\n\n const context = canvas.getContext('2d')\n context.fillStyle = '#00ffff'\n context.fillRect(0, 0, width, height)\n\n const composite = context.getImageData(0, 0, width, height)\n\n if (metalness) {\n context.drawImage(metalness, 0, 0, width, height)\n\n const convert = getEncodingConversion(metalnessMap)\n const data = context.getImageData(0, 0, width, height).data\n\n for (let i = 2; i < data.length; i += 4) {\n composite.data[i] = convert(data[i] / 256) * 256\n }\n }\n\n if (roughness) {\n context.drawImage(roughness, 0, 0, width, height)\n\n const convert = getEncodingConversion(roughnessMap)\n const data = context.getImageData(0, 0, width, height).data\n\n for (let i = 1; i < data.length; i += 4) {\n composite.data[i] = convert(data[i] / 256) * 256\n }\n }\n\n context.putImageData(composite, 0, 0)\n\n //\n\n const reference = metalnessMap || roughnessMap\n\n const texture = reference.clone()\n\n // TODO Use new Source() instead?\n texture.source = new Texture(canvas).source\n if ('colorSpace' in texture) texture.colorSpace = ''\n else texture.encoding = 3000\n texture.channel = (metalnessMap || roughnessMap).channel\n\n if (metalnessMap && roughnessMap && metalnessMap.channel !== roughnessMap.channel) {\n console.warn('THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match.')\n }\n\n return texture\n }\n\n /**\n * Process a buffer to append to the default one.\n * @param {ArrayBuffer} buffer\n * @return {Integer}\n */\n processBuffer(buffer) {\n const json = this.json\n const buffers = this.buffers\n\n if (!json.buffers) json.buffers = [{ byteLength: 0 }]\n\n // All buffers are merged before export.\n buffers.push(buffer)\n\n return 0\n }\n\n /**\n * Process and generate a BufferView\n * @param {BufferAttribute} attribute\n * @param {number} componentType\n * @param {number} start\n * @param {number} count\n * @param {number} target (Optional) Target usage of the BufferView\n * @return {Object}\n */\n processBufferView(attribute, componentType, start, count, target) {\n const json = this.json\n\n if (!json.bufferViews) json.bufferViews = []\n\n // Create a new dataview and dump the attribute's array into it\n\n let componentSize\n\n switch (componentType) {\n case WEBGL_CONSTANTS.BYTE:\n case WEBGL_CONSTANTS.UNSIGNED_BYTE:\n componentSize = 1\n\n break\n\n case WEBGL_CONSTANTS.SHORT:\n case WEBGL_CONSTANTS.UNSIGNED_SHORT:\n componentSize = 2\n\n break\n\n default:\n componentSize = 4\n }\n\n const byteLength = getPaddedBufferSize(count * attribute.itemSize * componentSize)\n const dataView = new DataView(new ArrayBuffer(byteLength))\n let offset = 0\n\n for (let i = start; i < start + count; i++) {\n for (let a = 0; a < attribute.itemSize; a++) {\n let value\n\n if (attribute.itemSize > 4) {\n // no support for interleaved data for itemSize > 4\n\n value = attribute.array[i * attribute.itemSize + a]\n } else {\n if (a === 0) value = attribute.getX(i)\n else if (a === 1) value = attribute.getY(i)\n else if (a === 2) value = attribute.getZ(i)\n else if (a === 3) value = attribute.getW(i)\n\n if (attribute.normalized === true) {\n value = MathUtils.normalize(value, attribute.array)\n }\n }\n\n if (componentType === WEBGL_CONSTANTS.FLOAT) {\n dataView.setFloat32(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.INT) {\n dataView.setInt32(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.UNSIGNED_INT) {\n dataView.setUint32(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.SHORT) {\n dataView.setInt16(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.UNSIGNED_SHORT) {\n dataView.setUint16(offset, value, true)\n } else if (componentType === WEBGL_CONSTANTS.BYTE) {\n dataView.setInt8(offset, value)\n } else if (componentType === WEBGL_CONSTANTS.UNSIGNED_BYTE) {\n dataView.setUint8(offset, value)\n }\n\n offset += componentSize\n }\n }\n\n const bufferViewDef = {\n buffer: this.processBuffer(dataView.buffer),\n byteOffset: this.byteOffset,\n byteLength: byteLength,\n }\n\n if (target !== undefined) bufferViewDef.target = target\n\n if (target === WEBGL_CONSTANTS.ARRAY_BUFFER) {\n // Only define byteStride for vertex attributes.\n bufferViewDef.byteStride = attribute.itemSize * componentSize\n }\n\n this.byteOffset += byteLength\n\n json.bufferViews.push(bufferViewDef)\n\n // @TODO Merge bufferViews where possible.\n const output = {\n id: json.bufferViews.length - 1,\n byteLength: 0,\n }\n\n return output\n }\n\n /**\n * Process and generate a BufferView from an image Blob.\n * @param {Blob} blob\n * @return {Promise}\n */\n processBufferViewImage(blob) {\n const writer = this\n const json = writer.json\n\n if (!json.bufferViews) json.bufferViews = []\n\n return blob.arrayBuffer().then((result) => {\n const buffer = getPaddedArrayBuffer(result)\n\n const bufferViewDef = {\n buffer: writer.processBuffer(buffer),\n byteOffset: writer.byteOffset,\n byteLength: buffer.byteLength,\n }\n\n writer.byteOffset += buffer.byteLength\n return json.bufferViews.push(bufferViewDef) - 1\n })\n }\n\n /**\n * Process attribute to generate an accessor\n * @param {BufferAttribute} attribute Attribute to process\n * @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range\n * @param {Integer} start (Optional)\n * @param {Integer} count (Optional)\n * @return {Integer|null} Index of the processed accessor on the \"accessors\" array\n */\n processAccessor(attribute, geometry, start, count) {\n const json = this.json\n\n const types = {\n 1: 'SCALAR',\n 2: 'VEC2',\n 3: 'VEC3',\n 4: 'VEC4',\n 9: 'MAT3',\n 16: 'MAT4',\n }\n\n let componentType\n\n // Detect the component type of the attribute array\n if (attribute.array.constructor === Float32Array) {\n componentType = WEBGL_CONSTANTS.FLOAT\n } else if (attribute.array.constructor === Int32Array) {\n componentType = WEBGL_CONSTANTS.INT\n } else if (attribute.array.constructor === Uint32Array) {\n componentType = WEBGL_CONSTANTS.UNSIGNED_INT\n } else if (attribute.array.constructor === Int16Array) {\n componentType = WEBGL_CONSTANTS.SHORT\n } else if (attribute.array.constructor === Uint16Array) {\n componentType = WEBGL_CONSTANTS.UNSIGNED_SHORT\n } else if (attribute.array.constructor === Int8Array) {\n componentType = WEBGL_CONSTANTS.BYTE\n } else if (attribute.array.constructor === Uint8Array) {\n componentType = WEBGL_CONSTANTS.UNSIGNED_BYTE\n } else {\n throw new Error(\n 'THREE.GLTFExporter: Unsupported bufferAttribute component type: ' + attribute.array.constructor.name,\n )\n }\n\n if (start === undefined) start = 0\n if (count === undefined) count = attribute.count\n\n // Skip creating an accessor if the attribute doesn't have data to export\n if (count === 0) return null\n\n const minMax = getMinMax(attribute, start, count)\n let bufferViewTarget\n\n // If geometry isn't provided, don't infer the target usage of the bufferView. For\n // animation samplers, target must not be set.\n if (geometry !== undefined) {\n bufferViewTarget =\n attribute === geometry.index ? WEBGL_CONSTANTS.ELEMENT_ARRAY_BUFFER : WEBGL_CONSTANTS.ARRAY_BUFFER\n }\n\n const bufferView = this.processBufferView(attribute, componentType, start, count, bufferViewTarget)\n\n const accessorDef = {\n bufferView: bufferView.id,\n byteOffset: bufferView.byteOffset,\n componentType: componentType,\n count: count,\n max: minMax.max,\n min: minMax.min,\n type: types[attribute.itemSize],\n }\n\n if (attribute.normalized === true) accessorDef.normalized = true\n if (!json.accessors) json.accessors = []\n\n return json.accessors.push(accessorDef) - 1\n }\n\n /**\n * Process image\n * @param {Image} image to process\n * @param {Integer} format of the image (RGBAFormat)\n * @param {Boolean} flipY before writing out the image\n * @param {String} mimeType export format\n * @return {Integer} Index of the processed texture in the \"images\" array\n */\n processImage(image, format, flipY, mimeType = 'image/png') {\n if (image !== null) {\n const writer = this\n const cache = writer.cache\n const json = writer.json\n const options = writer.options\n const pending = writer.pending\n\n if (!cache.images.has(image)) cache.images.set(image, {})\n\n const cachedImages = cache.images.get(image)\n\n const key = mimeType + ':flipY/' + flipY.toString()\n\n if (cachedImages[key] !== undefined) return cachedImages[key]\n\n if (!json.images) json.images = []\n\n const imageDef = { mimeType: mimeType }\n\n const canvas = getCanvas()\n\n canvas.width = Math.min(image.width, options.maxTextureSize)\n canvas.height = Math.min(image.height, options.maxTextureSize)\n\n const ctx = canvas.getContext('2d')\n\n if (flipY === true) {\n ctx.translate(0, canvas.height)\n ctx.scale(1, -1)\n }\n\n if (image.data !== undefined) {\n // THREE.DataTexture\n\n if (format !== RGBAFormat) {\n console.error('GLTFExporter: Only RGBAFormat is supported.', format)\n }\n\n if (image.width > options.maxTextureSize || image.height > options.maxTextureSize) {\n console.warn('GLTFExporter: Image size is bigger than maxTextureSize', image)\n }\n\n const data = new Uint8ClampedArray(image.height * image.width * 4)\n\n for (let i = 0; i < data.length; i += 4) {\n data[i + 0] = image.data[i + 0]\n data[i + 1] = image.data[i + 1]\n data[i + 2] = image.data[i + 2]\n data[i + 3] = image.data[i + 3]\n }\n\n ctx.putImageData(new ImageData(data, image.width, image.height), 0, 0)\n } else {\n ctx.drawImage(image, 0, 0, canvas.width, canvas.height)\n }\n\n if (options.binary === true) {\n pending.push(\n getToBlobPromise(canvas, mimeType)\n .then((blob) => writer.processBufferViewImage(blob))\n .then((bufferViewIndex) => {\n imageDef.bufferView = bufferViewIndex\n }),\n )\n } else {\n if (canvas.toDataURL !== undefined) {\n imageDef.uri = canvas.toDataURL(mimeType)\n } else {\n pending.push(\n getToBlobPromise(canvas, mimeType)\n .then(readAsDataURL)\n .then((uri) => {\n imageDef.uri = uri\n }),\n )\n }\n }\n\n const index = json.images.push(imageDef) - 1\n cachedImages[key] = index\n return index\n } else {\n throw new Error('THREE.GLTFExporter: No valid image data found. Unable to process texture.')\n }\n }\n\n /**\n * Process sampler\n * @param {Texture} map Texture to process\n * @return {Integer} Index of the processed texture in the \"samplers\" array\n */\n processSampler(map) {\n const json = this.json\n\n if (!json.samplers) json.samplers = []\n\n const samplerDef = {\n magFilter: THREE_TO_WEBGL[map.magFilter],\n minFilter: THREE_TO_WEBGL[map.minFilter],\n wrapS: THREE_TO_WEBGL[map.wrapS],\n wrapT: THREE_TO_WEBGL[map.wrapT],\n }\n\n return json.samplers.push(samplerDef) - 1\n }\n\n /**\n * Process texture\n * @param {Texture} map Map to process\n * @return {Integer} Index of the processed texture in the \"textures\" array\n */\n processTexture(map) {\n const writer = this\n const options = writer.options\n const cache = this.cache\n const json = this.json\n\n if (cache.textures.has(map)) return cache.textures.get(map)\n\n if (!json.textures) json.textures = []\n\n // make non-readable textures (e.g. CompressedTexture) readable by blitting them into a new texture\n if (map instanceof CompressedTexture) {\n map = decompress(map, options.maxTextureSize)\n }\n\n let mimeType = map.userData.mimeType\n\n if (mimeType === 'image/webp') mimeType = 'image/png'\n\n const textureDef = {\n sampler: this.processSampler(map),\n source: this.processImage(map.image, map.format, map.flipY, mimeType),\n }\n\n if (map.name) textureDef.name = map.name\n\n this._invokeAll(function (ext) {\n ext.writeTexture && ext.writeTexture(map, textureDef)\n })\n\n const index = json.textures.push(textureDef) - 1\n cache.textures.set(map, index)\n return index\n }\n\n /**\n * Process material\n * @param {THREE.Material} material Material to process\n * @return {Integer|null} Index of the processed material in the \"materials\" array\n */\n processMaterial(material) {\n const cache = this.cache\n const json = this.json\n\n if (cache.materials.has(material)) return cache.materials.get(material)\n\n if (material.isShaderMaterial) {\n console.warn('GLTFExporter: THREE.ShaderMaterial not supported.')\n return null\n }\n\n if (!json.materials) json.materials = []\n\n // @QUESTION Should we avoid including any attribute that has the default value?\n const materialDef = { pbrMetallicRoughness: {} }\n\n if (material.isMeshStandardMaterial !== true && material.isMeshBasicMaterial !== true) {\n console.warn('GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.')\n }\n\n // pbrMetallicRoughness.baseColorFactor\n const color = material.color.toArray().concat([material.opacity])\n\n if (!equalArray(color, [1, 1, 1, 1])) {\n materialDef.pbrMetallicRoughness.baseColorFactor = color\n }\n\n if (material.isMeshStandardMaterial) {\n materialDef.pbrMetallicRoughness.metallicFactor = material.metalness\n materialDef.pbrMetallicRoughness.roughnessFactor = material.roughness\n } else {\n materialDef.pbrMetallicRoughness.metallicFactor = 0.5\n materialDef.pbrMetallicRoughness.roughnessFactor = 0.5\n }\n\n // pbrMetallicRoughness.metallicRoughnessTexture\n if (material.metalnessMap || material.roughnessMap) {\n const metalRoughTexture = this.buildMetalRoughTexture(material.metalnessMap, material.roughnessMap)\n\n const metalRoughMapDef = {\n index: this.processTexture(metalRoughTexture),\n channel: metalRoughTexture.channel,\n }\n this.applyTextureTransform(metalRoughMapDef, metalRoughTexture)\n materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef\n }\n\n // pbrMetallicRoughness.baseColorTexture\n if (material.map) {\n const baseColorMapDef = {\n index: this.processTexture(material.map),\n texCoord: material.map.channel,\n }\n this.applyTextureTransform(baseColorMapDef, material.map)\n materialDef.pbrMetallicRoughness.baseColorTexture = baseColorMapDef\n }\n\n if (material.emissive) {\n const emissive = material.emissive\n const maxEmissiveComponent = Math.max(emissive.r, emissive.g, emissive.b)\n\n if (maxEmissiveComponent > 0) {\n materialDef.emissiveFactor = material.emissive.toArray()\n }\n\n // emissiveTexture\n if (material.emissiveMap) {\n const emissiveMapDef = {\n index: this.processTexture(material.emissiveMap),\n texCoord: material.emissiveMap.channel,\n }\n this.applyTextureTransform(emissiveMapDef, material.emissiveMap)\n materialDef.emissiveTexture = emissiveMapDef\n }\n }\n\n // normalTexture\n if (material.normalMap) {\n const normalMapDef = {\n index: this.processTexture(material.normalMap),\n texCoord: material.normalMap.channel,\n }\n\n if (material.normalScale && material.normalScale.x !== 1) {\n // glTF normal scale is univariate. Ignore `y`, which may be flipped.\n // Context: https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995\n normalMapDef.scale = material.normalScale.x\n }\n\n this.applyTextureTransform(normalMapDef, material.normalMap)\n materialDef.normalTexture = normalMapDef\n }\n\n // occlusionTexture\n if (material.aoMap) {\n const occlusionMapDef = {\n index: this.processTexture(material.aoMap),\n texCoord: material.aoMap.channel,\n }\n\n if (material.aoMapIntensity !== 1.0) {\n occlusionMapDef.strength = material.aoMapIntensity\n }\n\n this.applyTextureTransform(occlusionMapDef, material.aoMap)\n materialDef.occlusionTexture = occlusionMapDef\n }\n\n // alphaMode\n if (material.transparent) {\n materialDef.alphaMode = 'BLEND'\n } else {\n if (material.alphaTest > 0.0) {\n materialDef.alphaMode = 'MASK'\n materialDef.alphaCutoff = material.alphaTest\n }\n }\n\n // doubleSided\n if (material.side === DoubleSide) materialDef.doubleSided = true\n if (material.name !== '') materialDef.name = material.name\n\n this.serializeUserData(material, materialDef)\n\n this._invokeAll(function (ext) {\n ext.writeMaterial && ext.writeMaterial(material, materialDef)\n })\n\n const index = json.materials.push(materialDef) - 1\n cache.materials.set(material, index)\n return index\n }\n\n /**\n * Process mesh\n * @param {THREE.Mesh} mesh Mesh to process\n * @return {Integer|null} Index of the processed mesh in the \"meshes\" array\n */\n processMesh(mesh) {\n const cache = this.cache\n const json = this.json\n\n const meshCacheKeyParts = [mesh.geometry.uuid]\n\n if (Array.isArray(mesh.material)) {\n for (let i = 0, l = mesh.material.length; i < l; i++) {\n meshCacheKeyParts.push(mesh.material[i].uuid)\n }\n } else {\n meshCacheKeyParts.push(mesh.material.uuid)\n }\n\n const meshCacheKey = meshCacheKeyParts.join(':')\n\n if (cache.meshes.has(meshCacheKey)) return cache.meshes.get(meshCacheKey)\n\n const geometry = mesh.geometry\n\n let mode\n\n // Use the correct mode\n if (mesh.isLineSegments) {\n mode = WEBGL_CONSTANTS.LINES\n } else if (mesh.isLineLoop) {\n mode = WEBGL_CONSTANTS.LINE_LOOP\n } else if (mesh.isLine) {\n mode = WEBGL_CONSTANTS.LINE_STRIP\n } else if (mesh.isPoints) {\n mode = WEBGL_CONSTANTS.POINTS\n } else {\n mode = mesh.material.wireframe ? WEBGL_CONSTANTS.LINES : WEBGL_CONSTANTS.TRIANGLES\n }\n\n const meshDef = {}\n const attributes = {}\n const primitives = []\n const targets = []\n\n // Conversion between attributes names in threejs and gltf spec\n const nameConversion = {\n ...(version >= 152\n ? {\n uv: 'TEXCOORD_0',\n uv1: 'TEXCOORD_1',\n uv2: 'TEXCOORD_2',\n uv3: 'TEXCOORD_3',\n }\n : {\n uv: 'TEXCOORD_0',\n uv2: 'TEXCOORD_1',\n }),\n color: 'COLOR_0',\n skinWeight: 'WEIGHTS_0',\n skinIndex: 'JOINTS_0',\n }\n\n const originalNormal = geometry.getAttribute('normal')\n\n if (originalNormal !== undefined && !this.isNormalizedNormalAttribute(originalNormal)) {\n console.warn('THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.')\n\n geometry.setAttribute('normal', this.createNormalizedNormalAttribute(originalNormal))\n }\n\n // @QUESTION Detect if .vertexColors = true?\n // For every attribute create an accessor\n let modifiedAttribute = null\n\n for (let attributeName in geometry.attributes) {\n // Ignore morph target attributes, which are exported later.\n if (attributeName.slice(0, 5) === 'morph') continue\n\n const attribute = geometry.attributes[attributeName]\n attributeName = nameConversion[attributeName] || attributeName.toUpperCase()\n\n // Prefix all geometry attributes except the ones specifically\n // listed in the spec; non-spec attributes are considered custom.\n const validVertexAttributes = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\\d+|COLOR_\\d+|JOINTS_\\d+|WEIGHTS_\\d+)$/\n\n if (!validVertexAttributes.test(attributeName)) attributeName = '_' + attributeName\n\n if (cache.attributes.has(this.getUID(attribute))) {\n attributes[attributeName] = cache.attributes.get(this.getUID(attribute))\n continue\n }\n\n // JOINTS_0 must be UNSIGNED_BYTE or UNSIGNED_SHORT.\n modifiedAttribute = null\n const array = attribute.array\n\n if (attributeName === 'JOINTS_0' && !(array instanceof Uint16Array) && !(array instanceof Uint8Array)) {\n console.warn('GLTFExporter: Attribute \"skinIndex\" converted to type UNSIGNED_SHORT.')\n modifiedAttribute = new BufferAttribute(new Uint16Array(array), attribute.itemSize, attribute.normalized)\n }\n\n const accessor = this.processAccessor(modifiedAttribute || attribute, geometry)\n\n if (accessor !== null) {\n if (!attributeName.startsWith('_')) {\n this.detectMeshQuantization(attributeName, attribute)\n }\n\n attributes[attributeName] = accessor\n cache.attributes.set(this.getUID(attribute), accessor)\n }\n }\n\n if (originalNormal !== undefined) geometry.setAttribute('normal', originalNormal)\n\n // Skip if no exportable attributes found\n if (Object.keys(attributes).length === 0) return null\n\n // Morph targets\n if (mesh.morphTargetInfluences !== undefined && mesh.morphTargetInfluences.length > 0) {\n const weights = []\n const targetNames = []\n const reverseDictionary = {}\n\n if (mesh.morphTargetDictionary !== undefined) {\n for (const key in mesh.morphTargetDictionary) {\n reverseDictionary[mesh.morphTargetDictionary[key]] = key\n }\n }\n\n for (let i = 0; i < mesh.morphTargetInfluences.length; ++i) {\n const target = {}\n let warned = false\n\n for (const attributeName in geometry.morphAttributes) {\n // glTF 2.0 morph supports only POSITION/NORMAL/TANGENT.\n // Three.js doesn't support TANGENT yet.\n\n if (attributeName !== 'position' && attributeName !== 'normal') {\n if (!warned) {\n console.warn('GLTFExporter: Only POSITION and NORMAL morph are supported.')\n warned = true\n }\n\n continue\n }\n\n const attribute = geometry.morphAttributes[attributeName][i]\n const gltfAttributeName = attributeName.toUpperCase()\n\n // Three.js morph attribute has absolute values while the one of glTF has relative values.\n //\n // glTF 2.0 Specification:\n // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#morph-targets\n\n const baseAttribute = geometry.attributes[attributeName]\n\n if (cache.attributes.has(this.getUID(attribute, true))) {\n target[gltfAttributeName] = cache.attributes.get(this.getUID(attribute, true))\n continue\n }\n\n // Clones attribute not to override\n const relativeAttribute = attribute.clone()\n\n if (!geometry.morphTargetsRelative) {\n for (let j = 0, jl = attribute.count; j < jl; j++) {\n for (let a = 0; a < attribute.itemSize; a++) {\n if (a === 0) relativeAttribute.setX(j, attribute.getX(j) - baseAttribute.getX(j))\n if (a === 1) relativeAttribute.setY(j, attribute.getY(j) - baseAttribute.getY(j))\n if (a === 2) relativeAttribute.setZ(j, attribute.getZ(j) - baseAttribute.getZ(j))\n if (a === 3) relativeAttribute.setW(j, attribute.getW(j) - baseAttribute.getW(j))\n }\n }\n }\n\n target[gltfAttributeName] = this.processAccessor(relativeAttribute, geometry)\n cache.attributes.set(this.getUID(baseAttribute, true), target[gltfAttributeName])\n }\n\n targets.push(target)\n\n weights.push(mesh.morphTargetInfluences[i])\n\n if (mesh.morphTargetDictionary !== undefined) targetNames.push(reverseDictionary[i])\n }\n\n meshDef.weights = weights\n\n if (targetNames.length > 0) {\n meshDef.extras = {}\n meshDef.extras.targetNames = targetNames\n }\n }\n\n const isMultiMaterial = Array.isArray(mesh.material)\n\n if (isMultiMaterial && geometry.groups.length === 0) return null\n\n const materials = isMultiMaterial ? mesh.material : [mesh.material]\n const groups = isMultiMaterial ? geometry.groups : [{ materialIndex: 0, start: undefined, count: undefined }]\n\n for (let i = 0, il = groups.length; i < il; i++) {\n const primitive = {\n mode: mode,\n attributes: attributes,\n }\n\n this.serializeUserData(geometry, primitive)\n\n if (targets.length > 0) primitive.targets = targets\n\n if (geometry.index !== null) {\n let cacheKey = this.getUID(geometry.index)\n\n if (groups[i].start !== undefined || groups[i].count !== undefined) {\n cacheKey += ':' + groups[i].start + ':' + groups[i].count\n }\n\n if (cache.attributes.has(cacheKey)) {\n primitive.indices = cache.attributes.get(cacheKey)\n } else {\n primitive.indices = this.processAccessor(geometry.index, geometry, groups[i].start, groups[i].count)\n cache.attributes.set(cacheKey, primitive.indices)\n }\n\n if (primitive.indices === null) delete primitive.indices\n }\n\n const material = this.processMaterial(materials[groups[i].materialIndex])\n\n if (material !== null) primitive.material = material\n\n primitives.push(primitive)\n }\n\n meshDef.primitives = primitives\n\n if (!json.meshes) json.meshes = []\n\n this._invokeAll(function (ext) {\n ext.writeMesh && ext.writeMesh(mesh, meshDef)\n })\n\n const index = json.meshes.push(meshDef) - 1\n cache.meshes.set(meshCacheKey, index)\n return index\n }\n\n /**\n * If a vertex attribute with a\n * [non-standard data type](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview)\n * is used, it is checked whether it is a valid data type according to the\n * [KHR_mesh_quantization](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md)\n * extension.\n * In this case the extension is automatically added to the list of used extensions.\n *\n * @param {string} attributeName\n * @param {THREE.BufferAttribute} attribute\n */\n detectMeshQuantization(attributeName, attribute) {\n if (this.extensionsUsed[KHR_MESH_QUANTIZATION]) return\n\n let attrType = undefined\n\n switch (attribute.array.constructor) {\n case Int8Array:\n attrType = 'byte'\n\n break\n\n case Uint8Array:\n attrType = 'unsigned byte'\n\n break\n\n case Int16Array:\n attrType = 'short'\n\n break\n\n case Uint16Array:\n attrType = 'unsigned short'\n\n break\n\n default:\n return\n }\n\n if (attribute.normalized) attrType += ' normalized'\n\n const attrNamePrefix = attributeName.split('_', 1)[0]\n\n if (\n KHR_mesh_quantization_ExtraAttrTypes[attrNamePrefix] &&\n KHR_mesh_quantization_ExtraAttrTypes[attrNamePrefix].includes(attrType)\n ) {\n this.extensionsUsed[KHR_MESH_QUANTIZATION] = true\n this.extensionsRequired[KHR_MESH_QUANTIZATION] = true\n }\n }\n\n /**\n * Process camera\n * @param {THREE.Camera} camera Camera to process\n * @return {Integer} Index of the processed mesh in the \"camera\" array\n */\n processCamera(camera) {\n const json = this.json\n\n if (!json.cameras) json.cameras = []\n\n const isOrtho = camera.isOrthographicCamera\n\n const cameraDef = {\n type: isOrtho ? 'orthographic' : 'perspective',\n }\n\n if (isOrtho) {\n cameraDef.orthographic = {\n xmag: camera.right * 2,\n ymag: camera.top * 2,\n zfar: camera.far <= 0 ? 0.001 : camera.far,\n znear: camera.near < 0 ? 0 : camera.near,\n }\n } else {\n cameraDef.perspective = {\n aspectRatio: camera.aspect,\n yfov: MathUtils.degToRad(camera.fov),\n zfar: camera.far <= 0 ? 0.001 : camera.far,\n znear: camera.near < 0 ? 0 : camera.near,\n }\n }\n\n // Question: Is saving \"type\" as name intentional?\n if (camera.name !== '') cameraDef.name = camera.type\n\n return json.cameras.push(cameraDef) - 1\n }\n\n /**\n * Creates glTF animation entry from AnimationClip object.\n *\n * Status:\n * - Only properties listed in PATH_PROPERTIES may be animated.\n *\n * @param {THREE.AnimationClip} clip\n * @param {THREE.Object3D} root\n * @return {number|null}\n */\n processAnimation(clip, root) {\n const json = this.json\n const nodeMap = this.nodeMap\n\n if (!json.animations) json.animations = []\n\n clip = GLTFExporter.Utils.mergeMorphTargetTracks(clip.clone(), root)\n\n const tracks = clip.tracks\n const channels = []\n const samplers = []\n\n for (let i = 0; i < tracks.length; ++i) {\n const track = tracks[i]\n const trackBinding = PropertyBinding.parseTrackName(track.name)\n let trackNode = PropertyBinding.findNode(root, trackBinding.nodeName)\n const trackProperty = PATH_PROPERTIES[trackBinding.propertyName]\n\n if (trackBinding.objectName === 'bones') {\n if (trackNode.isSkinnedMesh === true) {\n trackNode = trackNode.skeleton.getBoneByName(trackBinding.objectIndex)\n } else {\n trackNode = undefined\n }\n }\n\n if (!trackNode || !trackProperty) {\n console.warn('THREE.GLTFExporter: Could not export animation track \"%s\".', track.name)\n return null\n }\n\n const inputItemSize = 1\n let outputItemSize = track.values.length / track.times.length\n\n if (trackProperty === PATH_PROPERTIES.morphTargetInfluences) {\n outputItemSize /= trackNode.morphTargetInfluences.length\n }\n\n let interpolation\n\n // @TODO export CubicInterpolant(InterpolateSmooth) as CUBICSPLINE\n\n // Detecting glTF cubic spline interpolant by checking factory method's special property\n // GLTFCubicSplineInterpolant is a custom interpolant and track doesn't return\n // valid value from .getInterpolation().\n if (track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === true) {\n interpolation = 'CUBICSPLINE'\n\n // itemSize of CUBICSPLINE keyframe is 9\n // (VEC3 * 3: inTangent, splineVertex, and outTangent)\n // but needs to be stored as VEC3 so dividing by 3 here.\n outputItemSize /= 3\n } else if (track.getInterpolation() === InterpolateDiscrete) {\n interpolation = 'STEP'\n } else {\n interpolation = 'LINEAR'\n }\n\n samplers.push({\n input: this.processAccessor(new BufferAttribute(track.times, inputItemSize)),\n output: this.processAccessor(new BufferAttribute(track.values, outputItemSize)),\n interpolation: interpolation,\n })\n\n channels.push({\n sampler: samplers.length - 1,\n target: {\n node: nodeMap.get(trackNode),\n path: trackProperty,\n },\n })\n }\n\n json.animations.push({\n name: clip.name || 'clip_' + json.animations.length,\n samplers: samplers,\n channels: channels,\n })\n\n return json.animations.length - 1\n }\n\n /**\n * @param {THREE.Object3D} object\n * @return {number|null}\n */\n processSkin(object) {\n const json = this.json\n const nodeMap = this.nodeMap\n\n const node = json.nodes[nodeMap.get(object)]\n\n const skeleton = object.skeleton\n\n if (skeleton === undefined) return null\n\n const rootJoint = object.skeleton.bones[0]\n\n if (rootJoint === undefined) return null\n\n const joints = []\n const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16)\n const temporaryBoneInverse = new Matrix4()\n\n for (let i = 0; i < skeleton.bones.length; ++i) {\n joints.push(nodeMap.get(skeleton.bones[i]))\n temporaryBoneInverse.copy(skeleton.boneInverses[i])\n temporaryBoneInverse.multiply(object.bindMatrix).toArray(inverseBindMatrices, i * 16)\n }\n\n if (json.skins === undefined) json.skins = []\n\n json.skins.push({\n inverseBindMatrices: this.processAccessor(new BufferAttribute(inverseBindMatrices, 16)),\n joints: joints,\n skeleton: nodeMap.get(rootJoint),\n })\n\n const skinIndex = (node.skin = json.skins.length - 1)\n\n return skinIndex\n }\n\n /**\n * Process Object3D node\n * @param {THREE.Object3D} node Object3D to processNode\n * @return {Integer} Index of the node in the nodes list\n */\n processNode(object) {\n const json = this.json\n const options = this.options\n const nodeMap = this.nodeMap\n\n if (!json.nodes) json.nodes = []\n\n const nodeDef = {}\n\n if (options.trs) {\n const rotation = object.quaternion.toArray()\n const position = object.position.toArray()\n const scale = object.scale.toArray()\n\n if (!equalArray(rotation, [0, 0, 0, 1])) {\n nodeDef.rotation = rotation\n }\n\n if (!equalArray(position, [0, 0, 0])) {\n nodeDef.translation = position\n }\n\n if (!equalArray(scale, [1, 1, 1])) {\n nodeDef.scale = scale\n }\n } else {\n if (object.matrixAutoUpdate) {\n object.updateMatrix()\n }\n\n if (isIdentityMatrix(object.matrix) === false) {\n nodeDef.matrix = object.matrix.elements\n }\n }\n\n // We don't export empty strings name because it represents no-name in Three.js.\n if (object.name !== '') nodeDef.name = String(object.name)\n\n this.serializeUserData(object, nodeDef)\n\n if (object.isMesh || object.isLine || object.isPoints) {\n const meshIndex = this.processMesh(object)\n\n if (meshIndex !== null) nodeDef.mesh = meshIndex\n } else if (object.isCamera) {\n nodeDef.camera = this.processCamera(object)\n }\n\n if (object.isSkinnedMesh) this.skins.push(object)\n\n if (object.children.length > 0) {\n const children = []\n\n for (let i = 0, l = object.children.length; i < l; i++) {\n const child = object.children[i]\n\n if (child.visible || options.onlyVisible === false) {\n const nodeIndex = this.processNode(child)\n\n if (nodeIndex !== null) children.push(nodeIndex)\n }\n }\n\n if (children.length > 0) nodeDef.children = children\n }\n\n this._invokeAll(function (ext) {\n ext.writeNode && ext.writeNode(object, nodeDef)\n })\n\n const nodeIndex = json.nodes.push(nodeDef) - 1\n nodeMap.set(object, nodeIndex)\n return nodeIndex\n }\n\n /**\n * Process Scene\n * @param {Scene} node Scene to process\n */\n processScene(scene) {\n const json = this.json\n const options = this.options\n\n if (!json.scenes) {\n json.scenes = []\n json.scene = 0\n }\n\n const sceneDef = {}\n\n if (scene.name !== '') sceneDef.name = scene.name\n\n json.scenes.push(sceneDef)\n\n const nodes = []\n\n for (let i = 0, l = scene.children.length; i < l; i++) {\n const child = scene.children[i]\n\n if (child.visible || options.onlyVisible === false) {\n const nodeIndex = this.processNode(child)\n\n if (nodeIndex !== null) nodes.push(nodeIndex)\n }\n }\n\n if (nodes.length > 0) sceneDef.nodes = nodes\n\n this.serializeUserData(scene, sceneDef)\n }\n\n /**\n * Creates a Scene to hold a list of objects and parse it\n * @param {Array} objects List of objects to process\n */\n processObjects(objects) {\n const scene = new Scene()\n scene.name = 'AuxScene'\n\n for (let i = 0; i < objects.length; i++) {\n // We push directly to children instead of calling `add` to prevent\n // modify the .parent and break its original scene and hierarchy\n scene.children.push(objects[i])\n }\n\n this.processScene(scene)\n }\n\n /**\n * @param {THREE.Object3D|Array} input\n */\n processInput(input) {\n const options = this.options\n\n input = input instanceof Array ? input : [input]\n\n this._invokeAll(function (ext) {\n ext.beforeParse && ext.beforeParse(input)\n })\n\n const objectsWithoutScene = []\n\n for (let i = 0; i < input.length; i++) {\n if (input[i] instanceof Scene) {\n this.processScene(input[i])\n } else {\n objectsWithoutScene.push(input[i])\n }\n }\n\n if (objectsWithoutScene.length > 0) this.processObjects(objectsWithoutScene)\n\n for (let i = 0; i < this.skins.length; ++i) {\n this.processSkin(this.skins[i])\n }\n\n for (let i = 0; i < options.animations.length; ++i) {\n this.processAnimation(options.animations[i], input[0])\n }\n\n this._invokeAll(function (ext) {\n ext.afterParse && ext.afterParse(input)\n })\n }\n\n _invokeAll(func) {\n for (let i = 0, il = this.plugins.length; i < il; i++) {\n func(this.plugins[i])\n }\n }\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 GLTFLightExtension {\n constructor(writer) {\n this.writer = writer\n this.name = 'KHR_lights_punctual'\n }\n\n writeNode(light, nodeDef) {\n if (!light.isLight) return\n\n if (!light.isDirectionalLight && !light.isPointLight && !light.isSpotLight) {\n console.warn('THREE.GLTFExporter: Only directional, point, and spot lights are supported.', light)\n return\n }\n\n const writer = this.writer\n const json = writer.json\n const extensionsUsed = writer.extensionsUsed\n\n const lightDef = {}\n\n if (light.name) lightDef.name = light.name\n\n lightDef.color = light.color.toArray()\n\n lightDef.intensity = light.intensity\n\n if (light.isDirectionalLight) {\n lightDef.type = 'directional'\n } else if (light.isPointLight) {\n lightDef.type = 'point'\n\n if (light.distance > 0) lightDef.range = light.distance\n } else if (light.isSpotLight) {\n lightDef.type = 'spot'\n\n if (light.distance > 0) lightDef.range = light.distance\n\n lightDef.spot = {}\n lightDef.spot.innerConeAngle = (light.penumbra - 1.0) * light.angle * -1.0\n lightDef.spot.outerConeAngle = light.angle\n }\n\n if (light.decay !== undefined && light.decay !== 2) {\n console.warn(\n 'THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, ' + 'and expects light.decay=2.',\n )\n }\n\n if (\n light.target &&\n (light.target.parent !== light ||\n light.target.position.x !== 0 ||\n light.target.position.y !== 0 ||\n light.target.position.z !== -1)\n ) {\n console.warn(\n 'THREE.GLTFExporter: Light direction may be lost. For best results, ' +\n 'make light.target a child of the light with position 0,0,-1.',\n )\n }\n\n if (!extensionsUsed[this.name]) {\n json.extensions = json.extensions || {}\n json.extensions[this.name] = { lights: [] }\n extensionsUsed[this.name] = true\n }\n\n const lights = json.extensions[this.name].lights\n lights.push(lightDef)\n\n nodeDef.extensions = nodeDef.extensions || {}\n nodeDef.extensions[this.name] = { light: lights.length - 1 }\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_unlit'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshBasicMaterial) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = {}\n\n extensionsUsed[this.name] = true\n\n materialDef.pbrMetallicRoughness.metallicFactor = 0.0\n materialDef.pbrMetallicRoughness.roughnessFactor = 0.9\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_clearcoat'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.clearcoat === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.clearcoatFactor = material.clearcoat\n\n if (material.clearcoatMap) {\n const clearcoatMapDef = {\n index: writer.processTexture(material.clearcoatMap),\n texCoord: material.clearcoatMap.channel,\n }\n writer.applyTextureTransform(clearcoatMapDef, material.clearcoatMap)\n extensionDef.clearcoatTexture = clearcoatMapDef\n }\n\n extensionDef.clearcoatRoughnessFactor = material.clearcoatRoughness\n\n if (material.clearcoatRoughnessMap) {\n const clearcoatRoughnessMapDef = {\n index: writer.processTexture(material.clearcoatRoughnessMap),\n texCoord: material.clearcoatRoughnessMap.channel,\n }\n writer.applyTextureTransform(clearcoatRoughnessMapDef, material.clearcoatRoughnessMap)\n extensionDef.clearcoatRoughnessTexture = clearcoatRoughnessMapDef\n }\n\n if (material.clearcoatNormalMap) {\n const clearcoatNormalMapDef = {\n index: writer.processTexture(material.clearcoatNormalMap),\n texCoord: material.clearcoatNormalMap.channel,\n }\n writer.applyTextureTransform(clearcoatNormalMapDef, material.clearcoatNormalMap)\n extensionDef.clearcoatNormalTexture = clearcoatNormalMapDef\n }\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_iridescence'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.iridescence === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.iridescenceFactor = material.iridescence\n\n if (material.iridescenceMap) {\n const iridescenceMapDef = {\n index: writer.processTexture(material.iridescenceMap),\n texCoord: material.iridescenceMap.channel,\n }\n writer.applyTextureTransform(iridescenceMapDef, material.iridescenceMap)\n extensionDef.iridescenceTexture = iridescenceMapDef\n }\n\n extensionDef.iridescenceIor = material.iridescenceIOR\n extensionDef.iridescenceThicknessMinimum = material.iridescenceThicknessRange[0]\n extensionDef.iridescenceThicknessMaximum = material.iridescenceThicknessRange[1]\n\n if (material.iridescenceThicknessMap) {\n const iridescenceThicknessMapDef = {\n index: writer.processTexture(material.iridescenceThicknessMap),\n texCoord: material.iridescenceThicknessMap.channel,\n }\n writer.applyTextureTransform(iridescenceThicknessMapDef, material.iridescenceThicknessMap)\n extensionDef.iridescenceThicknessTexture = iridescenceThicknessMapDef\n }\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 */\nclass GLTFMaterialsTransmissionExtension {\n constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_transmission'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.transmission === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.transmissionFactor = material.transmission\n\n if (material.transmissionMap) {\n const transmissionMapDef = {\n index: writer.processTexture(material.transmissionMap),\n texCoord: material.transmissionMap.channel,\n }\n writer.applyTextureTransform(transmissionMapDef, material.transmissionMap)\n extensionDef.transmissionTexture = transmissionMapDef\n }\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_volume'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.transmission === 0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.thicknessFactor = material.thickness\n\n if (material.thicknessMap) {\n const thicknessMapDef = {\n index: writer.processTexture(material.thicknessMap),\n texCoord: material.thicknessMap.channel,\n }\n writer.applyTextureTransform(thicknessMapDef, material.thicknessMap)\n extensionDef.thicknessTexture = thicknessMapDef\n }\n\n extensionDef.attenuationDistance = material.attenuationDistance\n extensionDef.attenuationColor = material.attenuationColor.toArray()\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_ior'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.ior === 1.5) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.ior = material.ior\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_specular'\n }\n\n writeMaterial(material, materialDef) {\n if (\n !material.isMeshPhysicalMaterial ||\n (material.specularIntensity === 1.0 &&\n material.specularColor.equals(DEFAULT_SPECULAR_COLOR) &&\n !material.specularIntensityMap &&\n !material.specularColorTexture)\n )\n return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n if (material.specularIntensityMap) {\n const specularIntensityMapDef = {\n index: writer.processTexture(material.specularIntensityMap),\n texCoord: material.specularIntensityMap.channel,\n }\n writer.applyTextureTransform(specularIntensityMapDef, material.specularIntensityMap)\n extensionDef.specularTexture = specularIntensityMapDef\n }\n\n if (material.specularColorMap) {\n const specularColorMapDef = {\n index: writer.processTexture(material.specularColorMap),\n texCoord: material.specularColorMap.channel,\n }\n writer.applyTextureTransform(specularColorMapDef, material.specularColorMap)\n extensionDef.specularColorTexture = specularColorMapDef\n }\n\n extensionDef.specularFactor = material.specularIntensity\n extensionDef.specularColorFactor = material.specularColor.toArray()\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_sheen'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.sheen == 0.0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n if (material.sheenRoughnessMap) {\n const sheenRoughnessMapDef = {\n index: writer.processTexture(material.sheenRoughnessMap),\n texCoord: material.sheenRoughnessMap.channel,\n }\n writer.applyTextureTransform(sheenRoughnessMapDef, material.sheenRoughnessMap)\n extensionDef.sheenRoughnessTexture = sheenRoughnessMapDef\n }\n\n if (material.sheenColorMap) {\n const sheenColorMapDef = {\n index: writer.processTexture(material.sheenColorMap),\n texCoord: material.sheenColorMap.channel,\n }\n writer.applyTextureTransform(sheenColorMapDef, material.sheenColorMap)\n extensionDef.sheenColorTexture = sheenColorMapDef\n }\n\n extensionDef.sheenRoughnessFactor = material.sheenRoughness\n extensionDef.sheenColorFactor = material.sheenColor.toArray()\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\n }\n}\n\n/**\n * Anisotropy Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_anisotropy\n */\nclass GLTFMaterialsAnisotropyExtension {\n constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_anisotropy'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshPhysicalMaterial || material.anisotropy == 0.0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n if (material.anisotropyMap) {\n const anisotropyMapDef = { index: writer.processTexture(material.anisotropyMap) }\n writer.applyTextureTransform(anisotropyMapDef, material.anisotropyMap)\n extensionDef.anisotropyTexture = anisotropyMapDef\n }\n\n extensionDef.anisotropyStrength = material.anisotropy\n extensionDef.anisotropyRotation = material.anisotropyRotation\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\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 constructor(writer) {\n this.writer = writer\n this.name = 'KHR_materials_emissive_strength'\n }\n\n writeMaterial(material, materialDef) {\n if (!material.isMeshStandardMaterial || material.emissiveIntensity === 1.0) return\n\n const writer = this.writer\n const extensionsUsed = writer.extensionsUsed\n\n const extensionDef = {}\n\n extensionDef.emissiveStrength = material.emissiveIntensity\n\n materialDef.extensions = materialDef.extensions || {}\n materialDef.extensions[this.name] = extensionDef\n\n extensionsUsed[this.name] = true\n }\n}\n\nexport { GLTFExporter }\n", "// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([c], { type: 'text/javascript' }))));\n w.onerror = function (e) { return cb(e.error, null); };\n w.onmessage = function (e) { return cb(null, e.data); };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\n// see fleb note\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new u32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return [b, r];\n};\nvar _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b[0], revfd = _b[1];\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i)\n ++l[cd[i] - 1];\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 0; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >>> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p / 8) | 0) + (p & 7 && 1); };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n var n = new (v instanceof u16 ? u16 : v instanceof u32 ? u32 : u8)(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, buf, st) {\n // source length\n var sl = dat.length;\n if (!sl || (st && !st.l && sl < 5))\n return buf || new u8(0);\n // have to estimate size\n var noBuf = !buf || st;\n // no state\n var noSt = !st || st.i;\n if (!st)\n st = {};\n // Assumes roughly 33% compression ratio average\n if (!buf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n st.f = final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n // ensure size\n if (noBuf)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >>> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n throw 'invalid block type';\n if (pos > tbts) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17;\n if (noBuf)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n if (!c)\n throw 'invalid length/literal';\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;\n if (!d)\n throw 'invalid distance';\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n throw 'unexpected EOF';\n break;\n }\n if (noBuf)\n cbuf(bt + 131072);\n var end = bt + add;\n for (; bt < end; bt += 4) {\n buf[bt] = buf[bt - dt];\n buf[bt + 1] = buf[bt + 1 - dt];\n buf[bt + 2] = buf[bt + 2 - dt];\n buf[bt + 3] = buf[bt + 3 - dt];\n }\n bt = end;\n }\n }\n st.l = lm, st.p = lpos, st.b = bt;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n return bt == buf.length ? buf : slc(buf, 0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n d[o + 2] |= v >>> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return [et, 0];\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return [v, 1];\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return [new u8(tr), mbt];\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return [cl.subarray(0, cli), s];\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >>> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a[0], mlb = _a[1];\n var _b = hTree(df, 15), ddt = _b[0], mdb = _b[1];\n var _c = lc(dlt), lclt = _c[0], nlc = _c[1];\n var _d = lc(ddt), lcdt = _d[0], ndc = _d[1];\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n lcfreq[lclt[i] & 31]++;\n for (var i = 0; i < lcdt.length; ++i)\n lcfreq[lcdt[i] & 31]++;\n var _e = hTree(lcfreq, 7), lct = _e[0], mlcb = _e[1];\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + (2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]);\n if (flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >>> 5) & 127), p += clct[i] >>> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n if (syms[i] > 255) {\n var len = (syms[i] >>> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (syms[i] >>> 23) & 31), p += fleb[len];\n var dst = syms[i] & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (syms[i] >>> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[syms[i]]), p += ll[syms[i]];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new u32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, lst) {\n var s = dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var pos = 0;\n if (!lvl || s < 8) {\n for (var i = 0; i <= s; i += 65535) {\n // end\n var e = i + 65535;\n if (e < s) {\n // write full block\n pos = wfblk(w, pos, dat.subarray(i, e));\n }\n else {\n // write final block\n w[i] = lst;\n pos = wfblk(w, pos, dat.subarray(i, s));\n }\n }\n }\n else {\n var opt = deo[lvl - 1];\n var n = opt >>> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = new u16(32768), head = new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new u32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx bitpos\n var lc_1 = 0, eb = 0, i = 0, li = 0, wi = 0, bs = 0;\n for (; i < s; ++i) {\n // hash value\n // deopt when i > s - 3 - at end, deopt acceptable\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && rem > 423) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = (imod - pimod) & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = (i - dif + j + 32768) & 32767;\n var pti = prev[ti];\n var cd = (ti - pti + 32768) & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += (imod - pimod + 32768) & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one Uint32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n // this is the easiest way to avoid needing to maintain state\n if (!lst && pos & 7)\n pos = wfblk(w, pos + 1, et);\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Alder32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a >>> 8) << 16 | (b & 255) << 8 | (b >>> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, !st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/ /g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return [fnStr, td];\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k] instanceof u8 || v[k] instanceof u16 || v[k] instanceof u32)\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n var _a;\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n _a = wcln(fns[i], fnStr, td_1), fnStr = _a[0], td_1 = _a[1];\n ch[id] = wcln(fns[m], fnStr, td_1);\n }\n var td = mrg({}, ch[id][1]);\n return wk(ch[id][0] + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, hMap, max, bits, bits16, shft, slc, inflt, inflateSync, pbf, gu8]; };\nvar bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zlv]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get u8\nvar gu8 = function (o) { return o && o.size && new u8(o.size); };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) { return strm.push(ev.data[0], ev.data[1]); };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.push = function (d, f) {\n if (t)\n throw 'stream finished';\n if (!strm.ondata)\n throw 'no stream handler';\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n throw 'invalid gzip data';\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += d[10] | (d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return ((d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16) | (d[l - 1] << 24)) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + ((o.filename && (o.filename.length + 1)) || 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (fl ? (32 - 2 * fl) : 1);\n};\n// zlib valid\nvar zlv = function (d) {\n if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n throw 'invalid zlib data';\n if (d[1] & 32)\n throw 'invalid zlib data: preset dictionaries not supported';\n};\nfunction AsyncCmpStrm(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n// zlib footer: -4 to -0 is Adler32\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, !f), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (this.d)\n throw 'stream finished';\n if (!this.ondata)\n throw 'no stream handler';\n this.d = final;\n this.p(chunk, final || false);\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n /**\n * Creates an inflation stream\n * @param cb The callback to call whenever data is inflated\n */\n function Inflate(cb) {\n this.s = {};\n this.p = new u8(0);\n this.ondata = cb;\n }\n Inflate.prototype.e = function (c) {\n if (this.d)\n throw 'stream finished';\n if (!this.ondata)\n throw 'no stream handler';\n var l = this.p.length;\n var n = new u8(l + c.length);\n n.set(this.p), n.set(c, l), this.p = n;\n };\n Inflate.prototype.c = function (final) {\n this.d = this.s.i = final || false;\n var bts = this.s.b;\n var dt = inflt(this.p, this.o, this.s);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous inflation stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncInflate(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, 0, function () {\n var strm = new Inflate();\n onmessage = astrm(strm);\n }, 7);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gu8(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, out) {\n return inflt(data, out);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n this.c.p(c);\n this.l += c.length;\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, !f);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n /**\n * Creates a GUNZIP stream\n * @param cb The callback to call whenever data is inflated\n */\n function Gunzip(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n var s = this.p.length > 3 ? gzs(this.p) : 4;\n if (s >= this.p.length && !final)\n return;\n this.p = this.p.subarray(s), this.v = 0;\n }\n if (final) {\n if (this.p.length < 8)\n throw 'invalid gzip stream';\n this.p = this.p.subarray(0, -8);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous GUNZIP stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncGunzip(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, 0, function () {\n var strm = new Gunzip();\n onmessage = astrm(strm);\n }, 9);\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, out) {\n return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n this.c.p(c);\n var raw = dopt(c, this.o, this.v && 2, f && 4, !f);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n /**\n * Creates a Zlib decompression stream\n * @param cb The callback to call whenever data is inflated\n */\n function Unzlib(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 2 && !final)\n return;\n this.p = this.p.subarray(2), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n throw 'invalid zlib stream';\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous Zlib decompression stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncUnzlib(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, 0, function () {\n var strm = new Unzlib();\n onmessage = astrm(strm);\n }, 11);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gu8(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, out) {\n return inflt((zlv(data), data.subarray(2, -4)), out);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function Decompress(cb) {\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no stream handler';\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n var _this_1 = this;\n var cb = function () { _this_1.ondata.apply(_this_1, arguments); };\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(cb)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(cb)\n : new this.Z(cb);\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function AsyncDecompress(cb) {\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, out) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, out)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, out)\n : unzlibSync(data, out);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k;\n if (val instanceof u8)\n t[n] = [val, o];\n else if (Array.isArray(val))\n t[n] = [val[0], mrg(o, val[1])];\n else\n fltn(val, n + '/', t, o);\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return [r, slc(d, i - 1)];\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no callback';\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n throw 'invalid utf-8 data';\n this.t = null;\n }\n return;\n }\n if (!this.p)\n throw 'stream finished';\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), ch = _a[0], np = _a[1];\n if (final) {\n if (np.length)\n throw 'invalid utf-8 data';\n this.p = null;\n }\n else\n this.p = np;\n this.ondata(ch, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no callback';\n if (this.d)\n throw 'stream finished';\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td)\n return td.decode(dat);\n else {\n var _a = dutf8(dat), out = _a[0], ext = _a[1];\n if (ext.length)\n throw 'invalid utf-8 data';\n return out;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n throw 'extra field too long';\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c == null && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n throw 'date not in range 1980-2099';\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >>> 1)), b += 4;\n if (c != null) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n throw 'no callback - add to ZIP archive before pushing';\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this_1 = this;\n if (this.d & 2)\n throw 'stream finished';\n var f = strToU8(file.filename), fl = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl != file.filename.length || (o && (com.length != o.length));\n var hl = fl + exfl(file.extra) + 30;\n if (fl > 65535)\n throw 'filename too long';\n var header = new u8(hl);\n wzh(header, 0, file, f, u);\n var chks = [header];\n var pAll = function () {\n for (var _i = 0, chks_1 = chks; _i < chks_1.length; _i++) {\n var chk = chks_1[_i];\n _this_1.ondata(null, chk, false);\n }\n chks = [];\n };\n var tr = this.d;\n this.d = 0;\n var ind = this.u.length;\n var uf = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll();\n if (tr) {\n var nxt = _this_1.u[ind + 1];\n if (nxt)\n nxt.r();\n else\n _this_1.d = 1;\n }\n tr = 1;\n }\n });\n var cl = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this_1.ondata(err, dat, final);\n _this_1.terminate();\n }\n else {\n cl += dat.length;\n chks.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl);\n wbytes(dd, 12, file.size);\n chks.push(dd);\n uf.c = cl, uf.b = hl + cl + 16, uf.crc = file.crc, uf.size = file.size;\n if (tr)\n uf.r();\n tr = 1;\n }\n else if (tr)\n pAll();\n }\n };\n this.u.push(uf);\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this_1 = this;\n if (this.d & 2) {\n if (this.d & 1)\n throw 'stream finishing';\n throw 'stream finished';\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this_1.d & 1))\n return;\n _this_1.u.splice(-1, 1);\n _this_1.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, f.c, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n throw 'no callback';\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cb(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cb(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cb(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl('filename too long', null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n throw 'filename too long';\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this_1 = this;\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, data, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this_1 = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this_1 = this;\n if (!this.onfile)\n throw 'no callback';\n if (!this.p)\n throw 'stream finished';\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_2 = [];\n this_1.k.unshift(chks_2);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n throw 'no callback';\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this_1.o[cmp_1];\n if (!ctr)\n throw 'unknown compression type ' + cmp_1;\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_3 = chks_2; _i < chks_3.length; _i++) {\n var dat = chks_3[_i];\n d_1.push(dat, false);\n }\n if (_this_1.k[0] == chks_2 && _this_1.c)\n _this_1.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n throw 'invalid zip file';\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\n/**\n * Asynchronously decompresses a ZIP archive\n * @param data The raw compressed ZIP file\n * @param cb The callback to call with the decompressed files\n * @returns A function that can be used to immediately terminate the unzipping\n */\nexport function unzip(data, cb) {\n if (typeof cb != 'function')\n throw 'no callback';\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cb('invalid zip file', null);\n return;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (!lft)\n cb(null, {});\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50) {\n cb('invalid zip file', null);\n return;\n }\n c = lft = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cb(e, null);\n }\n else {\n files[fn] = d;\n if (!--lft)\n cb(null, files);\n }\n };\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n if (sc < 320000) {\n try {\n cbl(null, inflateSync(infl, new u8(su)));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl('unknown compression type ' + c_1, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @returns The decompressed files\n */\nexport function unzipSync(data) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n throw 'invalid zip file';\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50)\n throw 'invalid zip file';\n c = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), new u8(su));\n else\n throw 'unknown compression type ' + c_2;\n }\n return files;\n}\n", "import type { EncoderModule } from 'draco3d'\nimport { BufferGeometry, Mesh, Points } from 'three'\n\n/**\n * Export draco compressed files from threejs geometry objects.\n *\n * Draco files are compressed and usually are smaller than conventional 3D file formats.\n *\n * The exporter receives a options object containing\n * - decodeSpeed, indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality)\n * - encodeSpeed, indicates how to tune the encoder parameters (0 gives better speed but worst quality)\n * - encoderMethod\n * - quantization, indicates the presision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC)\n * - exportUvs\n * - exportNormals\n */\n\ndeclare const DracoEncoderModule: () => EncoderModule\n\nclass DRACOExporter {\n // Encoder methods\n\n public static MESH_EDGEBREAKER_ENCODING = 1\n public static MESH_SEQUENTIAL_ENCODING = 0\n\n // Geometry type\n\n public static POINT_CLOUD = 0\n public static TRIANGULAR_MESH = 1\n\n // Attribute type\n public static INVALID = -1\n public static POSITION = 0\n public static NORMAL = 1\n public static COLOR = 2\n public static TEX_COORD = 3\n public static GENERIC = 4\n\n public parse(\n object: Mesh | Points,\n options = {\n decodeSpeed: 5,\n encodeSpeed: 5,\n encoderMethod: DRACOExporter.MESH_EDGEBREAKER_ENCODING,\n quantization: [16, 8, 8, 8, 8],\n exportUvs: true,\n exportNormals: true,\n exportColor: false,\n },\n ): Int8Array {\n if (object instanceof BufferGeometry && object.isBufferGeometry) {\n throw new Error('DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.')\n }\n\n if (DracoEncoderModule === undefined) {\n throw new Error('THREE.DRACOExporter: required the draco_encoder to work.')\n }\n\n const geometry = object.geometry\n\n const dracoEncoder = DracoEncoderModule()\n const encoder = new dracoEncoder.Encoder()\n let builder\n let dracoObject\n\n if (!geometry.isBufferGeometry) {\n throw new Error('THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.')\n }\n\n if (object instanceof Mesh && object.isMesh) {\n builder = new dracoEncoder.MeshBuilder()\n dracoObject = new dracoEncoder.Mesh()\n\n const vertices = geometry.getAttribute('position')\n // @ts-ignore\n builder.AddFloatAttributeToMesh(\n dracoObject,\n dracoEncoder.POSITION,\n vertices.count,\n vertices.itemSize,\n vertices.array,\n )\n\n const faces = geometry.getIndex()\n\n if (faces !== null) {\n builder.AddFacesToMesh(dracoObject, faces.count / 3, faces.array as Uint16Array | Uint32Array)\n } else {\n const faces = new (vertices.count > 65535 ? Uint32Array : Uint16Array)(vertices.count)\n\n for (let i = 0; i < faces.length; i++) {\n faces[i] = i\n }\n\n builder.AddFacesToMesh(dracoObject, vertices.count, faces)\n }\n\n if (options.exportNormals) {\n const normals = geometry.getAttribute('normal')\n\n if (normals !== undefined) {\n // @ts-ignore\n builder.AddFloatAttributeToMesh(\n dracoObject,\n dracoEncoder.NORMAL,\n normals.count,\n normals.itemSize,\n normals.array,\n )\n }\n }\n\n if (options.exportUvs) {\n const uvs = geometry.getAttribute('uv')\n\n if (uvs !== undefined) {\n // @ts-ignore\n builder.AddFloatAttributeToMesh(dracoObject, dracoEncoder.TEX_COORD, uvs.count, uvs.itemSize, uvs.array)\n }\n }\n\n if (options.exportColor) {\n const colors = geometry.getAttribute('color')\n\n if (colors !== undefined) {\n // @ts-ignore\n builder.AddFloatAttributeToMesh(dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, colors.array)\n }\n }\n } else if (object instanceof Points && object.isPoints) {\n // @ts-ignore\n builder = new dracoEncoder.PointCloudBuilder()\n // @ts-ignore\n dracoObject = new dracoEncoder.PointCloud()\n\n const vertices = geometry.getAttribute('position')\n builder.AddFloatAttribute(dracoObject, dracoEncoder.POSITION, vertices.count, vertices.itemSize, vertices.array)\n\n if (options.exportColor) {\n const colors = geometry.getAttribute('color')\n\n if (colors !== undefined) {\n builder.AddFloatAttribute(dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, colors.array)\n }\n }\n } else {\n throw new Error('DRACOExporter: Unsupported object type.')\n }\n\n //Compress using draco encoder\n\n const encodedData = new dracoEncoder.DracoInt8Array()\n\n //Sets the desired encoding and decoding speed for the given options from 0 (slowest speed, but the best compression) to 10 (fastest, but the worst compression).\n\n const encodeSpeed = options.encodeSpeed !== undefined ? options.encodeSpeed : 5\n const decodeSpeed = options.decodeSpeed !== undefined ? options.decodeSpeed : 5\n\n encoder.SetSpeedOptions(encodeSpeed, decodeSpeed)\n\n // Sets the desired encoding method for a given geometry.\n\n if (options.encoderMethod !== undefined) {\n encoder.SetEncodingMethod(options.encoderMethod)\n }\n\n // Sets the quantization (number of bits used to represent) compression options for a named attribute.\n // The attribute values will be quantized in a box defined by the maximum extent of the attribute values.\n if (options.quantization !== undefined) {\n for (let i = 0; i < 5; i++) {\n if (options.quantization[i] !== undefined) {\n encoder.SetAttributeQuantization(i, options.quantization[i])\n }\n }\n }\n\n let length\n\n if (object instanceof Mesh && object.isMesh) {\n length = encoder.EncodeMeshToDracoBuffer(dracoObject, encodedData)\n } else {\n // @ts-ignore\n length = encoder.EncodePointCloudToDracoBuffer(dracoObject, true, encodedData)\n }\n\n dracoEncoder.destroy(dracoObject)\n\n if (length === 0) {\n throw new Error('THREE.DRACOExporter: Draco encoding failed.')\n }\n\n //Copy encoded data to buffer.\n const outputData = new Int8Array(new ArrayBuffer(length))\n\n for (let i = 0; i < length; i++) {\n outputData[i] = encodedData.GetValue(i)\n }\n\n dracoEncoder.destroy(encodedData)\n dracoEncoder.destroy(encoder)\n dracoEncoder.destroy(builder)\n\n return outputData\n }\n}\n\nexport { DRACOExporter }\n", "/**\n * @author Takahiro / https://github.com/takahirox\n *\n * Simple CharsetEncoder.\n */\n\nclass CharsetEncoder {\n constructor() {\n this.s2uTable = {\n 0: 0,\n 1: 1,\n 2: 2,\n 3: 3,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 7,\n 8: 8,\n 9: 9,\n 10: 10,\n 11: 11,\n 12: 12,\n 13: 13,\n 14: 14,\n 15: 15,\n 16: 16,\n 17: 17,\n 18: 18,\n 19: 19,\n 20: 20,\n 21: 21,\n 22: 22,\n 23: 23,\n 24: 24,\n 25: 25,\n 26: 26,\n 27: 27,\n 28: 28,\n 29: 29,\n 30: 30,\n 31: 31,\n 32: 32,\n 33: 33,\n 34: 34,\n 35: 35,\n 36: 36,\n 37: 37,\n 38: 38,\n 39: 39,\n 40: 40,\n 41: 41,\n 42: 42,\n 43: 43,\n 44: 44,\n 45: 45,\n 46: 46,\n 47: 47,\n 48: 48,\n 49: 49,\n 50: 50,\n 51: 51,\n 52: 52,\n 53: 53,\n 54: 54,\n 55: 55,\n 56: 56,\n 57: 57,\n 58: 58,\n 59: 59,\n 60: 60,\n 61: 61,\n 62: 62,\n 63: 63,\n 64: 64,\n 65: 65,\n 66: 66,\n 67: 67,\n 68: 68,\n 69: 69,\n 70: 70,\n 71: 71,\n 72: 72,\n 73: 73,\n 74: 74,\n 75: 75,\n 76: 76,\n 77: 77,\n 78: 78,\n 79: 79,\n 80: 80,\n 81: 81,\n 82: 82,\n 83: 83,\n 84: 84,\n 85: 85,\n 86: 86,\n 87: 87,\n 88: 88,\n 89: 89,\n 90: 90,\n 91: 91,\n 92: 92,\n 93: 93,\n 94: 94,\n 95: 95,\n 96: 96,\n 97: 97,\n 98: 98,\n 99: 99,\n 100: 100,\n 101: 101,\n 102: 102,\n 103: 103,\n 104: 104,\n 105: 105,\n 106: 106,\n 107: 107,\n 108: 108,\n 109: 109,\n 110: 110,\n 111: 111,\n 112: 112,\n 113: 113,\n 114: 114,\n 115: 115,\n 116: 116,\n 117: 117,\n 118: 118,\n 119: 119,\n 120: 120,\n 121: 121,\n 122: 122,\n 123: 123,\n 124: 124,\n 125: 125,\n 126: 126,\n 161: 65377,\n 162: 65378,\n 163: 65379,\n 164: 65380,\n 165: 65381,\n 166: 65382,\n 167: 65383,\n 168: 65384,\n 169: 65385,\n 170: 65386,\n 171: 65387,\n 172: 65388,\n 173: 65389,\n 174: 65390,\n 175: 65391,\n 176: 65392,\n 177: 65393,\n 178: 65394,\n 179: 65395,\n 180: 65396,\n 181: 65397,\n 182: 65398,\n 183: 65399,\n 184: 65400,\n 185: 65401,\n 186: 65402,\n 187: 65403,\n 188: 65404,\n 189: 65405,\n 190: 65406,\n 191: 65407,\n 192: 65408,\n 193: 65409,\n 194: 65410,\n 195: 65411,\n 196: 65412,\n 197: 65413,\n 198: 65414,\n 199: 65415,\n 200: 65416,\n 201: 65417,\n 202: 65418,\n 203: 65419,\n 204: 65420,\n 205: 65421,\n 206: 65422,\n 207: 65423,\n 208: 65424,\n 209: 65425,\n 210: 65426,\n 211: 65427,\n 212: 65428,\n 213: 65429,\n 214: 65430,\n 215: 65431,\n 216: 65432,\n 217: 65433,\n 218: 65434,\n 219: 65435,\n 220: 65436,\n 221: 65437,\n 222: 65438,\n 223: 65439,\n 33088: 12288,\n 33089: 12289,\n 33090: 12290,\n 33091: 65292,\n 33092: 65294,\n 33093: 12539,\n 33094: 65306,\n 33095: 65307,\n 33096: 65311,\n 33097: 65281,\n 33098: 12443,\n 33099: 12444,\n 33100: 180,\n 33101: 65344,\n 33102: 168,\n 33103: 65342,\n 33104: 65507,\n 33105: 65343,\n 33106: 12541,\n 33107: 12542,\n 33108: 12445,\n 33109: 12446,\n 33110: 12291,\n 33111: 20189,\n 33112: 12293,\n 33113: 12294,\n 33114: 12295,\n 33115: 12540,\n 33116: 8213,\n 33117: 8208,\n 33118: 65295,\n 33119: 65340,\n 33120: 65374,\n 33121: 8741,\n 33122: 65372,\n 33123: 8230,\n 33124: 8229,\n 33125: 8216,\n 33126: 8217,\n 33127: 8220,\n 33128: 8221,\n 33129: 65288,\n 33130: 65289,\n 33131: 12308,\n 33132: 12309,\n 33133: 65339,\n 33134: 65341,\n 33135: 65371,\n 33136: 65373,\n 33137: 12296,\n 33138: 12297,\n 33139: 12298,\n 33140: 12299,\n 33141: 12300,\n 33142: 12301,\n 33143: 12302,\n 33144: 12303,\n 33145: 12304,\n 33146: 12305,\n 33147: 65291,\n 33148: 65293,\n 33149: 177,\n 33150: 215,\n 33152: 247,\n 33153: 65309,\n 33154: 8800,\n 33155: 65308,\n 33156: 65310,\n 33157: 8806,\n 33158: 8807,\n 33159: 8734,\n 33160: 8756,\n 33161: 9794,\n 33162: 9792,\n 33163: 176,\n 33164: 8242,\n 33165: 8243,\n 33166: 8451,\n 33167: 65509,\n 33168: 65284,\n 33169: 65504,\n 33170: 65505,\n 33171: 65285,\n 33172: 65283,\n 33173: 65286,\n 33174: 65290,\n 33175: 65312,\n 33176: 167,\n 33177: 9734,\n 33178: 9733,\n 33179: 9675,\n 33180: 9679,\n 33181: 9678,\n 33182: 9671,\n 33183: 9670,\n 33184: 9633,\n 33185: 9632,\n 33186: 9651,\n 33187: 9650,\n 33188: 9661,\n 33189: 9660,\n 33190: 8251,\n 33191: 12306,\n 33192: 8594,\n 33193: 8592,\n 33194: 8593,\n 33195: 8595,\n 33196: 12307,\n 33208: 8712,\n 33209: 8715,\n 33210: 8838,\n 33211: 8839,\n 33212: 8834,\n 33213: 8835,\n 33214: 8746,\n 33215: 8745,\n 33224: 8743,\n 33225: 8744,\n 33226: 65506,\n 33227: 8658,\n 33228: 8660,\n 33229: 8704,\n 33230: 8707,\n 33242: 8736,\n 33243: 8869,\n 33244: 8978,\n 33245: 8706,\n 33246: 8711,\n 33247: 8801,\n 33248: 8786,\n 33249: 8810,\n 33250: 8811,\n 33251: 8730,\n 33252: 8765,\n 33253: 8733,\n 33254: 8757,\n 33255: 8747,\n 33256: 8748,\n 33264: 8491,\n 33265: 8240,\n 33266: 9839,\n 33267: 9837,\n 33268: 9834,\n 33269: 8224,\n 33270: 8225,\n 33271: 182,\n 33276: 9711,\n 33359: 65296,\n 33360: 65297,\n 33361: 65298,\n 33362: 65299,\n 33363: 65300,\n 33364: 65301,\n 33365: 65302,\n 33366: 65303,\n 33367: 65304,\n 33368: 65305,\n 33376: 65313,\n 33377: 65314,\n 33378: 65315,\n 33379: 65316,\n 33380: 65317,\n 33381: 65318,\n 33382: 65319,\n 33383: 65320,\n 33384: 65321,\n 33385: 65322,\n 33386: 65323,\n 33387: 65324,\n 33388: 65325,\n 33389: 65326,\n 33390: 65327,\n 33391: 65328,\n 33392: 65329,\n 33393: 65330,\n 33394: 65331,\n 33395: 65332,\n 33396: 65333,\n 33397: 65334,\n 33398: 65335,\n 33399: 65336,\n 33400: 65337,\n 33401: 65338,\n 33409: 65345,\n 33410: 65346,\n 33411: 65347,\n 33412: 65348,\n 33413: 65349,\n 33414: 65350,\n 33415: 65351,\n 33416: 65352,\n 33417: 65353,\n 33418: 65354,\n 33419: 65355,\n 33420: 65356,\n 33421: 65357,\n 33422: 65358,\n 33423: 65359,\n 33424: 65360,\n 33425: 65361,\n 33426: 65362,\n 33427: 65363,\n 33428: 65364,\n 33429: 65365,\n 33430: 65366,\n 33431: 65367,\n 33432: 65368,\n 33433: 65369,\n 33434: 65370,\n 33439: 12353,\n 33440: 12354,\n 33441: 12355,\n 33442: 12356,\n 33443: 12357,\n 33444: 12358,\n 33445: 12359,\n 33446: 12360,\n 33447: 12361,\n 33448: 12362,\n 33449: 12363,\n 33450: 12364,\n 33451: 12365,\n 33452: 12366,\n 33453: 12367,\n 33454: 12368,\n 33455: 12369,\n 33456: 12370,\n 33457: 12371,\n 33458: 12372,\n 33459: 12373,\n 33460: 12374,\n 33461: 12375,\n 33462: 12376,\n 33463: 12377,\n 33464: 12378,\n 33465: 12379,\n 33466: 12380,\n 33467: 12381,\n 33468: 12382,\n 33469: 12383,\n 33470: 12384,\n 33471: 12385,\n 33472: 12386,\n 33473: 12387,\n 33474: 12388,\n 33475: 12389,\n 33476: 12390,\n 33477: 12391,\n 33478: 12392,\n 33479: 12393,\n 33480: 12394,\n 33481: 12395,\n 33482: 12396,\n 33483: 12397,\n 33484: 12398,\n 33485: 12399,\n 33486: 12400,\n 33487: 12401,\n 33488: 12402,\n 33489: 12403,\n 33490: 12404,\n 33491: 12405,\n 33492: 12406,\n 33493: 12407,\n 33494: 12408,\n 33495: 12409,\n 33496: 12410,\n 33497: 12411,\n 33498: 12412,\n 33499: 12413,\n 33500: 12414,\n 33501: 12415,\n 33502: 12416,\n 33503: 12417,\n 33504: 12418,\n 33505: 12419,\n 33506: 12420,\n 33507: 12421,\n 33508: 12422,\n 33509: 12423,\n 33510: 12424,\n 33511: 12425,\n 33512: 12426,\n 33513: 12427,\n 33514: 12428,\n 33515: 12429,\n 33516: 12430,\n 33517: 12431,\n 33518: 12432,\n 33519: 12433,\n 33520: 12434,\n 33521: 12435,\n 33600: 12449,\n 33601: 12450,\n 33602: 12451,\n 33603: 12452,\n 33604: 12453,\n 33605: 12454,\n 33606: 12455,\n 33607: 12456,\n 33608: 12457,\n 33609: 12458,\n 33610: 12459,\n 33611: 12460,\n 33612: 12461,\n 33613: 12462,\n 33614: 12463,\n 33615: 12464,\n 33616: 12465,\n 33617: 12466,\n 33618: 12467,\n 33619: 12468,\n 33620: 12469,\n 33621: 12470,\n 33622: 12471,\n 33623: 12472,\n 33624: 12473,\n 33625: 12474,\n 33626: 12475,\n 33627: 12476,\n 33628: 12477,\n 33629: 12478,\n 33630: 12479,\n 33631: 12480,\n 33632: 12481,\n 33633: 12482,\n 33634: 12483,\n 33635: 12484,\n 33636: 12485,\n 33637: 12486,\n 33638: 12487,\n 33639: 12488,\n 33640: 12489,\n 33641: 12490,\n 33642: 12491,\n 33643: 12492,\n 33644: 12493,\n 33645: 12494,\n 33646: 12495,\n 33647: 12496,\n 33648: 12497,\n 33649: 12498,\n 33650: 12499,\n 33651: 12500,\n 33652: 12501,\n 33653: 12502,\n 33654: 12503,\n 33655: 12504,\n 33656: 12505,\n 33657: 12506,\n 33658: 12507,\n 33659: 12508,\n 33660: 12509,\n 33661: 12510,\n 33662: 12511,\n 33664: 12512,\n 33665: 12513,\n 33666: 12514,\n 33667: 12515,\n 33668: 12516,\n 33669: 12517,\n 33670: 12518,\n 33671: 12519,\n 33672: 12520,\n 33673: 12521,\n 33674: 12522,\n 33675: 12523,\n 33676: 12524,\n 33677: 12525,\n 33678: 12526,\n 33679: 12527,\n 33680: 12528,\n 33681: 12529,\n 33682: 12530,\n 33683: 12531,\n 33684: 12532,\n 33685: 12533,\n 33686: 12534,\n 33695: 913,\n 33696: 914,\n 33697: 915,\n 33698: 916,\n 33699: 917,\n 33700: 918,\n 33701: 919,\n 33702: 920,\n 33703: 921,\n 33704: 922,\n 33705: 923,\n 33706: 924,\n 33707: 925,\n 33708: 926,\n 33709: 927,\n 33710: 928,\n 33711: 929,\n 33712: 931,\n 33713: 932,\n 33714: 933,\n 33715: 934,\n 33716: 935,\n 33717: 936,\n 33718: 937,\n 33727: 945,\n 33728: 946,\n 33729: 947,\n 33730: 948,\n 33731: 949,\n 33732: 950,\n 33733: 951,\n 33734: 952,\n 33735: 953,\n 33736: 954,\n 33737: 955,\n 33738: 956,\n 33739: 957,\n 33740: 958,\n 33741: 959,\n 33742: 960,\n 33743: 961,\n 33744: 963,\n 33745: 964,\n 33746: 965,\n 33747: 966,\n 33748: 967,\n 33749: 968,\n 33750: 969,\n 33856: 1040,\n 33857: 1041,\n 33858: 1042,\n 33859: 1043,\n 33860: 1044,\n 33861: 1045,\n 33862: 1025,\n 33863: 1046,\n 33864: 1047,\n 33865: 1048,\n 33866: 1049,\n 33867: 1050,\n 33868: 1051,\n 33869: 1052,\n 33870: 1053,\n 33871: 1054,\n 33872: 1055,\n 33873: 1056,\n 33874: 1057,\n 33875: 1058,\n 33876: 1059,\n 33877: 1060,\n 33878: 1061,\n 33879: 1062,\n 33880: 1063,\n 33881: 1064,\n 33882: 1065,\n 33883: 1066,\n 33884: 1067,\n 33885: 1068,\n 33886: 1069,\n 33887: 1070,\n 33888: 1071,\n 33904: 1072,\n 33905: 1073,\n 33906: 1074,\n 33907: 1075,\n 33908: 1076,\n 33909: 1077,\n 33910: 1105,\n 33911: 1078,\n 33912: 1079,\n 33913: 1080,\n 33914: 1081,\n 33915: 1082,\n 33916: 1083,\n 33917: 1084,\n 33918: 1085,\n 33920: 1086,\n 33921: 1087,\n 33922: 1088,\n 33923: 1089,\n 33924: 1090,\n 33925: 1091,\n 33926: 1092,\n 33927: 1093,\n 33928: 1094,\n 33929: 1095,\n 33930: 1096,\n 33931: 1097,\n 33932: 1098,\n 33933: 1099,\n 33934: 1100,\n 33935: 1101,\n 33936: 1102,\n 33937: 1103,\n 33951: 9472,\n 33952: 9474,\n 33953: 9484,\n 33954: 9488,\n 33955: 9496,\n 33956: 9492,\n 33957: 9500,\n 33958: 9516,\n 33959: 9508,\n 33960: 9524,\n 33961: 9532,\n 33962: 9473,\n 33963: 9475,\n 33964: 9487,\n 33965: 9491,\n 33966: 9499,\n 33967: 9495,\n 33968: 9507,\n 33969: 9523,\n 33970: 9515,\n 33971: 9531,\n 33972: 9547,\n 33973: 9504,\n 33974: 9519,\n 33975: 9512,\n 33976: 9527,\n 33977: 9535,\n 33978: 9501,\n 33979: 9520,\n 33980: 9509,\n 33981: 9528,\n 33982: 9538,\n 34624: 9312,\n 34625: 9313,\n 34626: 9314,\n 34627: 9315,\n 34628: 9316,\n 34629: 9317,\n 34630: 9318,\n 34631: 9319,\n 34632: 9320,\n 34633: 9321,\n 34634: 9322,\n 34635: 9323,\n 34636: 9324,\n 34637: 9325,\n 34638: 9326,\n 34639: 9327,\n 34640: 9328,\n 34641: 9329,\n 34642: 9330,\n 34643: 9331,\n 34644: 8544,\n 34645: 8545,\n 34646: 8546,\n 34647: 8547,\n 34648: 8548,\n 34649: 8549,\n 34650: 8550,\n 34651: 8551,\n 34652: 8552,\n 34653: 8553,\n 34655: 13129,\n 34656: 13076,\n 34657: 13090,\n 34658: 13133,\n 34659: 13080,\n 34660: 13095,\n 34661: 13059,\n 34662: 13110,\n 34663: 13137,\n 34664: 13143,\n 34665: 13069,\n 34666: 13094,\n 34667: 13091,\n 34668: 13099,\n 34669: 13130,\n 34670: 13115,\n 34671: 13212,\n 34672: 13213,\n 34673: 13214,\n 34674: 13198,\n 34675: 13199,\n 34676: 13252,\n 34677: 13217,\n 34686: 13179,\n 34688: 12317,\n 34689: 12319,\n 34690: 8470,\n 34691: 13261,\n 34692: 8481,\n 34693: 12964,\n 34694: 12965,\n 34695: 12966,\n 34696: 12967,\n 34697: 12968,\n 34698: 12849,\n 34699: 12850,\n 34700: 12857,\n 34701: 13182,\n 34702: 13181,\n 34703: 13180,\n 34704: 8786,\n 34705: 8801,\n 34706: 8747,\n 34707: 8750,\n 34708: 8721,\n 34709: 8730,\n 34710: 8869,\n 34711: 8736,\n 34712: 8735,\n 34713: 8895,\n 34714: 8757,\n 34715: 8745,\n 34716: 8746,\n 34975: 20124,\n 34976: 21782,\n 34977: 23043,\n 34978: 38463,\n 34979: 21696,\n 34980: 24859,\n 34981: 25384,\n 34982: 23030,\n 34983: 36898,\n 34984: 33909,\n 34985: 33564,\n 34986: 31312,\n 34987: 24746,\n 34988: 25569,\n 34989: 28197,\n 34990: 26093,\n 34991: 33894,\n 34992: 33446,\n 34993: 39925,\n 34994: 26771,\n 34995: 22311,\n 34996: 26017,\n 34997: 25201,\n 34998: 23451,\n 34999: 22992,\n 35000: 34427,\n 35001: 39156,\n 35002: 32098,\n 35003: 32190,\n 35004: 39822,\n 35005: 25110,\n 35006: 31903,\n 35007: 34999,\n 35008: 23433,\n 35009: 24245,\n 35010: 25353,\n 35011: 26263,\n 35012: 26696,\n 35013: 38343,\n 35014: 38797,\n 35015: 26447,\n 35016: 20197,\n 35017: 20234,\n 35018: 20301,\n 35019: 20381,\n 35020: 20553,\n 35021: 22258,\n 35022: 22839,\n 35023: 22996,\n 35024: 23041,\n 35025: 23561,\n 35026: 24799,\n 35027: 24847,\n 35028: 24944,\n 35029: 26131,\n 35030: 26885,\n 35031: 28858,\n 35032: 30031,\n 35033: 30064,\n 35034: 31227,\n 35035: 32173,\n 35036: 32239,\n 35037: 32963,\n 35038: 33806,\n 35039: 34915,\n 35040: 35586,\n 35041: 36949,\n 35042: 36986,\n 35043: 21307,\n 35044: 20117,\n 35045: 20133,\n 35046: 22495,\n 35047: 32946,\n 35048: 37057,\n 35049: 30959,\n 35050: 19968,\n 35051: 22769,\n 35052: 28322,\n 35053: 36920,\n 35054: 31282,\n 35055: 33576,\n 35056: 33419,\n 35057: 39983,\n 35058: 20801,\n 35059: 21360,\n 35060: 21693,\n 35061: 21729,\n 35062: 22240,\n 35063: 23035,\n 35064: 24341,\n 35065: 39154,\n 35066: 28139,\n 35067: 32996,\n 35068: 34093,\n 35136: 38498,\n 35137: 38512,\n 35138: 38560,\n 35139: 38907,\n 35140: 21515,\n 35141: 21491,\n 35142: 23431,\n 35143: 28879,\n 35144: 32701,\n 35145: 36802,\n 35146: 38632,\n 35147: 21359,\n 35148: 40284,\n 35149: 31418,\n 35150: 19985,\n 35151: 30867,\n 35152: 33276,\n 35153: 28198,\n 35154: 22040,\n 35155: 21764,\n 35156: 27421,\n 35157: 34074,\n 35158: 39995,\n 35159: 23013,\n 35160: 21417,\n 35161: 28006,\n 35162: 29916,\n 35163: 38287,\n 35164: 22082,\n 35165: 20113,\n 35166: 36939,\n 35167: 38642,\n 35168: 33615,\n 35169: 39180,\n 35170: 21473,\n 35171: 21942,\n 35172: 23344,\n 35173: 24433,\n 35174: 26144,\n 35175: 26355,\n 35176: 26628,\n 35177: 27704,\n 35178: 27891,\n 35179: 27945,\n 35180: 29787,\n 35181: 30408,\n 35182: 31310,\n 35183: 38964,\n 35184: 33521,\n 35185: 34907,\n 35186: 35424,\n 35187: 37613,\n 35188: 28082,\n 35189: 30123,\n 35190: 30410,\n 35191: 39365,\n 35192: 24742,\n 35193: 35585,\n 35194: 36234,\n 35195: 38322,\n 35196: 27022,\n 35197: 21421,\n 35198: 20870,\n 35200: 22290,\n 35201: 22576,\n 35202: 22852,\n 35203: 23476,\n 35204: 24310,\n 35205: 24616,\n 35206: 25513,\n 35207: 25588,\n 35208: 27839,\n 35209: 28436,\n 35210: 28814,\n 35211: 28948,\n 35212: 29017,\n 35213: 29141,\n 35214: 29503,\n 35215: 32257,\n 35216: 33398,\n 35217: 33489,\n 35218: 34199,\n 35219: 36960,\n 35220: 37467,\n 35221: 40219,\n 35222: 22633,\n 35223: 26044,\n 35224: 27738,\n 35225: 29989,\n 35226: 20985,\n 35227: 22830,\n 35228: 22885,\n 35229: 24448,\n 35230: 24540,\n 35231: 25276,\n 35232: 26106,\n 35233: 27178,\n 35234: 27431,\n 35235: 27572,\n 35236: 29579,\n 35237: 32705,\n 35238: 35158,\n 35239: 40236,\n 35240: 40206,\n 35241: 40644,\n 35242: 23713,\n 35243: 27798,\n 35244: 33659,\n 35245: 20740,\n 35246: 23627,\n 35247: 25014,\n 35248: 33222,\n 35249: 26742,\n 35250: 29281,\n 35251: 20057,\n 35252: 20474,\n 35253: 21368,\n 35254: 24681,\n 35255: 28201,\n 35256: 31311,\n 35257: 38899,\n 35258: 19979,\n 35259: 21270,\n 35260: 20206,\n 35261: 20309,\n 35262: 20285,\n 35263: 20385,\n 35264: 20339,\n 35265: 21152,\n 35266: 21487,\n 35267: 22025,\n 35268: 22799,\n 35269: 23233,\n 35270: 23478,\n 35271: 23521,\n 35272: 31185,\n 35273: 26247,\n 35274: 26524,\n 35275: 26550,\n 35276: 27468,\n 35277: 27827,\n 35278: 28779,\n 35279: 29634,\n 35280: 31117,\n 35281: 31166,\n 35282: 31292,\n 35283: 31623,\n 35284: 33457,\n 35285: 33499,\n 35286: 33540,\n 35287: 33655,\n 35288: 33775,\n 35289: 33747,\n 35290: 34662,\n 35291: 35506,\n 35292: 22057,\n 35293: 36008,\n 35294: 36838,\n 35295: 36942,\n 35296: 38686,\n 35297: 34442,\n 35298: 20420,\n 35299: 23784,\n 35300: 25105,\n 35301: 29273,\n 35302: 30011,\n 35303: 33253,\n 35304: 33469,\n 35305: 34558,\n 35306: 36032,\n 35307: 38597,\n 35308: 39187,\n 35309: 39381,\n 35310: 20171,\n 35311: 20250,\n 35312: 35299,\n 35313: 22238,\n 35314: 22602,\n 35315: 22730,\n 35316: 24315,\n 35317: 24555,\n 35318: 24618,\n 35319: 24724,\n 35320: 24674,\n 35321: 25040,\n 35322: 25106,\n 35323: 25296,\n 35324: 25913,\n 35392: 39745,\n 35393: 26214,\n 35394: 26800,\n 35395: 28023,\n 35396: 28784,\n 35397: 30028,\n 35398: 30342,\n 35399: 32117,\n 35400: 33445,\n 35401: 34809,\n 35402: 38283,\n 35403: 38542,\n 35404: 35997,\n 35405: 20977,\n 35406: 21182,\n 35407: 22806,\n 35408: 21683,\n 35409: 23475,\n 35410: 23830,\n 35411: 24936,\n 35412: 27010,\n 35413: 28079,\n 35414: 30861,\n 35415: 33995,\n 35416: 34903,\n 35417: 35442,\n 35418: 37799,\n 35419: 39608,\n 35420: 28012,\n 35421: 39336,\n 35422: 34521,\n 35423: 22435,\n 35424: 26623,\n 35425: 34510,\n 35426: 37390,\n 35427: 21123,\n 35428: 22151,\n 35429: 21508,\n 35430: 24275,\n 35431: 25313,\n 35432: 25785,\n 35433: 26684,\n 35434: 26680,\n 35435: 27579,\n 35436: 29554,\n 35437: 30906,\n 35438: 31339,\n 35439: 35226,\n 35440: 35282,\n 35441: 36203,\n 35442: 36611,\n 35443: 37101,\n 35444: 38307,\n 35445: 38548,\n 35446: 38761,\n 35447: 23398,\n 35448: 23731,\n 35449: 27005,\n 35450: 38989,\n 35451: 38990,\n 35452: 25499,\n 35453: 31520,\n 35454: 27179,\n 35456: 27263,\n 35457: 26806,\n 35458: 39949,\n 35459: 28511,\n 35460: 21106,\n 35461: 21917,\n 35462: 24688,\n 35463: 25324,\n 35464: 27963,\n 35465: 28167,\n 35466: 28369,\n 35467: 33883,\n 35468: 35088,\n 35469: 36676,\n 35470: 19988,\n 35471: 39993,\n 35472: 21494,\n 35473: 26907,\n 35474: 27194,\n 35475: 38788,\n 35476: 26666,\n 35477: 20828,\n 35478: 31427,\n 35479: 33970,\n 35480: 37340,\n 35481: 37772,\n 35482: 22107,\n 35483: 40232,\n 35484: 26658,\n 35485: 33541,\n 35486: 33841,\n 35487: 31909,\n 35488: 21000,\n 35489: 33477,\n 35490: 29926,\n 35491: 20094,\n 35492: 20355,\n 35493: 20896,\n 35494: 23506,\n 35495: 21002,\n 35496: 21208,\n 35497: 21223,\n 35498: 24059,\n 35499: 21914,\n 35500: 22570,\n 35501: 23014,\n 35502: 23436,\n 35503: 23448,\n 35504: 23515,\n 35505: 24178,\n 35506: 24185,\n 35507: 24739,\n 35508: 24863,\n 35509: 24931,\n 35510: 25022,\n 35511: 25563,\n 35512: 25954,\n 35513: 26577,\n 35514: 26707,\n 35515: 26874,\n 35516: 27454,\n 35517: 27475,\n 35518: 27735,\n 35519: 28450,\n 35520: 28567,\n 35521: 28485,\n 35522: 29872,\n 35523: 29976,\n 35524: 30435,\n 35525: 30475,\n 35526: 31487,\n 35527: 31649,\n 35528: 31777,\n 35529: 32233,\n 35530: 32566,\n 35531: 32752,\n 35532: 32925,\n 35533: 33382,\n 35534: 33694,\n 35535: 35251,\n 35536: 35532,\n 35537: 36011,\n 35538: 36996,\n 35539: 37969,\n 35540: 38291,\n 35541: 38289,\n 35542: 38306,\n 35543: 38501,\n 35544: 38867,\n 35545: 39208,\n 35546: 33304,\n 35547: 20024,\n 35548: 21547,\n 35549: 23736,\n 35550: 24012,\n 35551: 29609,\n 35552: 30284,\n 35553: 30524,\n 35554: 23721,\n 35555: 32747,\n 35556: 36107,\n 35557: 38593,\n 35558: 38929,\n 35559: 38996,\n 35560: 39000,\n 35561: 20225,\n 35562: 20238,\n 35563: 21361,\n 35564: 21916,\n 35565: 22120,\n 35566: 22522,\n 35567: 22855,\n 35568: 23305,\n 35569: 23492,\n 35570: 23696,\n 35571: 24076,\n 35572: 24190,\n 35573: 24524,\n 35574: 25582,\n 35575: 26426,\n 35576: 26071,\n 35577: 26082,\n 35578: 26399,\n 35579: 26827,\n 35580: 26820,\n 35648: 27231,\n 35649: 24112,\n 35650: 27589,\n 35651: 27671,\n 35652: 27773,\n 35653: 30079,\n 35654: 31048,\n 35655: 23395,\n 35656: 31232,\n 35657: 32000,\n 35658: 24509,\n 35659: 35215,\n 35660: 35352,\n 35661: 36020,\n 35662: 36215,\n 35663: 36556,\n 35664: 36637,\n 35665: 39138,\n 35666: 39438,\n 35667: 39740,\n 35668: 20096,\n 35669: 20605,\n 35670: 20736,\n 35671: 22931,\n 35672: 23452,\n 35673: 25135,\n 35674: 25216,\n 35675: 25836,\n 35676: 27450,\n 35677: 29344,\n 35678: 30097,\n 35679: 31047,\n 35680: 32681,\n 35681: 34811,\n 35682: 35516,\n 35683: 35696,\n 35684: 25516,\n 35685: 33738,\n 35686: 38816,\n 35687: 21513,\n 35688: 21507,\n 35689: 21931,\n 35690: 26708,\n 35691: 27224,\n 35692: 35440,\n 35693: 30759,\n 35694: 26485,\n 35695: 40653,\n 35696: 21364,\n 35697: 23458,\n 35698: 33050,\n 35699: 34384,\n 35700: 36870,\n 35701: 19992,\n 35702: 20037,\n 35703: 20167,\n 35704: 20241,\n 35705: 21450,\n 35706: 21560,\n 35707: 23470,\n 35708: 24339,\n 35709: 24613,\n 35710: 25937,\n 35712: 26429,\n 35713: 27714,\n 35714: 27762,\n 35715: 27875,\n 35716: 28792,\n 35717: 29699,\n 35718: 31350,\n 35719: 31406,\n 35720: 31496,\n 35721: 32026,\n 35722: 31998,\n 35723: 32102,\n 35724: 26087,\n 35725: 29275,\n 35726: 21435,\n 35727: 23621,\n 35728: 24040,\n 35729: 25298,\n 35730: 25312,\n 35731: 25369,\n 35732: 28192,\n 35733: 34394,\n 35734: 35377,\n 35735: 36317,\n 35736: 37624,\n 35737: 28417,\n 35738: 31142,\n 35739: 39770,\n 35740: 20136,\n 35741: 20139,\n 35742: 20140,\n 35743: 20379,\n 35744: 20384,\n 35745: 20689,\n 35746: 20807,\n 35747: 31478,\n 35748: 20849,\n 35749: 20982,\n 35750: 21332,\n 35751: 21281,\n 35752: 21375,\n 35753: 21483,\n 35754: 21932,\n 35755: 22659,\n 35756: 23777,\n 35757: 24375,\n 35758: 24394,\n 35759: 24623,\n 35760: 24656,\n 35761: 24685,\n 35762: 25375,\n 35763: 25945,\n 35764: 27211,\n 35765: 27841,\n 35766: 29378,\n 35767: 29421,\n 35768: 30703,\n 35769: 33016,\n 35770: 33029,\n 35771: 33288,\n 35772: 34126,\n 35773: 37111,\n 35774: 37857,\n 35775: 38911,\n 35776: 39255,\n 35777: 39514,\n 35778: 20208,\n 35779: 20957,\n 35780: 23597,\n 35781: 26241,\n 35782: 26989,\n 35783: 23616,\n 35784: 26354,\n 35785: 26997,\n 35786: 29577,\n 35787: 26704,\n 35788: 31873,\n 35789: 20677,\n 35790: 21220,\n 35791: 22343,\n 35792: 24062,\n 35793: 37670,\n 35794: 26020,\n 35795: 27427,\n 35796: 27453,\n 35797: 29748,\n 35798: 31105,\n 35799: 31165,\n 35800: 31563,\n 35801: 32202,\n 35802: 33465,\n 35803: 33740,\n 35804: 34943,\n 35805: 35167,\n 35806: 35641,\n 35807: 36817,\n 35808: 37329,\n 35809: 21535,\n 35810: 37504,\n 35811: 20061,\n 35812: 20534,\n 35813: 21477,\n 35814: 21306,\n 35815: 29399,\n 35816: 29590,\n 35817: 30697,\n 35818: 33510,\n 35819: 36527,\n 35820: 39366,\n 35821: 39368,\n 35822: 39378,\n 35823: 20855,\n 35824: 24858,\n 35825: 34398,\n 35826: 21936,\n 35827: 31354,\n 35828: 20598,\n 35829: 23507,\n 35830: 36935,\n 35831: 38533,\n 35832: 20018,\n 35833: 27355,\n 35834: 37351,\n 35835: 23633,\n 35836: 23624,\n 35904: 25496,\n 35905: 31391,\n 35906: 27795,\n 35907: 38772,\n 35908: 36705,\n 35909: 31402,\n 35910: 29066,\n 35911: 38536,\n 35912: 31874,\n 35913: 26647,\n 35914: 32368,\n 35915: 26705,\n 35916: 37740,\n 35917: 21234,\n 35918: 21531,\n 35919: 34219,\n 35920: 35347,\n 35921: 32676,\n 35922: 36557,\n 35923: 37089,\n 35924: 21350,\n 35925: 34952,\n 35926: 31041,\n 35927: 20418,\n 35928: 20670,\n 35929: 21009,\n 35930: 20804,\n 35931: 21843,\n 35932: 22317,\n 35933: 29674,\n 35934: 22411,\n 35935: 22865,\n 35936: 24418,\n 35937: 24452,\n 35938: 24693,\n 35939: 24950,\n 35940: 24935,\n 35941: 25001,\n 35942: 25522,\n 35943: 25658,\n 35944: 25964,\n 35945: 26223,\n 35946: 26690,\n 35947: 28179,\n 35948: 30054,\n 35949: 31293,\n 35950: 31995,\n 35951: 32076,\n 35952: 32153,\n 35953: 32331,\n 35954: 32619,\n 35955: 33550,\n 35956: 33610,\n 35957: 34509,\n 35958: 35336,\n 35959: 35427,\n 35960: 35686,\n 35961: 36605,\n 35962: 38938,\n 35963: 40335,\n 35964: 33464,\n 35965: 36814,\n 35966: 39912,\n 35968: 21127,\n 35969: 25119,\n 35970: 25731,\n 35971: 28608,\n 35972: 38553,\n 35973: 26689,\n 35974: 20625,\n 35975: 27424,\n 35976: 27770,\n 35977: 28500,\n 35978: 31348,\n 35979: 32080,\n 35980: 34880,\n 35981: 35363,\n 35982: 26376,\n 35983: 20214,\n 35984: 20537,\n 35985: 20518,\n 35986: 20581,\n 35987: 20860,\n 35988: 21048,\n 35989: 21091,\n 35990: 21927,\n 35991: 22287,\n 35992: 22533,\n 35993: 23244,\n 35994: 24314,\n 35995: 25010,\n 35996: 25080,\n 35997: 25331,\n 35998: 25458,\n 35999: 26908,\n 36000: 27177,\n 36001: 29309,\n 36002: 29356,\n 36003: 29486,\n 36004: 30740,\n 36005: 30831,\n 36006: 32121,\n 36007: 30476,\n 36008: 32937,\n 36009: 35211,\n 36010: 35609,\n 36011: 36066,\n 36012: 36562,\n 36013: 36963,\n 36014: 37749,\n 36015: 38522,\n 36016: 38997,\n 36017: 39443,\n 36018: 40568,\n 36019: 20803,\n 36020: 21407,\n 36021: 21427,\n 36022: 24187,\n 36023: 24358,\n 36024: 28187,\n 36025: 28304,\n 36026: 29572,\n 36027: 29694,\n 36028: 32067,\n 36029: 33335,\n 36030: 35328,\n 36031: 35578,\n 36032: 38480,\n 36033: 20046,\n 36034: 20491,\n 36035: 21476,\n 36036: 21628,\n 36037: 22266,\n 36038: 22993,\n 36039: 23396,\n 36040: 24049,\n 36041: 24235,\n 36042: 24359,\n 36043: 25144,\n 36044: 25925,\n 36045: 26543,\n 36046: 28246,\n 36047: 29392,\n 36048: 31946,\n 36049: 34996,\n 36050: 32929,\n 36051: 32993,\n 36052: 33776,\n 36053: 34382,\n 36054: 35463,\n 36055: 36328,\n 36056: 37431,\n 36057: 38599,\n 36058: 39015,\n 36059: 40723,\n 36060: 20116,\n 36061: 20114,\n 36062: 20237,\n 36063: 21320,\n 36064: 21577,\n 36065: 21566,\n 36066: 23087,\n 36067: 24460,\n 36068: 24481,\n 36069: 24735,\n 36070: 26791,\n 36071: 27278,\n 36072: 29786,\n 36073: 30849,\n 36074: 35486,\n 36075: 35492,\n 36076: 35703,\n 36077: 37264,\n 36078: 20062,\n 36079: 39881,\n 36080: 20132,\n 36081: 20348,\n 36082: 20399,\n 36083: 20505,\n 36084: 20502,\n 36085: 20809,\n 36086: 20844,\n 36087: 21151,\n 36088: 21177,\n 36089: 21246,\n 36090: 21402,\n 36091: 21475,\n 36092: 21521,\n 36160: 21518,\n 36161: 21897,\n 36162: 22353,\n 36163: 22434,\n 36164: 22909,\n 36165: 23380,\n 36166: 23389,\n 36167: 23439,\n 36168: 24037,\n 36169: 24039,\n 36170: 24055,\n 36171: 24184,\n 36172: 24195,\n 36173: 24218,\n 36174: 24247,\n 36175: 24344,\n 36176: 24658,\n 36177: 24908,\n 36178: 25239,\n 36179: 25304,\n 36180: 25511,\n 36181: 25915,\n 36182: 26114,\n 36183: 26179,\n 36184: 26356,\n 36185: 26477,\n 36186: 26657,\n 36187: 26775,\n 36188: 27083,\n 36189: 27743,\n 36190: 27946,\n 36191: 28009,\n 36192: 28207,\n 36193: 28317,\n 36194: 30002,\n 36195: 30343,\n 36196: 30828,\n 36197: 31295,\n 36198: 31968,\n 36199: 32005,\n 36200: 32024,\n 36201: 32094,\n 36202: 32177,\n 36203: 32789,\n 36204: 32771,\n 36205: 32943,\n 36206: 32945,\n 36207: 33108,\n 36208: 33167,\n 36209: 33322,\n 36210: 33618,\n 36211: 34892,\n 36212: 34913,\n 36213: 35611,\n 36214: 36002,\n 36215: 36092,\n 36216: 37066,\n 36217: 37237,\n 36218: 37489,\n 36219: 30783,\n 36220: 37628,\n 36221: 38308,\n 36222: 38477,\n 36224: 38917,\n 36225: 39321,\n 36226: 39640,\n 36227: 40251,\n 36228: 21083,\n 36229: 21163,\n 36230: 21495,\n 36231: 21512,\n 36232: 22741,\n 36233: 25335,\n 36234: 28640,\n 36235: 35946,\n 36236: 36703,\n 36237: 40633,\n 36238: 20811,\n 36239: 21051,\n 36240: 21578,\n 36241: 22269,\n 36242: 31296,\n 36243: 37239,\n 36244: 40288,\n 36245: 40658,\n 36246: 29508,\n 36247: 28425,\n 36248: 33136,\n 36249: 29969,\n 36250: 24573,\n 36251: 24794,\n 36252: 39592,\n 36253: 29403,\n 36254: 36796,\n 36255: 27492,\n 36256: 38915,\n 36257: 20170,\n 36258: 22256,\n 36259: 22372,\n 36260: 22718,\n 36261: 23130,\n 36262: 24680,\n 36263: 25031,\n 36264: 26127,\n 36265: 26118,\n 36266: 26681,\n 36267: 26801,\n 36268: 28151,\n 36269: 30165,\n 36270: 32058,\n 36271: 33390,\n 36272: 39746,\n 36273: 20123,\n 36274: 20304,\n 36275: 21449,\n 36276: 21766,\n 36277: 23919,\n 36278: 24038,\n 36279: 24046,\n 36280: 26619,\n 36281: 27801,\n 36282: 29811,\n 36283: 30722,\n 36284: 35408,\n 36285: 37782,\n 36286: 35039,\n 36287: 22352,\n 36288: 24231,\n 36289: 25387,\n 36290: 20661,\n 36291: 20652,\n 36292: 20877,\n 36293: 26368,\n 36294: 21705,\n 36295: 22622,\n 36296: 22971,\n 36297: 23472,\n 36298: 24425,\n 36299: 25165,\n 36300: 25505,\n 36301: 26685,\n 36302: 27507,\n 36303: 28168,\n 36304: 28797,\n 36305: 37319,\n 36306: 29312,\n 36307: 30741,\n 36308: 30758,\n 36309: 31085,\n 36310: 25998,\n 36311: 32048,\n 36312: 33756,\n 36313: 35009,\n 36314: 36617,\n 36315: 38555,\n 36316: 21092,\n 36317: 22312,\n 36318: 26448,\n 36319: 32618,\n 36320: 36001,\n 36321: 20916,\n 36322: 22338,\n 36323: 38442,\n 36324: 22586,\n 36325: 27018,\n 36326: 32948,\n 36327: 21682,\n 36328: 23822,\n 36329: 22524,\n 36330: 30869,\n 36331: 40442,\n 36332: 20316,\n 36333: 21066,\n 36334: 21643,\n 36335: 25662,\n 36336: 26152,\n 36337: 26388,\n 36338: 26613,\n 36339: 31364,\n 36340: 31574,\n 36341: 32034,\n 36342: 37679,\n 36343: 26716,\n 36344: 39853,\n 36345: 31545,\n 36346: 21273,\n 36347: 20874,\n 36348: 21047,\n 36416: 23519,\n 36417: 25334,\n 36418: 25774,\n 36419: 25830,\n 36420: 26413,\n 36421: 27578,\n 36422: 34217,\n 36423: 38609,\n 36424: 30352,\n 36425: 39894,\n 36426: 25420,\n 36427: 37638,\n 36428: 39851,\n 36429: 30399,\n 36430: 26194,\n 36431: 19977,\n 36432: 20632,\n 36433: 21442,\n 36434: 23665,\n 36435: 24808,\n 36436: 25746,\n 36437: 25955,\n 36438: 26719,\n 36439: 29158,\n 36440: 29642,\n 36441: 29987,\n 36442: 31639,\n 36443: 32386,\n 36444: 34453,\n 36445: 35715,\n 36446: 36059,\n 36447: 37240,\n 36448: 39184,\n 36449: 26028,\n 36450: 26283,\n 36451: 27531,\n 36452: 20181,\n 36453: 20180,\n 36454: 20282,\n 36455: 20351,\n 36456: 21050,\n 36457: 21496,\n 36458: 21490,\n 36459: 21987,\n 36460: 22235,\n 36461: 22763,\n 36462: 22987,\n 36463: 22985,\n 36464: 23039,\n 36465: 23376,\n 36466: 23629,\n 36467: 24066,\n 36468: 24107,\n 36469: 24535,\n 36470: 24605,\n 36471: 25351,\n 36472: 25903,\n 36473: 23388,\n 36474: 26031,\n 36475: 26045,\n 36476: 26088,\n 36477: 26525,\n 36478: 27490,\n 36480: 27515,\n 36481: 27663,\n 36482: 29509,\n 36483: 31049,\n 36484: 31169,\n 36485: 31992,\n 36486: 32025,\n 36487: 32043,\n 36488: 32930,\n 36489: 33026,\n 36490: 33267,\n 36491: 35222,\n 36492: 35422,\n 36493: 35433,\n 36494: 35430,\n 36495: 35468,\n 36496: 35566,\n 36497: 36039,\n 36498: 36060,\n 36499: 38604,\n 36500: 39164,\n 36501: 27503,\n 36502: 20107,\n 36503: 20284,\n 36504: 20365,\n 36505: 20816,\n 36506: 23383,\n 36507: 23546,\n 36508: 24904,\n 36509: 25345,\n 36510: 26178,\n 36511: 27425,\n 36512: 28363,\n 36513: 27835,\n 36514: 29246,\n 36515: 29885,\n 36516: 30164,\n 36517: 30913,\n 36518: 31034,\n 36519: 32780,\n 36520: 32819,\n 36521: 33258,\n 36522: 33940,\n 36523: 36766,\n 36524: 27728,\n 36525: 40575,\n 36526: 24335,\n 36527: 35672,\n 36528: 40235,\n 36529: 31482,\n 36530: 36600,\n 36531: 23437,\n 36532: 38635,\n 36533: 19971,\n 36534: 21489,\n 36535: 22519,\n 36536: 22833,\n 36537: 23241,\n 36538: 23460,\n 36539: 24713,\n 36540: 28287,\n 36541: 28422,\n 36542: 30142,\n 36543: 36074,\n 36544: 23455,\n 36545: 34048,\n 36546: 31712,\n 36547: 20594,\n 36548: 26612,\n 36549: 33437,\n 36550: 23649,\n 36551: 34122,\n 36552: 32286,\n 36553: 33294,\n 36554: 20889,\n 36555: 23556,\n 36556: 25448,\n 36557: 36198,\n 36558: 26012,\n 36559: 29038,\n 36560: 31038,\n 36561: 32023,\n 36562: 32773,\n 36563: 35613,\n 36564: 36554,\n 36565: 36974,\n 36566: 34503,\n 36567: 37034,\n 36568: 20511,\n 36569: 21242,\n 36570: 23610,\n 36571: 26451,\n 36572: 28796,\n 36573: 29237,\n 36574: 37196,\n 36575: 37320,\n 36576: 37675,\n 36577: 33509,\n 36578: 23490,\n 36579: 24369,\n 36580: 24825,\n 36581: 20027,\n 36582: 21462,\n 36583: 23432,\n 36584: 25163,\n 36585: 26417,\n 36586: 27530,\n 36587: 29417,\n 36588: 29664,\n 36589: 31278,\n 36590: 33131,\n 36591: 36259,\n 36592: 37202,\n 36593: 39318,\n 36594: 20754,\n 36595: 21463,\n 36596: 21610,\n 36597: 23551,\n 36598: 25480,\n 36599: 27193,\n 36600: 32172,\n 36601: 38656,\n 36602: 22234,\n 36603: 21454,\n 36604: 21608,\n 36672: 23447,\n 36673: 23601,\n 36674: 24030,\n 36675: 20462,\n 36676: 24833,\n 36677: 25342,\n 36678: 27954,\n 36679: 31168,\n 36680: 31179,\n 36681: 32066,\n 36682: 32333,\n 36683: 32722,\n 36684: 33261,\n 36685: 33311,\n 36686: 33936,\n 36687: 34886,\n 36688: 35186,\n 36689: 35728,\n 36690: 36468,\n 36691: 36655,\n 36692: 36913,\n 36693: 37195,\n 36694: 37228,\n 36695: 38598,\n 36696: 37276,\n 36697: 20160,\n 36698: 20303,\n 36699: 20805,\n 36700: 21313,\n 36701: 24467,\n 36702: 25102,\n 36703: 26580,\n 36704: 27713,\n 36705: 28171,\n 36706: 29539,\n 36707: 32294,\n 36708: 37325,\n 36709: 37507,\n 36710: 21460,\n 36711: 22809,\n 36712: 23487,\n 36713: 28113,\n 36714: 31069,\n 36715: 32302,\n 36716: 31899,\n 36717: 22654,\n 36718: 29087,\n 36719: 20986,\n 36720: 34899,\n 36721: 36848,\n 36722: 20426,\n 36723: 23803,\n 36724: 26149,\n 36725: 30636,\n 36726: 31459,\n 36727: 33308,\n 36728: 39423,\n 36729: 20934,\n 36730: 24490,\n 36731: 26092,\n 36732: 26991,\n 36733: 27529,\n 36734: 28147,\n 36736: 28310,\n 36737: 28516,\n 36738: 30462,\n 36739: 32020,\n 36740: 24033,\n 36741: 36981,\n 36742: 37255,\n 36743: 38918,\n 36744: 20966,\n 36745: 21021,\n 36746: 25152,\n 36747: 26257,\n 36748: 26329,\n 36749: 28186,\n 36750: 24246,\n 36751: 32210,\n 36752: 32626,\n 36753: 26360,\n 36754: 34223,\n 36755: 34295,\n 36756: 35576,\n 36757: 21161,\n 36758: 21465,\n 36759: 22899,\n 36760: 24207,\n 36761: 24464,\n 36762: 24661,\n 36763: 37604,\n 36764: 38500,\n 36765: 20663,\n 36766: 20767,\n 36767: 21213,\n 36768: 21280,\n 36769: 21319,\n 36770: 21484,\n 36771: 21736,\n 36772: 21830,\n 36773: 21809,\n 36774: 22039,\n 36775: 22888,\n 36776: 22974,\n 36777: 23100,\n 36778: 23477,\n 36779: 23558,\n 36780: 23567,\n 36781: 23569,\n 36782: 23578,\n 36783: 24196,\n 36784: 24202,\n 36785: 24288,\n 36786: 24432,\n 36787: 25215,\n 36788: 25220,\n 36789: 25307,\n 36790: 25484,\n 36791: 25463,\n 36792: 26119,\n 36793: 26124,\n 36794: 26157,\n 36795: 26230,\n 36796: 26494,\n 36797: 26786,\n 36798: 27167,\n 36799: 27189,\n 36800: 27836,\n 36801: 28040,\n 36802: 28169,\n 36803: 28248,\n 36804: 28988,\n 36805: 28966,\n 36806: 29031,\n 36807: 30151,\n 36808: 30465,\n 36809: 30813,\n 36810: 30977,\n 36811: 31077,\n 36812: 31216,\n 36813: 31456,\n 36814: 31505,\n 36815: 31911,\n 36816: 32057,\n 36817: 32918,\n 36818: 33750,\n 36819: 33931,\n 36820: 34121,\n 36821: 34909,\n 36822: 35059,\n 36823: 35359,\n 36824: 35388,\n 36825: 35412,\n 36826: 35443,\n 36827: 35937,\n 36828: 36062,\n 36829: 37284,\n 36830: 37478,\n 36831: 37758,\n 36832: 37912,\n 36833: 38556,\n 36834: 38808,\n 36835: 19978,\n 36836: 19976,\n 36837: 19998,\n 36838: 20055,\n 36839: 20887,\n 36840: 21104,\n 36841: 22478,\n 36842: 22580,\n 36843: 22732,\n 36844: 23330,\n 36845: 24120,\n 36846: 24773,\n 36847: 25854,\n 36848: 26465,\n 36849: 26454,\n 36850: 27972,\n 36851: 29366,\n 36852: 30067,\n 36853: 31331,\n 36854: 33976,\n 36855: 35698,\n 36856: 37304,\n 36857: 37664,\n 36858: 22065,\n 36859: 22516,\n 36860: 39166,\n 36928: 25325,\n 36929: 26893,\n 36930: 27542,\n 36931: 29165,\n 36932: 32340,\n 36933: 32887,\n 36934: 33394,\n 36935: 35302,\n 36936: 39135,\n 36937: 34645,\n 36938: 36785,\n 36939: 23611,\n 36940: 20280,\n 36941: 20449,\n 36942: 20405,\n 36943: 21767,\n 36944: 23072,\n 36945: 23517,\n 36946: 23529,\n 36947: 24515,\n 36948: 24910,\n 36949: 25391,\n 36950: 26032,\n 36951: 26187,\n 36952: 26862,\n 36953: 27035,\n 36954: 28024,\n 36955: 28145,\n 36956: 30003,\n 36957: 30137,\n 36958: 30495,\n 36959: 31070,\n 36960: 31206,\n 36961: 32051,\n 36962: 33251,\n 36963: 33455,\n 36964: 34218,\n 36965: 35242,\n 36966: 35386,\n 36967: 36523,\n 36968: 36763,\n 36969: 36914,\n 36970: 37341,\n 36971: 38663,\n 36972: 20154,\n 36973: 20161,\n 36974: 20995,\n 36975: 22645,\n 36976: 22764,\n 36977: 23563,\n 36978: 29978,\n 36979: 23613,\n 36980: 33102,\n 36981: 35338,\n 36982: 36805,\n 36983: 38499,\n 36984: 38765,\n 36985: 31525,\n 36986: 35535,\n 36987: 38920,\n 36988: 37218,\n 36989: 22259,\n 36990: 21416,\n 36992: 36887,\n 36993: 21561,\n 36994: 22402,\n 36995: 24101,\n 36996: 25512,\n 36997: 27700,\n 36998: 28810,\n 36999: 30561,\n 37000: 31883,\n 37001: 32736,\n 37002: 34928,\n 37003: 36930,\n 37004: 37204,\n 37005: 37648,\n 37006: 37656,\n 37007: 38543,\n 37008: 29790,\n 37009: 39620,\n 37010: 23815,\n 37011: 23913,\n 37012: 25968,\n 37013: 26530,\n 37014: 36264,\n 37015: 38619,\n 37016: 25454,\n 37017: 26441,\n 37018: 26905,\n 37019: 33733,\n 37020: 38935,\n 37021: 38592,\n 37022: 35070,\n 37023: 28548,\n 37024: 25722,\n 37025: 23544,\n 37026: 19990,\n 37027: 28716,\n 37028: 30045,\n 37029: 26159,\n 37030: 20932,\n 37031: 21046,\n 37032: 21218,\n 37033: 22995,\n 37034: 24449,\n 37035: 24615,\n 37036: 25104,\n 37037: 25919,\n 37038: 25972,\n 37039: 26143,\n 37040: 26228,\n 37041: 26866,\n 37042: 26646,\n 37043: 27491,\n 37044: 28165,\n 37045: 29298,\n 37046: 29983,\n 37047: 30427,\n 37048: 31934,\n 37049: 32854,\n 37050: 22768,\n 37051: 35069,\n 37052: 35199,\n 37053: 35488,\n 37054: 35475,\n 37055: 35531,\n 37056: 36893,\n 37057: 37266,\n 37058: 38738,\n 37059: 38745,\n 37060: 25993,\n 37061: 31246,\n 37062: 33030,\n 37063: 38587,\n 37064: 24109,\n 37065: 24796,\n 37066: 25114,\n 37067: 26021,\n 37068: 26132,\n 37069: 26512,\n 37070: 30707,\n 37071: 31309,\n 37072: 31821,\n 37073: 32318,\n 37074: 33034,\n 37075: 36012,\n 37076: 36196,\n 37077: 36321,\n 37078: 36447,\n 37079: 30889,\n 37080: 20999,\n 37081: 25305,\n 37082: 25509,\n 37083: 25666,\n 37084: 25240,\n 37085: 35373,\n 37086: 31363,\n 37087: 31680,\n 37088: 35500,\n 37089: 38634,\n 37090: 32118,\n 37091: 33292,\n 37092: 34633,\n 37093: 20185,\n 37094: 20808,\n 37095: 21315,\n 37096: 21344,\n 37097: 23459,\n 37098: 23554,\n 37099: 23574,\n 37100: 24029,\n 37101: 25126,\n 37102: 25159,\n 37103: 25776,\n 37104: 26643,\n 37105: 26676,\n 37106: 27849,\n 37107: 27973,\n 37108: 27927,\n 37109: 26579,\n 37110: 28508,\n 37111: 29006,\n 37112: 29053,\n 37113: 26059,\n 37114: 31359,\n 37115: 31661,\n 37116: 32218,\n 37184: 32330,\n 37185: 32680,\n 37186: 33146,\n 37187: 33307,\n 37188: 33337,\n 37189: 34214,\n 37190: 35438,\n 37191: 36046,\n 37192: 36341,\n 37193: 36984,\n 37194: 36983,\n 37195: 37549,\n 37196: 37521,\n 37197: 38275,\n 37198: 39854,\n 37199: 21069,\n 37200: 21892,\n 37201: 28472,\n 37202: 28982,\n 37203: 20840,\n 37204: 31109,\n 37205: 32341,\n 37206: 33203,\n 37207: 31950,\n 37208: 22092,\n 37209: 22609,\n 37210: 23720,\n 37211: 25514,\n 37212: 26366,\n 37213: 26365,\n 37214: 26970,\n 37215: 29401,\n 37216: 30095,\n 37217: 30094,\n 37218: 30990,\n 37219: 31062,\n 37220: 31199,\n 37221: 31895,\n 37222: 32032,\n 37223: 32068,\n 37224: 34311,\n 37225: 35380,\n 37226: 38459,\n 37227: 36961,\n 37228: 40736,\n 37229: 20711,\n 37230: 21109,\n 37231: 21452,\n 37232: 21474,\n 37233: 20489,\n 37234: 21930,\n 37235: 22766,\n 37236: 22863,\n 37237: 29245,\n 37238: 23435,\n 37239: 23652,\n 37240: 21277,\n 37241: 24803,\n 37242: 24819,\n 37243: 25436,\n 37244: 25475,\n 37245: 25407,\n 37246: 25531,\n 37248: 25805,\n 37249: 26089,\n 37250: 26361,\n 37251: 24035,\n 37252: 27085,\n 37253: 27133,\n 37254: 28437,\n 37255: 29157,\n 37256: 20105,\n 37257: 30185,\n 37258: 30456,\n 37259: 31379,\n 37260: 31967,\n 37261: 32207,\n 37262: 32156,\n 37263: 32865,\n 37264: 33609,\n 37265: 33624,\n 37266: 33900,\n 37267: 33980,\n 37268: 34299,\n 37269: 35013,\n 37270: 36208,\n 37271: 36865,\n 37272: 36973,\n 37273: 37783,\n 37274: 38684,\n 37275: 39442,\n 37276: 20687,\n 37277: 22679,\n 37278: 24974,\n 37279: 33235,\n 37280: 34101,\n 37281: 36104,\n 37282: 36896,\n 37283: 20419,\n 37284: 20596,\n 37285: 21063,\n 37286: 21363,\n 37287: 24687,\n 37288: 25417,\n 37289: 26463,\n 37290: 28204,\n 37291: 36275,\n 37292: 36895,\n 37293: 20439,\n 37294: 23646,\n 37295: 36042,\n 37296: 26063,\n 37297: 32154,\n 37298: 21330,\n 37299: 34966,\n 37300: 20854,\n 37301: 25539,\n 37302: 23384,\n 37303: 23403,\n 37304: 23562,\n 37305: 25613,\n 37306: 26449,\n 37307: 36956,\n 37308: 20182,\n 37309: 22810,\n 37310: 22826,\n 37311: 27760,\n 37312: 35409,\n 37313: 21822,\n 37314: 22549,\n 37315: 22949,\n 37316: 24816,\n 37317: 25171,\n 37318: 26561,\n 37319: 33333,\n 37320: 26965,\n 37321: 38464,\n 37322: 39364,\n 37323: 39464,\n 37324: 20307,\n 37325: 22534,\n 37326: 23550,\n 37327: 32784,\n 37328: 23729,\n 37329: 24111,\n 37330: 24453,\n 37331: 24608,\n 37332: 24907,\n 37333: 25140,\n 37334: 26367,\n 37335: 27888,\n 37336: 28382,\n 37337: 32974,\n 37338: 33151,\n 37339: 33492,\n 37340: 34955,\n 37341: 36024,\n 37342: 36864,\n 37343: 36910,\n 37344: 38538,\n 37345: 40667,\n 37346: 39899,\n 37347: 20195,\n 37348: 21488,\n 37349: 22823,\n 37350: 31532,\n 37351: 37261,\n 37352: 38988,\n 37353: 40441,\n 37354: 28381,\n 37355: 28711,\n 37356: 21331,\n 37357: 21828,\n 37358: 23429,\n 37359: 25176,\n 37360: 25246,\n 37361: 25299,\n 37362: 27810,\n 37363: 28655,\n 37364: 29730,\n 37365: 35351,\n 37366: 37944,\n 37367: 28609,\n 37368: 35582,\n 37369: 33592,\n 37370: 20967,\n 37371: 34552,\n 37372: 21482,\n 37440: 21481,\n 37441: 20294,\n 37442: 36948,\n 37443: 36784,\n 37444: 22890,\n 37445: 33073,\n 37446: 24061,\n 37447: 31466,\n 37448: 36799,\n 37449: 26842,\n 37450: 35895,\n 37451: 29432,\n 37452: 40008,\n 37453: 27197,\n 37454: 35504,\n 37455: 20025,\n 37456: 21336,\n 37457: 22022,\n 37458: 22374,\n 37459: 25285,\n 37460: 25506,\n 37461: 26086,\n 37462: 27470,\n 37463: 28129,\n 37464: 28251,\n 37465: 28845,\n 37466: 30701,\n 37467: 31471,\n 37468: 31658,\n 37469: 32187,\n 37470: 32829,\n 37471: 32966,\n 37472: 34507,\n 37473: 35477,\n 37474: 37723,\n 37475: 22243,\n 37476: 22727,\n 37477: 24382,\n 37478: 26029,\n 37479: 26262,\n 37480: 27264,\n 37481: 27573,\n 37482: 30007,\n 37483: 35527,\n 37484: 20516,\n 37485: 30693,\n 37486: 22320,\n 37487: 24347,\n 37488: 24677,\n 37489: 26234,\n 37490: 27744,\n 37491: 30196,\n 37492: 31258,\n 37493: 32622,\n 37494: 33268,\n 37495: 34584,\n 37496: 36933,\n 37497: 39347,\n 37498: 31689,\n 37499: 30044,\n 37500: 31481,\n 37501: 31569,\n 37502: 33988,\n 37504: 36880,\n 37505: 31209,\n 37506: 31378,\n 37507: 33590,\n 37508: 23265,\n 37509: 30528,\n 37510: 20013,\n 37511: 20210,\n 37512: 23449,\n 37513: 24544,\n 37514: 25277,\n 37515: 26172,\n 37516: 26609,\n 37517: 27880,\n 37518: 34411,\n 37519: 34935,\n 37520: 35387,\n 37521: 37198,\n 37522: 37619,\n 37523: 39376,\n 37524: 27159,\n 37525: 28710,\n 37526: 29482,\n 37527: 33511,\n 37528: 33879,\n 37529: 36015,\n 37530: 19969,\n 37531: 20806,\n 37532: 20939,\n 37533: 21899,\n 37534: 23541,\n 37535: 24086,\n 37536: 24115,\n 37537: 24193,\n 37538: 24340,\n 37539: 24373,\n 37540: 24427,\n 37541: 24500,\n 37542: 25074,\n 37543: 25361,\n 37544: 26274,\n 37545: 26397,\n 37546: 28526,\n 37547: 29266,\n 37548: 30010,\n 37549: 30522,\n 37550: 32884,\n 37551: 33081,\n 37552: 33144,\n 37553: 34678,\n 37554: 35519,\n 37555: 35548,\n 37556: 36229,\n 37557: 36339,\n 37558: 37530,\n 37559: 38263,\n 37560: 38914,\n 37561: 40165,\n 37562: 21189,\n 37563: 25431,\n 37564: 30452,\n 37565: 26389,\n 37566: 27784,\n 37567: 29645,\n 37568: 36035,\n 37569: 37806,\n 37570: 38515,\n 37571: 27941,\n 37572: 22684,\n 37573: 26894,\n 37574: 27084,\n 37575: 36861,\n 37576: 37786,\n 37577: 30171,\n 37578: 36890,\n 37579: 22618,\n 37580: 26626,\n 37581: 25524,\n 37582: 27131,\n 37583: 20291,\n 37584: 28460,\n 37585: 26584,\n 37586: 36795,\n 37587: 34086,\n 37588: 32180,\n 37589: 37716,\n 37590: 26943,\n 37591: 28528,\n 37592: 22378,\n 37593: 22775,\n 37594: 23340,\n 37595: 32044,\n 37596: 29226,\n 37597: 21514,\n 37598: 37347,\n 37599: 40372,\n 37600: 20141,\n 37601: 20302,\n 37602: 20572,\n 37603: 20597,\n 37604: 21059,\n 37605: 35998,\n 37606: 21576,\n 37607: 22564,\n 37608: 23450,\n 37609: 24093,\n 37610: 24213,\n 37611: 24237,\n 37612: 24311,\n 37613: 24351,\n 37614: 24716,\n 37615: 25269,\n 37616: 25402,\n 37617: 25552,\n 37618: 26799,\n 37619: 27712,\n 37620: 30855,\n 37621: 31118,\n 37622: 31243,\n 37623: 32224,\n 37624: 33351,\n 37625: 35330,\n 37626: 35558,\n 37627: 36420,\n 37628: 36883,\n 37696: 37048,\n 37697: 37165,\n 37698: 37336,\n 37699: 40718,\n 37700: 27877,\n 37701: 25688,\n 37702: 25826,\n 37703: 25973,\n 37704: 28404,\n 37705: 30340,\n 37706: 31515,\n 37707: 36969,\n 37708: 37841,\n 37709: 28346,\n 37710: 21746,\n 37711: 24505,\n 37712: 25764,\n 37713: 36685,\n 37714: 36845,\n 37715: 37444,\n 37716: 20856,\n 37717: 22635,\n 37718: 22825,\n 37719: 23637,\n 37720: 24215,\n 37721: 28155,\n 37722: 32399,\n 37723: 29980,\n 37724: 36028,\n 37725: 36578,\n 37726: 39003,\n 37727: 28857,\n 37728: 20253,\n 37729: 27583,\n 37730: 28593,\n 37731: 30000,\n 37732: 38651,\n 37733: 20814,\n 37734: 21520,\n 37735: 22581,\n 37736: 22615,\n 37737: 22956,\n 37738: 23648,\n 37739: 24466,\n 37740: 26007,\n 37741: 26460,\n 37742: 28193,\n 37743: 30331,\n 37744: 33759,\n 37745: 36077,\n 37746: 36884,\n 37747: 37117,\n 37748: 37709,\n 37749: 30757,\n 37750: 30778,\n 37751: 21162,\n 37752: 24230,\n 37753: 22303,\n 37754: 22900,\n 37755: 24594,\n 37756: 20498,\n 37757: 20826,\n 37758: 20908,\n 37760: 20941,\n 37761: 20992,\n 37762: 21776,\n 37763: 22612,\n 37764: 22616,\n 37765: 22871,\n 37766: 23445,\n 37767: 23798,\n 37768: 23947,\n 37769: 24764,\n 37770: 25237,\n 37771: 25645,\n 37772: 26481,\n 37773: 26691,\n 37774: 26812,\n 37775: 26847,\n 37776: 30423,\n 37777: 28120,\n 37778: 28271,\n 37779: 28059,\n 37780: 28783,\n 37781: 29128,\n 37782: 24403,\n 37783: 30168,\n 37784: 31095,\n 37785: 31561,\n 37786: 31572,\n 37787: 31570,\n 37788: 31958,\n 37789: 32113,\n 37790: 21040,\n 37791: 33891,\n 37792: 34153,\n 37793: 34276,\n 37794: 35342,\n 37795: 35588,\n 37796: 35910,\n 37797: 36367,\n 37798: 36867,\n 37799: 36879,\n 37800: 37913,\n 37801: 38518,\n 37802: 38957,\n 37803: 39472,\n 37804: 38360,\n 37805: 20685,\n 37806: 21205,\n 37807: 21516,\n 37808: 22530,\n 37809: 23566,\n 37810: 24999,\n 37811: 25758,\n 37812: 27934,\n 37813: 30643,\n 37814: 31461,\n 37815: 33012,\n 37816: 33796,\n 37817: 36947,\n 37818: 37509,\n 37819: 23776,\n 37820: 40199,\n 37821: 21311,\n 37822: 24471,\n 37823: 24499,\n 37824: 28060,\n 37825: 29305,\n 37826: 30563,\n 37827: 31167,\n 37828: 31716,\n 37829: 27602,\n 37830: 29420,\n 37831: 35501,\n 37832: 26627,\n 37833: 27233,\n 37834: 20984,\n 37835: 31361,\n 37836: 26932,\n 37837: 23626,\n 37838: 40182,\n 37839: 33515,\n 37840: 23493,\n 37841: 37193,\n 37842: 28702,\n 37843: 22136,\n 37844: 23663,\n 37845: 24775,\n 37846: 25958,\n 37847: 27788,\n 37848: 35930,\n 37849: 36929,\n 37850: 38931,\n 37851: 21585,\n 37852: 26311,\n 37853: 37389,\n 37854: 22856,\n 37855: 37027,\n 37856: 20869,\n 37857: 20045,\n 37858: 20970,\n 37859: 34201,\n 37860: 35598,\n 37861: 28760,\n 37862: 25466,\n 37863: 37707,\n 37864: 26978,\n 37865: 39348,\n 37866: 32260,\n 37867: 30071,\n 37868: 21335,\n 37869: 26976,\n 37870: 36575,\n 37871: 38627,\n 37872: 27741,\n 37873: 20108,\n 37874: 23612,\n 37875: 24336,\n 37876: 36841,\n 37877: 21250,\n 37878: 36049,\n 37879: 32905,\n 37880: 34425,\n 37881: 24319,\n 37882: 26085,\n 37883: 20083,\n 37884: 20837,\n 37952: 22914,\n 37953: 23615,\n 37954: 38894,\n 37955: 20219,\n 37956: 22922,\n 37957: 24525,\n 37958: 35469,\n 37959: 28641,\n 37960: 31152,\n 37961: 31074,\n 37962: 23527,\n 37963: 33905,\n 37964: 29483,\n 37965: 29105,\n 37966: 24180,\n 37967: 24565,\n 37968: 25467,\n 37969: 25754,\n 37970: 29123,\n 37971: 31896,\n 37972: 20035,\n 37973: 24316,\n 37974: 20043,\n 37975: 22492,\n 37976: 22178,\n 37977: 24745,\n 37978: 28611,\n 37979: 32013,\n 37980: 33021,\n 37981: 33075,\n 37982: 33215,\n 37983: 36786,\n 37984: 35223,\n 37985: 34468,\n 37986: 24052,\n 37987: 25226,\n 37988: 25773,\n 37989: 35207,\n 37990: 26487,\n 37991: 27874,\n 37992: 27966,\n 37993: 29750,\n 37994: 30772,\n 37995: 23110,\n 37996: 32629,\n 37997: 33453,\n 37998: 39340,\n 37999: 20467,\n 38000: 24259,\n 38001: 25309,\n 38002: 25490,\n 38003: 25943,\n 38004: 26479,\n 38005: 30403,\n 38006: 29260,\n 38007: 32972,\n 38008: 32954,\n 38009: 36649,\n 38010: 37197,\n 38011: 20493,\n 38012: 22521,\n 38013: 23186,\n 38014: 26757,\n 38016: 26995,\n 38017: 29028,\n 38018: 29437,\n 38019: 36023,\n 38020: 22770,\n 38021: 36064,\n 38022: 38506,\n 38023: 36889,\n 38024: 34687,\n 38025: 31204,\n 38026: 30695,\n 38027: 33833,\n 38028: 20271,\n 38029: 21093,\n 38030: 21338,\n 38031: 25293,\n 38032: 26575,\n 38033: 27850,\n 38034: 30333,\n 38035: 31636,\n 38036: 31893,\n 38037: 33334,\n 38038: 34180,\n 38039: 36843,\n 38040: 26333,\n 38041: 28448,\n 38042: 29190,\n 38043: 32283,\n 38044: 33707,\n 38045: 39361,\n 38046: 40614,\n 38047: 20989,\n 38048: 31665,\n 38049: 30834,\n 38050: 31672,\n 38051: 32903,\n 38052: 31560,\n 38053: 27368,\n 38054: 24161,\n 38055: 32908,\n 38056: 30033,\n 38057: 30048,\n 38058: 20843,\n 38059: 37474,\n 38060: 28300,\n 38061: 30330,\n 38062: 37271,\n 38063: 39658,\n 38064: 20240,\n 38065: 32624,\n 38066: 25244,\n 38067: 31567,\n 38068: 38309,\n 38069: 40169,\n 38070: 22138,\n 38071: 22617,\n 38072: 34532,\n 38073: 38588,\n 38074: 20276,\n 38075: 21028,\n 38076: 21322,\n 38077: 21453,\n 38078: 21467,\n 38079: 24070,\n 38080: 25644,\n 38081: 26001,\n 38082: 26495,\n 38083: 27710,\n 38084: 27726,\n 38085: 29256,\n 38086: 29359,\n 38087: 29677,\n 38088: 30036,\n 38089: 32321,\n 38090: 33324,\n 38091: 34281,\n 38092: 36009,\n 38093: 31684,\n 38094: 37318,\n 38095: 29033,\n 38096: 38930,\n 38097: 39151,\n 38098: 25405,\n 38099: 26217,\n 38100: 30058,\n 38101: 30436,\n 38102: 30928,\n 38103: 34115,\n 38104: 34542,\n 38105: 21290,\n 38106: 21329,\n 38107: 21542,\n 38108: 22915,\n 38109: 24199,\n 38110: 24444,\n 38111: 24754,\n 38112: 25161,\n 38113: 25209,\n 38114: 25259,\n 38115: 26000,\n 38116: 27604,\n 38117: 27852,\n 38118: 30130,\n 38119: 30382,\n 38120: 30865,\n 38121: 31192,\n 38122: 32203,\n 38123: 32631,\n 38124: 32933,\n 38125: 34987,\n 38126: 35513,\n 38127: 36027,\n 38128: 36991,\n 38129: 38750,\n 38130: 39131,\n 38131: 27147,\n 38132: 31800,\n 38133: 20633,\n 38134: 23614,\n 38135: 24494,\n 38136: 26503,\n 38137: 27608,\n 38138: 29749,\n 38139: 30473,\n 38140: 32654,\n 38208: 40763,\n 38209: 26570,\n 38210: 31255,\n 38211: 21305,\n 38212: 30091,\n 38213: 39661,\n 38214: 24422,\n 38215: 33181,\n 38216: 33777,\n 38217: 32920,\n 38218: 24380,\n 38219: 24517,\n 38220: 30050,\n 38221: 31558,\n 38222: 36924,\n 38223: 26727,\n 38224: 23019,\n 38225: 23195,\n 38226: 32016,\n 38227: 30334,\n 38228: 35628,\n 38229: 20469,\n 38230: 24426,\n 38231: 27161,\n 38232: 27703,\n 38233: 28418,\n 38234: 29922,\n 38235: 31080,\n 38236: 34920,\n 38237: 35413,\n 38238: 35961,\n 38239: 24287,\n 38240: 25551,\n 38241: 30149,\n 38242: 31186,\n 38243: 33495,\n 38244: 37672,\n 38245: 37618,\n 38246: 33948,\n 38247: 34541,\n 38248: 39981,\n 38249: 21697,\n 38250: 24428,\n 38251: 25996,\n 38252: 27996,\n 38253: 28693,\n 38254: 36007,\n 38255: 36051,\n 38256: 38971,\n 38257: 25935,\n 38258: 29942,\n 38259: 19981,\n 38260: 20184,\n 38261: 22496,\n 38262: 22827,\n 38263: 23142,\n 38264: 23500,\n 38265: 20904,\n 38266: 24067,\n 38267: 24220,\n 38268: 24598,\n 38269: 25206,\n 38270: 25975,\n 38272: 26023,\n 38273: 26222,\n 38274: 28014,\n 38275: 29238,\n 38276: 31526,\n 38277: 33104,\n 38278: 33178,\n 38279: 33433,\n 38280: 35676,\n 38281: 36000,\n 38282: 36070,\n 38283: 36212,\n 38284: 38428,\n 38285: 38468,\n 38286: 20398,\n 38287: 25771,\n 38288: 27494,\n 38289: 33310,\n 38290: 33889,\n 38291: 34154,\n 38292: 37096,\n 38293: 23553,\n 38294: 26963,\n 38295: 39080,\n 38296: 33914,\n 38297: 34135,\n 38298: 20239,\n 38299: 21103,\n 38300: 24489,\n 38301: 24133,\n 38302: 26381,\n 38303: 31119,\n 38304: 33145,\n 38305: 35079,\n 38306: 35206,\n 38307: 28149,\n 38308: 24343,\n 38309: 25173,\n 38310: 27832,\n 38311: 20175,\n 38312: 29289,\n 38313: 39826,\n 38314: 20998,\n 38315: 21563,\n 38316: 22132,\n 38317: 22707,\n 38318: 24996,\n 38319: 25198,\n 38320: 28954,\n 38321: 22894,\n 38322: 31881,\n 38323: 31966,\n 38324: 32027,\n 38325: 38640,\n 38326: 25991,\n 38327: 32862,\n 38328: 19993,\n 38329: 20341,\n 38330: 20853,\n 38331: 22592,\n 38332: 24163,\n 38333: 24179,\n 38334: 24330,\n 38335: 26564,\n 38336: 20006,\n 38337: 34109,\n 38338: 38281,\n 38339: 38491,\n 38340: 31859,\n 38341: 38913,\n 38342: 20731,\n 38343: 22721,\n 38344: 30294,\n 38345: 30887,\n 38346: 21029,\n 38347: 30629,\n 38348: 34065,\n 38349: 31622,\n 38350: 20559,\n 38351: 22793,\n 38352: 29255,\n 38353: 31687,\n 38354: 32232,\n 38355: 36794,\n 38356: 36820,\n 38357: 36941,\n 38358: 20415,\n 38359: 21193,\n 38360: 23081,\n 38361: 24321,\n 38362: 38829,\n 38363: 20445,\n 38364: 33303,\n 38365: 37610,\n 38366: 22275,\n 38367: 25429,\n 38368: 27497,\n 38369: 29995,\n 38370: 35036,\n 38371: 36628,\n 38372: 31298,\n 38373: 21215,\n 38374: 22675,\n 38375: 24917,\n 38376: 25098,\n 38377: 26286,\n 38378: 27597,\n 38379: 31807,\n 38380: 33769,\n 38381: 20515,\n 38382: 20472,\n 38383: 21253,\n 38384: 21574,\n 38385: 22577,\n 38386: 22857,\n 38387: 23453,\n 38388: 23792,\n 38389: 23791,\n 38390: 23849,\n 38391: 24214,\n 38392: 25265,\n 38393: 25447,\n 38394: 25918,\n 38395: 26041,\n 38396: 26379,\n 38464: 27861,\n 38465: 27873,\n 38466: 28921,\n 38467: 30770,\n 38468: 32299,\n 38469: 32990,\n 38470: 33459,\n 38471: 33804,\n 38472: 34028,\n 38473: 34562,\n 38474: 35090,\n 38475: 35370,\n 38476: 35914,\n 38477: 37030,\n 38478: 37586,\n 38479: 39165,\n 38480: 40179,\n 38481: 40300,\n 38482: 20047,\n 38483: 20129,\n 38484: 20621,\n 38485: 21078,\n 38486: 22346,\n 38487: 22952,\n 38488: 24125,\n 38489: 24536,\n 38490: 24537,\n 38491: 25151,\n 38492: 26292,\n 38493: 26395,\n 38494: 26576,\n 38495: 26834,\n 38496: 20882,\n 38497: 32033,\n 38498: 32938,\n 38499: 33192,\n 38500: 35584,\n 38501: 35980,\n 38502: 36031,\n 38503: 37502,\n 38504: 38450,\n 38505: 21536,\n 38506: 38956,\n 38507: 21271,\n 38508: 20693,\n 38509: 21340,\n 38510: 22696,\n 38511: 25778,\n 38512: 26420,\n 38513: 29287,\n 38514: 30566,\n 38515: 31302,\n 38516: 37350,\n 38517: 21187,\n 38518: 27809,\n 38519: 27526,\n 38520: 22528,\n 38521: 24140,\n 38522: 22868,\n 38523: 26412,\n 38524: 32763,\n 38525: 20961,\n 38526: 30406,\n 38528: 25705,\n 38529: 30952,\n 38530: 39764,\n 38531: 40635,\n 38532: 22475,\n 38533: 22969,\n 38534: 26151,\n 38535: 26522,\n 38536: 27598,\n 38537: 21737,\n 38538: 27097,\n 38539: 24149,\n 38540: 33180,\n 38541: 26517,\n 38542: 39850,\n 38543: 26622,\n 38544: 40018,\n 38545: 26717,\n 38546: 20134,\n 38547: 20451,\n 38548: 21448,\n 38549: 25273,\n 38550: 26411,\n 38551: 27819,\n 38552: 36804,\n 38553: 20397,\n 38554: 32365,\n 38555: 40639,\n 38556: 19975,\n 38557: 24930,\n 38558: 28288,\n 38559: 28459,\n 38560: 34067,\n 38561: 21619,\n 38562: 26410,\n 38563: 39749,\n 38564: 24051,\n 38565: 31637,\n 38566: 23724,\n 38567: 23494,\n 38568: 34588,\n 38569: 28234,\n 38570: 34001,\n 38571: 31252,\n 38572: 33032,\n 38573: 22937,\n 38574: 31885,\n 38575: 27665,\n 38576: 30496,\n 38577: 21209,\n 38578: 22818,\n 38579: 28961,\n 38580: 29279,\n 38581: 30683,\n 38582: 38695,\n 38583: 40289,\n 38584: 26891,\n 38585: 23167,\n 38586: 23064,\n 38587: 20901,\n 38588: 21517,\n 38589: 21629,\n 38590: 26126,\n 38591: 30431,\n 38592: 36855,\n 38593: 37528,\n 38594: 40180,\n 38595: 23018,\n 38596: 29277,\n 38597: 28357,\n 38598: 20813,\n 38599: 26825,\n 38600: 32191,\n 38601: 32236,\n 38602: 38754,\n 38603: 40634,\n 38604: 25720,\n 38605: 27169,\n 38606: 33538,\n 38607: 22916,\n 38608: 23391,\n 38609: 27611,\n 38610: 29467,\n 38611: 30450,\n 38612: 32178,\n 38613: 32791,\n 38614: 33945,\n 38615: 20786,\n 38616: 26408,\n 38617: 40665,\n 38618: 30446,\n 38619: 26466,\n 38620: 21247,\n 38621: 39173,\n 38622: 23588,\n 38623: 25147,\n 38624: 31870,\n 38625: 36016,\n 38626: 21839,\n 38627: 24758,\n 38628: 32011,\n 38629: 38272,\n 38630: 21249,\n 38631: 20063,\n 38632: 20918,\n 38633: 22812,\n 38634: 29242,\n 38635: 32822,\n 38636: 37326,\n 38637: 24357,\n 38638: 30690,\n 38639: 21380,\n 38640: 24441,\n 38641: 32004,\n 38642: 34220,\n 38643: 35379,\n 38644: 36493,\n 38645: 38742,\n 38646: 26611,\n 38647: 34222,\n 38648: 37971,\n 38649: 24841,\n 38650: 24840,\n 38651: 27833,\n 38652: 30290,\n 38720: 35565,\n 38721: 36664,\n 38722: 21807,\n 38723: 20305,\n 38724: 20778,\n 38725: 21191,\n 38726: 21451,\n 38727: 23461,\n 38728: 24189,\n 38729: 24736,\n 38730: 24962,\n 38731: 25558,\n 38732: 26377,\n 38733: 26586,\n 38734: 28263,\n 38735: 28044,\n 38736: 29494,\n 38737: 29495,\n 38738: 30001,\n 38739: 31056,\n 38740: 35029,\n 38741: 35480,\n 38742: 36938,\n 38743: 37009,\n 38744: 37109,\n 38745: 38596,\n 38746: 34701,\n 38747: 22805,\n 38748: 20104,\n 38749: 20313,\n 38750: 19982,\n 38751: 35465,\n 38752: 36671,\n 38753: 38928,\n 38754: 20653,\n 38755: 24188,\n 38756: 22934,\n 38757: 23481,\n 38758: 24248,\n 38759: 25562,\n 38760: 25594,\n 38761: 25793,\n 38762: 26332,\n 38763: 26954,\n 38764: 27096,\n 38765: 27915,\n 38766: 28342,\n 38767: 29076,\n 38768: 29992,\n 38769: 31407,\n 38770: 32650,\n 38771: 32768,\n 38772: 33865,\n 38773: 33993,\n 38774: 35201,\n 38775: 35617,\n 38776: 36362,\n 38777: 36965,\n 38778: 38525,\n 38779: 39178,\n 38780: 24958,\n 38781: 25233,\n 38782: 27442,\n 38784: 27779,\n 38785: 28020,\n 38786: 32716,\n 38787: 32764,\n 38788: 28096,\n 38789: 32645,\n 38790: 34746,\n 38791: 35064,\n 38792: 26469,\n 38793: 33713,\n 38794: 38972,\n 38795: 38647,\n 38796: 27931,\n 38797: 32097,\n 38798: 33853,\n 38799: 37226,\n 38800: 20081,\n 38801: 21365,\n 38802: 23888,\n 38803: 27396,\n 38804: 28651,\n 38805: 34253,\n 38806: 34349,\n 38807: 35239,\n 38808: 21033,\n 38809: 21519,\n 38810: 23653,\n 38811: 26446,\n 38812: 26792,\n 38813: 29702,\n 38814: 29827,\n 38815: 30178,\n 38816: 35023,\n 38817: 35041,\n 38818: 37324,\n 38819: 38626,\n 38820: 38520,\n 38821: 24459,\n 38822: 29575,\n 38823: 31435,\n 38824: 33870,\n 38825: 25504,\n 38826: 30053,\n 38827: 21129,\n 38828: 27969,\n 38829: 28316,\n 38830: 29705,\n 38831: 30041,\n 38832: 30827,\n 38833: 31890,\n 38834: 38534,\n 38835: 31452,\n 38836: 40845,\n 38837: 20406,\n 38838: 24942,\n 38839: 26053,\n 38840: 34396,\n 38841: 20102,\n 38842: 20142,\n 38843: 20698,\n 38844: 20001,\n 38845: 20940,\n 38846: 23534,\n 38847: 26009,\n 38848: 26753,\n 38849: 28092,\n 38850: 29471,\n 38851: 30274,\n 38852: 30637,\n 38853: 31260,\n 38854: 31975,\n 38855: 33391,\n 38856: 35538,\n 38857: 36988,\n 38858: 37327,\n 38859: 38517,\n 38860: 38936,\n 38861: 21147,\n 38862: 32209,\n 38863: 20523,\n 38864: 21400,\n 38865: 26519,\n 38866: 28107,\n 38867: 29136,\n 38868: 29747,\n 38869: 33256,\n 38870: 36650,\n 38871: 38563,\n 38872: 40023,\n 38873: 40607,\n 38874: 29792,\n 38875: 22593,\n 38876: 28057,\n 38877: 32047,\n 38878: 39006,\n 38879: 20196,\n 38880: 20278,\n 38881: 20363,\n 38882: 20919,\n 38883: 21169,\n 38884: 23994,\n 38885: 24604,\n 38886: 29618,\n 38887: 31036,\n 38888: 33491,\n 38889: 37428,\n 38890: 38583,\n 38891: 38646,\n 38892: 38666,\n 38893: 40599,\n 38894: 40802,\n 38895: 26278,\n 38896: 27508,\n 38897: 21015,\n 38898: 21155,\n 38899: 28872,\n 38900: 35010,\n 38901: 24265,\n 38902: 24651,\n 38903: 24976,\n 38904: 28451,\n 38905: 29001,\n 38906: 31806,\n 38907: 32244,\n 38908: 32879,\n 38976: 34030,\n 38977: 36899,\n 38978: 37676,\n 38979: 21570,\n 38980: 39791,\n 38981: 27347,\n 38982: 28809,\n 38983: 36034,\n 38984: 36335,\n 38985: 38706,\n 38986: 21172,\n 38987: 23105,\n 38988: 24266,\n 38989: 24324,\n 38990: 26391,\n 38991: 27004,\n 38992: 27028,\n 38993: 28010,\n 38994: 28431,\n 38995: 29282,\n 38996: 29436,\n 38997: 31725,\n 38998: 32769,\n 38999: 32894,\n 39000: 34635,\n 39001: 37070,\n 39002: 20845,\n 39003: 40595,\n 39004: 31108,\n 39005: 32907,\n 39006: 37682,\n 39007: 35542,\n 39008: 20525,\n 39009: 21644,\n 39010: 35441,\n 39011: 27498,\n 39012: 36036,\n 39013: 33031,\n 39014: 24785,\n 39015: 26528,\n 39016: 40434,\n 39017: 20121,\n 39018: 20120,\n 39019: 39952,\n 39020: 35435,\n 39021: 34241,\n 39022: 34152,\n 39023: 26880,\n 39024: 28286,\n 39025: 30871,\n 39026: 33109,\n 39071: 24332,\n 39072: 19984,\n 39073: 19989,\n 39074: 20010,\n 39075: 20017,\n 39076: 20022,\n 39077: 20028,\n 39078: 20031,\n 39079: 20034,\n 39080: 20054,\n 39081: 20056,\n 39082: 20098,\n 39083: 20101,\n 39084: 35947,\n 39085: 20106,\n 39086: 33298,\n 39087: 24333,\n 39088: 20110,\n 39089: 20126,\n 39090: 20127,\n 39091: 20128,\n 39092: 20130,\n 39093: 20144,\n 39094: 20147,\n 39095: 20150,\n 39096: 20174,\n 39097: 20173,\n 39098: 20164,\n 39099: 20166,\n 39100: 20162,\n 39101: 20183,\n 39102: 20190,\n 39103: 20205,\n 39104: 20191,\n 39105: 20215,\n 39106: 20233,\n 39107: 20314,\n 39108: 20272,\n 39109: 20315,\n 39110: 20317,\n 39111: 20311,\n 39112: 20295,\n 39113: 20342,\n 39114: 20360,\n 39115: 20367,\n 39116: 20376,\n 39117: 20347,\n 39118: 20329,\n 39119: 20336,\n 39120: 20369,\n 39121: 20335,\n 39122: 20358,\n 39123: 20374,\n 39124: 20760,\n 39125: 20436,\n 39126: 20447,\n 39127: 20430,\n 39128: 20440,\n 39129: 20443,\n 39130: 20433,\n 39131: 20442,\n 39132: 20432,\n 39133: 20452,\n 39134: 20453,\n 39135: 20506,\n 39136: 20520,\n 39137: 20500,\n 39138: 20522,\n 39139: 20517,\n 39140: 20485,\n 39141: 20252,\n 39142: 20470,\n 39143: 20513,\n 39144: 20521,\n 39145: 20524,\n 39146: 20478,\n 39147: 20463,\n 39148: 20497,\n 39149: 20486,\n 39150: 20547,\n 39151: 20551,\n 39152: 26371,\n 39153: 20565,\n 39154: 20560,\n 39155: 20552,\n 39156: 20570,\n 39157: 20566,\n 39158: 20588,\n 39159: 20600,\n 39160: 20608,\n 39161: 20634,\n 39162: 20613,\n 39163: 20660,\n 39164: 20658,\n 39232: 20681,\n 39233: 20682,\n 39234: 20659,\n 39235: 20674,\n 39236: 20694,\n 39237: 20702,\n 39238: 20709,\n 39239: 20717,\n 39240: 20707,\n 39241: 20718,\n 39242: 20729,\n 39243: 20725,\n 39244: 20745,\n 39245: 20737,\n 39246: 20738,\n 39247: 20758,\n 39248: 20757,\n 39249: 20756,\n 39250: 20762,\n 39251: 20769,\n 39252: 20794,\n 39253: 20791,\n 39254: 20796,\n 39255: 20795,\n 39256: 20799,\n 39257: 20800,\n 39258: 20818,\n 39259: 20812,\n 39260: 20820,\n 39261: 20834,\n 39262: 31480,\n 39263: 20841,\n 39264: 20842,\n 39265: 20846,\n 39266: 20864,\n 39267: 20866,\n 39268: 22232,\n 39269: 20876,\n 39270: 20873,\n 39271: 20879,\n 39272: 20881,\n 39273: 20883,\n 39274: 20885,\n 39275: 20886,\n 39276: 20900,\n 39277: 20902,\n 39278: 20898,\n 39279: 20905,\n 39280: 20906,\n 39281: 20907,\n 39282: 20915,\n 39283: 20913,\n 39284: 20914,\n 39285: 20912,\n 39286: 20917,\n 39287: 20925,\n 39288: 20933,\n 39289: 20937,\n 39290: 20955,\n 39291: 20960,\n 39292: 34389,\n 39293: 20969,\n 39294: 20973,\n 39296: 20976,\n 39297: 20981,\n 39298: 20990,\n 39299: 20996,\n 39300: 21003,\n 39301: 21012,\n 39302: 21006,\n 39303: 21031,\n 39304: 21034,\n 39305: 21038,\n 39306: 21043,\n 39307: 21049,\n 39308: 21071,\n 39309: 21060,\n 39310: 21067,\n 39311: 21068,\n 39312: 21086,\n 39313: 21076,\n 39314: 21098,\n 39315: 21108,\n 39316: 21097,\n 39317: 21107,\n 39318: 21119,\n 39319: 21117,\n 39320: 21133,\n 39321: 21140,\n 39322: 21138,\n 39323: 21105,\n 39324: 21128,\n 39325: 21137,\n 39326: 36776,\n 39327: 36775,\n 39328: 21164,\n 39329: 21165,\n 39330: 21180,\n 39331: 21173,\n 39332: 21185,\n 39333: 21197,\n 39334: 21207,\n 39335: 21214,\n 39336: 21219,\n 39337: 21222,\n 39338: 39149,\n 39339: 21216,\n 39340: 21235,\n 39341: 21237,\n 39342: 21240,\n 39343: 21241,\n 39344: 21254,\n 39345: 21256,\n 39346: 30008,\n 39347: 21261,\n 39348: 21264,\n 39349: 21263,\n 39350: 21269,\n 39351: 21274,\n 39352: 21283,\n 39353: 21295,\n 39354: 21297,\n 39355: 21299,\n 39356: 21304,\n 39357: 21312,\n 39358: 21318,\n 39359: 21317,\n 39360: 19991,\n 39361: 21321,\n 39362: 21325,\n 39363: 20950,\n 39364: 21342,\n 39365: 21353,\n 39366: 21358,\n 39367: 22808,\n 39368: 21371,\n 39369: 21367,\n 39370: 21378,\n 39371: 21398,\n 39372: 21408,\n 39373: 21414,\n 39374: 21413,\n 39375: 21422,\n 39376: 21424,\n 39377: 21430,\n 39378: 21443,\n 39379: 31762,\n 39380: 38617,\n 39381: 21471,\n 39382: 26364,\n 39383: 29166,\n 39384: 21486,\n 39385: 21480,\n 39386: 21485,\n 39387: 21498,\n 39388: 21505,\n 39389: 21565,\n 39390: 21568,\n 39391: 21548,\n 39392: 21549,\n 39393: 21564,\n 39394: 21550,\n 39395: 21558,\n 39396: 21545,\n 39397: 21533,\n 39398: 21582,\n 39399: 21647,\n 39400: 21621,\n 39401: 21646,\n 39402: 21599,\n 39403: 21617,\n 39404: 21623,\n 39405: 21616,\n 39406: 21650,\n 39407: 21627,\n 39408: 21632,\n 39409: 21622,\n 39410: 21636,\n 39411: 21648,\n 39412: 21638,\n 39413: 21703,\n 39414: 21666,\n 39415: 21688,\n 39416: 21669,\n 39417: 21676,\n 39418: 21700,\n 39419: 21704,\n 39420: 21672,\n 39488: 21675,\n 39489: 21698,\n 39490: 21668,\n 39491: 21694,\n 39492: 21692,\n 39493: 21720,\n 39494: 21733,\n 39495: 21734,\n 39496: 21775,\n 39497: 21780,\n 39498: 21757,\n 39499: 21742,\n 39500: 21741,\n 39501: 21754,\n 39502: 21730,\n 39503: 21817,\n 39504: 21824,\n 39505: 21859,\n 39506: 21836,\n 39507: 21806,\n 39508: 21852,\n 39509: 21829,\n 39510: 21846,\n 39511: 21847,\n 39512: 21816,\n 39513: 21811,\n 39514: 21853,\n 39515: 21913,\n 39516: 21888,\n 39517: 21679,\n 39518: 21898,\n 39519: 21919,\n 39520: 21883,\n 39521: 21886,\n 39522: 21912,\n 39523: 21918,\n 39524: 21934,\n 39525: 21884,\n 39526: 21891,\n 39527: 21929,\n 39528: 21895,\n 39529: 21928,\n 39530: 21978,\n 39531: 21957,\n 39532: 21983,\n 39533: 21956,\n 39534: 21980,\n 39535: 21988,\n 39536: 21972,\n 39537: 22036,\n 39538: 22007,\n 39539: 22038,\n 39540: 22014,\n 39541: 22013,\n 39542: 22043,\n 39543: 22009,\n 39544: 22094,\n 39545: 22096,\n 39546: 29151,\n 39547: 22068,\n 39548: 22070,\n 39549: 22066,\n 39550: 22072,\n 39552: 22123,\n 39553: 22116,\n 39554: 22063,\n 39555: 22124,\n 39556: 22122,\n 39557: 22150,\n 39558: 22144,\n 39559: 22154,\n 39560: 22176,\n 39561: 22164,\n 39562: 22159,\n 39563: 22181,\n 39564: 22190,\n 39565: 22198,\n 39566: 22196,\n 39567: 22210,\n 39568: 22204,\n 39569: 22209,\n 39570: 22211,\n 39571: 22208,\n 39572: 22216,\n 39573: 22222,\n 39574: 22225,\n 39575: 22227,\n 39576: 22231,\n 39577: 22254,\n 39578: 22265,\n 39579: 22272,\n 39580: 22271,\n 39581: 22276,\n 39582: 22281,\n 39583: 22280,\n 39584: 22283,\n 39585: 22285,\n 39586: 22291,\n 39587: 22296,\n 39588: 22294,\n 39589: 21959,\n 39590: 22300,\n 39591: 22310,\n 39592: 22327,\n 39593: 22328,\n 39594: 22350,\n 39595: 22331,\n 39596: 22336,\n 39597: 22351,\n 39598: 22377,\n 39599: 22464,\n 39600: 22408,\n 39601: 22369,\n 39602: 22399,\n 39603: 22409,\n 39604: 22419,\n 39605: 22432,\n 39606: 22451,\n 39607: 22436,\n 39608: 22442,\n 39609: 22448,\n 39610: 22467,\n 39611: 22470,\n 39612: 22484,\n 39613: 22482,\n 39614: 22483,\n 39615: 22538,\n 39616: 22486,\n 39617: 22499,\n 39618: 22539,\n 39619: 22553,\n 39620: 22557,\n 39621: 22642,\n 39622: 22561,\n 39623: 22626,\n 39624: 22603,\n 39625: 22640,\n 39626: 27584,\n 39627: 22610,\n 39628: 22589,\n 39629: 22649,\n 39630: 22661,\n 39631: 22713,\n 39632: 22687,\n 39633: 22699,\n 39634: 22714,\n 39635: 22750,\n 39636: 22715,\n 39637: 22712,\n 39638: 22702,\n 39639: 22725,\n 39640: 22739,\n 39641: 22737,\n 39642: 22743,\n 39643: 22745,\n 39644: 22744,\n 39645: 22757,\n 39646: 22748,\n 39647: 22756,\n 39648: 22751,\n 39649: 22767,\n 39650: 22778,\n 39651: 22777,\n 39652: 22779,\n 39653: 22780,\n 39654: 22781,\n 39655: 22786,\n 39656: 22794,\n 39657: 22800,\n 39658: 22811,\n 39659: 26790,\n 39660: 22821,\n 39661: 22828,\n 39662: 22829,\n 39663: 22834,\n 39664: 22840,\n 39665: 22846,\n 39666: 31442,\n 39667: 22869,\n 39668: 22864,\n 39669: 22862,\n 39670: 22874,\n 39671: 22872,\n 39672: 22882,\n 39673: 22880,\n 39674: 22887,\n 39675: 22892,\n 39676: 22889,\n 39744: 22904,\n 39745: 22913,\n 39746: 22941,\n 39747: 20318,\n 39748: 20395,\n 39749: 22947,\n 39750: 22962,\n 39751: 22982,\n 39752: 23016,\n 39753: 23004,\n 39754: 22925,\n 39755: 23001,\n 39756: 23002,\n 39757: 23077,\n 39758: 23071,\n 39759: 23057,\n 39760: 23068,\n 39761: 23049,\n 39762: 23066,\n 39763: 23104,\n 39764: 23148,\n 39765: 23113,\n 39766: 23093,\n 39767: 23094,\n 39768: 23138,\n 39769: 23146,\n 39770: 23194,\n 39771: 23228,\n 39772: 23230,\n 39773: 23243,\n 39774: 23234,\n 39775: 23229,\n 39776: 23267,\n 39777: 23255,\n 39778: 23270,\n 39779: 23273,\n 39780: 23254,\n 39781: 23290,\n 39782: 23291,\n 39783: 23308,\n 39784: 23307,\n 39785: 23318,\n 39786: 23346,\n 39787: 23248,\n 39788: 23338,\n 39789: 23350,\n 39790: 23358,\n 39791: 23363,\n 39792: 23365,\n 39793: 23360,\n 39794: 23377,\n 39795: 23381,\n 39796: 23386,\n 39797: 23387,\n 39798: 23397,\n 39799: 23401,\n 39800: 23408,\n 39801: 23411,\n 39802: 23413,\n 39803: 23416,\n 39804: 25992,\n 39805: 23418,\n 39806: 23424,\n 39808: 23427,\n 39809: 23462,\n 39810: 23480,\n 39811: 23491,\n 39812: 23495,\n 39813: 23497,\n 39814: 23508,\n 39815: 23504,\n 39816: 23524,\n 39817: 23526,\n 39818: 23522,\n 39819: 23518,\n 39820: 23525,\n 39821: 23531,\n 39822: 23536,\n 39823: 23542,\n 39824: 23539,\n 39825: 23557,\n 39826: 23559,\n 39827: 23560,\n 39828: 23565,\n 39829: 23571,\n 39830: 23584,\n 39831: 23586,\n 39832: 23592,\n 39833: 23608,\n 39834: 23609,\n 39835: 23617,\n 39836: 23622,\n 39837: 23630,\n 39838: 23635,\n 39839: 23632,\n 39840: 23631,\n 39841: 23409,\n 39842: 23660,\n 39843: 23662,\n 39844: 20066,\n 39845: 23670,\n 39846: 23673,\n 39847: 23692,\n 39848: 23697,\n 39849: 23700,\n 39850: 22939,\n 39851: 23723,\n 39852: 23739,\n 39853: 23734,\n 39854: 23740,\n 39855: 23735,\n 39856: 23749,\n 39857: 23742,\n 39858: 23751,\n 39859: 23769,\n 39860: 23785,\n 39861: 23805,\n 39862: 23802,\n 39863: 23789,\n 39864: 23948,\n 39865: 23786,\n 39866: 23819,\n 39867: 23829,\n 39868: 23831,\n 39869: 23900,\n 39870: 23839,\n 39871: 23835,\n 39872: 23825,\n 39873: 23828,\n 39874: 23842,\n 39875: 23834,\n 39876: 23833,\n 39877: 23832,\n 39878: 23884,\n 39879: 23890,\n 39880: 23886,\n 39881: 23883,\n 39882: 23916,\n 39883: 23923,\n 39884: 23926,\n 39885: 23943,\n 39886: 23940,\n 39887: 23938,\n 39888: 23970,\n 39889: 23965,\n 39890: 23980,\n 39891: 23982,\n 39892: 23997,\n 39893: 23952,\n 39894: 23991,\n 39895: 23996,\n 39896: 24009,\n 39897: 24013,\n 39898: 24019,\n 39899: 24018,\n 39900: 24022,\n 39901: 24027,\n 39902: 24043,\n 39903: 24050,\n 39904: 24053,\n 39905: 24075,\n 39906: 24090,\n 39907: 24089,\n 39908: 24081,\n 39909: 24091,\n 39910: 24118,\n 39911: 24119,\n 39912: 24132,\n 39913: 24131,\n 39914: 24128,\n 39915: 24142,\n 39916: 24151,\n 39917: 24148,\n 39918: 24159,\n 39919: 24162,\n 39920: 24164,\n 39921: 24135,\n 39922: 24181,\n 39923: 24182,\n 39924: 24186,\n 39925: 40636,\n 39926: 24191,\n 39927: 24224,\n 39928: 24257,\n 39929: 24258,\n 39930: 24264,\n 39931: 24272,\n 39932: 24271,\n 40000: 24278,\n 40001: 24291,\n 40002: 24285,\n 40003: 24282,\n 40004: 24283,\n 40005: 24290,\n 40006: 24289,\n 40007: 24296,\n 40008: 24297,\n 40009: 24300,\n 40010: 24305,\n 40011: 24307,\n 40012: 24304,\n 40013: 24308,\n 40014: 24312,\n 40015: 24318,\n 40016: 24323,\n 40017: 24329,\n 40018: 24413,\n 40019: 24412,\n 40020: 24331,\n 40021: 24337,\n 40022: 24342,\n 40023: 24361,\n 40024: 24365,\n 40025: 24376,\n 40026: 24385,\n 40027: 24392,\n 40028: 24396,\n 40029: 24398,\n 40030: 24367,\n 40031: 24401,\n 40032: 24406,\n 40033: 24407,\n 40034: 24409,\n 40035: 24417,\n 40036: 24429,\n 40037: 24435,\n 40038: 24439,\n 40039: 24451,\n 40040: 24450,\n 40041: 24447,\n 40042: 24458,\n 40043: 24456,\n 40044: 24465,\n 40045: 24455,\n 40046: 24478,\n 40047: 24473,\n 40048: 24472,\n 40049: 24480,\n 40050: 24488,\n 40051: 24493,\n 40052: 24508,\n 40053: 24534,\n 40054: 24571,\n 40055: 24548,\n 40056: 24568,\n 40057: 24561,\n 40058: 24541,\n 40059: 24755,\n 40060: 24575,\n 40061: 24609,\n 40062: 24672,\n 40064: 24601,\n 40065: 24592,\n 40066: 24617,\n 40067: 24590,\n 40068: 24625,\n 40069: 24603,\n 40070: 24597,\n 40071: 24619,\n 40072: 24614,\n 40073: 24591,\n 40074: 24634,\n 40075: 24666,\n 40076: 24641,\n 40077: 24682,\n 40078: 24695,\n 40079: 24671,\n 40080: 24650,\n 40081: 24646,\n 40082: 24653,\n 40083: 24675,\n 40084: 24643,\n 40085: 24676,\n 40086: 24642,\n 40087: 24684,\n 40088: 24683,\n 40089: 24665,\n 40090: 24705,\n 40091: 24717,\n 40092: 24807,\n 40093: 24707,\n 40094: 24730,\n 40095: 24708,\n 40096: 24731,\n 40097: 24726,\n 40098: 24727,\n 40099: 24722,\n 40100: 24743,\n 40101: 24715,\n 40102: 24801,\n 40103: 24760,\n 40104: 24800,\n 40105: 24787,\n 40106: 24756,\n 40107: 24560,\n 40108: 24765,\n 40109: 24774,\n 40110: 24757,\n 40111: 24792,\n 40112: 24909,\n 40113: 24853,\n 40114: 24838,\n 40115: 24822,\n 40116: 24823,\n 40117: 24832,\n 40118: 24820,\n 40119: 24826,\n 40120: 24835,\n 40121: 24865,\n 40122: 24827,\n 40123: 24817,\n 40124: 24845,\n 40125: 24846,\n 40126: 24903,\n 40127: 24894,\n 40128: 24872,\n 40129: 24871,\n 40130: 24906,\n 40131: 24895,\n 40132: 24892,\n 40133: 24876,\n 40134: 24884,\n 40135: 24893,\n 40136: 24898,\n 40137: 24900,\n 40138: 24947,\n 40139: 24951,\n 40140: 24920,\n 40141: 24921,\n 40142: 24922,\n 40143: 24939,\n 40144: 24948,\n 40145: 24943,\n 40146: 24933,\n 40147: 24945,\n 40148: 24927,\n 40149: 24925,\n 40150: 24915,\n 40151: 24949,\n 40152: 24985,\n 40153: 24982,\n 40154: 24967,\n 40155: 25004,\n 40156: 24980,\n 40157: 24986,\n 40158: 24970,\n 40159: 24977,\n 40160: 25003,\n 40161: 25006,\n 40162: 25036,\n 40163: 25034,\n 40164: 25033,\n 40165: 25079,\n 40166: 25032,\n 40167: 25027,\n 40168: 25030,\n 40169: 25018,\n 40170: 25035,\n 40171: 32633,\n 40172: 25037,\n 40173: 25062,\n 40174: 25059,\n 40175: 25078,\n 40176: 25082,\n 40177: 25076,\n 40178: 25087,\n 40179: 25085,\n 40180: 25084,\n 40181: 25086,\n 40182: 25088,\n 40183: 25096,\n 40184: 25097,\n 40185: 25101,\n 40186: 25100,\n 40187: 25108,\n 40188: 25115,\n 40256: 25118,\n 40257: 25121,\n 40258: 25130,\n 40259: 25134,\n 40260: 25136,\n 40261: 25138,\n 40262: 25139,\n 40263: 25153,\n 40264: 25166,\n 40265: 25182,\n 40266: 25187,\n 40267: 25179,\n 40268: 25184,\n 40269: 25192,\n 40270: 25212,\n 40271: 25218,\n 40272: 25225,\n 40273: 25214,\n 40274: 25234,\n 40275: 25235,\n 40276: 25238,\n 40277: 25300,\n 40278: 25219,\n 40279: 25236,\n 40280: 25303,\n 40281: 25297,\n 40282: 25275,\n 40283: 25295,\n 40284: 25343,\n 40285: 25286,\n 40286: 25812,\n 40287: 25288,\n 40288: 25308,\n 40289: 25292,\n 40290: 25290,\n 40291: 25282,\n 40292: 25287,\n 40293: 25243,\n 40294: 25289,\n 40295: 25356,\n 40296: 25326,\n 40297: 25329,\n 40298: 25383,\n 40299: 25346,\n 40300: 25352,\n 40301: 25327,\n 40302: 25333,\n 40303: 25424,\n 40304: 25406,\n 40305: 25421,\n 40306: 25628,\n 40307: 25423,\n 40308: 25494,\n 40309: 25486,\n 40310: 25472,\n 40311: 25515,\n 40312: 25462,\n 40313: 25507,\n 40314: 25487,\n 40315: 25481,\n 40316: 25503,\n 40317: 25525,\n 40318: 25451,\n 40320: 25449,\n 40321: 25534,\n 40322: 25577,\n 40323: 25536,\n 40324: 25542,\n 40325: 25571,\n 40326: 25545,\n 40327: 25554,\n 40328: 25590,\n 40329: 25540,\n 40330: 25622,\n 40331: 25652,\n 40332: 25606,\n 40333: 25619,\n 40334: 25638,\n 40335: 25654,\n 40336: 25885,\n 40337: 25623,\n 40338: 25640,\n 40339: 25615,\n 40340: 25703,\n 40341: 25711,\n 40342: 25718,\n 40343: 25678,\n 40344: 25898,\n 40345: 25749,\n 40346: 25747,\n 40347: 25765,\n 40348: 25769,\n 40349: 25736,\n 40350: 25788,\n 40351: 25818,\n 40352: 25810,\n 40353: 25797,\n 40354: 25799,\n 40355: 25787,\n 40356: 25816,\n 40357: 25794,\n 40358: 25841,\n 40359: 25831,\n 40360: 33289,\n 40361: 25824,\n 40362: 25825,\n 40363: 25260,\n 40364: 25827,\n 40365: 25839,\n 40366: 25900,\n 40367: 25846,\n 40368: 25844,\n 40369: 25842,\n 40370: 25850,\n 40371: 25856,\n 40372: 25853,\n 40373: 25880,\n 40374: 25884,\n 40375: 25861,\n 40376: 25892,\n 40377: 25891,\n 40378: 25899,\n 40379: 25908,\n 40380: 25909,\n 40381: 25911,\n 40382: 25910,\n 40383: 25912,\n 40384: 30027,\n 40385: 25928,\n 40386: 25942,\n 40387: 25941,\n 40388: 25933,\n 40389: 25944,\n 40390: 25950,\n 40391: 25949,\n 40392: 25970,\n 40393: 25976,\n 40394: 25986,\n 40395: 25987,\n 40396: 35722,\n 40397: 26011,\n 40398: 26015,\n 40399: 26027,\n 40400: 26039,\n 40401: 26051,\n 40402: 26054,\n 40403: 26049,\n 40404: 26052,\n 40405: 26060,\n 40406: 26066,\n 40407: 26075,\n 40408: 26073,\n 40409: 26080,\n 40410: 26081,\n 40411: 26097,\n 40412: 26482,\n 40413: 26122,\n 40414: 26115,\n 40415: 26107,\n 40416: 26483,\n 40417: 26165,\n 40418: 26166,\n 40419: 26164,\n 40420: 26140,\n 40421: 26191,\n 40422: 26180,\n 40423: 26185,\n 40424: 26177,\n 40425: 26206,\n 40426: 26205,\n 40427: 26212,\n 40428: 26215,\n 40429: 26216,\n 40430: 26207,\n 40431: 26210,\n 40432: 26224,\n 40433: 26243,\n 40434: 26248,\n 40435: 26254,\n 40436: 26249,\n 40437: 26244,\n 40438: 26264,\n 40439: 26269,\n 40440: 26305,\n 40441: 26297,\n 40442: 26313,\n 40443: 26302,\n 40444: 26300,\n 40512: 26308,\n 40513: 26296,\n 40514: 26326,\n 40515: 26330,\n 40516: 26336,\n 40517: 26175,\n 40518: 26342,\n 40519: 26345,\n 40520: 26352,\n 40521: 26357,\n 40522: 26359,\n 40523: 26383,\n 40524: 26390,\n 40525: 26398,\n 40526: 26406,\n 40527: 26407,\n 40528: 38712,\n 40529: 26414,\n 40530: 26431,\n 40531: 26422,\n 40532: 26433,\n 40533: 26424,\n 40534: 26423,\n 40535: 26438,\n 40536: 26462,\n 40537: 26464,\n 40538: 26457,\n 40539: 26467,\n 40540: 26468,\n 40541: 26505,\n 40542: 26480,\n 40543: 26537,\n 40544: 26492,\n 40545: 26474,\n 40546: 26508,\n 40547: 26507,\n 40548: 26534,\n 40549: 26529,\n 40550: 26501,\n 40551: 26551,\n 40552: 26607,\n 40553: 26548,\n 40554: 26604,\n 40555: 26547,\n 40556: 26601,\n 40557: 26552,\n 40558: 26596,\n 40559: 26590,\n 40560: 26589,\n 40561: 26594,\n 40562: 26606,\n 40563: 26553,\n 40564: 26574,\n 40565: 26566,\n 40566: 26599,\n 40567: 27292,\n 40568: 26654,\n 40569: 26694,\n 40570: 26665,\n 40571: 26688,\n 40572: 26701,\n 40573: 26674,\n 40574: 26702,\n 40576: 26803,\n 40577: 26667,\n 40578: 26713,\n 40579: 26723,\n 40580: 26743,\n 40581: 26751,\n 40582: 26783,\n 40583: 26767,\n 40584: 26797,\n 40585: 26772,\n 40586: 26781,\n 40587: 26779,\n 40588: 26755,\n 40589: 27310,\n 40590: 26809,\n 40591: 26740,\n 40592: 26805,\n 40593: 26784,\n 40594: 26810,\n 40595: 26895,\n 40596: 26765,\n 40597: 26750,\n 40598: 26881,\n 40599: 26826,\n 40600: 26888,\n 40601: 26840,\n 40602: 26914,\n 40603: 26918,\n 40604: 26849,\n 40605: 26892,\n 40606: 26829,\n 40607: 26836,\n 40608: 26855,\n 40609: 26837,\n 40610: 26934,\n 40611: 26898,\n 40612: 26884,\n 40613: 26839,\n 40614: 26851,\n 40615: 26917,\n 40616: 26873,\n 40617: 26848,\n 40618: 26863,\n 40619: 26920,\n 40620: 26922,\n 40621: 26906,\n 40622: 26915,\n 40623: 26913,\n 40624: 26822,\n 40625: 27001,\n 40626: 26999,\n 40627: 26972,\n 40628: 27000,\n 40629: 26987,\n 40630: 26964,\n 40631: 27006,\n 40632: 26990,\n 40633: 26937,\n 40634: 26996,\n 40635: 26941,\n 40636: 26969,\n 40637: 26928,\n 40638: 26977,\n 40639: 26974,\n 40640: 26973,\n 40641: 27009,\n 40642: 26986,\n 40643: 27058,\n 40644: 27054,\n 40645: 27088,\n 40646: 27071,\n 40647: 27073,\n 40648: 27091,\n 40649: 27070,\n 40650: 27086,\n 40651: 23528,\n 40652: 27082,\n 40653: 27101,\n 40654: 27067,\n 40655: 27075,\n 40656: 27047,\n 40657: 27182,\n 40658: 27025,\n 40659: 27040,\n 40660: 27036,\n 40661: 27029,\n 40662: 27060,\n 40663: 27102,\n 40664: 27112,\n 40665: 27138,\n 40666: 27163,\n 40667: 27135,\n 40668: 27402,\n 40669: 27129,\n 40670: 27122,\n 40671: 27111,\n 40672: 27141,\n 40673: 27057,\n 40674: 27166,\n 40675: 27117,\n 40676: 27156,\n 40677: 27115,\n 40678: 27146,\n 40679: 27154,\n 40680: 27329,\n 40681: 27171,\n 40682: 27155,\n 40683: 27204,\n 40684: 27148,\n 40685: 27250,\n 40686: 27190,\n 40687: 27256,\n 40688: 27207,\n 40689: 27234,\n 40690: 27225,\n 40691: 27238,\n 40692: 27208,\n 40693: 27192,\n 40694: 27170,\n 40695: 27280,\n 40696: 27277,\n 40697: 27296,\n 40698: 27268,\n 40699: 27298,\n 40700: 27299,\n 40768: 27287,\n 40769: 34327,\n 40770: 27323,\n 40771: 27331,\n 40772: 27330,\n 40773: 27320,\n 40774: 27315,\n 40775: 27308,\n 40776: 27358,\n 40777: 27345,\n 40778: 27359,\n 40779: 27306,\n 40780: 27354,\n 40781: 27370,\n 40782: 27387,\n 40783: 27397,\n 40784: 34326,\n 40785: 27386,\n 40786: 27410,\n 40787: 27414,\n 40788: 39729,\n 40789: 27423,\n 40790: 27448,\n 40791: 27447,\n 40792: 30428,\n 40793: 27449,\n 40794: 39150,\n 40795: 27463,\n 40796: 27459,\n 40797: 27465,\n 40798: 27472,\n 40799: 27481,\n 40800: 27476,\n 40801: 27483,\n 40802: 27487,\n 40803: 27489,\n 40804: 27512,\n 40805: 27513,\n 40806: 27519,\n 40807: 27520,\n 40808: 27524,\n 40809: 27523,\n 40810: 27533,\n 40811: 27544,\n 40812: 27541,\n 40813: 27550,\n 40814: 27556,\n 40815: 27562,\n 40816: 27563,\n 40817: 27567,\n 40818: 27570,\n 40819: 27569,\n 40820: 27571,\n 40821: 27575,\n 40822: 27580,\n 40823: 27590,\n 40824: 27595,\n 40825: 27603,\n 40826: 27615,\n 40827: 27628,\n 40828: 27627,\n 40829: 27635,\n 40830: 27631,\n 40832: 40638,\n 40833: 27656,\n 40834: 27667,\n 40835: 27668,\n 40836: 27675,\n 40837: 27684,\n 40838: 27683,\n 40839: 27742,\n 40840: 27733,\n 40841: 27746,\n 40842: 27754,\n 40843: 27778,\n 40844: 27789,\n 40845: 27802,\n 40846: 27777,\n 40847: 27803,\n 40848: 27774,\n 40849: 27752,\n 40850: 27763,\n 40851: 27794,\n 40852: 27792,\n 40853: 27844,\n 40854: 27889,\n 40855: 27859,\n 40856: 27837,\n 40857: 27863,\n 40858: 27845,\n 40859: 27869,\n 40860: 27822,\n 40861: 27825,\n 40862: 27838,\n 40863: 27834,\n 40864: 27867,\n 40865: 27887,\n 40866: 27865,\n 40867: 27882,\n 40868: 27935,\n 40869: 34893,\n 40870: 27958,\n 40871: 27947,\n 40872: 27965,\n 40873: 27960,\n 40874: 27929,\n 40875: 27957,\n 40876: 27955,\n 40877: 27922,\n 40878: 27916,\n 40879: 28003,\n 40880: 28051,\n 40881: 28004,\n 40882: 27994,\n 40883: 28025,\n 40884: 27993,\n 40885: 28046,\n 40886: 28053,\n 40887: 28644,\n 40888: 28037,\n 40889: 28153,\n 40890: 28181,\n 40891: 28170,\n 40892: 28085,\n 40893: 28103,\n 40894: 28134,\n 40895: 28088,\n 40896: 28102,\n 40897: 28140,\n 40898: 28126,\n 40899: 28108,\n 40900: 28136,\n 40901: 28114,\n 40902: 28101,\n 40903: 28154,\n 40904: 28121,\n 40905: 28132,\n 40906: 28117,\n 40907: 28138,\n 40908: 28142,\n 40909: 28205,\n 40910: 28270,\n 40911: 28206,\n 40912: 28185,\n 40913: 28274,\n 40914: 28255,\n 40915: 28222,\n 40916: 28195,\n 40917: 28267,\n 40918: 28203,\n 40919: 28278,\n 40920: 28237,\n 40921: 28191,\n 40922: 28227,\n 40923: 28218,\n 40924: 28238,\n 40925: 28196,\n 40926: 28415,\n 40927: 28189,\n 40928: 28216,\n 40929: 28290,\n 40930: 28330,\n 40931: 28312,\n 40932: 28361,\n 40933: 28343,\n 40934: 28371,\n 40935: 28349,\n 40936: 28335,\n 40937: 28356,\n 40938: 28338,\n 40939: 28372,\n 40940: 28373,\n 40941: 28303,\n 40942: 28325,\n 40943: 28354,\n 40944: 28319,\n 40945: 28481,\n 40946: 28433,\n 40947: 28748,\n 40948: 28396,\n 40949: 28408,\n 40950: 28414,\n 40951: 28479,\n 40952: 28402,\n 40953: 28465,\n 40954: 28399,\n 40955: 28466,\n 40956: 28364,\n 57408: 28478,\n 57409: 28435,\n 57410: 28407,\n 57411: 28550,\n 57412: 28538,\n 57413: 28536,\n 57414: 28545,\n 57415: 28544,\n 57416: 28527,\n 57417: 28507,\n 57418: 28659,\n 57419: 28525,\n 57420: 28546,\n 57421: 28540,\n 57422: 28504,\n 57423: 28558,\n 57424: 28561,\n 57425: 28610,\n 57426: 28518,\n 57427: 28595,\n 57428: 28579,\n 57429: 28577,\n 57430: 28580,\n 57431: 28601,\n 57432: 28614,\n 57433: 28586,\n 57434: 28639,\n 57435: 28629,\n 57436: 28652,\n 57437: 28628,\n 57438: 28632,\n 57439: 28657,\n 57440: 28654,\n 57441: 28635,\n 57442: 28681,\n 57443: 28683,\n 57444: 28666,\n 57445: 28689,\n 57446: 28673,\n 57447: 28687,\n 57448: 28670,\n 57449: 28699,\n 57450: 28698,\n 57451: 28532,\n 57452: 28701,\n 57453: 28696,\n 57454: 28703,\n 57455: 28720,\n 57456: 28734,\n 57457: 28722,\n 57458: 28753,\n 57459: 28771,\n 57460: 28825,\n 57461: 28818,\n 57462: 28847,\n 57463: 28913,\n 57464: 28844,\n 57465: 28856,\n 57466: 28851,\n 57467: 28846,\n 57468: 28895,\n 57469: 28875,\n 57470: 28893,\n 57472: 28889,\n 57473: 28937,\n 57474: 28925,\n 57475: 28956,\n 57476: 28953,\n 57477: 29029,\n 57478: 29013,\n 57479: 29064,\n 57480: 29030,\n 57481: 29026,\n 57482: 29004,\n 57483: 29014,\n 57484: 29036,\n 57485: 29071,\n 57486: 29179,\n 57487: 29060,\n 57488: 29077,\n 57489: 29096,\n 57490: 29100,\n 57491: 29143,\n 57492: 29113,\n 57493: 29118,\n 57494: 29138,\n 57495: 29129,\n 57496: 29140,\n 57497: 29134,\n 57498: 29152,\n 57499: 29164,\n 57500: 29159,\n 57501: 29173,\n 57502: 29180,\n 57503: 29177,\n 57504: 29183,\n 57505: 29197,\n 57506: 29200,\n 57507: 29211,\n 57508: 29224,\n 57509: 29229,\n 57510: 29228,\n 57511: 29232,\n 57512: 29234,\n 57513: 29243,\n 57514: 29244,\n 57515: 29247,\n 57516: 29248,\n 57517: 29254,\n 57518: 29259,\n 57519: 29272,\n 57520: 29300,\n 57521: 29310,\n 57522: 29314,\n 57523: 29313,\n 57524: 29319,\n 57525: 29330,\n 57526: 29334,\n 57527: 29346,\n 57528: 29351,\n 57529: 29369,\n 57530: 29362,\n 57531: 29379,\n 57532: 29382,\n 57533: 29380,\n 57534: 29390,\n 57535: 29394,\n 57536: 29410,\n 57537: 29408,\n 57538: 29409,\n 57539: 29433,\n 57540: 29431,\n 57541: 20495,\n 57542: 29463,\n 57543: 29450,\n 57544: 29468,\n 57545: 29462,\n 57546: 29469,\n 57547: 29492,\n 57548: 29487,\n 57549: 29481,\n 57550: 29477,\n 57551: 29502,\n 57552: 29518,\n 57553: 29519,\n 57554: 40664,\n 57555: 29527,\n 57556: 29546,\n 57557: 29544,\n 57558: 29552,\n 57559: 29560,\n 57560: 29557,\n 57561: 29563,\n 57562: 29562,\n 57563: 29640,\n 57564: 29619,\n 57565: 29646,\n 57566: 29627,\n 57567: 29632,\n 57568: 29669,\n 57569: 29678,\n 57570: 29662,\n 57571: 29858,\n 57572: 29701,\n 57573: 29807,\n 57574: 29733,\n 57575: 29688,\n 57576: 29746,\n 57577: 29754,\n 57578: 29781,\n 57579: 29759,\n 57580: 29791,\n 57581: 29785,\n 57582: 29761,\n 57583: 29788,\n 57584: 29801,\n 57585: 29808,\n 57586: 29795,\n 57587: 29802,\n 57588: 29814,\n 57589: 29822,\n 57590: 29835,\n 57591: 29854,\n 57592: 29863,\n 57593: 29898,\n 57594: 29903,\n 57595: 29908,\n 57596: 29681,\n 57664: 29920,\n 57665: 29923,\n 57666: 29927,\n 57667: 29929,\n 57668: 29934,\n 57669: 29938,\n 57670: 29936,\n 57671: 29937,\n 57672: 29944,\n 57673: 29943,\n 57674: 29956,\n 57675: 29955,\n 57676: 29957,\n 57677: 29964,\n 57678: 29966,\n 57679: 29965,\n 57680: 29973,\n 57681: 29971,\n 57682: 29982,\n 57683: 29990,\n 57684: 29996,\n 57685: 30012,\n 57686: 30020,\n 57687: 30029,\n 57688: 30026,\n 57689: 30025,\n 57690: 30043,\n 57691: 30022,\n 57692: 30042,\n 57693: 30057,\n 57694: 30052,\n 57695: 30055,\n 57696: 30059,\n 57697: 30061,\n 57698: 30072,\n 57699: 30070,\n 57700: 30086,\n 57701: 30087,\n 57702: 30068,\n 57703: 30090,\n 57704: 30089,\n 57705: 30082,\n 57706: 30100,\n 57707: 30106,\n 57708: 30109,\n 57709: 30117,\n 57710: 30115,\n 57711: 30146,\n 57712: 30131,\n 57713: 30147,\n 57714: 30133,\n 57715: 30141,\n 57716: 30136,\n 57717: 30140,\n 57718: 30129,\n 57719: 30157,\n 57720: 30154,\n 57721: 30162,\n 57722: 30169,\n 57723: 30179,\n 57724: 30174,\n 57725: 30206,\n 57726: 30207,\n 57728: 30204,\n 57729: 30209,\n 57730: 30192,\n 57731: 30202,\n 57732: 30194,\n 57733: 30195,\n 57734: 30219,\n 57735: 30221,\n 57736: 30217,\n 57737: 30239,\n 57738: 30247,\n 57739: 30240,\n 57740: 30241,\n 57741: 30242,\n 57742: 30244,\n 57743: 30260,\n 57744: 30256,\n 57745: 30267,\n 57746: 30279,\n 57747: 30280,\n 57748: 30278,\n 57749: 30300,\n 57750: 30296,\n 57751: 30305,\n 57752: 30306,\n 57753: 30312,\n 57754: 30313,\n 57755: 30314,\n 57756: 30311,\n 57757: 30316,\n 57758: 30320,\n 57759: 30322,\n 57760: 30326,\n 57761: 30328,\n 57762: 30332,\n 57763: 30336,\n 57764: 30339,\n 57765: 30344,\n 57766: 30347,\n 57767: 30350,\n 57768: 30358,\n 57769: 30355,\n 57770: 30361,\n 57771: 30362,\n 57772: 30384,\n 57773: 30388,\n 57774: 30392,\n 57775: 30393,\n 57776: 30394,\n 57777: 30402,\n 57778: 30413,\n 57779: 30422,\n 57780: 30418,\n 57781: 30430,\n 57782: 30433,\n 57783: 30437,\n 57784: 30439,\n 57785: 30442,\n 57786: 34351,\n 57787: 30459,\n 57788: 30472,\n 57789: 30471,\n 57790: 30468,\n 57791: 30505,\n 57792: 30500,\n 57793: 30494,\n 57794: 30501,\n 57795: 30502,\n 57796: 30491,\n 57797: 30519,\n 57798: 30520,\n 57799: 30535,\n 57800: 30554,\n 57801: 30568,\n 57802: 30571,\n 57803: 30555,\n 57804: 30565,\n 57805: 30591,\n 57806: 30590,\n 57807: 30585,\n 57808: 30606,\n 57809: 30603,\n 57810: 30609,\n 57811: 30624,\n 57812: 30622,\n 57813: 30640,\n 57814: 30646,\n 57815: 30649,\n 57816: 30655,\n 57817: 30652,\n 57818: 30653,\n 57819: 30651,\n 57820: 30663,\n 57821: 30669,\n 57822: 30679,\n 57823: 30682,\n 57824: 30684,\n 57825: 30691,\n 57826: 30702,\n 57827: 30716,\n 57828: 30732,\n 57829: 30738,\n 57830: 31014,\n 57831: 30752,\n 57832: 31018,\n 57833: 30789,\n 57834: 30862,\n 57835: 30836,\n 57836: 30854,\n 57837: 30844,\n 57838: 30874,\n 57839: 30860,\n 57840: 30883,\n 57841: 30901,\n 57842: 30890,\n 57843: 30895,\n 57844: 30929,\n 57845: 30918,\n 57846: 30923,\n 57847: 30932,\n 57848: 30910,\n 57849: 30908,\n 57850: 30917,\n 57851: 30922,\n 57852: 30956,\n 57920: 30951,\n 57921: 30938,\n 57922: 30973,\n 57923: 30964,\n 57924: 30983,\n 57925: 30994,\n 57926: 30993,\n 57927: 31001,\n 57928: 31020,\n 57929: 31019,\n 57930: 31040,\n 57931: 31072,\n 57932: 31063,\n 57933: 31071,\n 57934: 31066,\n 57935: 31061,\n 57936: 31059,\n 57937: 31098,\n 57938: 31103,\n 57939: 31114,\n 57940: 31133,\n 57941: 31143,\n 57942: 40779,\n 57943: 31146,\n 57944: 31150,\n 57945: 31155,\n 57946: 31161,\n 57947: 31162,\n 57948: 31177,\n 57949: 31189,\n 57950: 31207,\n 57951: 31212,\n 57952: 31201,\n 57953: 31203,\n 57954: 31240,\n 57955: 31245,\n 57956: 31256,\n 57957: 31257,\n 57958: 31264,\n 57959: 31263,\n 57960: 31104,\n 57961: 31281,\n 57962: 31291,\n 57963: 31294,\n 57964: 31287,\n 57965: 31299,\n 57966: 31319,\n 57967: 31305,\n 57968: 31329,\n 57969: 31330,\n 57970: 31337,\n 57971: 40861,\n 57972: 31344,\n 57973: 31353,\n 57974: 31357,\n 57975: 31368,\n 57976: 31383,\n 57977: 31381,\n 57978: 31384,\n 57979: 31382,\n 57980: 31401,\n 57981: 31432,\n 57982: 31408,\n 57984: 31414,\n 57985: 31429,\n 57986: 31428,\n 57987: 31423,\n 57988: 36995,\n 57989: 31431,\n 57990: 31434,\n 57991: 31437,\n 57992: 31439,\n 57993: 31445,\n 57994: 31443,\n 57995: 31449,\n 57996: 31450,\n 57997: 31453,\n 57998: 31457,\n 57999: 31458,\n 58000: 31462,\n 58001: 31469,\n 58002: 31472,\n 58003: 31490,\n 58004: 31503,\n 58005: 31498,\n 58006: 31494,\n 58007: 31539,\n 58008: 31512,\n 58009: 31513,\n 58010: 31518,\n 58011: 31541,\n 58012: 31528,\n 58013: 31542,\n 58014: 31568,\n 58015: 31610,\n 58016: 31492,\n 58017: 31565,\n 58018: 31499,\n 58019: 31564,\n 58020: 31557,\n 58021: 31605,\n 58022: 31589,\n 58023: 31604,\n 58024: 31591,\n 58025: 31600,\n 58026: 31601,\n 58027: 31596,\n 58028: 31598,\n 58029: 31645,\n 58030: 31640,\n 58031: 31647,\n 58032: 31629,\n 58033: 31644,\n 58034: 31642,\n 58035: 31627,\n 58036: 31634,\n 58037: 31631,\n 58038: 31581,\n 58039: 31641,\n 58040: 31691,\n 58041: 31681,\n 58042: 31692,\n 58043: 31695,\n 58044: 31668,\n 58045: 31686,\n 58046: 31709,\n 58047: 31721,\n 58048: 31761,\n 58049: 31764,\n 58050: 31718,\n 58051: 31717,\n 58052: 31840,\n 58053: 31744,\n 58054: 31751,\n 58055: 31763,\n 58056: 31731,\n 58057: 31735,\n 58058: 31767,\n 58059: 31757,\n 58060: 31734,\n 58061: 31779,\n 58062: 31783,\n 58063: 31786,\n 58064: 31775,\n 58065: 31799,\n 58066: 31787,\n 58067: 31805,\n 58068: 31820,\n 58069: 31811,\n 58070: 31828,\n 58071: 31823,\n 58072: 31808,\n 58073: 31824,\n 58074: 31832,\n 58075: 31839,\n 58076: 31844,\n 58077: 31830,\n 58078: 31845,\n 58079: 31852,\n 58080: 31861,\n 58081: 31875,\n 58082: 31888,\n 58083: 31908,\n 58084: 31917,\n 58085: 31906,\n 58086: 31915,\n 58087: 31905,\n 58088: 31912,\n 58089: 31923,\n 58090: 31922,\n 58091: 31921,\n 58092: 31918,\n 58093: 31929,\n 58094: 31933,\n 58095: 31936,\n 58096: 31941,\n 58097: 31938,\n 58098: 31960,\n 58099: 31954,\n 58100: 31964,\n 58101: 31970,\n 58102: 39739,\n 58103: 31983,\n 58104: 31986,\n 58105: 31988,\n 58106: 31990,\n 58107: 31994,\n 58108: 32006,\n 58176: 32002,\n 58177: 32028,\n 58178: 32021,\n 58179: 32010,\n 58180: 32069,\n 58181: 32075,\n 58182: 32046,\n 58183: 32050,\n 58184: 32063,\n 58185: 32053,\n 58186: 32070,\n 58187: 32115,\n 58188: 32086,\n 58189: 32078,\n 58190: 32114,\n 58191: 32104,\n 58192: 32110,\n 58193: 32079,\n 58194: 32099,\n 58195: 32147,\n 58196: 32137,\n 58197: 32091,\n 58198: 32143,\n 58199: 32125,\n 58200: 32155,\n 58201: 32186,\n 58202: 32174,\n 58203: 32163,\n 58204: 32181,\n 58205: 32199,\n 58206: 32189,\n 58207: 32171,\n 58208: 32317,\n 58209: 32162,\n 58210: 32175,\n 58211: 32220,\n 58212: 32184,\n 58213: 32159,\n 58214: 32176,\n 58215: 32216,\n 58216: 32221,\n 58217: 32228,\n 58218: 32222,\n 58219: 32251,\n 58220: 32242,\n 58221: 32225,\n 58222: 32261,\n 58223: 32266,\n 58224: 32291,\n 58225: 32289,\n 58226: 32274,\n 58227: 32305,\n 58228: 32287,\n 58229: 32265,\n 58230: 32267,\n 58231: 32290,\n 58232: 32326,\n 58233: 32358,\n 58234: 32315,\n 58235: 32309,\n 58236: 32313,\n 58237: 32323,\n 58238: 32311,\n 58240: 32306,\n 58241: 32314,\n 58242: 32359,\n 58243: 32349,\n 58244: 32342,\n 58245: 32350,\n 58246: 32345,\n 58247: 32346,\n 58248: 32377,\n 58249: 32362,\n 58250: 32361,\n 58251: 32380,\n 58252: 32379,\n 58253: 32387,\n 58254: 32213,\n 58255: 32381,\n 58256: 36782,\n 58257: 32383,\n 58258: 32392,\n 58259: 32393,\n 58260: 32396,\n 58261: 32402,\n 58262: 32400,\n 58263: 32403,\n 58264: 32404,\n 58265: 32406,\n 58266: 32398,\n 58267: 32411,\n 58268: 32412,\n 58269: 32568,\n 58270: 32570,\n 58271: 32581,\n 58272: 32588,\n 58273: 32589,\n 58274: 32590,\n 58275: 32592,\n 58276: 32593,\n 58277: 32597,\n 58278: 32596,\n 58279: 32600,\n 58280: 32607,\n 58281: 32608,\n 58282: 32616,\n 58283: 32617,\n 58284: 32615,\n 58285: 32632,\n 58286: 32642,\n 58287: 32646,\n 58288: 32643,\n 58289: 32648,\n 58290: 32647,\n 58291: 32652,\n 58292: 32660,\n 58293: 32670,\n 58294: 32669,\n 58295: 32666,\n 58296: 32675,\n 58297: 32687,\n 58298: 32690,\n 58299: 32697,\n 58300: 32686,\n 58301: 32694,\n 58302: 32696,\n 58303: 35697,\n 58304: 32709,\n 58305: 32710,\n 58306: 32714,\n 58307: 32725,\n 58308: 32724,\n 58309: 32737,\n 58310: 32742,\n 58311: 32745,\n 58312: 32755,\n 58313: 32761,\n 58314: 39132,\n 58315: 32774,\n 58316: 32772,\n 58317: 32779,\n 58318: 32786,\n 58319: 32792,\n 58320: 32793,\n 58321: 32796,\n 58322: 32801,\n 58323: 32808,\n 58324: 32831,\n 58325: 32827,\n 58326: 32842,\n 58327: 32838,\n 58328: 32850,\n 58329: 32856,\n 58330: 32858,\n 58331: 32863,\n 58332: 32866,\n 58333: 32872,\n 58334: 32883,\n 58335: 32882,\n 58336: 32880,\n 58337: 32886,\n 58338: 32889,\n 58339: 32893,\n 58340: 32895,\n 58341: 32900,\n 58342: 32902,\n 58343: 32901,\n 58344: 32923,\n 58345: 32915,\n 58346: 32922,\n 58347: 32941,\n 58348: 20880,\n 58349: 32940,\n 58350: 32987,\n 58351: 32997,\n 58352: 32985,\n 58353: 32989,\n 58354: 32964,\n 58355: 32986,\n 58356: 32982,\n 58357: 33033,\n 58358: 33007,\n 58359: 33009,\n 58360: 33051,\n 58361: 33065,\n 58362: 33059,\n 58363: 33071,\n 58364: 33099,\n 58432: 38539,\n 58433: 33094,\n 58434: 33086,\n 58435: 33107,\n 58436: 33105,\n 58437: 33020,\n 58438: 33137,\n 58439: 33134,\n 58440: 33125,\n 58441: 33126,\n 58442: 33140,\n 58443: 33155,\n 58444: 33160,\n 58445: 33162,\n 58446: 33152,\n 58447: 33154,\n 58448: 33184,\n 58449: 33173,\n 58450: 33188,\n 58451: 33187,\n 58452: 33119,\n 58453: 33171,\n 58454: 33193,\n 58455: 33200,\n 58456: 33205,\n 58457: 33214,\n 58458: 33208,\n 58459: 33213,\n 58460: 33216,\n 58461: 33218,\n 58462: 33210,\n 58463: 33225,\n 58464: 33229,\n 58465: 33233,\n 58466: 33241,\n 58467: 33240,\n 58468: 33224,\n 58469: 33242,\n 58470: 33247,\n 58471: 33248,\n 58472: 33255,\n 58473: 33274,\n 58474: 33275,\n 58475: 33278,\n 58476: 33281,\n 58477: 33282,\n 58478: 33285,\n 58479: 33287,\n 58480: 33290,\n 58481: 33293,\n 58482: 33296,\n 58483: 33302,\n 58484: 33321,\n 58485: 33323,\n 58486: 33336,\n 58487: 33331,\n 58488: 33344,\n 58489: 33369,\n 58490: 33368,\n 58491: 33373,\n 58492: 33370,\n 58493: 33375,\n 58494: 33380,\n 58496: 33378,\n 58497: 33384,\n 58498: 33386,\n 58499: 33387,\n 58500: 33326,\n 58501: 33393,\n 58502: 33399,\n 58503: 33400,\n 58504: 33406,\n 58505: 33421,\n 58506: 33426,\n 58507: 33451,\n 58508: 33439,\n 58509: 33467,\n 58510: 33452,\n 58511: 33505,\n 58512: 33507,\n 58513: 33503,\n 58514: 33490,\n 58515: 33524,\n 58516: 33523,\n 58517: 33530,\n 58518: 33683,\n 58519: 33539,\n 58520: 33531,\n 58521: 33529,\n 58522: 33502,\n 58523: 33542,\n 58524: 33500,\n 58525: 33545,\n 58526: 33497,\n 58527: 33589,\n 58528: 33588,\n 58529: 33558,\n 58530: 33586,\n 58531: 33585,\n 58532: 33600,\n 58533: 33593,\n 58534: 33616,\n 58535: 33605,\n 58536: 33583,\n 58537: 33579,\n 58538: 33559,\n 58539: 33560,\n 58540: 33669,\n 58541: 33690,\n 58542: 33706,\n 58543: 33695,\n 58544: 33698,\n 58545: 33686,\n 58546: 33571,\n 58547: 33678,\n 58548: 33671,\n 58549: 33674,\n 58550: 33660,\n 58551: 33717,\n 58552: 33651,\n 58553: 33653,\n 58554: 33696,\n 58555: 33673,\n 58556: 33704,\n 58557: 33780,\n 58558: 33811,\n 58559: 33771,\n 58560: 33742,\n 58561: 33789,\n 58562: 33795,\n 58563: 33752,\n 58564: 33803,\n 58565: 33729,\n 58566: 33783,\n 58567: 33799,\n 58568: 33760,\n 58569: 33778,\n 58570: 33805,\n 58571: 33826,\n 58572: 33824,\n 58573: 33725,\n 58574: 33848,\n 58575: 34054,\n 58576: 33787,\n 58577: 33901,\n 58578: 33834,\n 58579: 33852,\n 58580: 34138,\n 58581: 33924,\n 58582: 33911,\n 58583: 33899,\n 58584: 33965,\n 58585: 33902,\n 58586: 33922,\n 58587: 33897,\n 58588: 33862,\n 58589: 33836,\n 58590: 33903,\n 58591: 33913,\n 58592: 33845,\n 58593: 33994,\n 58594: 33890,\n 58595: 33977,\n 58596: 33983,\n 58597: 33951,\n 58598: 34009,\n 58599: 33997,\n 58600: 33979,\n 58601: 34010,\n 58602: 34000,\n 58603: 33985,\n 58604: 33990,\n 58605: 34006,\n 58606: 33953,\n 58607: 34081,\n 58608: 34047,\n 58609: 34036,\n 58610: 34071,\n 58611: 34072,\n 58612: 34092,\n 58613: 34079,\n 58614: 34069,\n 58615: 34068,\n 58616: 34044,\n 58617: 34112,\n 58618: 34147,\n 58619: 34136,\n 58620: 34120,\n 58688: 34113,\n 58689: 34306,\n 58690: 34123,\n 58691: 34133,\n 58692: 34176,\n 58693: 34212,\n 58694: 34184,\n 58695: 34193,\n 58696: 34186,\n 58697: 34216,\n 58698: 34157,\n 58699: 34196,\n 58700: 34203,\n 58701: 34282,\n 58702: 34183,\n 58703: 34204,\n 58704: 34167,\n 58705: 34174,\n 58706: 34192,\n 58707: 34249,\n 58708: 34234,\n 58709: 34255,\n 58710: 34233,\n 58711: 34256,\n 58712: 34261,\n 58713: 34269,\n 58714: 34277,\n 58715: 34268,\n 58716: 34297,\n 58717: 34314,\n 58718: 34323,\n 58719: 34315,\n 58720: 34302,\n 58721: 34298,\n 58722: 34310,\n 58723: 34338,\n 58724: 34330,\n 58725: 34352,\n 58726: 34367,\n 58727: 34381,\n 58728: 20053,\n 58729: 34388,\n 58730: 34399,\n 58731: 34407,\n 58732: 34417,\n 58733: 34451,\n 58734: 34467,\n 58735: 34473,\n 58736: 34474,\n 58737: 34443,\n 58738: 34444,\n 58739: 34486,\n 58740: 34479,\n 58741: 34500,\n 58742: 34502,\n 58743: 34480,\n 58744: 34505,\n 58745: 34851,\n 58746: 34475,\n 58747: 34516,\n 58748: 34526,\n 58749: 34537,\n 58750: 34540,\n 58752: 34527,\n 58753: 34523,\n 58754: 34543,\n 58755: 34578,\n 58756: 34566,\n 58757: 34568,\n 58758: 34560,\n 58759: 34563,\n 58760: 34555,\n 58761: 34577,\n 58762: 34569,\n 58763: 34573,\n 58764: 34553,\n 58765: 34570,\n 58766: 34612,\n 58767: 34623,\n 58768: 34615,\n 58769: 34619,\n 58770: 34597,\n 58771: 34601,\n 58772: 34586,\n 58773: 34656,\n 58774: 34655,\n 58775: 34680,\n 58776: 34636,\n 58777: 34638,\n 58778: 34676,\n 58779: 34647,\n 58780: 34664,\n 58781: 34670,\n 58782: 34649,\n 58783: 34643,\n 58784: 34659,\n 58785: 34666,\n 58786: 34821,\n 58787: 34722,\n 58788: 34719,\n 58789: 34690,\n 58790: 34735,\n 58791: 34763,\n 58792: 34749,\n 58793: 34752,\n 58794: 34768,\n 58795: 38614,\n 58796: 34731,\n 58797: 34756,\n 58798: 34739,\n 58799: 34759,\n 58800: 34758,\n 58801: 34747,\n 58802: 34799,\n 58803: 34802,\n 58804: 34784,\n 58805: 34831,\n 58806: 34829,\n 58807: 34814,\n 58808: 34806,\n 58809: 34807,\n 58810: 34830,\n 58811: 34770,\n 58812: 34833,\n 58813: 34838,\n 58814: 34837,\n 58815: 34850,\n 58816: 34849,\n 58817: 34865,\n 58818: 34870,\n 58819: 34873,\n 58820: 34855,\n 58821: 34875,\n 58822: 34884,\n 58823: 34882,\n 58824: 34898,\n 58825: 34905,\n 58826: 34910,\n 58827: 34914,\n 58828: 34923,\n 58829: 34945,\n 58830: 34942,\n 58831: 34974,\n 58832: 34933,\n 58833: 34941,\n 58834: 34997,\n 58835: 34930,\n 58836: 34946,\n 58837: 34967,\n 58838: 34962,\n 58839: 34990,\n 58840: 34969,\n 58841: 34978,\n 58842: 34957,\n 58843: 34980,\n 58844: 34992,\n 58845: 35007,\n 58846: 34993,\n 58847: 35011,\n 58848: 35012,\n 58849: 35028,\n 58850: 35032,\n 58851: 35033,\n 58852: 35037,\n 58853: 35065,\n 58854: 35074,\n 58855: 35068,\n 58856: 35060,\n 58857: 35048,\n 58858: 35058,\n 58859: 35076,\n 58860: 35084,\n 58861: 35082,\n 58862: 35091,\n 58863: 35139,\n 58864: 35102,\n 58865: 35109,\n 58866: 35114,\n 58867: 35115,\n 58868: 35137,\n 58869: 35140,\n 58870: 35131,\n 58871: 35126,\n 58872: 35128,\n 58873: 35148,\n 58874: 35101,\n 58875: 35168,\n 58876: 35166,\n 58944: 35174,\n 58945: 35172,\n 58946: 35181,\n 58947: 35178,\n 58948: 35183,\n 58949: 35188,\n 58950: 35191,\n 58951: 35198,\n 58952: 35203,\n 58953: 35208,\n 58954: 35210,\n 58955: 35219,\n 58956: 35224,\n 58957: 35233,\n 58958: 35241,\n 58959: 35238,\n 58960: 35244,\n 58961: 35247,\n 58962: 35250,\n 58963: 35258,\n 58964: 35261,\n 58965: 35263,\n 58966: 35264,\n 58967: 35290,\n 58968: 35292,\n 58969: 35293,\n 58970: 35303,\n 58971: 35316,\n 58972: 35320,\n 58973: 35331,\n 58974: 35350,\n 58975: 35344,\n 58976: 35340,\n 58977: 35355,\n 58978: 35357,\n 58979: 35365,\n 58980: 35382,\n 58981: 35393,\n 58982: 35419,\n 58983: 35410,\n 58984: 35398,\n 58985: 35400,\n 58986: 35452,\n 58987: 35437,\n 58988: 35436,\n 58989: 35426,\n 58990: 35461,\n 58991: 35458,\n 58992: 35460,\n 58993: 35496,\n 58994: 35489,\n 58995: 35473,\n 58996: 35493,\n 58997: 35494,\n 58998: 35482,\n 58999: 35491,\n 59000: 35524,\n 59001: 35533,\n 59002: 35522,\n 59003: 35546,\n 59004: 35563,\n 59005: 35571,\n 59006: 35559,\n 59008: 35556,\n 59009: 35569,\n 59010: 35604,\n 59011: 35552,\n 59012: 35554,\n 59013: 35575,\n 59014: 35550,\n 59015: 35547,\n 59016: 35596,\n 59017: 35591,\n 59018: 35610,\n 59019: 35553,\n 59020: 35606,\n 59021: 35600,\n 59022: 35607,\n 59023: 35616,\n 59024: 35635,\n 59025: 38827,\n 59026: 35622,\n 59027: 35627,\n 59028: 35646,\n 59029: 35624,\n 59030: 35649,\n 59031: 35660,\n 59032: 35663,\n 59033: 35662,\n 59034: 35657,\n 59035: 35670,\n 59036: 35675,\n 59037: 35674,\n 59038: 35691,\n 59039: 35679,\n 59040: 35692,\n 59041: 35695,\n 59042: 35700,\n 59043: 35709,\n 59044: 35712,\n 59045: 35724,\n 59046: 35726,\n 59047: 35730,\n 59048: 35731,\n 59049: 35734,\n 59050: 35737,\n 59051: 35738,\n 59052: 35898,\n 59053: 35905,\n 59054: 35903,\n 59055: 35912,\n 59056: 35916,\n 59057: 35918,\n 59058: 35920,\n 59059: 35925,\n 59060: 35938,\n 59061: 35948,\n 59062: 35960,\n 59063: 35962,\n 59064: 35970,\n 59065: 35977,\n 59066: 35973,\n 59067: 35978,\n 59068: 35981,\n 59069: 35982,\n 59070: 35988,\n 59071: 35964,\n 59072: 35992,\n 59073: 25117,\n 59074: 36013,\n 59075: 36010,\n 59076: 36029,\n 59077: 36018,\n 59078: 36019,\n 59079: 36014,\n 59080: 36022,\n 59081: 36040,\n 59082: 36033,\n 59083: 36068,\n 59084: 36067,\n 59085: 36058,\n 59086: 36093,\n 59087: 36090,\n 59088: 36091,\n 59089: 36100,\n 59090: 36101,\n 59091: 36106,\n 59092: 36103,\n 59093: 36111,\n 59094: 36109,\n 59095: 36112,\n 59096: 40782,\n 59097: 36115,\n 59098: 36045,\n 59099: 36116,\n 59100: 36118,\n 59101: 36199,\n 59102: 36205,\n 59103: 36209,\n 59104: 36211,\n 59105: 36225,\n 59106: 36249,\n 59107: 36290,\n 59108: 36286,\n 59109: 36282,\n 59110: 36303,\n 59111: 36314,\n 59112: 36310,\n 59113: 36300,\n 59114: 36315,\n 59115: 36299,\n 59116: 36330,\n 59117: 36331,\n 59118: 36319,\n 59119: 36323,\n 59120: 36348,\n 59121: 36360,\n 59122: 36361,\n 59123: 36351,\n 59124: 36381,\n 59125: 36382,\n 59126: 36368,\n 59127: 36383,\n 59128: 36418,\n 59129: 36405,\n 59130: 36400,\n 59131: 36404,\n 59132: 36426,\n 59200: 36423,\n 59201: 36425,\n 59202: 36428,\n 59203: 36432,\n 59204: 36424,\n 59205: 36441,\n 59206: 36452,\n 59207: 36448,\n 59208: 36394,\n 59209: 36451,\n 59210: 36437,\n 59211: 36470,\n 59212: 36466,\n 59213: 36476,\n 59214: 36481,\n 59215: 36487,\n 59216: 36485,\n 59217: 36484,\n 59218: 36491,\n 59219: 36490,\n 59220: 36499,\n 59221: 36497,\n 59222: 36500,\n 59223: 36505,\n 59224: 36522,\n 59225: 36513,\n 59226: 36524,\n 59227: 36528,\n 59228: 36550,\n 59229: 36529,\n 59230: 36542,\n 59231: 36549,\n 59232: 36552,\n 59233: 36555,\n 59234: 36571,\n 59235: 36579,\n 59236: 36604,\n 59237: 36603,\n 59238: 36587,\n 59239: 36606,\n 59240: 36618,\n 59241: 36613,\n 59242: 36629,\n 59243: 36626,\n 59244: 36633,\n 59245: 36627,\n 59246: 36636,\n 59247: 36639,\n 59248: 36635,\n 59249: 36620,\n 59250: 36646,\n 59251: 36659,\n 59252: 36667,\n 59253: 36665,\n 59254: 36677,\n 59255: 36674,\n 59256: 36670,\n 59257: 36684,\n 59258: 36681,\n 59259: 36678,\n 59260: 36686,\n 59261: 36695,\n 59262: 36700,\n 59264: 36706,\n 59265: 36707,\n 59266: 36708,\n 59267: 36764,\n 59268: 36767,\n 59269: 36771,\n 59270: 36781,\n 59271: 36783,\n 59272: 36791,\n 59273: 36826,\n 59274: 36837,\n 59275: 36834,\n 59276: 36842,\n 59277: 36847,\n 59278: 36999,\n 59279: 36852,\n 59280: 36869,\n 59281: 36857,\n 59282: 36858,\n 59283: 36881,\n 59284: 36885,\n 59285: 36897,\n 59286: 36877,\n 59287: 36894,\n 59288: 36886,\n 59289: 36875,\n 59290: 36903,\n 59291: 36918,\n 59292: 36917,\n 59293: 36921,\n 59294: 36856,\n 59295: 36943,\n 59296: 36944,\n 59297: 36945,\n 59298: 36946,\n 59299: 36878,\n 59300: 36937,\n 59301: 36926,\n 59302: 36950,\n 59303: 36952,\n 59304: 36958,\n 59305: 36968,\n 59306: 36975,\n 59307: 36982,\n 59308: 38568,\n 59309: 36978,\n 59310: 36994,\n 59311: 36989,\n 59312: 36993,\n 59313: 36992,\n 59314: 37002,\n 59315: 37001,\n 59316: 37007,\n 59317: 37032,\n 59318: 37039,\n 59319: 37041,\n 59320: 37045,\n 59321: 37090,\n 59322: 37092,\n 59323: 25160,\n 59324: 37083,\n 59325: 37122,\n 59326: 37138,\n 59327: 37145,\n 59328: 37170,\n 59329: 37168,\n 59330: 37194,\n 59331: 37206,\n 59332: 37208,\n 59333: 37219,\n 59334: 37221,\n 59335: 37225,\n 59336: 37235,\n 59337: 37234,\n 59338: 37259,\n 59339: 37257,\n 59340: 37250,\n 59341: 37282,\n 59342: 37291,\n 59343: 37295,\n 59344: 37290,\n 59345: 37301,\n 59346: 37300,\n 59347: 37306,\n 59348: 37312,\n 59349: 37313,\n 59350: 37321,\n 59351: 37323,\n 59352: 37328,\n 59353: 37334,\n 59354: 37343,\n 59355: 37345,\n 59356: 37339,\n 59357: 37372,\n 59358: 37365,\n 59359: 37366,\n 59360: 37406,\n 59361: 37375,\n 59362: 37396,\n 59363: 37420,\n 59364: 37397,\n 59365: 37393,\n 59366: 37470,\n 59367: 37463,\n 59368: 37445,\n 59369: 37449,\n 59370: 37476,\n 59371: 37448,\n 59372: 37525,\n 59373: 37439,\n 59374: 37451,\n 59375: 37456,\n 59376: 37532,\n 59377: 37526,\n 59378: 37523,\n 59379: 37531,\n 59380: 37466,\n 59381: 37583,\n 59382: 37561,\n 59383: 37559,\n 59384: 37609,\n 59385: 37647,\n 59386: 37626,\n 59387: 37700,\n 59388: 37678,\n 59456: 37657,\n 59457: 37666,\n 59458: 37658,\n 59459: 37667,\n 59460: 37690,\n 59461: 37685,\n 59462: 37691,\n 59463: 37724,\n 59464: 37728,\n 59465: 37756,\n 59466: 37742,\n 59467: 37718,\n 59468: 37808,\n 59469: 37804,\n 59470: 37805,\n 59471: 37780,\n 59472: 37817,\n 59473: 37846,\n 59474: 37847,\n 59475: 37864,\n 59476: 37861,\n 59477: 37848,\n 59478: 37827,\n 59479: 37853,\n 59480: 37840,\n 59481: 37832,\n 59482: 37860,\n 59483: 37914,\n 59484: 37908,\n 59485: 37907,\n 59486: 37891,\n 59487: 37895,\n 59488: 37904,\n 59489: 37942,\n 59490: 37931,\n 59491: 37941,\n 59492: 37921,\n 59493: 37946,\n 59494: 37953,\n 59495: 37970,\n 59496: 37956,\n 59497: 37979,\n 59498: 37984,\n 59499: 37986,\n 59500: 37982,\n 59501: 37994,\n 59502: 37417,\n 59503: 38000,\n 59504: 38005,\n 59505: 38007,\n 59506: 38013,\n 59507: 37978,\n 59508: 38012,\n 59509: 38014,\n 59510: 38017,\n 59511: 38015,\n 59512: 38274,\n 59513: 38279,\n 59514: 38282,\n 59515: 38292,\n 59516: 38294,\n 59517: 38296,\n 59518: 38297,\n 59520: 38304,\n 59521: 38312,\n 59522: 38311,\n 59523: 38317,\n 59524: 38332,\n 59525: 38331,\n 59526: 38329,\n 59527: 38334,\n 59528: 38346,\n 59529: 28662,\n 59530: 38339,\n 59531: 38349,\n 59532: 38348,\n 59533: 38357,\n 59534: 38356,\n 59535: 38358,\n 59536: 38364,\n 59537: 38369,\n 59538: 38373,\n 59539: 38370,\n 59540: 38433,\n 59541: 38440,\n 59542: 38446,\n 59543: 38447,\n 59544: 38466,\n 59545: 38476,\n 59546: 38479,\n 59547: 38475,\n 59548: 38519,\n 59549: 38492,\n 59550: 38494,\n 59551: 38493,\n 59552: 38495,\n 59553: 38502,\n 59554: 38514,\n 59555: 38508,\n 59556: 38541,\n 59557: 38552,\n 59558: 38549,\n 59559: 38551,\n 59560: 38570,\n 59561: 38567,\n 59562: 38577,\n 59563: 38578,\n 59564: 38576,\n 59565: 38580,\n 59566: 38582,\n 59567: 38584,\n 59568: 38585,\n 59569: 38606,\n 59570: 38603,\n 59571: 38601,\n 59572: 38605,\n 59573: 35149,\n 59574: 38620,\n 59575: 38669,\n 59576: 38613,\n 59577: 38649,\n 59578: 38660,\n 59579: 38662,\n 59580: 38664,\n 59581: 38675,\n 59582: 38670,\n 59583: 38673,\n 59584: 38671,\n 59585: 38678,\n 59586: 38681,\n 59587: 38692,\n 59588: 38698,\n 59589: 38704,\n 59590: 38713,\n 59591: 38717,\n 59592: 38718,\n 59593: 38724,\n 59594: 38726,\n 59595: 38728,\n 59596: 38722,\n 59597: 38729,\n 59598: 38748,\n 59599: 38752,\n 59600: 38756,\n 59601: 38758,\n 59602: 38760,\n 59603: 21202,\n 59604: 38763,\n 59605: 38769,\n 59606: 38777,\n 59607: 38789,\n 59608: 38780,\n 59609: 38785,\n 59610: 38778,\n 59611: 38790,\n 59612: 38795,\n 59613: 38799,\n 59614: 38800,\n 59615: 38812,\n 59616: 38824,\n 59617: 38822,\n 59618: 38819,\n 59619: 38835,\n 59620: 38836,\n 59621: 38851,\n 59622: 38854,\n 59623: 38856,\n 59624: 38859,\n 59625: 38876,\n 59626: 38893,\n 59627: 40783,\n 59628: 38898,\n 59629: 31455,\n 59630: 38902,\n 59631: 38901,\n 59632: 38927,\n 59633: 38924,\n 59634: 38968,\n 59635: 38948,\n 59636: 38945,\n 59637: 38967,\n 59638: 38973,\n 59639: 38982,\n 59640: 38991,\n 59641: 38987,\n 59642: 39019,\n 59643: 39023,\n 59644: 39024,\n 59712: 39025,\n 59713: 39028,\n 59714: 39027,\n 59715: 39082,\n 59716: 39087,\n 59717: 39089,\n 59718: 39094,\n 59719: 39108,\n 59720: 39107,\n 59721: 39110,\n 59722: 39145,\n 59723: 39147,\n 59724: 39171,\n 59725: 39177,\n 59726: 39186,\n 59727: 39188,\n 59728: 39192,\n 59729: 39201,\n 59730: 39197,\n 59731: 39198,\n 59732: 39204,\n 59733: 39200,\n 59734: 39212,\n 59735: 39214,\n 59736: 39229,\n 59737: 39230,\n 59738: 39234,\n 59739: 39241,\n 59740: 39237,\n 59741: 39248,\n 59742: 39243,\n 59743: 39249,\n 59744: 39250,\n 59745: 39244,\n 59746: 39253,\n 59747: 39319,\n 59748: 39320,\n 59749: 39333,\n 59750: 39341,\n 59751: 39342,\n 59752: 39356,\n 59753: 39391,\n 59754: 39387,\n 59755: 39389,\n 59756: 39384,\n 59757: 39377,\n 59758: 39405,\n 59759: 39406,\n 59760: 39409,\n 59761: 39410,\n 59762: 39419,\n 59763: 39416,\n 59764: 39425,\n 59765: 39439,\n 59766: 39429,\n 59767: 39394,\n 59768: 39449,\n 59769: 39467,\n 59770: 39479,\n 59771: 39493,\n 59772: 39490,\n 59773: 39488,\n 59774: 39491,\n 59776: 39486,\n 59777: 39509,\n 59778: 39501,\n 59779: 39515,\n 59780: 39511,\n 59781: 39519,\n 59782: 39522,\n 59783: 39525,\n 59784: 39524,\n 59785: 39529,\n 59786: 39531,\n 59787: 39530,\n 59788: 39597,\n 59789: 39600,\n 59790: 39612,\n 59791: 39616,\n 59792: 39631,\n 59793: 39633,\n 59794: 39635,\n 59795: 39636,\n 59796: 39646,\n 59797: 39647,\n 59798: 39650,\n 59799: 39651,\n 59800: 39654,\n 59801: 39663,\n 59802: 39659,\n 59803: 39662,\n 59804: 39668,\n 59805: 39665,\n 59806: 39671,\n 59807: 39675,\n 59808: 39686,\n 59809: 39704,\n 59810: 39706,\n 59811: 39711,\n 59812: 39714,\n 59813: 39715,\n 59814: 39717,\n 59815: 39719,\n 59816: 39720,\n 59817: 39721,\n 59818: 39722,\n 59819: 39726,\n 59820: 39727,\n 59821: 39730,\n 59822: 39748,\n 59823: 39747,\n 59824: 39759,\n 59825: 39757,\n 59826: 39758,\n 59827: 39761,\n 59828: 39768,\n 59829: 39796,\n 59830: 39827,\n 59831: 39811,\n 59832: 39825,\n 59833: 39830,\n 59834: 39831,\n 59835: 39839,\n 59836: 39840,\n 59837: 39848,\n 59838: 39860,\n 59839: 39872,\n 59840: 39882,\n 59841: 39865,\n 59842: 39878,\n 59843: 39887,\n 59844: 39889,\n 59845: 39890,\n 59846: 39907,\n 59847: 39906,\n 59848: 39908,\n 59849: 39892,\n 59850: 39905,\n 59851: 39994,\n 59852: 39922,\n 59853: 39921,\n 59854: 39920,\n 59855: 39957,\n 59856: 39956,\n 59857: 39945,\n 59858: 39955,\n 59859: 39948,\n 59860: 39942,\n 59861: 39944,\n 59862: 39954,\n 59863: 39946,\n 59864: 39940,\n 59865: 39982,\n 59866: 39963,\n 59867: 39973,\n 59868: 39972,\n 59869: 39969,\n 59870: 39984,\n 59871: 40007,\n 59872: 39986,\n 59873: 40006,\n 59874: 39998,\n 59875: 40026,\n 59876: 40032,\n 59877: 40039,\n 59878: 40054,\n 59879: 40056,\n 59880: 40167,\n 59881: 40172,\n 59882: 40176,\n 59883: 40201,\n 59884: 40200,\n 59885: 40171,\n 59886: 40195,\n 59887: 40198,\n 59888: 40234,\n 59889: 40230,\n 59890: 40367,\n 59891: 40227,\n 59892: 40223,\n 59893: 40260,\n 59894: 40213,\n 59895: 40210,\n 59896: 40257,\n 59897: 40255,\n 59898: 40254,\n 59899: 40262,\n 59900: 40264,\n 59968: 40285,\n 59969: 40286,\n 59970: 40292,\n 59971: 40273,\n 59972: 40272,\n 59973: 40281,\n 59974: 40306,\n 59975: 40329,\n 59976: 40327,\n 59977: 40363,\n 59978: 40303,\n 59979: 40314,\n 59980: 40346,\n 59981: 40356,\n 59982: 40361,\n 59983: 40370,\n 59984: 40388,\n 59985: 40385,\n 59986: 40379,\n 59987: 40376,\n 59988: 40378,\n 59989: 40390,\n 59990: 40399,\n 59991: 40386,\n 59992: 40409,\n 59993: 40403,\n 59994: 40440,\n 59995: 40422,\n 59996: 40429,\n 59997: 40431,\n 59998: 40445,\n 59999: 40474,\n 60000: 40475,\n 60001: 40478,\n 60002: 40565,\n 60003: 40569,\n 60004: 40573,\n 60005: 40577,\n 60006: 40584,\n 60007: 40587,\n 60008: 40588,\n 60009: 40594,\n 60010: 40597,\n 60011: 40593,\n 60012: 40605,\n 60013: 40613,\n 60014: 40617,\n 60015: 40632,\n 60016: 40618,\n 60017: 40621,\n 60018: 38753,\n 60019: 40652,\n 60020: 40654,\n 60021: 40655,\n 60022: 40656,\n 60023: 40660,\n 60024: 40668,\n 60025: 40670,\n 60026: 40669,\n 60027: 40672,\n 60028: 40677,\n 60029: 40680,\n 60030: 40687,\n 60032: 40692,\n 60033: 40694,\n 60034: 40695,\n 60035: 40697,\n 60036: 40699,\n 60037: 40700,\n 60038: 40701,\n 60039: 40711,\n 60040: 40712,\n 60041: 30391,\n 60042: 40725,\n 60043: 40737,\n 60044: 40748,\n 60045: 40766,\n 60046: 40778,\n 60047: 40786,\n 60048: 40788,\n 60049: 40803,\n 60050: 40799,\n 60051: 40800,\n 60052: 40801,\n 60053: 40806,\n 60054: 40807,\n 60055: 40812,\n 60056: 40810,\n 60057: 40823,\n 60058: 40818,\n 60059: 40822,\n 60060: 40853,\n 60061: 40860,\n 60062: 40864,\n 60063: 22575,\n 60064: 27079,\n 60065: 36953,\n 60066: 29796,\n 60067: 20956,\n 60068: 29081,\n 60736: 32394,\n 60737: 35100,\n 60738: 37704,\n 60739: 37512,\n 60740: 34012,\n 60741: 20425,\n 60742: 28859,\n 60743: 26161,\n 60744: 26824,\n 60745: 37625,\n 60746: 26363,\n 60747: 24389,\n 60748: 20008,\n 60749: 20193,\n 60750: 20220,\n 60751: 20224,\n 60752: 20227,\n 60753: 20281,\n 60754: 20310,\n 60755: 20370,\n 60756: 20362,\n 60757: 20378,\n 60758: 20372,\n 60759: 20429,\n 60760: 20544,\n 60761: 20514,\n 60762: 20479,\n 60763: 20510,\n 60764: 20550,\n 60765: 20592,\n 60766: 20546,\n 60767: 20628,\n 60768: 20724,\n 60769: 20696,\n 60770: 20810,\n 60771: 20836,\n 60772: 20893,\n 60773: 20926,\n 60774: 20972,\n 60775: 21013,\n 60776: 21148,\n 60777: 21158,\n 60778: 21184,\n 60779: 21211,\n 60780: 21248,\n 60781: 21255,\n 60782: 21284,\n 60783: 21362,\n 60784: 21395,\n 60785: 21426,\n 60786: 21469,\n 60787: 64014,\n 60788: 21660,\n 60789: 21642,\n 60790: 21673,\n 60791: 21759,\n 60792: 21894,\n 60793: 22361,\n 60794: 22373,\n 60795: 22444,\n 60796: 22472,\n 60797: 22471,\n 60798: 64015,\n 60800: 64016,\n 60801: 22686,\n 60802: 22706,\n 60803: 22795,\n 60804: 22867,\n 60805: 22875,\n 60806: 22877,\n 60807: 22883,\n 60808: 22948,\n 60809: 22970,\n 60810: 23382,\n 60811: 23488,\n 60812: 29999,\n 60813: 23512,\n 60814: 23532,\n 60815: 23582,\n 60816: 23718,\n 60817: 23738,\n 60818: 23797,\n 60819: 23847,\n 60820: 23891,\n 60821: 64017,\n 60822: 23874,\n 60823: 23917,\n 60824: 23992,\n 60825: 23993,\n 60826: 24016,\n 60827: 24353,\n 60828: 24372,\n 60829: 24423,\n 60830: 24503,\n 60831: 24542,\n 60832: 24669,\n 60833: 24709,\n 60834: 24714,\n 60835: 24798,\n 60836: 24789,\n 60837: 24864,\n 60838: 24818,\n 60839: 24849,\n 60840: 24887,\n 60841: 24880,\n 60842: 24984,\n 60843: 25107,\n 60844: 25254,\n 60845: 25589,\n 60846: 25696,\n 60847: 25757,\n 60848: 25806,\n 60849: 25934,\n 60850: 26112,\n 60851: 26133,\n 60852: 26171,\n 60853: 26121,\n 60854: 26158,\n 60855: 26142,\n 60856: 26148,\n 60857: 26213,\n 60858: 26199,\n 60859: 26201,\n 60860: 64018,\n 60861: 26227,\n 60862: 26265,\n 60863: 26272,\n 60864: 26290,\n 60865: 26303,\n 60866: 26362,\n 60867: 26382,\n 60868: 63785,\n 60869: 26470,\n 60870: 26555,\n 60871: 26706,\n 60872: 26560,\n 60873: 26625,\n 60874: 26692,\n 60875: 26831,\n 60876: 64019,\n 60877: 26984,\n 60878: 64020,\n 60879: 27032,\n 60880: 27106,\n 60881: 27184,\n 60882: 27243,\n 60883: 27206,\n 60884: 27251,\n 60885: 27262,\n 60886: 27362,\n 60887: 27364,\n 60888: 27606,\n 60889: 27711,\n 60890: 27740,\n 60891: 27782,\n 60892: 27759,\n 60893: 27866,\n 60894: 27908,\n 60895: 28039,\n 60896: 28015,\n 60897: 28054,\n 60898: 28076,\n 60899: 28111,\n 60900: 28152,\n 60901: 28146,\n 60902: 28156,\n 60903: 28217,\n 60904: 28252,\n 60905: 28199,\n 60906: 28220,\n 60907: 28351,\n 60908: 28552,\n 60909: 28597,\n 60910: 28661,\n 60911: 28677,\n 60912: 28679,\n 60913: 28712,\n 60914: 28805,\n 60915: 28843,\n 60916: 28943,\n 60917: 28932,\n 60918: 29020,\n 60919: 28998,\n 60920: 28999,\n 60921: 64021,\n 60922: 29121,\n 60923: 29182,\n 60924: 29361,\n 60992: 29374,\n 60993: 29476,\n 60994: 64022,\n 60995: 29559,\n 60996: 29629,\n 60997: 29641,\n 60998: 29654,\n 60999: 29667,\n 61000: 29650,\n 61001: 29703,\n 61002: 29685,\n 61003: 29734,\n 61004: 29738,\n 61005: 29737,\n 61006: 29742,\n 61007: 29794,\n 61008: 29833,\n 61009: 29855,\n 61010: 29953,\n 61011: 30063,\n 61012: 30338,\n 61013: 30364,\n 61014: 30366,\n 61015: 30363,\n 61016: 30374,\n 61017: 64023,\n 61018: 30534,\n 61019: 21167,\n 61020: 30753,\n 61021: 30798,\n 61022: 30820,\n 61023: 30842,\n 61024: 31024,\n 61025: 64024,\n 61026: 64025,\n 61027: 64026,\n 61028: 31124,\n 61029: 64027,\n 61030: 31131,\n 61031: 31441,\n 61032: 31463,\n 61033: 64028,\n 61034: 31467,\n 61035: 31646,\n 61036: 64029,\n 61037: 32072,\n 61038: 32092,\n 61039: 32183,\n 61040: 32160,\n 61041: 32214,\n 61042: 32338,\n 61043: 32583,\n 61044: 32673,\n 61045: 64030,\n 61046: 33537,\n 61047: 33634,\n 61048: 33663,\n 61049: 33735,\n 61050: 33782,\n 61051: 33864,\n 61052: 33972,\n 61053: 34131,\n 61054: 34137,\n 61056: 34155,\n 61057: 64031,\n 61058: 34224,\n 61059: 64032,\n 61060: 64033,\n 61061: 34823,\n 61062: 35061,\n 61063: 35346,\n 61064: 35383,\n 61065: 35449,\n 61066: 35495,\n 61067: 35518,\n 61068: 35551,\n 61069: 64034,\n 61070: 35574,\n 61071: 35667,\n 61072: 35711,\n 61073: 36080,\n 61074: 36084,\n 61075: 36114,\n 61076: 36214,\n 61077: 64035,\n 61078: 36559,\n 61079: 64036,\n 61080: 64037,\n 61081: 36967,\n 61082: 37086,\n 61083: 64038,\n 61084: 37141,\n 61085: 37159,\n 61086: 37338,\n 61087: 37335,\n 61088: 37342,\n 61089: 37357,\n 61090: 37358,\n 61091: 37348,\n 61092: 37349,\n 61093: 37382,\n 61094: 37392,\n 61095: 37386,\n 61096: 37434,\n 61097: 37440,\n 61098: 37436,\n 61099: 37454,\n 61100: 37465,\n 61101: 37457,\n 61102: 37433,\n 61103: 37479,\n 61104: 37543,\n 61105: 37495,\n 61106: 37496,\n 61107: 37607,\n 61108: 37591,\n 61109: 37593,\n 61110: 37584,\n 61111: 64039,\n 61112: 37589,\n 61113: 37600,\n 61114: 37587,\n 61115: 37669,\n 61116: 37665,\n 61117: 37627,\n 61118: 64040,\n 61119: 37662,\n 61120: 37631,\n 61121: 37661,\n 61122: 37634,\n 61123: 37744,\n 61124: 37719,\n 61125: 37796,\n 61126: 37830,\n 61127: 37854,\n 61128: 37880,\n 61129: 37937,\n 61130: 37957,\n 61131: 37960,\n 61132: 38290,\n 61133: 63964,\n 61134: 64041,\n 61135: 38557,\n 61136: 38575,\n 61137: 38707,\n 61138: 38715,\n 61139: 38723,\n 61140: 38733,\n 61141: 38735,\n 61142: 38737,\n 61143: 38741,\n 61144: 38999,\n 61145: 39013,\n 61146: 64042,\n 61147: 64043,\n 61148: 39207,\n 61149: 64044,\n 61150: 39326,\n 61151: 39502,\n 61152: 39641,\n 61153: 39644,\n 61154: 39797,\n 61155: 39794,\n 61156: 39823,\n 61157: 39857,\n 61158: 39867,\n 61159: 39936,\n 61160: 40304,\n 61161: 40299,\n 61162: 64045,\n 61163: 40473,\n 61164: 40657,\n 61167: 8560,\n 61168: 8561,\n 61169: 8562,\n 61170: 8563,\n 61171: 8564,\n 61172: 8565,\n 61173: 8566,\n 61174: 8567,\n 61175: 8568,\n 61176: 8569,\n 61177: 65506,\n 61178: 65508,\n 61179: 65287,\n 61180: 65282,\n 61504: 57344,\n 61505: 57345,\n 61506: 57346,\n 61507: 57347,\n 61508: 57348,\n 61509: 57349,\n 61510: 57350,\n 61511: 57351,\n 61512: 57352,\n 61513: 57353,\n 61514: 57354,\n 61515: 57355,\n 61516: 57356,\n 61517: 57357,\n 61518: 57358,\n 61519: 57359,\n 61520: 57360,\n 61521: 57361,\n 61522: 57362,\n 61523: 57363,\n 61524: 57364,\n 61525: 57365,\n 61526: 57366,\n 61527: 57367,\n 61528: 57368,\n 61529: 57369,\n 61530: 57370,\n 61531: 57371,\n 61532: 57372,\n 61533: 57373,\n 61534: 57374,\n 61535: 57375,\n 61536: 57376,\n 61537: 57377,\n 61538: 57378,\n 61539: 57379,\n 61540: 57380,\n 61541: 57381,\n 61542: 57382,\n 61543: 57383,\n 61544: 57384,\n 61545: 57385,\n 61546: 57386,\n 61547: 57387,\n 61548: 57388,\n 61549: 57389,\n 61550: 57390,\n 61551: 57391,\n 61552: 57392,\n 61553: 57393,\n 61554: 57394,\n 61555: 57395,\n 61556: 57396,\n 61557: 57397,\n 61558: 57398,\n 61559: 57399,\n 61560: 57400,\n 61561: 57401,\n 61562: 57402,\n 61563: 57403,\n 61564: 57404,\n 61565: 57405,\n 61566: 57406,\n 61568: 57407,\n 61569: 57408,\n 61570: 57409,\n 61571: 57410,\n 61572: 57411,\n 61573: 57412,\n 61574: 57413,\n 61575: 57414,\n 61576: 57415,\n 61577: 57416,\n 61578: 57417,\n 61579: 57418,\n 61580: 57419,\n 61581: 57420,\n 61582: 57421,\n 61583: 57422,\n 61584: 57423,\n 61585: 57424,\n 61586: 57425,\n 61587: 57426,\n 61588: 57427,\n 61589: 57428,\n 61590: 57429,\n 61591: 57430,\n 61592: 57431,\n 61593: 57432,\n 61594: 57433,\n 61595: 57434,\n 61596: 57435,\n 61597: 57436,\n 61598: 57437,\n 61599: 57438,\n 61600: 57439,\n 61601: 57440,\n 61602: 57441,\n 61603: 57442,\n 61604: 57443,\n 61605: 57444,\n 61606: 57445,\n 61607: 57446,\n 61608: 57447,\n 61609: 57448,\n 61610: 57449,\n 61611: 57450,\n 61612: 57451,\n 61613: 57452,\n 61614: 57453,\n 61615: 57454,\n 61616: 57455,\n 61617: 57456,\n 61618: 57457,\n 61619: 57458,\n 61620: 57459,\n 61621: 57460,\n 61622: 57461,\n 61623: 57462,\n 61624: 57463,\n 61625: 57464,\n 61626: 57465,\n 61627: 57466,\n 61628: 57467,\n 61629: 57468,\n 61630: 57469,\n 61631: 57470,\n 61632: 57471,\n 61633: 57472,\n 61634: 57473,\n 61635: 57474,\n 61636: 57475,\n 61637: 57476,\n 61638: 57477,\n 61639: 57478,\n 61640: 57479,\n 61641: 57480,\n 61642: 57481,\n 61643: 57482,\n 61644: 57483,\n 61645: 57484,\n 61646: 57485,\n 61647: 57486,\n 61648: 57487,\n 61649: 57488,\n 61650: 57489,\n 61651: 57490,\n 61652: 57491,\n 61653: 57492,\n 61654: 57493,\n 61655: 57494,\n 61656: 57495,\n 61657: 57496,\n 61658: 57497,\n 61659: 57498,\n 61660: 57499,\n 61661: 57500,\n 61662: 57501,\n 61663: 57502,\n 61664: 57503,\n 61665: 57504,\n 61666: 57505,\n 61667: 57506,\n 61668: 57507,\n 61669: 57508,\n 61670: 57509,\n 61671: 57510,\n 61672: 57511,\n 61673: 57512,\n 61674: 57513,\n 61675: 57514,\n 61676: 57515,\n 61677: 57516,\n 61678: 57517,\n 61679: 57518,\n 61680: 57519,\n 61681: 57520,\n 61682: 57521,\n 61683: 57522,\n 61684: 57523,\n 61685: 57524,\n 61686: 57525,\n 61687: 57526,\n 61688: 57527,\n 61689: 57528,\n 61690: 57529,\n 61691: 57530,\n 61692: 57531,\n 61760: 57532,\n 61761: 57533,\n 61762: 57534,\n 61763: 57535,\n 61764: 57536,\n 61765: 57537,\n 61766: 57538,\n 61767: 57539,\n 61768: 57540,\n 61769: 57541,\n 61770: 57542,\n 61771: 57543,\n 61772: 57544,\n 61773: 57545,\n 61774: 57546,\n 61775: 57547,\n 61776: 57548,\n 61777: 57549,\n 61778: 57550,\n 61779: 57551,\n 61780: 57552,\n 61781: 57553,\n 61782: 57554,\n 61783: 57555,\n 61784: 57556,\n 61785: 57557,\n 61786: 57558,\n 61787: 57559,\n 61788: 57560,\n 61789: 57561,\n 61790: 57562,\n 61791: 57563,\n 61792: 57564,\n 61793: 57565,\n 61794: 57566,\n 61795: 57567,\n 61796: 57568,\n 61797: 57569,\n 61798: 57570,\n 61799: 57571,\n 61800: 57572,\n 61801: 57573,\n 61802: 57574,\n 61803: 57575,\n 61804: 57576,\n 61805: 57577,\n 61806: 57578,\n 61807: 57579,\n 61808: 57580,\n 61809: 57581,\n 61810: 57582,\n 61811: 57583,\n 61812: 57584,\n 61813: 57585,\n 61814: 57586,\n 61815: 57587,\n 61816: 57588,\n 61817: 57589,\n 61818: 57590,\n 61819: 57591,\n 61820: 57592,\n 61821: 57593,\n 61822: 57594,\n 61824: 57595,\n 61825: 57596,\n 61826: 57597,\n 61827: 57598,\n 61828: 57599,\n 61829: 57600,\n 61830: 57601,\n 61831: 57602,\n 61832: 57603,\n 61833: 57604,\n 61834: 57605,\n 61835: 57606,\n 61836: 57607,\n 61837: 57608,\n 61838: 57609,\n 61839: 57610,\n 61840: 57611,\n 61841: 57612,\n 61842: 57613,\n 61843: 57614,\n 61844: 57615,\n 61845: 57616,\n 61846: 57617,\n 61847: 57618,\n 61848: 57619,\n 61849: 57620,\n 61850: 57621,\n 61851: 57622,\n 61852: 57623,\n 61853: 57624,\n 61854: 57625,\n 61855: 57626,\n 61856: 57627,\n 61857: 57628,\n 61858: 57629,\n 61859: 57630,\n 61860: 57631,\n 61861: 57632,\n 61862: 57633,\n 61863: 57634,\n 61864: 57635,\n 61865: 57636,\n 61866: 57637,\n 61867: 57638,\n 61868: 57639,\n 61869: 57640,\n 61870: 57641,\n 61871: 57642,\n 61872: 57643,\n 61873: 57644,\n 61874: 57645,\n 61875: 57646,\n 61876: 57647,\n 61877: 57648,\n 61878: 57649,\n 61879: 57650,\n 61880: 57651,\n 61881: 57652,\n 61882: 57653,\n 61883: 57654,\n 61884: 57655,\n 61885: 57656,\n 61886: 57657,\n 61887: 57658,\n 61888: 57659,\n 61889: 57660,\n 61890: 57661,\n 61891: 57662,\n 61892: 57663,\n 61893: 57664,\n 61894: 57665,\n 61895: 57666,\n 61896: 57667,\n 61897: 57668,\n 61898: 57669,\n 61899: 57670,\n 61900: 57671,\n 61901: 57672,\n 61902: 57673,\n 61903: 57674,\n 61904: 57675,\n 61905: 57676,\n 61906: 57677,\n 61907: 57678,\n 61908: 57679,\n 61909: 57680,\n 61910: 57681,\n 61911: 57682,\n 61912: 57683,\n 61913: 57684,\n 61914: 57685,\n 61915: 57686,\n 61916: 57687,\n 61917: 57688,\n 61918: 57689,\n 61919: 57690,\n 61920: 57691,\n 61921: 57692,\n 61922: 57693,\n 61923: 57694,\n 61924: 57695,\n 61925: 57696,\n 61926: 57697,\n 61927: 57698,\n 61928: 57699,\n 61929: 57700,\n 61930: 57701,\n 61931: 57702,\n 61932: 57703,\n 61933: 57704,\n 61934: 57705,\n 61935: 57706,\n 61936: 57707,\n 61937: 57708,\n 61938: 57709,\n 61939: 57710,\n 61940: 57711,\n 61941: 57712,\n 61942: 57713,\n 61943: 57714,\n 61944: 57715,\n 61945: 57716,\n 61946: 57717,\n 61947: 57718,\n 61948: 57719,\n 62016: 57720,\n 62017: 57721,\n 62018: 57722,\n 62019: 57723,\n 62020: 57724,\n 62021: 57725,\n 62022: 57726,\n 62023: 57727,\n 62024: 57728,\n 62025: 57729,\n 62026: 57730,\n 62027: 57731,\n 62028: 57732,\n 62029: 57733,\n 62030: 57734,\n 62031: 57735,\n 62032: 57736,\n 62033: 57737,\n 62034: 57738,\n 62035: 57739,\n 62036: 57740,\n 62037: 57741,\n 62038: 57742,\n 62039: 57743,\n 62040: 57744,\n 62041: 57745,\n 62042: 57746,\n 62043: 57747,\n 62044: 57748,\n 62045: 57749,\n 62046: 57750,\n 62047: 57751,\n 62048: 57752,\n 62049: 57753,\n 62050: 57754,\n 62051: 57755,\n 62052: 57756,\n 62053: 57757,\n 62054: 57758,\n 62055: 57759,\n 62056: 57760,\n 62057: 57761,\n 62058: 57762,\n 62059: 57763,\n 62060: 57764,\n 62061: 57765,\n 62062: 57766,\n 62063: 57767,\n 62064: 57768,\n 62065: 57769,\n 62066: 57770,\n 62067: 57771,\n 62068: 57772,\n 62069: 57773,\n 62070: 57774,\n 62071: 57775,\n 62072: 57776,\n 62073: 57777,\n 62074: 57778,\n 62075: 57779,\n 62076: 57780,\n 62077: 57781,\n 62078: 57782,\n 62080: 57783,\n 62081: 57784,\n 62082: 57785,\n 62083: 57786,\n 62084: 57787,\n 62085: 57788,\n 62086: 57789,\n 62087: 57790,\n 62088: 57791,\n 62089: 57792,\n 62090: 57793,\n 62091: 57794,\n 62092: 57795,\n 62093: 57796,\n 62094: 57797,\n 62095: 57798,\n 62096: 57799,\n 62097: 57800,\n 62098: 57801,\n 62099: 57802,\n 62100: 57803,\n 62101: 57804,\n 62102: 57805,\n 62103: 57806,\n 62104: 57807,\n 62105: 57808,\n 62106: 57809,\n 62107: 57810,\n 62108: 57811,\n 62109: 57812,\n 62110: 57813,\n 62111: 57814,\n 62112: 57815,\n 62113: 57816,\n 62114: 57817,\n 62115: 57818,\n 62116: 57819,\n 62117: 57820,\n 62118: 57821,\n 62119: 57822,\n 62120: 57823,\n 62121: 57824,\n 62122: 57825,\n 62123: 57826,\n 62124: 57827,\n 62125: 57828,\n 62126: 57829,\n 62127: 57830,\n 62128: 57831,\n 62129: 57832,\n 62130: 57833,\n 62131: 57834,\n 62132: 57835,\n 62133: 57836,\n 62134: 57837,\n 62135: 57838,\n 62136: 57839,\n 62137: 57840,\n 62138: 57841,\n 62139: 57842,\n 62140: 57843,\n 62141: 57844,\n 62142: 57845,\n 62143: 57846,\n 62144: 57847,\n 62145: 57848,\n 62146: 57849,\n 62147: 57850,\n 62148: 57851,\n 62149: 57852,\n 62150: 57853,\n 62151: 57854,\n 62152: 57855,\n 62153: 57856,\n 62154: 57857,\n 62155: 57858,\n 62156: 57859,\n 62157: 57860,\n 62158: 57861,\n 62159: 57862,\n 62160: 57863,\n 62161: 57864,\n 62162: 57865,\n 62163: 57866,\n 62164: 57867,\n 62165: 57868,\n 62166: 57869,\n 62167: 57870,\n 62168: 57871,\n 62169: 57872,\n 62170: 57873,\n 62171: 57874,\n 62172: 57875,\n 62173: 57876,\n 62174: 57877,\n 62175: 57878,\n 62176: 57879,\n 62177: 57880,\n 62178: 57881,\n 62179: 57882,\n 62180: 57883,\n 62181: 57884,\n 62182: 57885,\n 62183: 57886,\n 62184: 57887,\n 62185: 57888,\n 62186: 57889,\n 62187: 57890,\n 62188: 57891,\n 62189: 57892,\n 62190: 57893,\n 62191: 57894,\n 62192: 57895,\n 62193: 57896,\n 62194: 57897,\n 62195: 57898,\n 62196: 57899,\n 62197: 57900,\n 62198: 57901,\n 62199: 57902,\n 62200: 57903,\n 62201: 57904,\n 62202: 57905,\n 62203: 57906,\n 62204: 57907,\n 62272: 57908,\n 62273: 57909,\n 62274: 57910,\n 62275: 57911,\n 62276: 57912,\n 62277: 57913,\n 62278: 57914,\n 62279: 57915,\n 62280: 57916,\n 62281: 57917,\n 62282: 57918,\n 62283: 57919,\n 62284: 57920,\n 62285: 57921,\n 62286: 57922,\n 62287: 57923,\n 62288: 57924,\n 62289: 57925,\n 62290: 57926,\n 62291: 57927,\n 62292: 57928,\n 62293: 57929,\n 62294: 57930,\n 62295: 57931,\n 62296: 57932,\n 62297: 57933,\n 62298: 57934,\n 62299: 57935,\n 62300: 57936,\n 62301: 57937,\n 62302: 57938,\n 62303: 57939,\n 62304: 57940,\n 62305: 57941,\n 62306: 57942,\n 62307: 57943,\n 62308: 57944,\n 62309: 57945,\n 62310: 57946,\n 62311: 57947,\n 62312: 57948,\n 62313: 57949,\n 62314: 57950,\n 62315: 57951,\n 62316: 57952,\n 62317: 57953,\n 62318: 57954,\n 62319: 57955,\n 62320: 57956,\n 62321: 57957,\n 62322: 57958,\n 62323: 57959,\n 62324: 57960,\n 62325: 57961,\n 62326: 57962,\n 62327: 57963,\n 62328: 57964,\n 62329: 57965,\n 62330: 57966,\n 62331: 57967,\n 62332: 57968,\n 62333: 57969,\n 62334: 57970,\n 62336: 57971,\n 62337: 57972,\n 62338: 57973,\n 62339: 57974,\n 62340: 57975,\n 62341: 57976,\n 62342: 57977,\n 62343: 57978,\n 62344: 57979,\n 62345: 57980,\n 62346: 57981,\n 62347: 57982,\n 62348: 57983,\n 62349: 57984,\n 62350: 57985,\n 62351: 57986,\n 62352: 57987,\n 62353: 57988,\n 62354: 57989,\n 62355: 57990,\n 62356: 57991,\n 62357: 57992,\n 62358: 57993,\n 62359: 57994,\n 62360: 57995,\n 62361: 57996,\n 62362: 57997,\n 62363: 57998,\n 62364: 57999,\n 62365: 58000,\n 62366: 58001,\n 62367: 58002,\n 62368: 58003,\n 62369: 58004,\n 62370: 58005,\n 62371: 58006,\n 62372: 58007,\n 62373: 58008,\n 62374: 58009,\n 62375: 58010,\n 62376: 58011,\n 62377: 58012,\n 62378: 58013,\n 62379: 58014,\n 62380: 58015,\n 62381: 58016,\n 62382: 58017,\n 62383: 58018,\n 62384: 58019,\n 62385: 58020,\n 62386: 58021,\n 62387: 58022,\n 62388: 58023,\n 62389: 58024,\n 62390: 58025,\n 62391: 58026,\n 62392: 58027,\n 62393: 58028,\n 62394: 58029,\n 62395: 58030,\n 62396: 58031,\n 62397: 58032,\n 62398: 58033,\n 62399: 58034,\n 62400: 58035,\n 62401: 58036,\n 62402: 58037,\n 62403: 58038,\n 62404: 58039,\n 62405: 58040,\n 62406: 58041,\n 62407: 58042,\n 62408: 58043,\n 62409: 58044,\n 62410: 58045,\n 62411: 58046,\n 62412: 58047,\n 62413: 58048,\n 62414: 58049,\n 62415: 58050,\n 62416: 58051,\n 62417: 58052,\n 62418: 58053,\n 62419: 58054,\n 62420: 58055,\n 62421: 58056,\n 62422: 58057,\n 62423: 58058,\n 62424: 58059,\n 62425: 58060,\n 62426: 58061,\n 62427: 58062,\n 62428: 58063,\n 62429: 58064,\n 62430: 58065,\n 62431: 58066,\n 62432: 58067,\n 62433: 58068,\n 62434: 58069,\n 62435: 58070,\n 62436: 58071,\n 62437: 58072,\n 62438: 58073,\n 62439: 58074,\n 62440: 58075,\n 62441: 58076,\n 62442: 58077,\n 62443: 58078,\n 62444: 58079,\n 62445: 58080,\n 62446: 58081,\n 62447: 58082,\n 62448: 58083,\n 62449: 58084,\n 62450: 58085,\n 62451: 58086,\n 62452: 58087,\n 62453: 58088,\n 62454: 58089,\n 62455: 58090,\n 62456: 58091,\n 62457: 58092,\n 62458: 58093,\n 62459: 58094,\n 62460: 58095,\n 62528: 58096,\n 62529: 58097,\n 62530: 58098,\n 62531: 58099,\n 62532: 58100,\n 62533: 58101,\n 62534: 58102,\n 62535: 58103,\n 62536: 58104,\n 62537: 58105,\n 62538: 58106,\n 62539: 58107,\n 62540: 58108,\n 62541: 58109,\n 62542: 58110,\n 62543: 58111,\n 62544: 58112,\n 62545: 58113,\n 62546: 58114,\n 62547: 58115,\n 62548: 58116,\n 62549: 58117,\n 62550: 58118,\n 62551: 58119,\n 62552: 58120,\n 62553: 58121,\n 62554: 58122,\n 62555: 58123,\n 62556: 58124,\n 62557: 58125,\n 62558: 58126,\n 62559: 58127,\n 62560: 58128,\n 62561: 58129,\n 62562: 58130,\n 62563: 58131,\n 62564: 58132,\n 62565: 58133,\n 62566: 58134,\n 62567: 58135,\n 62568: 58136,\n 62569: 58137,\n 62570: 58138,\n 62571: 58139,\n 62572: 58140,\n 62573: 58141,\n 62574: 58142,\n 62575: 58143,\n 62576: 58144,\n 62577: 58145,\n 62578: 58146,\n 62579: 58147,\n 62580: 58148,\n 62581: 58149,\n 62582: 58150,\n 62583: 58151,\n 62584: 58152,\n 62585: 58153,\n 62586: 58154,\n 62587: 58155,\n 62588: 58156,\n 62589: 58157,\n 62590: 58158,\n 62592: 58159,\n 62593: 58160,\n 62594: 58161,\n 62595: 58162,\n 62596: 58163,\n 62597: 58164,\n 62598: 58165,\n 62599: 58166,\n 62600: 58167,\n 62601: 58168,\n 62602: 58169,\n 62603: 58170,\n 62604: 58171,\n 62605: 58172,\n 62606: 58173,\n 62607: 58174,\n 62608: 58175,\n 62609: 58176,\n 62610: 58177,\n 62611: 58178,\n 62612: 58179,\n 62613: 58180,\n 62614: 58181,\n 62615: 58182,\n 62616: 58183,\n 62617: 58184,\n 62618: 58185,\n 62619: 58186,\n 62620: 58187,\n 62621: 58188,\n 62622: 58189,\n 62623: 58190,\n 62624: 58191,\n 62625: 58192,\n 62626: 58193,\n 62627: 58194,\n 62628: 58195,\n 62629: 58196,\n 62630: 58197,\n 62631: 58198,\n 62632: 58199,\n 62633: 58200,\n 62634: 58201,\n 62635: 58202,\n 62636: 58203,\n 62637: 58204,\n 62638: 58205,\n 62639: 58206,\n 62640: 58207,\n 62641: 58208,\n 62642: 58209,\n 62643: 58210,\n 62644: 58211,\n 62645: 58212,\n 62646: 58213,\n 62647: 58214,\n 62648: 58215,\n 62649: 58216,\n 62650: 58217,\n 62651: 58218,\n 62652: 58219,\n 62653: 58220,\n 62654: 58221,\n 62655: 58222,\n 62656: 58223,\n 62657: 58224,\n 62658: 58225,\n 62659: 58226,\n 62660: 58227,\n 62661: 58228,\n 62662: 58229,\n 62663: 58230,\n 62664: 58231,\n 62665: 58232,\n 62666: 58233,\n 62667: 58234,\n 62668: 58235,\n 62669: 58236,\n 62670: 58237,\n 62671: 58238,\n 62672: 58239,\n 62673: 58240,\n 62674: 58241,\n 62675: 58242,\n 62676: 58243,\n 62677: 58244,\n 62678: 58245,\n 62679: 58246,\n 62680: 58247,\n 62681: 58248,\n 62682: 58249,\n 62683: 58250,\n 62684: 58251,\n 62685: 58252,\n 62686: 58253,\n 62687: 58254,\n 62688: 58255,\n 62689: 58256,\n 62690: 58257,\n 62691: 58258,\n 62692: 58259,\n 62693: 58260,\n 62694: 58261,\n 62695: 58262,\n 62696: 58263,\n 62697: 58264,\n 62698: 58265,\n 62699: 58266,\n 62700: 58267,\n 62701: 58268,\n 62702: 58269,\n 62703: 58270,\n 62704: 58271,\n 62705: 58272,\n 62706: 58273,\n 62707: 58274,\n 62708: 58275,\n 62709: 58276,\n 62710: 58277,\n 62711: 58278,\n 62712: 58279,\n 62713: 58280,\n 62714: 58281,\n 62715: 58282,\n 62716: 58283,\n 62784: 58284,\n 62785: 58285,\n 62786: 58286,\n 62787: 58287,\n 62788: 58288,\n 62789: 58289,\n 62790: 58290,\n 62791: 58291,\n 62792: 58292,\n 62793: 58293,\n 62794: 58294,\n 62795: 58295,\n 62796: 58296,\n 62797: 58297,\n 62798: 58298,\n 62799: 58299,\n 62800: 58300,\n 62801: 58301,\n 62802: 58302,\n 62803: 58303,\n 62804: 58304,\n 62805: 58305,\n 62806: 58306,\n 62807: 58307,\n 62808: 58308,\n 62809: 58309,\n 62810: 58310,\n 62811: 58311,\n 62812: 58312,\n 62813: 58313,\n 62814: 58314,\n 62815: 58315,\n 62816: 58316,\n 62817: 58317,\n 62818: 58318,\n 62819: 58319,\n 62820: 58320,\n 62821: 58321,\n 62822: 58322,\n 62823: 58323,\n 62824: 58324,\n 62825: 58325,\n 62826: 58326,\n 62827: 58327,\n 62828: 58328,\n 62829: 58329,\n 62830: 58330,\n 62831: 58331,\n 62832: 58332,\n 62833: 58333,\n 62834: 58334,\n 62835: 58335,\n 62836: 58336,\n 62837: 58337,\n 62838: 58338,\n 62839: 58339,\n 62840: 58340,\n 62841: 58341,\n 62842: 58342,\n 62843: 58343,\n 62844: 58344,\n 62845: 58345,\n 62846: 58346,\n 62848: 58347,\n 62849: 58348,\n 62850: 58349,\n 62851: 58350,\n 62852: 58351,\n 62853: 58352,\n 62854: 58353,\n 62855: 58354,\n 62856: 58355,\n 62857: 58356,\n 62858: 58357,\n 62859: 58358,\n 62860: 58359,\n 62861: 58360,\n 62862: 58361,\n 62863: 58362,\n 62864: 58363,\n 62865: 58364,\n 62866: 58365,\n 62867: 58366,\n 62868: 58367,\n 62869: 58368,\n 62870: 58369,\n 62871: 58370,\n 62872: 58371,\n 62873: 58372,\n 62874: 58373,\n 62875: 58374,\n 62876: 58375,\n 62877: 58376,\n 62878: 58377,\n 62879: 58378,\n 62880: 58379,\n 62881: 58380,\n 62882: 58381,\n 62883: 58382,\n 62884: 58383,\n 62885: 58384,\n 62886: 58385,\n 62887: 58386,\n 62888: 58387,\n 62889: 58388,\n 62890: 58389,\n 62891: 58390,\n 62892: 58391,\n 62893: 58392,\n 62894: 58393,\n 62895: 58394,\n 62896: 58395,\n 62897: 58396,\n 62898: 58397,\n 62899: 58398,\n 62900: 58399,\n 62901: 58400,\n 62902: 58401,\n 62903: 58402,\n 62904: 58403,\n 62905: 58404,\n 62906: 58405,\n 62907: 58406,\n 62908: 58407,\n 62909: 58408,\n 62910: 58409,\n 62911: 58410,\n 62912: 58411,\n 62913: 58412,\n 62914: 58413,\n 62915: 58414,\n 62916: 58415,\n 62917: 58416,\n 62918: 58417,\n 62919: 58418,\n 62920: 58419,\n 62921: 58420,\n 62922: 58421,\n 62923: 58422,\n 62924: 58423,\n 62925: 58424,\n 62926: 58425,\n 62927: 58426,\n 62928: 58427,\n 62929: 58428,\n 62930: 58429,\n 62931: 58430,\n 62932: 58431,\n 62933: 58432,\n 62934: 58433,\n 62935: 58434,\n 62936: 58435,\n 62937: 58436,\n 62938: 58437,\n 62939: 58438,\n 62940: 58439,\n 62941: 58440,\n 62942: 58441,\n 62943: 58442,\n 62944: 58443,\n 62945: 58444,\n 62946: 58445,\n 62947: 58446,\n 62948: 58447,\n 62949: 58448,\n 62950: 58449,\n 62951: 58450,\n 62952: 58451,\n 62953: 58452,\n 62954: 58453,\n 62955: 58454,\n 62956: 58455,\n 62957: 58456,\n 62958: 58457,\n 62959: 58458,\n 62960: 58459,\n 62961: 58460,\n 62962: 58461,\n 62963: 58462,\n 62964: 58463,\n 62965: 58464,\n 62966: 58465,\n 62967: 58466,\n 62968: 58467,\n 62969: 58468,\n 62970: 58469,\n 62971: 58470,\n 62972: 58471,\n 63040: 58472,\n 63041: 58473,\n 63042: 58474,\n 63043: 58475,\n 63044: 58476,\n 63045: 58477,\n 63046: 58478,\n 63047: 58479,\n 63048: 58480,\n 63049: 58481,\n 63050: 58482,\n 63051: 58483,\n 63052: 58484,\n 63053: 58485,\n 63054: 58486,\n 63055: 58487,\n 63056: 58488,\n 63057: 58489,\n 63058: 58490,\n 63059: 58491,\n 63060: 58492,\n 63061: 58493,\n 63062: 58494,\n 63063: 58495,\n 63064: 58496,\n 63065: 58497,\n 63066: 58498,\n 63067: 58499,\n 63068: 58500,\n 63069: 58501,\n 63070: 58502,\n 63071: 58503,\n 63072: 58504,\n 63073: 58505,\n 63074: 58506,\n 63075: 58507,\n 63076: 58508,\n 63077: 58509,\n 63078: 58510,\n 63079: 58511,\n 63080: 58512,\n 63081: 58513,\n 63082: 58514,\n 63083: 58515,\n 63084: 58516,\n 63085: 58517,\n 63086: 58518,\n 63087: 58519,\n 63088: 58520,\n 63089: 58521,\n 63090: 58522,\n 63091: 58523,\n 63092: 58524,\n 63093: 58525,\n 63094: 58526,\n 63095: 58527,\n 63096: 58528,\n 63097: 58529,\n 63098: 58530,\n 63099: 58531,\n 63100: 58532,\n 63101: 58533,\n 63102: 58534,\n 63104: 58535,\n 63105: 58536,\n 63106: 58537,\n 63107: 58538,\n 63108: 58539,\n 63109: 58540,\n 63110: 58541,\n 63111: 58542,\n 63112: 58543,\n 63113: 58544,\n 63114: 58545,\n 63115: 58546,\n 63116: 58547,\n 63117: 58548,\n 63118: 58549,\n 63119: 58550,\n 63120: 58551,\n 63121: 58552,\n 63122: 58553,\n 63123: 58554,\n 63124: 58555,\n 63125: 58556,\n 63126: 58557,\n 63127: 58558,\n 63128: 58559,\n 63129: 58560,\n 63130: 58561,\n 63131: 58562,\n 63132: 58563,\n 63133: 58564,\n 63134: 58565,\n 63135: 58566,\n 63136: 58567,\n 63137: 58568,\n 63138: 58569,\n 63139: 58570,\n 63140: 58571,\n 63141: 58572,\n 63142: 58573,\n 63143: 58574,\n 63144: 58575,\n 63145: 58576,\n 63146: 58577,\n 63147: 58578,\n 63148: 58579,\n 63149: 58580,\n 63150: 58581,\n 63151: 58582,\n 63152: 58583,\n 63153: 58584,\n 63154: 58585,\n 63155: 58586,\n 63156: 58587,\n 63157: 58588,\n 63158: 58589,\n 63159: 58590,\n 63160: 58591,\n 63161: 58592,\n 63162: 58593,\n 63163: 58594,\n 63164: 58595,\n 63165: 58596,\n 63166: 58597,\n 63167: 58598,\n 63168: 58599,\n 63169: 58600,\n 63170: 58601,\n 63171: 58602,\n 63172: 58603,\n 63173: 58604,\n 63174: 58605,\n 63175: 58606,\n 63176: 58607,\n 63177: 58608,\n 63178: 58609,\n 63179: 58610,\n 63180: 58611,\n 63181: 58612,\n 63182: 58613,\n 63183: 58614,\n 63184: 58615,\n 63185: 58616,\n 63186: 58617,\n 63187: 58618,\n 63188: 58619,\n 63189: 58620,\n 63190: 58621,\n 63191: 58622,\n 63192: 58623,\n 63193: 58624,\n 63194: 58625,\n 63195: 58626,\n 63196: 58627,\n 63197: 58628,\n 63198: 58629,\n 63199: 58630,\n 63200: 58631,\n 63201: 58632,\n 63202: 58633,\n 63203: 58634,\n 63204: 58635,\n 63205: 58636,\n 63206: 58637,\n 63207: 58638,\n 63208: 58639,\n 63209: 58640,\n 63210: 58641,\n 63211: 58642,\n 63212: 58643,\n 63213: 58644,\n 63214: 58645,\n 63215: 58646,\n 63216: 58647,\n 63217: 58648,\n 63218: 58649,\n 63219: 58650,\n 63220: 58651,\n 63221: 58652,\n 63222: 58653,\n 63223: 58654,\n 63224: 58655,\n 63225: 58656,\n 63226: 58657,\n 63227: 58658,\n 63228: 58659,\n 63296: 58660,\n 63297: 58661,\n 63298: 58662,\n 63299: 58663,\n 63300: 58664,\n 63301: 58665,\n 63302: 58666,\n 63303: 58667,\n 63304: 58668,\n 63305: 58669,\n 63306: 58670,\n 63307: 58671,\n 63308: 58672,\n 63309: 58673,\n 63310: 58674,\n 63311: 58675,\n 63312: 58676,\n 63313: 58677,\n 63314: 58678,\n 63315: 58679,\n 63316: 58680,\n 63317: 58681,\n 63318: 58682,\n 63319: 58683,\n 63320: 58684,\n 63321: 58685,\n 63322: 58686,\n 63323: 58687,\n 63324: 58688,\n 63325: 58689,\n 63326: 58690,\n 63327: 58691,\n 63328: 58692,\n 63329: 58693,\n 63330: 58694,\n 63331: 58695,\n 63332: 58696,\n 63333: 58697,\n 63334: 58698,\n 63335: 58699,\n 63336: 58700,\n 63337: 58701,\n 63338: 58702,\n 63339: 58703,\n 63340: 58704,\n 63341: 58705,\n 63342: 58706,\n 63343: 58707,\n 63344: 58708,\n 63345: 58709,\n 63346: 58710,\n 63347: 58711,\n 63348: 58712,\n 63349: 58713,\n 63350: 58714,\n 63351: 58715,\n 63352: 58716,\n 63353: 58717,\n 63354: 58718,\n 63355: 58719,\n 63356: 58720,\n 63357: 58721,\n 63358: 58722,\n 63360: 58723,\n 63361: 58724,\n 63362: 58725,\n 63363: 58726,\n 63364: 58727,\n 63365: 58728,\n 63366: 58729,\n 63367: 58730,\n 63368: 58731,\n 63369: 58732,\n 63370: 58733,\n 63371: 58734,\n 63372: 58735,\n 63373: 58736,\n 63374: 58737,\n 63375: 58738,\n 63376: 58739,\n 63377: 58740,\n 63378: 58741,\n 63379: 58742,\n 63380: 58743,\n 63381: 58744,\n 63382: 58745,\n 63383: 58746,\n 63384: 58747,\n 63385: 58748,\n 63386: 58749,\n 63387: 58750,\n 63388: 58751,\n 63389: 58752,\n 63390: 58753,\n 63391: 58754,\n 63392: 58755,\n 63393: 58756,\n 63394: 58757,\n 63395: 58758,\n 63396: 58759,\n 63397: 58760,\n 63398: 58761,\n 63399: 58762,\n 63400: 58763,\n 63401: 58764,\n 63402: 58765,\n 63403: 58766,\n 63404: 58767,\n 63405: 58768,\n 63406: 58769,\n 63407: 58770,\n 63408: 58771,\n 63409: 58772,\n 63410: 58773,\n 63411: 58774,\n 63412: 58775,\n 63413: 58776,\n 63414: 58777,\n 63415: 58778,\n 63416: 58779,\n 63417: 58780,\n 63418: 58781,\n 63419: 58782,\n 63420: 58783,\n 63421: 58784,\n 63422: 58785,\n 63423: 58786,\n 63424: 58787,\n 63425: 58788,\n 63426: 58789,\n 63427: 58790,\n 63428: 58791,\n 63429: 58792,\n 63430: 58793,\n 63431: 58794,\n 63432: 58795,\n 63433: 58796,\n 63434: 58797,\n 63435: 58798,\n 63436: 58799,\n 63437: 58800,\n 63438: 58801,\n 63439: 58802,\n 63440: 58803,\n 63441: 58804,\n 63442: 58805,\n 63443: 58806,\n 63444: 58807,\n 63445: 58808,\n 63446: 58809,\n 63447: 58810,\n 63448: 58811,\n 63449: 58812,\n 63450: 58813,\n 63451: 58814,\n 63452: 58815,\n 63453: 58816,\n 63454: 58817,\n 63455: 58818,\n 63456: 58819,\n 63457: 58820,\n 63458: 58821,\n 63459: 58822,\n 63460: 58823,\n 63461: 58824,\n 63462: 58825,\n 63463: 58826,\n 63464: 58827,\n 63465: 58828,\n 63466: 58829,\n 63467: 58830,\n 63468: 58831,\n 63469: 58832,\n 63470: 58833,\n 63471: 58834,\n 63472: 58835,\n 63473: 58836,\n 63474: 58837,\n 63475: 58838,\n 63476: 58839,\n 63477: 58840,\n 63478: 58841,\n 63479: 58842,\n 63480: 58843,\n 63481: 58844,\n 63482: 58845,\n 63483: 58846,\n 63484: 58847,\n 63552: 58848,\n 63553: 58849,\n 63554: 58850,\n 63555: 58851,\n 63556: 58852,\n 63557: 58853,\n 63558: 58854,\n 63559: 58855,\n 63560: 58856,\n 63561: 58857,\n 63562: 58858,\n 63563: 58859,\n 63564: 58860,\n 63565: 58861,\n 63566: 58862,\n 63567: 58863,\n 63568: 58864,\n 63569: 58865,\n 63570: 58866,\n 63571: 58867,\n 63572: 58868,\n 63573: 58869,\n 63574: 58870,\n 63575: 58871,\n 63576: 58872,\n 63577: 58873,\n 63578: 58874,\n 63579: 58875,\n 63580: 58876,\n 63581: 58877,\n 63582: 58878,\n 63583: 58879,\n 63584: 58880,\n 63585: 58881,\n 63586: 58882,\n 63587: 58883,\n 63588: 58884,\n 63589: 58885,\n 63590: 58886,\n 63591: 58887,\n 63592: 58888,\n 63593: 58889,\n 63594: 58890,\n 63595: 58891,\n 63596: 58892,\n 63597: 58893,\n 63598: 58894,\n 63599: 58895,\n 63600: 58896,\n 63601: 58897,\n 63602: 58898,\n 63603: 58899,\n 63604: 58900,\n 63605: 58901,\n 63606: 58902,\n 63607: 58903,\n 63608: 58904,\n 63609: 58905,\n 63610: 58906,\n 63611: 58907,\n 63612: 58908,\n 63613: 58909,\n 63614: 58910,\n 63616: 58911,\n 63617: 58912,\n 63618: 58913,\n 63619: 58914,\n 63620: 58915,\n 63621: 58916,\n 63622: 58917,\n 63623: 58918,\n 63624: 58919,\n 63625: 58920,\n 63626: 58921,\n 63627: 58922,\n 63628: 58923,\n 63629: 58924,\n 63630: 58925,\n 63631: 58926,\n 63632: 58927,\n 63633: 58928,\n 63634: 58929,\n 63635: 58930,\n 63636: 58931,\n 63637: 58932,\n 63638: 58933,\n 63639: 58934,\n 63640: 58935,\n 63641: 58936,\n 63642: 58937,\n 63643: 58938,\n 63644: 58939,\n 63645: 58940,\n 63646: 58941,\n 63647: 58942,\n 63648: 58943,\n 63649: 58944,\n 63650: 58945,\n 63651: 58946,\n 63652: 58947,\n 63653: 58948,\n 63654: 58949,\n 63655: 58950,\n 63656: 58951,\n 63657: 58952,\n 63658: 58953,\n 63659: 58954,\n 63660: 58955,\n 63661: 58956,\n 63662: 58957,\n 63663: 58958,\n 63664: 58959,\n 63665: 58960,\n 63666: 58961,\n 63667: 58962,\n 63668: 58963,\n 63669: 58964,\n 63670: 58965,\n 63671: 58966,\n 63672: 58967,\n 63673: 58968,\n 63674: 58969,\n 63675: 58970,\n 63676: 58971,\n 63677: 58972,\n 63678: 58973,\n 63679: 58974,\n 63680: 58975,\n 63681: 58976,\n 63682: 58977,\n 63683: 58978,\n 63684: 58979,\n 63685: 58980,\n 63686: 58981,\n 63687: 58982,\n 63688: 58983,\n 63689: 58984,\n 63690: 58985,\n 63691: 58986,\n 63692: 58987,\n 63693: 58988,\n 63694: 58989,\n 63695: 58990,\n 63696: 58991,\n 63697: 58992,\n 63698: 58993,\n 63699: 58994,\n 63700: 58995,\n 63701: 58996,\n 63702: 58997,\n 63703: 58998,\n 63704: 58999,\n 63705: 59000,\n 63706: 59001,\n 63707: 59002,\n 63708: 59003,\n 63709: 59004,\n 63710: 59005,\n 63711: 59006,\n 63712: 59007,\n 63713: 59008,\n 63714: 59009,\n 63715: 59010,\n 63716: 59011,\n 63717: 59012,\n 63718: 59013,\n 63719: 59014,\n 63720: 59015,\n 63721: 59016,\n 63722: 59017,\n 63723: 59018,\n 63724: 59019,\n 63725: 59020,\n 63726: 59021,\n 63727: 59022,\n 63728: 59023,\n 63729: 59024,\n 63730: 59025,\n 63731: 59026,\n 63732: 59027,\n 63733: 59028,\n 63734: 59029,\n 63735: 59030,\n 63736: 59031,\n 63737: 59032,\n 63738: 59033,\n 63739: 59034,\n 63740: 59035,\n 64064: 8560,\n 64065: 8561,\n 64066: 8562,\n 64067: 8563,\n 64068: 8564,\n 64069: 8565,\n 64070: 8566,\n 64071: 8567,\n 64072: 8568,\n 64073: 8569,\n 64074: 8544,\n 64075: 8545,\n 64076: 8546,\n 64077: 8547,\n 64078: 8548,\n 64079: 8549,\n 64080: 8550,\n 64081: 8551,\n 64082: 8552,\n 64083: 8553,\n 64084: 65506,\n 64085: 65508,\n 64086: 65287,\n 64087: 65282,\n 64088: 12849,\n 64089: 8470,\n 64090: 8481,\n 64091: 8757,\n 64092: 32394,\n 64093: 35100,\n 64094: 37704,\n 64095: 37512,\n 64096: 34012,\n 64097: 20425,\n 64098: 28859,\n 64099: 26161,\n 64100: 26824,\n 64101: 37625,\n 64102: 26363,\n 64103: 24389,\n 64104: 20008,\n 64105: 20193,\n 64106: 20220,\n 64107: 20224,\n 64108: 20227,\n 64109: 20281,\n 64110: 20310,\n 64111: 20370,\n 64112: 20362,\n 64113: 20378,\n 64114: 20372,\n 64115: 20429,\n 64116: 20544,\n 64117: 20514,\n 64118: 20479,\n 64119: 20510,\n 64120: 20550,\n 64121: 20592,\n 64122: 20546,\n 64123: 20628,\n 64124: 20724,\n 64125: 20696,\n 64126: 20810,\n 64128: 20836,\n 64129: 20893,\n 64130: 20926,\n 64131: 20972,\n 64132: 21013,\n 64133: 21148,\n 64134: 21158,\n 64135: 21184,\n 64136: 21211,\n 64137: 21248,\n 64138: 21255,\n 64139: 21284,\n 64140: 21362,\n 64141: 21395,\n 64142: 21426,\n 64143: 21469,\n 64144: 64014,\n 64145: 21660,\n 64146: 21642,\n 64147: 21673,\n 64148: 21759,\n 64149: 21894,\n 64150: 22361,\n 64151: 22373,\n 64152: 22444,\n 64153: 22472,\n 64154: 22471,\n 64155: 64015,\n 64156: 64016,\n 64157: 22686,\n 64158: 22706,\n 64159: 22795,\n 64160: 22867,\n 64161: 22875,\n 64162: 22877,\n 64163: 22883,\n 64164: 22948,\n 64165: 22970,\n 64166: 23382,\n 64167: 23488,\n 64168: 29999,\n 64169: 23512,\n 64170: 23532,\n 64171: 23582,\n 64172: 23718,\n 64173: 23738,\n 64174: 23797,\n 64175: 23847,\n 64176: 23891,\n 64177: 64017,\n 64178: 23874,\n 64179: 23917,\n 64180: 23992,\n 64181: 23993,\n 64182: 24016,\n 64183: 24353,\n 64184: 24372,\n 64185: 24423,\n 64186: 24503,\n 64187: 24542,\n 64188: 24669,\n 64189: 24709,\n 64190: 24714,\n 64191: 24798,\n 64192: 24789,\n 64193: 24864,\n 64194: 24818,\n 64195: 24849,\n 64196: 24887,\n 64197: 24880,\n 64198: 24984,\n 64199: 25107,\n 64200: 25254,\n 64201: 25589,\n 64202: 25696,\n 64203: 25757,\n 64204: 25806,\n 64205: 25934,\n 64206: 26112,\n 64207: 26133,\n 64208: 26171,\n 64209: 26121,\n 64210: 26158,\n 64211: 26142,\n 64212: 26148,\n 64213: 26213,\n 64214: 26199,\n 64215: 26201,\n 64216: 64018,\n 64217: 26227,\n 64218: 26265,\n 64219: 26272,\n 64220: 26290,\n 64221: 26303,\n 64222: 26362,\n 64223: 26382,\n 64224: 63785,\n 64225: 26470,\n 64226: 26555,\n 64227: 26706,\n 64228: 26560,\n 64229: 26625,\n 64230: 26692,\n 64231: 26831,\n 64232: 64019,\n 64233: 26984,\n 64234: 64020,\n 64235: 27032,\n 64236: 27106,\n 64237: 27184,\n 64238: 27243,\n 64239: 27206,\n 64240: 27251,\n 64241: 27262,\n 64242: 27362,\n 64243: 27364,\n 64244: 27606,\n 64245: 27711,\n 64246: 27740,\n 64247: 27782,\n 64248: 27759,\n 64249: 27866,\n 64250: 27908,\n 64251: 28039,\n 64252: 28015,\n 64320: 28054,\n 64321: 28076,\n 64322: 28111,\n 64323: 28152,\n 64324: 28146,\n 64325: 28156,\n 64326: 28217,\n 64327: 28252,\n 64328: 28199,\n 64329: 28220,\n 64330: 28351,\n 64331: 28552,\n 64332: 28597,\n 64333: 28661,\n 64334: 28677,\n 64335: 28679,\n 64336: 28712,\n 64337: 28805,\n 64338: 28843,\n 64339: 28943,\n 64340: 28932,\n 64341: 29020,\n 64342: 28998,\n 64343: 28999,\n 64344: 64021,\n 64345: 29121,\n 64346: 29182,\n 64347: 29361,\n 64348: 29374,\n 64349: 29476,\n 64350: 64022,\n 64351: 29559,\n 64352: 29629,\n 64353: 29641,\n 64354: 29654,\n 64355: 29667,\n 64356: 29650,\n 64357: 29703,\n 64358: 29685,\n 64359: 29734,\n 64360: 29738,\n 64361: 29737,\n 64362: 29742,\n 64363: 29794,\n 64364: 29833,\n 64365: 29855,\n 64366: 29953,\n 64367: 30063,\n 64368: 30338,\n 64369: 30364,\n 64370: 30366,\n 64371: 30363,\n 64372: 30374,\n 64373: 64023,\n 64374: 30534,\n 64375: 21167,\n 64376: 30753,\n 64377: 30798,\n 64378: 30820,\n 64379: 30842,\n 64380: 31024,\n 64381: 64024,\n 64382: 64025,\n 64384: 64026,\n 64385: 31124,\n 64386: 64027,\n 64387: 31131,\n 64388: 31441,\n 64389: 31463,\n 64390: 64028,\n 64391: 31467,\n 64392: 31646,\n 64393: 64029,\n 64394: 32072,\n 64395: 32092,\n 64396: 32183,\n 64397: 32160,\n 64398: 32214,\n 64399: 32338,\n 64400: 32583,\n 64401: 32673,\n 64402: 64030,\n 64403: 33537,\n 64404: 33634,\n 64405: 33663,\n 64406: 33735,\n 64407: 33782,\n 64408: 33864,\n 64409: 33972,\n 64410: 34131,\n 64411: 34137,\n 64412: 34155,\n 64413: 64031,\n 64414: 34224,\n 64415: 64032,\n 64416: 64033,\n 64417: 34823,\n 64418: 35061,\n 64419: 35346,\n 64420: 35383,\n 64421: 35449,\n 64422: 35495,\n 64423: 35518,\n 64424: 35551,\n 64425: 64034,\n 64426: 35574,\n 64427: 35667,\n 64428: 35711,\n 64429: 36080,\n 64430: 36084,\n 64431: 36114,\n 64432: 36214,\n 64433: 64035,\n 64434: 36559,\n 64435: 64036,\n 64436: 64037,\n 64437: 36967,\n 64438: 37086,\n 64439: 64038,\n 64440: 37141,\n 64441: 37159,\n 64442: 37338,\n 64443: 37335,\n 64444: 37342,\n 64445: 37357,\n 64446: 37358,\n 64447: 37348,\n 64448: 37349,\n 64449: 37382,\n 64450: 37392,\n 64451: 37386,\n 64452: 37434,\n 64453: 37440,\n 64454: 37436,\n 64455: 37454,\n 64456: 37465,\n 64457: 37457,\n 64458: 37433,\n 64459: 37479,\n 64460: 37543,\n 64461: 37495,\n 64462: 37496,\n 64463: 37607,\n 64464: 37591,\n 64465: 37593,\n 64466: 37584,\n 64467: 64039,\n 64468: 37589,\n 64469: 37600,\n 64470: 37587,\n 64471: 37669,\n 64472: 37665,\n 64473: 37627,\n 64474: 64040,\n 64475: 37662,\n 64476: 37631,\n 64477: 37661,\n 64478: 37634,\n 64479: 37744,\n 64480: 37719,\n 64481: 37796,\n 64482: 37830,\n 64483: 37854,\n 64484: 37880,\n 64485: 37937,\n 64486: 37957,\n 64487: 37960,\n 64488: 38290,\n 64489: 63964,\n 64490: 64041,\n 64491: 38557,\n 64492: 38575,\n 64493: 38707,\n 64494: 38715,\n 64495: 38723,\n 64496: 38733,\n 64497: 38735,\n 64498: 38737,\n 64499: 38741,\n 64500: 38999,\n 64501: 39013,\n 64502: 64042,\n 64503: 64043,\n 64504: 39207,\n 64505: 64044,\n 64506: 39326,\n 64507: 39502,\n 64508: 39641,\n 64576: 39644,\n 64577: 39797,\n 64578: 39794,\n 64579: 39823,\n 64580: 39857,\n 64581: 39867,\n 64582: 39936,\n 64583: 40304,\n 64584: 40299,\n 64585: 64045,\n 64586: 40473,\n 64587: 40657,\n }\n }\n\n /*\n * Converts from Shift_JIS Uint8Array data to Unicode strings.\n */\n s2u(uint8Array) {\n var t = this.s2uTable\n var str = ''\n var p = 0\n\n while (p < uint8Array.length) {\n var key = uint8Array[p++]\n\n if (!((key >= 0x00 && key <= 0x7e) || (key >= 0xa1 && key <= 0xdf)) && p < uint8Array.length) {\n key = (key << 8) | uint8Array[p++]\n }\n\n if (t[key] === undefined) {\n console.error('unknown char code ' + key + '.')\n return str\n }\n\n str += String.fromCharCode(t[key])\n }\n\n return str\n }\n}\n\n/**\n * @author takahiro / https://github.com/takahirox\n */\n\nclass DataViewEx {\n constructor(buffer, littleEndian) {\n this.dv = new DataView(buffer)\n this.offset = 0\n this.littleEndian = littleEndian !== undefined ? littleEndian : true\n this.encoder = new CharsetEncoder()\n }\n getInt8() {\n var value = this.dv.getInt8(this.offset)\n this.offset += 1\n return value\n }\n getInt8Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getInt8())\n }\n\n return a\n }\n getUint8() {\n var value = this.dv.getUint8(this.offset)\n this.offset += 1\n return value\n }\n getUint8Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getUint8())\n }\n\n return a\n }\n getInt16() {\n var value = this.dv.getInt16(this.offset, this.littleEndian)\n this.offset += 2\n return value\n }\n getInt16Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getInt16())\n }\n\n return a\n }\n getUint16() {\n var value = this.dv.getUint16(this.offset, this.littleEndian)\n this.offset += 2\n return value\n }\n getUint16Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getUint16())\n }\n\n return a\n }\n getInt32() {\n var value = this.dv.getInt32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n getInt32Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getInt32())\n }\n\n return a\n }\n getUint32() {\n var value = this.dv.getUint32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n getUint32Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getUint32())\n }\n\n return a\n }\n getFloat32() {\n var value = this.dv.getFloat32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n getFloat32Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getFloat32())\n }\n\n return a\n }\n getFloat64() {\n var value = this.dv.getFloat64(this.offset, this.littleEndian)\n this.offset += 8\n return value\n }\n getFloat64Array(size) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getFloat64())\n }\n\n return a\n }\n getIndex(type, isUnsigned) {\n switch (type) {\n case 1:\n return isUnsigned === true ? this.getUint8() : this.getInt8()\n\n case 2:\n return isUnsigned === true ? this.getUint16() : this.getInt16()\n\n case 4:\n return this.getInt32() // No Uint32\n\n default:\n throw 'unknown number type ' + type + ' exception.'\n }\n }\n getIndexArray(type, size, isUnsigned) {\n var a = []\n\n for (var i = 0; i < size; i++) {\n a.push(this.getIndex(type, isUnsigned))\n }\n\n return a\n }\n getChars(size) {\n var str = ''\n\n while (size > 0) {\n var value = this.getUint8()\n size--\n\n if (value === 0) {\n break\n }\n\n str += String.fromCharCode(value)\n }\n\n while (size > 0) {\n this.getUint8()\n size--\n }\n\n return str\n }\n getSjisStringsAsUnicode(size) {\n var a = []\n\n while (size > 0) {\n var value = this.getUint8()\n size--\n\n if (value === 0) {\n break\n }\n\n a.push(value)\n }\n\n while (size > 0) {\n this.getUint8()\n size--\n }\n\n return this.encoder.s2u(new Uint8Array(a))\n }\n getUnicodeStrings(size) {\n var str = ''\n\n while (size > 0) {\n var value = this.getUint16()\n size -= 2\n\n if (value === 0) {\n break\n }\n\n str += String.fromCharCode(value)\n }\n\n while (size > 0) {\n this.getUint8()\n size--\n }\n\n return str\n }\n getTextBuffer() {\n var size = this.getUint32()\n return this.getUnicodeStrings(size)\n }\n}\n\n\n/**\n * @author takahiro / https://github.com/takahirox\n */\n\nclass DataCreationHelper {\n leftToRightVector3(v) {\n v[2] = -v[2]\n }\n\n leftToRightQuaternion(q) {\n q[0] = -q[0]\n q[1] = -q[1]\n }\n\n leftToRightEuler(r) {\n r[0] = -r[0]\n r[1] = -r[1]\n }\n\n leftToRightIndexOrder(p) {\n var tmp = p[2]\n p[2] = p[0]\n p[0] = tmp\n }\n\n leftToRightVector3Range(v1, v2) {\n var tmp = -v2[2]\n v2[2] = -v1[2]\n v1[2] = tmp\n }\n\n leftToRightEulerRange(r1, r2) {\n var tmp1 = -r2[0]\n var tmp2 = -r2[1]\n r2[0] = -r1[0]\n r2[1] = -r1[1]\n r1[0] = tmp1\n r1[1] = tmp2\n }\n}\n\n/**\n * @author takahiro / https://github.com/takahirox\n */\n\nclass Parser {\n constructor() { }\n parsePmd(buffer, leftToRight) {\n var pmd = {}\n var dv = new DataViewEx(buffer)\n\n pmd.metadata = {}\n pmd.metadata.format = 'pmd'\n pmd.metadata.coordinateSystem = 'left'\n\n var parseHeader = function () {\n var metadata = pmd.metadata\n metadata.magic = dv.getChars(3)\n\n if (metadata.magic !== 'Pmd') {\n throw 'PMD file magic is not Pmd, but ' + metadata.magic\n }\n\n metadata.version = dv.getFloat32()\n metadata.modelName = dv.getSjisStringsAsUnicode(20)\n metadata.comment = dv.getSjisStringsAsUnicode(256)\n }\n\n var parseVertices = function () {\n var parseVertex = function () {\n var p = {}\n p.position = dv.getFloat32Array(3)\n p.normal = dv.getFloat32Array(3)\n p.uv = dv.getFloat32Array(2)\n p.skinIndices = dv.getUint16Array(2)\n p.skinWeights = [dv.getUint8() / 100]\n p.skinWeights.push(1.0 - p.skinWeights[0])\n p.edgeFlag = dv.getUint8()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.vertexCount = dv.getUint32()\n\n pmd.vertices = []\n\n for (var i = 0; i < metadata.vertexCount; i++) {\n pmd.vertices.push(parseVertex())\n }\n }\n\n var parseFaces = function () {\n var parseFace = function () {\n var p = {}\n p.indices = dv.getUint16Array(3)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.faceCount = dv.getUint32() / 3\n\n pmd.faces = []\n\n for (var i = 0; i < metadata.faceCount; i++) {\n pmd.faces.push(parseFace())\n }\n }\n\n var parseMaterials = function () {\n var parseMaterial = function () {\n var p = {}\n p.diffuse = dv.getFloat32Array(4)\n p.shininess = dv.getFloat32()\n p.specular = dv.getFloat32Array(3)\n p.ambient = dv.getFloat32Array(3)\n p.toonIndex = dv.getInt8()\n p.edgeFlag = dv.getUint8()\n p.faceCount = dv.getUint32() / 3\n p.fileName = dv.getSjisStringsAsUnicode(20)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.materialCount = dv.getUint32()\n\n pmd.materials = []\n\n for (var i = 0; i < metadata.materialCount; i++) {\n pmd.materials.push(parseMaterial())\n }\n }\n\n var parseBones = function () {\n var parseBone = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.parentIndex = dv.getInt16()\n p.tailIndex = dv.getInt16()\n p.type = dv.getUint8()\n p.ikIndex = dv.getInt16()\n p.position = dv.getFloat32Array(3)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.boneCount = dv.getUint16()\n\n pmd.bones = []\n\n for (var i = 0; i < metadata.boneCount; i++) {\n pmd.bones.push(parseBone())\n }\n }\n\n var parseIks = function () {\n var parseIk = function () {\n var p = {}\n p.target = dv.getUint16()\n p.effector = dv.getUint16()\n p.linkCount = dv.getUint8()\n p.iteration = dv.getUint16()\n p.maxAngle = dv.getFloat32()\n\n p.links = []\n for (var i = 0; i < p.linkCount; i++) {\n var link = {}\n link.index = dv.getUint16()\n p.links.push(link)\n }\n\n return p\n }\n\n var metadata = pmd.metadata\n metadata.ikCount = dv.getUint16()\n\n pmd.iks = []\n\n for (var i = 0; i < metadata.ikCount; i++) {\n pmd.iks.push(parseIk())\n }\n }\n\n var parseMorphs = function () {\n var parseMorph = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.elementCount = dv.getUint32()\n p.type = dv.getUint8()\n\n p.elements = []\n for (var i = 0; i < p.elementCount; i++) {\n p.elements.push({\n index: dv.getUint32(),\n position: dv.getFloat32Array(3),\n })\n }\n\n return p\n }\n\n var metadata = pmd.metadata\n metadata.morphCount = dv.getUint16()\n\n pmd.morphs = []\n\n for (var i = 0; i < metadata.morphCount; i++) {\n pmd.morphs.push(parseMorph())\n }\n }\n\n var parseMorphFrames = function () {\n var parseMorphFrame = function () {\n var p = {}\n p.index = dv.getUint16()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.morphFrameCount = dv.getUint8()\n\n pmd.morphFrames = []\n\n for (var i = 0; i < metadata.morphFrameCount; i++) {\n pmd.morphFrames.push(parseMorphFrame())\n }\n }\n\n var parseBoneFrameNames = function () {\n var parseBoneFrameName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(50)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.boneFrameNameCount = dv.getUint8()\n\n pmd.boneFrameNames = []\n\n for (var i = 0; i < metadata.boneFrameNameCount; i++) {\n pmd.boneFrameNames.push(parseBoneFrameName())\n }\n }\n\n var parseBoneFrames = function () {\n var parseBoneFrame = function () {\n var p = {}\n p.boneIndex = dv.getInt16()\n p.frameIndex = dv.getUint8()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.boneFrameCount = dv.getUint32()\n\n pmd.boneFrames = []\n\n for (var i = 0; i < metadata.boneFrameCount; i++) {\n pmd.boneFrames.push(parseBoneFrame())\n }\n }\n\n var parseEnglishHeader = function () {\n var metadata = pmd.metadata\n metadata.englishCompatibility = dv.getUint8()\n\n if (metadata.englishCompatibility > 0) {\n metadata.englishModelName = dv.getSjisStringsAsUnicode(20)\n metadata.englishComment = dv.getSjisStringsAsUnicode(256)\n }\n }\n\n var parseEnglishBoneNames = function () {\n var parseEnglishBoneName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n return p\n }\n\n var metadata = pmd.metadata\n\n if (metadata.englishCompatibility === 0) {\n return\n }\n\n pmd.englishBoneNames = []\n\n for (var i = 0; i < metadata.boneCount; i++) {\n pmd.englishBoneNames.push(parseEnglishBoneName())\n }\n }\n\n var parseEnglishMorphNames = function () {\n var parseEnglishMorphName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n return p\n }\n\n var metadata = pmd.metadata\n\n if (metadata.englishCompatibility === 0) {\n return\n }\n\n pmd.englishMorphNames = []\n\n for (var i = 0; i < metadata.morphCount - 1; i++) {\n pmd.englishMorphNames.push(parseEnglishMorphName())\n }\n }\n\n var parseEnglishBoneFrameNames = function () {\n var parseEnglishBoneFrameName = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(50)\n return p\n }\n\n var metadata = pmd.metadata\n\n if (metadata.englishCompatibility === 0) {\n return\n }\n\n pmd.englishBoneFrameNames = []\n\n for (var i = 0; i < metadata.boneFrameNameCount; i++) {\n pmd.englishBoneFrameNames.push(parseEnglishBoneFrameName())\n }\n }\n\n var parseToonTextures = function () {\n var parseToonTexture = function () {\n var p = {}\n p.fileName = dv.getSjisStringsAsUnicode(100)\n return p\n }\n\n pmd.toonTextures = []\n\n for (var i = 0; i < 10; i++) {\n pmd.toonTextures.push(parseToonTexture())\n }\n }\n\n var parseRigidBodies = function () {\n var parseRigidBody = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.boneIndex = dv.getInt16()\n p.groupIndex = dv.getUint8()\n p.groupTarget = dv.getUint16()\n p.shapeType = dv.getUint8()\n p.width = dv.getFloat32()\n p.height = dv.getFloat32()\n p.depth = dv.getFloat32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.weight = dv.getFloat32()\n p.positionDamping = dv.getFloat32()\n p.rotationDamping = dv.getFloat32()\n p.restitution = dv.getFloat32()\n p.friction = dv.getFloat32()\n p.type = dv.getUint8()\n return p\n }\n\n var metadata = pmd.metadata\n metadata.rigidBodyCount = dv.getUint32()\n\n pmd.rigidBodies = []\n\n for (var i = 0; i < metadata.rigidBodyCount; i++) {\n pmd.rigidBodies.push(parseRigidBody())\n }\n }\n\n var parseConstraints = function () {\n var parseConstraint = function () {\n var p = {}\n p.name = dv.getSjisStringsAsUnicode(20)\n p.rigidBodyIndex1 = dv.getUint32()\n p.rigidBodyIndex2 = dv.getUint32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.translationLimitation1 = dv.getFloat32Array(3)\n p.translationLimitation2 = dv.getFloat32Array(3)\n p.rotationLimitation1 = dv.getFloat32Array(3)\n p.rotationLimitation2 = dv.getFloat32Array(3)\n p.springPosition = dv.getFloat32Array(3)\n p.springRotation = dv.getFloat32Array(3)\n return p\n }\n\n var metadata = pmd.metadata\n metadata.constraintCount = dv.getUint32()\n\n pmd.constraints = []\n\n for (var i = 0; i < metadata.constraintCount; i++) {\n pmd.constraints.push(parseConstraint())\n }\n }\n\n parseHeader()\n parseVertices()\n parseFaces()\n parseMaterials()\n parseBones()\n parseIks()\n parseMorphs()\n parseMorphFrames()\n parseBoneFrameNames()\n parseBoneFrames()\n parseEnglishHeader()\n parseEnglishBoneNames()\n parseEnglishMorphNames()\n parseEnglishBoneFrameNames()\n parseToonTextures()\n parseRigidBodies()\n parseConstraints()\n\n if (leftToRight === true) this.leftToRightModel(pmd)\n\n // console.log( pmd ); // for console debug\n return pmd\n }\n parsePmx(buffer, leftToRight) {\n var pmx = {}\n var dv = new DataViewEx(buffer)\n\n pmx.metadata = {}\n pmx.metadata.format = 'pmx'\n pmx.metadata.coordinateSystem = 'left'\n\n var parseHeader = function () {\n var metadata = pmx.metadata\n metadata.magic = dv.getChars(4)\n\n // Note: don't remove the last blank space.\n if (metadata.magic !== 'PMX ') {\n throw 'PMX file magic is not PMX , but ' + metadata.magic\n }\n\n metadata.version = dv.getFloat32()\n\n if (metadata.version !== 2.0 && metadata.version !== 2.1) {\n throw 'PMX version ' + metadata.version + ' is not supported.'\n }\n\n metadata.headerSize = dv.getUint8()\n metadata.encoding = dv.getUint8()\n metadata.additionalUvNum = dv.getUint8()\n metadata.vertexIndexSize = dv.getUint8()\n metadata.textureIndexSize = dv.getUint8()\n metadata.materialIndexSize = dv.getUint8()\n metadata.boneIndexSize = dv.getUint8()\n metadata.morphIndexSize = dv.getUint8()\n metadata.rigidBodyIndexSize = dv.getUint8()\n metadata.modelName = dv.getTextBuffer()\n metadata.englishModelName = dv.getTextBuffer()\n metadata.comment = dv.getTextBuffer()\n metadata.englishComment = dv.getTextBuffer()\n }\n\n var parseVertices = function () {\n var parseVertex = function () {\n var p = {}\n p.position = dv.getFloat32Array(3)\n p.normal = dv.getFloat32Array(3)\n p.uv = dv.getFloat32Array(2)\n\n p.auvs = []\n\n for (var i = 0; i < pmx.metadata.additionalUvNum; i++) {\n p.auvs.push(dv.getFloat32Array(4))\n }\n\n p.type = dv.getUint8()\n\n var indexSize = metadata.boneIndexSize\n\n if (p.type === 0) {\n // BDEF1\n p.skinIndices = dv.getIndexArray(indexSize, 1)\n p.skinWeights = [1.0]\n } else if (p.type === 1) {\n // BDEF2\n p.skinIndices = dv.getIndexArray(indexSize, 2)\n p.skinWeights = dv.getFloat32Array(1)\n p.skinWeights.push(1.0 - p.skinWeights[0])\n } else if (p.type === 2) {\n // BDEF4\n p.skinIndices = dv.getIndexArray(indexSize, 4)\n p.skinWeights = dv.getFloat32Array(4)\n } else if (p.type === 3) {\n // SDEF\n p.skinIndices = dv.getIndexArray(indexSize, 2)\n p.skinWeights = dv.getFloat32Array(1)\n p.skinWeights.push(1.0 - p.skinWeights[0])\n\n p.skinC = dv.getFloat32Array(3)\n p.skinR0 = dv.getFloat32Array(3)\n p.skinR1 = dv.getFloat32Array(3)\n\n // SDEF is not supported yet and is handled as BDEF2 so far.\n // TODO: SDEF support\n p.type = 1\n } else {\n throw 'unsupport bone type ' + p.type + ' exception.'\n }\n\n p.edgeRatio = dv.getFloat32()\n return p\n }\n\n var metadata = pmx.metadata\n metadata.vertexCount = dv.getUint32()\n\n pmx.vertices = []\n\n for (var i = 0; i < metadata.vertexCount; i++) {\n pmx.vertices.push(parseVertex())\n }\n }\n\n var parseFaces = function () {\n var parseFace = function () {\n var p = {}\n p.indices = dv.getIndexArray(metadata.vertexIndexSize, 3, true)\n return p\n }\n\n var metadata = pmx.metadata\n metadata.faceCount = dv.getUint32() / 3\n\n pmx.faces = []\n\n for (var i = 0; i < metadata.faceCount; i++) {\n pmx.faces.push(parseFace())\n }\n }\n\n var parseTextures = function () {\n var parseTexture = function () {\n return dv.getTextBuffer()\n }\n\n var metadata = pmx.metadata\n metadata.textureCount = dv.getUint32()\n\n pmx.textures = []\n\n for (var i = 0; i < metadata.textureCount; i++) {\n pmx.textures.push(parseTexture())\n }\n }\n\n var parseMaterials = function () {\n var parseMaterial = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.diffuse = dv.getFloat32Array(4)\n p.specular = dv.getFloat32Array(3)\n p.shininess = dv.getFloat32()\n p.ambient = dv.getFloat32Array(3)\n p.flag = dv.getUint8()\n p.edgeColor = dv.getFloat32Array(4)\n p.edgeSize = dv.getFloat32()\n p.textureIndex = dv.getIndex(pmx.metadata.textureIndexSize)\n p.envTextureIndex = dv.getIndex(pmx.metadata.textureIndexSize)\n p.envFlag = dv.getUint8()\n p.toonFlag = dv.getUint8()\n\n if (p.toonFlag === 0) {\n p.toonIndex = dv.getIndex(pmx.metadata.textureIndexSize)\n } else if (p.toonFlag === 1) {\n p.toonIndex = dv.getInt8()\n } else {\n throw 'unknown toon flag ' + p.toonFlag + ' exception.'\n }\n\n p.comment = dv.getTextBuffer()\n p.faceCount = dv.getUint32() / 3\n return p\n }\n\n var metadata = pmx.metadata\n metadata.materialCount = dv.getUint32()\n\n pmx.materials = []\n\n for (var i = 0; i < metadata.materialCount; i++) {\n pmx.materials.push(parseMaterial())\n }\n }\n\n var parseBones = function () {\n var parseBone = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.position = dv.getFloat32Array(3)\n p.parentIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n p.transformationClass = dv.getUint32()\n p.flag = dv.getUint16()\n\n if (p.flag & 0x1) {\n p.connectIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n } else {\n p.offsetPosition = dv.getFloat32Array(3)\n }\n\n if (p.flag & 0x100 || p.flag & 0x200) {\n // Note: I don't think Grant is an appropriate name\n // but I found that some English translated MMD tools use this term\n // so I've named it Grant so far.\n // I'd rename to more appropriate name from Grant later.\n var grant = {}\n\n grant.isLocal = (p.flag & 0x80) !== 0 ? true : false\n grant.affectRotation = (p.flag & 0x100) !== 0 ? true : false\n grant.affectPosition = (p.flag & 0x200) !== 0 ? true : false\n grant.parentIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n grant.ratio = dv.getFloat32()\n\n p.grant = grant\n }\n\n if (p.flag & 0x400) {\n p.fixAxis = dv.getFloat32Array(3)\n }\n\n if (p.flag & 0x800) {\n p.localXVector = dv.getFloat32Array(3)\n p.localZVector = dv.getFloat32Array(3)\n }\n\n if (p.flag & 0x2000) {\n p.key = dv.getUint32()\n }\n\n if (p.flag & 0x20) {\n var ik = {}\n\n ik.effector = dv.getIndex(pmx.metadata.boneIndexSize)\n ik.target = null\n ik.iteration = dv.getUint32()\n ik.maxAngle = dv.getFloat32()\n ik.linkCount = dv.getUint32()\n ik.links = []\n\n for (var i = 0; i < ik.linkCount; i++) {\n var link = {}\n link.index = dv.getIndex(pmx.metadata.boneIndexSize)\n link.angleLimitation = dv.getUint8()\n\n if (link.angleLimitation === 1) {\n link.lowerLimitationAngle = dv.getFloat32Array(3)\n link.upperLimitationAngle = dv.getFloat32Array(3)\n }\n\n ik.links.push(link)\n }\n\n p.ik = ik\n }\n\n return p\n }\n\n var metadata = pmx.metadata\n metadata.boneCount = dv.getUint32()\n\n pmx.bones = []\n\n for (var i = 0; i < metadata.boneCount; i++) {\n pmx.bones.push(parseBone())\n }\n }\n\n var parseMorphs = function () {\n var parseMorph = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.panel = dv.getUint8()\n p.type = dv.getUint8()\n p.elementCount = dv.getUint32()\n p.elements = []\n\n for (var i = 0; i < p.elementCount; i++) {\n if (p.type === 0) {\n // group morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.morphIndexSize)\n m.ratio = dv.getFloat32()\n p.elements.push(m)\n } else if (p.type === 1) {\n // vertex morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.vertexIndexSize, true)\n m.position = dv.getFloat32Array(3)\n p.elements.push(m)\n } else if (p.type === 2) {\n // bone morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.boneIndexSize)\n m.position = dv.getFloat32Array(3)\n m.rotation = dv.getFloat32Array(4)\n p.elements.push(m)\n } else if (p.type === 3) {\n // uv morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.vertexIndexSize, true)\n m.uv = dv.getFloat32Array(4)\n p.elements.push(m)\n } else if (p.type === 4) {\n // additional uv1\n // TODO: implement\n } else if (p.type === 5) {\n // additional uv2\n // TODO: implement\n } else if (p.type === 6) {\n // additional uv3\n // TODO: implement\n } else if (p.type === 7) {\n // additional uv4\n // TODO: implement\n } else if (p.type === 8) {\n // material morph\n var m = {}\n m.index = dv.getIndex(pmx.metadata.materialIndexSize)\n m.type = dv.getUint8()\n m.diffuse = dv.getFloat32Array(4)\n m.specular = dv.getFloat32Array(3)\n m.shininess = dv.getFloat32()\n m.ambient = dv.getFloat32Array(3)\n m.edgeColor = dv.getFloat32Array(4)\n m.edgeSize = dv.getFloat32()\n m.textureColor = dv.getFloat32Array(4)\n m.sphereTextureColor = dv.getFloat32Array(4)\n m.toonColor = dv.getFloat32Array(4)\n p.elements.push(m)\n }\n }\n\n return p\n }\n\n var metadata = pmx.metadata\n metadata.morphCount = dv.getUint32()\n\n pmx.morphs = []\n\n for (var i = 0; i < metadata.morphCount; i++) {\n pmx.morphs.push(parseMorph())\n }\n }\n\n var parseFrames = function () {\n var parseFrame = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.type = dv.getUint8()\n p.elementCount = dv.getUint32()\n p.elements = []\n\n for (var i = 0; i < p.elementCount; i++) {\n var e = {}\n e.target = dv.getUint8()\n e.index = e.target === 0 ? dv.getIndex(pmx.metadata.boneIndexSize) : dv.getIndex(pmx.metadata.morphIndexSize)\n p.elements.push(e)\n }\n\n return p\n }\n\n var metadata = pmx.metadata\n metadata.frameCount = dv.getUint32()\n\n pmx.frames = []\n\n for (var i = 0; i < metadata.frameCount; i++) {\n pmx.frames.push(parseFrame())\n }\n }\n\n var parseRigidBodies = function () {\n var parseRigidBody = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.boneIndex = dv.getIndex(pmx.metadata.boneIndexSize)\n p.groupIndex = dv.getUint8()\n p.groupTarget = dv.getUint16()\n p.shapeType = dv.getUint8()\n p.width = dv.getFloat32()\n p.height = dv.getFloat32()\n p.depth = dv.getFloat32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.weight = dv.getFloat32()\n p.positionDamping = dv.getFloat32()\n p.rotationDamping = dv.getFloat32()\n p.restitution = dv.getFloat32()\n p.friction = dv.getFloat32()\n p.type = dv.getUint8()\n return p\n }\n\n var metadata = pmx.metadata\n metadata.rigidBodyCount = dv.getUint32()\n\n pmx.rigidBodies = []\n\n for (var i = 0; i < metadata.rigidBodyCount; i++) {\n pmx.rigidBodies.push(parseRigidBody())\n }\n }\n\n var parseConstraints = function () {\n var parseConstraint = function () {\n var p = {}\n p.name = dv.getTextBuffer()\n p.englishName = dv.getTextBuffer()\n p.type = dv.getUint8()\n p.rigidBodyIndex1 = dv.getIndex(pmx.metadata.rigidBodyIndexSize)\n p.rigidBodyIndex2 = dv.getIndex(pmx.metadata.rigidBodyIndexSize)\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.translationLimitation1 = dv.getFloat32Array(3)\n p.translationLimitation2 = dv.getFloat32Array(3)\n p.rotationLimitation1 = dv.getFloat32Array(3)\n p.rotationLimitation2 = dv.getFloat32Array(3)\n p.springPosition = dv.getFloat32Array(3)\n p.springRotation = dv.getFloat32Array(3)\n return p\n }\n\n var metadata = pmx.metadata\n metadata.constraintCount = dv.getUint32()\n\n pmx.constraints = []\n\n for (var i = 0; i < metadata.constraintCount; i++) {\n pmx.constraints.push(parseConstraint())\n }\n }\n\n parseHeader()\n parseVertices()\n parseFaces()\n parseTextures()\n parseMaterials()\n parseBones()\n parseMorphs()\n parseFrames()\n parseRigidBodies()\n parseConstraints()\n\n if (leftToRight === true) this.leftToRightModel(pmx)\n\n // console.log( pmx ); // for console debug\n return pmx\n }\n parseVmd(buffer, leftToRight) {\n var vmd = {}\n var dv = new DataViewEx(buffer)\n\n vmd.metadata = {}\n vmd.metadata.coordinateSystem = 'left'\n\n var parseHeader = function () {\n var metadata = vmd.metadata\n metadata.magic = dv.getChars(30)\n\n if (metadata.magic !== 'Vocaloid Motion Data 0002') {\n throw 'VMD file magic is not Vocaloid Motion Data 0002, but ' + metadata.magic\n }\n\n metadata.name = dv.getSjisStringsAsUnicode(20)\n }\n\n var parseMotions = function () {\n var parseMotion = function () {\n var p = {}\n p.boneName = dv.getSjisStringsAsUnicode(15)\n p.frameNum = dv.getUint32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(4)\n p.interpolation = dv.getUint8Array(64)\n return p\n }\n\n var metadata = vmd.metadata\n metadata.motionCount = dv.getUint32()\n\n vmd.motions = []\n for (var i = 0; i < metadata.motionCount; i++) {\n vmd.motions.push(parseMotion())\n }\n }\n\n var parseMorphs = function () {\n var parseMorph = function () {\n var p = {}\n p.morphName = dv.getSjisStringsAsUnicode(15)\n p.frameNum = dv.getUint32()\n p.weight = dv.getFloat32()\n return p\n }\n\n var metadata = vmd.metadata\n metadata.morphCount = dv.getUint32()\n\n vmd.morphs = []\n for (var i = 0; i < metadata.morphCount; i++) {\n vmd.morphs.push(parseMorph())\n }\n }\n\n var parseCameras = function () {\n var parseCamera = function () {\n var p = {}\n p.frameNum = dv.getUint32()\n p.distance = dv.getFloat32()\n p.position = dv.getFloat32Array(3)\n p.rotation = dv.getFloat32Array(3)\n p.interpolation = dv.getUint8Array(24)\n p.fov = dv.getUint32()\n p.perspective = dv.getUint8()\n return p\n }\n\n var metadata = vmd.metadata\n metadata.cameraCount = dv.getUint32()\n\n vmd.cameras = []\n for (var i = 0; i < metadata.cameraCount; i++) {\n vmd.cameras.push(parseCamera())\n }\n }\n\n parseHeader()\n parseMotions()\n parseMorphs()\n parseCameras()\n\n if (leftToRight === true) this.leftToRightVmd(vmd)\n\n // console.log( vmd ); // for console debug\n return vmd\n }\n parseVpd(text, leftToRight) {\n var vpd = {}\n\n vpd.metadata = {}\n vpd.metadata.coordinateSystem = 'left'\n\n vpd.bones = []\n\n var commentPatternG = /\\/\\/\\w*(\\r|\\n|\\r\\n)/g\n var newlinePattern = /\\r|\\n|\\r\\n/\n\n var lines = text.replace(commentPatternG, '').split(newlinePattern)\n\n function throwError() {\n throw 'the file seems not vpd file.'\n }\n\n function checkMagic() {\n if (lines[0] !== 'Vocaloid Pose Data file') {\n throwError()\n }\n }\n\n function parseHeader() {\n if (lines.length < 4) {\n throwError()\n }\n\n vpd.metadata.parentFile = lines[2]\n vpd.metadata.boneCount = parseInt(lines[3])\n }\n\n function parseBones() {\n var boneHeaderPattern = /^\\s*(Bone[0-9]+)\\s*\\{\\s*(.*)$/\n var boneVectorPattern = /^\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*;/\n var boneQuaternionPattern = /^\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*,\\s*(-?[0-9]+\\.[0-9]+)\\s*;/\n var boneFooterPattern = /^\\s*}/\n\n var bones = vpd.bones\n var n = null\n var v = null\n var q = null\n\n for (var i = 4; i < lines.length; i++) {\n var line = lines[i]\n\n var result\n\n result = line.match(boneHeaderPattern)\n\n if (result !== null) {\n if (n !== null) {\n throwError()\n }\n\n n = result[2]\n }\n\n result = line.match(boneVectorPattern)\n\n if (result !== null) {\n if (v !== null) {\n throwError()\n }\n\n v = [parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])]\n }\n\n result = line.match(boneQuaternionPattern)\n\n if (result !== null) {\n if (q !== null) {\n throwError()\n }\n\n q = [parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]), parseFloat(result[4])]\n }\n\n result = line.match(boneFooterPattern)\n\n if (result !== null) {\n if (n === null || v === null || q === null) {\n throwError()\n }\n\n bones.push({\n name: n,\n translation: v,\n quaternion: q,\n })\n\n n = null\n v = null\n q = null\n }\n }\n\n if (n !== null || v !== null || q !== null) {\n throwError()\n }\n }\n\n checkMagic()\n parseHeader()\n parseBones()\n\n if (leftToRight === true) this.leftToRightVpd(vpd)\n\n // console.log( vpd ); // for console debug\n return vpd\n }\n mergeVmds(vmds) {\n var v = {}\n v.metadata = {}\n v.metadata.name = vmds[0].metadata.name\n v.metadata.coordinateSystem = vmds[0].metadata.coordinateSystem\n v.metadata.motionCount = 0\n v.metadata.morphCount = 0\n v.metadata.cameraCount = 0\n v.motions = []\n v.morphs = []\n v.cameras = []\n\n for (var i = 0; i < vmds.length; i++) {\n var v2 = vmds[i]\n\n v.metadata.motionCount += v2.metadata.motionCount\n v.metadata.morphCount += v2.metadata.morphCount\n v.metadata.cameraCount += v2.metadata.cameraCount\n\n for (var j = 0; j < v2.metadata.motionCount; j++) {\n v.motions.push(v2.motions[j])\n }\n\n for (var j = 0; j < v2.metadata.morphCount; j++) {\n v.morphs.push(v2.morphs[j])\n }\n\n for (var j = 0; j < v2.metadata.cameraCount; j++) {\n v.cameras.push(v2.cameras[j])\n }\n }\n\n return v\n }\n leftToRightModel(model) {\n if (model.metadata.coordinateSystem === 'right') {\n return\n }\n\n model.metadata.coordinateSystem = 'right'\n\n var helper = new DataCreationHelper()\n\n for (var i = 0; i < model.metadata.vertexCount; i++) {\n helper.leftToRightVector3(model.vertices[i].position)\n helper.leftToRightVector3(model.vertices[i].normal)\n }\n\n for (var i = 0; i < model.metadata.faceCount; i++) {\n helper.leftToRightIndexOrder(model.faces[i].indices)\n }\n\n for (var i = 0; i < model.metadata.boneCount; i++) {\n helper.leftToRightVector3(model.bones[i].position)\n }\n\n // TODO: support other morph for PMX\n for (var i = 0; i < model.metadata.morphCount; i++) {\n var m = model.morphs[i]\n\n if (model.metadata.format === 'pmx' && m.type !== 1) {\n // TODO: implement\n continue\n }\n\n for (var j = 0; j < m.elements.length; j++) {\n helper.leftToRightVector3(m.elements[j].position)\n }\n }\n\n for (var i = 0; i < model.metadata.rigidBodyCount; i++) {\n helper.leftToRightVector3(model.rigidBodies[i].position)\n helper.leftToRightEuler(model.rigidBodies[i].rotation)\n }\n\n for (var i = 0; i < model.metadata.constraintCount; i++) {\n helper.leftToRightVector3(model.constraints[i].position)\n helper.leftToRightEuler(model.constraints[i].rotation)\n helper.leftToRightVector3Range(\n model.constraints[i].translationLimitation1,\n model.constraints[i].translationLimitation2\n )\n helper.leftToRightEulerRange(model.constraints[i].rotationLimitation1, model.constraints[i].rotationLimitation2)\n }\n }\n leftToRightVmd(vmd) {\n if (vmd.metadata.coordinateSystem === 'right') {\n return\n }\n\n vmd.metadata.coordinateSystem = 'right'\n\n var helper = new DataCreationHelper()\n\n for (var i = 0; i < vmd.metadata.motionCount; i++) {\n helper.leftToRightVector3(vmd.motions[i].position)\n helper.leftToRightQuaternion(vmd.motions[i].rotation)\n }\n\n for (var i = 0; i < vmd.metadata.cameraCount; i++) {\n helper.leftToRightVector3(vmd.cameras[i].position)\n helper.leftToRightEuler(vmd.cameras[i].rotation)\n }\n }\n leftToRightVpd(vpd) {\n if (vpd.metadata.coordinateSystem === 'right') {\n return\n }\n\n vpd.metadata.coordinateSystem = 'right'\n\n var helper = new DataCreationHelper()\n\n for (var i = 0; i < vpd.bones.length; i++) {\n helper.leftToRightVector3(vpd.bones[i].translation)\n helper.leftToRightQuaternion(vpd.bones[i].quaternion)\n }\n }\n}\n\nexport { CharsetEncoder, Parser }\n", "import {\n BufferAttribute,\n BufferGeometry,\n Color,\n Line,\n LineBasicMaterial,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Quaternion,\n SphereGeometry,\n Vector3,\n} from 'three'\n\nconst _q = new Quaternion()\nconst _targetPos = new Vector3()\nconst _targetVec = new Vector3()\nconst _effectorPos = new Vector3()\nconst _effectorVec = new Vector3()\nconst _linkPos = new Vector3()\nconst _invLinkQ = new Quaternion()\nconst _linkScale = new Vector3()\nconst _axis = new Vector3()\nconst _vector = new Vector3()\nconst _matrix = new Matrix4()\n\n/**\n * CCD Algorithm\n * - https://sites.google.com/site/auraliusproject/ccd-algorithm\n *\n * // ik parameter example\n * //\n * // target, effector, index in links are bone index in skeleton.bones.\n * // the bones relation should be\n * // <-- parent child -->\n * // links[ n ], links[ n - 1 ], ..., links[ 0 ], effector\n * iks = [ {\n *\ttarget: 1,\n *\teffector: 2,\n *\tlinks: [ { index: 5, limitation: new Vector3( 1, 0, 0 ) }, { index: 4, enabled: false }, { index : 3 } ],\n *\titeration: 10,\n *\tminAngle: 0.0,\n *\tmaxAngle: 1.0,\n * } ];\n */\n\nclass CCDIKSolver {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} iks\n */\n constructor(mesh, iks = []) {\n this.mesh = mesh\n this.iks = iks\n\n this._valid()\n }\n\n /**\n * Update all IK bones.\n *\n * @return {CCDIKSolver}\n */\n update() {\n const iks = this.iks\n\n for (let i = 0, il = iks.length; i < il; i++) {\n this.updateOne(iks[i])\n }\n\n return this\n }\n\n /**\n * Update one IK bone\n *\n * @param {Object} ik parameter\n * @return {CCDIKSolver}\n */\n updateOne(ik) {\n const bones = this.mesh.skeleton.bones\n\n // for reference overhead reduction in loop\n const math = Math\n\n const effector = bones[ik.effector]\n const target = bones[ik.target]\n\n // don't use getWorldPosition() here for the performance\n // because it calls updateMatrixWorld( true ) inside.\n _targetPos.setFromMatrixPosition(target.matrixWorld)\n\n const links = ik.links\n const iteration = ik.iteration !== undefined ? ik.iteration : 1\n\n for (let i = 0; i < iteration; i++) {\n let rotated = false\n\n for (let j = 0, jl = links.length; j < jl; j++) {\n const link = bones[links[j].index]\n\n // skip this link and following links.\n // this skip is used for MMD performance optimization.\n if (links[j].enabled === false) break\n\n const limitation = links[j].limitation\n const rotationMin = links[j].rotationMin\n const rotationMax = links[j].rotationMax\n\n // don't use getWorldPosition/Quaternion() here for the performance\n // because they call updateMatrixWorld( true ) inside.\n link.matrixWorld.decompose(_linkPos, _invLinkQ, _linkScale)\n _invLinkQ.invert()\n _effectorPos.setFromMatrixPosition(effector.matrixWorld)\n\n // work in link world\n _effectorVec.subVectors(_effectorPos, _linkPos)\n _effectorVec.applyQuaternion(_invLinkQ)\n _effectorVec.normalize()\n\n _targetVec.subVectors(_targetPos, _linkPos)\n _targetVec.applyQuaternion(_invLinkQ)\n _targetVec.normalize()\n\n let angle = _targetVec.dot(_effectorVec)\n\n if (angle > 1.0) {\n angle = 1.0\n } else if (angle < -1.0) {\n angle = -1.0\n }\n\n angle = math.acos(angle)\n\n // skip if changing angle is too small to prevent vibration of bone\n if (angle < 1e-5) continue\n\n if (ik.minAngle !== undefined && angle < ik.minAngle) {\n angle = ik.minAngle\n }\n\n if (ik.maxAngle !== undefined && angle > ik.maxAngle) {\n angle = ik.maxAngle\n }\n\n _axis.crossVectors(_effectorVec, _targetVec)\n _axis.normalize()\n\n _q.setFromAxisAngle(_axis, angle)\n link.quaternion.multiply(_q)\n\n // TODO: re-consider the limitation specification\n if (limitation !== undefined) {\n let c = link.quaternion.w\n\n if (c > 1.0) c = 1.0\n\n const c2 = math.sqrt(1 - c * c)\n link.quaternion.set(limitation.x * c2, limitation.y * c2, limitation.z * c2, c)\n }\n\n if (rotationMin !== undefined) {\n link.rotation.setFromVector3(_vector.setFromEuler(link.rotation).max(rotationMin))\n }\n\n if (rotationMax !== undefined) {\n link.rotation.setFromVector3(_vector.setFromEuler(link.rotation).min(rotationMax))\n }\n\n link.updateMatrixWorld(true)\n\n rotated = true\n }\n\n if (!rotated) break\n }\n\n return this\n }\n\n /**\n * Creates Helper\n *\n * @return {CCDIKHelper}\n */\n createHelper() {\n return new CCDIKHelper(this.mesh, this.iks)\n }\n\n // private methods\n\n _valid() {\n const iks = this.iks\n const bones = this.mesh.skeleton.bones\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n const effector = bones[ik.effector]\n const links = ik.links\n let link0, link1\n\n link0 = effector\n\n for (let j = 0, jl = links.length; j < jl; j++) {\n link1 = bones[links[j].index]\n\n if (link0.parent !== link1) {\n console.warn('THREE.CCDIKSolver: bone ' + link0.name + ' is not the child of bone ' + link1.name)\n }\n\n link0 = link1\n }\n }\n }\n}\n\nfunction getPosition(bone, matrixWorldInv) {\n return _vector.setFromMatrixPosition(bone.matrixWorld).applyMatrix4(matrixWorldInv)\n}\n\nfunction setPositionOfBoneToAttributeArray(array, index, bone, matrixWorldInv) {\n const v = getPosition(bone, matrixWorldInv)\n\n array[index * 3 + 0] = v.x\n array[index * 3 + 1] = v.y\n array[index * 3 + 2] = v.z\n}\n\n/**\n * Visualize IK bones\n *\n * @param {SkinnedMesh} mesh\n * @param {Array} iks\n */\nclass CCDIKHelper extends Object3D {\n constructor(mesh, iks = [], sphereSize = 0.25) {\n super()\n\n this.root = mesh\n this.iks = iks\n\n this.matrix.copy(mesh.matrixWorld)\n this.matrixAutoUpdate = false\n\n this.sphereGeometry = new SphereGeometry(sphereSize, 16, 8)\n\n this.targetSphereMaterial = new MeshBasicMaterial({\n color: new Color(0xff8888),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.effectorSphereMaterial = new MeshBasicMaterial({\n color: new Color(0x88ff88),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.linkSphereMaterial = new MeshBasicMaterial({\n color: new Color(0x8888ff),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.lineMaterial = new LineBasicMaterial({\n color: new Color(0xff0000),\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this._init()\n }\n\n /**\n * Updates IK bones visualization.\n */\n updateMatrixWorld(force) {\n const mesh = this.root\n\n if (this.visible) {\n let offset = 0\n\n const iks = this.iks\n const bones = mesh.skeleton.bones\n\n _matrix.copy(mesh.matrixWorld).invert()\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n\n const targetBone = bones[ik.target]\n const effectorBone = bones[ik.effector]\n\n const targetMesh = this.children[offset++]\n const effectorMesh = this.children[offset++]\n\n targetMesh.position.copy(getPosition(targetBone, _matrix))\n effectorMesh.position.copy(getPosition(effectorBone, _matrix))\n\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n const link = ik.links[j]\n const linkBone = bones[link.index]\n\n const linkMesh = this.children[offset++]\n\n linkMesh.position.copy(getPosition(linkBone, _matrix))\n }\n\n const line = this.children[offset++]\n const array = line.geometry.attributes.position.array\n\n setPositionOfBoneToAttributeArray(array, 0, targetBone, _matrix)\n setPositionOfBoneToAttributeArray(array, 1, effectorBone, _matrix)\n\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n const link = ik.links[j]\n const linkBone = bones[link.index]\n setPositionOfBoneToAttributeArray(array, j + 2, linkBone, _matrix)\n }\n\n line.geometry.attributes.position.needsUpdate = true\n }\n }\n\n this.matrix.copy(mesh.matrixWorld)\n\n super.updateMatrixWorld(force)\n }\n\n /**\n * Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.\n */\n dispose() {\n this.sphereGeometry.dispose()\n\n this.targetSphereMaterial.dispose()\n this.effectorSphereMaterial.dispose()\n this.linkSphereMaterial.dispose()\n this.lineMaterial.dispose()\n\n const children = this.children\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n\n if (child.isLine) child.geometry.dispose()\n }\n }\n\n // private method\n\n _init() {\n const scope = this\n const iks = this.iks\n\n function createLineGeometry(ik) {\n const geometry = new BufferGeometry()\n const vertices = new Float32Array((2 + ik.links.length) * 3)\n geometry.setAttribute('position', new BufferAttribute(vertices, 3))\n\n return geometry\n }\n\n function createTargetMesh() {\n return new Mesh(scope.sphereGeometry, scope.targetSphereMaterial)\n }\n\n function createEffectorMesh() {\n return new Mesh(scope.sphereGeometry, scope.effectorSphereMaterial)\n }\n\n function createLinkMesh() {\n return new Mesh(scope.sphereGeometry, scope.linkSphereMaterial)\n }\n\n function createLine(ik) {\n return new Line(createLineGeometry(ik), scope.lineMaterial)\n }\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n\n this.add(createTargetMesh())\n this.add(createEffectorMesh())\n\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n this.add(createLinkMesh())\n }\n\n this.add(createLine(ik))\n }\n }\n}\n\nexport { CCDIKSolver, CCDIKHelper }\n", "import {\n Bone,\n BoxGeometry,\n Color,\n Euler,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n Quaternion,\n SphereGeometry,\n Vector3,\n} from 'three'\nimport { CapsuleGeometry } from '../_polyfill/CapsuleGeometry'\n\n/**\n * Dependencies\n * - Ammo.js https://github.com/kripken/ammo.js\n *\n * MMDPhysics calculates physics with Ammo(Bullet based JavaScript Physics engine)\n * for MMD model loaded by MMDLoader.\n *\n * TODO\n * - Physics in Worker\n */\n\n/* global Ammo */\n\nclass MMDPhysics {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} rigidBodyParams\n * @param {Array} (optional) constraintParams\n * @param {Object} params - (optional)\n * @param {Number} params.unitStep - Default is 1 / 65.\n * @param {Integer} params.maxStepNum - Default is 3.\n * @param {Vector3} params.gravity - Default is ( 0, - 9.8 * 10, 0 )\n */\n constructor(mesh, rigidBodyParams, constraintParams = [], params = {}) {\n if (typeof Ammo === 'undefined') {\n throw new Error('THREE.MMDPhysics: Import ammo.js https://github.com/kripken/ammo.js')\n }\n\n this.manager = new ResourceManager()\n\n this.mesh = mesh\n\n /*\n * I don't know why but 1/60 unitStep easily breaks models\n * so I set it 1/65 so far.\n * Don't set too small unitStep because\n * the smaller unitStep can make the performance worse.\n */\n this.unitStep = params.unitStep !== undefined ? params.unitStep : 1 / 65\n this.maxStepNum = params.maxStepNum !== undefined ? params.maxStepNum : 3\n this.gravity = new Vector3(0, -9.8 * 10, 0)\n\n if (params.gravity !== undefined) this.gravity.copy(params.gravity)\n\n this.world = params.world !== undefined ? params.world : null // experimental\n\n this.bodies = []\n this.constraints = []\n\n this._init(mesh, rigidBodyParams, constraintParams)\n }\n\n /**\n * Advances Physics calculation and updates bones.\n *\n * @param {Number} delta - time in second\n * @return {MMDPhysics}\n */\n update(delta) {\n const manager = this.manager\n const mesh = this.mesh\n\n // rigid bodies and constrains are for\n // mesh's world scale (1, 1, 1).\n // Convert to (1, 1, 1) if it isn't.\n\n let isNonDefaultScale = false\n\n const position = manager.allocThreeVector3()\n const quaternion = manager.allocThreeQuaternion()\n const scale = manager.allocThreeVector3()\n\n mesh.matrixWorld.decompose(position, quaternion, scale)\n\n if (scale.x !== 1 || scale.y !== 1 || scale.z !== 1) {\n isNonDefaultScale = true\n }\n\n let parent\n\n if (isNonDefaultScale) {\n parent = mesh.parent\n\n if (parent !== null) mesh.parent = null\n\n scale.copy(this.mesh.scale)\n\n mesh.scale.set(1, 1, 1)\n mesh.updateMatrixWorld(true)\n }\n\n // calculate physics and update bones\n\n this._updateRigidBodies()\n this._stepSimulation(delta)\n this._updateBones()\n\n // restore mesh if converted above\n\n if (isNonDefaultScale) {\n if (parent !== null) mesh.parent = parent\n\n mesh.scale.copy(scale)\n }\n\n manager.freeThreeVector3(scale)\n manager.freeThreeQuaternion(quaternion)\n manager.freeThreeVector3(position)\n\n return this\n }\n\n /**\n * Resets rigid bodies transorm to current bone's.\n *\n * @return {MMDPhysics}\n */\n reset() {\n for (let i = 0, il = this.bodies.length; i < il; i++) {\n this.bodies[i].reset()\n }\n\n return this\n }\n\n /**\n * Warm ups Rigid bodies. Calculates cycles steps.\n *\n * @param {Integer} cycles\n * @return {MMDPhysics}\n */\n warmup(cycles) {\n for (let i = 0; i < cycles; i++) {\n this.update(1 / 60)\n }\n\n return this\n }\n\n /**\n * Sets gravity.\n *\n * @param {Vector3} gravity\n * @return {MMDPhysicsHelper}\n */\n setGravity(gravity) {\n this.world.setGravity(new Ammo.btVector3(gravity.x, gravity.y, gravity.z))\n this.gravity.copy(gravity)\n\n return this\n }\n\n /**\n * Creates MMDPhysicsHelper\n *\n * @return {MMDPhysicsHelper}\n */\n createHelper() {\n return new MMDPhysicsHelper(this.mesh, this)\n }\n\n // private methods\n\n _init(mesh, rigidBodyParams, constraintParams) {\n const manager = this.manager\n\n // rigid body/constraint parameters are for\n // mesh's default world transform as position(0, 0, 0),\n // quaternion(0, 0, 0, 1) and scale(0, 0, 0)\n\n const parent = mesh.parent\n\n if (parent !== null) mesh.parent = null\n\n const currentPosition = manager.allocThreeVector3()\n const currentQuaternion = manager.allocThreeQuaternion()\n const currentScale = manager.allocThreeVector3()\n\n currentPosition.copy(mesh.position)\n currentQuaternion.copy(mesh.quaternion)\n currentScale.copy(mesh.scale)\n\n mesh.position.set(0, 0, 0)\n mesh.quaternion.set(0, 0, 0, 1)\n mesh.scale.set(1, 1, 1)\n\n mesh.updateMatrixWorld(true)\n\n if (this.world === null) {\n this.world = this._createWorld()\n this.setGravity(this.gravity)\n }\n\n this._initRigidBodies(rigidBodyParams)\n this._initConstraints(constraintParams)\n\n if (parent !== null) mesh.parent = parent\n\n mesh.position.copy(currentPosition)\n mesh.quaternion.copy(currentQuaternion)\n mesh.scale.copy(currentScale)\n\n mesh.updateMatrixWorld(true)\n\n this.reset()\n\n manager.freeThreeVector3(currentPosition)\n manager.freeThreeQuaternion(currentQuaternion)\n manager.freeThreeVector3(currentScale)\n }\n\n _createWorld() {\n const config = new Ammo.btDefaultCollisionConfiguration()\n const dispatcher = new Ammo.btCollisionDispatcher(config)\n const cache = new Ammo.btDbvtBroadphase()\n const solver = new Ammo.btSequentialImpulseConstraintSolver()\n const world = new Ammo.btDiscreteDynamicsWorld(dispatcher, cache, solver, config)\n return world\n }\n\n _initRigidBodies(rigidBodies) {\n for (let i = 0, il = rigidBodies.length; i < il; i++) {\n this.bodies.push(new RigidBody(this.mesh, this.world, rigidBodies[i], this.manager))\n }\n }\n\n _initConstraints(constraints) {\n for (let i = 0, il = constraints.length; i < il; i++) {\n const params = constraints[i]\n const bodyA = this.bodies[params.rigidBodyIndex1]\n const bodyB = this.bodies[params.rigidBodyIndex2]\n this.constraints.push(new Constraint(this.mesh, this.world, bodyA, bodyB, params, this.manager))\n }\n }\n\n _stepSimulation(delta) {\n const unitStep = this.unitStep\n let stepTime = delta\n let maxStepNum = ((delta / unitStep) | 0) + 1\n\n if (stepTime < unitStep) {\n stepTime = unitStep\n maxStepNum = 1\n }\n\n if (maxStepNum > this.maxStepNum) {\n maxStepNum = this.maxStepNum\n }\n\n this.world.stepSimulation(stepTime, maxStepNum, unitStep)\n }\n\n _updateRigidBodies() {\n for (let i = 0, il = this.bodies.length; i < il; i++) {\n this.bodies[i].updateFromBone()\n }\n }\n\n _updateBones() {\n for (let i = 0, il = this.bodies.length; i < il; i++) {\n this.bodies[i].updateBone()\n }\n }\n}\n\n/**\n * This manager's responsibilies are\n *\n * 1. manage Ammo.js and Three.js object resources and\n * improve the performance and the memory consumption by\n * reusing objects.\n *\n * 2. provide simple Ammo object operations.\n */\nclass ResourceManager {\n constructor() {\n // for Three.js\n this.threeVector3s = []\n this.threeMatrix4s = []\n this.threeQuaternions = []\n this.threeEulers = []\n\n // for Ammo.js\n this.transforms = []\n this.quaternions = []\n this.vector3s = []\n }\n\n allocThreeVector3() {\n return this.threeVector3s.length > 0 ? this.threeVector3s.pop() : new Vector3()\n }\n\n freeThreeVector3(v) {\n this.threeVector3s.push(v)\n }\n\n allocThreeMatrix4() {\n return this.threeMatrix4s.length > 0 ? this.threeMatrix4s.pop() : new Matrix4()\n }\n\n freeThreeMatrix4(m) {\n this.threeMatrix4s.push(m)\n }\n\n allocThreeQuaternion() {\n return this.threeQuaternions.length > 0 ? this.threeQuaternions.pop() : new Quaternion()\n }\n\n freeThreeQuaternion(q) {\n this.threeQuaternions.push(q)\n }\n\n allocThreeEuler() {\n return this.threeEulers.length > 0 ? this.threeEulers.pop() : new Euler()\n }\n\n freeThreeEuler(e) {\n this.threeEulers.push(e)\n }\n\n allocTransform() {\n return this.transforms.length > 0 ? this.transforms.pop() : new Ammo.btTransform()\n }\n\n freeTransform(t) {\n this.transforms.push(t)\n }\n\n allocQuaternion() {\n return this.quaternions.length > 0 ? this.quaternions.pop() : new Ammo.btQuaternion()\n }\n\n freeQuaternion(q) {\n this.quaternions.push(q)\n }\n\n allocVector3() {\n return this.vector3s.length > 0 ? this.vector3s.pop() : new Ammo.btVector3()\n }\n\n freeVector3(v) {\n this.vector3s.push(v)\n }\n\n setIdentity(t) {\n t.setIdentity()\n }\n\n getBasis(t) {\n var q = this.allocQuaternion()\n t.getBasis().getRotation(q)\n return q\n }\n\n getBasisAsMatrix3(t) {\n var q = this.getBasis(t)\n var m = this.quaternionToMatrix3(q)\n this.freeQuaternion(q)\n return m\n }\n\n getOrigin(t) {\n return t.getOrigin()\n }\n\n setOrigin(t, v) {\n t.getOrigin().setValue(v.x(), v.y(), v.z())\n }\n\n copyOrigin(t1, t2) {\n var o = t2.getOrigin()\n this.setOrigin(t1, o)\n }\n\n setBasis(t, q) {\n t.setRotation(q)\n }\n\n setBasisFromMatrix3(t, m) {\n var q = this.matrix3ToQuaternion(m)\n this.setBasis(t, q)\n this.freeQuaternion(q)\n }\n\n setOriginFromArray3(t, a) {\n t.getOrigin().setValue(a[0], a[1], a[2])\n }\n\n setOriginFromThreeVector3(t, v) {\n t.getOrigin().setValue(v.x, v.y, v.z)\n }\n\n setBasisFromArray3(t, a) {\n var thQ = this.allocThreeQuaternion()\n var thE = this.allocThreeEuler()\n thE.set(a[0], a[1], a[2])\n this.setBasisFromThreeQuaternion(t, thQ.setFromEuler(thE))\n\n this.freeThreeEuler(thE)\n this.freeThreeQuaternion(thQ)\n }\n\n setBasisFromThreeQuaternion(t, a) {\n var q = this.allocQuaternion()\n\n q.setX(a.x)\n q.setY(a.y)\n q.setZ(a.z)\n q.setW(a.w)\n this.setBasis(t, q)\n\n this.freeQuaternion(q)\n }\n\n multiplyTransforms(t1, t2) {\n var t = this.allocTransform()\n this.setIdentity(t)\n\n var m1 = this.getBasisAsMatrix3(t1)\n var m2 = this.getBasisAsMatrix3(t2)\n\n var o1 = this.getOrigin(t1)\n var o2 = this.getOrigin(t2)\n\n var v1 = this.multiplyMatrix3ByVector3(m1, o2)\n var v2 = this.addVector3(v1, o1)\n this.setOrigin(t, v2)\n\n var m3 = this.multiplyMatrices3(m1, m2)\n this.setBasisFromMatrix3(t, m3)\n\n this.freeVector3(v1)\n this.freeVector3(v2)\n\n return t\n }\n\n inverseTransform(t) {\n var t2 = this.allocTransform()\n\n var m1 = this.getBasisAsMatrix3(t)\n var o = this.getOrigin(t)\n\n var m2 = this.transposeMatrix3(m1)\n var v1 = this.negativeVector3(o)\n var v2 = this.multiplyMatrix3ByVector3(m2, v1)\n\n this.setOrigin(t2, v2)\n this.setBasisFromMatrix3(t2, m2)\n\n this.freeVector3(v1)\n this.freeVector3(v2)\n\n return t2\n }\n\n multiplyMatrices3(m1, m2) {\n var m3 = []\n\n var v10 = this.rowOfMatrix3(m1, 0)\n var v11 = this.rowOfMatrix3(m1, 1)\n var v12 = this.rowOfMatrix3(m1, 2)\n\n var v20 = this.columnOfMatrix3(m2, 0)\n var v21 = this.columnOfMatrix3(m2, 1)\n var v22 = this.columnOfMatrix3(m2, 2)\n\n m3[0] = this.dotVectors3(v10, v20)\n m3[1] = this.dotVectors3(v10, v21)\n m3[2] = this.dotVectors3(v10, v22)\n m3[3] = this.dotVectors3(v11, v20)\n m3[4] = this.dotVectors3(v11, v21)\n m3[5] = this.dotVectors3(v11, v22)\n m3[6] = this.dotVectors3(v12, v20)\n m3[7] = this.dotVectors3(v12, v21)\n m3[8] = this.dotVectors3(v12, v22)\n\n this.freeVector3(v10)\n this.freeVector3(v11)\n this.freeVector3(v12)\n this.freeVector3(v20)\n this.freeVector3(v21)\n this.freeVector3(v22)\n\n return m3\n }\n\n addVector3(v1, v2) {\n var v = this.allocVector3()\n v.setValue(v1.x() + v2.x(), v1.y() + v2.y(), v1.z() + v2.z())\n return v\n }\n\n dotVectors3(v1, v2) {\n return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z()\n }\n\n rowOfMatrix3(m, i) {\n var v = this.allocVector3()\n v.setValue(m[i * 3 + 0], m[i * 3 + 1], m[i * 3 + 2])\n return v\n }\n\n columnOfMatrix3(m, i) {\n var v = this.allocVector3()\n v.setValue(m[i + 0], m[i + 3], m[i + 6])\n return v\n }\n\n negativeVector3(v) {\n var v2 = this.allocVector3()\n v2.setValue(-v.x(), -v.y(), -v.z())\n return v2\n }\n\n multiplyMatrix3ByVector3(m, v) {\n var v4 = this.allocVector3()\n\n var v0 = this.rowOfMatrix3(m, 0)\n var v1 = this.rowOfMatrix3(m, 1)\n var v2 = this.rowOfMatrix3(m, 2)\n var x = this.dotVectors3(v0, v)\n var y = this.dotVectors3(v1, v)\n var z = this.dotVectors3(v2, v)\n\n v4.setValue(x, y, z)\n\n this.freeVector3(v0)\n this.freeVector3(v1)\n this.freeVector3(v2)\n\n return v4\n }\n\n transposeMatrix3(m) {\n var m2 = []\n m2[0] = m[0]\n m2[1] = m[3]\n m2[2] = m[6]\n m2[3] = m[1]\n m2[4] = m[4]\n m2[5] = m[7]\n m2[6] = m[2]\n m2[7] = m[5]\n m2[8] = m[8]\n return m2\n }\n\n quaternionToMatrix3(q) {\n var m = []\n\n var x = q.x()\n var y = q.y()\n var z = q.z()\n var w = q.w()\n\n var xx = x * x\n var yy = y * y\n var zz = z * z\n\n var xy = x * y\n var yz = y * z\n var zx = z * x\n\n var xw = x * w\n var yw = y * w\n var zw = z * w\n\n m[0] = 1 - 2 * (yy + zz)\n m[1] = 2 * (xy - zw)\n m[2] = 2 * (zx + yw)\n m[3] = 2 * (xy + zw)\n m[4] = 1 - 2 * (zz + xx)\n m[5] = 2 * (yz - xw)\n m[6] = 2 * (zx - yw)\n m[7] = 2 * (yz + xw)\n m[8] = 1 - 2 * (xx + yy)\n\n return m\n }\n\n matrix3ToQuaternion(m) {\n var t = m[0] + m[4] + m[8]\n var s, x, y, z, w\n\n if (t > 0) {\n s = Math.sqrt(t + 1.0) * 2\n w = 0.25 * s\n x = (m[7] - m[5]) / s\n y = (m[2] - m[6]) / s\n z = (m[3] - m[1]) / s\n } else if (m[0] > m[4] && m[0] > m[8]) {\n s = Math.sqrt(1.0 + m[0] - m[4] - m[8]) * 2\n w = (m[7] - m[5]) / s\n x = 0.25 * s\n y = (m[1] + m[3]) / s\n z = (m[2] + m[6]) / s\n } else if (m[4] > m[8]) {\n s = Math.sqrt(1.0 + m[4] - m[0] - m[8]) * 2\n w = (m[2] - m[6]) / s\n x = (m[1] + m[3]) / s\n y = 0.25 * s\n z = (m[5] + m[7]) / s\n } else {\n s = Math.sqrt(1.0 + m[8] - m[0] - m[4]) * 2\n w = (m[3] - m[1]) / s\n x = (m[2] + m[6]) / s\n y = (m[5] + m[7]) / s\n z = 0.25 * s\n }\n\n var q = this.allocQuaternion()\n q.setX(x)\n q.setY(y)\n q.setZ(z)\n q.setW(w)\n return q\n }\n}\n\n/**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Ammo.btDiscreteDynamicsWorld} world\n * @param {Object} params\n * @param {ResourceManager} manager\n */\nclass RigidBody {\n constructor(mesh, world, params, manager) {\n this.mesh = mesh\n this.world = world\n this.params = params\n this.manager = manager\n\n this.body = null\n this.bone = null\n this.boneOffsetForm = null\n this.boneOffsetFormInverse = null\n\n this._init()\n }\n\n /**\n * Resets rigid body transform to the current bone's.\n *\n * @return {RigidBody}\n */\n reset() {\n this._setTransformFromBone()\n return this\n }\n\n /**\n * Updates rigid body's transform from the current bone.\n *\n * @return {RidigBody}\n */\n updateFromBone() {\n if (this.params.boneIndex !== -1 && this.params.type === 0) {\n this._setTransformFromBone()\n }\n\n return this\n }\n\n /**\n * Updates bone from the current ridid body's transform.\n *\n * @return {RidigBody}\n */\n updateBone() {\n if (this.params.type === 0 || this.params.boneIndex === -1) {\n return this\n }\n\n this._updateBoneRotation()\n\n if (this.params.type === 1) {\n this._updateBonePosition()\n }\n\n this.bone.updateMatrixWorld(true)\n\n if (this.params.type === 2) {\n this._setPositionFromBone()\n }\n\n return this\n }\n\n // private methods\n\n _init() {\n function generateShape(p) {\n switch (p.shapeType) {\n case 0:\n return new Ammo.btSphereShape(p.width)\n\n case 1:\n return new Ammo.btBoxShape(new Ammo.btVector3(p.width, p.height, p.depth))\n\n case 2:\n return new Ammo.btCapsuleShape(p.width, p.height)\n\n default:\n throw new Error('unknown shape type ' + p.shapeType)\n }\n }\n\n const manager = this.manager\n const params = this.params\n const bones = this.mesh.skeleton.bones\n const bone = params.boneIndex === -1 ? new Bone() : bones[params.boneIndex]\n\n const shape = generateShape(params)\n const weight = params.type === 0 ? 0 : params.weight\n const localInertia = manager.allocVector3()\n localInertia.setValue(0, 0, 0)\n\n if (weight !== 0) {\n shape.calculateLocalInertia(weight, localInertia)\n }\n\n const boneOffsetForm = manager.allocTransform()\n manager.setIdentity(boneOffsetForm)\n manager.setOriginFromArray3(boneOffsetForm, params.position)\n manager.setBasisFromArray3(boneOffsetForm, params.rotation)\n\n const vector = manager.allocThreeVector3()\n const boneForm = manager.allocTransform()\n manager.setIdentity(boneForm)\n manager.setOriginFromThreeVector3(boneForm, bone.getWorldPosition(vector))\n\n const form = manager.multiplyTransforms(boneForm, boneOffsetForm)\n const state = new Ammo.btDefaultMotionState(form)\n\n const info = new Ammo.btRigidBodyConstructionInfo(weight, state, shape, localInertia)\n info.set_m_friction(params.friction)\n info.set_m_restitution(params.restitution)\n\n const body = new Ammo.btRigidBody(info)\n\n if (params.type === 0) {\n body.setCollisionFlags(body.getCollisionFlags() | 2)\n\n /*\n * It'd be better to comment out this line though in general I should call this method\n * because I'm not sure why but physics will be more like MMD's\n * if I comment out.\n */\n body.setActivationState(4)\n }\n\n body.setDamping(params.positionDamping, params.rotationDamping)\n body.setSleepingThresholds(0, 0)\n\n this.world.addRigidBody(body, 1 << params.groupIndex, params.groupTarget)\n\n this.body = body\n this.bone = bone\n this.boneOffsetForm = boneOffsetForm\n this.boneOffsetFormInverse = manager.inverseTransform(boneOffsetForm)\n\n manager.freeVector3(localInertia)\n manager.freeTransform(form)\n manager.freeTransform(boneForm)\n manager.freeThreeVector3(vector)\n }\n\n _getBoneTransform() {\n const manager = this.manager\n const p = manager.allocThreeVector3()\n const q = manager.allocThreeQuaternion()\n const s = manager.allocThreeVector3()\n\n this.bone.matrixWorld.decompose(p, q, s)\n\n const tr = manager.allocTransform()\n manager.setOriginFromThreeVector3(tr, p)\n manager.setBasisFromThreeQuaternion(tr, q)\n\n const form = manager.multiplyTransforms(tr, this.boneOffsetForm)\n\n manager.freeTransform(tr)\n manager.freeThreeVector3(s)\n manager.freeThreeQuaternion(q)\n manager.freeThreeVector3(p)\n\n return form\n }\n\n _getWorldTransformForBone() {\n const manager = this.manager\n const tr = this.body.getCenterOfMassTransform()\n return manager.multiplyTransforms(tr, this.boneOffsetFormInverse)\n }\n\n _setTransformFromBone() {\n const manager = this.manager\n const form = this._getBoneTransform()\n\n // TODO: check the most appropriate way to set\n //this.body.setWorldTransform( form );\n this.body.setCenterOfMassTransform(form)\n this.body.getMotionState().setWorldTransform(form)\n\n manager.freeTransform(form)\n }\n\n _setPositionFromBone() {\n const manager = this.manager\n const form = this._getBoneTransform()\n\n const tr = manager.allocTransform()\n this.body.getMotionState().getWorldTransform(tr)\n manager.copyOrigin(tr, form)\n\n // TODO: check the most appropriate way to set\n //this.body.setWorldTransform( tr );\n this.body.setCenterOfMassTransform(tr)\n this.body.getMotionState().setWorldTransform(tr)\n\n manager.freeTransform(tr)\n manager.freeTransform(form)\n }\n\n _updateBoneRotation() {\n const manager = this.manager\n\n const tr = this._getWorldTransformForBone()\n const q = manager.getBasis(tr)\n\n const thQ = manager.allocThreeQuaternion()\n const thQ2 = manager.allocThreeQuaternion()\n const thQ3 = manager.allocThreeQuaternion()\n\n thQ.set(q.x(), q.y(), q.z(), q.w())\n thQ2.setFromRotationMatrix(this.bone.matrixWorld)\n thQ2.conjugate()\n thQ2.multiply(thQ)\n\n //this.bone.quaternion.multiply( thQ2 );\n\n thQ3.setFromRotationMatrix(this.bone.matrix)\n\n // Renormalizing quaternion here because repeatedly transforming\n // quaternion continuously accumulates floating point error and\n // can end up being overflow. See #15335\n this.bone.quaternion.copy(thQ2.multiply(thQ3).normalize())\n\n manager.freeThreeQuaternion(thQ)\n manager.freeThreeQuaternion(thQ2)\n manager.freeThreeQuaternion(thQ3)\n\n manager.freeQuaternion(q)\n manager.freeTransform(tr)\n }\n\n _updateBonePosition() {\n const manager = this.manager\n\n const tr = this._getWorldTransformForBone()\n\n const thV = manager.allocThreeVector3()\n\n const o = manager.getOrigin(tr)\n thV.set(o.x(), o.y(), o.z())\n\n if (this.bone.parent) {\n this.bone.parent.worldToLocal(thV)\n }\n\n this.bone.position.copy(thV)\n\n manager.freeThreeVector3(thV)\n\n manager.freeTransform(tr)\n }\n}\n\n//\n\nclass Constraint {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Ammo.btDiscreteDynamicsWorld} world\n * @param {RigidBody} bodyA\n * @param {RigidBody} bodyB\n * @param {Object} params\n * @param {ResourceManager} manager\n */\n constructor(mesh, world, bodyA, bodyB, params, manager) {\n this.mesh = mesh\n this.world = world\n this.bodyA = bodyA\n this.bodyB = bodyB\n this.params = params\n this.manager = manager\n\n this.constraint = null\n\n this._init()\n }\n\n // private method\n\n _init() {\n const manager = this.manager\n const params = this.params\n const bodyA = this.bodyA\n const bodyB = this.bodyB\n\n const form = manager.allocTransform()\n manager.setIdentity(form)\n manager.setOriginFromArray3(form, params.position)\n manager.setBasisFromArray3(form, params.rotation)\n\n const formA = manager.allocTransform()\n const formB = manager.allocTransform()\n\n bodyA.body.getMotionState().getWorldTransform(formA)\n bodyB.body.getMotionState().getWorldTransform(formB)\n\n const formInverseA = manager.inverseTransform(formA)\n const formInverseB = manager.inverseTransform(formB)\n\n const formA2 = manager.multiplyTransforms(formInverseA, form)\n const formB2 = manager.multiplyTransforms(formInverseB, form)\n\n const constraint = new Ammo.btGeneric6DofSpringConstraint(bodyA.body, bodyB.body, formA2, formB2, true)\n\n const lll = manager.allocVector3()\n const lul = manager.allocVector3()\n const all = manager.allocVector3()\n const aul = manager.allocVector3()\n\n lll.setValue(params.translationLimitation1[0], params.translationLimitation1[1], params.translationLimitation1[2])\n lul.setValue(params.translationLimitation2[0], params.translationLimitation2[1], params.translationLimitation2[2])\n all.setValue(params.rotationLimitation1[0], params.rotationLimitation1[1], params.rotationLimitation1[2])\n aul.setValue(params.rotationLimitation2[0], params.rotationLimitation2[1], params.rotationLimitation2[2])\n\n constraint.setLinearLowerLimit(lll)\n constraint.setLinearUpperLimit(lul)\n constraint.setAngularLowerLimit(all)\n constraint.setAngularUpperLimit(aul)\n\n for (let i = 0; i < 3; i++) {\n if (params.springPosition[i] !== 0) {\n constraint.enableSpring(i, true)\n constraint.setStiffness(i, params.springPosition[i])\n }\n }\n\n for (let i = 0; i < 3; i++) {\n if (params.springRotation[i] !== 0) {\n constraint.enableSpring(i + 3, true)\n constraint.setStiffness(i + 3, params.springRotation[i])\n }\n }\n\n /*\n * Currently(10/31/2016) official ammo.js doesn't support\n * btGeneric6DofSpringConstraint.setParam method.\n * You need custom ammo.js (add the method into idl) if you wanna use.\n * By setting this parameter, physics will be more like MMD's\n */\n if (constraint.setParam !== undefined) {\n for (let i = 0; i < 6; i++) {\n constraint.setParam(2, 0.475, i)\n }\n }\n\n this.world.addConstraint(constraint, true)\n this.constraint = constraint\n\n manager.freeTransform(form)\n manager.freeTransform(formA)\n manager.freeTransform(formB)\n manager.freeTransform(formInverseA)\n manager.freeTransform(formInverseB)\n manager.freeTransform(formA2)\n manager.freeTransform(formB2)\n manager.freeVector3(lll)\n manager.freeVector3(lul)\n manager.freeVector3(all)\n manager.freeVector3(aul)\n }\n}\n\nconst _position = new Vector3()\nconst _quaternion = new Quaternion()\nconst _scale = new Vector3()\nconst _matrixWorldInv = new Matrix4()\n\nclass MMDPhysicsHelper extends Object3D {\n /**\n * Visualize Rigid bodies\n *\n * @param {THREE.SkinnedMesh} mesh\n * @param {Physics} physics\n */\n constructor(mesh, physics) {\n super()\n\n this.root = mesh\n this.physics = physics\n\n this.matrix.copy(mesh.matrixWorld)\n this.matrixAutoUpdate = false\n\n this.materials = []\n\n this.materials.push(\n new MeshBasicMaterial({\n color: new Color(0xff8888),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true,\n }),\n )\n\n this.materials.push(\n new MeshBasicMaterial({\n color: new Color(0x88ff88),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true,\n }),\n )\n\n this.materials.push(\n new MeshBasicMaterial({\n color: new Color(0x8888ff),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true,\n }),\n )\n\n this._init()\n }\n\n /**\n * Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.\n */\n dispose() {\n const materials = this.materials\n const children = this.children\n\n for (let i = 0; i < materials.length; i++) {\n materials[i].dispose()\n }\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n\n if (child.isMesh) child.geometry.dispose()\n }\n }\n\n /**\n * Updates Rigid Bodies visualization.\n */\n updateMatrixWorld(force) {\n var mesh = this.root\n\n if (this.visible) {\n var bodies = this.physics.bodies\n\n _matrixWorldInv\n .copy(mesh.matrixWorld)\n .decompose(_position, _quaternion, _scale)\n .compose(_position, _quaternion, _scale.set(1, 1, 1))\n .invert()\n\n for (var i = 0, il = bodies.length; i < il; i++) {\n var body = bodies[i].body\n var child = this.children[i]\n\n var tr = body.getCenterOfMassTransform()\n var origin = tr.getOrigin()\n var rotation = tr.getRotation()\n\n child.position.set(origin.x(), origin.y(), origin.z()).applyMatrix4(_matrixWorldInv)\n\n child.quaternion\n .setFromRotationMatrix(_matrixWorldInv)\n .multiply(_quaternion.set(rotation.x(), rotation.y(), rotation.z(), rotation.w()))\n }\n }\n\n this.matrix\n .copy(mesh.matrixWorld)\n .decompose(_position, _quaternion, _scale)\n .compose(_position, _quaternion, _scale.set(1, 1, 1))\n\n super.updateMatrixWorld(force)\n }\n\n // private method\n\n _init() {\n var bodies = this.physics.bodies\n\n function createGeometry(param) {\n switch (param.shapeType) {\n case 0:\n return new SphereGeometry(param.width, 16, 8)\n\n case 1:\n return new BoxGeometry(param.width * 2, param.height * 2, param.depth * 2, 8, 8, 8)\n\n case 2:\n return new CapsuleGeometry(param.width, param.height, 8, 16)\n\n default:\n return null\n }\n }\n\n for (var i = 0, il = bodies.length; i < il; i++) {\n var param = bodies[i].params\n this.add(new Mesh(createGeometry(param), this.materials[param.type]))\n }\n }\n}\n\nexport { MMDPhysics }\n", "import { AnimationMixer, Object3D, Quaternion, Vector3 } from 'three'\nimport { CCDIKSolver } from '../animation/CCDIKSolver'\nimport { MMDPhysics } from '../animation/MMDPhysics'\n\n/**\n * MMDAnimationHelper handles animation of MMD assets loaded by MMDLoader\n * with MMD special features as IK, Grant, and Physics.\n *\n * Dependencies\n * - ammo.js https://github.com/kripken/ammo.js\n * - MMDPhysics\n * - CCDIKSolver\n *\n * TODO\n * - more precise grant skinning support.\n */\nclass MMDAnimationHelper {\n /**\n * @param {Object} params - (optional)\n * @param {boolean} params.sync - Whether animation durations of added objects are synched. Default is true.\n * @param {Number} params.afterglow - Default is 0.0.\n * @param {boolean} params.resetPhysicsOnLoop - Default is true.\n */\n constructor(params = {}) {\n this.meshes = []\n\n this.camera = null\n this.cameraTarget = new Object3D()\n this.cameraTarget.name = 'target'\n\n this.audio = null\n this.audioManager = null\n\n this.objects = new WeakMap()\n\n this.configuration = {\n sync: params.sync !== undefined ? params.sync : true,\n afterglow: params.afterglow !== undefined ? params.afterglow : 0.0,\n resetPhysicsOnLoop: params.resetPhysicsOnLoop !== undefined ? params.resetPhysicsOnLoop : true,\n pmxAnimation: params.pmxAnimation !== undefined ? params.pmxAnimation : false,\n }\n\n this.enabled = {\n animation: true,\n ik: true,\n grant: true,\n physics: true,\n cameraAnimation: true,\n }\n\n this.onBeforePhysics = function (/* mesh */) {}\n\n // experimental\n this.sharedPhysics = false\n this.masterPhysics = null\n }\n\n /**\n * Adds an Three.js Object to helper and setups animation.\n * The anmation durations of added objects are synched\n * if this.configuration.sync is true.\n *\n * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object\n * @param {Object} params - (optional)\n * @param {THREE.AnimationClip|Array} params.animation - Only for THREE.SkinnedMesh and THREE.Camera. Default is undefined.\n * @param {boolean} params.physics - Only for THREE.SkinnedMesh. Default is true.\n * @param {Integer} params.warmup - Only for THREE.SkinnedMesh and physics is true. Default is 60.\n * @param {Number} params.unitStep - Only for THREE.SkinnedMesh and physics is true. Default is 1 / 65.\n * @param {Integer} params.maxStepNum - Only for THREE.SkinnedMesh and physics is true. Default is 3.\n * @param {Vector3} params.gravity - Only for THREE.SkinnedMesh and physics is true. Default ( 0, - 9.8 * 10, 0 ).\n * @param {Number} params.delayTime - Only for THREE.Audio. Default is 0.0.\n * @return {MMDAnimationHelper}\n */\n add(object, params = {}) {\n if (object.isSkinnedMesh) {\n this._addMesh(object, params)\n } else if (object.isCamera) {\n this._setupCamera(object, params)\n } else if (object.type === 'Audio') {\n this._setupAudio(object, params)\n } else {\n throw new Error(\n 'THREE.MMDAnimationHelper.add: ' +\n 'accepts only ' +\n 'THREE.SkinnedMesh or ' +\n 'THREE.Camera or ' +\n 'THREE.Audio instance.',\n )\n }\n\n if (this.configuration.sync) this._syncDuration()\n\n return this\n }\n\n /**\n * Removes an Three.js Object from helper.\n *\n * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object\n * @return {MMDAnimationHelper}\n */\n remove(object) {\n if (object.isSkinnedMesh) {\n this._removeMesh(object)\n } else if (object.isCamera) {\n this._clearCamera(object)\n } else if (object.type === 'Audio') {\n this._clearAudio(object)\n } else {\n throw new Error(\n 'THREE.MMDAnimationHelper.remove: ' +\n 'accepts only ' +\n 'THREE.SkinnedMesh or ' +\n 'THREE.Camera or ' +\n 'THREE.Audio instance.',\n )\n }\n\n if (this.configuration.sync) this._syncDuration()\n\n return this\n }\n\n /**\n * Updates the animation.\n *\n * @param {Number} delta\n * @return {MMDAnimationHelper}\n */\n update(delta) {\n if (this.audioManager !== null) this.audioManager.control(delta)\n\n for (let i = 0; i < this.meshes.length; i++) {\n this._animateMesh(this.meshes[i], delta)\n }\n\n if (this.sharedPhysics) this._updateSharedPhysics(delta)\n\n if (this.camera !== null) this._animateCamera(this.camera, delta)\n\n return this\n }\n\n /**\n * Changes the pose of SkinnedMesh as VPD specifies.\n *\n * @param {THREE.SkinnedMesh} mesh\n * @param {Object} vpd - VPD content parsed MMDParser\n * @param {Object} params - (optional)\n * @param {boolean} params.resetPose - Default is true.\n * @param {boolean} params.ik - Default is true.\n * @param {boolean} params.grant - Default is true.\n * @return {MMDAnimationHelper}\n */\n pose(mesh, vpd, params = {}) {\n if (params.resetPose !== false) mesh.pose()\n\n const bones = mesh.skeleton.bones\n const boneParams = vpd.bones\n\n const boneNameDictionary = {}\n\n for (let i = 0, il = bones.length; i < il; i++) {\n boneNameDictionary[bones[i].name] = i\n }\n\n const vector = new Vector3()\n const quaternion = new Quaternion()\n\n for (let i = 0, il = boneParams.length; i < il; i++) {\n const boneParam = boneParams[i]\n const boneIndex = boneNameDictionary[boneParam.name]\n\n if (boneIndex === undefined) continue\n\n const bone = bones[boneIndex]\n bone.position.add(vector.fromArray(boneParam.translation))\n bone.quaternion.multiply(quaternion.fromArray(boneParam.quaternion))\n }\n\n mesh.updateMatrixWorld(true)\n\n // PMX animation system special path\n if (this.configuration.pmxAnimation && mesh.geometry.userData.MMD && mesh.geometry.userData.MMD.format === 'pmx') {\n const sortedBonesData = this._sortBoneDataArray(mesh.geometry.userData.MMD.bones.slice())\n const ikSolver = params.ik !== false ? this._createCCDIKSolver(mesh) : null\n const grantSolver = params.grant !== false ? this.createGrantSolver(mesh) : null\n this._animatePMXMesh(mesh, sortedBonesData, ikSolver, grantSolver)\n } else {\n if (params.ik !== false) {\n this._createCCDIKSolver(mesh).update()\n }\n\n if (params.grant !== false) {\n this.createGrantSolver(mesh).update()\n }\n }\n\n return this\n }\n\n /**\n * Enabes/Disables an animation feature.\n *\n * @param {string} key\n * @param {boolean} enabled\n * @return {MMDAnimationHelper}\n */\n enable(key, enabled) {\n if (this.enabled[key] === undefined) {\n throw new Error('THREE.MMDAnimationHelper.enable: ' + 'unknown key ' + key)\n }\n\n this.enabled[key] = enabled\n\n if (key === 'physics') {\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n this._optimizeIK(this.meshes[i], enabled)\n }\n }\n\n return this\n }\n\n /**\n * Creates an GrantSolver instance.\n *\n * @param {THREE.SkinnedMesh} mesh\n * @return {GrantSolver}\n */\n createGrantSolver(mesh) {\n return new GrantSolver(mesh, mesh.geometry.userData.MMD.grants)\n }\n\n // private methods\n\n _addMesh(mesh, params) {\n if (this.meshes.indexOf(mesh) >= 0) {\n throw new Error('THREE.MMDAnimationHelper._addMesh: ' + \"SkinnedMesh '\" + mesh.name + \"' has already been added.\")\n }\n\n this.meshes.push(mesh)\n this.objects.set(mesh, { looped: false })\n\n this._setupMeshAnimation(mesh, params.animation)\n\n if (params.physics !== false) {\n this._setupMeshPhysics(mesh, params)\n }\n\n return this\n }\n\n _setupCamera(camera, params) {\n if (this.camera === camera) {\n throw new Error('THREE.MMDAnimationHelper._setupCamera: ' + \"Camera '\" + camera.name + \"' has already been set.\")\n }\n\n if (this.camera) this.clearCamera(this.camera)\n\n this.camera = camera\n\n camera.add(this.cameraTarget)\n\n this.objects.set(camera, {})\n\n if (params.animation !== undefined) {\n this._setupCameraAnimation(camera, params.animation)\n }\n\n return this\n }\n\n _setupAudio(audio, params) {\n if (this.audio === audio) {\n throw new Error('THREE.MMDAnimationHelper._setupAudio: ' + \"Audio '\" + audio.name + \"' has already been set.\")\n }\n\n if (this.audio) this.clearAudio(this.audio)\n\n this.audio = audio\n this.audioManager = new AudioManager(audio, params)\n\n this.objects.set(this.audioManager, {\n duration: this.audioManager.duration,\n })\n\n return this\n }\n\n _removeMesh(mesh) {\n let found = false\n let writeIndex = 0\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n if (this.meshes[i] === mesh) {\n this.objects.delete(mesh)\n found = true\n\n continue\n }\n\n this.meshes[writeIndex++] = this.meshes[i]\n }\n\n if (!found) {\n throw new Error(\n 'THREE.MMDAnimationHelper._removeMesh: ' + \"SkinnedMesh '\" + mesh.name + \"' has not been added yet.\",\n )\n }\n\n this.meshes.length = writeIndex\n\n return this\n }\n\n _clearCamera(camera) {\n if (camera !== this.camera) {\n throw new Error('THREE.MMDAnimationHelper._clearCamera: ' + \"Camera '\" + camera.name + \"' has not been set yet.\")\n }\n\n this.camera.remove(this.cameraTarget)\n\n this.objects.delete(this.camera)\n this.camera = null\n\n return this\n }\n\n _clearAudio(audio) {\n if (audio !== this.audio) {\n throw new Error('THREE.MMDAnimationHelper._clearAudio: ' + \"Audio '\" + audio.name + \"' has not been set yet.\")\n }\n\n this.objects.delete(this.audioManager)\n\n this.audio = null\n this.audioManager = null\n\n return this\n }\n\n _setupMeshAnimation(mesh, animation) {\n const objects = this.objects.get(mesh)\n\n if (animation !== undefined) {\n const animations = Array.isArray(animation) ? animation : [animation]\n\n objects.mixer = new AnimationMixer(mesh)\n\n for (let i = 0, il = animations.length; i < il; i++) {\n objects.mixer.clipAction(animations[i]).play()\n }\n\n // TODO: find a workaround not to access ._clip looking like a private property\n objects.mixer.addEventListener('loop', function (event) {\n const tracks = event.action._clip.tracks\n\n if (tracks.length > 0 && tracks[0].name.slice(0, 6) !== '.bones') return\n\n objects.looped = true\n })\n }\n\n objects.ikSolver = this._createCCDIKSolver(mesh)\n objects.grantSolver = this.createGrantSolver(mesh)\n\n return this\n }\n\n _setupCameraAnimation(camera, animation) {\n const animations = Array.isArray(animation) ? animation : [animation]\n\n const objects = this.objects.get(camera)\n\n objects.mixer = new AnimationMixer(camera)\n\n for (let i = 0, il = animations.length; i < il; i++) {\n objects.mixer.clipAction(animations[i]).play()\n }\n }\n\n _setupMeshPhysics(mesh, params) {\n const objects = this.objects.get(mesh)\n\n // shared physics is experimental\n\n if (params.world === undefined && this.sharedPhysics) {\n const masterPhysics = this._getMasterPhysics()\n\n if (masterPhysics !== null) world = masterPhysics.world // eslint-disable-line no-undef\n }\n\n objects.physics = this._createMMDPhysics(mesh, params)\n\n if (objects.mixer && params.animationWarmup !== false) {\n this._animateMesh(mesh, 0)\n objects.physics.reset()\n }\n\n objects.physics.warmup(params.warmup !== undefined ? params.warmup : 60)\n\n this._optimizeIK(mesh, true)\n }\n\n _animateMesh(mesh, delta) {\n const objects = this.objects.get(mesh)\n\n const mixer = objects.mixer\n const ikSolver = objects.ikSolver\n const grantSolver = objects.grantSolver\n const physics = objects.physics\n const looped = objects.looped\n\n if (mixer && this.enabled.animation) {\n // alternate solution to save/restore bones but less performant?\n //mesh.pose();\n //this._updatePropertyMixersBuffer( mesh );\n\n this._restoreBones(mesh)\n\n mixer.update(delta)\n\n this._saveBones(mesh)\n\n // PMX animation system special path\n if (\n this.configuration.pmxAnimation &&\n mesh.geometry.userData.MMD &&\n mesh.geometry.userData.MMD.format === 'pmx'\n ) {\n if (!objects.sortedBonesData)\n objects.sortedBonesData = this._sortBoneDataArray(mesh.geometry.userData.MMD.bones.slice())\n\n this._animatePMXMesh(\n mesh,\n objects.sortedBonesData,\n ikSolver && this.enabled.ik ? ikSolver : null,\n grantSolver && this.enabled.grant ? grantSolver : null,\n )\n } else {\n if (ikSolver && this.enabled.ik) {\n mesh.updateMatrixWorld(true)\n ikSolver.update()\n }\n\n if (grantSolver && this.enabled.grant) {\n grantSolver.update()\n }\n }\n }\n\n if (looped === true && this.enabled.physics) {\n if (physics && this.configuration.resetPhysicsOnLoop) physics.reset()\n\n objects.looped = false\n }\n\n if (physics && this.enabled.physics && !this.sharedPhysics) {\n this.onBeforePhysics(mesh)\n physics.update(delta)\n }\n }\n\n // Sort bones in order by 1. transformationClass and 2. bone index.\n // In PMX animation system, bone transformations should be processed\n // in this order.\n _sortBoneDataArray(boneDataArray) {\n return boneDataArray.sort(function (a, b) {\n if (a.transformationClass !== b.transformationClass) {\n return a.transformationClass - b.transformationClass\n } else {\n return a.index - b.index\n }\n })\n }\n\n // PMX Animation system is a bit too complex and doesn't great match to\n // Three.js Animation system. This method attempts to simulate it as much as\n // possible but doesn't perfectly simulate.\n // This method is more costly than the regular one so\n // you are recommended to set constructor parameter \"pmxAnimation: true\"\n // only if your PMX model animation doesn't work well.\n // If you need better method you would be required to write your own.\n _animatePMXMesh(mesh, sortedBonesData, ikSolver, grantSolver) {\n _quaternionIndex = 0\n _grantResultMap.clear()\n\n for (let i = 0, il = sortedBonesData.length; i < il; i++) {\n updateOne(mesh, sortedBonesData[i].index, ikSolver, grantSolver)\n }\n\n mesh.updateMatrixWorld(true)\n return this\n }\n\n _animateCamera(camera, delta) {\n const mixer = this.objects.get(camera).mixer\n\n if (mixer && this.enabled.cameraAnimation) {\n mixer.update(delta)\n\n camera.updateProjectionMatrix()\n\n camera.up.set(0, 1, 0)\n camera.up.applyQuaternion(camera.quaternion)\n camera.lookAt(this.cameraTarget.position)\n }\n }\n\n _optimizeIK(mesh, physicsEnabled) {\n const iks = mesh.geometry.userData.MMD.iks\n const bones = mesh.geometry.userData.MMD.bones\n\n for (let i = 0, il = iks.length; i < il; i++) {\n const ik = iks[i]\n const links = ik.links\n\n for (let j = 0, jl = links.length; j < jl; j++) {\n const link = links[j]\n\n if (physicsEnabled === true) {\n // disable IK of the bone the corresponding rigidBody type of which is 1 or 2\n // because its rotation will be overriden by physics\n link.enabled = bones[link.index].rigidBodyType > 0 ? false : true\n } else {\n link.enabled = true\n }\n }\n }\n }\n\n _createCCDIKSolver(mesh) {\n if (CCDIKSolver === undefined) {\n throw new Error('THREE.MMDAnimationHelper: Import CCDIKSolver.')\n }\n\n return new CCDIKSolver(mesh, mesh.geometry.userData.MMD.iks)\n }\n\n _createMMDPhysics(mesh, params) {\n if (MMDPhysics === undefined) {\n throw new Error('THREE.MMDPhysics: Import MMDPhysics.')\n }\n\n return new MMDPhysics(mesh, mesh.geometry.userData.MMD.rigidBodies, mesh.geometry.userData.MMD.constraints, params)\n }\n\n /*\n * Detects the longest duration and then sets it to them to sync.\n * TODO: Not to access private properties ( ._actions and ._clip )\n */\n _syncDuration() {\n let max = 0.0\n\n const objects = this.objects\n const meshes = this.meshes\n const camera = this.camera\n const audioManager = this.audioManager\n\n // get the longest duration\n\n for (let i = 0, il = meshes.length; i < il; i++) {\n const mixer = this.objects.get(meshes[i]).mixer\n\n if (mixer === undefined) continue\n\n for (let j = 0; j < mixer._actions.length; j++) {\n const clip = mixer._actions[j]._clip\n\n if (!objects.has(clip)) {\n objects.set(clip, {\n duration: clip.duration,\n })\n }\n\n max = Math.max(max, objects.get(clip).duration)\n }\n }\n\n if (camera !== null) {\n const mixer = this.objects.get(camera).mixer\n\n if (mixer !== undefined) {\n for (let i = 0, il = mixer._actions.length; i < il; i++) {\n const clip = mixer._actions[i]._clip\n\n if (!objects.has(clip)) {\n objects.set(clip, {\n duration: clip.duration,\n })\n }\n\n max = Math.max(max, objects.get(clip).duration)\n }\n }\n }\n\n if (audioManager !== null) {\n max = Math.max(max, objects.get(audioManager).duration)\n }\n\n max += this.configuration.afterglow\n\n // update the duration\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const mixer = this.objects.get(this.meshes[i]).mixer\n\n if (mixer === undefined) continue\n\n for (let j = 0, jl = mixer._actions.length; j < jl; j++) {\n mixer._actions[j]._clip.duration = max\n }\n }\n\n if (camera !== null) {\n const mixer = this.objects.get(camera).mixer\n\n if (mixer !== undefined) {\n for (let i = 0, il = mixer._actions.length; i < il; i++) {\n mixer._actions[i]._clip.duration = max\n }\n }\n }\n\n if (audioManager !== null) {\n audioManager.duration = max\n }\n }\n\n // workaround\n\n _updatePropertyMixersBuffer(mesh) {\n const mixer = this.objects.get(mesh).mixer\n\n const propertyMixers = mixer._bindings\n const accuIndex = mixer._accuIndex\n\n for (let i = 0, il = propertyMixers.length; i < il; i++) {\n const propertyMixer = propertyMixers[i]\n const buffer = propertyMixer.buffer\n const stride = propertyMixer.valueSize\n const offset = (accuIndex + 1) * stride\n\n propertyMixer.binding.getValue(buffer, offset)\n }\n }\n\n /*\n * Avoiding these two issues by restore/save bones before/after mixer animation.\n *\n * 1. PropertyMixer used by AnimationMixer holds cache value in .buffer.\n * Calculating IK, Grant, and Physics after mixer animation can break\n * the cache coherency.\n *\n * 2. Applying Grant two or more times without reset the posing breaks model.\n */\n _saveBones(mesh) {\n const objects = this.objects.get(mesh)\n\n const bones = mesh.skeleton.bones\n\n let backupBones = objects.backupBones\n\n if (backupBones === undefined) {\n backupBones = new Float32Array(bones.length * 7)\n objects.backupBones = backupBones\n }\n\n for (let i = 0, il = bones.length; i < il; i++) {\n const bone = bones[i]\n bone.position.toArray(backupBones, i * 7)\n bone.quaternion.toArray(backupBones, i * 7 + 3)\n }\n }\n\n _restoreBones(mesh) {\n const objects = this.objects.get(mesh)\n\n const backupBones = objects.backupBones\n\n if (backupBones === undefined) return\n\n const bones = mesh.skeleton.bones\n\n for (let i = 0, il = bones.length; i < il; i++) {\n const bone = bones[i]\n bone.position.fromArray(backupBones, i * 7)\n bone.quaternion.fromArray(backupBones, i * 7 + 3)\n }\n }\n\n // experimental\n\n _getMasterPhysics() {\n if (this.masterPhysics !== null) return this.masterPhysics\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const physics = this.meshes[i].physics\n\n if (physics !== undefined && physics !== null) {\n this.masterPhysics = physics\n return this.masterPhysics\n }\n }\n\n return null\n }\n\n _updateSharedPhysics(delta) {\n if (this.meshes.length === 0 || !this.enabled.physics || !this.sharedPhysics) return\n\n const physics = this._getMasterPhysics()\n\n if (physics === null) return\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const p = this.meshes[i].physics\n\n if (p !== null && p !== undefined) {\n p.updateRigidBodies()\n }\n }\n\n physics.stepSimulation(delta)\n\n for (let i = 0, il = this.meshes.length; i < il; i++) {\n const p = this.meshes[i].physics\n\n if (p !== null && p !== undefined) {\n p.updateBones()\n }\n }\n }\n}\n\n// Keep working quaternions for less GC\nconst _quaternions = []\nlet _quaternionIndex = 0\n\nfunction getQuaternion() {\n if (_quaternionIndex >= _quaternions.length) {\n _quaternions.push(new Quaternion())\n }\n\n return _quaternions[_quaternionIndex++]\n}\n\n// Save rotation whose grant and IK are already applied\n// used by grant children\nconst _grantResultMap = new Map()\n\nfunction updateOne(mesh, boneIndex, ikSolver, grantSolver) {\n const bones = mesh.skeleton.bones\n const bonesData = mesh.geometry.userData.MMD.bones\n const boneData = bonesData[boneIndex]\n const bone = bones[boneIndex]\n\n // Return if already updated by being referred as a grant parent.\n if (_grantResultMap.has(boneIndex)) return\n\n const quaternion = getQuaternion()\n\n // Initialize grant result here to prevent infinite loop.\n // If it's referred before updating with actual result later\n // result without applyting IK or grant is gotten\n // but better than composing of infinite loop.\n _grantResultMap.set(boneIndex, quaternion.copy(bone.quaternion))\n\n // @TODO: Support global grant and grant position\n if (grantSolver && boneData.grant && !boneData.grant.isLocal && boneData.grant.affectRotation) {\n const parentIndex = boneData.grant.parentIndex\n const ratio = boneData.grant.ratio\n\n if (!_grantResultMap.has(parentIndex)) {\n updateOne(mesh, parentIndex, ikSolver, grantSolver)\n }\n\n grantSolver.addGrantRotation(bone, _grantResultMap.get(parentIndex), ratio)\n }\n\n if (ikSolver && boneData.ik) {\n // @TODO: Updating world matrices every time solving an IK bone is\n // costly. Optimize if possible.\n mesh.updateMatrixWorld(true)\n ikSolver.updateOne(boneData.ik)\n\n // No confident, but it seems the grant results with ik links should be updated?\n const links = boneData.ik.links\n\n for (let i = 0, il = links.length; i < il; i++) {\n const link = links[i]\n\n if (link.enabled === false) continue\n\n const linkIndex = link.index\n\n if (_grantResultMap.has(linkIndex)) {\n _grantResultMap.set(linkIndex, _grantResultMap.get(linkIndex).copy(bones[linkIndex].quaternion))\n }\n }\n }\n\n // Update with the actual result here\n quaternion.copy(bone.quaternion)\n}\n\n//\n\nclass AudioManager {\n /**\n * @param {THREE.Audio} audio\n * @param {Object} params - (optional)\n * @param {Nuumber} params.delayTime\n */\n constructor(audio, params = {}) {\n this.audio = audio\n\n this.elapsedTime = 0.0\n this.currentTime = 0.0\n this.delayTime = params.delayTime !== undefined ? params.delayTime : 0.0\n\n this.audioDuration = this.audio.buffer.duration\n this.duration = this.audioDuration + this.delayTime\n }\n\n /**\n * @param {Number} delta\n * @return {AudioManager}\n */\n control(delta) {\n this.elapsed += delta\n this.currentTime += delta\n\n if (this._shouldStopAudio()) this.audio.stop()\n if (this._shouldStartAudio()) this.audio.play()\n\n return this\n }\n\n // private methods\n\n _shouldStartAudio() {\n if (this.audio.isPlaying) return false\n\n while (this.currentTime >= this.duration) {\n this.currentTime -= this.duration\n }\n\n if (this.currentTime < this.delayTime) return false\n\n // 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration\n if (this.currentTime - this.delayTime > this.audioDuration) return false\n\n return true\n }\n\n _shouldStopAudio() {\n return this.audio.isPlaying && this.currentTime >= this.duration\n }\n}\n\nconst _q = new Quaternion()\n\n/**\n * Solver for Grant (Fuyo in Japanese. I just google translated because\n * Fuyo may be MMD specific term and may not be common word in 3D CG terms.)\n * Grant propagates a bone's transform to other bones transforms even if\n * they are not children.\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} grants\n */\nclass GrantSolver {\n constructor(mesh, grants = []) {\n this.mesh = mesh\n this.grants = grants\n }\n\n /**\n * Solve all the grant bones\n * @return {GrantSolver}\n */\n update() {\n const grants = this.grants\n\n for (let i = 0, il = grants.length; i < il; i++) {\n this.updateOne(grants[i])\n }\n\n return this\n }\n\n /**\n * Solve a grant bone\n * @param {Object} grant - grant parameter\n * @return {GrantSolver}\n */\n updateOne(grant) {\n const bones = this.mesh.skeleton.bones\n const bone = bones[grant.index]\n const parentBone = bones[grant.parentIndex]\n\n if (grant.isLocal) {\n // TODO: implement\n if (grant.affectPosition) {\n }\n\n // TODO: implement\n if (grant.affectRotation) {\n }\n } else {\n // TODO: implement\n if (grant.affectPosition) {\n }\n\n if (grant.affectRotation) {\n this.addGrantRotation(bone, parentBone.quaternion, grant.ratio)\n }\n }\n\n return this\n }\n\n addGrantRotation(bone, q, ratio) {\n _q.set(0, 0, 0, 1)\n _q.slerp(q, ratio)\n bone.quaternion.multiply(_q)\n\n return this\n }\n}\n\nexport { MMDAnimationHelper }\n", "import {\n Matrix4,\n BufferAttribute,\n InterleavedBufferAttribute,\n Mesh,\n BufferGeometry,\n Material,\n DataTexture,\n IUniform,\n MathUtils,\n RGBAFormat,\n FloatType,\n} from 'three'\n\nconst ID_ATTR_NAME = '_batch_id_'\nconst _identityMatrix = new Matrix4()\nconst _zeroScaleMatrix = new Matrix4().set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)\n\n// Custom shaders\nconst batchingParsVertex = /* glsl */ `\n#ifdef BATCHING\n\tattribute float ${ID_ATTR_NAME};\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\n\t}\n#endif\n`\n\nconst batchingbaseVertex = /* glsl */ `\n#ifdef BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( ${ID_ATTR_NAME} );\n#endif\n`\n\nconst batchingnormalVertex = /* glsl */ `\n#ifdef BATCHING\n\tobjectNormal = vec4( batchingMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( batchingMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif\n`\n\nconst batchingVertex = /* glsl */ `\n#ifdef BATCHING\n\ttransformed = ( batchingMatrix * vec4( transformed, 1.0 ) ).xyz;\n#endif\n`\n\n// @TODO: SkinnedMesh support?\n// @TODO: Future work if needed. Move into the core. Can be optimized more with WEBGL_multi_draw.\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData(\n src: BufferAttribute | InterleavedBufferAttribute,\n target: BufferAttribute | InterleavedBufferAttribute,\n targetOffset = 0,\n): void {\n const itemSize = target.itemSize\n if (\n (src as InterleavedBufferAttribute).isInterleavedBufferAttribute ||\n src.array.constructor !== target.array.constructor\n ) {\n // use the component getters and setters if the array data cannot\n // be copied directly\n const vertexCount = src.count\n for (let i = 0; i < vertexCount; i++) {\n for (let c = 0; c < itemSize; c++) {\n // @ts-ignore\n target.setComponent(i + targetOffset, c, src.getComponent(i, c))\n }\n }\n } else {\n // faster copy approach using typed array set function\n // @ts-ignore\n target.array.set(src.array, targetOffset * itemSize)\n }\n\n target.needsUpdate = true\n}\n\nclass BatchedMesh extends Mesh {\n _vertexStarts: number[]\n _vertexCounts: number[]\n _indexStarts: number[]\n _indexCounts: number[]\n _reservedRanges: { vertexStart: number; vertexCount: number; indexStart: number; indexCount: number }[]\n _visible: boolean[]\n _active: boolean[]\n _maxGeometryCount: number\n _maxVertexCount: number\n _maxIndexCount: number\n _geometryInitialized: boolean\n _geometryCount: number\n _matrices: Matrix4[]\n _matricesTexture: DataTexture | null\n _customUniforms: Record\n\n constructor(\n maxGeometryCount: number,\n maxVertexCount: number,\n maxIndexCount = maxVertexCount * 2,\n material?: Material,\n ) {\n super(new BufferGeometry(), material)\n\n this._vertexStarts = []\n this._vertexCounts = []\n this._indexStarts = []\n this._indexCounts = []\n this._reservedRanges = []\n\n this._visible = []\n this._active = []\n\n this._maxGeometryCount = maxGeometryCount\n this._maxVertexCount = maxVertexCount\n this._maxIndexCount = maxIndexCount\n\n this._geometryInitialized = false\n this._geometryCount = 0\n\n // Local matrix per geometry by using data texture\n // @TODO: Support uniform parameter per geometry\n\n this._matrices = []\n this._matricesTexture = null!\n\n // @TODO: Calculate the entire binding box and make frustumCulled true\n this.frustumCulled = false\n\n this._customUniforms = {\n batchingTexture: { value: null },\n }\n\n this._initMatricesTexture()\n this._initShader()\n\n this.onBeforeRender = function () {\n if (this.material.defines) {\n this.material.defines.BATCHING = true\n }\n\n // @TODO: Implement frustum culling for each geometry\n }\n\n this.onAfterRender = function () {\n if (this.material.defines) {\n this.material.defines.BATCHING = false\n }\n }\n }\n\n _initMatricesTexture(): void {\n // layout (1 matrix = 4 pixels)\n // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n // with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)\n // 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n // 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n // 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n let size = Math.sqrt(this._maxGeometryCount * 4) // 4 pixels needed for 1 matrix\n size = MathUtils.ceilPowerOfTwo(size)\n size = Math.max(size, 4)\n\n const matricesArray = new Float32Array(size * size * 4) // 4 floats per RGBA pixel\n const matricesTexture = new DataTexture(matricesArray, size, size, RGBAFormat, FloatType)\n\n this._matricesTexture = matricesTexture\n this._customUniforms.batchingTexture.value = this._matricesTexture\n }\n\n _initShader(): void {\n const material = this.material\n const currentOnBeforeCompile = material.onBeforeCompile\n const customUniforms = this._customUniforms\n\n material.onBeforeCompile = function onBeforeCompile(parameters, renderer) {\n // Is this replacement stable across any materials?\n parameters.vertexShader = parameters.vertexShader\n .replace('#include ', '#include \\n' + batchingParsVertex)\n .replace('#include ', '#include \\n' + batchingbaseVertex)\n .replace('#include ', '#include \\n' + batchingnormalVertex)\n .replace('#include ', '#include \\n' + batchingVertex)\n\n for (const uniformName in customUniforms) {\n parameters.uniforms[uniformName] = customUniforms[uniformName]\n }\n\n currentOnBeforeCompile.call(this, parameters, renderer)\n }\n\n material.defines = material.defines || {}\n material.defines.BATCHING = false\n }\n\n _initializeGeometry(reference: BufferGeometry): void {\n // @TODO: geometry.groups support?\n // @TODO: geometry.drawRange support?\n // @TODO: geometry.morphAttributes support?\n\n const geometry = this.geometry\n const maxVertexCount = this._maxVertexCount\n const maxGeometryCount = this._maxGeometryCount\n const maxIndexCount = this._maxIndexCount\n if (this._geometryInitialized === false) {\n for (const attributeName in reference.attributes) {\n const srcAttribute = reference.getAttribute(attributeName)\n const { array, itemSize, normalized } = srcAttribute\n\n const dstArray = new (array.constructor as Float32ArrayConstructor)(maxVertexCount * itemSize)\n const dstAttribute = new (srcAttribute.constructor as any)(dstArray, itemSize, normalized)\n\n // TODO: add usage in @types/three\n // @ts-ignore\n dstAttribute.setUsage(srcAttribute.usage)\n\n geometry.setAttribute(attributeName, dstAttribute)\n }\n\n if (reference.getIndex() !== null) {\n const indexArray = maxVertexCount > 65536 ? new Uint32Array(maxIndexCount) : new Uint16Array(maxIndexCount)\n\n geometry.setIndex(new BufferAttribute(indexArray, 1))\n }\n\n const idArray = maxGeometryCount > 65536 ? new Uint32Array(maxVertexCount) : new Uint16Array(maxVertexCount)\n geometry.setAttribute(ID_ATTR_NAME, new BufferAttribute(idArray, 1))\n\n this._geometryInitialized = true\n }\n }\n\n // Make sure the geometry is compatible with the existing combined geometry atributes\n _validateGeometry(geometry: BufferGeometry): void {\n // check that the geometry doesn't have a version of our reserved id attribute\n if (geometry.getAttribute(ID_ATTR_NAME)) {\n throw new Error(`BatchedMesh: Geometry cannot use attribute \"${ID_ATTR_NAME}\"`)\n }\n\n // check to ensure the geometries are using consistent attributes and indices\n const batchGeometry = this.geometry\n if (Boolean(geometry.getIndex()) !== Boolean(batchGeometry.getIndex())) {\n throw new Error('BatchedMesh: All geometries must consistently have \"index\".')\n }\n\n for (const attributeName in batchGeometry.attributes) {\n if (attributeName === ID_ATTR_NAME) {\n continue\n }\n\n if (!geometry.hasAttribute(attributeName)) {\n throw new Error(\n `BatchedMesh: Added geometry missing \"${attributeName}\". All geometries must have consistent attributes.`,\n )\n }\n\n const srcAttribute = geometry.getAttribute(attributeName)\n const dstAttribute = batchGeometry.getAttribute(attributeName)\n if (srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized) {\n throw new Error('BatchedMesh: All attributes must have a consistent itemSize and normalized value.')\n }\n }\n }\n\n getGeometryCount(): number {\n return this._geometryCount\n }\n\n getVertexCount(): number {\n const reservedRanges = this._reservedRanges\n if (reservedRanges.length === 0) {\n return 0\n } else {\n const finalRange = reservedRanges[reservedRanges.length - 1]\n return finalRange.vertexStart + finalRange.vertexCount\n }\n }\n\n getIndexCount(): number {\n const reservedRanges = this._reservedRanges\n const geometry = this.geometry\n if (geometry.getIndex() === null || reservedRanges.length === 0) {\n return 0\n } else {\n const finalRange = reservedRanges[reservedRanges.length - 1]\n return finalRange.indexStart + finalRange.indexCount\n }\n }\n\n addGeometry(geometry: BufferGeometry, vertexCount = -1, indexCount = -1): number {\n this._initializeGeometry(geometry)\n\n this._validateGeometry(geometry)\n\n // ensure we're not over geometry\n if (this._geometryCount >= this._maxGeometryCount) {\n throw new Error('BatchedMesh: Maximum geometry count reached.')\n }\n\n // get the necessary range fo the geometry\n const range = {\n vertexStart: -1,\n vertexCount: -1,\n indexStart: -1,\n indexCount: -1,\n }\n\n let lastRange = null\n const reservedRanges = this._reservedRanges\n if (this._geometryCount !== 0) {\n lastRange = reservedRanges[reservedRanges.length - 1]\n }\n\n if (vertexCount === -1) {\n range.vertexCount = geometry.getAttribute('position').count\n } else {\n range.vertexCount = vertexCount\n }\n\n if (lastRange === null) {\n range.vertexStart = 0\n } else {\n range.vertexStart = lastRange.vertexStart + lastRange.vertexCount\n }\n\n if (geometry.getIndex() !== null) {\n if (indexCount === -1) {\n range.indexCount = geometry.getIndex()!.count\n } else {\n range.indexCount = indexCount\n }\n\n if (lastRange === null) {\n range.indexStart = 0\n } else {\n range.indexStart = lastRange.indexStart + lastRange.indexCount\n }\n }\n\n if (\n (range.indexStart !== -1 && range.indexStart + range.indexCount > this._maxIndexCount) ||\n range.vertexStart + range.vertexCount > this._maxVertexCount\n ) {\n throw new Error('BatchedMesh: Reserved space request exceeds the maximum buffer size.')\n }\n\n const indexCounts = this._indexCounts\n const indexStarts = this._indexStarts\n const vertexCounts = this._vertexCounts\n const vertexStarts = this._vertexStarts\n\n const visible = this._visible\n const active = this._active\n const matricesTexture = this._matricesTexture\n const matrices = this._matrices\n const matricesArray = this._matricesTexture!.image.data\n\n // push new visibility states\n visible.push(true)\n active.push(true)\n\n // update id\n const geometryId = this._geometryCount\n this._geometryCount++\n\n // initialize matrix information\n matrices.push(new Matrix4())\n _identityMatrix.toArray(matricesArray, geometryId * 16)\n matricesTexture!.needsUpdate = true\n\n // add the reserved range\n reservedRanges.push(range)\n\n // push new geometry data range\n vertexStarts.push(range.vertexStart)\n vertexCounts.push(range.vertexCount)\n\n if (geometry.getIndex() !== null) {\n // push new index range\n indexStarts.push(range.indexCount)\n indexCounts.push(range.indexCount)\n }\n\n // set the id for the geometry\n const idAttribute = this.geometry.getAttribute(ID_ATTR_NAME)\n for (let i = 0; i < range.vertexCount; i++) {\n idAttribute.setX(range.vertexStart + i, geometryId)\n }\n\n idAttribute.needsUpdate = true\n\n // update the geometry\n this.setGeometryAt(geometryId, geometry)\n\n return geometryId\n }\n\n /**\n * @deprecated use `addGeometry` instead.\n */\n applyGeometry(geometry: BufferGeometry): number {\n return this.addGeometry(geometry)\n }\n\n setGeometryAt(id: number, geometry: BufferGeometry): number {\n if (id >= this._geometryCount) {\n throw new Error('BatchedMesh: Maximum geometry count reached.')\n }\n\n this._validateGeometry(geometry)\n\n const range = this._reservedRanges[id]\n if (\n (geometry.getIndex() !== null && geometry.getIndex()!.count > range.indexCount) ||\n geometry.attributes.position.count > range.vertexCount\n ) {\n throw new Error('BatchedMesh: Reserved space not large enough for provided geometry.')\n }\n\n // copy geometry over\n const batchGeometry = this.geometry\n const srcPositionAttribute = geometry.getAttribute('position')\n const hasIndex = batchGeometry.getIndex() !== null\n const dstIndex = batchGeometry.getIndex()!\n const srcIndex = geometry.getIndex()!\n\n // copy attribute data over\n const vertexStart = range.vertexStart\n const vertexCount = range.vertexCount\n for (const attributeName in batchGeometry.attributes) {\n if (attributeName === ID_ATTR_NAME) {\n continue\n }\n\n const srcAttribute = geometry.getAttribute(attributeName)\n const dstAttribute = batchGeometry.getAttribute(attributeName)\n copyAttributeData(srcAttribute, dstAttribute, vertexStart)\n\n // fill the rest in with zeroes\n const itemSize = srcAttribute.itemSize\n for (let i = srcAttribute.count, l = vertexCount; i < l; i++) {\n const index = vertexStart + i\n for (let c = 0; c < itemSize; c++) {\n // @ts-ignore\n dstAttribute.setComponent(index, c, 0)\n }\n }\n\n dstAttribute.needsUpdate = true\n }\n\n this._vertexCounts[id] = srcPositionAttribute.count\n\n if (hasIndex) {\n // fill the rest in with zeroes\n const indexStart = range.indexStart\n\n // copy index data over\n for (let i = 0; i < srcIndex.count; i++) {\n dstIndex.setX(indexStart + i, vertexStart + srcIndex.getX(i))\n }\n\n // fill the rest in with zeroes\n for (let i = srcIndex.count, l = range.indexCount; i < l; i++) {\n dstIndex.setX(indexStart + i, vertexStart)\n }\n\n dstIndex.needsUpdate = true\n this._indexCounts[id] = srcIndex.count\n }\n\n return id\n }\n\n deleteGeometry(geometryId: number): this {\n // Note: User needs to call optimize() afterward to pack the data.\n\n const active = this._active\n const matricesTexture = this._matricesTexture!\n const matricesArray = matricesTexture.image.data\n if (geometryId >= active.length || active[geometryId] === false) {\n return this\n }\n\n active[geometryId] = false\n _zeroScaleMatrix.toArray(matricesArray, geometryId * 16)\n matricesTexture!.needsUpdate = true\n\n return this\n }\n\n optimize(): never {\n throw new Error('BatchedMesh: Optimize function not implemented.')\n }\n\n setMatrixAt(geometryId: number, matrix: Matrix4): this {\n // @TODO: Map geometryId to index of the arrays because\n // optimize() can make geometryId mismatch the index\n\n const visible = this._visible\n const active = this._active\n const matricesTexture = this._matricesTexture!\n const matrices = this._matrices\n const matricesArray = matricesTexture.image.data\n if (geometryId >= matrices.length || active[geometryId] === false) {\n return this\n }\n\n if (visible[geometryId] === true) {\n matrix.toArray(matricesArray, geometryId * 16)\n matricesTexture.needsUpdate = true\n }\n\n matrices[geometryId].copy(matrix)\n\n return this\n }\n\n getMatrixAt(geometryId: number, matrix: Matrix4): Matrix4 {\n const matrices = this._matrices\n const active = this._active\n if (geometryId >= matrices.length || active[geometryId] === false) {\n return matrix\n }\n\n return matrix.copy(matrices[geometryId])\n }\n\n setVisibleAt(geometryId: number, value: boolean): this {\n const visible = this._visible\n const active = this._active\n const matricesTexture = this._matricesTexture!\n const matrices = this._matrices\n const matricesArray = matricesTexture.image.data\n\n // if the geometry is out of range, not active, or visibility state\n // does not change then return early\n if (geometryId >= visible.length || active[geometryId] === false || visible[geometryId] === value) {\n return this\n }\n\n // scale the matrix to zero if it's hidden\n if (value === true) {\n matrices[geometryId].toArray(matricesArray, geometryId * 16)\n } else {\n _zeroScaleMatrix.toArray(matricesArray, geometryId * 16)\n }\n\n matricesTexture.needsUpdate = true\n visible[geometryId] = value\n\n return this\n }\n\n getVisibleAt(geometryId: number): boolean {\n const visible = this._visible\n const active = this._active\n\n // return early if the geometry is out of range or not active\n if (geometryId >= visible.length || active[geometryId] === false) {\n return false\n }\n\n return visible[geometryId]\n }\n\n raycast(): void {\n console.warn('BatchedMesh: Raycast function not implemented.')\n }\n\n copy(): never {\n // super.copy( source );\n\n throw new Error('BatchedMesh: Copy function not implemented.')\n }\n\n toJSON(): never {\n throw new Error('BatchedMesh: toJSON function not implemented.')\n }\n\n dispose(): this {\n // Assuming the geometry is not shared with other meshes\n this.geometry.dispose()\n\n this._matricesTexture!.dispose()\n this._matricesTexture = null!\n\n return this\n }\n}\n\nexport { BatchedMesh }\n", "import {\n Color,\n Matrix4,\n Mesh,\n PerspectiveCamera,\n Plane,\n ShaderMaterial,\n UniformsUtils,\n Vector3,\n Vector4,\n WebGLRenderTarget,\n HalfFloatType,\n NoToneMapping,\n} from 'three'\nimport { version } from '../_polyfill/constants'\n\nclass Reflector extends Mesh {\n static ReflectorShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n tDiffuse: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n },\n\n vertexShader: /* glsl */ `\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\t\t#include \n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t#include \n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\n\t\t}`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isReflector = true\n\n this.type = 'Reflector'\n this.camera = new PerspectiveCamera()\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0x7f7f7f)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const shader = options.shader || Reflector.ReflectorShader\n const multisample = options.multisample !== undefined ? options.multisample : 4\n\n //\n\n const reflectorPlane = new Plane()\n const normal = new Vector3()\n const reflectorWorldPosition = new Vector3()\n const cameraWorldPosition = new Vector3()\n const rotationMatrix = new Matrix4()\n const lookAtPosition = new Vector3(0, 0, -1)\n const clipPlane = new Vector4()\n\n const view = new Vector3()\n const target = new Vector3()\n const q = new Vector4()\n\n const textureMatrix = new Matrix4()\n const virtualCamera = this.camera\n\n const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight, {\n samples: multisample,\n type: HalfFloatType,\n })\n\n const material = new ShaderMaterial({\n uniforms: UniformsUtils.clone(shader.uniforms),\n fragmentShader: shader.fragmentShader,\n vertexShader: shader.vertexShader,\n })\n\n material.uniforms['tDiffuse'].value = renderTarget.texture\n material.uniforms['color'].value = color\n material.uniforms['textureMatrix'].value = textureMatrix\n\n this.material = material\n\n this.onBeforeRender = function (renderer, scene, camera) {\n reflectorWorldPosition.setFromMatrixPosition(scope.matrixWorld)\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld)\n\n rotationMatrix.extractRotation(scope.matrixWorld)\n\n normal.set(0, 0, 1)\n normal.applyMatrix4(rotationMatrix)\n\n view.subVectors(reflectorWorldPosition, cameraWorldPosition)\n\n // Avoid rendering when reflector is facing away\n\n if (view.dot(normal) > 0) return\n\n view.reflect(normal).negate()\n view.add(reflectorWorldPosition)\n\n rotationMatrix.extractRotation(camera.matrixWorld)\n\n lookAtPosition.set(0, 0, -1)\n lookAtPosition.applyMatrix4(rotationMatrix)\n lookAtPosition.add(cameraWorldPosition)\n\n target.subVectors(reflectorWorldPosition, lookAtPosition)\n target.reflect(normal).negate()\n target.add(reflectorWorldPosition)\n\n virtualCamera.position.copy(view)\n virtualCamera.up.set(0, 1, 0)\n virtualCamera.up.applyMatrix4(rotationMatrix)\n virtualCamera.up.reflect(normal)\n virtualCamera.lookAt(target)\n\n virtualCamera.far = camera.far // Used in WebGLBackground\n\n virtualCamera.updateMatrixWorld()\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix)\n\n // Update the texture matrix\n textureMatrix.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 textureMatrix.multiply(virtualCamera.projectionMatrix)\n textureMatrix.multiply(virtualCamera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n\n // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html\n // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf\n reflectorPlane.setFromNormalAndCoplanarPoint(normal, reflectorWorldPosition)\n reflectorPlane.applyMatrix4(virtualCamera.matrixWorldInverse)\n\n clipPlane.set(reflectorPlane.normal.x, reflectorPlane.normal.y, reflectorPlane.normal.z, reflectorPlane.constant)\n\n const projectionMatrix = virtualCamera.projectionMatrix\n\n q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0]\n q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5]\n q.z = -1.0\n q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14]\n\n // Calculate the scaled plane vector\n clipPlane.multiplyScalar(2.0 / clipPlane.dot(q))\n\n // Replacing the third row of the projection matrix\n projectionMatrix.elements[2] = clipPlane.x\n projectionMatrix.elements[6] = clipPlane.y\n projectionMatrix.elements[10] = clipPlane.z + 1.0 - clipBias\n projectionMatrix.elements[14] = clipPlane.w\n\n // Render\n scope.visible = false\n\n const currentRenderTarget = renderer.getRenderTarget()\n\n const currentXrEnabled = renderer.xr.enabled\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate\n const currentToneMapping = renderer.toneMapping\n\n let isSRGB = false\n if ('outputColorSpace' in renderer) isSRGB = renderer.outputColorSpace === 'srgb'\n else isSRGB = renderer.outputEncoding === 3001 // sRGBEncoding\n\n renderer.xr.enabled = false // Avoid camera modification\n renderer.shadowMap.autoUpdate = false // Avoid re-computing shadows\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'srgb-linear'\n else renderer.outputEncoding = 3000 // LinearEncoding\n renderer.toneMapping = NoToneMapping\n\n renderer.setRenderTarget(renderTarget)\n\n renderer.state.buffers.depth.setMask(true) // make sure the depth buffer is writable so it can be properly cleared, see #18897\n\n if (renderer.autoClear === false) renderer.clear()\n renderer.render(scene, virtualCamera)\n\n renderer.xr.enabled = currentXrEnabled\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate\n renderer.toneMapping = currentToneMapping\n\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = isSRGB ? 'srgb' : 'srgb-linear'\n else renderer.outputEncoding = isSRGB ? 3001 : 3000\n\n renderer.setRenderTarget(currentRenderTarget)\n\n // Restore viewport\n\n const viewport = camera.viewport\n\n if (viewport !== undefined) {\n renderer.state.viewport(viewport)\n }\n\n scope.visible = true\n }\n\n this.getRenderTarget = function () {\n return renderTarget\n }\n\n this.dispose = function () {\n renderTarget.dispose()\n scope.material.dispose()\n }\n }\n}\n\nexport { Reflector }\n", "import {\n Color,\n Matrix4,\n Mesh,\n PerspectiveCamera,\n Plane,\n Quaternion,\n ShaderMaterial,\n UniformsUtils,\n Vector3,\n Vector4,\n WebGLRenderTarget,\n NoToneMapping,\n HalfFloatType,\n} from 'three'\nimport { version } from '../_polyfill/constants'\n\nclass Refractor extends Mesh {\n static RefractorShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n tDiffuse: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n },\n\n vertexShader: /* glsl */ `\n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec4 vUv;\n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\n\t\t}`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isRefractor = true\n\n this.type = 'Refractor'\n this.camera = new PerspectiveCamera()\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0x7f7f7f)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const shader = options.shader || Refractor.RefractorShader\n const multisample = options.multisample !== undefined ? options.multisample : 4\n\n //\n\n const virtualCamera = this.camera\n virtualCamera.matrixAutoUpdate = false\n virtualCamera.userData.refractor = true\n\n //\n\n const refractorPlane = new Plane()\n const textureMatrix = new Matrix4()\n\n // render target\n\n const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight, {\n samples: multisample,\n type: HalfFloatType,\n })\n\n // material\n\n this.material = new ShaderMaterial({\n uniforms: UniformsUtils.clone(shader.uniforms),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n transparent: true, // ensures, refractors are drawn from farthest to closest\n })\n\n this.material.uniforms['color'].value = color\n this.material.uniforms['tDiffuse'].value = renderTarget.texture\n this.material.uniforms['textureMatrix'].value = textureMatrix\n\n // functions\n\n const visible = (function () {\n const refractorWorldPosition = new Vector3()\n const cameraWorldPosition = new Vector3()\n const rotationMatrix = new Matrix4()\n\n const view = new Vector3()\n const normal = new Vector3()\n\n return function visible(camera) {\n refractorWorldPosition.setFromMatrixPosition(scope.matrixWorld)\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld)\n\n view.subVectors(refractorWorldPosition, cameraWorldPosition)\n\n rotationMatrix.extractRotation(scope.matrixWorld)\n\n normal.set(0, 0, 1)\n normal.applyMatrix4(rotationMatrix)\n\n return view.dot(normal) < 0\n }\n })()\n\n const updateRefractorPlane = (function () {\n const normal = new Vector3()\n const position = new Vector3()\n const quaternion = new Quaternion()\n const scale = new Vector3()\n\n return function updateRefractorPlane() {\n scope.matrixWorld.decompose(position, quaternion, scale)\n normal.set(0, 0, 1).applyQuaternion(quaternion).normalize()\n\n // flip the normal because we want to cull everything above the plane\n\n normal.negate()\n\n refractorPlane.setFromNormalAndCoplanarPoint(normal, position)\n }\n })()\n\n const updateVirtualCamera = (function () {\n const clipPlane = new Plane()\n const clipVector = new Vector4()\n const q = new Vector4()\n\n return function updateVirtualCamera(camera) {\n virtualCamera.matrixWorld.copy(camera.matrixWorld)\n virtualCamera.matrixWorldInverse.copy(virtualCamera.matrixWorld).invert()\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix)\n virtualCamera.far = camera.far // used in WebGLBackground\n\n // The following code creates an oblique view frustum for clipping.\n // see: Lengyel, Eric. “Oblique View Frustum Depth Projection and Clipping”.\n // Journal of Game Development, Vol. 1, No. 2 (2005), Charles River Media, pp. 5–16\n\n clipPlane.copy(refractorPlane)\n clipPlane.applyMatrix4(virtualCamera.matrixWorldInverse)\n\n clipVector.set(clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.constant)\n\n // calculate the clip-space corner point opposite the clipping plane and\n // transform it into camera space by multiplying it by the inverse of the projection matrix\n\n const projectionMatrix = virtualCamera.projectionMatrix\n\n q.x = (Math.sign(clipVector.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0]\n q.y = (Math.sign(clipVector.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5]\n q.z = -1.0\n q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14]\n\n // calculate the scaled plane vector\n\n clipVector.multiplyScalar(2.0 / clipVector.dot(q))\n\n // replacing the third row of the projection matrix\n\n projectionMatrix.elements[2] = clipVector.x\n projectionMatrix.elements[6] = clipVector.y\n projectionMatrix.elements[10] = clipVector.z + 1.0 - clipBias\n projectionMatrix.elements[14] = clipVector.w\n }\n })()\n\n // This will update the texture matrix that is used for projective texture mapping in the shader.\n // see: http://developer.download.nvidia.com/assets/gamedev/docs/projective_texture_mapping.pdf\n\n function updateTextureMatrix(camera) {\n // this matrix does range mapping to [ 0, 1 ]\n\n textureMatrix.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\n // we use \"Object Linear Texgen\", so we need to multiply the texture matrix T\n // (matrix above) with the projection and view matrix of the virtual camera\n // and the model matrix of the refractor\n\n textureMatrix.multiply(camera.projectionMatrix)\n textureMatrix.multiply(camera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n }\n\n //\n\n function render(renderer, scene, camera) {\n scope.visible = false\n\n const currentRenderTarget = renderer.getRenderTarget()\n const currentXrEnabled = renderer.xr.enabled\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate\n const currentToneMapping = renderer.toneMapping\n\n let isSRGB = false\n if ('outputColorSpace' in renderer) isSRGB = renderer.outputColorSpace === 'srgb'\n else isSRGB = renderer.outputEncoding === 3001 // sRGBEncoding\n\n renderer.xr.enabled = false // avoid camera modification\n renderer.shadowMap.autoUpdate = false // avoid re-computing shadows\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'srgb-linear'\n else renderer.outputEncoding = 3000 // LinearEncoding\n renderer.toneMapping = NoToneMapping\n\n renderer.setRenderTarget(renderTarget)\n if (renderer.autoClear === false) renderer.clear()\n renderer.render(scene, virtualCamera)\n\n renderer.xr.enabled = currentXrEnabled\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate\n renderer.toneMapping = currentToneMapping\n renderer.setRenderTarget(currentRenderTarget)\n\n if ('outputColorSpace' in renderer) renderer.outputColorSpace = isSRGB ? 'srgb' : 'srgb-linear'\n else renderer.outputEncoding = isSRGB ? 3001 : 3000\n\n // restore viewport\n\n const viewport = camera.viewport\n\n if (viewport !== undefined) {\n renderer.state.viewport(viewport)\n }\n\n scope.visible = true\n }\n\n //\n\n this.onBeforeRender = function (renderer, scene, camera) {\n // ensure refractors are rendered only once per frame\n\n if (camera.userData.refractor === true) return\n\n // avoid rendering when the refractor is viewed from behind\n\n if (!visible(camera) === true) return\n\n // update\n\n updateRefractorPlane()\n\n updateTextureMatrix(camera)\n\n updateVirtualCamera(camera)\n\n render(renderer, scene, camera)\n }\n\n this.getRenderTarget = function () {\n return renderTarget\n }\n\n this.dispose = function () {\n renderTarget.dispose()\n scope.material.dispose()\n }\n }\n}\n\nexport { Refractor }\n", "import { Matrix4, Mesh, MeshBasicMaterial, EqualStencilFunc, IncrementStencilOp } from 'three'\n\n/**\n * A shadow Mesh that follows a shadow-casting Mesh in the scene, but is confined to a single plane.\n */\n\nconst _shadowMatrix = new Matrix4()\n\nclass ShadowMesh extends Mesh {\n constructor(mesh) {\n const shadowMaterial = new MeshBasicMaterial({\n color: 0x000000,\n transparent: true,\n opacity: 0.6,\n depthWrite: false,\n stencilWrite: true,\n stencilFunc: EqualStencilFunc,\n stencilRef: 0,\n stencilZPass: IncrementStencilOp,\n })\n\n super(mesh.geometry, shadowMaterial)\n\n this.isShadowMesh = true\n\n this.meshMatrix = mesh.matrixWorld\n\n this.frustumCulled = false\n this.matrixAutoUpdate = false\n }\n\n update(plane, lightPosition4D) {\n // based on https://www.opengl.org/archives/resources/features/StencilTalk/tsld021.htm\n\n const dot =\n plane.normal.x * lightPosition4D.x +\n plane.normal.y * lightPosition4D.y +\n plane.normal.z * lightPosition4D.z +\n -plane.constant * lightPosition4D.w\n\n const sme = _shadowMatrix.elements\n\n sme[0] = dot - lightPosition4D.x * plane.normal.x\n sme[4] = -lightPosition4D.x * plane.normal.y\n sme[8] = -lightPosition4D.x * plane.normal.z\n sme[12] = -lightPosition4D.x * -plane.constant\n\n sme[1] = -lightPosition4D.y * plane.normal.x\n sme[5] = dot - lightPosition4D.y * plane.normal.y\n sme[9] = -lightPosition4D.y * plane.normal.z\n sme[13] = -lightPosition4D.y * -plane.constant\n\n sme[2] = -lightPosition4D.z * plane.normal.x\n sme[6] = -lightPosition4D.z * plane.normal.y\n sme[10] = dot - lightPosition4D.z * plane.normal.z\n sme[14] = -lightPosition4D.z * -plane.constant\n\n sme[3] = -lightPosition4D.w * plane.normal.x\n sme[7] = -lightPosition4D.w * plane.normal.y\n sme[11] = -lightPosition4D.w * plane.normal.z\n sme[15] = dot - lightPosition4D.w * -plane.constant\n\n this.matrix.multiplyMatrices(_shadowMatrix, this.meshMatrix)\n }\n}\n\nexport { ShadowMesh }\n", "import {\n AdditiveBlending,\n Box2,\n BufferGeometry,\n ClampToEdgeWrapping,\n Color,\n DataTexture,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n Mesh,\n MeshBasicMaterial,\n NearestFilter,\n RGBAFormat,\n RawShaderMaterial,\n Vector2,\n Vector3,\n Vector4,\n} from 'three'\n\nconst geometry = new BufferGeometry()\n\nconst float32Array = new Float32Array([-1, -1, 0, 0, 0, 1, -1, 0, 1, 0, 1, 1, 0, 1, 1, -1, 1, 0, 0, 1])\n\nconst interleavedBuffer = new InterleavedBuffer(float32Array, 5)\n\ngeometry.setIndex([0, 1, 2, 0, 2, 3])\ngeometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false))\ngeometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false))\n\nclass Lensflare extends Mesh {\n static Geometry = geometry\n\n constructor() {\n super(Lensflare.Geometry, new MeshBasicMaterial({ opacity: 0, transparent: true }))\n\n this.isLensflare = true\n\n this.type = 'Lensflare'\n this.frustumCulled = false\n this.renderOrder = Infinity\n\n //\n\n const positionScreen = new Vector3()\n const positionView = new Vector3()\n\n // textures\n const tempMap = new DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, RGBAFormat)\n tempMap.minFilter = NearestFilter\n tempMap.magFilter = NearestFilter\n tempMap.wrapS = ClampToEdgeWrapping\n tempMap.wrapT = ClampToEdgeWrapping\n\n const occlusionMap = new DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, RGBAFormat)\n occlusionMap.minFilter = NearestFilter\n occlusionMap.magFilter = NearestFilter\n occlusionMap.wrapS = ClampToEdgeWrapping\n occlusionMap.wrapT = ClampToEdgeWrapping\n\n // material\n\n const geometry = Lensflare.Geometry\n\n const material1a = new RawShaderMaterial({\n uniforms: {\n scale: { value: null },\n screenPosition: { value: null },\n },\n vertexShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n\n\t\t\t\t}`,\n depthTest: true,\n depthWrite: false,\n transparent: false,\n })\n\n const material1b = new RawShaderMaterial({\n uniforms: {\n map: { value: tempMap },\n scale: { value: null },\n screenPosition: { value: null },\n },\n vertexShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\t\t\t\tattribute vec2 uv;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUV = uv;\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform sampler2D map;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = texture2D( map, vUV );\n\n\t\t\t\t}`,\n depthTest: false,\n depthWrite: false,\n transparent: false,\n })\n\n // the following object is used for occlusionMap generation\n\n const mesh1 = new Mesh(geometry, material1a)\n\n //\n\n const elements = []\n\n const shader = LensflareElement.Shader\n\n const material2 = new RawShaderMaterial({\n uniforms: {\n map: { value: null },\n occlusionMap: { value: occlusionMap },\n color: { value: new Color(0xffffff) },\n scale: { value: new Vector2() },\n screenPosition: { value: new Vector3() },\n },\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n blending: AdditiveBlending,\n transparent: true,\n depthWrite: false,\n })\n\n const mesh2 = new Mesh(geometry, material2)\n\n this.addElement = function (element) {\n elements.push(element)\n }\n\n //\n\n const scale = new Vector2()\n const screenPositionPixels = new Vector2()\n const validArea = new Box2()\n const viewport = new Vector4()\n\n this.onBeforeRender = function (renderer, scene, camera) {\n renderer.getCurrentViewport(viewport)\n\n const invAspect = viewport.w / viewport.z\n const halfViewportWidth = viewport.z / 2.0\n const halfViewportHeight = viewport.w / 2.0\n\n let size = 16 / viewport.w\n scale.set(size * invAspect, size)\n\n validArea.min.set(viewport.x, viewport.y)\n validArea.max.set(viewport.x + (viewport.z - 16), viewport.y + (viewport.w - 16))\n\n // calculate position in screen space\n\n positionView.setFromMatrixPosition(this.matrixWorld)\n positionView.applyMatrix4(camera.matrixWorldInverse)\n\n if (positionView.z > 0) return // lensflare is behind the camera\n\n positionScreen.copy(positionView).applyMatrix4(camera.projectionMatrix)\n\n // horizontal and vertical coordinate of the lower left corner of the pixels to copy\n\n screenPositionPixels.x = viewport.x + positionScreen.x * halfViewportWidth + halfViewportWidth - 8\n screenPositionPixels.y = viewport.y + positionScreen.y * halfViewportHeight + halfViewportHeight - 8\n\n // screen cull\n\n if (validArea.containsPoint(screenPositionPixels)) {\n // save current RGB to temp texture\n\n renderer.copyFramebufferToTexture(screenPositionPixels, tempMap)\n\n // render pink quad\n\n let uniforms = material1a.uniforms\n uniforms['scale'].value = scale\n uniforms['screenPosition'].value = positionScreen\n\n renderer.renderBufferDirect(camera, null, geometry, material1a, mesh1, null)\n\n // copy result to occlusionMap\n\n renderer.copyFramebufferToTexture(screenPositionPixels, occlusionMap)\n\n // restore graphics\n\n uniforms = material1b.uniforms\n uniforms['scale'].value = scale\n uniforms['screenPosition'].value = positionScreen\n\n renderer.renderBufferDirect(camera, null, geometry, material1b, mesh1, null)\n\n // render elements\n\n const vecX = -positionScreen.x * 2\n const vecY = -positionScreen.y * 2\n\n for (let i = 0, l = elements.length; i < l; i++) {\n const element = elements[i]\n\n const uniforms = material2.uniforms\n\n uniforms['color'].value.copy(element.color)\n uniforms['map'].value = element.texture\n uniforms['screenPosition'].value.x = positionScreen.x + vecX * element.distance\n uniforms['screenPosition'].value.y = positionScreen.y + vecY * element.distance\n\n size = element.size / viewport.w\n const invAspect = viewport.w / viewport.z\n\n uniforms['scale'].value.set(size * invAspect, size)\n\n material2.uniformsNeedUpdate = true\n\n renderer.renderBufferDirect(camera, null, geometry, material2, mesh2, null)\n }\n }\n }\n\n this.dispose = function () {\n material1a.dispose()\n material1b.dispose()\n material2.dispose()\n\n tempMap.dispose()\n occlusionMap.dispose()\n\n for (let i = 0, l = elements.length; i < l; i++) {\n elements[i].texture.dispose()\n }\n }\n }\n}\n\n//\n\nclass LensflareElement {\n static Shader = {\n uniforms: {\n map: { value: null },\n occlusionMap: { value: null },\n color: { value: null },\n scale: { value: null },\n screenPosition: { value: null },\n },\n\n vertexShader: /* glsl */ `\n\n\t\tprecision highp float;\n\n\t\tuniform vec3 screenPosition;\n\t\tuniform vec2 scale;\n\n\t\tuniform sampler2D occlusionMap;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvUV = uv;\n\n\t\t\tvec2 pos = position.xy;\n\n\t\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\n\n\t\t\tvVisibility = visibility.r / 9.0;\n\t\t\tvVisibility *= 1.0 - visibility.g / 9.0;\n\t\t\tvVisibility *= visibility.b / 9.0;\n\n\t\t\tgl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\tprecision highp float;\n\n\t\tuniform sampler2D map;\n\t\tuniform vec3 color;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texture = texture2D( map, vUV );\n\t\t\ttexture.a *= vVisibility;\n\t\t\tgl_FragColor = texture;\n\t\t\tgl_FragColor.rgb *= color;\n\n\t\t}`,\n }\n\n constructor(texture, size = 1, distance = 0, color = new Color(0xffffff)) {\n this.texture = texture\n this.size = size\n this.distance = distance\n this.color = color\n }\n}\n\nexport { Lensflare, LensflareElement }\n", "import { BufferAttribute, BufferGeometry, Color, DynamicDrawUsage, Mesh, Sphere, Vector3 } from 'three'\n\n/**\n * Port of http://webglsamples.org/blob/blob.html\n */\n\nclass MarchingCubes extends Mesh {\n constructor(resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000) {\n const geometry = new BufferGeometry()\n\n super(geometry, material)\n\n this.isMarchingCubes = true\n\n const scope = this\n\n // temp buffers used in polygonize\n\n const vlist = new Float32Array(12 * 3)\n const nlist = new Float32Array(12 * 3)\n const clist = new Float32Array(12 * 3)\n\n this.enableUvs = enableUvs\n this.enableColors = enableColors\n\n // functions have to be object properties\n // prototype functions kill performance\n // (tested and it was 4x slower !!!)\n\n this.init = function (resolution) {\n this.resolution = resolution\n\n // parameters\n\n this.isolation = 80.0\n\n // size of field, 32 is pushing it in Javascript :)\n\n this.size = resolution\n this.size2 = this.size * this.size\n this.size3 = this.size2 * this.size\n this.halfsize = this.size / 2.0\n\n // deltas\n\n this.delta = 2.0 / this.size\n this.yd = this.size\n this.zd = this.size2\n\n this.field = new Float32Array(this.size3)\n this.normal_cache = new Float32Array(this.size3 * 3)\n this.palette = new Float32Array(this.size3 * 3)\n\n //\n\n this.count = 0\n\n const maxVertexCount = maxPolyCount * 3\n\n this.positionArray = new Float32Array(maxVertexCount * 3)\n const positionAttribute = new BufferAttribute(this.positionArray, 3)\n positionAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('position', positionAttribute)\n\n this.normalArray = new Float32Array(maxVertexCount * 3)\n const normalAttribute = new BufferAttribute(this.normalArray, 3)\n normalAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('normal', normalAttribute)\n\n if (this.enableUvs) {\n this.uvArray = new Float32Array(maxVertexCount * 2)\n const uvAttribute = new BufferAttribute(this.uvArray, 2)\n uvAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('uv', uvAttribute)\n }\n\n if (this.enableColors) {\n this.colorArray = new Float32Array(maxVertexCount * 3)\n const colorAttribute = new BufferAttribute(this.colorArray, 3)\n colorAttribute.setUsage(DynamicDrawUsage)\n geometry.setAttribute('color', colorAttribute)\n }\n\n geometry.boundingSphere = new Sphere(new Vector3(), 1)\n }\n\n ///////////////////////\n // Polygonization\n ///////////////////////\n\n function lerp(a, b, t) {\n return a + (b - a) * t\n }\n\n function VIntX(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1),\n nc = scope.normal_cache\n\n vlist[offset + 0] = x + mu * scope.delta\n vlist[offset + 1] = y\n vlist[offset + 2] = z\n\n nlist[offset + 0] = lerp(nc[q + 0], nc[q + 3], mu)\n nlist[offset + 1] = lerp(nc[q + 1], nc[q + 4], mu)\n nlist[offset + 2] = lerp(nc[q + 2], nc[q + 5], mu)\n\n clist[offset + 0] = lerp(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu)\n clist[offset + 1] = lerp(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu)\n clist[offset + 2] = lerp(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu)\n }\n\n function VIntY(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1),\n nc = scope.normal_cache\n\n vlist[offset + 0] = x\n vlist[offset + 1] = y + mu * scope.delta\n vlist[offset + 2] = z\n\n const q2 = q + scope.yd * 3\n\n nlist[offset + 0] = lerp(nc[q + 0], nc[q2 + 0], mu)\n nlist[offset + 1] = lerp(nc[q + 1], nc[q2 + 1], mu)\n nlist[offset + 2] = lerp(nc[q + 2], nc[q2 + 2], mu)\n\n clist[offset + 0] = lerp(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu)\n clist[offset + 1] = lerp(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu)\n clist[offset + 2] = lerp(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu)\n }\n\n function VIntZ(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1),\n nc = scope.normal_cache\n\n vlist[offset + 0] = x\n vlist[offset + 1] = y\n vlist[offset + 2] = z + mu * scope.delta\n\n const q2 = q + scope.zd * 3\n\n nlist[offset + 0] = lerp(nc[q + 0], nc[q2 + 0], mu)\n nlist[offset + 1] = lerp(nc[q + 1], nc[q2 + 1], mu)\n nlist[offset + 2] = lerp(nc[q + 2], nc[q2 + 2], mu)\n\n clist[offset + 0] = lerp(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu)\n clist[offset + 1] = lerp(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu)\n clist[offset + 2] = lerp(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu)\n }\n\n function compNorm(q) {\n const q3 = q * 3\n\n if (scope.normal_cache[q3] === 0.0) {\n scope.normal_cache[q3 + 0] = scope.field[q - 1] - scope.field[q + 1]\n scope.normal_cache[q3 + 1] = scope.field[q - scope.yd] - scope.field[q + scope.yd]\n scope.normal_cache[q3 + 2] = scope.field[q - scope.zd] - scope.field[q + scope.zd]\n }\n }\n\n // Returns total number of triangles. Fills triangles.\n // (this is where most of time is spent - it's inner work of O(n3) loop )\n\n function polygonize(fx, fy, fz, q, isol) {\n // cache indices\n const q1 = q + 1,\n qy = q + scope.yd,\n qz = q + scope.zd,\n q1y = q1 + scope.yd,\n q1z = q1 + scope.zd,\n qyz = q + scope.yd + scope.zd,\n q1yz = q1 + scope.yd + scope.zd\n\n let cubeindex = 0\n const field0 = scope.field[q],\n field1 = scope.field[q1],\n field2 = scope.field[qy],\n field3 = scope.field[q1y],\n field4 = scope.field[qz],\n field5 = scope.field[q1z],\n field6 = scope.field[qyz],\n field7 = scope.field[q1yz]\n\n if (field0 < isol) cubeindex |= 1\n if (field1 < isol) cubeindex |= 2\n if (field2 < isol) cubeindex |= 8\n if (field3 < isol) cubeindex |= 4\n if (field4 < isol) cubeindex |= 16\n if (field5 < isol) cubeindex |= 32\n if (field6 < isol) cubeindex |= 128\n if (field7 < isol) cubeindex |= 64\n\n // if cube is entirely in/out of the surface - bail, nothing to draw\n\n const bits = edgeTable[cubeindex]\n if (bits === 0) return 0\n\n const d = scope.delta,\n fx2 = fx + d,\n fy2 = fy + d,\n fz2 = fz + d\n\n // top of the cube\n\n if (bits & 1) {\n compNorm(q)\n compNorm(q1)\n VIntX(q * 3, 0, isol, fx, fy, fz, field0, field1, q, q1)\n }\n\n if (bits & 2) {\n compNorm(q1)\n compNorm(q1y)\n VIntY(q1 * 3, 3, isol, fx2, fy, fz, field1, field3, q1, q1y)\n }\n\n if (bits & 4) {\n compNorm(qy)\n compNorm(q1y)\n VIntX(qy * 3, 6, isol, fx, fy2, fz, field2, field3, qy, q1y)\n }\n\n if (bits & 8) {\n compNorm(q)\n compNorm(qy)\n VIntY(q * 3, 9, isol, fx, fy, fz, field0, field2, q, qy)\n }\n\n // bottom of the cube\n\n if (bits & 16) {\n compNorm(qz)\n compNorm(q1z)\n VIntX(qz * 3, 12, isol, fx, fy, fz2, field4, field5, qz, q1z)\n }\n\n if (bits & 32) {\n compNorm(q1z)\n compNorm(q1yz)\n VIntY(q1z * 3, 15, isol, fx2, fy, fz2, field5, field7, q1z, q1yz)\n }\n\n if (bits & 64) {\n compNorm(qyz)\n compNorm(q1yz)\n VIntX(qyz * 3, 18, isol, fx, fy2, fz2, field6, field7, qyz, q1yz)\n }\n\n if (bits & 128) {\n compNorm(qz)\n compNorm(qyz)\n VIntY(qz * 3, 21, isol, fx, fy, fz2, field4, field6, qz, qyz)\n }\n\n // vertical lines of the cube\n if (bits & 256) {\n compNorm(q)\n compNorm(qz)\n VIntZ(q * 3, 24, isol, fx, fy, fz, field0, field4, q, qz)\n }\n\n if (bits & 512) {\n compNorm(q1)\n compNorm(q1z)\n VIntZ(q1 * 3, 27, isol, fx2, fy, fz, field1, field5, q1, q1z)\n }\n\n if (bits & 1024) {\n compNorm(q1y)\n compNorm(q1yz)\n VIntZ(q1y * 3, 30, isol, fx2, fy2, fz, field3, field7, q1y, q1yz)\n }\n\n if (bits & 2048) {\n compNorm(qy)\n compNorm(qyz)\n VIntZ(qy * 3, 33, isol, fx, fy2, fz, field2, field6, qy, qyz)\n }\n\n cubeindex <<= 4 // re-purpose cubeindex into an offset into triTable\n\n let o1,\n o2,\n o3,\n numtris = 0,\n i = 0\n\n // here is where triangles are created\n\n while (triTable[cubeindex + i] != -1) {\n o1 = cubeindex + i\n o2 = o1 + 1\n o3 = o1 + 2\n\n posnormtriv(vlist, nlist, clist, 3 * triTable[o1], 3 * triTable[o2], 3 * triTable[o3])\n\n i += 3\n numtris++\n }\n\n return numtris\n }\n\n function posnormtriv(pos, norm, colors, o1, o2, o3) {\n const c = scope.count * 3\n\n // positions\n\n scope.positionArray[c + 0] = pos[o1]\n scope.positionArray[c + 1] = pos[o1 + 1]\n scope.positionArray[c + 2] = pos[o1 + 2]\n\n scope.positionArray[c + 3] = pos[o2]\n scope.positionArray[c + 4] = pos[o2 + 1]\n scope.positionArray[c + 5] = pos[o2 + 2]\n\n scope.positionArray[c + 6] = pos[o3]\n scope.positionArray[c + 7] = pos[o3 + 1]\n scope.positionArray[c + 8] = pos[o3 + 2]\n\n // normals\n\n if (scope.material.flatShading === true) {\n const nx = (norm[o1 + 0] + norm[o2 + 0] + norm[o3 + 0]) / 3\n const ny = (norm[o1 + 1] + norm[o2 + 1] + norm[o3 + 1]) / 3\n const nz = (norm[o1 + 2] + norm[o2 + 2] + norm[o3 + 2]) / 3\n\n scope.normalArray[c + 0] = nx\n scope.normalArray[c + 1] = ny\n scope.normalArray[c + 2] = nz\n\n scope.normalArray[c + 3] = nx\n scope.normalArray[c + 4] = ny\n scope.normalArray[c + 5] = nz\n\n scope.normalArray[c + 6] = nx\n scope.normalArray[c + 7] = ny\n scope.normalArray[c + 8] = nz\n } else {\n scope.normalArray[c + 0] = norm[o1 + 0]\n scope.normalArray[c + 1] = norm[o1 + 1]\n scope.normalArray[c + 2] = norm[o1 + 2]\n\n scope.normalArray[c + 3] = norm[o2 + 0]\n scope.normalArray[c + 4] = norm[o2 + 1]\n scope.normalArray[c + 5] = norm[o2 + 2]\n\n scope.normalArray[c + 6] = norm[o3 + 0]\n scope.normalArray[c + 7] = norm[o3 + 1]\n scope.normalArray[c + 8] = norm[o3 + 2]\n }\n\n // uvs\n\n if (scope.enableUvs) {\n const d = scope.count * 2\n\n scope.uvArray[d + 0] = pos[o1 + 0]\n scope.uvArray[d + 1] = pos[o1 + 2]\n\n scope.uvArray[d + 2] = pos[o2 + 0]\n scope.uvArray[d + 3] = pos[o2 + 2]\n\n scope.uvArray[d + 4] = pos[o3 + 0]\n scope.uvArray[d + 5] = pos[o3 + 2]\n }\n\n // colors\n\n if (scope.enableColors) {\n scope.colorArray[c + 0] = colors[o1 + 0]\n scope.colorArray[c + 1] = colors[o1 + 1]\n scope.colorArray[c + 2] = colors[o1 + 2]\n\n scope.colorArray[c + 3] = colors[o2 + 0]\n scope.colorArray[c + 4] = colors[o2 + 1]\n scope.colorArray[c + 5] = colors[o2 + 2]\n\n scope.colorArray[c + 6] = colors[o3 + 0]\n scope.colorArray[c + 7] = colors[o3 + 1]\n scope.colorArray[c + 8] = colors[o3 + 2]\n }\n\n scope.count += 3\n }\n\n /////////////////////////////////////\n // Metaballs\n /////////////////////////////////////\n\n // Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after\n // a fixed distance, determined by strength and subtract.\n\n this.addBall = function (ballx, bally, ballz, strength, subtract, colors) {\n const sign = Math.sign(strength)\n strength = Math.abs(strength)\n const userDefineColor = !(colors === undefined || colors === null)\n let ballColor = new Color(ballx, bally, ballz)\n\n if (userDefineColor) {\n try {\n ballColor =\n colors instanceof Color\n ? colors\n : Array.isArray(colors)\n ? new Color(\n Math.min(Math.abs(colors[0]), 1),\n Math.min(Math.abs(colors[1]), 1),\n Math.min(Math.abs(colors[2]), 1),\n )\n : new Color(colors)\n } catch (err) {\n ballColor = new Color(ballx, bally, ballz)\n }\n }\n\n // Let's solve the equation to find the radius:\n // 1.0 / (0.000001 + radius^2) * strength - subtract = 0\n // strength / (radius^2) = subtract\n // strength = subtract * radius^2\n // radius^2 = strength / subtract\n // radius = sqrt(strength / subtract)\n\n const radius = this.size * Math.sqrt(strength / subtract),\n zs = ballz * this.size,\n ys = bally * this.size,\n xs = ballx * this.size\n\n let min_z = Math.floor(zs - radius)\n if (min_z < 1) min_z = 1\n let max_z = Math.floor(zs + radius)\n if (max_z > this.size - 1) max_z = this.size - 1\n let min_y = Math.floor(ys - radius)\n if (min_y < 1) min_y = 1\n let max_y = Math.floor(ys + radius)\n if (max_y > this.size - 1) max_y = this.size - 1\n let min_x = Math.floor(xs - radius)\n if (min_x < 1) min_x = 1\n let max_x = Math.floor(xs + radius)\n if (max_x > this.size - 1) max_x = this.size - 1\n\n // Don't polygonize in the outer layer because normals aren't\n // well-defined there.\n\n let x, y, z, y_offset, z_offset, fx, fy, fz, fz2, fy2, val\n\n for (z = min_z; z < max_z; z++) {\n z_offset = this.size2 * z\n fz = z / this.size - ballz\n fz2 = fz * fz\n\n for (y = min_y; y < max_y; y++) {\n y_offset = z_offset + this.size * y\n fy = y / this.size - bally\n fy2 = fy * fy\n\n for (x = min_x; x < max_x; x++) {\n fx = x / this.size - ballx\n val = strength / (0.000001 + fx * fx + fy2 + fz2) - subtract\n if (val > 0.0) {\n this.field[y_offset + x] += val * sign\n\n // optimization\n // http://www.geisswerks.com/ryan/BLOBS/blobs.html\n const ratio = Math.sqrt((x - xs) * (x - xs) + (y - ys) * (y - ys) + (z - zs) * (z - zs)) / radius\n const contrib = 1 - ratio * ratio * ratio * (ratio * (ratio * 6 - 15) + 10)\n this.palette[(y_offset + x) * 3 + 0] += ballColor.r * contrib\n this.palette[(y_offset + x) * 3 + 1] += ballColor.g * contrib\n this.palette[(y_offset + x) * 3 + 2] += ballColor.b * contrib\n }\n }\n }\n }\n }\n\n this.addPlaneX = function (strength, subtract) {\n // cache attribute lookups\n const size = this.size,\n yd = this.yd,\n zd = this.zd,\n field = this.field\n\n let x,\n y,\n z,\n xx,\n val,\n xdiv,\n cxy,\n dist = size * Math.sqrt(strength / subtract)\n\n if (dist > size) dist = size\n\n for (x = 0; x < dist; x++) {\n xdiv = x / size\n xx = xdiv * xdiv\n val = strength / (0.0001 + xx) - subtract\n\n if (val > 0.0) {\n for (y = 0; y < size; y++) {\n cxy = x + y * yd\n\n for (z = 0; z < size; z++) {\n field[zd * z + cxy] += val\n }\n }\n }\n }\n }\n\n this.addPlaneY = function (strength, subtract) {\n // cache attribute lookups\n const size = this.size,\n yd = this.yd,\n zd = this.zd,\n field = this.field\n\n let x,\n y,\n z,\n yy,\n val,\n ydiv,\n cy,\n cxy,\n dist = size * Math.sqrt(strength / subtract)\n\n if (dist > size) dist = size\n\n for (y = 0; y < dist; y++) {\n ydiv = y / size\n yy = ydiv * ydiv\n val = strength / (0.0001 + yy) - subtract\n\n if (val > 0.0) {\n cy = y * yd\n\n for (x = 0; x < size; x++) {\n cxy = cy + x\n\n for (z = 0; z < size; z++) field[zd * z + cxy] += val\n }\n }\n }\n }\n\n this.addPlaneZ = function (strength, subtract) {\n // cache attribute lookups\n\n const size = this.size,\n yd = this.yd,\n zd = this.zd,\n field = this.field\n\n let x,\n y,\n z,\n zz,\n val,\n zdiv,\n cz,\n cyz,\n dist = size * Math.sqrt(strength / subtract)\n\n if (dist > size) dist = size\n\n for (z = 0; z < dist; z++) {\n zdiv = z / size\n zz = zdiv * zdiv\n val = strength / (0.0001 + zz) - subtract\n if (val > 0.0) {\n cz = zd * z\n\n for (y = 0; y < size; y++) {\n cyz = cz + y * yd\n\n for (x = 0; x < size; x++) field[cyz + x] += val\n }\n }\n }\n }\n\n /////////////////////////////////////\n // Updates\n /////////////////////////////////////\n\n this.setCell = function (x, y, z, value) {\n const index = this.size2 * z + this.size * y + x\n this.field[index] = value\n }\n\n this.getCell = function (x, y, z) {\n const index = this.size2 * z + this.size * y + x\n return this.field[index]\n }\n\n this.blur = function (intensity = 1) {\n const field = this.field\n const fieldCopy = field.slice()\n const size = this.size\n const size2 = this.size2\n for (let x = 0; x < size; x++) {\n for (let y = 0; y < size; y++) {\n for (let z = 0; z < size; z++) {\n const index = size2 * z + size * y + x\n let val = fieldCopy[index]\n let count = 1\n\n for (let x2 = -1; x2 <= 1; x2 += 2) {\n const x3 = x2 + x\n if (x3 < 0 || x3 >= size) continue\n\n for (let y2 = -1; y2 <= 1; y2 += 2) {\n const y3 = y2 + y\n if (y3 < 0 || y3 >= size) continue\n\n for (let z2 = -1; z2 <= 1; z2 += 2) {\n const z3 = z2 + z\n if (z3 < 0 || z3 >= size) continue\n\n const index2 = size2 * z3 + size * y3 + x3\n const val2 = fieldCopy[index2]\n\n count++\n val += (intensity * (val2 - val)) / count\n }\n }\n }\n\n field[index] = val\n }\n }\n }\n }\n\n this.reset = function () {\n // wipe the normal cache\n\n for (let i = 0; i < this.size3; i++) {\n this.normal_cache[i * 3] = 0.0\n this.field[i] = 0.0\n this.palette[i * 3] = this.palette[i * 3 + 1] = this.palette[i * 3 + 2] = 0.0\n }\n }\n\n this.update = function () {\n this.count = 0\n\n // Triangulate. Yeah, this is slow.\n\n const smin2 = this.size - 2\n\n for (let z = 1; z < smin2; z++) {\n const z_offset = this.size2 * z\n const fz = (z - this.halfsize) / this.halfsize //+ 1\n\n for (let y = 1; y < smin2; y++) {\n const y_offset = z_offset + this.size * y\n const fy = (y - this.halfsize) / this.halfsize //+ 1\n\n for (let x = 1; x < smin2; x++) {\n const fx = (x - this.halfsize) / this.halfsize //+ 1\n const q = y_offset + x\n\n polygonize(fx, fy, fz, q, this.isolation)\n }\n }\n }\n\n // set the draw range to only the processed triangles\n\n this.geometry.setDrawRange(0, this.count)\n\n // update geometry data\n\n geometry.getAttribute('position').needsUpdate = true\n geometry.getAttribute('normal').needsUpdate = true\n\n if (this.enableUvs) geometry.getAttribute('uv').needsUpdate = true\n if (this.enableColors) geometry.getAttribute('color').needsUpdate = true\n\n // safety check\n\n if (this.count / 3 > maxPolyCount)\n console.warn(\n 'THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.',\n )\n }\n\n this.init(resolution)\n }\n}\n\n/////////////////////////////////////\n// Marching cubes lookup tables\n/////////////////////////////////////\n\n// These tables are straight from Paul Bourke's page:\n// http://paulbourke.net/geometry/polygonise/\n// who in turn got them from Cory Gene Bloyd.\n\n// prettier-ignore\nconst edgeTable = new Int32Array( [\n\t0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,\n\t0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,\n\t0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,\n\t0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,\n\t0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,\n\t0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,\n\t0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,\n\t0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,\n\t0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,\n\t0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,\n\t0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,\n\t0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,\n\t0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,\n\t0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,\n\t0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,\n\t0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,\n\t0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,\n\t0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,\n\t0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,\n\t0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,\n\t0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,\n\t0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,\n\t0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,\n\t0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,\n\t0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,\n\t0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,\n\t0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,\n\t0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,\n\t0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,\n\t0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,\n\t0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,\n\t0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ] );\n\n// prettier-ignore\nconst triTable = new Int32Array( [\n\t- 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 8, 3, 9, 8, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 2, 10, 0, 2, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 8, 3, 2, 10, 8, 10, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 11, 2, 8, 11, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 9, 0, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 11, 2, 1, 9, 11, 9, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 10, 1, 11, 10, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 10, 1, 0, 8, 10, 8, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 9, 0, 3, 11, 9, 11, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 3, 0, 7, 3, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 1, 9, 4, 7, 1, 7, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 4, 7, 3, 0, 4, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 2, 10, 9, 0, 2, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,\n\t8, 4, 7, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 4, 7, 11, 2, 4, 2, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 0, 1, 8, 4, 7, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, - 1, - 1, - 1, - 1,\n\t3, 10, 1, 3, 11, 10, 7, 8, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, - 1, - 1, - 1, - 1,\n\t4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,\n\t4, 7, 11, 4, 11, 9, 9, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 4, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 5, 4, 1, 5, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 5, 4, 8, 3, 5, 3, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 8, 1, 2, 10, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 2, 10, 5, 4, 2, 4, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, - 1, - 1, - 1, - 1,\n\t9, 5, 4, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 11, 2, 0, 8, 11, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 5, 4, 0, 1, 5, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, - 1, - 1, - 1, - 1,\n\t10, 3, 11, 10, 1, 3, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, - 1, - 1, - 1, - 1,\n\t5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,\n\t5, 4, 8, 5, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 7, 8, 5, 7, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 3, 0, 9, 5, 3, 5, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 7, 8, 0, 1, 7, 1, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 7, 8, 9, 5, 7, 10, 1, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, - 1, - 1, - 1, - 1,\n\t8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, - 1, - 1, - 1, - 1,\n\t2, 10, 5, 2, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 9, 5, 7, 8, 9, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,\n\t2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, - 1, - 1, - 1, - 1,\n\t11, 2, 1, 11, 1, 7, 7, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, - 1, - 1, - 1, - 1,\n\t5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, - 1,\n\t11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, - 1,\n\t11, 10, 5, 7, 11, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 0, 1, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 8, 3, 1, 9, 8, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 6, 5, 2, 6, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 6, 5, 1, 2, 6, 3, 0, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 6, 5, 9, 0, 6, 0, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, - 1, - 1, - 1, - 1,\n\t2, 3, 11, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 0, 8, 11, 2, 0, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, - 1, - 1, - 1, - 1,\n\t6, 3, 11, 6, 5, 3, 5, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,\n\t3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, - 1, - 1, - 1, - 1,\n\t6, 5, 9, 6, 9, 11, 11, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 10, 6, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 3, 0, 4, 7, 3, 6, 5, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 9, 0, 5, 10, 6, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,\n\t6, 1, 2, 6, 5, 1, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, - 1, - 1, - 1, - 1,\n\t8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, - 1, - 1, - 1, - 1,\n\t7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, - 1,\n\t3, 11, 2, 7, 8, 4, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1,\n\t9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, - 1,\n\t8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,\n\t5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, - 1,\n\t0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, - 1,\n\t6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, - 1, - 1, - 1, - 1,\n\t10, 4, 9, 6, 4, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 10, 6, 4, 9, 10, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 0, 1, 10, 6, 0, 6, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,\n\t1, 4, 9, 1, 2, 4, 2, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, - 1, - 1, - 1, - 1,\n\t0, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 3, 2, 8, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 4, 9, 10, 6, 4, 11, 2, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, - 1, - 1, - 1, - 1,\n\t3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,\n\t6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, - 1,\n\t9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, - 1, - 1, - 1, - 1,\n\t8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, - 1,\n\t3, 11, 6, 3, 6, 0, 0, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 4, 8, 11, 6, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 10, 6, 7, 8, 10, 8, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, - 1, - 1, - 1, - 1,\n\t10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, - 1, - 1, - 1, - 1,\n\t10, 6, 7, 10, 7, 1, 1, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,\n\t2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, - 1,\n\t7, 8, 0, 7, 0, 6, 6, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 3, 2, 6, 7, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,\n\t2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, - 1,\n\t1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, - 1,\n\t11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, - 1, - 1, - 1, - 1,\n\t8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, - 1,\n\t0, 9, 1, 11, 6, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, - 1, - 1, - 1, - 1,\n\t7, 11, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 8, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 1, 9, 8, 3, 1, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 1, 2, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 3, 0, 8, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 9, 0, 2, 10, 9, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, - 1, - 1, - 1, - 1,\n\t7, 2, 3, 6, 2, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t7, 0, 8, 7, 6, 0, 6, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 7, 6, 2, 3, 7, 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, - 1, - 1, - 1, - 1,\n\t10, 7, 6, 10, 1, 7, 1, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, - 1, - 1, - 1, - 1,\n\t0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, - 1, - 1, - 1, - 1,\n\t7, 6, 10, 7, 10, 8, 8, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 8, 4, 11, 8, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 6, 11, 3, 0, 6, 0, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 6, 11, 8, 4, 6, 9, 0, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, - 1, - 1, - 1, - 1,\n\t6, 8, 4, 6, 11, 8, 2, 10, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, - 1, - 1, - 1, - 1,\n\t4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, - 1, - 1, - 1, - 1,\n\t10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, - 1,\n\t8, 2, 3, 8, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, - 1, - 1, - 1, - 1,\n\t1, 9, 4, 1, 4, 2, 2, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, - 1, - 1, - 1, - 1,\n\t10, 1, 0, 10, 0, 6, 6, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, - 1,\n\t10, 9, 4, 6, 10, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 5, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 4, 9, 5, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 0, 1, 5, 4, 0, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, - 1, - 1, - 1, - 1,\n\t9, 5, 4, 10, 1, 2, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, - 1, - 1, - 1, - 1,\n\t7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, - 1,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 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, - 1,\n\t1, 5, 6, 2, 1, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, - 1,\n\t10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, - 1, - 1, - 1, - 1,\n\t0, 3, 8, 5, 6, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 5, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 5, 10, 7, 5, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 5, 10, 11, 7, 5, 8, 3, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 11, 7, 5, 10, 11, 1, 9, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, - 1, - 1, - 1, - 1,\n\t11, 1, 2, 11, 7, 1, 7, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, - 1, - 1, - 1, - 1,\n\t9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, - 1, - 1, - 1, - 1,\n\t7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, - 1,\n\t2, 5, 10, 2, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, - 1, - 1, - 1, - 1,\n\t9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, - 1, - 1, - 1, - 1,\n\t9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, - 1,\n\t1, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 7, 0, 7, 1, 1, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 0, 3, 9, 3, 5, 5, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 8, 7, 5, 9, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 8, 4, 5, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, - 1, - 1, - 1, - 1,\n\t0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, - 1, - 1, - 1, - 1,\n\t10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, - 1,\n\t2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, - 1, - 1, - 1, - 1,\n\t0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, - 1,\n\t0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, - 1,\n\t9, 4, 5, 2, 11, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, - 1, - 1, - 1, - 1,\n\t5, 10, 2, 5, 2, 4, 4, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, - 1,\n\t5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, - 1, - 1, - 1, - 1,\n\t8, 4, 5, 8, 5, 3, 3, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 4, 5, 1, 0, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, - 1, - 1, - 1, - 1,\n\t9, 4, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 11, 7, 4, 9, 11, 9, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, - 1, - 1, - 1, - 1,\n\t1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, - 1, - 1, - 1, - 1,\n\t3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, - 1,\n\t4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, - 1, - 1, - 1, - 1,\n\t9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, - 1,\n\t11, 7, 4, 11, 4, 2, 2, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, - 1, - 1, - 1, - 1,\n\t2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, - 1, - 1, - 1, - 1,\n\t9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, - 1,\n\t3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, - 1,\n\t1, 10, 2, 8, 7, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 1, 4, 1, 7, 7, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, - 1, - 1, - 1, - 1,\n\t4, 0, 3, 7, 4, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t4, 8, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 9, 3, 9, 11, 11, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 1, 10, 0, 10, 8, 8, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 1, 10, 11, 3, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 2, 11, 1, 11, 9, 9, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, - 1, - 1, - 1, - 1,\n\t0, 2, 11, 8, 0, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t3, 2, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 3, 8, 2, 8, 10, 10, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t9, 10, 2, 0, 9, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, - 1, - 1, - 1, - 1,\n\t1, 10, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t1, 3, 8, 9, 1, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 9, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t0, 3, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,\n\t- 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 ] );\n\nexport { MarchingCubes, edgeTable, triTable }\n", "// Ported from Stefan Gustavson's java implementation\n// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf\n// Read Stefan's excellent paper for details on how this code works.\n//\n// Sean McCullough banksean@gmail.com\n//\n\nexport interface NumberGenerator {\n random: () => number\n}\n\n// Added 4D noise\nexport class SimplexNoise {\n private grad3 = [\n [1, 1, 0],\n [-1, 1, 0],\n [1, -1, 0],\n [-1, -1, 0],\n [1, 0, 1],\n [-1, 0, 1],\n [1, 0, -1],\n [-1, 0, -1],\n [0, 1, 1],\n [0, -1, 1],\n [0, 1, -1],\n [0, -1, -1],\n ]\n\n private grad4 = [\n [0, 1, 1, 1],\n [0, 1, 1, -1],\n [0, 1, -1, 1],\n [0, 1, -1, -1],\n [0, -1, 1, 1],\n [0, -1, 1, -1],\n [0, -1, -1, 1],\n [0, -1, -1, -1],\n [1, 0, 1, 1],\n [1, 0, 1, -1],\n [1, 0, -1, 1],\n [1, 0, -1, -1],\n [-1, 0, 1, 1],\n [-1, 0, 1, -1],\n [-1, 0, -1, 1],\n [-1, 0, -1, -1],\n [1, 1, 0, 1],\n [1, 1, 0, -1],\n [1, -1, 0, 1],\n [1, -1, 0, -1],\n [-1, 1, 0, 1],\n [-1, 1, 0, -1],\n [-1, -1, 0, 1],\n [-1, -1, 0, -1],\n [1, 1, 1, 0],\n [1, 1, -1, 0],\n [1, -1, 1, 0],\n [1, -1, -1, 0],\n [-1, 1, 1, 0],\n [-1, 1, -1, 0],\n [-1, -1, 1, 0],\n [-1, -1, -1, 0],\n ]\n\n private p: number[] = []\n\n // To remove the need for index wrapping, double the permutation table length\n private perm: number[] = []\n\n // A lookup table to traverse the simplex around a given point in 4D.\n // Details can be found where this table is used, in the 4D noise method.\n private simplex = [\n [0, 1, 2, 3],\n [0, 1, 3, 2],\n [0, 0, 0, 0],\n [0, 2, 3, 1],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 2, 3, 0],\n [0, 2, 1, 3],\n [0, 0, 0, 0],\n [0, 3, 1, 2],\n [0, 3, 2, 1],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 3, 2, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 2, 0, 3],\n [0, 0, 0, 0],\n [1, 3, 0, 2],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 3, 0, 1],\n [2, 3, 1, 0],\n [1, 0, 2, 3],\n [1, 0, 3, 2],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 0, 3, 1],\n [0, 0, 0, 0],\n [2, 1, 3, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 0, 1, 3],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [3, 0, 1, 2],\n [3, 0, 2, 1],\n [0, 0, 0, 0],\n [3, 1, 2, 0],\n [2, 1, 0, 3],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [3, 1, 0, 2],\n [0, 0, 0, 0],\n [3, 2, 0, 1],\n [3, 2, 1, 0],\n ]\n\n /**\n * You can pass in a random number generator object if you like.\n * It is assumed to have a random() method.\n */\n constructor(r: NumberGenerator = Math) {\n for (let i = 0; i < 256; i++) {\n this.p[i] = Math.floor(r.random() * 256)\n }\n\n for (let i = 0; i < 512; i++) {\n this.perm[i] = this.p[i & 255]\n }\n }\n\n public dot = (g: number[], x: number, y: number): number => {\n return g[0] * x + g[1] * y\n }\n\n public dot3 = (g: number[], x: number, y: number, z: number): number => {\n return g[0] * x + g[1] * y + g[2] * z\n }\n\n public dot4 = (g: number[], x: number, y: number, z: number, w: number): number => {\n return g[0] * x + g[1] * y + g[2] * z + g[3] * w\n }\n\n public noise = (xin: number, yin: number): number => {\n let n0\n let n1\n let n2 // Noise contributions from the three corners\n // Skew the input space to determine which simplex cell we're in\n const F2 = 0.5 * (Math.sqrt(3.0) - 1.0)\n const s = (xin + yin) * F2 // Hairy factor for 2D\n const i = Math.floor(xin + s)\n const j = Math.floor(yin + s)\n const G2 = (3.0 - Math.sqrt(3.0)) / 6.0\n const t = (i + j) * G2\n const X0 = i - t // Unskew the cell origin back to (x,y) space\n const Y0 = j - t\n const x0 = xin - X0 // The x,y distances from the cell origin\n const y0 = yin - Y0\n // For the 2D case, the simplex shape is an equilateral triangle.\n // Determine which simplex we are in.\n // upper triangle, YX order: (0,0)->(0,1)->(1,1)\n let i1 = 0\n // Offsets for second (middle) corner of simplex in (i,j) coords\n let j1 = 1\n if (x0 > y0) {\n i1 = 1\n j1 = 0\n }\n\n // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and\n // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where\n // c = (3-sqrt(3))/6\n const x1 = x0 - i1 + G2 // Offsets for middle corner in (x,y) unskewed coords\n const y1 = y0 - j1 + G2\n const x2 = x0 - 1.0 + 2.0 * G2 // Offsets for last corner in (x,y) unskewed coords\n const y2 = y0 - 1.0 + 2.0 * G2\n // Work out the hashed gradient indices of the three simplex corners\n const ii = i & 255\n const jj = j & 255\n const gi0 = this.perm[ii + this.perm[jj]] % 12\n const gi1 = this.perm[ii + i1 + this.perm[jj + j1]] % 12\n const gi2 = this.perm[ii + 1 + this.perm[jj + 1]] % 12\n // Calculate the contribution from the three corners\n let t0 = 0.5 - x0 * x0 - y0 * y0\n if (t0 < 0) {\n n0 = 0.0\n } else {\n t0 *= t0\n n0 = t0 * t0 * this.dot(this.grad3[gi0], x0, y0) // (x,y) of grad3 used for 2D gradient\n }\n\n let t1 = 0.5 - x1 * x1 - y1 * y1\n if (t1 < 0) {\n n1 = 0.0\n } else {\n t1 *= t1\n n1 = t1 * t1 * this.dot(this.grad3[gi1], x1, y1)\n }\n\n let t2 = 0.5 - x2 * x2 - y2 * y2\n if (t2 < 0) {\n n2 = 0.0\n } else {\n t2 *= t2\n n2 = t2 * t2 * this.dot(this.grad3[gi2], x2, y2)\n }\n\n // Add contributions from each corner to get the final noise value.\n // The result is scaled to return values in the interval [-1,1].\n return 70.0 * (n0 + n1 + n2)\n }\n\n // 3D simplex noise\n private noise3d = (xin: number, yin: number, zin: number): number => {\n // Noise contributions from the four corners\n let n0\n let n1\n let n2\n let n3\n // Skew the input space to determine which simplex cell we're in\n const F3 = 1.0 / 3.0\n const s = (xin + yin + zin) * F3 // Very nice and simple skew factor for 3D\n const i = Math.floor(xin + s)\n const j = Math.floor(yin + s)\n const k = Math.floor(zin + s)\n const G3 = 1.0 / 6.0 // Very nice and simple unskew factor, too\n const t = (i + j + k) * G3\n const X0 = i - t // Unskew the cell origin back to (x,y,z) space\n const Y0 = j - t\n const Z0 = k - t\n const x0 = xin - X0 // The x,y,z distances from the cell origin\n const y0 = yin - Y0\n const z0 = zin - Z0\n // For the 3D case, the simplex shape is a slightly irregular tetrahedron.\n // Determine which simplex we are in.\n let i1\n let j1\n let k1 // Offsets for second corner of simplex in (i,j,k) coords\n let i2\n let j2\n let k2 // Offsets for third corner of simplex in (i,j,k) coords\n if (x0 >= y0) {\n if (y0 >= z0) {\n i1 = 1\n j1 = 0\n k1 = 0\n i2 = 1\n j2 = 1\n k2 = 0\n\n // X Y Z order\n } else if (x0 >= z0) {\n i1 = 1\n j1 = 0\n k1 = 0\n i2 = 1\n j2 = 0\n k2 = 1\n\n // X Z Y order\n } else {\n i1 = 0\n j1 = 0\n k1 = 1\n i2 = 1\n j2 = 0\n k2 = 1\n } // Z X Y order\n } else {\n // x0 {\n // For faster and easier lookups\n const grad4 = this.grad4\n const simplex = this.simplex\n const perm = this.perm\n\n // The skewing and unskewing factors are hairy again for the 4D case\n const F4 = (Math.sqrt(5.0) - 1.0) / 4.0\n const G4 = (5.0 - Math.sqrt(5.0)) / 20.0\n let n0\n let n1\n let n2\n let n3\n let n4 // Noise contributions from the five corners\n // Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in\n const s = (x + y + z + w) * F4 // Factor for 4D skewing\n const i = Math.floor(x + s)\n const j = Math.floor(y + s)\n const k = Math.floor(z + s)\n const l = Math.floor(w + s)\n const t = (i + j + k + l) * G4 // Factor for 4D unskewing\n const X0 = i - t // Unskew the cell origin back to (x,y,z,w) space\n const Y0 = j - t\n const Z0 = k - t\n const W0 = l - t\n const x0 = x - X0 // The x,y,z,w distances from the cell origin\n const y0 = y - Y0\n const z0 = z - Z0\n const w0 = w - W0\n\n // For the 4D case, the simplex is a 4D shape I won't even try to describe.\n // To find out which of the 24 possible simplices we're in, we need to\n // determine the magnitude ordering of x0, y0, z0 and w0.\n // The method below is a good way of finding the ordering of x,y,z,w and\n // then find the correct traversal order for the simplex we’re in.\n // First, six pair-wise comparisons are performed between each possible pair\n // of the four coordinates, and the results are used to add up binary bits\n // for an integer index.\n const c1 = x0 > y0 ? 32 : 0\n const c2 = x0 > z0 ? 16 : 0\n const c3 = y0 > z0 ? 8 : 0\n const c4 = x0 > w0 ? 4 : 0\n const c5 = y0 > w0 ? 2 : 0\n const c6 = z0 > w0 ? 1 : 0\n const c = c1 + c2 + c3 + c4 + c5 + c6\n // The integer offsets for the second simplex corner\n let i1\n let j1\n let k1\n let l1\n\n // The integer offsets for the third simplex corner\n let i2\n let j2\n let k2\n let l2\n\n // The integer offsets for the fourth simplex corner\n let i3\n let j3\n let k3\n let l3\n // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order.\n // Many values of c will never occur, since e.g. x>y>z>w makes x= 3 ? 1 : 0\n j1 = simplex[c][1] >= 3 ? 1 : 0\n k1 = simplex[c][2] >= 3 ? 1 : 0\n l1 = simplex[c][3] >= 3 ? 1 : 0\n // The number 2 in the \"simplex\" array is at the second largest coordinate.\n i2 = simplex[c][0] >= 2 ? 1 : 0\n j2 = simplex[c][1] >= 2 ? 1 : 0\n k2 = simplex[c][2] >= 2 ? 1 : 0\n l2 = simplex[c][3] >= 2 ? 1 : 0\n // The number 1 in the \"simplex\" array is at the second smallest coordinate.\n i3 = simplex[c][0] >= 1 ? 1 : 0\n j3 = simplex[c][1] >= 1 ? 1 : 0\n k3 = simplex[c][2] >= 1 ? 1 : 0\n l3 = simplex[c][3] >= 1 ? 1 : 0\n // The fifth corner has all coordinate offsets = 1, so no need to look that up.\n const x1 = x0 - i1 + G4 // Offsets for second corner in (x,y,z,w) coords\n const y1 = y0 - j1 + G4\n const z1 = z0 - k1 + G4\n const w1 = w0 - l1 + G4\n const x2 = x0 - i2 + 2.0 * G4 // Offsets for third corner in (x,y,z,w) coords\n const y2 = y0 - j2 + 2.0 * G4\n const z2 = z0 - k2 + 2.0 * G4\n const w2 = w0 - l2 + 2.0 * G4\n const x3 = x0 - i3 + 3.0 * G4 // Offsets for fourth corner in (x,y,z,w) coords\n const y3 = y0 - j3 + 3.0 * G4\n const z3 = z0 - k3 + 3.0 * G4\n const w3 = w0 - l3 + 3.0 * G4\n const x4 = x0 - 1.0 + 4.0 * G4 // Offsets for last corner in (x,y,z,w) coords\n const y4 = y0 - 1.0 + 4.0 * G4\n const z4 = z0 - 1.0 + 4.0 * G4\n const w4 = w0 - 1.0 + 4.0 * G4\n // Work out the hashed gradient indices of the five simplex corners\n const ii = i & 255\n const jj = j & 255\n const kk = k & 255\n const ll = l & 255\n const gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32\n const gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32\n const gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32\n const gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32\n const gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32\n // Calculate the contribution from the five corners\n let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0\n if (t0 < 0) {\n n0 = 0.0\n } else {\n t0 *= t0\n n0 = t0 * t0 * this.dot4(grad4[gi0], x0, y0, z0, w0)\n }\n\n let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1\n if (t1 < 0) {\n n1 = 0.0\n } else {\n t1 *= t1\n n1 = t1 * t1 * this.dot4(grad4[gi1], x1, y1, z1, w1)\n }\n\n let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2\n if (t2 < 0) {\n n2 = 0.0\n } else {\n t2 *= t2\n n2 = t2 * t2 * this.dot4(grad4[gi2], x2, y2, z2, w2)\n }\n\n let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3\n if (t3 < 0) {\n n3 = 0.0\n } else {\n t3 *= t3\n n3 = t3 * t3 * this.dot4(grad4[gi3], x3, y3, z3, w3)\n }\n\n let t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4\n if (t4 < 0) {\n n4 = 0.0\n } else {\n t4 *= t4\n n4 = t4 * t4 * this.dot4(grad4[gi4], x4, y4, z4, w4)\n }\n\n // Sum up and scale the result to cover the range [-1,1]\n return 27.0 * (n0 + n1 + n2 + n3 + n4)\n }\n}\n", "import {\n BufferGeometry,\n DynamicDrawUsage,\n Float32BufferAttribute,\n MathUtils,\n Uint32BufferAttribute,\n Vector3,\n} from 'three'\nimport { SimplexNoise } from '../math/SimplexNoise'\n\n/**\n * @fileoverview LightningStrike object for creating lightning strikes and voltaic arcs.\n *\n *\n * Usage\n *\n * var myRay = new LightningStrike( paramsObject );\n * var myRayMesh = new THREE.Mesh( myRay, myMaterial );\n * scene.add( myRayMesh );\n * ...\n * myRay.update( currentTime );\n *\n * The \"currentTime\" can vary its rate, go forwards, backwards or even jump, but it cannot be negative.\n *\n * You should normally leave the ray position to (0, 0, 0). You should control it by changing the sourceOffset and destOffset parameters.\n *\n *\n * LightningStrike parameters\n *\n * The paramsObject can contain any of the following parameters.\n *\n * Legend:\n * 'LightningStrike' (also called 'ray'): An independent voltaic arc with its ramifications and defined with a set of parameters.\n * 'Subray': A ramification of the ray. It is not a LightningStrike object.\n * 'Segment': A linear segment piece of a subray.\n * 'Leaf segment': A ray segment which cannot be smaller.\n *\n *\n * The following parameters can be changed any time and if they vary smoothly, the ray form will also change smoothly:\n *\n * @param {Vector3} sourceOffset The point where the ray starts.\n *\n * @param {Vector3} destOffset The point where the ray ends.\n *\n * @param {double} timeScale The rate at wich the ray form changes in time. Default: 1\n *\n * @param {double} roughness From 0 to 1. The higher the value, the more wrinkled is the ray. Default: 0.9\n *\n * @param {double} straightness From 0 to 1. The higher the value, the more straight will be a subray path. Default: 0.7\n *\n * @param {Vector3} up0 Ray 'up' direction at the ray starting point. Must be normalized. It should be perpendicular to the ray forward direction but it doesn't matter much.\n *\n * @param {Vector3} up1 Like the up0 parameter but at the end of the ray. Must be normalized.\n *\n * @param {double} radius0 Radius of the main ray trunk at the start point. Default: 1\n *\n * @param {double} radius1 Radius of the main ray trunk at the end point. Default: 1\n *\n * @param {double} radius0Factor The radius0 of a subray is this factor times the radius0 of its parent subray. Default: 0.5\n *\n * @param {double} radius1Factor The radius1 of a subray is this factor times the radius1 of its parent subray. Default: 0.2\n *\n * @param {minRadius} Minimum value a subray radius0 or radius1 can get. Default: 0.1\n *\n *\n * The following parameters should not be changed after lightning creation. They can be changed but the ray will change its form abruptly:\n *\n * @param {boolean} isEternal If true the ray never extinguishes. Otherwise its life is controlled by the 'birthTime' and 'deathTime' parameters. Default: true if any of those two parameters is undefined.\n *\n * @param {double} birthTime The time at which the ray starts its life and begins propagating. Only if isEternal is false. Default: None.\n *\n * @param {double} deathTime The time at which the ray ends vanishing and its life. Only if isEternal is false. Default: None.\n *\n * @param {double} propagationTimeFactor From 0 to 1. Lifetime factor at which the ray ends propagating and enters the steady phase. For example, 0.1 means it is propagating 1/10 of its lifetime. Default: 0.1\n *\n * @param {double} vanishingTimeFactor From 0 to 1. Lifetime factor at which the ray ends the steady phase and begins vanishing. For example, 0.9 means it is vanishing 1/10 of its lifetime. Default: 0.9\n *\n * @param {double} subrayPeriod Subrays cycle periodically. This is their time period. Default: 4\n *\n * @param {double} subrayDutyCycle From 0 to 1. This is the fraction of time a subray is active. Default: 0.6\n *\n *\n * These parameters cannot change after lightning creation:\n *\n * @param {integer} maxIterations: Greater than 0. The number of ray's leaf segments is 2**maxIterations. Default: 9\n *\n * @param {boolean} isStatic Set to true only for rays which won't change over time and are not attached to moving objects (Rare case). It is used to set the vertex buffers non-dynamic. You can omit calling update() for these rays.\n *\n * @param {integer} ramification Greater than 0. Maximum number of child subrays a subray can have. Default: 5\n *\n * @param {integer} maxSubrayRecursion Greater than 0. Maximum level of recursion (subray descendant generations). Default: 3\n *\n * @param {double} recursionProbability From 0 to 1. The lower the value, the less chance each new generation of subrays has to generate new subrays. Default: 0.6\n *\n * @param {boolean} generateUVs If true, the ray geometry will have uv coordinates generated. u runs along the ray, and v across its perimeter. Default: false.\n *\n * @param {Object} randomGenerator Set here your random number generator which will seed the SimplexNoise and other decisions during ray tree creation.\n * It can be used to generate repeatable rays. For that, set also the noiseSeed parameter, and each ray created with that generator and seed pair will be identical in time.\n * The randomGenerator parameter should be an object with a random() function similar to Math.random, but seedable.\n * It must have also a getSeed() method, which returns the current seed, and a setSeed( seed ) method, which accepts as seed a fractional number from 0 to 1, as well as any other number.\n * The default value is an internal generator for some uses and Math.random for others (It is non-repeatable even if noiseSeed is supplied)\n *\n * @param {double} noiseSeed Seed used to make repeatable rays (see the randomGenerator)\n *\n * @param {function} onDecideSubrayCreation Set this to change the callback which decides subray creation. You can look at the default callback in the code (createDefaultSubrayCreationCallbacks)for more info.\n *\n * @param {function} onSubrayCreation This is another callback, more simple than the previous one. It can be used to adapt the form of subrays or other parameters once a subray has been created and initialized. It is used in the examples to adapt subrays to a sphere or to a plane.\n *\n *\n */\n\nclass LightningStrike extends BufferGeometry {\n // Ray states\n static RAY_INITIALIZED = 0\n static RAY_UNBORN = 1\n static RAY_PROPAGATING = 2\n static RAY_STEADY = 3\n static RAY_VANISHING = 4\n static RAY_EXTINGUISHED = 5\n\n static COS30DEG = Math.cos((30 * Math.PI) / 180)\n static SIN30DEG = Math.sin((30 * Math.PI) / 180)\n\n constructor(rayParameters = {}) {\n super()\n\n this.isLightningStrike = true\n\n this.type = 'LightningStrike'\n\n // Set parameters, and set undefined parameters to default values\n this.init(LightningStrike.copyParameters(rayParameters, rayParameters))\n\n // Creates and populates the mesh\n this.createMesh()\n }\n\n static createRandomGenerator() {\n const numSeeds = 2053\n const seeds = []\n\n for (let i = 0; i < numSeeds; i++) {\n seeds.push(Math.random())\n }\n\n const generator = {\n currentSeed: 0,\n\n random: function () {\n const value = seeds[generator.currentSeed]\n\n generator.currentSeed = (generator.currentSeed + 1) % numSeeds\n\n return value\n },\n\n getSeed: function () {\n return generator.currentSeed / numSeeds\n },\n\n setSeed: function (seed) {\n generator.currentSeed = Math.floor(seed * numSeeds) % numSeeds\n },\n }\n\n return generator\n }\n\n static copyParameters(dest = {}, source = {}) {\n const vecCopy = function (v) {\n if (source === dest) {\n return v\n } else {\n return v.clone()\n }\n }\n\n ;(dest.sourceOffset = source.sourceOffset !== undefined ? vecCopy(source.sourceOffset) : new Vector3(0, 100, 0)),\n (dest.destOffset = source.destOffset !== undefined ? vecCopy(source.destOffset) : new Vector3(0, 0, 0)),\n (dest.timeScale = source.timeScale !== undefined ? source.timeScale : 1),\n (dest.roughness = source.roughness !== undefined ? source.roughness : 0.9),\n (dest.straightness = source.straightness !== undefined ? source.straightness : 0.7),\n (dest.up0 = source.up0 !== undefined ? vecCopy(source.up0) : new Vector3(0, 0, 1))\n ;(dest.up1 = source.up1 !== undefined ? vecCopy(source.up1) : new Vector3(0, 0, 1)),\n (dest.radius0 = source.radius0 !== undefined ? source.radius0 : 1),\n (dest.radius1 = source.radius1 !== undefined ? source.radius1 : 1),\n (dest.radius0Factor = source.radius0Factor !== undefined ? source.radius0Factor : 0.5),\n (dest.radius1Factor = source.radius1Factor !== undefined ? source.radius1Factor : 0.2),\n (dest.minRadius = source.minRadius !== undefined ? source.minRadius : 0.2),\n // These parameters should not be changed after lightning creation. They can be changed but the ray will change its form abruptly:\n\n (dest.isEternal =\n source.isEternal !== undefined\n ? source.isEternal\n : source.birthTime === undefined || source.deathTime === undefined),\n (dest.birthTime = source.birthTime),\n (dest.deathTime = source.deathTime),\n (dest.propagationTimeFactor = source.propagationTimeFactor !== undefined ? source.propagationTimeFactor : 0.1),\n (dest.vanishingTimeFactor = source.vanishingTimeFactor !== undefined ? source.vanishingTimeFactor : 0.9),\n (dest.subrayPeriod = source.subrayPeriod !== undefined ? source.subrayPeriod : 4),\n (dest.subrayDutyCycle = source.subrayDutyCycle !== undefined ? source.subrayDutyCycle : 0.6)\n\n // These parameters cannot change after lightning creation:\n\n dest.maxIterations = source.maxIterations !== undefined ? source.maxIterations : 9\n dest.isStatic = source.isStatic !== undefined ? source.isStatic : false\n dest.ramification = source.ramification !== undefined ? source.ramification : 5\n dest.maxSubrayRecursion = source.maxSubrayRecursion !== undefined ? source.maxSubrayRecursion : 3\n dest.recursionProbability = source.recursionProbability !== undefined ? source.recursionProbability : 0.6\n dest.generateUVs = source.generateUVs !== undefined ? source.generateUVs : false\n ;(dest.randomGenerator = source.randomGenerator),\n (dest.noiseSeed = source.noiseSeed),\n (dest.onDecideSubrayCreation = source.onDecideSubrayCreation),\n (dest.onSubrayCreation = source.onSubrayCreation)\n\n return dest\n }\n\n update(time) {\n if (this.isStatic) return\n\n if (\n this.rayParameters.isEternal ||\n (this.rayParameters.birthTime <= time && time <= this.rayParameters.deathTime)\n ) {\n this.updateMesh(time)\n\n if (time < this.subrays[0].endPropagationTime) {\n this.state = LightningStrike.RAY_PROPAGATING\n } else if (time > this.subrays[0].beginVanishingTime) {\n this.state = LightningStrike.RAY_VANISHING\n } else {\n this.state = LightningStrike.RAY_STEADY\n }\n\n this.visible = true\n } else {\n this.visible = false\n\n if (time < this.rayParameters.birthTime) {\n this.state = LightningStrike.RAY_UNBORN\n } else {\n this.state = LightningStrike.RAY_EXTINGUISHED\n }\n }\n }\n\n init(rayParameters) {\n // Init all the state from the parameters\n\n this.rayParameters = rayParameters\n\n // These parameters cannot change after lightning creation:\n\n this.maxIterations = rayParameters.maxIterations !== undefined ? Math.floor(rayParameters.maxIterations) : 9\n rayParameters.maxIterations = this.maxIterations\n this.isStatic = rayParameters.isStatic !== undefined ? rayParameters.isStatic : false\n rayParameters.isStatic = this.isStatic\n this.ramification = rayParameters.ramification !== undefined ? Math.floor(rayParameters.ramification) : 5\n rayParameters.ramification = this.ramification\n this.maxSubrayRecursion =\n rayParameters.maxSubrayRecursion !== undefined ? Math.floor(rayParameters.maxSubrayRecursion) : 3\n rayParameters.maxSubrayRecursion = this.maxSubrayRecursion\n this.recursionProbability =\n rayParameters.recursionProbability !== undefined ? rayParameters.recursionProbability : 0.6\n rayParameters.recursionProbability = this.recursionProbability\n this.generateUVs = rayParameters.generateUVs !== undefined ? rayParameters.generateUVs : false\n rayParameters.generateUVs = this.generateUVs\n\n // Random generator\n if (rayParameters.randomGenerator !== undefined) {\n this.randomGenerator = rayParameters.randomGenerator\n this.seedGenerator = rayParameters.randomGenerator\n\n if (rayParameters.noiseSeed !== undefined) {\n this.seedGenerator.setSeed(rayParameters.noiseSeed)\n }\n } else {\n this.randomGenerator = LightningStrike.createRandomGenerator()\n this.seedGenerator = Math\n }\n\n // Ray creation callbacks\n if (rayParameters.onDecideSubrayCreation !== undefined) {\n this.onDecideSubrayCreation = rayParameters.onDecideSubrayCreation\n } else {\n this.createDefaultSubrayCreationCallbacks()\n\n if (rayParameters.onSubrayCreation !== undefined) {\n this.onSubrayCreation = rayParameters.onSubrayCreation\n }\n }\n\n // Internal state\n\n this.state = LightningStrike.RAY_INITIALIZED\n\n this.maxSubrays = Math.ceil(1 + Math.pow(this.ramification, Math.max(0, this.maxSubrayRecursion - 1)))\n rayParameters.maxSubrays = this.maxSubrays\n\n this.maxRaySegments = 2 * (1 << this.maxIterations)\n\n this.subrays = []\n\n for (let i = 0; i < this.maxSubrays; i++) {\n this.subrays.push(this.createSubray())\n }\n\n this.raySegments = []\n\n for (let i = 0; i < this.maxRaySegments; i++) {\n this.raySegments.push(this.createSegment())\n }\n\n this.time = 0\n this.timeFraction = 0\n this.currentSegmentCallback = null\n this.currentCreateTriangleVertices = this.generateUVs\n ? this.createTriangleVerticesWithUVs\n : this.createTriangleVerticesWithoutUVs\n this.numSubrays = 0\n this.currentSubray = null\n this.currentSegmentIndex = 0\n this.isInitialSegment = false\n this.subrayProbability = 0\n\n this.currentVertex = 0\n this.currentIndex = 0\n this.currentCoordinate = 0\n this.currentUVCoordinate = 0\n this.vertices = null\n this.uvs = null\n this.indices = null\n this.positionAttribute = null\n this.uvsAttribute = null\n\n this.simplexX = new SimplexNoise(this.seedGenerator)\n this.simplexY = new SimplexNoise(this.seedGenerator)\n this.simplexZ = new SimplexNoise(this.seedGenerator)\n\n // Temp vectors\n this.forwards = new Vector3()\n this.forwardsFill = new Vector3()\n this.side = new Vector3()\n this.down = new Vector3()\n this.middlePos = new Vector3()\n this.middleLinPos = new Vector3()\n this.newPos = new Vector3()\n this.vPos = new Vector3()\n this.cross1 = new Vector3()\n }\n\n createMesh() {\n const maxDrawableSegmentsPerSubRay = 1 << this.maxIterations\n\n const maxVerts = 3 * (maxDrawableSegmentsPerSubRay + 1) * this.maxSubrays\n const maxIndices = 18 * maxDrawableSegmentsPerSubRay * this.maxSubrays\n\n this.vertices = new Float32Array(maxVerts * 3)\n this.indices = new Uint32Array(maxIndices)\n\n if (this.generateUVs) {\n this.uvs = new Float32Array(maxVerts * 2)\n }\n\n // Populate the mesh\n this.fillMesh(0)\n\n this.setIndex(new Uint32BufferAttribute(this.indices, 1))\n\n this.positionAttribute = new Float32BufferAttribute(this.vertices, 3)\n this.setAttribute('position', this.positionAttribute)\n\n if (this.generateUVs) {\n this.uvsAttribute = new Float32BufferAttribute(new Float32Array(this.uvs), 2)\n this.setAttribute('uv', this.uvsAttribute)\n }\n\n if (!this.isStatic) {\n this.index.usage = DynamicDrawUsage\n this.positionAttribute.usage = DynamicDrawUsage\n\n if (this.generateUVs) {\n this.uvsAttribute.usage = DynamicDrawUsage\n }\n }\n\n // Store buffers for later modification\n this.vertices = this.positionAttribute.array\n this.indices = this.index.array\n\n if (this.generateUVs) {\n this.uvs = this.uvsAttribute.array\n }\n }\n\n updateMesh(time) {\n this.fillMesh(time)\n\n this.drawRange.count = this.currentIndex\n\n this.index.needsUpdate = true\n\n this.positionAttribute.needsUpdate = true\n\n if (this.generateUVs) {\n this.uvsAttribute.needsUpdate = true\n }\n }\n\n fillMesh(time) {\n const scope = this\n\n this.currentVertex = 0\n this.currentIndex = 0\n this.currentCoordinate = 0\n this.currentUVCoordinate = 0\n\n this.fractalRay(time, function fillVertices(segment) {\n const subray = scope.currentSubray\n\n if (time < subray.birthTime) {\n //&& ( ! this.rayParameters.isEternal || scope.currentSubray.recursion > 0 ) ) {\n\n return\n } else if (this.rayParameters.isEternal && scope.currentSubray.recursion == 0) {\n // Eternal rays don't propagate nor vanish, but its subrays do\n\n scope.createPrism(segment)\n\n scope.onDecideSubrayCreation(segment, scope)\n } else if (time < subray.endPropagationTime) {\n if (scope.timeFraction >= segment.fraction0 * subray.propagationTimeFactor) {\n // Ray propagation has arrived to this segment\n\n scope.createPrism(segment)\n\n scope.onDecideSubrayCreation(segment, scope)\n }\n } else if (time < subray.beginVanishingTime) {\n // Ray is steady (nor propagating nor vanishing)\n\n scope.createPrism(segment)\n\n scope.onDecideSubrayCreation(segment, scope)\n } else {\n if (scope.timeFraction <= subray.vanishingTimeFactor + segment.fraction1 * (1 - subray.vanishingTimeFactor)) {\n // Segment has not yet vanished\n\n scope.createPrism(segment)\n }\n\n scope.onDecideSubrayCreation(segment, scope)\n }\n })\n }\n\n addNewSubray(/*rayParameters*/) {\n return this.subrays[this.numSubrays++]\n }\n\n initSubray(subray, rayParameters) {\n subray.pos0.copy(rayParameters.sourceOffset)\n subray.pos1.copy(rayParameters.destOffset)\n subray.up0.copy(rayParameters.up0)\n subray.up1.copy(rayParameters.up1)\n subray.radius0 = rayParameters.radius0\n subray.radius1 = rayParameters.radius1\n subray.birthTime = rayParameters.birthTime\n subray.deathTime = rayParameters.deathTime\n subray.timeScale = rayParameters.timeScale\n subray.roughness = rayParameters.roughness\n subray.straightness = rayParameters.straightness\n subray.propagationTimeFactor = rayParameters.propagationTimeFactor\n subray.vanishingTimeFactor = rayParameters.vanishingTimeFactor\n\n subray.maxIterations = this.maxIterations\n subray.seed = rayParameters.noiseSeed !== undefined ? rayParameters.noiseSeed : 0\n subray.recursion = 0\n }\n\n fractalRay(time, segmentCallback) {\n this.time = time\n this.currentSegmentCallback = segmentCallback\n this.numSubrays = 0\n\n // Add the top level subray\n this.initSubray(this.addNewSubray(), this.rayParameters)\n\n // Process all subrays that are being generated until consuming all of them\n for (let subrayIndex = 0; subrayIndex < this.numSubrays; subrayIndex++) {\n const subray = this.subrays[subrayIndex]\n this.currentSubray = subray\n\n this.randomGenerator.setSeed(subray.seed)\n\n subray.endPropagationTime = MathUtils.lerp(subray.birthTime, subray.deathTime, subray.propagationTimeFactor)\n subray.beginVanishingTime = MathUtils.lerp(subray.deathTime, subray.birthTime, 1 - subray.vanishingTimeFactor)\n\n const random1 = this.randomGenerator.random\n subray.linPos0.set(random1(), random1(), random1()).multiplyScalar(1000)\n subray.linPos1.set(random1(), random1(), random1()).multiplyScalar(1000)\n\n this.timeFraction = (time - subray.birthTime) / (subray.deathTime - subray.birthTime)\n\n this.currentSegmentIndex = 0\n this.isInitialSegment = true\n\n const segment = this.getNewSegment()\n segment.iteration = 0\n segment.pos0.copy(subray.pos0)\n segment.pos1.copy(subray.pos1)\n segment.linPos0.copy(subray.linPos0)\n segment.linPos1.copy(subray.linPos1)\n segment.up0.copy(subray.up0)\n segment.up1.copy(subray.up1)\n segment.radius0 = subray.radius0\n segment.radius1 = subray.radius1\n segment.fraction0 = 0\n segment.fraction1 = 1\n segment.positionVariationFactor = 1 - subray.straightness\n\n this.subrayProbability =\n (this.ramification * Math.pow(this.recursionProbability, subray.recursion)) / (1 << subray.maxIterations)\n\n this.fractalRayRecursive(segment)\n }\n\n this.currentSegmentCallback = null\n this.currentSubray = null\n }\n\n fractalRayRecursive(segment) {\n // Leave recursion condition\n if (segment.iteration >= this.currentSubray.maxIterations) {\n this.currentSegmentCallback(segment)\n\n return\n }\n\n // Interpolation\n this.forwards.subVectors(segment.pos1, segment.pos0)\n let lForwards = this.forwards.length()\n\n if (lForwards < 0.000001) {\n this.forwards.set(0, 0, 0.01)\n lForwards = this.forwards.length()\n }\n\n const middleRadius = (segment.radius0 + segment.radius1) * 0.5\n const middleFraction = (segment.fraction0 + segment.fraction1) * 0.5\n\n const timeDimension = this.time * this.currentSubray.timeScale * Math.pow(2, segment.iteration)\n\n this.middlePos.lerpVectors(segment.pos0, segment.pos1, 0.5)\n this.middleLinPos.lerpVectors(segment.linPos0, segment.linPos1, 0.5)\n const p = this.middleLinPos\n\n // Noise\n this.newPos.set(\n this.simplexX.noise4d(p.x, p.y, p.z, timeDimension),\n this.simplexY.noise4d(p.x, p.y, p.z, timeDimension),\n this.simplexZ.noise4d(p.x, p.y, p.z, timeDimension),\n )\n\n this.newPos.multiplyScalar(segment.positionVariationFactor * lForwards)\n this.newPos.add(this.middlePos)\n\n // Recursion\n\n const newSegment1 = this.getNewSegment()\n newSegment1.pos0.copy(segment.pos0)\n newSegment1.pos1.copy(this.newPos)\n newSegment1.linPos0.copy(segment.linPos0)\n newSegment1.linPos1.copy(this.middleLinPos)\n newSegment1.up0.copy(segment.up0)\n newSegment1.up1.copy(segment.up1)\n newSegment1.radius0 = segment.radius0\n newSegment1.radius1 = middleRadius\n newSegment1.fraction0 = segment.fraction0\n newSegment1.fraction1 = middleFraction\n newSegment1.positionVariationFactor = segment.positionVariationFactor * this.currentSubray.roughness\n newSegment1.iteration = segment.iteration + 1\n\n const newSegment2 = this.getNewSegment()\n newSegment2.pos0.copy(this.newPos)\n newSegment2.pos1.copy(segment.pos1)\n newSegment2.linPos0.copy(this.middleLinPos)\n newSegment2.linPos1.copy(segment.linPos1)\n this.cross1.crossVectors(segment.up0, this.forwards.normalize())\n newSegment2.up0.crossVectors(this.forwards, this.cross1).normalize()\n newSegment2.up1.copy(segment.up1)\n newSegment2.radius0 = middleRadius\n newSegment2.radius1 = segment.radius1\n newSegment2.fraction0 = middleFraction\n newSegment2.fraction1 = segment.fraction1\n newSegment2.positionVariationFactor = segment.positionVariationFactor * this.currentSubray.roughness\n newSegment2.iteration = segment.iteration + 1\n\n this.fractalRayRecursive(newSegment1)\n\n this.fractalRayRecursive(newSegment2)\n }\n\n createPrism(segment) {\n // Creates one triangular prism and its vertices at the segment\n\n this.forwardsFill.subVectors(segment.pos1, segment.pos0).normalize()\n\n if (this.isInitialSegment) {\n this.currentCreateTriangleVertices(segment.pos0, segment.up0, this.forwardsFill, segment.radius0, 0)\n\n this.isInitialSegment = false\n }\n\n this.currentCreateTriangleVertices(segment.pos1, segment.up0, this.forwardsFill, segment.radius1, segment.fraction1)\n\n this.createPrismFaces()\n }\n\n createTriangleVerticesWithoutUVs(pos, up, forwards, radius) {\n // Create an equilateral triangle (only vertices)\n\n this.side.crossVectors(up, forwards).multiplyScalar(radius * LightningStrike.COS30DEG)\n this.down.copy(up).multiplyScalar(-radius * LightningStrike.SIN30DEG)\n\n const p = this.vPos\n const v = this.vertices\n\n p.copy(pos).sub(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n p.copy(pos).add(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n p.copy(up).multiplyScalar(radius).add(pos)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n this.currentVertex += 3\n }\n\n createTriangleVerticesWithUVs(pos, up, forwards, radius, u) {\n // Create an equilateral triangle (only vertices)\n\n this.side.crossVectors(up, forwards).multiplyScalar(radius * LightningStrike.COS30DEG)\n this.down.copy(up).multiplyScalar(-radius * LightningStrike.SIN30DEG)\n\n const p = this.vPos\n const v = this.vertices\n const uv = this.uvs\n\n p.copy(pos).sub(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n uv[this.currentUVCoordinate++] = u\n uv[this.currentUVCoordinate++] = 0\n\n p.copy(pos).add(this.side).add(this.down)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n uv[this.currentUVCoordinate++] = u\n uv[this.currentUVCoordinate++] = 0.5\n\n p.copy(up).multiplyScalar(radius).add(pos)\n\n v[this.currentCoordinate++] = p.x\n v[this.currentCoordinate++] = p.y\n v[this.currentCoordinate++] = p.z\n\n uv[this.currentUVCoordinate++] = u\n uv[this.currentUVCoordinate++] = 1\n\n this.currentVertex += 3\n }\n\n createPrismFaces(vertex /*, index*/) {\n const indices = this.indices\n vertex = this.currentVertex - 6\n\n indices[this.currentIndex++] = vertex + 1\n indices[this.currentIndex++] = vertex + 2\n indices[this.currentIndex++] = vertex + 5\n indices[this.currentIndex++] = vertex + 1\n indices[this.currentIndex++] = vertex + 5\n indices[this.currentIndex++] = vertex + 4\n indices[this.currentIndex++] = vertex + 0\n indices[this.currentIndex++] = vertex + 1\n indices[this.currentIndex++] = vertex + 4\n indices[this.currentIndex++] = vertex + 0\n indices[this.currentIndex++] = vertex + 4\n indices[this.currentIndex++] = vertex + 3\n indices[this.currentIndex++] = vertex + 2\n indices[this.currentIndex++] = vertex + 0\n indices[this.currentIndex++] = vertex + 3\n indices[this.currentIndex++] = vertex + 2\n indices[this.currentIndex++] = vertex + 3\n indices[this.currentIndex++] = vertex + 5\n }\n\n createDefaultSubrayCreationCallbacks() {\n const random1 = this.randomGenerator.random\n\n this.onDecideSubrayCreation = function (segment, lightningStrike) {\n // Decide subrays creation at parent (sub)ray segment\n\n const subray = lightningStrike.currentSubray\n\n const period = lightningStrike.rayParameters.subrayPeriod\n const dutyCycle = lightningStrike.rayParameters.subrayDutyCycle\n\n const phase0 =\n lightningStrike.rayParameters.isEternal && subray.recursion == 0\n ? -random1() * period\n : MathUtils.lerp(subray.birthTime, subray.endPropagationTime, segment.fraction0) - random1() * period\n\n const phase = lightningStrike.time - phase0\n const currentCycle = Math.floor(phase / period)\n\n const childSubraySeed = random1() * (currentCycle + 1)\n\n const isActive = phase % period <= dutyCycle * period\n\n let probability = 0\n\n if (isActive) {\n probability = lightningStrike.subrayProbability\n // Distribution test: probability *= segment.fraction0 > 0.5 && segment.fraction0 < 0.9 ? 1 / 0.4 : 0;\n }\n\n if (\n subray.recursion < lightningStrike.maxSubrayRecursion &&\n lightningStrike.numSubrays < lightningStrike.maxSubrays &&\n random1() < probability\n ) {\n const childSubray = lightningStrike.addNewSubray()\n\n const parentSeed = lightningStrike.randomGenerator.getSeed()\n childSubray.seed = childSubraySeed\n lightningStrike.randomGenerator.setSeed(childSubraySeed)\n\n childSubray.recursion = subray.recursion + 1\n childSubray.maxIterations = Math.max(1, subray.maxIterations - 1)\n\n childSubray.linPos0.set(random1(), random1(), random1()).multiplyScalar(1000)\n childSubray.linPos1.set(random1(), random1(), random1()).multiplyScalar(1000)\n childSubray.up0.copy(subray.up0)\n childSubray.up1.copy(subray.up1)\n childSubray.radius0 = segment.radius0 * lightningStrike.rayParameters.radius0Factor\n childSubray.radius1 = Math.min(\n lightningStrike.rayParameters.minRadius,\n segment.radius1 * lightningStrike.rayParameters.radius1Factor,\n )\n\n childSubray.birthTime = phase0 + currentCycle * period\n childSubray.deathTime = childSubray.birthTime + period * dutyCycle\n\n if (!lightningStrike.rayParameters.isEternal && subray.recursion == 0) {\n childSubray.birthTime = Math.max(childSubray.birthTime, subray.birthTime)\n childSubray.deathTime = Math.min(childSubray.deathTime, subray.deathTime)\n }\n\n childSubray.timeScale = subray.timeScale * 2\n childSubray.roughness = subray.roughness\n childSubray.straightness = subray.straightness\n childSubray.propagationTimeFactor = subray.propagationTimeFactor\n childSubray.vanishingTimeFactor = subray.vanishingTimeFactor\n\n lightningStrike.onSubrayCreation(segment, subray, childSubray, lightningStrike)\n\n lightningStrike.randomGenerator.setSeed(parentSeed)\n }\n }\n\n const vec1Pos = new Vector3()\n const vec2Forward = new Vector3()\n const vec3Side = new Vector3()\n const vec4Up = new Vector3()\n\n this.onSubrayCreation = function (segment, parentSubray, childSubray, lightningStrike) {\n // Decide childSubray origin and destination positions (pos0 and pos1) and possibly other properties of childSubray\n\n // Just use the default cone position generator\n lightningStrike.subrayCylinderPosition(segment, parentSubray, childSubray, 0.5, 0.6, 0.2)\n }\n\n this.subrayConePosition = function (\n segment,\n parentSubray,\n childSubray,\n heightFactor,\n sideWidthFactor,\n minSideWidthFactor,\n ) {\n // Sets childSubray pos0 and pos1 in a cone\n\n childSubray.pos0.copy(segment.pos0)\n\n vec1Pos.subVectors(parentSubray.pos1, parentSubray.pos0)\n vec2Forward.copy(vec1Pos).normalize()\n vec1Pos.multiplyScalar(segment.fraction0 + (1 - segment.fraction0) * (random1() * heightFactor))\n const length = vec1Pos.length()\n vec3Side.crossVectors(parentSubray.up0, vec2Forward)\n const angle = 2 * Math.PI * random1()\n vec3Side.multiplyScalar(Math.cos(angle))\n vec4Up.copy(parentSubray.up0).multiplyScalar(Math.sin(angle))\n\n childSubray.pos1\n .copy(vec3Side)\n .add(vec4Up)\n .multiplyScalar(length * sideWidthFactor * (minSideWidthFactor + random1() * (1 - minSideWidthFactor)))\n .add(vec1Pos)\n .add(parentSubray.pos0)\n }\n\n this.subrayCylinderPosition = function (\n segment,\n parentSubray,\n childSubray,\n heightFactor,\n sideWidthFactor,\n minSideWidthFactor,\n ) {\n // Sets childSubray pos0 and pos1 in a cylinder\n\n childSubray.pos0.copy(segment.pos0)\n\n vec1Pos.subVectors(parentSubray.pos1, parentSubray.pos0)\n vec2Forward.copy(vec1Pos).normalize()\n vec1Pos.multiplyScalar(segment.fraction0 + (1 - segment.fraction0) * ((2 * random1() - 1) * heightFactor))\n const length = vec1Pos.length()\n vec3Side.crossVectors(parentSubray.up0, vec2Forward)\n const angle = 2 * Math.PI * random1()\n vec3Side.multiplyScalar(Math.cos(angle))\n vec4Up.copy(parentSubray.up0).multiplyScalar(Math.sin(angle))\n\n childSubray.pos1\n .copy(vec3Side)\n .add(vec4Up)\n .multiplyScalar(length * sideWidthFactor * (minSideWidthFactor + random1() * (1 - minSideWidthFactor)))\n .add(vec1Pos)\n .add(parentSubray.pos0)\n }\n }\n\n createSubray() {\n return {\n seed: 0,\n maxIterations: 0,\n recursion: 0,\n pos0: new Vector3(),\n pos1: new Vector3(),\n linPos0: new Vector3(),\n linPos1: new Vector3(),\n up0: new Vector3(),\n up1: new Vector3(),\n radius0: 0,\n radius1: 0,\n birthTime: 0,\n deathTime: 0,\n timeScale: 0,\n roughness: 0,\n straightness: 0,\n propagationTimeFactor: 0,\n vanishingTimeFactor: 0,\n endPropagationTime: 0,\n beginVanishingTime: 0,\n }\n }\n\n createSegment() {\n return {\n iteration: 0,\n pos0: new Vector3(),\n pos1: new Vector3(),\n linPos0: new Vector3(),\n linPos1: new Vector3(),\n up0: new Vector3(),\n up1: new Vector3(),\n radius0: 0,\n radius1: 0,\n fraction0: 0,\n fraction1: 0,\n positionVariationFactor: 0,\n }\n }\n\n getNewSegment() {\n return this.raySegments[this.currentSegmentIndex++]\n }\n\n copy(source) {\n super.copy(source)\n\n this.init(LightningStrike.copyParameters({}, source.rayParameters))\n\n return this\n }\n\n clone() {\n return new this.constructor(LightningStrike.copyParameters({}, this.rayParameters))\n }\n}\n\nexport { LightningStrike }\n", "import {\n Color,\n Matrix4,\n Mesh,\n PerspectiveCamera,\n ShaderMaterial,\n UniformsUtils,\n Vector2,\n Vector3,\n WebGLRenderTarget,\n DepthTexture,\n UnsignedShortType,\n NearestFilter,\n Plane,\n HalfFloatType,\n} from 'three'\n\nclass ReflectorForSSRPass extends Mesh {\n static ReflectorShader = {\n defines: {\n DISTANCE_ATTENUATION: true,\n FRESNEL: true,\n },\n\n uniforms: {\n color: { value: null },\n tDiffuse: { value: null },\n tDepth: { value: null },\n textureMatrix: { value: new Matrix4() },\n maxDistance: { value: 180 },\n opacity: { value: 0.5 },\n fresnelCoe: { value: null },\n virtualCameraNear: { value: null },\n virtualCameraFar: { value: null },\n virtualCameraProjectionMatrix: { value: new Matrix4() },\n virtualCameraMatrixWorld: { value: new Matrix4() },\n virtualCameraProjectionMatrixInverse: { value: new Matrix4() },\n resolution: { value: new Vector2() },\n },\n\n vertexShader: /* glsl */ `\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform sampler2D tDepth;\n\t\tuniform float maxDistance;\n\t\tuniform float opacity;\n\t\tuniform float fresnelCoe;\n\t\tuniform float virtualCameraNear;\n\t\tuniform float virtualCameraFar;\n\t\tuniform mat4 virtualCameraProjectionMatrix;\n\t\tuniform mat4 virtualCameraProjectionMatrixInverse;\n\t\tuniform mat4 virtualCameraMatrixWorld;\n\t\tuniform vec2 resolution;\n\t\tvarying vec4 vUv;\n\t\t#include \n\t\tfloat blendOverlay( float base, float blend ) {\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\t\t}\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\treturn perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar );\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view\n\t\t}\n\t\tvoid main() {\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\t#ifdef useDepthTexture\n\t\t\t\tvec2 uv=(gl_FragCoord.xy-.5)/resolution.xy;\n\t\t\t\tuv.x=1.-uv.x;\n\t\t\t\tfloat depth = texture2DProj( tDepth, vUv ).r;\n\t\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\t\tfloat clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3];\n\t\t\t\tvec3 viewPosition=getViewPosition( uv, depth, clipW );\n\t\t\t\tvec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz;\n\t\t\t\tif(worldPosition.y>maxDistance) discard;\n\t\t\t\tfloat op=opacity;\n\t\t\t\t#ifdef DISTANCE_ATTENUATION\n\t\t\t\t\tfloat ratio=1.-(worldPosition.y/maxDistance);\n\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t#endif\n\t\t\t\t#ifdef FRESNEL\n\t\t\t\t\top*=fresnelCoe;\n\t\t\t\t#endif\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), op );\n\t\t\t#else\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\t\t\t#endif\n\t\t}\n\t`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isReflectorForSSRPass = true\n\n this.type = 'ReflectorForSSRPass'\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0x7f7f7f)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const shader = options.shader || ReflectorForSSRPass.ReflectorShader\n const useDepthTexture = options.useDepthTexture === true\n const yAxis = new Vector3(0, 1, 0)\n const vecTemp0 = new Vector3()\n const vecTemp1 = new Vector3()\n\n //\n\n scope.needsUpdate = false\n scope.maxDistance = ReflectorForSSRPass.ReflectorShader.uniforms.maxDistance.value\n scope.opacity = ReflectorForSSRPass.ReflectorShader.uniforms.opacity.value\n scope.color = color\n scope.resolution = options.resolution || new Vector2(window.innerWidth, window.innerHeight)\n\n scope._distanceAttenuation = ReflectorForSSRPass.ReflectorShader.defines.DISTANCE_ATTENUATION\n Object.defineProperty(scope, 'distanceAttenuation', {\n get() {\n return scope._distanceAttenuation\n },\n set(val) {\n if (scope._distanceAttenuation === val) return\n scope._distanceAttenuation = val\n scope.material.defines.DISTANCE_ATTENUATION = val\n scope.material.needsUpdate = true\n },\n })\n\n scope._fresnel = ReflectorForSSRPass.ReflectorShader.defines.FRESNEL\n Object.defineProperty(scope, 'fresnel', {\n get() {\n return scope._fresnel\n },\n set(val) {\n if (scope._fresnel === val) return\n scope._fresnel = val\n scope.material.defines.FRESNEL = val\n scope.material.needsUpdate = true\n },\n })\n\n const normal = new Vector3()\n const reflectorWorldPosition = new Vector3()\n const cameraWorldPosition = new Vector3()\n const rotationMatrix = new Matrix4()\n const lookAtPosition = new Vector3(0, 0, -1)\n\n const view = new Vector3()\n const target = new Vector3()\n\n const textureMatrix = new Matrix4()\n const virtualCamera = new PerspectiveCamera()\n\n let depthTexture\n\n if (useDepthTexture) {\n depthTexture = new DepthTexture()\n depthTexture.type = UnsignedShortType\n depthTexture.minFilter = NearestFilter\n depthTexture.magFilter = NearestFilter\n }\n\n const parameters = {\n depthTexture: useDepthTexture ? depthTexture : null,\n type: HalfFloatType,\n }\n\n const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight, parameters)\n\n const material = new ShaderMaterial({\n transparent: useDepthTexture,\n defines: Object.assign({}, ReflectorForSSRPass.ReflectorShader.defines, {\n useDepthTexture,\n }),\n uniforms: UniformsUtils.clone(shader.uniforms),\n fragmentShader: shader.fragmentShader,\n vertexShader: shader.vertexShader,\n })\n\n material.uniforms['tDiffuse'].value = renderTarget.texture\n material.uniforms['color'].value = scope.color\n material.uniforms['textureMatrix'].value = textureMatrix\n if (useDepthTexture) {\n material.uniforms['tDepth'].value = renderTarget.depthTexture\n }\n\n this.material = material\n\n const globalPlane = new Plane(new Vector3(0, 1, 0), clipBias)\n const globalPlanes = [globalPlane]\n\n this.doRender = function (renderer, scene, camera) {\n material.uniforms['maxDistance'].value = scope.maxDistance\n material.uniforms['color'].value = scope.color\n material.uniforms['opacity'].value = scope.opacity\n\n vecTemp0.copy(camera.position).normalize()\n vecTemp1.copy(vecTemp0).reflect(yAxis)\n material.uniforms['fresnelCoe'].value = (vecTemp0.dot(vecTemp1) + 1) / 2 // TODO: Also need to use glsl viewPosition and viewNormal per pixel.\n\n reflectorWorldPosition.setFromMatrixPosition(scope.matrixWorld)\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld)\n\n rotationMatrix.extractRotation(scope.matrixWorld)\n\n normal.set(0, 0, 1)\n normal.applyMatrix4(rotationMatrix)\n\n view.subVectors(reflectorWorldPosition, cameraWorldPosition)\n\n // Avoid rendering when reflector is facing away\n\n if (view.dot(normal) > 0) return\n\n view.reflect(normal).negate()\n view.add(reflectorWorldPosition)\n\n rotationMatrix.extractRotation(camera.matrixWorld)\n\n lookAtPosition.set(0, 0, -1)\n lookAtPosition.applyMatrix4(rotationMatrix)\n lookAtPosition.add(cameraWorldPosition)\n\n target.subVectors(reflectorWorldPosition, lookAtPosition)\n target.reflect(normal).negate()\n target.add(reflectorWorldPosition)\n\n virtualCamera.position.copy(view)\n virtualCamera.up.set(0, 1, 0)\n virtualCamera.up.applyMatrix4(rotationMatrix)\n virtualCamera.up.reflect(normal)\n virtualCamera.lookAt(target)\n\n virtualCamera.far = camera.far // Used in WebGLBackground\n\n virtualCamera.updateMatrixWorld()\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix)\n\n material.uniforms['virtualCameraNear'].value = camera.near\n material.uniforms['virtualCameraFar'].value = camera.far\n material.uniforms['virtualCameraMatrixWorld'].value = virtualCamera.matrixWorld\n material.uniforms['virtualCameraProjectionMatrix'].value = camera.projectionMatrix\n material.uniforms['virtualCameraProjectionMatrixInverse'].value = camera.projectionMatrixInverse\n material.uniforms['resolution'].value = scope.resolution\n\n // Update the texture matrix\n textureMatrix.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 textureMatrix.multiply(virtualCamera.projectionMatrix)\n textureMatrix.multiply(virtualCamera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n\n // scope.visible = false;\n\n const currentRenderTarget = renderer.getRenderTarget()\n\n const currentXrEnabled = renderer.xr.enabled\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate\n const currentClippingPlanes = renderer.clippingPlanes\n\n renderer.xr.enabled = false // Avoid camera modification\n renderer.shadowMap.autoUpdate = false // Avoid re-computing shadows\n renderer.clippingPlanes = globalPlanes\n\n renderer.setRenderTarget(renderTarget)\n\n renderer.state.buffers.depth.setMask(true) // make sure the depth buffer is writable so it can be properly cleared, see #18897\n\n if (renderer.autoClear === false) renderer.clear()\n renderer.render(scene, virtualCamera)\n\n renderer.xr.enabled = currentXrEnabled\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate\n renderer.clippingPlanes = currentClippingPlanes\n\n renderer.setRenderTarget(currentRenderTarget)\n\n // Restore viewport\n\n const viewport = camera.viewport\n\n if (viewport !== undefined) {\n renderer.state.viewport(viewport)\n }\n\n // scope.visible = true;\n }\n\n this.getRenderTarget = function () {\n return renderTarget\n }\n }\n}\n\nexport { ReflectorForSSRPass }\n", "import { BackSide, BoxGeometry, Mesh, ShaderMaterial, UniformsUtils, Vector3 } from 'three'\nimport { version } from '../_polyfill/constants'\n\nconst SkyShader = {\n uniforms: {\n turbidity: { value: 2 },\n rayleigh: { value: 1 },\n mieCoefficient: { value: 0.005 },\n mieDirectionalG: { value: 0.8 },\n sunPosition: { value: new Vector3() },\n up: { value: new Vector3(0, 1, 0) },\n },\n\n vertexShader: /* glsl */ `\n uniform vec3 sunPosition;\n uniform float rayleigh;\n uniform float turbidity;\n uniform float mieCoefficient;\n uniform vec3 up;\n\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n // constants for atmospheric scattering\n const float e = 2.71828182845904523536028747135266249775724709369995957;\n const float pi = 3.141592653589793238462643383279502884197169;\n\n // wavelength of used primaries, according to preetham\n const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n // mie stuff\n // K coefficient for the primaries\n const float v = 4.0;\n const vec3 K = vec3( 0.686, 0.678, 0.666 );\n // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n // earth shadow hack\n // cutoffAngle = pi / 1.95;\n const float cutoffAngle = 1.6110731556870734;\n const float steepness = 1.5;\n const float EE = 1000.0;\n\n float sunIntensity( float zenithAngleCos ) {\n zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n }\n\n vec3 totalMie( float T ) {\n float c = ( 0.2 * T ) * 10E-18;\n return 0.434 * c * MieConst;\n }\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = worldPosition.xyz;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n gl_Position.z = gl_Position.w; // set z to camera.far\n\n vSunDirection = normalize( sunPosition );\n\n vSunE = sunIntensity( dot( vSunDirection, up ) );\n\n vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n // extinction (absorbtion + out scattering)\n // rayleigh coefficients\n vBetaR = totalRayleigh * rayleighCoefficient;\n\n // mie coefficients\n vBetaM = totalMie( turbidity ) * mieCoefficient;\n\n }\n `,\n\n fragmentShader: /* glsl */ `\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n uniform float mieDirectionalG;\n uniform vec3 up;\n\n const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n // constants for atmospheric scattering\n const float pi = 3.141592653589793238462643383279502884197169;\n\n const float n = 1.0003; // refractive index of air\n const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n // optical length at zenith for molecules\n const float rayleighZenithLength = 8.4E3;\n const float mieZenithLength = 1.25E3;\n // 66 arc seconds -> degrees, and the cosine of that\n const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n // 3.0 / ( 16.0 * pi )\n const float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n // 1.0 / ( 4.0 * pi )\n const float ONE_OVER_FOURPI = 0.07957747154594767;\n\n float rayleighPhase( float cosTheta ) {\n return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n }\n\n float hgPhase( float cosTheta, float g ) {\n float g2 = pow( g, 2.0 );\n float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n }\n\n void main() {\n\n vec3 direction = normalize( vWorldPosition - cameraPos );\n\n // optical length\n // cutoff angle at 90 to avoid singularity in next formula.\n float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n float sR = rayleighZenithLength * inverse;\n float sM = mieZenithLength * inverse;\n\n // combined extinction factor\n vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n // in scattering\n float cosTheta = dot( direction, vSunDirection );\n\n float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n vec3 betaRTheta = vBetaR * rPhase;\n\n float mPhase = hgPhase( cosTheta, mieDirectionalG );\n vec3 betaMTheta = vBetaM * mPhase;\n\n vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n // nightsky\n float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]\n float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]\n vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n vec3 L0 = vec3( 0.1 ) * Fex;\n\n // composition + solar disc\n float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n L0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n gl_FragColor = vec4( retColor, 1.0 );\n\n #include \n #include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\n }\n `,\n}\n\nconst material = new ShaderMaterial({\n name: 'SkyShader',\n fragmentShader: SkyShader.fragmentShader,\n vertexShader: SkyShader.vertexShader,\n uniforms: UniformsUtils.clone(SkyShader.uniforms),\n side: BackSide,\n depthWrite: false,\n})\n\n/**\n * Based on \"A Practical Analytic Model for Daylight\"\n * aka The Preetham Model, the de facto standard analytic skydome model\n * https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight\n *\n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n */\nclass Sky extends Mesh {\n constructor() {\n super(new BoxGeometry(1, 1, 1), material)\n }\n\n static SkyShader = SkyShader\n public static material = material\n}\n\nexport { Sky }\n", "import {\n Clock,\n Color,\n Matrix4,\n Mesh,\n RepeatWrapping,\n ShaderMaterial,\n UniformsLib,\n UniformsUtils,\n Vector2,\n Vector4,\n} from 'three'\nimport { Reflector } from './Reflector'\nimport { Refractor } from './Refractor'\nimport { version } from '../_polyfill/constants'\n\n/**\n * References:\n *\thttp://www.valvesoftware.com/publications/2010/siggraph2010_vlachos_waterflow.pdf\n * \thttp://graphicsrunner.blogspot.de/2010/08/water-using-flow-maps.html\n *\n */\n\nclass Water2 extends Mesh {\n static WaterShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n reflectivity: {\n value: 0,\n },\n\n tReflectionMap: {\n value: null,\n },\n\n tRefractionMap: {\n value: null,\n },\n\n tNormalMap0: {\n value: null,\n },\n\n tNormalMap1: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n\n config: {\n value: new Vector4(),\n },\n },\n\n vertexShader: /* glsl */ `\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tvCoord = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvToEye = cameraPosition - worldPosition.xyz;\n\n\t\t\tvec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex\n\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}`,\n\n fragmentShader: /* glsl */ `\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform sampler2D tReflectionMap;\n\t\tuniform sampler2D tRefractionMap;\n\t\tuniform sampler2D tNormalMap0;\n\t\tuniform sampler2D tNormalMap1;\n\n\t\t#ifdef USE_FLOWMAP\n\t\t\tuniform sampler2D tFlowMap;\n\t\t#else\n\t\t\tuniform vec2 flowDirection;\n\t\t#endif\n\n\t\tuniform vec3 color;\n\t\tuniform float reflectivity;\n\t\tuniform vec4 config;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tfloat flowMapOffset0 = config.x;\n\t\t\tfloat flowMapOffset1 = config.y;\n\t\t\tfloat halfCycle = config.z;\n\t\t\tfloat scale = config.w;\n\n\t\t\tvec3 toEye = normalize( vToEye );\n\n\t\t\t// determine flow direction\n\t\t\tvec2 flow;\n\t\t\t#ifdef USE_FLOWMAP\n\t\t\t\tflow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;\n\t\t\t#else\n\t\t\t\tflow = flowDirection;\n\t\t\t#endif\n\t\t\tflow.x *= - 1.0;\n\n\t\t\t// sample normal maps (distort uvs with flowdata)\n\t\t\tvec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );\n\t\t\tvec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );\n\n\t\t\t// linear interpolate to get the final normal color\n\t\t\tfloat flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;\n\t\t\tvec4 normalColor = mix( normalColor0, normalColor1, flowLerp );\n\n\t\t\t// calculate normal vector\n\t\t\tvec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n\n\t\t\t// calculate the fresnel term to blend reflection and refraction maps\n\t\t\tfloat theta = max( dot( toEye, normal ), 0.0 );\n\t\t\tfloat reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );\n\n\t\t\t// calculate final uv coords\n\t\t\tvec3 coord = vCoord.xyz / vCoord.w;\n\t\t\tvec2 uv = coord.xy + coord.z * normal.xz * 0.05;\n\n\t\t\tvec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );\n\t\t\tvec4 refractColor = texture2D( tRefractionMap, uv );\n\n\t\t\t// multiply water color with the mix of both textures\n\t\t\tgl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );\n\n\t\t\t#include \n\t\t\t#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n\t\t\t#include \n\n\t\t}`,\n }\n\n constructor(geometry, options = {}) {\n super(geometry)\n\n this.isWater = true\n\n this.type = 'Water'\n\n const scope = this\n\n const color = options.color !== undefined ? new Color(options.color) : new Color(0xffffff)\n const textureWidth = options.textureWidth || 512\n const textureHeight = options.textureHeight || 512\n const clipBias = options.clipBias || 0\n const flowDirection = options.flowDirection || new Vector2(1, 0)\n const flowSpeed = options.flowSpeed || 0.03\n const reflectivity = options.reflectivity || 0.02\n const scale = options.scale || 1\n const shader = options.shader || Water2.WaterShader\n const encoding = options.encoding !== undefined ? options.encoding : 3000\n\n const flowMap = options.flowMap || undefined\n const normalMap0 = options.normalMap0\n const normalMap1 = options.normalMap1\n\n const cycle = 0.15 // a cycle of a flow map phase\n const halfCycle = cycle * 0.5\n const textureMatrix = new Matrix4()\n const clock = new Clock()\n\n // internal components\n\n if (Reflector === undefined) {\n console.error('THREE.Water: Required component Reflector not found.')\n return\n }\n\n if (Refractor === undefined) {\n console.error('THREE.Water: Required component Refractor not found.')\n return\n }\n\n const reflector = new Reflector(geometry, {\n textureWidth: textureWidth,\n textureHeight: textureHeight,\n clipBias: clipBias,\n encoding: encoding,\n })\n\n const refractor = new Refractor(geometry, {\n textureWidth: textureWidth,\n textureHeight: textureHeight,\n clipBias: clipBias,\n encoding: encoding,\n })\n\n reflector.matrixAutoUpdate = false\n refractor.matrixAutoUpdate = false\n\n // material\n\n this.material = new ShaderMaterial({\n uniforms: UniformsUtils.merge([UniformsLib['fog'], shader.uniforms]),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n transparent: true,\n fog: true,\n })\n\n if (flowMap !== undefined) {\n this.material.defines.USE_FLOWMAP = ''\n this.material.uniforms['tFlowMap'] = {\n type: 't',\n value: flowMap,\n }\n } else {\n this.material.uniforms['flowDirection'] = {\n type: 'v2',\n value: flowDirection,\n }\n }\n\n // maps\n\n normalMap0.wrapS = normalMap0.wrapT = RepeatWrapping\n normalMap1.wrapS = normalMap1.wrapT = RepeatWrapping\n\n this.material.uniforms['tReflectionMap'].value = reflector.getRenderTarget().texture\n this.material.uniforms['tRefractionMap'].value = refractor.getRenderTarget().texture\n this.material.uniforms['tNormalMap0'].value = normalMap0\n this.material.uniforms['tNormalMap1'].value = normalMap1\n\n // water\n\n this.material.uniforms['color'].value = color\n this.material.uniforms['reflectivity'].value = reflectivity\n this.material.uniforms['textureMatrix'].value = textureMatrix\n\n // inital values\n\n this.material.uniforms['config'].value.x = 0 // flowMapOffset0\n this.material.uniforms['config'].value.y = halfCycle // flowMapOffset1\n this.material.uniforms['config'].value.z = halfCycle // halfCycle\n this.material.uniforms['config'].value.w = scale // scale\n\n // functions\n\n function updateTextureMatrix(camera) {\n textureMatrix.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\n textureMatrix.multiply(camera.projectionMatrix)\n textureMatrix.multiply(camera.matrixWorldInverse)\n textureMatrix.multiply(scope.matrixWorld)\n }\n\n function updateFlow() {\n const delta = clock.getDelta()\n const config = scope.material.uniforms['config']\n\n config.value.x += flowSpeed * delta // flowMapOffset0\n config.value.y = config.value.x + halfCycle // flowMapOffset1\n\n // Important: The distance between offsets should be always the value of \"halfCycle\".\n // Moreover, both offsets should be in the range of [ 0, cycle ].\n // This approach ensures a smooth water flow and avoids \"reset\" effects.\n\n if (config.value.x >= cycle) {\n config.value.x = 0\n config.value.y = halfCycle\n } else if (config.value.y >= cycle) {\n config.value.y = config.value.y - cycle\n }\n }\n\n //\n\n this.onBeforeRender = function (renderer, scene, camera) {\n updateTextureMatrix(camera)\n updateFlow()\n\n scope.visible = false\n\n reflector.matrixWorld.copy(scope.matrixWorld)\n refractor.matrixWorld.copy(scope.matrixWorld)\n\n reflector.onBeforeRender(renderer, scene, camera)\n refractor.onBeforeRender(renderer, scene, camera)\n\n scope.visible = true\n }\n }\n}\n\nexport { Water2 }\n", "/**\n * This class generates custom mipmaps for a roughness map by encoding the lost variation in the\n * normal map mip levels as increased roughness in the corresponding roughness mip levels. This\n * helps with rendering accuracy for MeshStandardMaterial, and also helps with anti-aliasing when\n * using PMREM. If the normal map is larger than the roughness map, the roughness map will be\n * enlarged to match the dimensions of the normal map.\n */\n\nimport {\n MathUtils,\n Mesh,\n NoBlending,\n OrthographicCamera,\n PlaneGeometry,\n RawShaderMaterial,\n Vector2,\n WebGLRenderTarget,\n} from 'three'\n\nvar _mipmapMaterial = _getMipmapMaterial()\n\nvar _mesh = new Mesh(new PlaneGeometry(2, 2), _mipmapMaterial)\n\nvar _flatCamera = new OrthographicCamera(0, 1, 0, 1, 0, 1)\n\nvar _tempTarget = null\n\nclass RoughnessMipmapper {\n constructor(renderer) {\n this._renderer = renderer\n\n this._renderer.compile(_mesh, _flatCamera)\n }\n\n generateMipmaps = function (material) {\n if ('roughnessMap' in material === false) return\n\n var { roughnessMap, normalMap } = material\n\n if (\n roughnessMap === null ||\n normalMap === null ||\n !roughnessMap.generateMipmaps ||\n material.userData.roughnessUpdated\n ) {\n return\n }\n\n material.userData.roughnessUpdated = true\n\n var width = Math.max(roughnessMap.image.width, normalMap.image.width)\n\n var height = Math.max(roughnessMap.image.height, normalMap.image.height)\n\n if (!MathUtils.isPowerOfTwo(width) || !MathUtils.isPowerOfTwo(height)) return\n\n var oldTarget = this._renderer.getRenderTarget()\n\n var autoClear = this._renderer.autoClear\n\n this._renderer.autoClear = false\n\n if (_tempTarget === null || _tempTarget.width !== width || _tempTarget.height !== height) {\n if (_tempTarget !== null) _tempTarget.dispose()\n\n _tempTarget = new WebGLRenderTarget(width, height, {\n depthBuffer: false,\n })\n\n _tempTarget.scissorTest = true\n }\n\n if (width !== roughnessMap.image.width || height !== roughnessMap.image.height) {\n var params = {\n wrapS: roughnessMap.wrapS,\n wrapT: roughnessMap.wrapT,\n magFilter: roughnessMap.magFilter,\n minFilter: roughnessMap.minFilter,\n depthBuffer: false,\n }\n\n var newRoughnessTarget = new WebGLRenderTarget(width, height, params)\n\n newRoughnessTarget.texture.generateMipmaps = true\n\n // Setting the render target causes the memory to be allocated.\n\n this._renderer.setRenderTarget(newRoughnessTarget)\n\n material.roughnessMap = newRoughnessTarget.texture\n\n if (material.metalnessMap == roughnessMap) material.metalnessMap = material.roughnessMap\n\n if (material.aoMap == roughnessMap) material.aoMap = material.roughnessMap\n }\n\n _mipmapMaterial.uniforms.roughnessMap.value = roughnessMap\n\n _mipmapMaterial.uniforms.normalMap.value = normalMap\n\n var position = new Vector2(0, 0)\n\n var texelSize = _mipmapMaterial.uniforms.texelSize.value\n\n for (let mip = 0; width >= 1 && height >= 1; ++mip, width /= 2, height /= 2) {\n // Rendering to a mip level is not allowed in webGL1. Instead we must set\n // up a secondary texture to write the result to, then copy it back to the\n // proper mipmap level.\n\n texelSize.set(1.0 / width, 1.0 / height)\n\n if (mip == 0) texelSize.set(0.0, 0.0)\n\n _tempTarget.viewport.set(position.x, position.y, width, height)\n\n _tempTarget.scissor.set(position.x, position.y, width, height)\n\n this._renderer.setRenderTarget(_tempTarget)\n\n this._renderer.render(_mesh, _flatCamera)\n\n this._renderer.copyFramebufferToTexture(position, material.roughnessMap, mip)\n\n _mipmapMaterial.uniforms.roughnessMap.value = material.roughnessMap\n }\n\n if (roughnessMap !== material.roughnessMap) roughnessMap.dispose()\n\n this._renderer.setRenderTarget(oldTarget)\n\n this._renderer.autoClear = autoClear\n }\n\n dispose = function () {\n _mipmapMaterial.dispose()\n\n _mesh.geometry.dispose()\n\n if (_tempTarget != null) _tempTarget.dispose()\n }\n}\n\nfunction _getMipmapMaterial() {\n var shaderMaterial = new RawShaderMaterial({\n uniforms: {\n roughnessMap: { value: null },\n normalMap: { value: null },\n texelSize: { value: new Vector2(1, 1) },\n },\n\n vertexShader: /* glsl */ `\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n fragmentShader: /* glsl */ `\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tuniform sampler2D roughnessMap;\n\t\t\tuniform sampler2D normalMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec4 envMapTexelToLinear( vec4 a ) { return a; }\n\n\t\t\t#include \n\n\t\t\tfloat roughnessToVariance( float roughness ) {\n\n\t\t\t\tfloat variance = 0.0;\n\n\t\t\t\tif ( roughness >= r1 ) {\n\n\t\t\t\t\tvariance = ( r0 - roughness ) * ( v1 - v0 ) / ( r0 - r1 ) + v0;\n\n\t\t\t\t} else if ( roughness >= r4 ) {\n\n\t\t\t\t\tvariance = ( r1 - roughness ) * ( v4 - v1 ) / ( r1 - r4 ) + v1;\n\n\t\t\t\t} else if ( roughness >= r5 ) {\n\n\t\t\t\t\tvariance = ( r4 - roughness ) * ( v5 - v4 ) / ( r4 - r5 ) + v4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfloat roughness2 = roughness * roughness;\n\n\t\t\t\t\tvariance = 1.79 * roughness2 * roughness2;\n\n\t\t\t\t}\n\n\t\t\t\treturn variance;\n\n\t\t\t}\n\n\t\t\tfloat varianceToRoughness( float variance ) {\n\n\t\t\t\tfloat roughness = 0.0;\n\n\t\t\t\tif ( variance >= v1 ) {\n\n\t\t\t\t\troughness = ( v0 - variance ) * ( r1 - r0 ) / ( v0 - v1 ) + r0;\n\n\t\t\t\t} else if ( variance >= v4 ) {\n\n\t\t\t\t\troughness = ( v1 - variance ) * ( r4 - r1 ) / ( v1 - v4 ) + r1;\n\n\t\t\t\t} else if ( variance >= v5 ) {\n\n\t\t\t\t\troughness = ( v4 - variance ) * ( r5 - r4 ) / ( v4 - v5 ) + r4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\troughness = pow( 0.559 * variance, 0.25 ); // 0.559 = 1.0 / 1.79\n\n\t\t\t\t}\n\n\t\t\t\treturn roughness;\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = texture2D( roughnessMap, vUv, - 1.0 );\n\n\t\t\t\tif ( texelSize.x == 0.0 ) return;\n\n\t\t\t\tfloat roughness = gl_FragColor.g;\n\n\t\t\t\tfloat variance = roughnessToVariance( roughness );\n\n\t\t\t\tvec3 avgNormal;\n\n\t\t\t\tfor ( float x = - 1.0; x < 2.0; x += 2.0 ) {\n\n\t\t\t\t\tfor ( float y = - 1.0; y < 2.0; y += 2.0 ) {\n\n\t\t\t\t\t\tvec2 uv = vUv + vec2( x, y ) * 0.25 * texelSize;\n\n\t\t\t\t\t\tavgNormal += normalize( texture2D( normalMap, uv, - 1.0 ).xyz - 0.5 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvariance += 1.0 - 0.25 * length( avgNormal );\n\n\t\t\t\tgl_FragColor.g = varianceToRoughness( variance );\n\n\t\t\t}\n\t\t`,\n\n blending: NoBlending,\n depthTest: false,\n depthWrite: false,\n })\n\n shaderMaterial.type = 'RoughnessMipmapper'\n\n return shaderMaterial\n}\n\nexport { RoughnessMipmapper }\n", "/**\n * Unpack RGBA depth shader\n * - show RGBA encoded depth as monochrome color\n */\n\nexport const UnpackDepthRGBAShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n '#include ',\n\n 'void main() {',\n\n '\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );',\n '\tgl_FragColor = vec4( vec3( depth ), opacity );',\n\n '}',\n ].join('\\n'),\n}\n", "import { IUniform, Texture, Vector2 } from 'three'\n\nexport interface BokehShader2Uniforms {\n textureWidth: IUniform\n textureHeight: IUniform\n\n focalDepth: IUniform\n focalLength: IUniform\n fstop: IUniform\n\n tColor: IUniform\n tDepth: IUniform\n\n maxblur: IUniform\n\n showFocus: IUniform\n manualdof: IUniform\n vignetting: IUniform\n depthblur: IUniform\n\n threshold: IUniform\n gain: IUniform\n bias: IUniform\n fringe: IUniform\n\n znear: IUniform\n zfar: IUniform\n\n noise: IUniform\n dithering: IUniform\n pentagon: IUniform\n\n shaderFocus: IUniform\n focusCoords: IUniform\n}\n\n/**\n * Depth-of-field shader with bokeh\n * ported from GLSL shader by Martins Upitis\n * http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update)\n *\n * Requires #define RINGS and SAMPLES integers\n */\n\nexport const BokehShader2: {\n uniforms: BokehShader2Uniforms\n vertexShader: string\n fragmentShader: string\n} = {\n uniforms: {\n textureWidth: { value: 1.0 },\n textureHeight: { value: 1.0 },\n\n focalDepth: { value: 1.0 },\n focalLength: { value: 24.0 },\n fstop: { value: 0.9 },\n\n tColor: { value: null },\n tDepth: { value: null },\n\n maxblur: { value: 1.0 },\n\n showFocus: { value: 0 },\n manualdof: { value: 0 },\n vignetting: { value: 0 },\n depthblur: { value: 0 },\n\n threshold: { value: 0.5 },\n gain: { value: 2.0 },\n bias: { value: 0.5 },\n fringe: { value: 0.7 },\n\n znear: { value: 0.1 },\n zfar: { value: 100 },\n\n noise: { value: 1 },\n dithering: { value: 0.0001 },\n pentagon: { value: 0 },\n\n shaderFocus: { value: 1 },\n focusCoords: { value: new Vector2() },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tColor;',\n 'uniform sampler2D tDepth;',\n 'uniform float textureWidth;',\n 'uniform float textureHeight;',\n\n 'uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below',\n 'uniform float focalLength; //focal length in mm',\n 'uniform float fstop; //f-stop value',\n 'uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)',\n\n '/*',\n 'make sure that these two values are the same for your camera, otherwise distances will be wrong.',\n '*/',\n\n 'uniform float znear; // camera clipping start',\n 'uniform float zfar; // camera clipping end',\n\n '//------------------------------------------',\n '//user variables',\n\n 'const int samples = SAMPLES; //samples on the first ring',\n 'const int rings = RINGS; //ring count',\n\n 'const int maxringsamples = rings * samples;',\n\n 'uniform bool manualdof; // manual dof calculation',\n 'float ndofstart = 1.0; // near dof blur start',\n 'float ndofdist = 2.0; // near dof blur falloff distance',\n 'float fdofstart = 1.0; // far dof blur start',\n 'float fdofdist = 3.0; // far dof blur falloff distance',\n\n 'float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)',\n\n 'uniform bool vignetting; // use optical lens vignetting',\n\n 'float vignout = 1.3; // vignetting outer border',\n 'float vignin = 0.0; // vignetting inner border',\n 'float vignfade = 22.0; // f-stops till vignete fades',\n\n 'uniform bool shaderFocus;',\n '// disable if you use external focalDepth value',\n\n 'uniform vec2 focusCoords;',\n '// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)',\n '// if center of screen use vec2(0.5, 0.5);',\n\n 'uniform float maxblur;',\n '//clamp value of max blur (0.0 = no blur, 1.0 default)',\n\n 'uniform float threshold; // highlight threshold;',\n 'uniform float gain; // highlight gain;',\n\n 'uniform float bias; // bokeh edge bias',\n 'uniform float fringe; // bokeh chromatic aberration / fringing',\n\n 'uniform bool noise; //use noise instead of pattern for sample dithering',\n\n 'uniform float dithering;',\n\n 'uniform bool depthblur; // blur the depth buffer',\n 'float dbsize = 1.25; // depth blur size',\n\n '/*',\n 'next part is experimental',\n 'not looking good with small sample and ring count',\n 'looks okay starting from samples = 4, rings = 4',\n '*/',\n\n 'uniform bool pentagon; //use pentagon as bokeh shape?',\n 'float feather = 0.4; //pentagon shape feather',\n\n '//------------------------------------------',\n\n 'float penta(vec2 coords) {',\n '\t//pentagonal shape',\n '\tfloat scale = float(rings) - 1.3;',\n '\tvec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);',\n '\tvec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);',\n '\tvec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);',\n '\tvec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);',\n '\tvec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);',\n '\tvec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);',\n\n '\tvec4 one = vec4( 1.0 );',\n\n '\tvec4 P = vec4((coords),vec2(scale, scale));',\n\n '\tvec4 dist = vec4(0.0);',\n '\tfloat inorout = -4.0;',\n\n '\tdist.x = dot( P, HS0 );',\n '\tdist.y = dot( P, HS1 );',\n '\tdist.z = dot( P, HS2 );',\n '\tdist.w = dot( P, HS3 );',\n\n '\tdist = smoothstep( -feather, feather, dist );',\n\n '\tinorout += dot( dist, one );',\n\n '\tdist.x = dot( P, HS4 );',\n '\tdist.y = HS5.w - abs( P.z );',\n\n '\tdist = smoothstep( -feather, feather, dist );',\n '\tinorout += dist.x;',\n\n '\treturn clamp( inorout, 0.0, 1.0 );',\n '}',\n\n 'float bdepth(vec2 coords) {',\n '\t// Depth buffer blur',\n '\tfloat d = 0.0;',\n '\tfloat kernel[9];',\n '\tvec2 offset[9];',\n\n '\tvec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;',\n\n '\toffset[0] = vec2(-wh.x,-wh.y);',\n '\toffset[1] = vec2( 0.0, -wh.y);',\n '\toffset[2] = vec2( wh.x -wh.y);',\n\n '\toffset[3] = vec2(-wh.x, 0.0);',\n '\toffset[4] = vec2( 0.0, 0.0);',\n '\toffset[5] = vec2( wh.x, 0.0);',\n\n '\toffset[6] = vec2(-wh.x, wh.y);',\n '\toffset[7] = vec2( 0.0, wh.y);',\n '\toffset[8] = vec2( wh.x, wh.y);',\n\n '\tkernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;',\n '\tkernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;',\n '\tkernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;',\n\n '\tfor( int i=0; i<9; i++ ) {',\n '\t\tfloat tmp = texture2D(tDepth, coords + offset[i]).r;',\n '\t\td += tmp * kernel[i];',\n '\t}',\n\n '\treturn d;',\n '}',\n\n 'vec3 color(vec2 coords,float blur) {',\n '\t//processing the sample',\n\n '\tvec3 col = vec3(0.0);',\n '\tvec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);',\n\n '\tcol.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;',\n '\tcol.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;',\n '\tcol.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;',\n\n '\tvec3 lumcoeff = vec3(0.299,0.587,0.114);',\n '\tfloat lum = dot(col.rgb, lumcoeff);',\n '\tfloat thresh = max((lum-threshold)*gain, 0.0);',\n '\treturn col+mix(vec3(0.0),col,thresh*blur);',\n '}',\n\n 'vec3 debugFocus(vec3 col, float blur, float depth) {',\n '\tfloat edge = 0.002*depth; //distance based edge smoothing',\n '\tfloat m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);',\n '\tfloat e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);',\n\n '\tcol = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);',\n '\tcol = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);',\n\n '\treturn col;',\n '}',\n\n 'float linearize(float depth) {',\n '\treturn -zfar * znear / (depth * (zfar - znear) - zfar);',\n '}',\n\n 'float vignette() {',\n '\tfloat dist = distance(vUv.xy, vec2(0.5,0.5));',\n '\tdist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);',\n '\treturn clamp(dist,0.0,1.0);',\n '}',\n\n 'float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {',\n '\tfloat rings2 = float(rings);',\n '\tfloat step = PI*2.0 / float(ringsamples);',\n '\tfloat pw = cos(j*step)*i;',\n '\tfloat ph = sin(j*step)*i;',\n '\tfloat p = 1.0;',\n '\tif (pentagon) {',\n '\t\tp = penta(vec2(pw,ph));',\n '\t}',\n '\tcol += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;',\n '\treturn 1.0 * mix(1.0, i /rings2, bias) * p;',\n '}',\n\n 'void main() {',\n '\t//scene depth calculation',\n\n '\tfloat depth = linearize(texture2D(tDepth,vUv.xy).x);',\n\n '\t// Blur depth?',\n '\tif ( depthblur ) {',\n '\t\tdepth = linearize(bdepth(vUv.xy));',\n '\t}',\n\n '\t//focal plane calculation',\n\n '\tfloat fDepth = focalDepth;',\n\n '\tif (shaderFocus) {',\n\n '\t\tfDepth = linearize(texture2D(tDepth,focusCoords).x);',\n\n '\t}',\n\n '\t// dof blur factor calculation',\n\n '\tfloat blur = 0.0;',\n\n '\tif (manualdof) {',\n '\t\tfloat a = depth-fDepth; // Focal plane',\n '\t\tfloat b = (a-fdofstart)/fdofdist; // Far DoF',\n '\t\tfloat c = (-a-ndofstart)/ndofdist; // Near Dof',\n '\t\tblur = (a>0.0) ? b : c;',\n '\t} else {',\n '\t\tfloat f = focalLength; // focal length in mm',\n '\t\tfloat d = fDepth*1000.0; // focal plane in mm',\n '\t\tfloat o = depth*1000.0; // depth in mm',\n\n '\t\tfloat a = (o*f)/(o-f);',\n '\t\tfloat b = (d*f)/(d-f);',\n '\t\tfloat c = (d-f)/(d*fstop*CoC);',\n\n '\t\tblur = abs(a-b)*c;',\n '\t}',\n\n '\tblur = clamp(blur,0.0,1.0);',\n\n '\t// calculation of pattern for dithering',\n\n '\tvec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;',\n\n '\t// getting blur x and y step factor',\n\n '\tfloat w = (1.0/textureWidth)*blur*maxblur+noise.x;',\n '\tfloat h = (1.0/textureHeight)*blur*maxblur+noise.y;',\n\n '\t// calculation of final color',\n\n '\tvec3 col = vec3(0.0);',\n\n '\tif(blur < 0.05) {',\n '\t\t//some optimization thingy',\n '\t\tcol = texture2D(tColor, vUv.xy).rgb;',\n '\t} else {',\n '\t\tcol = texture2D(tColor, vUv.xy).rgb;',\n '\t\tfloat s = 1.0;',\n '\t\tint ringsamples;',\n\n '\t\tfor (int i = 1; i <= rings; i++) {',\n '\t\t\t/*unboxstart*/',\n '\t\t\tringsamples = i * samples;',\n\n '\t\t\tfor (int j = 0 ; j < maxringsamples ; j++) {',\n '\t\t\t\tif (j >= ringsamples) break;',\n '\t\t\t\ts += gather(float(i), float(j), ringsamples, col, w, h, blur);',\n '\t\t\t}',\n '\t\t\t/*unboxend*/',\n '\t\t}',\n\n '\t\tcol /= s; //divide by sample count',\n '\t}',\n\n '\tif (showFocus) {',\n '\t\tcol = debugFocus(col, blur, depth);',\n '\t}',\n\n '\tif (vignetting) {',\n '\t\tcol *= vignette();',\n '\t}',\n\n '\tgl_FragColor.rgb = col;',\n '\tgl_FragColor.a = 1.0;',\n '} ',\n ].join('\\n'),\n}\n\nexport const BokehDepthShader = {\n uniforms: {\n mNear: { value: 1.0 },\n mFar: { value: 1000.0 },\n },\n\n vertexShader: [\n 'varying float vViewZDepth;',\n\n 'void main() {',\n\n '\t#include ',\n '\t#include ',\n\n '\tvViewZDepth = - mvPosition.z;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float mNear;',\n 'uniform float mFar;',\n\n 'varying float vViewZDepth;',\n\n 'void main() {',\n\n '\tfloat color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );',\n '\tgl_FragColor = vec4( vec3( color ), 1.0 );',\n\n '} ',\n ].join('\\n'),\n}\n", "import { Triangle, Vector3 } from 'three'\n\n/**\n * Utility class for sampling weighted random points on the surface of a mesh.\n *\n * Building the sampler is a one-time O(n) operation. Once built, any number of\n * random samples may be selected in O(logn) time. Memory usage is O(n).\n *\n * References:\n * - http://www.joesfer.com/?p=84\n * - https://stackoverflow.com/a/4322940/1314762\n */\n\nconst _face = new Triangle()\nconst _color = new Vector3()\n\nclass MeshSurfaceSampler {\n constructor(mesh) {\n let geometry = mesh.geometry\n\n if (geometry.index) {\n console.warn('THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry.')\n\n geometry = geometry.toNonIndexed()\n }\n\n this.geometry = geometry\n this.randomFunction = Math.random\n\n this.positionAttribute = this.geometry.getAttribute('position')\n this.colorAttribute = this.geometry.getAttribute('color')\n this.weightAttribute = null\n\n this.distribution = null\n }\n\n setWeightAttribute(name) {\n this.weightAttribute = name ? this.geometry.getAttribute(name) : null\n\n return this\n }\n\n build() {\n const positionAttribute = this.positionAttribute\n const weightAttribute = this.weightAttribute\n\n const faceWeights = new Float32Array(positionAttribute.count / 3)\n\n // Accumulate weights for each mesh face.\n\n for (let i = 0; i < positionAttribute.count; i += 3) {\n let faceWeight = 1\n\n if (weightAttribute) {\n faceWeight = weightAttribute.getX(i) + weightAttribute.getX(i + 1) + weightAttribute.getX(i + 2)\n }\n\n _face.a.fromBufferAttribute(positionAttribute, i)\n _face.b.fromBufferAttribute(positionAttribute, i + 1)\n _face.c.fromBufferAttribute(positionAttribute, i + 2)\n faceWeight *= _face.getArea()\n\n faceWeights[i / 3] = faceWeight\n }\n\n // Store cumulative total face weights in an array, where weight index\n // corresponds to face index.\n\n this.distribution = new Float32Array(positionAttribute.count / 3)\n\n let cumulativeTotal = 0\n\n for (let i = 0; i < faceWeights.length; i++) {\n cumulativeTotal += faceWeights[i]\n\n this.distribution[i] = cumulativeTotal\n }\n\n return this\n }\n\n setRandomGenerator(randomFunction) {\n this.randomFunction = randomFunction\n return this\n }\n\n sample(targetPosition, targetNormal, targetColor) {\n const faceIndex = this.sampleFaceIndex()\n return this.sampleFace(faceIndex, targetPosition, targetNormal, targetColor)\n }\n\n sampleFaceIndex() {\n const cumulativeTotal = this.distribution[this.distribution.length - 1]\n return this.binarySearch(this.randomFunction() * cumulativeTotal)\n }\n\n binarySearch(x) {\n const dist = this.distribution\n let start = 0\n let end = dist.length - 1\n\n let index = -1\n\n while (start <= end) {\n const mid = Math.ceil((start + end) / 2)\n\n if (mid === 0 || (dist[mid - 1] <= x && dist[mid] > x)) {\n index = mid\n\n break\n } else if (x < dist[mid]) {\n end = mid - 1\n } else {\n start = mid + 1\n }\n }\n\n return index\n }\n\n sampleFace(faceIndex, targetPosition, targetNormal, targetColor) {\n let u = this.randomFunction()\n let v = this.randomFunction()\n\n if (u + v > 1) {\n u = 1 - u\n v = 1 - v\n }\n\n _face.a.fromBufferAttribute(this.positionAttribute, faceIndex * 3)\n _face.b.fromBufferAttribute(this.positionAttribute, faceIndex * 3 + 1)\n _face.c.fromBufferAttribute(this.positionAttribute, faceIndex * 3 + 2)\n\n targetPosition\n .set(0, 0, 0)\n .addScaledVector(_face.a, u)\n .addScaledVector(_face.b, v)\n .addScaledVector(_face.c, 1 - (u + v))\n\n if (targetNormal !== undefined) {\n _face.getNormal(targetNormal)\n }\n\n if (targetColor !== undefined && this.colorAttribute !== undefined) {\n _face.a.fromBufferAttribute(this.colorAttribute, faceIndex * 3)\n _face.b.fromBufferAttribute(this.colorAttribute, faceIndex * 3 + 1)\n _face.c.fromBufferAttribute(this.colorAttribute, faceIndex * 3 + 2)\n\n _color\n .set(0, 0, 0)\n .addScaledVector(_face.a, u)\n .addScaledVector(_face.b, v)\n .addScaledVector(_face.c, 1 - (u + v))\n\n targetColor.r = _color.x\n targetColor.g = _color.y\n targetColor.b = _color.z\n }\n\n return this\n }\n}\n\nexport { MeshSurfaceSampler }\n", "import { Box3, MathUtils, Matrix4, Matrix3, Ray, Vector3 } from 'three'\n\n// module scope helper variables\n\nconst a = {\n c: null, // center\n u: [new Vector3(), new Vector3(), new Vector3()], // basis vectors\n e: [], // half width\n}\n\nconst b = {\n c: null, // center\n u: [new Vector3(), new Vector3(), new Vector3()], // basis vectors\n e: [], // half width\n}\n\nconst R = [[], [], []]\nconst AbsR = [[], [], []]\nconst t = []\n\nconst xAxis = new Vector3()\nconst yAxis = new Vector3()\nconst zAxis = new Vector3()\nconst v1 = new Vector3()\nconst size = new Vector3()\nconst closestPoint = new Vector3()\nconst rotationMatrix = new Matrix3()\nconst aabb = new Box3()\nconst matrix = new Matrix4()\nconst inverse = new Matrix4()\nconst localRay = new Ray()\n\n// OBB\n\nclass OBB {\n constructor(center = new Vector3(), halfSize = new Vector3(), rotation = new Matrix3()) {\n this.center = center\n this.halfSize = halfSize\n this.rotation = rotation\n }\n\n set(center, halfSize, rotation) {\n this.center = center\n this.halfSize = halfSize\n this.rotation = rotation\n\n return this\n }\n\n copy(obb) {\n this.center.copy(obb.center)\n this.halfSize.copy(obb.halfSize)\n this.rotation.copy(obb.rotation)\n\n return this\n }\n\n clone() {\n return new this.constructor().copy(this)\n }\n\n getSize(result) {\n return result.copy(this.halfSize).multiplyScalar(2)\n }\n\n /**\n * Reference: Closest Point on OBB to Point in Real-Time Collision Detection\n * by Christer Ericson (chapter 5.1.4)\n */\n clampPoint(point, result) {\n const halfSize = this.halfSize\n\n v1.subVectors(point, this.center)\n this.rotation.extractBasis(xAxis, yAxis, zAxis)\n\n // start at the center position of the OBB\n\n result.copy(this.center)\n\n // project the target onto the OBB axes and walk towards that point\n\n const x = MathUtils.clamp(v1.dot(xAxis), -halfSize.x, halfSize.x)\n result.add(xAxis.multiplyScalar(x))\n\n const y = MathUtils.clamp(v1.dot(yAxis), -halfSize.y, halfSize.y)\n result.add(yAxis.multiplyScalar(y))\n\n const z = MathUtils.clamp(v1.dot(zAxis), -halfSize.z, halfSize.z)\n result.add(zAxis.multiplyScalar(z))\n\n return result\n }\n\n containsPoint(point) {\n v1.subVectors(point, this.center)\n this.rotation.extractBasis(xAxis, yAxis, zAxis)\n\n // project v1 onto each axis and check if these points lie inside the OBB\n\n return (\n Math.abs(v1.dot(xAxis)) <= this.halfSize.x &&\n Math.abs(v1.dot(yAxis)) <= this.halfSize.y &&\n Math.abs(v1.dot(zAxis)) <= this.halfSize.z\n )\n }\n\n intersectsBox3(box3) {\n return this.intersectsOBB(obb.fromBox3(box3))\n }\n\n intersectsSphere(sphere) {\n // find the point on the OBB closest to the sphere center\n\n this.clampPoint(sphere.center, closestPoint)\n\n // if that point is inside the sphere, the OBB and sphere intersect\n\n return closestPoint.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius\n }\n\n /**\n * Reference: OBB-OBB Intersection in Real-Time Collision Detection\n * by Christer Ericson (chapter 4.4.1)\n *\n */\n intersectsOBB(obb, epsilon = Number.EPSILON) {\n // prepare data structures (the code uses the same nomenclature like the reference)\n\n a.c = this.center\n a.e[0] = this.halfSize.x\n a.e[1] = this.halfSize.y\n a.e[2] = this.halfSize.z\n this.rotation.extractBasis(a.u[0], a.u[1], a.u[2])\n\n b.c = obb.center\n b.e[0] = obb.halfSize.x\n b.e[1] = obb.halfSize.y\n b.e[2] = obb.halfSize.z\n obb.rotation.extractBasis(b.u[0], b.u[1], b.u[2])\n\n // compute rotation matrix expressing b in a's coordinate frame\n\n for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 3; j++) {\n R[i][j] = a.u[i].dot(b.u[j])\n }\n }\n\n // compute translation vector\n\n v1.subVectors(b.c, a.c)\n\n // bring translation into a's coordinate frame\n\n t[0] = v1.dot(a.u[0])\n t[1] = v1.dot(a.u[1])\n t[2] = v1.dot(a.u[2])\n\n // compute common subexpressions. Add in an epsilon term to\n // counteract arithmetic errors when two edges are parallel and\n // their cross product is (near) null\n\n for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 3; j++) {\n AbsR[i][j] = Math.abs(R[i][j]) + epsilon\n }\n }\n\n let ra, rb\n\n // test axes L = A0, L = A1, L = A2\n\n for (let i = 0; i < 3; i++) {\n ra = a.e[i]\n rb = b.e[0] * AbsR[i][0] + b.e[1] * AbsR[i][1] + b.e[2] * AbsR[i][2]\n if (Math.abs(t[i]) > ra + rb) return false\n }\n\n // test axes L = B0, L = B1, L = B2\n\n for (let i = 0; i < 3; i++) {\n ra = a.e[0] * AbsR[0][i] + a.e[1] * AbsR[1][i] + a.e[2] * AbsR[2][i]\n rb = b.e[i]\n if (Math.abs(t[0] * R[0][i] + t[1] * R[1][i] + t[2] * R[2][i]) > ra + rb) return false\n }\n\n // test axis L = A0 x B0\n\n ra = a.e[1] * AbsR[2][0] + a.e[2] * AbsR[1][0]\n rb = b.e[1] * AbsR[0][2] + b.e[2] * AbsR[0][1]\n if (Math.abs(t[2] * R[1][0] - t[1] * R[2][0]) > ra + rb) return false\n\n // test axis L = A0 x B1\n\n ra = a.e[1] * AbsR[2][1] + a.e[2] * AbsR[1][1]\n rb = b.e[0] * AbsR[0][2] + b.e[2] * AbsR[0][0]\n if (Math.abs(t[2] * R[1][1] - t[1] * R[2][1]) > ra + rb) return false\n\n // test axis L = A0 x B2\n\n ra = a.e[1] * AbsR[2][2] + a.e[2] * AbsR[1][2]\n rb = b.e[0] * AbsR[0][1] + b.e[1] * AbsR[0][0]\n if (Math.abs(t[2] * R[1][2] - t[1] * R[2][2]) > ra + rb) return false\n\n // test axis L = A1 x B0\n\n ra = a.e[0] * AbsR[2][0] + a.e[2] * AbsR[0][0]\n rb = b.e[1] * AbsR[1][2] + b.e[2] * AbsR[1][1]\n if (Math.abs(t[0] * R[2][0] - t[2] * R[0][0]) > ra + rb) return false\n\n // test axis L = A1 x B1\n\n ra = a.e[0] * AbsR[2][1] + a.e[2] * AbsR[0][1]\n rb = b.e[0] * AbsR[1][2] + b.e[2] * AbsR[1][0]\n if (Math.abs(t[0] * R[2][1] - t[2] * R[0][1]) > ra + rb) return false\n\n // test axis L = A1 x B2\n\n ra = a.e[0] * AbsR[2][2] + a.e[2] * AbsR[0][2]\n rb = b.e[0] * AbsR[1][1] + b.e[1] * AbsR[1][0]\n if (Math.abs(t[0] * R[2][2] - t[2] * R[0][2]) > ra + rb) return false\n\n // test axis L = A2 x B0\n\n ra = a.e[0] * AbsR[1][0] + a.e[1] * AbsR[0][0]\n rb = b.e[1] * AbsR[2][2] + b.e[2] * AbsR[2][1]\n if (Math.abs(t[1] * R[0][0] - t[0] * R[1][0]) > ra + rb) return false\n\n // test axis L = A2 x B1\n\n ra = a.e[0] * AbsR[1][1] + a.e[1] * AbsR[0][1]\n rb = b.e[0] * AbsR[2][2] + b.e[2] * AbsR[2][0]\n if (Math.abs(t[1] * R[0][1] - t[0] * R[1][1]) > ra + rb) return false\n\n // test axis L = A2 x B2\n\n ra = a.e[0] * AbsR[1][2] + a.e[1] * AbsR[0][2]\n rb = b.e[0] * AbsR[2][1] + b.e[1] * AbsR[2][0]\n if (Math.abs(t[1] * R[0][2] - t[0] * R[1][2]) > ra + rb) return false\n\n // since no separating axis is found, the OBBs must be intersecting\n\n return true\n }\n\n /**\n * Reference: Testing Box Against Plane in Real-Time Collision Detection\n * by Christer Ericson (chapter 5.2.3)\n */\n intersectsPlane(plane) {\n this.rotation.extractBasis(xAxis, yAxis, zAxis)\n\n // compute the projection interval radius of this OBB onto L(t) = this->center + t * p.normal;\n\n const r =\n this.halfSize.x * Math.abs(plane.normal.dot(xAxis)) +\n this.halfSize.y * Math.abs(plane.normal.dot(yAxis)) +\n this.halfSize.z * Math.abs(plane.normal.dot(zAxis))\n\n // compute distance of the OBB's center from the plane\n\n const d = plane.normal.dot(this.center) - plane.constant\n\n // Intersection occurs when distance d falls within [-r,+r] interval\n\n return Math.abs(d) <= r\n }\n\n /**\n * Performs a ray/OBB intersection test and stores the intersection point\n * to the given 3D vector. If no intersection is detected, *null* is returned.\n */\n intersectRay(ray, result) {\n // the idea is to perform the intersection test in the local space\n // of the OBB.\n\n this.getSize(size)\n aabb.setFromCenterAndSize(v1.set(0, 0, 0), size)\n\n // create a 4x4 transformation matrix\n\n matrix.setFromMatrix3(this.rotation)\n matrix.setPosition(this.center)\n\n // transform ray to the local space of the OBB\n\n inverse.copy(matrix).invert()\n localRay.copy(ray).applyMatrix4(inverse)\n\n // perform ray <-> AABB intersection test\n\n if (localRay.intersectBox(aabb, result)) {\n // transform the intersection point back to world space\n\n return result.applyMatrix4(matrix)\n } else {\n return null\n }\n }\n\n /**\n * Performs a ray/OBB intersection test. Returns either true or false if\n * there is a intersection or not.\n */\n intersectsRay(ray) {\n return this.intersectRay(ray, v1) !== null\n }\n\n fromBox3(box3) {\n box3.getCenter(this.center)\n\n box3.getSize(this.halfSize).multiplyScalar(0.5)\n\n this.rotation.identity()\n\n return this\n }\n\n equals(obb) {\n return obb.center.equals(this.center) && obb.halfSize.equals(this.halfSize) && obb.rotation.equals(this.rotation)\n }\n\n applyMatrix4(matrix) {\n const e = matrix.elements\n\n let sx = v1.set(e[0], e[1], e[2]).length()\n const sy = v1.set(e[4], e[5], e[6]).length()\n const sz = v1.set(e[8], e[9], e[10]).length()\n\n const det = matrix.determinant()\n if (det < 0) sx = -sx\n\n rotationMatrix.setFromMatrix4(matrix)\n\n const invSX = 1 / sx\n const invSY = 1 / sy\n const invSZ = 1 / sz\n\n rotationMatrix.elements[0] *= invSX\n rotationMatrix.elements[1] *= invSX\n rotationMatrix.elements[2] *= invSX\n\n rotationMatrix.elements[3] *= invSY\n rotationMatrix.elements[4] *= invSY\n rotationMatrix.elements[5] *= invSY\n\n rotationMatrix.elements[6] *= invSZ\n rotationMatrix.elements[7] *= invSZ\n rotationMatrix.elements[8] *= invSZ\n\n this.rotation.multiply(rotationMatrix)\n\n this.halfSize.x *= sx\n this.halfSize.y *= sy\n this.halfSize.z *= sz\n\n v1.setFromMatrixPosition(matrix)\n this.center.add(v1)\n\n return this\n }\n}\n\nconst obb = new OBB()\n\nexport { OBB }\n", "import { Vector3 } from 'three'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\nconst _v3 = new Vector3()\n\nconst EPS = 1e-10\n\nclass Capsule {\n constructor(start = new Vector3(0, 0, 0), end = new Vector3(0, 1, 0), radius = 1) {\n this.start = start\n this.end = end\n this.radius = radius\n }\n\n clone() {\n return new Capsule(this.start.clone(), this.end.clone(), this.radius)\n }\n\n set(start, end, radius) {\n this.start.copy(start)\n this.end.copy(end)\n this.radius = radius\n }\n\n copy(capsule) {\n this.start.copy(capsule.start)\n this.end.copy(capsule.end)\n this.radius = capsule.radius\n }\n\n getCenter(target) {\n return target.copy(this.end).add(this.start).multiplyScalar(0.5)\n }\n\n translate(v) {\n this.start.add(v)\n this.end.add(v)\n }\n\n checkAABBAxis(p1x, p1y, p2x, p2y, minx, maxx, miny, maxy, radius) {\n return (\n (minx - p1x < radius || minx - p2x < radius) &&\n (p1x - maxx < radius || p2x - maxx < radius) &&\n (miny - p1y < radius || miny - p2y < radius) &&\n (p1y - maxy < radius || p2y - maxy < radius)\n )\n }\n\n intersectsBox(box) {\n return (\n this.checkAABBAxis(\n this.start.x,\n this.start.y,\n this.end.x,\n this.end.y,\n box.min.x,\n box.max.x,\n box.min.y,\n box.max.y,\n this.radius,\n ) &&\n this.checkAABBAxis(\n this.start.x,\n this.start.z,\n this.end.x,\n this.end.z,\n box.min.x,\n box.max.x,\n box.min.z,\n box.max.z,\n this.radius,\n ) &&\n this.checkAABBAxis(\n this.start.y,\n this.start.z,\n this.end.y,\n this.end.z,\n box.min.y,\n box.max.y,\n box.min.z,\n box.max.z,\n this.radius,\n )\n )\n }\n\n lineLineMinimumPoints(line1, line2) {\n const r = _v1.copy(line1.end).sub(line1.start)\n const s = _v2.copy(line2.end).sub(line2.start)\n const w = _v3.copy(line2.start).sub(line1.start)\n\n const a = r.dot(s),\n b = r.dot(r),\n c = s.dot(s),\n d = s.dot(w),\n e = r.dot(w)\n\n let t1, t2\n const divisor = b * c - a * a\n\n if (Math.abs(divisor) < EPS) {\n const d1 = -d / c\n const d2 = (a - d) / c\n\n if (Math.abs(d1 - 0.5) < Math.abs(d2 - 0.5)) {\n t1 = 0\n t2 = d1\n } else {\n t1 = 1\n t2 = d2\n }\n } else {\n t1 = (d * a + e * c) / divisor\n t2 = (t1 * a - d) / c\n }\n\n t2 = Math.max(0, Math.min(1, t2))\n t1 = Math.max(0, Math.min(1, t1))\n\n const point1 = r.multiplyScalar(t1).add(line1.start)\n const point2 = s.multiplyScalar(t2).add(line2.start)\n\n return [point1, point2]\n }\n}\n\nexport { Capsule }\n", "// https://cs.nyu.edu/~perlin/noise/\n\nfunction init() {\n // prettier-ignore\n const _p = [ 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10,\n 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87,\n 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211,\n 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208,\n 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5,\n 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119,\n 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232,\n 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249,\n 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205,\n 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180 ];\n\n for (let i = 0; i < 256; i++) {\n _p[256 + i] = _p[i]\n }\n\n return _p\n}\n\nconst _p = init()\n\nfunction fade(t) {\n return t * t * t * (t * (t * 6 - 15) + 10)\n}\n\nfunction lerp(t, a, b) {\n return a + t * (b - a)\n}\n\nfunction grad(hash, x, y, z) {\n const h = hash & 15\n const u = h < 8 ? x : y,\n v = h < 4 ? y : h == 12 || h == 14 ? x : z\n return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v)\n}\n\nclass ImprovedNoise {\n noise(x, y, z) {\n const floorX = Math.floor(x),\n floorY = Math.floor(y),\n floorZ = Math.floor(z)\n\n const X = floorX & 255,\n Y = floorY & 255,\n Z = floorZ & 255\n\n x -= floorX\n y -= floorY\n z -= floorZ\n\n const xMinus1 = x - 1,\n yMinus1 = y - 1,\n zMinus1 = z - 1\n\n const u = fade(x),\n v = fade(y),\n w = fade(z)\n\n const A = _p[X] + Y,\n AA = _p[A] + Z,\n AB = _p[A + 1] + Z,\n B = _p[X + 1] + Y,\n BA = _p[B] + Z,\n BB = _p[B + 1] + Z\n\n return lerp(\n w,\n lerp(\n v,\n lerp(u, grad(_p[AA], x, y, z), grad(_p[BA], xMinus1, y, z)),\n lerp(u, grad(_p[AB], x, yMinus1, z), grad(_p[BB], xMinus1, yMinus1, z)),\n ),\n lerp(\n v,\n lerp(u, grad(_p[AA + 1], x, y, zMinus1), grad(_p[BA + 1], xMinus1, y, zMinus1)),\n lerp(u, grad(_p[AB + 1], x, yMinus1, zMinus1), grad(_p[BB + 1], xMinus1, yMinus1, zMinus1)),\n ),\n )\n }\n}\n\nexport { ImprovedNoise }\n", "import { Box3, Line3, Plane, Sphere, Triangle, Vector3 } from 'three'\nimport { Capsule } from '../math/Capsule'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\nconst _plane = new Plane()\nconst _line1 = new Line3()\nconst _line2 = new Line3()\nconst _sphere = new Sphere()\nconst _capsule = new Capsule()\n\nclass Octree {\n constructor(box) {\n this.triangles = []\n this.box = box\n this.subTrees = []\n }\n\n addTriangle(triangle) {\n if (!this.bounds) this.bounds = new Box3()\n\n this.bounds.min.x = Math.min(this.bounds.min.x, triangle.a.x, triangle.b.x, triangle.c.x)\n this.bounds.min.y = Math.min(this.bounds.min.y, triangle.a.y, triangle.b.y, triangle.c.y)\n this.bounds.min.z = Math.min(this.bounds.min.z, triangle.a.z, triangle.b.z, triangle.c.z)\n this.bounds.max.x = Math.max(this.bounds.max.x, triangle.a.x, triangle.b.x, triangle.c.x)\n this.bounds.max.y = Math.max(this.bounds.max.y, triangle.a.y, triangle.b.y, triangle.c.y)\n this.bounds.max.z = Math.max(this.bounds.max.z, triangle.a.z, triangle.b.z, triangle.c.z)\n\n this.triangles.push(triangle)\n\n return this\n }\n\n calcBox() {\n this.box = this.bounds.clone()\n\n // offset small amount to account for regular grid\n this.box.min.x -= 0.01\n this.box.min.y -= 0.01\n this.box.min.z -= 0.01\n\n return this\n }\n\n split(level) {\n if (!this.box) return\n\n const subTrees = []\n const halfsize = _v2.copy(this.box.max).sub(this.box.min).multiplyScalar(0.5)\n\n for (let x = 0; x < 2; x++) {\n for (let y = 0; y < 2; y++) {\n for (let z = 0; z < 2; z++) {\n const box = new Box3()\n const v = _v1.set(x, y, z)\n\n box.min.copy(this.box.min).add(v.multiply(halfsize))\n box.max.copy(box.min).add(halfsize)\n\n subTrees.push(new Octree(box))\n }\n }\n }\n\n let triangle\n\n while ((triangle = this.triangles.pop())) {\n for (let i = 0; i < subTrees.length; i++) {\n if (subTrees[i].box.intersectsTriangle(triangle)) {\n subTrees[i].triangles.push(triangle)\n }\n }\n }\n\n for (let i = 0; i < subTrees.length; i++) {\n const len = subTrees[i].triangles.length\n\n if (len > 8 && level < 16) {\n subTrees[i].split(level + 1)\n }\n\n if (len !== 0) {\n this.subTrees.push(subTrees[i])\n }\n }\n\n return this\n }\n\n build() {\n this.calcBox()\n this.split(0)\n\n return this\n }\n\n getRayTriangles(ray, triangles) {\n for (let i = 0; i < this.subTrees.length; i++) {\n const subTree = this.subTrees[i]\n if (!ray.intersectsBox(subTree.box)) continue\n\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1) triangles.push(subTree.triangles[j])\n }\n } else {\n subTree.getRayTriangles(ray, triangles)\n }\n }\n\n return triangles\n }\n\n triangleCapsuleIntersect(capsule, triangle) {\n triangle.getPlane(_plane)\n\n const d1 = _plane.distanceToPoint(capsule.start) - capsule.radius\n const d2 = _plane.distanceToPoint(capsule.end) - capsule.radius\n\n if ((d1 > 0 && d2 > 0) || (d1 < -capsule.radius && d2 < -capsule.radius)) {\n return false\n }\n\n const delta = Math.abs(d1 / (Math.abs(d1) + Math.abs(d2)))\n const intersectPoint = _v1.copy(capsule.start).lerp(capsule.end, delta)\n\n if (triangle.containsPoint(intersectPoint)) {\n return { normal: _plane.normal.clone(), point: intersectPoint.clone(), depth: Math.abs(Math.min(d1, d2)) }\n }\n\n const r2 = capsule.radius * capsule.radius\n\n const line1 = _line1.set(capsule.start, capsule.end)\n\n const lines = [\n [triangle.a, triangle.b],\n [triangle.b, triangle.c],\n [triangle.c, triangle.a],\n ]\n\n for (let i = 0; i < lines.length; i++) {\n const line2 = _line2.set(lines[i][0], lines[i][1])\n\n const [point1, point2] = capsule.lineLineMinimumPoints(line1, line2)\n\n if (point1.distanceToSquared(point2) < r2) {\n return {\n normal: point1.clone().sub(point2).normalize(),\n point: point2.clone(),\n depth: capsule.radius - point1.distanceTo(point2),\n }\n }\n }\n\n return false\n }\n\n triangleSphereIntersect(sphere, triangle) {\n triangle.getPlane(_plane)\n\n if (!sphere.intersectsPlane(_plane)) return false\n\n const depth = Math.abs(_plane.distanceToSphere(sphere))\n const r2 = sphere.radius * sphere.radius - depth * depth\n\n const plainPoint = _plane.projectPoint(sphere.center, _v1)\n\n if (triangle.containsPoint(sphere.center)) {\n return {\n normal: _plane.normal.clone(),\n point: plainPoint.clone(),\n depth: Math.abs(_plane.distanceToSphere(sphere)),\n }\n }\n\n const lines = [\n [triangle.a, triangle.b],\n [triangle.b, triangle.c],\n [triangle.c, triangle.a],\n ]\n\n for (let i = 0; i < lines.length; i++) {\n _line1.set(lines[i][0], lines[i][1])\n _line1.closestPointToPoint(plainPoint, true, _v2)\n\n const d = _v2.distanceToSquared(sphere.center)\n\n if (d < r2) {\n return {\n normal: sphere.center.clone().sub(_v2).normalize(),\n point: _v2.clone(),\n depth: sphere.radius - Math.sqrt(d),\n }\n }\n }\n\n return false\n }\n\n getSphereTriangles(sphere, triangles) {\n for (let i = 0; i < this.subTrees.length; i++) {\n const subTree = this.subTrees[i]\n\n if (!sphere.intersectsBox(subTree.box)) continue\n\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1) triangles.push(subTree.triangles[j])\n }\n } else {\n subTree.getSphereTriangles(sphere, triangles)\n }\n }\n }\n\n getCapsuleTriangles(capsule, triangles) {\n for (let i = 0; i < this.subTrees.length; i++) {\n const subTree = this.subTrees[i]\n\n if (!capsule.intersectsBox(subTree.box)) continue\n\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1) triangles.push(subTree.triangles[j])\n }\n } else {\n subTree.getCapsuleTriangles(capsule, triangles)\n }\n }\n }\n\n sphereIntersect(sphere) {\n _sphere.copy(sphere)\n\n const triangles = []\n let result,\n hit = false\n\n this.getSphereTriangles(sphere, triangles)\n\n for (let i = 0; i < triangles.length; i++) {\n if ((result = this.triangleSphereIntersect(_sphere, triangles[i]))) {\n hit = true\n\n _sphere.center.add(result.normal.multiplyScalar(result.depth))\n }\n }\n\n if (hit) {\n const collisionVector = _sphere.center.clone().sub(sphere.center)\n const depth = collisionVector.length()\n\n return { normal: collisionVector.normalize(), depth: depth }\n }\n\n return false\n }\n\n capsuleIntersect(capsule) {\n _capsule.copy(capsule)\n\n const triangles = []\n let result,\n hit = false\n\n this.getCapsuleTriangles(_capsule, triangles)\n\n for (let i = 0; i < triangles.length; i++) {\n if ((result = this.triangleCapsuleIntersect(_capsule, triangles[i]))) {\n hit = true\n\n _capsule.translate(result.normal.multiplyScalar(result.depth))\n }\n }\n\n if (hit) {\n const collisionVector = _capsule.getCenter(new Vector3()).sub(capsule.getCenter(_v1))\n const depth = collisionVector.length()\n\n return { normal: collisionVector.normalize(), depth: depth }\n }\n\n return false\n }\n\n rayIntersect(ray) {\n if (ray.direction.length() === 0) return\n\n const triangles = []\n let triangle,\n position,\n distance = 1e100\n\n this.getRayTriangles(ray, triangles)\n\n for (let i = 0; i < triangles.length; i++) {\n const result = ray.intersectTriangle(triangles[i].a, triangles[i].b, triangles[i].c, true, _v1)\n\n if (result) {\n const newdistance = result.sub(ray.origin).length()\n\n if (distance > newdistance) {\n position = result.clone().add(ray.origin)\n distance = newdistance\n triangle = triangles[i]\n }\n }\n }\n\n return distance < 1e100 ? { distance: distance, triangle: triangle, position: position } : false\n }\n\n fromGraphNode(group) {\n group.updateWorldMatrix(true, true)\n\n group.traverse((obj) => {\n if (obj.isMesh === true) {\n let geometry,\n isTemp = false\n\n if (obj.geometry.index !== null) {\n isTemp = true\n geometry = obj.geometry.toNonIndexed()\n } else {\n geometry = obj.geometry\n }\n\n const positionAttribute = geometry.getAttribute('position')\n\n for (let i = 0; i < positionAttribute.count; i += 3) {\n const v1 = new Vector3().fromBufferAttribute(positionAttribute, i)\n const v2 = new Vector3().fromBufferAttribute(positionAttribute, i + 1)\n const v3 = new Vector3().fromBufferAttribute(positionAttribute, i + 2)\n\n v1.applyMatrix4(obj.matrixWorld)\n v2.applyMatrix4(obj.matrixWorld)\n v3.applyMatrix4(obj.matrixWorld)\n\n this.addTriangle(new Triangle(v1, v2, v3))\n }\n\n if (isTemp) {\n geometry.dispose()\n }\n }\n })\n\n this.build()\n\n return this\n }\n}\n\nexport { Octree }\n", "import { MathUtils, Spherical, Vector3, EventDispatcher, Camera } from 'three'\n\nconst targetPosition = new Vector3()\n\nexport class FirstPersonControls extends EventDispatcher {\n public object: Camera\n public domElement?: HTMLElement | null\n\n public enabled = true\n\n public movementSpeed = 1.0\n public lookSpeed = 0.005\n\n public lookVertical = true\n public autoForward = false\n\n public activeLook = true\n\n public heightSpeed = false\n public heightCoef = 1.0\n public heightMin = 0.0\n public heightMax = 1.0\n\n public constrainVertical = false\n public verticalMin = 0\n public verticalMax = Math.PI\n\n public mouseDragOn = false\n\n // internals\n\n private autoSpeedFactor = 0.0\n\n private mouseX = 0\n private mouseY = 0\n\n private moveForward = false\n private moveBackward = false\n private moveLeft = false\n private moveRight = false\n private moveUp = false\n private moveDown = false\n\n private viewHalfX = 0\n private viewHalfY = 0\n\n private lat = 0\n private lon = 0\n\n private lookDirection = new Vector3()\n private spherical = new Spherical()\n private target = new Vector3()\n\n constructor(object: Camera, domElement?: HTMLElement | null) {\n super()\n\n this.object = object\n this.domElement = domElement\n\n this.setOrientation()\n\n if (domElement) this.connect(domElement)\n }\n\n public connect = (domElement: HTMLElement): void => {\n domElement.setAttribute('tabindex', '-1')\n\n domElement.style.touchAction = 'none'\n\n domElement.addEventListener('contextmenu', this.contextmenu)\n domElement.addEventListener('mousemove', this.onMouseMove)\n domElement.addEventListener('mousedown', this.onMouseDown)\n domElement.addEventListener('mouseup', this.onMouseUp)\n\n this.domElement = domElement\n\n window.addEventListener('keydown', this.onKeyDown)\n window.addEventListener('keyup', this.onKeyUp)\n\n this.handleResize()\n }\n\n public dispose = (): void => {\n this.domElement?.removeEventListener('contextmenu', this.contextmenu)\n this.domElement?.removeEventListener('mousedown', this.onMouseDown)\n this.domElement?.removeEventListener('mousemove', this.onMouseMove)\n this.domElement?.removeEventListener('mouseup', this.onMouseUp)\n\n window.removeEventListener('keydown', this.onKeyDown)\n window.removeEventListener('keyup', this.onKeyUp)\n }\n\n public handleResize = (): void => {\n if (this.domElement) {\n this.viewHalfX = this.domElement.offsetWidth / 2\n this.viewHalfY = this.domElement.offsetHeight / 2\n }\n }\n\n private onMouseDown = (event: MouseEvent): void => {\n this.domElement?.focus()\n\n if (this.activeLook) {\n switch (event.button) {\n case 0:\n this.moveForward = true\n break\n case 2:\n this.moveBackward = true\n break\n }\n }\n\n this.mouseDragOn = true\n }\n\n private onMouseUp = (event: MouseEvent): void => {\n if (this.activeLook) {\n switch (event.button) {\n case 0:\n this.moveForward = false\n break\n case 2:\n this.moveBackward = false\n break\n }\n }\n\n this.mouseDragOn = false\n }\n\n private onMouseMove = (event: MouseEvent): void => {\n if (this.domElement) {\n this.mouseX = event.pageX - this.domElement.offsetLeft - this.viewHalfX\n this.mouseY = event.pageY - this.domElement.offsetTop - this.viewHalfY\n }\n }\n\n private onKeyDown = (event: KeyboardEvent): void => {\n switch (event.code) {\n case 'ArrowUp':\n case 'KeyW':\n this.moveForward = true\n break\n\n case 'ArrowLeft':\n case 'KeyA':\n this.moveLeft = true\n break\n\n case 'ArrowDown':\n case 'KeyS':\n this.moveBackward = true\n break\n\n case 'ArrowRight':\n case 'KeyD':\n this.moveRight = true\n break\n\n case 'KeyR':\n this.moveUp = true\n break\n case 'KeyF':\n this.moveDown = true\n break\n }\n }\n\n private onKeyUp = (event: KeyboardEvent): void => {\n switch (event.code) {\n case 'ArrowUp':\n case 'KeyW':\n this.moveForward = false\n break\n\n case 'ArrowLeft':\n case 'KeyA':\n this.moveLeft = false\n break\n\n case 'ArrowDown':\n case 'KeyS':\n this.moveBackward = false\n break\n\n case 'ArrowRight':\n case 'KeyD':\n this.moveRight = false\n break\n\n case 'KeyR':\n this.moveUp = false\n break\n case 'KeyF':\n this.moveDown = false\n break\n }\n }\n\n public lookAt = (x: Vector3 | number, y?: number, z?: number): this => {\n if (x instanceof Vector3) {\n this.target.copy(x)\n } else if (y && z) {\n this.target.set(x, y, z)\n }\n\n this.object.lookAt(this.target)\n\n this.setOrientation()\n\n return this\n }\n\n public update = (delta: number): void => {\n if (!this.enabled) return\n\n if (this.heightSpeed) {\n const y = MathUtils.clamp(this.object.position.y, this.heightMin, this.heightMax)\n const heightDelta = y - this.heightMin\n\n this.autoSpeedFactor = delta * (heightDelta * this.heightCoef)\n } else {\n this.autoSpeedFactor = 0.0\n }\n\n const actualMoveSpeed = delta * this.movementSpeed\n\n if (this.moveForward || (this.autoForward && !this.moveBackward)) {\n this.object.translateZ(-(actualMoveSpeed + this.autoSpeedFactor))\n }\n if (this.moveBackward) this.object.translateZ(actualMoveSpeed)\n\n if (this.moveLeft) this.object.translateX(-actualMoveSpeed)\n if (this.moveRight) this.object.translateX(actualMoveSpeed)\n\n if (this.moveUp) this.object.translateY(actualMoveSpeed)\n if (this.moveDown) this.object.translateY(-actualMoveSpeed)\n\n let actualLookSpeed = delta * this.lookSpeed\n\n if (!this.activeLook) {\n actualLookSpeed = 0\n }\n\n let verticalLookRatio = 1\n\n if (this.constrainVertical) {\n verticalLookRatio = Math.PI / (this.verticalMax - this.verticalMin)\n }\n\n this.lon -= this.mouseX * actualLookSpeed\n if (this.lookVertical) this.lat -= this.mouseY * actualLookSpeed * verticalLookRatio\n\n this.lat = Math.max(-85, Math.min(85, this.lat))\n\n let phi = MathUtils.degToRad(90 - this.lat)\n const theta = MathUtils.degToRad(this.lon)\n\n if (this.constrainVertical) {\n phi = MathUtils.mapLinear(phi, 0, Math.PI, this.verticalMin, this.verticalMax)\n }\n\n const position = this.object.position\n\n targetPosition.setFromSphericalCoords(1, phi, theta).add(position)\n\n this.object.lookAt(targetPosition)\n }\n\n private contextmenu = (event: Event): void => event.preventDefault()\n\n private setOrientation = (): void => {\n this.lookDirection.set(0, 0, -1).applyQuaternion(this.object.quaternion)\n this.spherical.setFromVector3(this.lookDirection)\n this.lat = 90 - MathUtils.radToDeg(this.spherical.phi)\n this.lon = MathUtils.radToDeg(this.spherical.theta)\n }\n}\n", "import { Euler, Camera, EventDispatcher, Vector3 } from 'three'\n\nconst _euler = new Euler(0, 0, 0, 'YXZ')\nconst _vector = new Vector3()\nconst _changeEvent = { type: 'change' }\nconst _lockEvent = { type: 'lock' }\nconst _unlockEvent = { type: 'unlock' }\nconst _PI_2 = Math.PI / 2\n\nclass PointerLockControls extends EventDispatcher {\n public camera: Camera\n public domElement?: HTMLElement\n public isLocked: boolean\n public minPolarAngle: number\n public maxPolarAngle: number\n public pointerSpeed: number\n\n constructor(camera: Camera, domElement?: HTMLElement) {\n super()\n\n this.camera = camera\n this.domElement = domElement\n this.isLocked = false\n\n // Set to constrain the pitch of the camera\n // Range is 0 to Math.PI radians\n this.minPolarAngle = 0 // radians\n this.maxPolarAngle = Math.PI // radians\n\n this.pointerSpeed = 1.0\n if (domElement) this.connect(domElement)\n }\n\n private onMouseMove = (event: MouseEvent): void => {\n if (!this.domElement || this.isLocked === false) return\n const movementX = event.movementX || (event as any).mozMovementX || (event as any).webkitMovementX || 0\n const movementY = event.movementY || (event as any).mozMovementY || (event as any).webkitMovementY || 0\n _euler.setFromQuaternion(this.camera.quaternion)\n _euler.y -= movementX * 0.002 * this.pointerSpeed\n _euler.x -= movementY * 0.002 * this.pointerSpeed\n _euler.x = Math.max(_PI_2 - this.maxPolarAngle, Math.min(_PI_2 - this.minPolarAngle, _euler.x))\n this.camera.quaternion.setFromEuler(_euler)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n private onPointerlockChange = (): void => {\n if (!this.domElement) return\n if (this.domElement.ownerDocument.pointerLockElement === this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_lockEvent)\n this.isLocked = true\n } else {\n // @ts-ignore\n this.dispatchEvent(_unlockEvent)\n this.isLocked = false\n }\n }\n\n private onPointerlockError = (): void => {\n console.error('THREE.PointerLockControls: Unable to use Pointer Lock API')\n }\n\n public connect = (domElement: HTMLElement): void => {\n this.domElement = domElement || this.domElement\n if (!this.domElement) return\n this.domElement.ownerDocument.addEventListener('mousemove', this.onMouseMove)\n this.domElement.ownerDocument.addEventListener('pointerlockchange', this.onPointerlockChange)\n this.domElement.ownerDocument.addEventListener('pointerlockerror', this.onPointerlockError)\n }\n\n public disconnect = (): void => {\n if (!this.domElement) return\n this.domElement.ownerDocument.removeEventListener('mousemove', this.onMouseMove)\n this.domElement.ownerDocument.removeEventListener('pointerlockchange', this.onPointerlockChange)\n this.domElement.ownerDocument.removeEventListener('pointerlockerror', this.onPointerlockError)\n }\n\n public dispose = (): void => {\n this.disconnect()\n }\n\n public getObject = (): Camera => {\n // retaining this method for backward compatibility\n return this.camera\n }\n\n private direction = new Vector3(0, 0, -1)\n public getDirection = (v: Vector3): Vector3 => {\n return v.copy(this.direction).applyQuaternion(this.camera.quaternion)\n }\n\n public moveForward = (distance: number): void => {\n // move forward parallel to the xz-plane\n // assumes camera.up is y-up\n _vector.setFromMatrixColumn(this.camera.matrix, 0)\n _vector.crossVectors(this.camera.up, _vector)\n this.camera.position.addScaledVector(_vector, distance)\n }\n\n public moveRight = (distance: number): void => {\n _vector.setFromMatrixColumn(this.camera.matrix, 0)\n this.camera.position.addScaledVector(_vector, distance)\n }\n\n public lock = (): void => {\n if (this.domElement) this.domElement.requestPointerLock()\n }\n\n public unlock = (): void => {\n if (this.domElement) this.domElement.ownerDocument.exitPointerLock()\n }\n}\n\nexport { PointerLockControls }\n", "import {\n EventDispatcher,\n Matrix4,\n MOUSE,\n OrthographicCamera,\n PerspectiveCamera,\n Quaternion,\n Spherical,\n TOUCH,\n Vector2,\n Vector3,\n Ray,\n Plane,\n} from 'three'\n\nconst _ray = new Ray()\nconst _plane = new Plane()\nconst TILT_LIMIT = Math.cos(70 * (Math.PI / 180))\n\n// This set of controls 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 moduloWrapAround = (offset: number, capacity: number) => ((offset % capacity) + capacity) % capacity\n\nclass OrbitControls extends EventDispatcher {\n object: PerspectiveCamera | OrthographicCamera\n domElement: HTMLElement | undefined\n // Set to false to disable this control\n enabled = true\n // \"target\" sets the location of focus, where the object orbits around\n target = new Vector3()\n // How far you can dolly in and out ( PerspectiveCamera only )\n minDistance = 0\n maxDistance = Infinity\n // How far you can zoom in and out ( OrthographicCamera only )\n minZoom = 0\n maxZoom = Infinity\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n minPolarAngle = 0 // radians\n 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 minAzimuthAngle = -Infinity // radians\n 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 enableDamping = false\n 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 enableZoom = true\n zoomSpeed = 1.0\n // Set to false to disable rotating\n enableRotate = true\n rotateSpeed = 1.0\n // Set to false to disable panning\n enablePan = true\n panSpeed = 1.0\n screenSpacePanning = true // if false, pan orthogonal to world-space direction camera.up\n keyPanSpeed = 7.0 // pixels moved per arrow key push\n 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 autoRotate = false\n autoRotateSpeed = 2.0 // 30 seconds per orbit when fps is 60\n reverseOrbit = false // true if you want to reverse the orbit to mouse drag from left to right = orbits left\n reverseHorizontalOrbit = false // true if you want to reverse the horizontal orbit direction\n reverseVerticalOrbit = false // true if you want to reverse the vertical orbit direction\n // The four arrow keys\n keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' }\n // Mouse buttons\n mouseButtons: Partial<{\n LEFT: MOUSE\n MIDDLE: MOUSE\n RIGHT: MOUSE\n }> = {\n LEFT: MOUSE.ROTATE,\n MIDDLE: MOUSE.DOLLY,\n RIGHT: MOUSE.PAN,\n }\n // Touch fingers\n touches: Partial<{\n ONE: TOUCH\n TWO: TOUCH\n }> = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }\n target0: Vector3\n position0: Vector3\n zoom0: number\n // the target DOM element for key events\n _domElementKeyEvents: any = null\n\n getPolarAngle: () => number\n getAzimuthalAngle: () => number\n setPolarAngle: (x: number) => void\n setAzimuthalAngle: (x: number) => void\n getDistance: () => number\n\n listenToKeyEvents: (domElement: HTMLElement) => void\n stopListenToKeyEvents: () => void\n saveState: () => void\n reset: () => void\n update: () => void\n connect: (domElement: HTMLElement) => void\n dispose: () => void\n\n constructor(object: PerspectiveCamera | OrthographicCamera, domElement?: HTMLElement) {\n super()\n\n this.object = object\n this.domElement = domElement\n\n // for reset\n this.target0 = this.target.clone()\n this.position0 = this.object.position.clone()\n this.zoom0 = this.object.zoom\n\n //\n // public methods\n //\n\n this.getPolarAngle = (): number => spherical.phi\n\n this.getAzimuthalAngle = (): number => spherical.theta\n\n this.setPolarAngle = (value: number): void => {\n // use modulo wrapping to safeguard value\n let phi = moduloWrapAround(value, 2 * Math.PI)\n let currentPhi = spherical.phi\n\n // convert to the equivalent shortest angle\n if (currentPhi < 0) currentPhi += 2 * Math.PI\n if (phi < 0) phi += 2 * Math.PI\n let phiDist = Math.abs(phi - currentPhi)\n if (2 * Math.PI - phiDist < phiDist) {\n if (phi < currentPhi) {\n phi += 2 * Math.PI\n } else {\n currentPhi += 2 * Math.PI\n }\n }\n sphericalDelta.phi = phi - currentPhi\n scope.update()\n }\n\n this.setAzimuthalAngle = (value: number): void => {\n // use modulo wrapping to safeguard value\n let theta = moduloWrapAround(value, 2 * Math.PI)\n let currentTheta = spherical.theta\n\n // convert to the equivalent shortest angle\n if (currentTheta < 0) currentTheta += 2 * Math.PI\n if (theta < 0) theta += 2 * Math.PI\n let thetaDist = Math.abs(theta - currentTheta)\n if (2 * Math.PI - thetaDist < thetaDist) {\n if (theta < currentTheta) {\n theta += 2 * Math.PI\n } else {\n currentTheta += 2 * Math.PI\n }\n }\n sphericalDelta.theta = theta - currentTheta\n scope.update()\n }\n\n this.getDistance = (): number => scope.object.position.distanceTo(scope.target)\n\n this.listenToKeyEvents = (domElement: HTMLElement): void => {\n domElement.addEventListener('keydown', onKeyDown)\n this._domElementKeyEvents = domElement\n }\n\n this.stopListenToKeyEvents = (): void => {\n this._domElementKeyEvents.removeEventListener('keydown', onKeyDown)\n this._domElementKeyEvents = null\n }\n\n this.saveState = (): void => {\n scope.target0.copy(scope.target)\n scope.position0.copy(scope.object.position)\n scope.zoom0 = scope.object.zoom\n }\n\n this.reset = (): void => {\n scope.target.copy(scope.target0)\n scope.object.position.copy(scope.position0)\n scope.object.zoom = scope.zoom0\n scope.object.updateProjectionMatrix()\n\n // @ts-ignore\n scope.dispatchEvent(changeEvent)\n\n scope.update()\n\n state = STATE.NONE\n }\n\n // this method is exposed, but perhaps it would be better if we can make it private...\n this.update = ((): (() => void) => {\n const offset = new Vector3()\n const up = new Vector3(0, 1, 0)\n\n // so camera.up is the orbit axis\n const quat = new Quaternion().setFromUnitVectors(object.up, up)\n const quatInverse = quat.clone().invert()\n\n const lastPosition = new Vector3()\n const lastQuaternion = new Quaternion()\n\n const twoPI = 2 * Math.PI\n\n return function update(): boolean {\n const position = scope.object.position\n\n // update new up direction\n quat.setFromUnitVectors(object.up, up)\n quatInverse.copy(quat).invert()\n\n offset.copy(position).sub(scope.target)\n\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion(quat)\n\n // angle from z-axis around y-axis\n spherical.setFromVector3(offset)\n\n if (scope.autoRotate && state === STATE.NONE) {\n rotateLeft(getAutoRotationAngle())\n }\n\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\n // restrict theta to be between desired limits\n\n let min = scope.minAzimuthAngle\n let max = scope.maxAzimuthAngle\n\n if (isFinite(min) && isFinite(max)) {\n if (min < -Math.PI) min += twoPI\n else if (min > Math.PI) min -= twoPI\n\n if (max < -Math.PI) max += twoPI\n else if (max > Math.PI) max -= twoPI\n\n if (min <= max) {\n spherical.theta = Math.max(min, Math.min(max, spherical.theta))\n } else {\n spherical.theta =\n spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta)\n }\n }\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\n // move target to panned location\n\n if (scope.enableDamping === true) {\n scope.target.addScaledVector(panOffset, scope.dampingFactor)\n } else {\n scope.target.add(panOffset)\n }\n\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 as OrthographicCamera).isOrthographicCamera) {\n spherical.radius = clampDistance(spherical.radius)\n } else {\n spherical.radius = clampDistance(spherical.radius * scale)\n }\n\n offset.setFromSpherical(spherical)\n\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion(quatInverse)\n\n position.copy(scope.target).add(offset)\n\n if (!scope.object.matrixAutoUpdate) scope.object.updateMatrix()\n scope.object.lookAt(scope.target)\n\n if (scope.enableDamping === true) {\n sphericalDelta.theta *= 1 - scope.dampingFactor\n sphericalDelta.phi *= 1 - scope.dampingFactor\n\n panOffset.multiplyScalar(1 - scope.dampingFactor)\n } else {\n sphericalDelta.set(0, 0, 0)\n\n panOffset.set(0, 0, 0)\n }\n\n // adjust camera position\n let zoomChanged = false\n if (scope.zoomToCursor && performCursorZoom) {\n let newRadius = null\n if (scope.object instanceof PerspectiveCamera && 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\n const radiusDelta = prevRadius - newRadius\n scope.object.position.addScaledVector(dollyDirection, radiusDelta)\n scope.object.updateMatrixWorld()\n } else if ((scope.object as OrthographicCamera).isOrthographicCamera) {\n // adjust the ortho camera position based on zoom changes\n const mouseBefore = new Vector3(mouse.x, mouse.y, 0)\n mouseBefore.unproject(scope.object)\n\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 const mouseAfter = new Vector3(mouse.x, mouse.y, 0)\n mouseAfter.unproject(scope.object)\n\n scope.object.position.sub(mouseAfter).add(mouseBefore)\n scope.object.updateMatrixWorld()\n\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\n // handle the placement of the target\n if (newRadius !== null) {\n if (scope.screenSpacePanning) {\n // position the orbit target in front of the new camera position\n scope.target\n .set(0, 0, -1)\n .transformDirection(scope.object.matrix)\n .multiplyScalar(newRadius)\n .add(scope.object.position)\n } else {\n // get the ray and translation plane to compute target\n _ray.origin.copy(scope.object.position)\n _ray.direction.set(0, 0, -1).transformDirection(scope.object.matrix)\n\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(_ray.direction)) < TILT_LIMIT) {\n object.lookAt(scope.target)\n } else {\n _plane.setFromNormalAndCoplanarPoint(scope.object.up, scope.target)\n _ray.intersectPlane(_plane, scope.target)\n }\n }\n }\n } else if (scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera) {\n zoomChanged = scale !== 1\n\n if (zoomChanged) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / scale))\n scope.object.updateProjectionMatrix()\n }\n }\n\n scale = 1\n performCursorZoom = false\n\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\n if (\n zoomChanged ||\n lastPosition.distanceToSquared(scope.object.position) > EPS ||\n 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS\n ) {\n // @ts-ignore\n scope.dispatchEvent(changeEvent)\n\n lastPosition.copy(scope.object.position)\n lastQuaternion.copy(scope.object.quaternion)\n zoomChanged = false\n\n return true\n }\n\n return false\n }\n })()\n\n // https://github.com/mrdoob/three.js/issues/20575\n this.connect = (domElement: HTMLElement): void => {\n if ((domElement as any) === document) {\n console.error(\n 'THREE.OrbitControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.',\n )\n }\n scope.domElement = domElement\n // disables touch scroll\n // touch-action needs to be defined for pointer events to work on mobile\n // https://stackoverflow.com/a/48254578\n scope.domElement.style.touchAction = 'none'\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 }\n\n this.dispose = (): void => {\n // Enabling touch scroll\n if (scope.domElement) {\n scope.domElement.style.touchAction = 'auto'\n }\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?.ownerDocument.removeEventListener('pointermove', onPointerMove)\n scope.domElement?.ownerDocument.removeEventListener('pointerup', onPointerUp)\n if (scope._domElementKeyEvents !== null) {\n scope._domElementKeyEvents.removeEventListener('keydown', onKeyDown)\n }\n //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n }\n\n //\n // internals\n //\n\n const scope = this\n\n const changeEvent = { type: 'change' }\n const startEvent = { type: 'start' }\n const endEvent = { type: 'end' }\n\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\n let state = STATE.NONE\n\n const EPS = 0.000001\n\n // current position in spherical coordinates\n const spherical = new Spherical()\n const sphericalDelta = new Spherical()\n\n let scale = 1\n const panOffset = new Vector3()\n\n const rotateStart = new Vector2()\n const rotateEnd = new Vector2()\n const rotateDelta = new Vector2()\n\n const panStart = new Vector2()\n const panEnd = new Vector2()\n const panDelta = new Vector2()\n\n const dollyStart = new Vector2()\n const dollyEnd = new Vector2()\n const dollyDelta = new Vector2()\n\n const dollyDirection = new Vector3()\n const mouse = new Vector2()\n let performCursorZoom = false\n\n const pointers: PointerEvent[] = []\n const pointerPositions: { [key: string]: Vector2 } = {}\n\n function getAutoRotationAngle(): number {\n return ((2 * Math.PI) / 60 / 60) * scope.autoRotateSpeed\n }\n\n function getZoomScale(): number {\n return Math.pow(0.95, scope.zoomSpeed)\n }\n\n function rotateLeft(angle: number): void {\n if (scope.reverseOrbit || scope.reverseHorizontalOrbit) {\n sphericalDelta.theta += angle\n } else {\n sphericalDelta.theta -= angle\n }\n }\n\n function rotateUp(angle: number): void {\n if (scope.reverseOrbit || scope.reverseVerticalOrbit) {\n sphericalDelta.phi += angle\n } else {\n sphericalDelta.phi -= angle\n }\n }\n\n const panLeft = (() => {\n const v = new Vector3()\n\n return function panLeft(distance: number, objectMatrix: Matrix4) {\n v.setFromMatrixColumn(objectMatrix, 0) // get X column of objectMatrix\n v.multiplyScalar(-distance)\n\n panOffset.add(v)\n }\n })()\n\n const panUp = (() => {\n const v = new Vector3()\n\n return function panUp(distance: number, objectMatrix: Matrix4) {\n if (scope.screenSpacePanning === true) {\n v.setFromMatrixColumn(objectMatrix, 1)\n } else {\n v.setFromMatrixColumn(objectMatrix, 0)\n v.crossVectors(scope.object.up, v)\n }\n\n v.multiplyScalar(distance)\n\n panOffset.add(v)\n }\n })()\n\n // deltaX and deltaY are in pixels; right and down are positive\n const pan = (() => {\n const offset = new Vector3()\n\n return function pan(deltaX: number, deltaY: number) {\n const element = scope.domElement\n\n if (element && scope.object instanceof PerspectiveCamera && scope.object.isPerspectiveCamera) {\n // perspective\n const position = scope.object.position\n offset.copy(position).sub(scope.target)\n let targetDistance = offset.length()\n\n // half of the fov is center to top of screen\n targetDistance *= Math.tan(((scope.object.fov / 2) * Math.PI) / 180.0)\n\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 (element && scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera) {\n // orthographic\n panLeft(\n (deltaX * (scope.object.right - scope.object.left)) / scope.object.zoom / element.clientWidth,\n scope.object.matrix,\n )\n panUp(\n (deltaY * (scope.object.top - scope.object.bottom)) / scope.object.zoom / element.clientHeight,\n scope.object.matrix,\n )\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\n function dollyOut(dollyScale: number) {\n if (\n (scope.object instanceof PerspectiveCamera && scope.object.isPerspectiveCamera) ||\n (scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera)\n ) {\n 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\n function dollyIn(dollyScale: number) {\n if (\n (scope.object instanceof PerspectiveCamera && scope.object.isPerspectiveCamera) ||\n (scope.object instanceof OrthographicCamera && scope.object.isOrthographicCamera)\n ) {\n 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\n function updateMouseParameters(event: MouseEvent): void {\n if (!scope.zoomToCursor || !scope.domElement) {\n return\n }\n\n performCursorZoom = true\n\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\n mouse.x = (x / w) * 2 - 1\n mouse.y = -(y / h) * 2 + 1\n\n dollyDirection.set(mouse.x, mouse.y, 1).unproject(scope.object).sub(scope.object.position).normalize()\n }\n\n function clampDistance(dist: number): number {\n return Math.max(scope.minDistance, Math.min(scope.maxDistance, dist))\n }\n\n //\n // event callbacks - update the object state\n //\n\n function handleMouseDownRotate(event: MouseEvent) {\n rotateStart.set(event.clientX, event.clientY)\n }\n\n function handleMouseDownDolly(event: MouseEvent) {\n updateMouseParameters(event)\n dollyStart.set(event.clientX, event.clientY)\n }\n\n function handleMouseDownPan(event: MouseEvent) {\n panStart.set(event.clientX, event.clientY)\n }\n\n function handleMouseMoveRotate(event: MouseEvent) {\n rotateEnd.set(event.clientX, event.clientY)\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed)\n\n const element = scope.domElement\n\n if (element) {\n rotateLeft((2 * Math.PI * rotateDelta.x) / element.clientHeight) // yes, height\n rotateUp((2 * Math.PI * rotateDelta.y) / element.clientHeight)\n }\n rotateStart.copy(rotateEnd)\n scope.update()\n }\n\n function handleMouseMoveDolly(event: MouseEvent) {\n dollyEnd.set(event.clientX, event.clientY)\n dollyDelta.subVectors(dollyEnd, dollyStart)\n\n if (dollyDelta.y > 0) {\n dollyOut(getZoomScale())\n } else if (dollyDelta.y < 0) {\n dollyIn(getZoomScale())\n }\n\n dollyStart.copy(dollyEnd)\n scope.update()\n }\n\n function handleMouseMovePan(event: MouseEvent) {\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\n function handleMouseWheel(event: WheelEvent) {\n updateMouseParameters(event)\n\n if (event.deltaY < 0) {\n dollyIn(getZoomScale())\n } else if (event.deltaY > 0) {\n dollyOut(getZoomScale())\n }\n\n scope.update()\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n let needsUpdate = false\n\n switch (event.code) {\n case scope.keys.UP:\n pan(0, scope.keyPanSpeed)\n needsUpdate = true\n break\n\n case scope.keys.BOTTOM:\n pan(0, -scope.keyPanSpeed)\n needsUpdate = true\n break\n\n case scope.keys.LEFT:\n pan(scope.keyPanSpeed, 0)\n needsUpdate = true\n break\n\n case scope.keys.RIGHT:\n pan(-scope.keyPanSpeed, 0)\n needsUpdate = true\n break\n }\n\n if (needsUpdate) {\n // prevent the browser from scrolling on cursor keys\n event.preventDefault()\n scope.update()\n }\n }\n\n function handleTouchStartRotate() {\n if (pointers.length == 1) {\n 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\n rotateStart.set(x, y)\n }\n }\n\n function handleTouchStartPan() {\n if (pointers.length == 1) {\n 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\n panStart.set(x, y)\n }\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\n dollyStart.set(0, distance)\n }\n\n function handleTouchStartDollyPan() {\n if (scope.enableZoom) handleTouchStartDolly()\n if (scope.enablePan) handleTouchStartPan()\n }\n\n function handleTouchStartDollyRotate() {\n if (scope.enableZoom) handleTouchStartDolly()\n if (scope.enableRotate) handleTouchStartRotate()\n }\n\n function handleTouchMoveRotate(event: PointerEvent) {\n if (pointers.length == 1) {\n 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\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed)\n\n const element = scope.domElement\n\n if (element) {\n rotateLeft((2 * Math.PI * rotateDelta.x) / element.clientHeight) // yes, height\n rotateUp((2 * Math.PI * rotateDelta.y) / element.clientHeight)\n }\n rotateStart.copy(rotateEnd)\n }\n\n function handleTouchMovePan(event: PointerEvent) {\n if (pointers.length == 1) {\n 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\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed)\n pan(panDelta.x, panDelta.y)\n panStart.copy(panEnd)\n }\n\n function handleTouchMoveDolly(event: PointerEvent) {\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\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\n function handleTouchMoveDollyPan(event: PointerEvent) {\n if (scope.enableZoom) handleTouchMoveDolly(event)\n if (scope.enablePan) handleTouchMovePan(event)\n }\n\n function handleTouchMoveDollyRotate(event: PointerEvent) {\n if (scope.enableZoom) handleTouchMoveDolly(event)\n if (scope.enableRotate) handleTouchMoveRotate(event)\n }\n\n //\n // event handlers - FSM: listen for events and reset state\n //\n\n function onPointerDown(event: PointerEvent) {\n if (scope.enabled === false) return\n\n if (pointers.length === 0) {\n scope.domElement?.ownerDocument.addEventListener('pointermove', onPointerMove)\n scope.domElement?.ownerDocument.addEventListener('pointerup', onPointerUp)\n }\n\n addPointer(event)\n\n if (event.pointerType === 'touch') {\n onTouchStart(event)\n } else {\n onMouseDown(event)\n }\n }\n\n function onPointerMove(event: PointerEvent) {\n if (scope.enabled === false) return\n\n if (event.pointerType === 'touch') {\n onTouchMove(event)\n } else {\n onMouseMove(event)\n }\n }\n\n function onPointerUp(event: PointerEvent) {\n removePointer(event)\n\n if (pointers.length === 0) {\n scope.domElement?.releasePointerCapture(event.pointerId)\n\n scope.domElement?.ownerDocument.removeEventListener('pointermove', onPointerMove)\n scope.domElement?.ownerDocument.removeEventListener('pointerup', onPointerUp)\n }\n\n // @ts-ignore\n scope.dispatchEvent(endEvent)\n\n state = STATE.NONE\n }\n\n function onMouseDown(event: MouseEvent) {\n let mouseAction\n\n switch (event.button) {\n case 0:\n mouseAction = scope.mouseButtons.LEFT\n break\n\n case 1:\n mouseAction = scope.mouseButtons.MIDDLE\n break\n\n case 2:\n mouseAction = scope.mouseButtons.RIGHT\n break\n\n default:\n mouseAction = -1\n }\n\n switch (mouseAction) {\n case MOUSE.DOLLY:\n if (scope.enableZoom === false) return\n handleMouseDownDolly(event)\n state = STATE.DOLLY\n break\n\n case 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\n case 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\n default:\n state = STATE.NONE\n }\n\n if (state !== STATE.NONE) {\n // @ts-ignore\n scope.dispatchEvent(startEvent)\n }\n }\n\n function onMouseMove(event: MouseEvent) {\n if (scope.enabled === false) return\n\n switch (state) {\n case STATE.ROTATE:\n if (scope.enableRotate === false) return\n handleMouseMoveRotate(event)\n break\n\n case STATE.DOLLY:\n if (scope.enableZoom === false) return\n handleMouseMoveDolly(event)\n break\n\n case STATE.PAN:\n if (scope.enablePan === false) return\n handleMouseMovePan(event)\n break\n }\n }\n\n function onMouseWheel(event: WheelEvent) {\n if (scope.enabled === false || scope.enableZoom === false || (state !== STATE.NONE && state !== STATE.ROTATE)) {\n return\n }\n\n event.preventDefault()\n\n // @ts-ignore\n scope.dispatchEvent(startEvent)\n\n handleMouseWheel(event)\n\n // @ts-ignore\n scope.dispatchEvent(endEvent)\n }\n\n function onKeyDown(event: KeyboardEvent) {\n if (scope.enabled === false || scope.enablePan === false) return\n handleKeyDown(event)\n }\n\n function onTouchStart(event: PointerEvent) {\n trackPointer(event)\n\n switch (pointers.length) {\n case 1:\n switch (scope.touches.ONE) {\n case TOUCH.ROTATE:\n if (scope.enableRotate === false) return\n handleTouchStartRotate()\n state = STATE.TOUCH_ROTATE\n break\n\n case TOUCH.PAN:\n if (scope.enablePan === false) return\n handleTouchStartPan()\n state = STATE.TOUCH_PAN\n break\n\n default:\n state = STATE.NONE\n }\n\n break\n\n case 2:\n switch (scope.touches.TWO) {\n case TOUCH.DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return\n handleTouchStartDollyPan()\n state = STATE.TOUCH_DOLLY_PAN\n break\n\n case TOUCH.DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return\n handleTouchStartDollyRotate()\n state = STATE.TOUCH_DOLLY_ROTATE\n break\n\n default:\n state = STATE.NONE\n }\n\n break\n\n default:\n state = STATE.NONE\n }\n\n if (state !== STATE.NONE) {\n // @ts-ignore\n scope.dispatchEvent(startEvent)\n }\n }\n\n function onTouchMove(event: PointerEvent) {\n trackPointer(event)\n\n switch (state) {\n case STATE.TOUCH_ROTATE:\n if (scope.enableRotate === false) return\n handleTouchMoveRotate(event)\n scope.update()\n break\n\n case STATE.TOUCH_PAN:\n if (scope.enablePan === false) return\n handleTouchMovePan(event)\n scope.update()\n break\n\n case STATE.TOUCH_DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return\n handleTouchMoveDollyPan(event)\n scope.update()\n break\n\n case STATE.TOUCH_DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return\n handleTouchMoveDollyRotate(event)\n scope.update()\n break\n\n default:\n state = STATE.NONE\n }\n }\n\n function onContextMenu(event: Event) {\n if (scope.enabled === false) return\n event.preventDefault()\n }\n\n function addPointer(event: PointerEvent) {\n pointers.push(event)\n }\n\n function removePointer(event: PointerEvent) {\n delete pointerPositions[event.pointerId]\n\n for (let i = 0; i < pointers.length; i++) {\n if (pointers[i].pointerId == event.pointerId) {\n pointers.splice(i, 1)\n return\n }\n }\n }\n\n function trackPointer(event: PointerEvent) {\n let position = pointerPositions[event.pointerId]\n\n if (position === undefined) {\n position = new Vector2()\n pointerPositions[event.pointerId] = position\n }\n\n position.set(event.pageX, event.pageY)\n }\n\n function getSecondPointerPosition(event: PointerEvent) {\n const pointer = event.pointerId === pointers[0].pointerId ? pointers[1] : pointers[0]\n return pointerPositions[pointer.pointerId]\n }\n\n // connect events\n if (domElement !== undefined) this.connect(domElement)\n // force an update at start\n this.update()\n }\n}\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n// This is very similar to OrbitControls, another set of touch behavior\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 constructor(object: PerspectiveCamera | OrthographicCamera, domElement?: HTMLElement) {\n super(object, domElement)\n\n this.screenSpacePanning = false // pan orthogonal to world-space direction camera.up\n\n this.mouseButtons.LEFT = MOUSE.PAN\n this.mouseButtons.RIGHT = MOUSE.ROTATE\n\n this.touches.ONE = TOUCH.PAN\n this.touches.TWO = TOUCH.DOLLY_ROTATE\n }\n}\n\nexport { OrbitControls, MapControls }\n", "import {\n GridHelper,\n EllipseCurve,\n BufferGeometry,\n Line,\n LineBasicMaterial,\n Raycaster,\n Group,\n Box3,\n Sphere,\n Quaternion,\n Vector2,\n Vector3,\n Matrix4,\n MathUtils,\n Scene,\n PerspectiveCamera,\n OrthographicCamera,\n Mesh,\n Material,\n EventDispatcher,\n} from 'three'\n\ntype Camera = OrthographicCamera | PerspectiveCamera\ntype Operation = 'PAN' | 'ROTATE' | 'ZOOM' | 'FOV'\ntype MouseButtonType = number | 'WHEEL'\ntype ModifierKey = 'CTRL' | 'SHIFT'\ntype MouseAction = {\n operation: Operation\n mouse: MouseButtonType\n key: ModifierKey | null\n}\n\ntype Transformation = {\n camera: Matrix4 | null\n gizmos: Matrix4 | null\n}\n\n//trackball state\nconst STATE = {\n IDLE: Symbol(),\n ROTATE: Symbol(),\n PAN: Symbol(),\n SCALE: Symbol(),\n FOV: Symbol(),\n FOCUS: Symbol(),\n ZROTATE: Symbol(),\n TOUCH_MULTI: Symbol(),\n ANIMATION_FOCUS: Symbol(),\n ANIMATION_ROTATE: Symbol(),\n}\n\nconst INPUT = {\n NONE: Symbol(),\n ONE_FINGER: Symbol(),\n ONE_FINGER_SWITCHED: Symbol(),\n TWO_FINGER: Symbol(),\n MULT_FINGER: Symbol(),\n CURSOR: Symbol(),\n}\n\n//cursor center coordinates\nconst _center = {\n x: 0,\n y: 0,\n}\n\n//transformation matrices for gizmos and camera\nconst _transformation: Transformation = {\n camera: new Matrix4(),\n gizmos: new Matrix4(),\n}\n\n//events\nconst _changeEvent = { type: 'change' }\nconst _startEvent = { type: 'start' }\nconst _endEvent = { type: 'end' }\n\n/**\n *\n * @param {CamOrthographicCamera | PerspectiveCameraera} camera Virtual camera used in the scene\n * @param {HTMLElement=null} domElement Renderer's dom element\n * @param {Scene=null} scene The scene to be rendered\n */\nclass ArcballControls extends EventDispatcher {\n private camera: OrthographicCamera | PerspectiveCamera | null\n private domElement: HTMLElement | null | undefined\n private scene: Scene | null | undefined\n\n private mouseActions: (MouseAction & { state: Symbol })[]\n private _mouseOp: Operation | null\n\n private _v2_1: Vector2\n private _v3_1: Vector3\n private _v3_2: Vector3\n\n private _m4_1: Matrix4\n private _m4_2: Matrix4\n\n private _quat: Quaternion\n\n private _translationMatrix: Matrix4\n private _rotationMatrix: Matrix4\n private _scaleMatrix: Matrix4\n\n private _rotationAxis: Vector3\n\n private _cameraMatrixState: Matrix4\n private _cameraProjectionState: Matrix4\n\n private _fovState: number\n private _upState: Vector3\n private _zoomState: number\n private _nearPos: number\n private _farPos: number\n\n private _gizmoMatrixState: Matrix4\n\n private _up0: Vector3\n private _zoom0: number\n private _fov0: number\n private _initialNear: number\n private _nearPos0: number\n private _initialFar: number\n private _farPos0: number\n private _cameraMatrixState0: Matrix4\n private _gizmoMatrixState0: Matrix4\n\n private _button: MouseButtonType\n private _touchStart: PointerEvent[]\n private _touchCurrent: PointerEvent[]\n private _input: Symbol\n\n private _switchSensibility: number\n private _startFingerDistance: number\n private _currentFingerDistance: number\n private _startFingerRotation: number\n private _currentFingerRotation: number\n\n private _devPxRatio: number\n private _downValid: boolean\n private _nclicks: number\n private _downEvents: PointerEvent[]\n private _clickStart: number\n private _maxDownTime: number\n private _maxInterval: number\n private _posThreshold: number\n private _movementThreshold: number\n\n private _currentCursorPosition: Vector3\n private _startCursorPosition: Vector3\n\n private _grid: GridHelper | null\n private _gridPosition: Vector3\n\n private _gizmos: Group\n private _curvePts: number\n\n private _timeStart: number\n private _animationId: number\n\n public focusAnimationTime: number\n\n private _timePrev: number\n private _timeCurrent: number\n private _anglePrev: number\n private _angleCurrent: number\n private _cursorPosPrev: Vector3\n private _cursorPosCurr: Vector3\n private _wPrev: number\n private _wCurr: number\n\n public adjustNearFar: boolean\n public scaleFactor: number\n public dampingFactor: number\n public wMax: number\n public enableAnimations: boolean\n public enableGrid: boolean\n public cursorZoom: boolean\n public minFov: number\n public maxFov: number\n\n public enabled: boolean\n public enablePan: boolean\n public enableRotate: boolean\n public enableZoom: boolean\n\n public minDistance: number\n public maxDistance: number\n public minZoom: number\n public maxZoom: number\n\n private target: Vector3\n private _currentTarget: Vector3\n\n private _tbRadius: number\n\n private _state: Symbol\n\n constructor(\n camera: Camera | null,\n domElement: HTMLElement | null | undefined = null,\n scene: Scene | null | undefined = null,\n ) {\n super()\n this.camera = null\n this.domElement = domElement\n this.scene = scene\n\n this.mouseActions = []\n this._mouseOp = null\n\n //global vectors and matrices that are used in some operations to avoid creating new objects every time (e.g. every time cursor moves)\n this._v2_1 = new Vector2()\n this._v3_1 = new Vector3()\n this._v3_2 = new Vector3()\n\n this._m4_1 = new Matrix4()\n this._m4_2 = new Matrix4()\n\n this._quat = new Quaternion()\n\n //transformation matrices\n this._translationMatrix = new Matrix4() //matrix for translation operation\n this._rotationMatrix = new Matrix4() //matrix for rotation operation\n this._scaleMatrix = new Matrix4() //matrix for scaling operation\n\n this._rotationAxis = new Vector3() //axis for rotate operation\n\n //camera state\n this._cameraMatrixState = new Matrix4()\n this._cameraProjectionState = new Matrix4()\n\n this._fovState = 1\n this._upState = new Vector3()\n this._zoomState = 1\n this._nearPos = 0\n this._farPos = 0\n\n this._gizmoMatrixState = new Matrix4()\n\n //initial values\n this._up0 = new Vector3()\n this._zoom0 = 1\n this._fov0 = 0\n this._initialNear = 0\n this._nearPos0 = 0\n this._initialFar = 0\n this._farPos0 = 0\n this._cameraMatrixState0 = new Matrix4()\n this._gizmoMatrixState0 = new Matrix4()\n\n //pointers array\n this._button = -1\n this._touchStart = []\n this._touchCurrent = []\n this._input = INPUT.NONE\n\n //two fingers touch interaction\n this._switchSensibility = 32 //minimum movement to be performed to fire single pan start after the second finger has been released\n this._startFingerDistance = 0 //distance between two fingers\n this._currentFingerDistance = 0\n this._startFingerRotation = 0 //amount of rotation performed with two fingers\n this._currentFingerRotation = 0\n\n //double tap\n this._devPxRatio = 0\n this._downValid = true\n this._nclicks = 0\n this._downEvents = []\n this._clickStart = 0 //first click time\n this._maxDownTime = 250\n this._maxInterval = 300\n this._posThreshold = 24\n this._movementThreshold = 24\n\n //cursor positions\n this._currentCursorPosition = new Vector3()\n this._startCursorPosition = new Vector3()\n\n //grid\n this._grid = null //grid to be visualized during pan operation\n this._gridPosition = new Vector3()\n\n //gizmos\n this._gizmos = new Group()\n this._curvePts = 128\n\n //animations\n this._timeStart = -1 //initial time\n this._animationId = -1\n\n //focus animation\n this.focusAnimationTime = 500 //duration of focus animation in ms\n\n //rotate animation\n this._timePrev = 0 //time at which previous rotate operation has been detected\n this._timeCurrent = 0 //time at which current rotate operation has been detected\n this._anglePrev = 0 //angle of previous rotation\n this._angleCurrent = 0 //angle of current rotation\n this._cursorPosPrev = new Vector3() //cursor position when previous rotate operation has been detected\n this._cursorPosCurr = new Vector3() //cursor position when current rotate operation has been detected\n this._wPrev = 0 //angular velocity of the previous rotate operation\n this._wCurr = 0 //angular velocity of the current rotate operation\n\n //parameters\n this.adjustNearFar = false\n this.scaleFactor = 1.1 //zoom/distance multiplier\n this.dampingFactor = 25\n this.wMax = 20 //maximum angular velocity allowed\n this.enableAnimations = true //if animations should be performed\n this.enableGrid = false //if grid should be showed during pan operation\n this.cursorZoom = false //if wheel zoom should be cursor centered\n this.minFov = 5\n this.maxFov = 90\n\n this.enabled = true\n this.enablePan = true\n this.enableRotate = true\n this.enableZoom = true\n\n this.minDistance = 0\n this.maxDistance = Infinity\n this.minZoom = 0\n this.maxZoom = Infinity\n\n //trackball parameters\n this.target = new Vector3(0, 0, 0)\n this._currentTarget = new Vector3(0, 0, 0)\n\n this._tbRadius = 1\n\n //FSA\n this._state = STATE.IDLE\n\n this.setCamera(camera)\n\n if (this.scene) {\n this.scene.add(this._gizmos)\n }\n\n this._devPxRatio = window.devicePixelRatio\n\n this.initializeMouseActions()\n\n if (this.domElement) this.connect(this.domElement)\n\n window.addEventListener('resize', this.onWindowResize)\n }\n\n //listeners\n\n private onWindowResize = (): void => {\n const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3\n if (this.camera) {\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n }\n\n const newRadius = this._tbRadius / scale\n // @ts-ignore\n const curve = new EllipseCurve(0, 0, newRadius, newRadius)\n const points = curve.getPoints(this._curvePts)\n const curveGeometry = new BufferGeometry().setFromPoints(points)\n\n for (const gizmo in this._gizmos.children) {\n const child = this._gizmos.children[gizmo] as Mesh\n child.geometry = curveGeometry\n }\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n private onContextMenu = (event: MouseEvent): void => {\n if (!this.enabled) {\n return\n }\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n if (this.mouseActions[i].mouse == 2) {\n //prevent only if button 2 is actually used\n event.preventDefault()\n break\n }\n }\n }\n\n private onPointerCancel = (): void => {\n this._touchStart.splice(0, this._touchStart.length)\n this._touchCurrent.splice(0, this._touchCurrent.length)\n this._input = INPUT.NONE\n }\n\n private onPointerDown = (event: PointerEvent): void => {\n if (event.button == 0 && event.isPrimary) {\n this._downValid = true\n this._downEvents.push(event)\n } else {\n this._downValid = false\n }\n\n if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {\n this._touchStart.push(event)\n this._touchCurrent.push(event)\n\n switch (this._input) {\n case INPUT.NONE:\n //singleStart\n this._input = INPUT.ONE_FINGER\n this.onSinglePanStart(event, 'ROTATE')\n\n window.addEventListener('pointermove', this.onPointerMove)\n window.addEventListener('pointerup', this.onPointerUp)\n\n break\n\n case INPUT.ONE_FINGER:\n case INPUT.ONE_FINGER_SWITCHED:\n //doubleStart\n this._input = INPUT.TWO_FINGER\n\n this.onRotateStart()\n this.onPinchStart()\n this.onDoublePanStart()\n\n break\n\n case INPUT.TWO_FINGER:\n //multipleStart\n this._input = INPUT.MULT_FINGER\n this.onTriplePanStart()\n break\n }\n } else if (event.pointerType != 'touch' && this._input == INPUT.NONE) {\n let modifier: ModifierKey | null = null\n\n if (event.ctrlKey || event.metaKey) {\n modifier = 'CTRL'\n } else if (event.shiftKey) {\n modifier = 'SHIFT'\n }\n\n this._mouseOp = this.getOpFromAction(event.button, modifier)\n if (this._mouseOp) {\n window.addEventListener('pointermove', this.onPointerMove)\n window.addEventListener('pointerup', this.onPointerUp)\n\n //singleStart\n this._input = INPUT.CURSOR\n this._button = event.button\n this.onSinglePanStart(event, this._mouseOp)\n }\n }\n }\n\n private onPointerMove = (event: PointerEvent): void => {\n if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {\n switch (this._input) {\n case INPUT.ONE_FINGER:\n //singleMove\n this.updateTouchEvent(event)\n\n this.onSinglePanMove(event, STATE.ROTATE)\n break\n\n case INPUT.ONE_FINGER_SWITCHED:\n const movement = this.calculatePointersDistance(this._touchCurrent[0], event) * this._devPxRatio\n\n if (movement >= this._switchSensibility) {\n //singleMove\n this._input = INPUT.ONE_FINGER\n this.updateTouchEvent(event)\n\n this.onSinglePanStart(event, 'ROTATE')\n break\n }\n\n break\n\n case INPUT.TWO_FINGER:\n //rotate/pan/pinchMove\n this.updateTouchEvent(event)\n\n this.onRotateMove()\n this.onPinchMove()\n this.onDoublePanMove()\n\n break\n\n case INPUT.MULT_FINGER:\n //multMove\n this.updateTouchEvent(event)\n\n this.onTriplePanMove()\n break\n }\n } else if (event.pointerType != 'touch' && this._input == INPUT.CURSOR) {\n let modifier: ModifierKey | null = null\n\n if (event.ctrlKey || event.metaKey) {\n modifier = 'CTRL'\n } else if (event.shiftKey) {\n modifier = 'SHIFT'\n }\n\n const mouseOpState = this.getOpStateFromAction(this._button, modifier)\n\n if (mouseOpState) {\n this.onSinglePanMove(event, mouseOpState)\n }\n }\n\n //checkDistance\n if (this._downValid) {\n const movement =\n this.calculatePointersDistance(this._downEvents[this._downEvents.length - 1], event) * this._devPxRatio\n if (movement > this._movementThreshold) {\n this._downValid = false\n }\n }\n }\n\n private onPointerUp = (event: PointerEvent): void => {\n if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {\n const nTouch = this._touchCurrent.length\n\n for (let i = 0; i < nTouch; i++) {\n if (this._touchCurrent[i].pointerId == event.pointerId) {\n this._touchCurrent.splice(i, 1)\n this._touchStart.splice(i, 1)\n break\n }\n }\n\n switch (this._input) {\n case INPUT.ONE_FINGER:\n case INPUT.ONE_FINGER_SWITCHED:\n //singleEnd\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n this._input = INPUT.NONE\n this.onSinglePanEnd()\n\n break\n\n case INPUT.TWO_FINGER:\n //doubleEnd\n this.onDoublePanEnd()\n this.onPinchEnd()\n this.onRotateEnd()\n\n //switching to singleStart\n this._input = INPUT.ONE_FINGER_SWITCHED\n\n break\n\n case INPUT.MULT_FINGER:\n if (this._touchCurrent.length == 0) {\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n //multCancel\n this._input = INPUT.NONE\n this.onTriplePanEnd()\n }\n\n break\n }\n } else if (event.pointerType != 'touch' && this._input == INPUT.CURSOR) {\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n this._input = INPUT.NONE\n this.onSinglePanEnd()\n this._button = -1\n }\n\n if (event.isPrimary) {\n if (this._downValid) {\n const downTime = event.timeStamp - this._downEvents[this._downEvents.length - 1].timeStamp\n\n if (downTime <= this._maxDownTime) {\n if (this._nclicks == 0) {\n //first valid click detected\n this._nclicks = 1\n this._clickStart = performance.now()\n } else {\n const clickInterval = event.timeStamp - this._clickStart\n const movement = this.calculatePointersDistance(this._downEvents[1], this._downEvents[0]) * this._devPxRatio\n\n if (clickInterval <= this._maxInterval && movement <= this._posThreshold) {\n //second valid click detected\n //fire double tap and reset values\n this._nclicks = 0\n this._downEvents.splice(0, this._downEvents.length)\n this.onDoubleTap(event)\n } else {\n //new 'first click'\n this._nclicks = 1\n this._downEvents.shift()\n this._clickStart = performance.now()\n }\n }\n } else {\n this._downValid = false\n this._nclicks = 0\n this._downEvents.splice(0, this._downEvents.length)\n }\n } else {\n this._nclicks = 0\n this._downEvents.splice(0, this._downEvents.length)\n }\n }\n }\n\n private onWheel = (event: WheelEvent): void => {\n if (this.enabled && this.enableZoom && this.domElement) {\n let modifier: ModifierKey | null = null\n\n if (event.ctrlKey || event.metaKey) {\n modifier = 'CTRL'\n } else if (event.shiftKey) {\n modifier = 'SHIFT'\n }\n\n const mouseOp = this.getOpFromAction('WHEEL', modifier)\n\n if (mouseOp) {\n event.preventDefault()\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n const notchDeltaY = 125 //distance of one notch of mouse wheel\n let sgn = event.deltaY / notchDeltaY\n\n let size = 1\n\n if (sgn > 0) {\n size = 1 / this.scaleFactor\n } else if (sgn < 0) {\n size = this.scaleFactor\n }\n\n switch (mouseOp) {\n case 'ZOOM':\n this.updateTbState(STATE.SCALE, true)\n\n if (sgn > 0) {\n size = 1 / Math.pow(this.scaleFactor, sgn)\n } else if (sgn < 0) {\n size = Math.pow(this.scaleFactor, -sgn)\n }\n\n if (this.cursorZoom && this.enablePan) {\n let scalePoint\n\n if (this.camera instanceof OrthographicCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .multiplyScalar(1 / this.camera.zoom)\n .add(this._gizmos.position)\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .add(this._gizmos.position)\n }\n\n if (scalePoint !== undefined) this.applyTransformMatrix(this.applyScale(size, scalePoint))\n } else {\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position))\n }\n\n if (this._grid) {\n this.disposeGrid()\n this.drawGrid()\n }\n\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n\n break\n\n case 'FOV':\n if (this.camera instanceof PerspectiveCamera) {\n this.updateTbState(STATE.FOV, true)\n\n //Vertigo effect\n\n //\t fov / 2\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\tx\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t\t| _ _ _\\\n //\t\t\ty\n\n //check for iOs shift shortcut\n if (event.deltaX != 0) {\n sgn = event.deltaX / notchDeltaY\n\n size = 1\n\n if (sgn > 0) {\n size = 1 / Math.pow(this.scaleFactor, sgn)\n } else if (sgn < 0) {\n size = Math.pow(this.scaleFactor, -sgn)\n }\n }\n\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n const x = this._v3_1.distanceTo(this._gizmos.position)\n let xNew = x / size //distance between camera and gizmos if scale(size, scalepoint) would be performed\n\n //check min and max distance\n xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance)\n\n const y = x * Math.tan(MathUtils.DEG2RAD * this.camera.fov * 0.5)\n\n //calculate new fov\n let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2)\n\n //check min and max fov\n if (newFov > this.maxFov) {\n newFov = this.maxFov\n } else if (newFov < this.minFov) {\n newFov = this.minFov\n }\n\n const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2))\n size = x / newDistance\n\n this.setFov(newFov)\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position, false))\n }\n\n if (this._grid) {\n this.disposeGrid()\n this.drawGrid()\n }\n\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n\n break\n }\n }\n }\n }\n\n private onSinglePanStart = (event: PointerEvent, operation: Operation): void => {\n if (this.enabled && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.setCenter(event.clientX, event.clientY)\n\n switch (operation) {\n case 'PAN':\n if (!this.enablePan) return\n\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n if (this.camera) {\n this.updateTbState(STATE.PAN, true)\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n if (this.enableGrid) {\n this.drawGrid()\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n break\n\n case 'ROTATE':\n if (!this.enableRotate) return\n\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n }\n\n if (this.camera) {\n this.updateTbState(STATE.ROTATE, true)\n const rayDir = this.unprojectOnTbSurface(this.camera, _center.x, _center.y, this.domElement, this._tbRadius)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n this.activateGizmos(true)\n if (this.enableAnimations) {\n this._timePrev = this._timeCurrent = performance.now()\n this._angleCurrent = this._anglePrev = 0\n this._cursorPosPrev.copy(this._startCursorPosition)\n this._cursorPosCurr.copy(this._cursorPosPrev)\n this._wCurr = 0\n this._wPrev = this._wCurr\n }\n }\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n break\n\n case 'FOV':\n if (!this.enableZoom) return\n\n if (this.camera instanceof PerspectiveCamera) {\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n this.updateTbState(STATE.FOV, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n }\n break\n\n case 'ZOOM':\n if (!this.enableZoom) return\n\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId)\n this._animationId = -1\n this._timeStart = -1\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n this.updateTbState(STATE.SCALE, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n break\n }\n }\n }\n\n private onSinglePanMove = (event: PointerEvent, opState: Symbol): void => {\n if (this.enabled && this.domElement) {\n const restart = opState != this._state\n this.setCenter(event.clientX, event.clientY)\n\n switch (opState) {\n case STATE.PAN:\n if (this.enablePan && this.camera) {\n if (restart) {\n //switch to pan operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n if (this.enableGrid) {\n this.drawGrid()\n }\n\n this.activateGizmos(false)\n } else {\n //continue with pan operation\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n if (rayDir !== undefined) {\n this._currentCursorPosition.copy(rayDir)\n }\n this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition))\n }\n }\n\n break\n\n case STATE.ROTATE:\n if (this.enableRotate && this.camera) {\n if (restart) {\n //switch to rotate operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n const rayDir = this.unprojectOnTbSurface(\n this.camera,\n _center.x,\n _center.y,\n this.domElement,\n this._tbRadius,\n )\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(true)\n } else {\n //continue with rotate operation\n const rayDir = this.unprojectOnTbSurface(\n this.camera,\n _center.x,\n _center.y,\n this.domElement,\n this._tbRadius,\n )\n if (rayDir !== undefined) {\n this._currentCursorPosition.copy(rayDir)\n }\n\n const distance = this._startCursorPosition.distanceTo(this._currentCursorPosition)\n const angle = this._startCursorPosition.angleTo(this._currentCursorPosition)\n const amount = Math.max(distance / this._tbRadius, angle) //effective rotation angle\n\n this.applyTransformMatrix(\n this.rotate(this.calculateRotationAxis(this._startCursorPosition, this._currentCursorPosition), amount),\n )\n\n if (this.enableAnimations) {\n this._timePrev = this._timeCurrent\n this._timeCurrent = performance.now()\n this._anglePrev = this._angleCurrent\n this._angleCurrent = amount\n this._cursorPosPrev.copy(this._cursorPosCurr)\n this._cursorPosCurr.copy(this._currentCursorPosition)\n this._wPrev = this._wCurr\n this._wCurr = this.calculateAngularSpeed(\n this._anglePrev,\n this._angleCurrent,\n this._timePrev,\n this._timeCurrent,\n )\n }\n }\n }\n\n break\n\n case STATE.SCALE:\n if (this.enableZoom) {\n if (restart) {\n //switch to zoom operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(false)\n } else {\n //continue with zoom operation\n const screenNotches = 8 //how many wheel notches corresponds to a full screen pan\n this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y\n\n let size = 1\n\n if (movement < 0) {\n size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches)\n } else if (movement > 0) {\n size = Math.pow(this.scaleFactor, movement * screenNotches)\n }\n\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position))\n }\n }\n\n break\n\n case STATE.FOV:\n if (this.enableZoom && this.camera instanceof PerspectiveCamera) {\n if (restart) {\n //switch to fov operation\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(opState, true)\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(false)\n } else {\n //continue with fov operation\n const screenNotches = 8 //how many wheel notches corresponds to a full screen pan\n this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y\n\n let size = 1\n\n if (movement < 0) {\n size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches)\n } else if (movement > 0) {\n size = Math.pow(this.scaleFactor, movement * screenNotches)\n }\n\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n const x = this._v3_1.distanceTo(this._gizmos.position)\n let xNew = x / size //distance between camera and gizmos if scale(size, scalepoint) would be performed\n\n //check min and max distance\n xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance)\n\n const y = x * Math.tan(MathUtils.DEG2RAD * this._fovState * 0.5)\n\n //calculate new fov\n let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2)\n\n //check min and max fov\n newFov = MathUtils.clamp(newFov, this.minFov, this.maxFov)\n\n const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2))\n size = x / newDistance\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n\n this.setFov(newFov)\n this.applyTransformMatrix(this.applyScale(size, this._v3_2, false))\n\n //adjusting distance\n const direction = this._gizmos.position\n .clone()\n .sub(this.camera.position)\n .normalize()\n .multiplyScalar(newDistance / x)\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z)\n }\n }\n\n break\n }\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onSinglePanEnd = (): void => {\n if (this._state == STATE.ROTATE) {\n if (!this.enableRotate) {\n return\n }\n\n if (this.enableAnimations) {\n //perform rotation animation\n const deltaTime = performance.now() - this._timeCurrent\n if (deltaTime < 120) {\n const w = Math.abs((this._wPrev + this._wCurr) / 2)\n\n const self = this\n this._animationId = window.requestAnimationFrame(function (t) {\n self.updateTbState(STATE.ANIMATION_ROTATE, true)\n const rotationAxis = self.calculateRotationAxis(self._cursorPosPrev, self._cursorPosCurr)\n\n self.onRotationAnim(t, rotationAxis, Math.min(w, self.wMax))\n })\n } else {\n //cursor has been standing still for over 120 ms since last movement\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n } else {\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n } else if (this._state == STATE.PAN || this._state == STATE.IDLE) {\n this.updateTbState(STATE.IDLE, false)\n\n if (this.enableGrid) {\n this.disposeGrid()\n }\n\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onDoubleTap = (event: PointerEvent): void => {\n if (this.enabled && this.enablePan && this.scene && this.camera && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.setCenter(event.clientX, event.clientY)\n const hitP = this.unprojectOnObj(this.getCursorNDC(_center.x, _center.y, this.domElement), this.camera)\n\n if (hitP && this.enableAnimations) {\n const self = this\n if (this._animationId != -1) {\n window.cancelAnimationFrame(this._animationId)\n }\n\n this._timeStart = -1\n this._animationId = window.requestAnimationFrame(function (t) {\n self.updateTbState(STATE.ANIMATION_FOCUS, true)\n self.onFocusAnim(t, hitP, self._cameraMatrixState, self._gizmoMatrixState)\n })\n } else if (hitP && !this.enableAnimations) {\n this.updateTbState(STATE.FOCUS, true)\n this.focus(hitP, this.scaleFactor)\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onDoublePanStart = (): void => {\n if (this.enabled && this.enablePan && this.camera && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(STATE.PAN, true)\n\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true)\n if (rayDir !== undefined) {\n this._startCursorPosition.copy(rayDir)\n }\n this._currentCursorPosition.copy(this._startCursorPosition)\n\n this.activateGizmos(false)\n }\n }\n\n private onDoublePanMove = (): void => {\n if (this.enabled && this.enablePan && this.camera && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n\n if (this._state != STATE.PAN) {\n this.updateTbState(STATE.PAN, true)\n this._startCursorPosition.copy(this._currentCursorPosition)\n }\n\n const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true)\n if (rayDir !== undefined) this._currentCursorPosition.copy(rayDir)\n this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition, true))\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onDoublePanEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onRotateStart = (): void => {\n if (this.enabled && this.enableRotate) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(STATE.ZROTATE, true)\n\n //this._startFingerRotation = event.rotation;\n\n this._startFingerRotation =\n this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) +\n this.getAngle(this._touchStart[1], this._touchStart[0])\n this._currentFingerRotation = this._startFingerRotation\n\n this.camera?.getWorldDirection(this._rotationAxis) //rotation axis\n\n if (!this.enablePan && !this.enableZoom) {\n this.activateGizmos(true)\n }\n }\n }\n\n private onRotateMove = (): void => {\n if (this.enabled && this.enableRotate && this.camera && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n let rotationPoint\n\n if (this._state != STATE.ZROTATE) {\n this.updateTbState(STATE.ZROTATE, true)\n this._startFingerRotation = this._currentFingerRotation\n }\n\n //this._currentFingerRotation = event.rotation;\n this._currentFingerRotation =\n this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) +\n this.getAngle(this._touchStart[1], this._touchStart[0])\n\n if (!this.enablePan) {\n rotationPoint = new Vector3().setFromMatrixPosition(this._gizmoMatrixState)\n } else if (this.camera) {\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n rotationPoint = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .multiplyScalar(1 / this.camera.zoom)\n .add(this._v3_2)\n }\n\n const amount = MathUtils.DEG2RAD * (this._startFingerRotation - this._currentFingerRotation)\n\n if (rotationPoint !== undefined) {\n this.applyTransformMatrix(this.zRotate(rotationPoint, amount))\n }\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onRotateEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onPinchStart = (): void => {\n if (this.enabled && this.enableZoom) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n this.updateTbState(STATE.SCALE, true)\n\n this._startFingerDistance = this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1])\n this._currentFingerDistance = this._startFingerDistance\n\n this.activateGizmos(false)\n }\n }\n\n private onPinchMove = (): void => {\n if (this.enabled && this.enableZoom && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2,\n )\n const minDistance = 12 //minimum distance between fingers (in css pixels)\n\n if (this._state != STATE.SCALE) {\n this._startFingerDistance = this._currentFingerDistance\n this.updateTbState(STATE.SCALE, true)\n }\n\n this._currentFingerDistance = Math.max(\n this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]),\n minDistance * this._devPxRatio,\n )\n const amount = this._currentFingerDistance / this._startFingerDistance\n\n let scalePoint\n\n if (!this.enablePan) {\n scalePoint = this._gizmos.position\n } else {\n if (this.camera instanceof OrthographicCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .multiplyScalar(1 / this.camera.zoom)\n .add(this._gizmos.position)\n } else if (this.camera instanceof PerspectiveCamera) {\n scalePoint = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)\n ?.applyQuaternion(this.camera.quaternion)\n .add(this._gizmos.position)\n }\n }\n\n if (scalePoint !== undefined) {\n this.applyTransformMatrix(this.applyScale(amount, scalePoint))\n }\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onPinchEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n }\n\n private onTriplePanStart = (): void => {\n if (this.enabled && this.enableZoom && this.domElement) {\n // @ts-ignore\n this.dispatchEvent(_startEvent)\n\n this.updateTbState(STATE.SCALE, true)\n\n //const center = event.center;\n let clientX = 0\n let clientY = 0\n const nFingers = this._touchCurrent.length\n\n for (let i = 0; i < nFingers; i++) {\n clientX += this._touchCurrent[i].clientX\n clientY += this._touchCurrent[i].clientY\n }\n\n this.setCenter(clientX / nFingers, clientY / nFingers)\n\n this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n this._currentCursorPosition.copy(this._startCursorPosition)\n }\n }\n\n private onTriplePanMove = (): void => {\n if (this.enabled && this.enableZoom && this.camera && this.domElement) {\n //\t fov / 2\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\tx\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t\t| _ _ _\\\n //\t\t\ty\n\n //const center = event.center;\n let clientX = 0\n let clientY = 0\n const nFingers = this._touchCurrent.length\n\n for (let i = 0; i < nFingers; i++) {\n clientX += this._touchCurrent[i].clientX\n clientY += this._touchCurrent[i].clientY\n }\n\n this.setCenter(clientX / nFingers, clientY / nFingers)\n\n const screenNotches = 8 //how many wheel notches corresponds to a full screen pan\n this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5)\n\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y\n\n let size = 1\n\n if (movement < 0) {\n size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches)\n } else if (movement > 0) {\n size = Math.pow(this.scaleFactor, movement * screenNotches)\n }\n\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n const x = this._v3_1.distanceTo(this._gizmos.position)\n let xNew = x / size //distance between camera and gizmos if scale(size, scalepoint) would be performed\n\n //check min and max distance\n xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance)\n\n const y = x * Math.tan(MathUtils.DEG2RAD * this._fovState * 0.5)\n\n //calculate new fov\n let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2)\n\n //check min and max fov\n newFov = MathUtils.clamp(newFov, this.minFov, this.maxFov)\n\n const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2))\n size = x / newDistance\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n\n this.setFov(newFov)\n this.applyTransformMatrix(this.applyScale(size, this._v3_2, false))\n\n //adjusting distance\n const direction = this._gizmos.position\n .clone()\n .sub(this.camera.position)\n .normalize()\n .multiplyScalar(newDistance / x)\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n private onTriplePanEnd = (): void => {\n this.updateTbState(STATE.IDLE, false)\n // @ts-ignore\n this.dispatchEvent(_endEvent)\n //this.dispatchEvent( _changeEvent );\n }\n\n /**\n * Set _center's x/y coordinates\n * @param {Number} clientX\n * @param {Number} clientY\n */\n private setCenter = (clientX: number, clientY: number): void => {\n _center.x = clientX\n _center.y = clientY\n }\n\n /**\n * Set default mouse actions\n */\n private initializeMouseActions = (): void => {\n this.setMouseAction('PAN', 0, 'CTRL')\n this.setMouseAction('PAN', 2)\n\n this.setMouseAction('ROTATE', 0)\n\n this.setMouseAction('ZOOM', 'WHEEL')\n this.setMouseAction('ZOOM', 1)\n\n this.setMouseAction('FOV', 'WHEEL', 'SHIFT')\n this.setMouseAction('FOV', 1, 'SHIFT')\n }\n\n /**\n * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one\n * @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV)\n * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches\n * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed\n * @returns {Boolean} True if the mouse action has been successfully added, false otherwise\n */\n private setMouseAction = (operation: Operation, mouse: MouseButtonType, key: ModifierKey | null = null): boolean => {\n const operationInput = ['PAN', 'ROTATE', 'ZOOM', 'FOV']\n const mouseInput = [0, 1, 2, 'WHEEL']\n const keyInput = ['CTRL', 'SHIFT', null]\n let state\n\n if (!operationInput.includes(operation) || !mouseInput.includes(mouse) || !keyInput.includes(key)) {\n //invalid parameters\n return false\n }\n\n if (mouse == 'WHEEL') {\n if (operation != 'ZOOM' && operation != 'FOV') {\n //cannot associate 2D operation to 1D input\n return false\n }\n }\n\n switch (operation) {\n case 'PAN':\n state = STATE.PAN\n break\n\n case 'ROTATE':\n state = STATE.ROTATE\n break\n\n case 'ZOOM':\n state = STATE.SCALE\n break\n\n case 'FOV':\n state = STATE.FOV\n break\n }\n\n const action = {\n operation: operation,\n mouse: mouse,\n key: key,\n state: state,\n }\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n if (this.mouseActions[i].mouse == action.mouse && this.mouseActions[i].key == action.key) {\n this.mouseActions.splice(i, 1, action)\n return true\n }\n }\n\n this.mouseActions.push(action)\n return true\n }\n\n /**\n * Return the operation associated to a mouse/keyboard combination\n * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches\n * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed\n * @returns The operation if it has been found, null otherwise\n */\n private getOpFromAction = (mouse: MouseButtonType, key: ModifierKey | null): Operation | null => {\n let action\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == key) {\n return action.operation\n }\n }\n\n if (key) {\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == null) {\n return action.operation\n }\n }\n }\n\n return null\n }\n\n /**\n * Get the operation associated to mouse and key combination and returns the corresponding FSA state\n * @param {Number} mouse Mouse button\n * @param {String} key Keyboard modifier\n * @returns The FSA state obtained from the operation associated to mouse/keyboard combination\n */\n private getOpStateFromAction = (mouse: MouseButtonType, key: ModifierKey | null): Symbol | null => {\n let action\n\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == key) {\n return action.state\n }\n }\n\n if (key) {\n for (let i = 0; i < this.mouseActions.length; i++) {\n action = this.mouseActions[i]\n if (action.mouse == mouse && action.key == null) {\n return action.state\n }\n }\n }\n\n return null\n }\n\n /**\n * Calculate the angle between two pointers\n * @param {PointerEvent} p1\n * @param {PointerEvent} p2\n * @returns {Number} The angle between two pointers in degrees\n */\n private getAngle = (p1: PointerEvent, p2: PointerEvent): number => {\n return (Math.atan2(p2.clientY - p1.clientY, p2.clientX - p1.clientX) * 180) / Math.PI\n }\n\n /**\n * Update a PointerEvent inside current pointerevents array\n * @param {PointerEvent} event\n */\n private updateTouchEvent = (event: PointerEvent): void => {\n for (let i = 0; i < this._touchCurrent.length; i++) {\n if (this._touchCurrent[i].pointerId == event.pointerId) {\n this._touchCurrent.splice(i, 1, event)\n break\n }\n }\n }\n\n /**\n * Apply a transformation matrix, to the camera and gizmos\n * @param {Object} transformation Object containing matrices to apply to camera and gizmos\n */\n private applyTransformMatrix(transformation: Transformation | undefined): void {\n if (transformation?.camera && this.camera) {\n this._m4_1.copy(this._cameraMatrixState).premultiply(transformation.camera)\n this._m4_1.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n this.camera.updateMatrix()\n\n //update camera up vector\n if (this._state == STATE.ROTATE || this._state == STATE.ZROTATE || this._state == STATE.ANIMATION_ROTATE) {\n this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion)\n }\n }\n\n if (transformation?.gizmos) {\n this._m4_1.copy(this._gizmoMatrixState).premultiply(transformation.gizmos)\n this._m4_1.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n this._gizmos.updateMatrix()\n }\n\n if (\n (this._state == STATE.SCALE || this._state == STATE.FOCUS || this._state == STATE.ANIMATION_FOCUS) &&\n this.camera\n ) {\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n\n if (this.adjustNearFar) {\n const cameraDistance = this.camera.position.distanceTo(this._gizmos.position)\n\n const bb = new Box3()\n bb.setFromObject(this._gizmos)\n const sphere = new Sphere()\n bb.getBoundingSphere(sphere)\n\n const adjustedNearPosition = Math.max(this._nearPos0, sphere.radius + sphere.center.length())\n const regularNearPosition = cameraDistance - this._initialNear\n\n const minNearPos = Math.min(adjustedNearPosition, regularNearPosition)\n this.camera.near = cameraDistance - minNearPos\n\n const adjustedFarPosition = Math.min(this._farPos0, -sphere.radius + sphere.center.length())\n const regularFarPosition = cameraDistance - this._initialFar\n\n const minFarPos = Math.min(adjustedFarPosition, regularFarPosition)\n this.camera.far = cameraDistance - minFarPos\n\n this.camera.updateProjectionMatrix()\n } else {\n let update = false\n\n if (this.camera.near != this._initialNear) {\n this.camera.near = this._initialNear\n update = true\n }\n\n if (this.camera.far != this._initialFar) {\n this.camera.far = this._initialFar\n update = true\n }\n\n if (update) {\n this.camera.updateProjectionMatrix()\n }\n }\n }\n }\n\n /**\n * Calculate the angular speed\n * @param {Number} p0 Position at t0\n * @param {Number} p1 Position at t1\n * @param {Number} t0 Initial time in milliseconds\n * @param {Number} t1 Ending time in milliseconds\n */\n private calculateAngularSpeed = (p0: number, p1: number, t0: number, t1: number): number => {\n const s = p1 - p0\n const t = (t1 - t0) / 1000\n if (t == 0) {\n return 0\n }\n\n return s / t\n }\n\n /**\n * Calculate the distance between two pointers\n * @param {PointerEvent} p0 The first pointer\n * @param {PointerEvent} p1 The second pointer\n * @returns {number} The distance between the two pointers\n */\n private calculatePointersDistance = (p0: PointerEvent, p1: PointerEvent): number => {\n return Math.sqrt(Math.pow(p1.clientX - p0.clientX, 2) + Math.pow(p1.clientY - p0.clientY, 2))\n }\n\n /**\n * Calculate the rotation axis as the vector perpendicular between two vectors\n * @param {Vector3} vec1 The first vector\n * @param {Vector3} vec2 The second vector\n * @returns {Vector3} The normalized rotation axis\n */\n private calculateRotationAxis = (vec1: Vector3, vec2: Vector3): Vector3 => {\n this._rotationMatrix.extractRotation(this._cameraMatrixState)\n this._quat.setFromRotationMatrix(this._rotationMatrix)\n\n this._rotationAxis.crossVectors(vec1, vec2).applyQuaternion(this._quat)\n return this._rotationAxis.normalize().clone()\n }\n\n /**\n * Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum\n * @param {Camera} camera\n * @returns {Number} The trackball radius\n */\n private calculateTbRadius = (camera: Camera): number | undefined => {\n const factor = 0.67\n const distance = camera.position.distanceTo(this._gizmos.position)\n\n if (camera instanceof PerspectiveCamera) {\n const halfFovV = MathUtils.DEG2RAD * camera.fov * 0.5 //vertical fov/2 in radians\n const halfFovH = Math.atan(camera.aspect * Math.tan(halfFovV)) //horizontal fov/2 in radians\n return Math.tan(Math.min(halfFovV, halfFovH)) * distance * factor\n } else if (camera instanceof OrthographicCamera) {\n return Math.min(camera.top, camera.right) * factor\n }\n }\n\n /**\n * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in\n * @param {Vector3} point The point of interest\n * @param {Number} size Scale factor\n * @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)\n */\n private focus = (point: Vector3, size: number, amount = 1): void => {\n if (this.camera) {\n const focusPoint = point.clone()\n\n //move center of camera (along with gizmos) towards point of interest\n focusPoint.sub(this._gizmos.position).multiplyScalar(amount)\n this._translationMatrix.makeTranslation(focusPoint.x, focusPoint.y, focusPoint.z)\n\n const gizmoStateTemp = this._gizmoMatrixState.clone()\n this._gizmoMatrixState.premultiply(this._translationMatrix)\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n const cameraStateTemp = this._cameraMatrixState.clone()\n this._cameraMatrixState.premultiply(this._translationMatrix)\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n\n //apply zoom\n if (this.enableZoom) {\n this.applyTransformMatrix(this.applyScale(size, this._gizmos.position))\n }\n\n this._gizmoMatrixState.copy(gizmoStateTemp)\n this._cameraMatrixState.copy(cameraStateTemp)\n }\n }\n\n /**\n * Draw a grid and add it to the scene\n */\n private drawGrid = (): void => {\n if (this.scene) {\n const color = 0x888888\n const multiplier = 3\n let size, divisions, maxLength, tick\n\n if (this.camera instanceof OrthographicCamera) {\n const width = this.camera.right - this.camera.left\n const height = this.camera.bottom - this.camera.top\n\n maxLength = Math.max(width, height)\n tick = maxLength / 20\n\n size = (maxLength / this.camera.zoom) * multiplier\n divisions = (size / tick) * this.camera.zoom\n } else if (this.camera instanceof PerspectiveCamera) {\n const distance = this.camera.position.distanceTo(this._gizmos.position)\n const halfFovV = MathUtils.DEG2RAD * this.camera.fov * 0.5\n const halfFovH = Math.atan(this.camera.aspect * Math.tan(halfFovV))\n\n maxLength = Math.tan(Math.max(halfFovV, halfFovH)) * distance * 2\n tick = maxLength / 20\n\n size = maxLength * multiplier\n divisions = size / tick\n }\n\n if (this._grid == null && this.camera) {\n this._grid = new GridHelper(size, divisions, color, color)\n this._grid.position.copy(this._gizmos.position)\n this._gridPosition.copy(this._grid.position)\n this._grid.quaternion.copy(this.camera.quaternion)\n this._grid.rotateX(Math.PI * 0.5)\n\n this.scene.add(this._grid)\n }\n }\n }\n\n public connect = (domElement: HTMLElement): void => {\n // https://github.com/mrdoob/three.js/issues/20575\n\n if ((domElement as any) === document) {\n console.error(\n 'THREE.ArcballControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.',\n )\n }\n this.domElement = domElement\n // disables touch scroll\n // touch-action needs to be defined for pointer events to work on mobile\n // https://stackoverflow.com/a/48254578\n this.domElement.style.touchAction = 'none'\n this.domElement.addEventListener('contextmenu', this.onContextMenu)\n this.domElement.addEventListener('pointerdown', this.onPointerDown)\n this.domElement.addEventListener('pointercancel', this.onPointerCancel)\n this.domElement.addEventListener('wheel', this.onWheel)\n }\n\n /**\n * Remove all listeners, stop animations and clean scene\n */\n public dispose = (): void => {\n if (this._animationId != -1) {\n window.cancelAnimationFrame(this._animationId)\n }\n\n this.domElement?.removeEventListener('pointerdown', this.onPointerDown)\n this.domElement?.removeEventListener('pointercancel', this.onPointerCancel)\n this.domElement?.removeEventListener('wheel', this.onWheel)\n this.domElement?.removeEventListener('contextmenu', this.onContextMenu)\n\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n\n window.removeEventListener('resize', this.onWindowResize)\n\n this.scene?.remove(this._gizmos)\n this.disposeGrid()\n }\n\n /**\n * remove the grid from the scene\n */\n private disposeGrid = (): void => {\n if (this._grid && this.scene) {\n this.scene.remove(this._grid)\n this._grid = null\n }\n }\n\n /**\n * Compute the easing out cubic function for ease out effect in animation\n * @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation)\n * @returns {Number} Result of easing out cubic at time t\n */\n private easeOutCubic = (t: number): number => {\n return 1 - Math.pow(1 - t, 3)\n }\n\n /**\n * Make rotation gizmos more or less visible\n * @param {Boolean} isActive If true, make gizmos more visible\n */\n private activateGizmos = (isActive: boolean): void => {\n for (const gizmo of this._gizmos.children) {\n ;(gizmo as Mesh).material.setValues({ opacity: isActive ? 1 : 0.6 })\n }\n }\n\n /**\n * Calculate the cursor position in NDC\n * @param {number} x Cursor horizontal coordinate within the canvas\n * @param {number} y Cursor vertical coordinate within the canvas\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @returns {Vector2} Cursor normalized position inside the canvas\n */\n private getCursorNDC = (cursorX: number, cursorY: number, canvas: HTMLElement): Vector2 => {\n const canvasRect = canvas.getBoundingClientRect()\n this._v2_1.setX(((cursorX - canvasRect.left) / canvasRect.width) * 2 - 1)\n this._v2_1.setY(((canvasRect.bottom - cursorY) / canvasRect.height) * 2 - 1)\n return this._v2_1.clone()\n }\n\n /**\n * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas\n * @param {Number} x Cursor horizontal coordinate within the canvas\n * @param {Number} y Cursor vertical coordinate within the canvas\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @returns {Vector2} Cursor position inside the canvas\n */\n private getCursorPosition = (cursorX: number, cursorY: number, canvas: HTMLElement): Vector2 => {\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas))\n if (this.camera instanceof OrthographicCamera) {\n this._v2_1.x *= (this.camera.right - this.camera.left) * 0.5\n this._v2_1.y *= (this.camera.top - this.camera.bottom) * 0.5\n }\n return this._v2_1.clone()\n }\n\n /**\n * Set the camera to be controlled\n * @param {Camera} camera The virtual camera to be controlled\n */\n private setCamera = (camera: Camera | null): void => {\n if (camera) {\n camera.lookAt(this.target)\n camera.updateMatrix()\n\n //setting state\n if (camera instanceof PerspectiveCamera) {\n this._fov0 = camera.fov\n this._fovState = camera.fov\n }\n\n this._cameraMatrixState0.copy(camera.matrix)\n this._cameraMatrixState.copy(this._cameraMatrixState0)\n this._cameraProjectionState.copy(camera.projectionMatrix)\n this._zoom0 = camera.zoom\n this._zoomState = this._zoom0\n\n this._initialNear = camera.near\n this._nearPos0 = camera.position.distanceTo(this.target) - camera.near\n this._nearPos = this._initialNear\n\n this._initialFar = camera.far\n this._farPos0 = camera.position.distanceTo(this.target) - camera.far\n this._farPos = this._initialFar\n\n this._up0.copy(camera.up)\n this._upState.copy(camera.up)\n\n this.camera = camera\n\n this.camera.updateProjectionMatrix()\n\n //making gizmos\n const tbRadius = this.calculateTbRadius(camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this.target, this._tbRadius)\n }\n }\n\n /**\n * Set gizmos visibility\n * @param {Boolean} value Value of gizmos visibility\n */\n public setGizmosVisible(value: boolean): void {\n this._gizmos.visible = value\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n\n /**\n * Creates the rotation gizmos matching trackball center and radius\n * @param {Vector3} tbCenter The trackball center\n * @param {number} tbRadius The trackball radius\n */\n private makeGizmos = (tbCenter: Vector3, tbRadius: number): void => {\n // @ts-ignore\n const curve = new EllipseCurve(0, 0, tbRadius, tbRadius)\n const points = curve.getPoints(this._curvePts)\n\n //geometry\n const curveGeometry = new BufferGeometry().setFromPoints(points)\n\n //material\n const curveMaterialX = new LineBasicMaterial({ color: 0xff8080, fog: false, transparent: true, opacity: 0.6 })\n const curveMaterialY = new LineBasicMaterial({ color: 0x80ff80, fog: false, transparent: true, opacity: 0.6 })\n const curveMaterialZ = new LineBasicMaterial({ color: 0x8080ff, fog: false, transparent: true, opacity: 0.6 })\n\n //line\n const gizmoX = new Line(curveGeometry, curveMaterialX)\n const gizmoY = new Line(curveGeometry, curveMaterialY)\n const gizmoZ = new Line(curveGeometry, curveMaterialZ)\n\n const rotation = Math.PI * 0.5\n gizmoX.rotation.x = rotation\n gizmoY.rotation.y = rotation\n\n //setting state\n this._gizmoMatrixState0.identity().setPosition(tbCenter)\n this._gizmoMatrixState.copy(this._gizmoMatrixState0)\n\n if (this.camera && this.camera.zoom != 1) {\n //adapt gizmos size to camera zoom\n const size = 1 / this.camera.zoom\n this._scaleMatrix.makeScale(size, size, size)\n this._translationMatrix.makeTranslation(-tbCenter.x, -tbCenter.y, -tbCenter.z)\n\n this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix)\n this._translationMatrix.makeTranslation(tbCenter.x, tbCenter.y, tbCenter.z)\n this._gizmoMatrixState.premultiply(this._translationMatrix)\n }\n\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n this._gizmos.clear()\n\n this._gizmos.add(gizmoX)\n this._gizmos.add(gizmoY)\n this._gizmos.add(gizmoZ)\n }\n\n /**\n * Perform animation for focus operation\n * @param {Number} time Instant in which this function is called as performance.now()\n * @param {Vector3} point Point of interest for focus operation\n * @param {Matrix4} cameraMatrix Camera matrix\n * @param {Matrix4} gizmoMatrix Gizmos matrix\n */\n private onFocusAnim = (time: number, point: Vector3, cameraMatrix: Matrix4, gizmoMatrix: Matrix4): void => {\n if (this._timeStart == -1) {\n //animation start\n this._timeStart = time\n }\n\n if (this._state == STATE.ANIMATION_FOCUS) {\n const deltaTime = time - this._timeStart\n const animTime = deltaTime / this.focusAnimationTime\n\n this._gizmoMatrixState.copy(gizmoMatrix)\n\n if (animTime >= 1) {\n //animation end\n\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n this.focus(point, this.scaleFactor)\n\n this._timeStart = -1\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n } else {\n const amount = this.easeOutCubic(animTime)\n const size = 1 - amount + this.scaleFactor * amount\n\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n this.focus(point, size, amount)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n const self = this\n this._animationId = window.requestAnimationFrame(function (t) {\n self.onFocusAnim(t, point, cameraMatrix, gizmoMatrix.clone())\n })\n }\n } else {\n //interrupt animation\n\n this._animationId = -1\n this._timeStart = -1\n }\n }\n\n /**\n * Perform animation for rotation operation\n * @param {Number} time Instant in which this function is called as performance.now()\n * @param {Vector3} rotationAxis Rotation axis\n * @param {number} w0 Initial angular velocity\n */\n private onRotationAnim = (time: number, rotationAxis: Vector3, w0: number): void => {\n if (this._timeStart == -1) {\n //animation start\n this._anglePrev = 0\n this._angleCurrent = 0\n this._timeStart = time\n }\n\n if (this._state == STATE.ANIMATION_ROTATE) {\n //w = w0 + alpha * t\n const deltaTime = (time - this._timeStart) / 1000\n const w = w0 + -this.dampingFactor * deltaTime\n\n if (w > 0) {\n //tetha = 0.5 * alpha * t^2 + w0 * t + tetha0\n this._angleCurrent = 0.5 * -this.dampingFactor * Math.pow(deltaTime, 2) + w0 * deltaTime + 0\n this.applyTransformMatrix(this.rotate(rotationAxis, this._angleCurrent))\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n const self = this\n this._animationId = window.requestAnimationFrame(function (t) {\n self.onRotationAnim(t, rotationAxis, w0)\n })\n } else {\n this._animationId = -1\n this._timeStart = -1\n\n this.updateTbState(STATE.IDLE, false)\n this.activateGizmos(false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n } else {\n //interrupt animation\n\n this._animationId = -1\n this._timeStart = -1\n\n if (this._state != STATE.ROTATE) {\n this.activateGizmos(false)\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n }\n\n /**\n * Perform pan operation moving camera between two points\n * @param {Vector3} p0 Initial point\n * @param {Vector3} p1 Ending point\n * @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)\n */\n private pan = (p0: Vector3, p1: Vector3, adjust = false): Transformation => {\n if (this.camera) {\n const movement = p0.clone().sub(p1)\n\n if (this.camera instanceof OrthographicCamera) {\n //adjust movement amount\n movement.multiplyScalar(1 / this.camera.zoom)\n }\n\n if (this.camera instanceof PerspectiveCamera && adjust) {\n //adjust movement amount\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState0) //camera's initial position\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0) //gizmo's initial position\n const distanceFactor =\n this._v3_1.distanceTo(this._v3_2) / this.camera.position.distanceTo(this._gizmos.position)\n movement.multiplyScalar(1 / distanceFactor)\n }\n\n this._v3_1.set(movement.x, movement.y, 0).applyQuaternion(this.camera.quaternion)\n\n this._m4_1.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z)\n\n this.setTransformationMatrices(this._m4_1, this._m4_1)\n }\n return _transformation\n }\n\n /**\n * Reset trackball\n */\n public reset = (): void => {\n if (this.camera) {\n this.camera.zoom = this._zoom0\n\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.fov = this._fov0\n }\n\n this.camera.near = this._nearPos\n this.camera.far = this._farPos\n this._cameraMatrixState.copy(this._cameraMatrixState0)\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n this.camera.up.copy(this._up0)\n\n this.camera.updateMatrix()\n this.camera.updateProjectionMatrix()\n\n this._gizmoMatrixState.copy(this._gizmoMatrixState0)\n this._gizmoMatrixState0.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n this._gizmos.updateMatrix()\n\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this._gizmos.position, this._tbRadius)\n\n this.camera.lookAt(this._gizmos.position)\n\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n\n /**\n * Rotate the camera around an axis passing by trackball's center\n * @param {Vector3} axis Rotation axis\n * @param {number} angle Angle in radians\n * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera\n */\n private rotate = (axis: Vector3, angle: number): Transformation => {\n const point = this._gizmos.position //rotation center\n this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z)\n this._rotationMatrix.makeRotationAxis(axis, -angle)\n\n //rotate camera\n this._m4_1.makeTranslation(point.x, point.y, point.z)\n this._m4_1.multiply(this._rotationMatrix)\n this._m4_1.multiply(this._translationMatrix)\n\n this.setTransformationMatrices(this._m4_1)\n\n return _transformation\n }\n\n public copyState = (): void => {\n if (this.camera) {\n const state = JSON.stringify(\n this.camera instanceof OrthographicCamera\n ? {\n arcballState: {\n cameraFar: this.camera.far,\n cameraMatrix: this.camera.matrix,\n cameraNear: this.camera.near,\n cameraUp: this.camera.up,\n cameraZoom: this.camera.zoom,\n gizmoMatrix: this._gizmos.matrix,\n },\n }\n : {\n arcballState: {\n cameraFar: this.camera.far,\n cameraFov: this.camera.fov,\n cameraMatrix: this.camera.matrix,\n cameraNear: this.camera.near,\n cameraUp: this.camera.up,\n cameraZoom: this.camera.zoom,\n gizmoMatrix: this._gizmos.matrix,\n },\n },\n )\n\n navigator.clipboard.writeText(state)\n }\n }\n\n public pasteState = (): void => {\n const self = this\n navigator.clipboard.readText().then(function resolved(value) {\n self.setStateFromJSON(value)\n })\n }\n\n /**\n * Save the current state of the control. This can later be recovered with .reset\n */\n public saveState = (): void => {\n if (!this.camera) return\n\n this._cameraMatrixState0.copy(this.camera.matrix)\n this._gizmoMatrixState0.copy(this._gizmos.matrix)\n this._nearPos = this.camera.near\n this._farPos = this.camera.far\n this._zoom0 = this.camera.zoom\n this._up0.copy(this.camera.up)\n\n if (this.camera instanceof PerspectiveCamera) {\n this._fov0 = this.camera.fov\n }\n }\n\n /**\n * Perform uniform scale operation around a given point\n * @param {Number} size Scale factor\n * @param {Vector3} point Point around which scale\n * @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only)\n * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos\n */\n private applyScale = (size: number, point: Vector3, scaleGizmos = true): Transformation | undefined => {\n if (!this.camera) return\n\n const scalePoint = point.clone()\n let sizeInverse = 1 / size\n\n if (this.camera instanceof OrthographicCamera) {\n //camera zoom\n this.camera.zoom = this._zoomState\n this.camera.zoom *= size\n\n //check min and max zoom\n if (this.camera.zoom > this.maxZoom) {\n this.camera.zoom = this.maxZoom\n sizeInverse = this._zoomState / this.maxZoom\n } else if (this.camera.zoom < this.minZoom) {\n this.camera.zoom = this.minZoom\n sizeInverse = this._zoomState / this.minZoom\n }\n\n this.camera.updateProjectionMatrix()\n\n this._v3_1.setFromMatrixPosition(this._gizmoMatrixState) //gizmos position\n\n //scale gizmos so they appear in the same spot having the same dimension\n this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse)\n this._translationMatrix.makeTranslation(-this._v3_1.x, -this._v3_1.y, -this._v3_1.z)\n\n this._m4_2.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z).multiply(this._scaleMatrix)\n this._m4_2.multiply(this._translationMatrix)\n\n //move camera and gizmos to obtain pinch effect\n scalePoint.sub(this._v3_1)\n\n const amount = scalePoint.clone().multiplyScalar(sizeInverse)\n scalePoint.sub(amount)\n\n this._m4_1.makeTranslation(scalePoint.x, scalePoint.y, scalePoint.z)\n this._m4_2.premultiply(this._m4_1)\n\n this.setTransformationMatrices(this._m4_1, this._m4_2)\n return _transformation\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState)\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState)\n\n //move camera\n let distance = this._v3_1.distanceTo(scalePoint)\n let amount = distance - distance * sizeInverse\n\n //check min and max distance\n const newDistance = distance - amount\n if (newDistance < this.minDistance) {\n sizeInverse = this.minDistance / distance\n amount = distance - distance * sizeInverse\n } else if (newDistance > this.maxDistance) {\n sizeInverse = this.maxDistance / distance\n amount = distance - distance * sizeInverse\n }\n\n let direction = scalePoint.clone().sub(this._v3_1).normalize().multiplyScalar(amount)\n\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z)\n\n if (scaleGizmos) {\n //scale gizmos so they appear in the same spot having the same dimension\n const pos = this._v3_2\n\n distance = pos.distanceTo(scalePoint)\n amount = distance - distance * sizeInverse\n direction = scalePoint.clone().sub(this._v3_2).normalize().multiplyScalar(amount)\n\n this._translationMatrix.makeTranslation(pos.x, pos.y, pos.z)\n this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse)\n\n this._m4_2.makeTranslation(direction.x, direction.y, direction.z).multiply(this._translationMatrix)\n this._m4_2.multiply(this._scaleMatrix)\n\n this._translationMatrix.makeTranslation(-pos.x, -pos.y, -pos.z)\n\n this._m4_2.multiply(this._translationMatrix)\n this.setTransformationMatrices(this._m4_1, this._m4_2)\n } else {\n this.setTransformationMatrices(this._m4_1)\n }\n\n return _transformation\n }\n }\n\n /**\n * Set camera fov\n * @param {Number} value fov to be setted\n */\n private setFov = (value: number): void => {\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.fov = MathUtils.clamp(value, this.minFov, this.maxFov)\n this.camera.updateProjectionMatrix()\n }\n }\n\n /**\n * Set the trackball's center point\n * @param {Number} x X coordinate\n * @param {Number} y Y coordinate\n * @param {Number} z Z coordinate\n */\n public setTarget = (x: number, y: number, z: number): void => {\n if (this.camera) {\n this.target.set(x, y, z)\n this._gizmos.position.set(x, y, z) //for correct radius calculation\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this.target, this._tbRadius)\n this.camera.lookAt(this.target)\n }\n }\n\n /**\n * Set values in transformation object\n * @param {Matrix4} camera Transformation to be applied to the camera\n * @param {Matrix4} gizmos Transformation to be applied to gizmos\n */\n private setTransformationMatrices(camera: Matrix4 | null = null, gizmos: Matrix4 | null = null): void {\n if (camera) {\n if (_transformation.camera) {\n _transformation.camera.copy(camera)\n } else {\n _transformation.camera = camera.clone()\n }\n } else {\n _transformation.camera = null\n }\n\n if (gizmos) {\n if (_transformation.gizmos) {\n _transformation.gizmos.copy(gizmos)\n } else {\n _transformation.gizmos = gizmos.clone()\n }\n } else {\n _transformation.gizmos = null\n }\n }\n\n /**\n * Rotate camera around its direction axis passing by a given point by a given angle\n * @param {Vector3} point The point where the rotation axis is passing trough\n * @param {Number} angle Angle in radians\n * @returns The computed transormation matix\n */\n private zRotate = (point: Vector3, angle: number): Transformation => {\n this._rotationMatrix.makeRotationAxis(this._rotationAxis, angle)\n this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z)\n\n this._m4_1.makeTranslation(point.x, point.y, point.z)\n this._m4_1.multiply(this._rotationMatrix)\n this._m4_1.multiply(this._translationMatrix)\n\n this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(point) //vector from rotation center to gizmos position\n this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis, angle) //apply rotation\n this._v3_2.sub(this._v3_1)\n\n this._m4_2.makeTranslation(this._v3_2.x, this._v3_2.y, this._v3_2.z)\n\n this.setTransformationMatrices(this._m4_1, this._m4_2)\n return _transformation\n }\n\n /**\n * Unproject the cursor on the 3D object surface\n * @param {Vector2} cursor Cursor coordinates in NDC\n * @param {Camera} camera Virtual camera\n * @returns {Vector3} The point of intersection with the model, if exist, null otherwise\n */\n private unprojectOnObj = (cursor: Vector2, camera: Camera): Vector3 | null => {\n if (!this.scene) return null\n\n const raycaster = new Raycaster()\n raycaster.near = camera.near\n raycaster.far = camera.far\n raycaster.setFromCamera(cursor, camera)\n\n const intersect = raycaster.intersectObjects(this.scene.children, true)\n for (let i = 0; i < intersect.length; i++) {\n if (intersect[i].object.uuid != this._gizmos.uuid && intersect[i].face) {\n return intersect[i].point.clone()\n }\n }\n\n return null\n }\n\n /**\n * Unproject the cursor on the trackball surface\n * @param {Camera} camera The virtual camera\n * @param {Number} cursorX Cursor horizontal coordinate on screen\n * @param {Number} cursorY Cursor vertical coordinate on screen\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @param {number} tbRadius The trackball radius\n * @returns {Vector3} The unprojected point on the trackball surface\n */\n private unprojectOnTbSurface = (\n camera: Camera,\n cursorX: number,\n cursorY: number,\n canvas: HTMLElement,\n tbRadius: number,\n ): Vector3 | undefined => {\n if (camera instanceof OrthographicCamera) {\n this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas))\n this._v3_1.set(this._v2_1.x, this._v2_1.y, 0)\n\n const x2 = Math.pow(this._v2_1.x, 2)\n const y2 = Math.pow(this._v2_1.y, 2)\n const r2 = Math.pow(this._tbRadius, 2)\n\n if (x2 + y2 <= r2 * 0.5) {\n //intersection with sphere\n this._v3_1.setZ(Math.sqrt(r2 - (x2 + y2)))\n } else {\n //intersection with hyperboloid\n this._v3_1.setZ((r2 * 0.5) / Math.sqrt(x2 + y2))\n }\n\n return this._v3_1\n }\n\n if (camera instanceof PerspectiveCamera) {\n //unproject cursor on the near plane\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas))\n\n this._v3_1.set(this._v2_1.x, this._v2_1.y, -1)\n this._v3_1.applyMatrix4(camera.projectionMatrixInverse)\n\n const rayDir = this._v3_1.clone().normalize() //unprojected ray direction\n const cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position)\n const radius2 = Math.pow(tbRadius, 2)\n\n //\t camera\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\th\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t_ _ | _ _ _\\ _ _ near plane\n //\t\t\tl\n\n const h = this._v3_1.z\n const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2))\n\n if (l == 0) {\n //ray aligned with camera\n rayDir.set(this._v3_1.x, this._v3_1.y, tbRadius)\n return rayDir\n }\n\n const m = h / l\n const q = cameraGizmoDistance\n\n /*\n * calculate intersection point between unprojected ray and trackball surface\n *|y = m * x + q\n *|x^2 + y^2 = r^2\n *\n * (m^2 + 1) * x^2 + (2 * m * q) * x + q^2 - r^2 = 0\n */\n let a = Math.pow(m, 2) + 1\n let b = 2 * m * q\n let c = Math.pow(q, 2) - radius2\n let delta = Math.pow(b, 2) - 4 * a * c\n\n if (delta >= 0) {\n //intersection with sphere\n this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a))\n this._v2_1.setY(m * this._v2_1.x + q)\n\n const angle = MathUtils.RAD2DEG * this._v2_1.angle()\n\n if (angle >= 45) {\n //if angle between intersection point and X' axis is >= 45°, return that point\n //otherwise, calculate intersection point with hyperboloid\n\n const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2))\n rayDir.multiplyScalar(rayLength)\n rayDir.z += cameraGizmoDistance\n return rayDir\n }\n }\n\n //intersection with hyperboloid\n /*\n *|y = m * x + q\n *|y = (1 / x) * (r^2 / 2)\n *\n * m * x^2 + q * x - r^2 / 2 = 0\n */\n\n a = m\n b = q\n c = -radius2 * 0.5\n delta = Math.pow(b, 2) - 4 * a * c\n this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a))\n this._v2_1.setY(m * this._v2_1.x + q)\n\n const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2))\n\n rayDir.multiplyScalar(rayLength)\n rayDir.z += cameraGizmoDistance\n return rayDir\n }\n }\n\n /**\n * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera\n * @param {Camera} camera The virtual camera\n * @param {Number} cursorX Cursor horizontal coordinate on screen\n * @param {Number} cursorY Cursor vertical coordinate on screen\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only)\n * @returns {Vector3} The unprojected point on the trackball plane\n */\n private unprojectOnTbPlane = (\n camera: Camera,\n cursorX: number,\n cursorY: number,\n canvas: HTMLElement,\n initialDistance = false,\n ): Vector3 | undefined => {\n if (camera instanceof OrthographicCamera) {\n this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas))\n this._v3_1.set(this._v2_1.x, this._v2_1.y, 0)\n\n return this._v3_1.clone()\n }\n\n if (camera instanceof PerspectiveCamera) {\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas))\n\n //unproject cursor on the near plane\n this._v3_1.set(this._v2_1.x, this._v2_1.y, -1)\n this._v3_1.applyMatrix4(camera.projectionMatrixInverse)\n\n const rayDir = this._v3_1.clone().normalize() //unprojected ray direction\n\n //\t camera\n //\t\t|\\\n //\t\t| \\\n //\t\t| \\\n //\th\t|\t\\\n //\t\t| \t \\\n //\t\t| \t \\\n //\t_ _ | _ _ _\\ _ _ near plane\n //\t\t\tl\n\n const h = this._v3_1.z\n const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2))\n let cameraGizmoDistance\n\n if (initialDistance) {\n cameraGizmoDistance = this._v3_1\n .setFromMatrixPosition(this._cameraMatrixState0)\n .distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0))\n } else {\n cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position)\n }\n\n /*\n * calculate intersection point between unprojected ray and the plane\n *|y = mx + q\n *|y = 0\n *\n * x = -q/m\n */\n if (l == 0) {\n //ray aligned with camera\n rayDir.set(0, 0, 0)\n return rayDir\n }\n\n const m = h / l\n const q = cameraGizmoDistance\n const x = -q / m\n\n const rayLength = Math.sqrt(Math.pow(q, 2) + Math.pow(x, 2))\n rayDir.multiplyScalar(rayLength)\n rayDir.z = 0\n return rayDir\n }\n }\n\n /**\n * Update camera and gizmos state\n */\n private updateMatrixState = (): void => {\n if (!this.camera) return\n\n //update camera and gizmos state\n this._cameraMatrixState.copy(this.camera.matrix)\n this._gizmoMatrixState.copy(this._gizmos.matrix)\n\n if (this.camera instanceof OrthographicCamera) {\n this._cameraProjectionState.copy(this.camera.projectionMatrix)\n this.camera.updateProjectionMatrix()\n this._zoomState = this.camera.zoom\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n this._fovState = this.camera.fov\n }\n }\n\n /**\n * Update the trackball FSA\n * @param {STATE} newState New state of the FSA\n * @param {Boolean} updateMatrices If matriices state should be updated\n */\n private updateTbState = (newState: Symbol, updateMatrices: boolean): void => {\n this._state = newState\n if (updateMatrices) {\n this.updateMatrixState()\n }\n }\n\n public update = (): void => {\n const EPS = 0.000001\n\n // Update target and gizmos state\n if (!this.target.equals(this._currentTarget) && this.camera) {\n this._gizmos.position.set(this.target.x, this.target.y, this.target.z) //for correct radius calculation\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n this.makeGizmos(this.target, this._tbRadius)\n this._currentTarget.copy(this.target)\n }\n\n if (!this.camera) return\n\n //check min/max parameters\n if (this.camera instanceof OrthographicCamera) {\n //check zoom\n if (this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom) {\n const newZoom = MathUtils.clamp(this.camera.zoom, this.minZoom, this.maxZoom)\n this.applyTransformMatrix(this.applyScale(newZoom / this.camera.zoom, this._gizmos.position, true))\n }\n }\n\n if (this.camera instanceof PerspectiveCamera) {\n //check distance\n const distance = this.camera.position.distanceTo(this._gizmos.position)\n\n if (distance > this.maxDistance + EPS || distance < this.minDistance - EPS) {\n const newDistance = MathUtils.clamp(distance, this.minDistance, this.maxDistance)\n this.applyTransformMatrix(this.applyScale(newDistance / distance, this._gizmos.position))\n this.updateMatrixState()\n }\n\n //check fov\n if (this.camera.fov < this.minFov || this.camera.fov > this.maxFov) {\n this.camera.fov = MathUtils.clamp(this.camera.fov, this.minFov, this.maxFov)\n this.camera.updateProjectionMatrix()\n }\n\n const oldRadius = this._tbRadius\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n\n if (oldRadius < this._tbRadius - EPS || oldRadius > this._tbRadius + EPS) {\n const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3\n const newRadius = this._tbRadius / scale\n // @ts-ignore\n const curve = new EllipseCurve(0, 0, newRadius, newRadius)\n const points = curve.getPoints(this._curvePts)\n const curveGeometry = new BufferGeometry().setFromPoints(points)\n\n for (const gizmo in this._gizmos.children) {\n const child = this._gizmos.children[gizmo] as Mesh\n child.geometry = curveGeometry\n }\n }\n }\n\n this.camera.lookAt(this._gizmos.position)\n }\n\n private setStateFromJSON = (json: string): void => {\n const state = JSON.parse(json)\n\n if (state.arcballState && this.camera) {\n this._cameraMatrixState.fromArray(state.arcballState.cameraMatrix.elements)\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale)\n\n this.camera.up.copy(state.arcballState.cameraUp)\n this.camera.near = state.arcballState.cameraNear\n this.camera.far = state.arcballState.cameraFar\n\n this.camera.zoom = state.arcballState.cameraZoom\n\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.fov = state.arcballState.cameraFov\n }\n\n this._gizmoMatrixState.fromArray(state.arcballState.gizmoMatrix.elements)\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)\n\n this.camera.updateMatrix()\n this.camera.updateProjectionMatrix()\n\n this._gizmos.updateMatrix()\n\n const tbRadius = this.calculateTbRadius(this.camera)\n if (tbRadius !== undefined) {\n this._tbRadius = tbRadius\n }\n const gizmoTmp = new Matrix4().copy(this._gizmoMatrixState0)\n this.makeGizmos(this._gizmos.position, this._tbRadius)\n this._gizmoMatrixState0.copy(gizmoTmp)\n\n this.camera.lookAt(this._gizmos.position)\n this.updateTbState(STATE.IDLE, false)\n\n // @ts-ignore\n this.dispatchEvent(_changeEvent)\n }\n }\n}\n\nexport { ArcballControls }\n", "import { OrthographicCamera, PlaneGeometry, Mesh, Material, Renderer, WebGLRenderer, WebGLRenderTarget } from 'three'\n\nclass Pass {\n // if set to true, the pass is processed by the composer\n public enabled = true\n\n // if set to true, the pass indicates to swap read and write buffer after rendering\n public needsSwap = true\n\n // if set to true, the pass clears its buffer before rendering\n public clear = false\n\n // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.\n public renderToScreen = false\n\n public setSize(width: number, height: number): void {}\n\n public render(\n renderer: WebGLRenderer,\n writeBuffer: WebGLRenderTarget,\n readBuffer: WebGLRenderTarget,\n deltaTime: number,\n maskActive?: unknown,\n ): void {\n console.error('THREE.Pass: .render() must be implemented in derived pass.')\n }\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\nclass FullScreenQuad {\n public camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1)\n public geometry = new PlaneGeometry(2, 2)\n private mesh: Mesh\n\n constructor(material: TMaterial) {\n this.mesh = new Mesh(this.geometry, material)\n }\n\n public get material(): TMaterial {\n return this.mesh.material\n }\n\n public set material(value: TMaterial) {\n this.mesh.material = value\n }\n\n public dispose(): void {\n this.mesh.geometry.dispose()\n }\n\n public render(renderer: Renderer): void {\n renderer.render(this.mesh, this.camera)\n }\n}\n\nexport { Pass, FullScreenQuad }\n", "export const DigitalGlitch = {\n uniforms: {\n tDiffuse: { value: null }, //diffuse texture\n tDisp: { value: null }, //displacement texture for digital glitch squares\n byp: { value: 0 }, //apply the glitch ?\n amount: { value: 0.08 },\n angle: { value: 0.02 },\n seed: { value: 0.02 },\n seed_x: { value: 0.02 }, //-1,1\n seed_y: { value: 0.02 }, //-1,1\n distortion_x: { value: 0.5 },\n distortion_y: { value: 0.6 },\n col_s: { value: 0.05 },\n },\n\n vertexShader: `varying vec2 vUv;\n void main() {\n \t vUv = uv;\n \t gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }`,\n\n fragmentShader: `uniform int byp; //should we apply the glitch ?\n uniform sampler2D tDiffuse;\n uniform sampler2D tDisp;\n uniform float amount;\n uniform float angle;\n uniform float seed;\n uniform float seed_x;\n uniform float seed_y;\n uniform float distortion_x;\n uniform float distortion_y;\n uniform float col_s;\n\n varying vec2 vUv;\n\n float rand(vec2 co){\n \t return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n void main() {\n \tif(byp<1) {\n \t\tvec2 p = vUv;\n \t\tfloat xs = floor(gl_FragCoord.x / 0.5);\n \t\tfloat ys = floor(gl_FragCoord.y / 0.5);\n //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch\n \t\tvec4 normal = texture2D (tDisp, p*seed*seed);\n \t\tif(p.ydistortion_x-col_s*seed) {\n \t\t\tif(seed_x>0.){\n \t\t\t\tp.y = 1. - (p.y + distortion_y);\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.y = distortion_y;\n \t\t\t}\n \t\t}\n \t\tif(p.xdistortion_y-col_s*seed) {\n \t\t\tif(seed_y>0.){\n \t\t\t\tp.x=distortion_x;\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.x = 1. - (p.x + distortion_x);\n \t\t\t}\n \t\t}\n \t\tp.x+=normal.x*seed_x*(seed/5.);\n \t\tp.y+=normal.y*seed_y*(seed/5.);\n //base from RGB shift shader\n \t\tvec2 offset = amount * vec2( cos(angle), sin(angle));\n \t\tvec4 cr = texture2D(tDiffuse, p + offset);\n \t\tvec4 cga = texture2D(tDiffuse, p);\n \t\tvec4 cb = texture2D(tDiffuse, p - offset);\n \t\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\n //add noise\n \t\tvec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);\n \t\tgl_FragColor = gl_FragColor+ snow;\n \t}\n \telse {\n \t\tgl_FragColor=texture2D (tDiffuse, vUv);\n \t}\n }`,\n}\n", "/**\n * RGB Halftone shader for three.js.\n *\tNOTE:\n * \t\tShape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square)\n *\t\tBlending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker)\n */\n\nexport const HalftoneShader = {\n uniforms: {\n tDiffuse: { value: null },\n shape: { value: 1 },\n radius: { value: 4 },\n rotateR: { value: (Math.PI / 12) * 1 },\n rotateG: { value: (Math.PI / 12) * 2 },\n rotateB: { value: (Math.PI / 12) * 3 },\n scatter: { value: 0 },\n width: { value: 1 },\n height: { value: 1 },\n blending: { value: 1 },\n blendingMode: { value: 1 },\n greyscale: { value: false },\n disable: { value: false },\n },\n\n vertexShader: [\n 'varying vec2 vUV;',\n\n 'void main() {',\n\n '\tvUV = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define SQRT2_MINUS_ONE 0.41421356',\n '#define SQRT2_HALF_MINUS_ONE 0.20710678',\n '#define PI2 6.28318531',\n '#define SHAPE_DOT 1',\n '#define SHAPE_ELLIPSE 2',\n '#define SHAPE_LINE 3',\n '#define SHAPE_SQUARE 4',\n '#define BLENDING_LINEAR 1',\n '#define BLENDING_MULTIPLY 2',\n '#define BLENDING_ADD 3',\n '#define BLENDING_LIGHTER 4',\n '#define BLENDING_DARKER 5',\n 'uniform sampler2D tDiffuse;',\n 'uniform float radius;',\n 'uniform float rotateR;',\n 'uniform float rotateG;',\n 'uniform float rotateB;',\n 'uniform float scatter;',\n 'uniform float width;',\n 'uniform float height;',\n 'uniform int shape;',\n 'uniform bool disable;',\n 'uniform float blending;',\n 'uniform int blendingMode;',\n 'varying vec2 vUV;',\n 'uniform bool greyscale;',\n 'const int samples = 8;',\n\n 'float blend( float a, float b, float t ) {',\n\n // linear blend\n '\treturn a * ( 1.0 - t ) + b * t;',\n\n '}',\n\n 'float hypot( float x, float y ) {',\n\n // vector magnitude\n '\treturn sqrt( x * x + y * y );',\n\n '}',\n\n 'float rand( vec2 seed ){',\n\n // get pseudo-random number\n 'return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );',\n\n '}',\n\n 'float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {',\n\n // apply shape-specific transforms\n '\tfloat dist = hypot( coord.x - p.x, coord.y - p.y );',\n '\tfloat rad = channel;',\n\n '\tif ( shape == SHAPE_DOT ) {',\n\n '\t\trad = pow( abs( rad ), 1.125 ) * rad_max;',\n\n '\t} else if ( shape == SHAPE_ELLIPSE ) {',\n\n '\t\trad = pow( abs( rad ), 1.125 ) * rad_max;',\n\n '\t\tif ( dist != 0.0 ) {',\n '\t\t\tfloat dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );',\n '\t\t\tdist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;',\n '\t\t}',\n\n '\t} else if ( shape == SHAPE_LINE ) {',\n\n '\t\trad = pow( abs( rad ), 1.5) * rad_max;',\n '\t\tfloat dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;',\n '\t\tdist = hypot( normal.x * dot_p, normal.y * dot_p );',\n\n '\t} else if ( shape == SHAPE_SQUARE ) {',\n\n '\t\tfloat theta = atan( p.y - coord.y, p.x - coord.x ) - angle;',\n '\t\tfloat sin_t = abs( sin( theta ) );',\n '\t\tfloat cos_t = abs( cos( theta ) );',\n '\t\trad = pow( abs( rad ), 1.4 );',\n '\t\trad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );',\n\n '\t}',\n\n '\treturn rad - dist;',\n\n '}',\n\n 'struct Cell {',\n\n // grid sample positions\n '\tvec2 normal;',\n '\tvec2 p1;',\n '\tvec2 p2;',\n '\tvec2 p3;',\n '\tvec2 p4;',\n '\tfloat samp2;',\n '\tfloat samp1;',\n '\tfloat samp3;',\n '\tfloat samp4;',\n\n '};',\n\n 'vec4 getSample( vec2 point ) {',\n\n // multi-sampled point\n '\tvec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );',\n '\tfloat base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;',\n '\tfloat step = PI2 / float( samples );',\n '\tfloat dist = radius * 0.66;',\n\n '\tfor ( int i = 0; i < samples; ++i ) {',\n\n '\t\tfloat r = base + step * float( i );',\n '\t\tvec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );',\n '\t\ttex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );',\n\n '\t}',\n\n '\ttex /= float( samples ) + 1.0;',\n '\treturn tex;',\n\n '}',\n\n 'float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {',\n\n // get colour for given point\n '\tfloat dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;',\n\n '\tif ( channel == 0 ) {',\n\n '\t\tc.samp1 = getSample( c.p1 ).r;',\n '\t\tc.samp2 = getSample( c.p2 ).r;',\n '\t\tc.samp3 = getSample( c.p3 ).r;',\n '\t\tc.samp4 = getSample( c.p4 ).r;',\n\n '\t} else if (channel == 1) {',\n\n '\t\tc.samp1 = getSample( c.p1 ).g;',\n '\t\tc.samp2 = getSample( c.p2 ).g;',\n '\t\tc.samp3 = getSample( c.p3 ).g;',\n '\t\tc.samp4 = getSample( c.p4 ).g;',\n\n '\t} else {',\n\n '\t\tc.samp1 = getSample( c.p1 ).b;',\n '\t\tc.samp3 = getSample( c.p3 ).b;',\n '\t\tc.samp2 = getSample( c.p2 ).b;',\n '\t\tc.samp4 = getSample( c.p4 ).b;',\n\n '\t}',\n\n '\tdist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );',\n '\tdist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );',\n '\tdist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );',\n '\tdist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );',\n '\tres = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;',\n '\tres = clamp( res, 0.0, 1.0 );',\n\n '\treturn res;',\n\n '}',\n\n 'Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {',\n\n // get containing cell\n '\tCell c;',\n\n // calc grid\n '\tvec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );',\n '\tfloat threshold = step * 0.5;',\n '\tfloat dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );',\n '\tfloat dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );',\n '\tvec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );',\n '\tfloat offset_normal = mod( hypot( offset.x, offset.y ), step );',\n '\tfloat normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;',\n '\tfloat normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;',\n '\tfloat offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );',\n '\tfloat line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;',\n '\tfloat line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;',\n\n // get closest corner\n '\tc.normal = n;',\n '\tc.p1.x = p.x - n.x * normal_scale + n.y * line_scale;',\n '\tc.p1.y = p.y - n.y * normal_scale - n.x * line_scale;',\n\n // scatter\n '\tif ( scatter != 0.0 ) {',\n\n '\t\tfloat off_mag = scatter * threshold * 0.5;',\n '\t\tfloat off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;',\n '\t\tc.p1.x += cos( off_angle ) * off_mag;',\n '\t\tc.p1.y += sin( off_angle ) * off_mag;',\n\n '\t}',\n\n // find corners\n '\tfloat normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );',\n '\tfloat line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );',\n '\tc.p2.x = c.p1.x - n.x * normal_step;',\n '\tc.p2.y = c.p1.y - n.y * normal_step;',\n '\tc.p3.x = c.p1.x + n.y * line_step;',\n '\tc.p3.y = c.p1.y - n.x * line_step;',\n '\tc.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;',\n '\tc.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;',\n\n '\treturn c;',\n\n '}',\n\n 'float blendColour( float a, float b, float t ) {',\n\n // blend colours\n '\tif ( blendingMode == BLENDING_LINEAR ) {',\n '\t\treturn blend( a, b, 1.0 - t );',\n '\t} else if ( blendingMode == BLENDING_ADD ) {',\n '\t\treturn blend( a, min( 1.0, a + b ), t );',\n '\t} else if ( blendingMode == BLENDING_MULTIPLY ) {',\n '\t\treturn blend( a, max( 0.0, a * b ), t );',\n '\t} else if ( blendingMode == BLENDING_LIGHTER ) {',\n '\t\treturn blend( a, max( a, b ), t );',\n '\t} else if ( blendingMode == BLENDING_DARKER ) {',\n '\t\treturn blend( a, min( a, b ), t );',\n '\t} else {',\n '\t\treturn blend( a, b, 1.0 - t );',\n '\t}',\n\n '}',\n\n 'void main() {',\n\n '\tif ( ! disable ) {',\n\n // setup\n '\t\tvec2 p = vec2( vUV.x * width, vUV.y * height );',\n '\t\tvec2 origin = vec2( 0, 0 );',\n '\t\tfloat aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;',\n\n // get channel samples\n '\t\tCell cell_r = getReferenceCell( p, origin, rotateR, radius );',\n '\t\tCell cell_g = getReferenceCell( p, origin, rotateG, radius );',\n '\t\tCell cell_b = getReferenceCell( p, origin, rotateB, radius );',\n '\t\tfloat r = getDotColour( cell_r, p, 0, rotateR, aa );',\n '\t\tfloat g = getDotColour( cell_g, p, 1, rotateG, aa );',\n '\t\tfloat b = getDotColour( cell_b, p, 2, rotateB, aa );',\n\n // blend with original\n '\t\tvec4 colour = texture2D( tDiffuse, vUV );',\n '\t\tr = blendColour( r, colour.r, blending );',\n '\t\tg = blendColour( g, colour.g, blending );',\n '\t\tb = blendColour( b, colour.b, blending );',\n\n '\t\tif ( greyscale ) {',\n '\t\t\tr = g = b = (r + b + g) / 3.0;',\n '\t\t}',\n\n '\t\tgl_FragColor = vec4( r, g, b, 1.0 );',\n\n '\t} else {',\n\n '\t\tgl_FragColor = texture2D( tDiffuse, vUV );',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * WebGL port of Subpixel Morphological Antialiasing (SMAA) v2.8\n * Preset: SMAA 1x Medium (with color edge detection)\n * https://github.com/iryoku/smaa/releases/tag/v2.8\n */\n\nexport const SMAAEdgesShader = {\n defines: {\n SMAA_THRESHOLD: '0.1',\n },\n\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 3 ];',\n\n 'void SMAAEdgeDetectionVS( vec2 texcoord ) {',\n '\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );', // WebGL port note: Changed sign in W component\n '\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );', // WebGL port note: Changed sign in W component\n '\tvOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );', // WebGL port note: Changed sign in W component\n '}',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tSMAAEdgeDetectionVS( vUv );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 3 ];',\n\n 'vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {',\n '\tvec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );',\n\n // Calculate color deltas:\n '\tvec4 delta;',\n '\tvec3 C = texture2D( colorTex, texcoord ).rgb;',\n\n '\tvec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;',\n '\tvec3 t = abs( C - Cleft );',\n '\tdelta.x = max( max( t.r, t.g ), t.b );',\n\n '\tvec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;',\n '\tt = abs( C - Ctop );',\n '\tdelta.y = max( max( t.r, t.g ), t.b );',\n\n // We do the usual threshold:\n '\tvec2 edges = step( threshold, delta.xy );',\n\n // Then discard if there is no edge:\n '\tif ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )',\n '\t\tdiscard;',\n\n // Calculate right and bottom deltas:\n '\tvec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;',\n '\tt = abs( C - Cright );',\n '\tdelta.z = max( max( t.r, t.g ), t.b );',\n\n '\tvec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;',\n '\tt = abs( C - Cbottom );',\n '\tdelta.w = max( max( t.r, t.g ), t.b );',\n\n // Calculate the maximum delta in the direct neighborhood:\n '\tfloat maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );',\n\n // Calculate left-left and top-top deltas:\n '\tvec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;',\n '\tt = abs( C - Cleftleft );',\n '\tdelta.z = max( max( t.r, t.g ), t.b );',\n\n '\tvec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;',\n '\tt = abs( C - Ctoptop );',\n '\tdelta.w = max( max( t.r, t.g ), t.b );',\n\n // Calculate the final maximum delta:\n '\tmaxDelta = max( max( maxDelta, delta.z ), delta.w );',\n\n // Local contrast adaptation in action:\n '\tedges.xy *= step( 0.5 * maxDelta, delta.xy );',\n\n '\treturn vec4( edges, 0.0, 0.0 );',\n '}',\n\n 'void main() {',\n\n '\tgl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SMAAWeightsShader = {\n defines: {\n SMAA_MAX_SEARCH_STEPS: '8',\n SMAA_AREATEX_MAX_DISTANCE: '16',\n SMAA_AREATEX_PIXEL_SIZE: '( 1.0 / vec2( 160.0, 560.0 ) )',\n SMAA_AREATEX_SUBTEX_SIZE: '( 1.0 / 7.0 )',\n },\n\n uniforms: {\n tDiffuse: { value: null },\n tArea: { value: null },\n tSearch: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 3 ];',\n 'varying vec2 vPixcoord;',\n\n 'void SMAABlendingWeightCalculationVS( vec2 texcoord ) {',\n '\tvPixcoord = texcoord / resolution;',\n\n // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n '\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );', // WebGL port note: Changed sign in Y and W components\n '\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );', // WebGL port note: Changed sign in Y and W components\n\n // And these for the searches, they indicate the ends of the loops:\n '\tvOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );',\n\n '}',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tSMAABlendingWeightCalculationVS( vUv );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 )',\n\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tArea;',\n 'uniform sampler2D tSearch;',\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[3];',\n 'varying vec2 vPixcoord;',\n\n '#if __VERSION__ == 100',\n 'vec2 round( vec2 x ) {',\n '\treturn sign( x ) * floor( abs( x ) + 0.5 );',\n '}',\n '#endif',\n\n 'float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {',\n // Not required if searchTex accesses are set to point:\n // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);\n // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +\n // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\n '\te.r = bias + e.r * scale;',\n '\treturn 255.0 * texture2D( searchTex, e, 0.0 ).r;',\n '}',\n\n 'float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n /**\n * @PSEUDO_GATHER4\n * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to\n * sample between edge, thus fetching four edges in a row.\n * Sampling with different offsets in each direction allows to disambiguate\n * which edges are active from the four fetched ones.\n */\n '\tvec2 e = vec2( 0.0, 1.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord -= vec2( 2.0, 0.0 ) * resolution;',\n '\t\tif ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;',\n '\t}',\n\n // We correct the previous (-0.25, -0.125) offset we applied:\n '\ttexcoord.x += 0.25 * resolution.x;',\n\n // The searches are bias by 1, so adjust the coords accordingly:\n '\ttexcoord.x += resolution.x;',\n\n // Disambiguate the length added by the last step:\n '\ttexcoord.x += 2.0 * resolution.x;', // Undo last step\n '\ttexcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);',\n\n '\treturn texcoord.x;',\n '}',\n\n 'float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n '\tvec2 e = vec2( 0.0, 1.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord += vec2( 2.0, 0.0 ) * resolution;',\n '\t\tif ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;',\n '\t}',\n\n '\ttexcoord.x -= 0.25 * resolution.x;',\n '\ttexcoord.x -= resolution.x;',\n '\ttexcoord.x -= 2.0 * resolution.x;',\n '\ttexcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );',\n\n '\treturn texcoord.x;',\n '}',\n\n 'float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n '\tvec2 e = vec2( 1.0, 0.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord += vec2( 0.0, 2.0 ) * resolution;', // WebGL port note: Changed sign\n '\t\tif ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;',\n '\t}',\n\n '\ttexcoord.y -= 0.25 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y -= resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y -= 2.0 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );', // WebGL port note: Changed sign\n\n '\treturn texcoord.y;',\n '}',\n\n 'float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {',\n '\tvec2 e = vec2( 1.0, 0.0 );',\n\n '\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {', // WebGL port note: Changed while to for\n '\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;',\n '\t\ttexcoord -= vec2( 0.0, 2.0 ) * resolution;', // WebGL port note: Changed sign\n '\t\tif ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;',\n '\t}',\n\n '\ttexcoord.y += 0.25 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y += resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y += 2.0 * resolution.y;', // WebGL port note: Changed sign\n '\ttexcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );', // WebGL port note: Changed sign\n\n '\treturn texcoord.y;',\n '}',\n\n 'vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {',\n // Rounding prevents precision errors of bilinear filtering:\n '\tvec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;',\n\n // We do a scale and bias for mapping to texel space:\n '\ttexcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );',\n\n // Move to proper place, according to the subpixel offset:\n '\ttexcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;',\n\n '\treturn texture2D( areaTex, texcoord, 0.0 ).rg;',\n '}',\n\n 'vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {',\n '\tvec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );',\n\n '\tvec2 e = texture2D( edgesTex, texcoord ).rg;',\n\n '\tif ( e.g > 0.0 ) {', // Edge at north\n '\t\tvec2 d;',\n\n // Find the distance to the left:\n '\t\tvec2 coords;',\n '\t\tcoords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );',\n '\t\tcoords.y = offset[ 1 ].y;', // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)\n '\t\td.x = coords.x;',\n\n // Now fetch the left crossing edges, two at a time using bilinear\n // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n // discern what value each edge has:\n '\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).r;',\n\n // Find the distance to the right:\n '\t\tcoords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );',\n '\t\td.y = coords.x;',\n\n // We want the distances to be in pixel units (doing this here allow to\n // better interleave arithmetic and memory accesses):\n '\t\td = d / resolution.x - pixcoord.x;',\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n '\t\tvec2 sqrt_d = sqrt( abs( d ) );',\n\n // Fetch the right crossing edges:\n '\t\tcoords.y -= 1.0 * resolution.y;', // WebGL port note: Added\n '\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;',\n\n // Ok, we know how this pattern looks like, now it is time for getting\n // the actual area:\n '\t\tweights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );',\n '\t}',\n\n '\tif ( e.r > 0.0 ) {', // Edge at west\n '\t\tvec2 d;',\n\n // Find the distance to the top:\n '\t\tvec2 coords;',\n\n '\t\tcoords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );',\n '\t\tcoords.x = offset[ 0 ].x;', // offset[1].x = texcoord.x - 0.25 * resolution.x;\n '\t\td.x = coords.y;',\n\n // Fetch the top crossing edges:\n '\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).g;',\n\n // Find the distance to the bottom:\n '\t\tcoords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );',\n '\t\td.y = coords.y;',\n\n // We want the distances to be in pixel units:\n '\t\td = d / resolution.y - pixcoord.y;',\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n '\t\tvec2 sqrt_d = sqrt( abs( d ) );',\n\n // Fetch the bottom crossing edges:\n '\t\tcoords.y -= 1.0 * resolution.y;', // WebGL port note: Added\n '\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;',\n\n // Get the area for this direction:\n '\t\tweights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );',\n '\t}',\n\n '\treturn weights;',\n '}',\n\n 'void main() {',\n\n '\tgl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SMAABlendShader = {\n uniforms: {\n tDiffuse: { value: null },\n tColor: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 2 ];',\n\n 'void SMAANeighborhoodBlendingVS( vec2 texcoord ) {',\n '\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );', // WebGL port note: Changed sign in W component\n '\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );', // WebGL port note: Changed sign in W component\n '}',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tSMAANeighborhoodBlendingVS( vUv );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tColor;',\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vOffset[ 2 ];',\n\n 'vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {',\n // Fetch the blending weights for current pixel:\n '\tvec4 a;',\n '\ta.xz = texture2D( blendTex, texcoord ).xz;',\n '\ta.y = texture2D( blendTex, offset[ 1 ].zw ).g;',\n '\ta.w = texture2D( blendTex, offset[ 1 ].xy ).a;',\n\n // Is there any blending weight with a value greater than 0.0?\n '\tif ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {',\n '\t\treturn texture2D( colorTex, texcoord, 0.0 );',\n '\t} else {',\n // Up to 4 lines can be crossing a pixel (one through each edge). We\n // favor blending by choosing the line with the maximum weight for each\n // direction:\n '\t\tvec2 offset;',\n '\t\toffset.x = a.a > a.b ? a.a : -a.b;', // left vs. right\n '\t\toffset.y = a.g > a.r ? -a.g : a.r;', // top vs. bottom // WebGL port note: Changed signs\n\n // Then we go in the direction that has the maximum weight:\n '\t\tif ( abs( offset.x ) > abs( offset.y )) {', // horizontal vs. vertical\n '\t\t\toffset.y = 0.0;',\n '\t\t} else {',\n '\t\t\toffset.x = 0.0;',\n '\t\t}',\n\n // Fetch the opposite color and lerp by hand:\n '\t\tvec4 C = texture2D( colorTex, texcoord, 0.0 );',\n '\t\ttexcoord += sign( offset ) * resolution;',\n '\t\tvec4 Cop = texture2D( colorTex, texcoord, 0.0 );',\n '\t\tfloat s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );',\n\n // WebGL port note: Added gamma correction\n '\t\tC.xyz = pow(C.xyz, vec3(2.2));',\n '\t\tCop.xyz = pow(Cop.xyz, vec3(2.2));',\n '\t\tvec4 mixed = mix(C, Cop, s);',\n '\t\tmixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));',\n\n '\t\treturn mixed;',\n '\t}',\n '}',\n\n 'void main() {',\n\n '\tgl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Film grain & scanlines shader\n *\n * - ported from HLSL to WebGL / GLSL\n * http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html\n *\n * Screen Space Static Postprocessor\n *\n * Produces an analogue noise overlay similar to a film grain / TV static\n *\n * Original implementation and noise algorithm\n * Pat 'Hawthorne' Shearon\n *\n * Optimized scanlines + noise version with intensity scaling\n * Georg 'Leviathan' Steinrohder\n *\n * This version is provided under a Creative Commons Attribution 3.0 License\n * http://creativecommons.org/licenses/by/3.0/\n */\n\nexport const FilmShader = {\n uniforms: {\n tDiffuse: { value: null },\n time: { value: 0.0 },\n nIntensity: { value: 0.5 },\n sIntensity: { value: 0.05 },\n sCount: { value: 4096 },\n grayscale: { value: 1 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n // control parameter\n 'uniform float time;',\n\n 'uniform bool grayscale;',\n\n // noise effect intensity value (0 = no effect, 1 = full effect)\n 'uniform float nIntensity;',\n\n // scanlines effect intensity value (0 = no effect, 1 = full effect)\n 'uniform float sIntensity;',\n\n // scanlines effect count value (0 = no effect, 4096 = full effect)\n 'uniform float sCount;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n // sample the source\n '\tvec4 cTextureScreen = texture2D( tDiffuse, vUv );',\n\n // make some noise\n '\tfloat dx = rand( vUv + time );',\n\n // add noise\n '\tvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );',\n\n // get us a sine and cosine\n '\tvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );',\n\n // add scanlines\n '\tcResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;',\n\n // interpolate between source and result by intensity\n '\tcResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );',\n\n // convert to grayscale if desired\n '\tif( grayscale ) {',\n\n '\t\tcResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );',\n\n '\t}',\n\n '\tgl_FragColor = vec4( cResult, cTextureScreen.a );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Full-screen textured quad shader\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type CopyShaderUniforms = {\n opacity: IUniform\n tDiffuse: IUniform\n}\n\nexport interface ICopyShader extends IShader {}\n\nexport const CopyShader: ICopyShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n '\tgl_FragColor = opacity * texel;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Matrix4, Vector2 } from 'three'\n\n/**\n * References:\n * http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html\n * https://learnopengl.com/Advanced-Lighting/SSAO\n * https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl\n */\n\nexport const SSAOShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1,\n KERNEL_SIZE: 32,\n },\n\n uniforms: {\n tDiffuse: { value: null },\n tNormal: { value: null },\n tDepth: { value: null },\n tNoise: { value: null },\n kernel: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n resolution: { value: new Vector2() },\n cameraProjectionMatrix: { value: new Matrix4() },\n cameraInverseProjectionMatrix: { value: new Matrix4() },\n kernelRadius: { value: 8 },\n minDistance: { value: 0.005 },\n maxDistance: { value: 0.05 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tNormal;',\n 'uniform sampler2D tDepth;',\n 'uniform sampler2D tNoise;',\n\n 'uniform vec3 kernel[ KERNEL_SIZE ];',\n\n 'uniform vec2 resolution;',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n 'uniform mat4 cameraProjectionMatrix;',\n 'uniform mat4 cameraInverseProjectionMatrix;',\n\n 'uniform float kernelRadius;',\n 'uniform float minDistance;', // avoid artifacts caused by neighbour fragments with minimal depth difference\n 'uniform float maxDistance;', // avoid the influence of fragments which are too far away\n\n 'varying vec2 vUv;',\n\n '#include ',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n\n '\treturn texture2D( tDepth, screenPosition ).x;',\n\n '}',\n\n 'float getLinearDepth( const in vec2 screenPosition ) {',\n\n '\t#if PERSPECTIVE_CAMERA == 1',\n\n '\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;',\n '\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );',\n '\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );',\n\n '\t#else',\n\n '\t\treturn texture2D( tDepth, screenPosition ).x;',\n\n '\t#endif',\n\n '}',\n\n 'float getViewZ( const in float depth ) {',\n\n '\t#if PERSPECTIVE_CAMERA == 1',\n\n '\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );',\n\n '\t#else',\n\n '\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );',\n\n '\t#endif',\n\n '}',\n\n 'vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {',\n\n '\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];',\n\n '\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );',\n\n '\tclipPosition *= clipW; // unprojection.',\n\n '\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;',\n\n '}',\n\n 'vec3 getViewNormal( const in vec2 screenPosition ) {',\n\n '\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );',\n\n '}',\n\n 'void main() {',\n\n '\tfloat depth = getDepth( vUv );',\n '\tfloat viewZ = getViewZ( depth );',\n\n '\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );',\n '\tvec3 viewNormal = getViewNormal( vUv );',\n\n ' vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );',\n '\tvec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;',\n\n // compute matrix used to reorient a kernel vector\n\n '\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );',\n '\tvec3 bitangent = cross( viewNormal, tangent );',\n '\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );',\n\n ' float occlusion = 0.0;',\n\n ' for ( int i = 0; i < KERNEL_SIZE; i ++ ) {',\n\n '\t\tvec3 sampleVector = kernelMatrix * kernel[ i ];', // reorient sample vector in view space\n '\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );', // calculate sample point\n\n '\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );', // project point and calculate NDC\n '\t\tsamplePointNDC /= samplePointNDC.w;',\n\n '\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;', // compute uv coordinates\n\n '\t\tfloat realDepth = getLinearDepth( samplePointUv );', // get linear depth from depth texture\n '\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );', // compute linear depth of the sample view Z value\n '\t\tfloat delta = sampleDepth - realDepth;',\n\n '\t\tif ( delta > minDistance && delta < maxDistance ) {', // if fragment is before sample point, increase occlusion\n\n '\t\t\tocclusion += 1.0;',\n\n '\t\t}',\n\n '\t}',\n\n '\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );',\n\n '\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SSAODepthShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1,\n },\n\n uniforms: {\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDepth;',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n\n 'varying vec2 vUv;',\n\n '#include ',\n\n 'float getLinearDepth( const in vec2 screenPosition ) {',\n\n '\t#if PERSPECTIVE_CAMERA == 1',\n\n '\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;',\n '\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );',\n '\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );',\n\n '\t#else',\n\n '\t\treturn texture2D( tDepth, screenPosition ).x;',\n\n '\t#endif',\n\n '}',\n\n 'void main() {',\n\n '\tfloat depth = getLinearDepth( vUv );',\n '\tgl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n\nexport const SSAOBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2() },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n\n 'uniform vec2 resolution;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 texelSize = ( 1.0 / resolution );',\n '\tfloat result = 0.0;',\n\n '\tfor ( int i = - 2; i <= 2; i ++ ) {',\n\n '\t\tfor ( int j = - 2; j <= 2; j ++ ) {',\n\n '\t\t\tvec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;',\n '\t\t\tresult += texture2D( tDiffuse, vUv + offset ).r;',\n\n '\t\t}',\n\n '\t}',\n\n '\tgl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "import {\n AddEquation,\n Color,\n CustomBlending,\n DataTexture,\n DepthTexture,\n DstAlphaFactor,\n DstColorFactor,\n FloatType,\n MathUtils,\n MeshNormalMaterial,\n NearestFilter,\n NoBlending,\n RedFormat,\n LuminanceFormat,\n DepthStencilFormat,\n UnsignedInt248Type,\n RepeatWrapping,\n ShaderMaterial,\n UniformsUtils,\n Vector3,\n WebGLRenderTarget,\n ZeroFactor,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { SimplexNoise } from '../math/SimplexNoise'\nimport { SSAOShader, SSAOBlurShader, SSAODepthShader } from '../shaders/SSAOShader'\n\nimport { CopyShader } from '../shaders/CopyShader'\n\nclass SSAOPass extends Pass {\n static OUTPUT = {\n Default: 0,\n SSAO: 1,\n Blur: 2,\n Beauty: 3,\n Depth: 4,\n Normal: 5,\n }\n\n constructor(scene, camera, width, height) {\n super()\n\n this.width = width !== undefined ? width : 512\n this.height = height !== undefined ? height : 512\n\n this.clear = true\n\n this.camera = camera\n this.scene = scene\n\n this.kernelRadius = 8\n this.kernelSize = 32\n this.kernel = []\n this.noiseTexture = null\n this.output = 0\n\n this.minDistance = 0.005\n this.maxDistance = 0.1\n\n this._visibilityCache = new Map()\n\n //\n\n this.generateSampleKernel()\n this.generateRandomKernelRotations()\n\n // beauty render target\n\n const depthTexture = new DepthTexture()\n depthTexture.format = DepthStencilFormat\n depthTexture.type = UnsignedInt248Type\n\n this.beautyRenderTarget = new WebGLRenderTarget(this.width, this.height)\n\n // normal render target with depth buffer\n\n this.normalRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n depthTexture: depthTexture,\n })\n\n // ssao render target\n\n this.ssaoRenderTarget = new WebGLRenderTarget(this.width, this.height)\n\n this.blurRenderTarget = this.ssaoRenderTarget.clone()\n\n // ssao material\n\n if (SSAOShader === undefined) {\n console.error('THREE.SSAOPass: The pass relies on SSAOShader.')\n }\n\n this.ssaoMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSAOShader.defines),\n uniforms: UniformsUtils.clone(SSAOShader.uniforms),\n vertexShader: SSAOShader.vertexShader,\n fragmentShader: SSAOShader.fragmentShader,\n blending: NoBlending,\n })\n\n this.ssaoMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.ssaoMaterial.uniforms['tNormal'].value = this.normalRenderTarget.texture\n this.ssaoMaterial.uniforms['tDepth'].value = this.normalRenderTarget.depthTexture\n this.ssaoMaterial.uniforms['tNoise'].value = this.noiseTexture\n this.ssaoMaterial.uniforms['kernel'].value = this.kernel\n this.ssaoMaterial.uniforms['cameraNear'].value = this.camera.near\n this.ssaoMaterial.uniforms['cameraFar'].value = this.camera.far\n this.ssaoMaterial.uniforms['resolution'].value.set(this.width, this.height)\n this.ssaoMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssaoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n // normal material\n\n this.normalMaterial = new MeshNormalMaterial()\n this.normalMaterial.blending = NoBlending\n\n // blur material\n\n this.blurMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSAOBlurShader.defines),\n uniforms: UniformsUtils.clone(SSAOBlurShader.uniforms),\n vertexShader: SSAOBlurShader.vertexShader,\n fragmentShader: SSAOBlurShader.fragmentShader,\n })\n this.blurMaterial.uniforms['tDiffuse'].value = this.ssaoRenderTarget.texture\n this.blurMaterial.uniforms['resolution'].value.set(this.width, this.height)\n\n // material for rendering the depth\n\n this.depthRenderMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSAODepthShader.defines),\n uniforms: UniformsUtils.clone(SSAODepthShader.uniforms),\n vertexShader: SSAODepthShader.vertexShader,\n fragmentShader: SSAODepthShader.fragmentShader,\n blending: NoBlending,\n })\n this.depthRenderMaterial.uniforms['tDepth'].value = this.normalRenderTarget.depthTexture\n this.depthRenderMaterial.uniforms['cameraNear'].value = this.camera.near\n this.depthRenderMaterial.uniforms['cameraFar'].value = this.camera.far\n\n // material for rendering the content of a render target\n\n this.copyMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n blendSrc: DstColorFactor,\n blendDst: ZeroFactor,\n blendEquation: AddEquation,\n blendSrcAlpha: DstAlphaFactor,\n blendDstAlpha: ZeroFactor,\n blendEquationAlpha: AddEquation,\n })\n\n this.fsQuad = new FullScreenQuad(null)\n\n this.originalClearColor = new Color()\n }\n\n dispose() {\n // dispose render targets\n\n this.beautyRenderTarget.dispose()\n this.normalRenderTarget.dispose()\n this.ssaoRenderTarget.dispose()\n this.blurRenderTarget.dispose()\n\n // dispose materials\n\n this.normalMaterial.dispose()\n this.blurMaterial.dispose()\n this.copyMaterial.dispose()\n this.depthRenderMaterial.dispose()\n\n // dipsose full screen quad\n\n this.fsQuad.dispose()\n }\n\n render(renderer, writeBuffer /*, readBuffer, deltaTime, maskActive */) {\n if (renderer.capabilities.isWebGL2 === false) this.noiseTexture.format = LuminanceFormat\n\n // render beauty\n\n renderer.setRenderTarget(this.beautyRenderTarget)\n renderer.clear()\n renderer.render(this.scene, this.camera)\n\n // render normals and depth (honor only meshes, points and lines do not contribute to SSAO)\n\n this.overrideVisibility()\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0)\n this.restoreVisibility()\n\n // render SSAO\n\n this.ssaoMaterial.uniforms['kernelRadius'].value = this.kernelRadius\n this.ssaoMaterial.uniforms['minDistance'].value = this.minDistance\n this.ssaoMaterial.uniforms['maxDistance'].value = this.maxDistance\n this.renderPass(renderer, this.ssaoMaterial, this.ssaoRenderTarget)\n\n // render blur\n\n this.renderPass(renderer, this.blurMaterial, this.blurRenderTarget)\n\n // output result to screen\n\n switch (this.output) {\n case SSAOPass.OUTPUT.SSAO:\n this.copyMaterial.uniforms['tDiffuse'].value = this.ssaoRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Blur:\n this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Beauty:\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Depth:\n this.renderPass(renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Normal:\n this.copyMaterial.uniforms['tDiffuse'].value = this.normalRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSAOPass.OUTPUT.Default:\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget.texture\n this.copyMaterial.blending = CustomBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n default:\n console.warn('THREE.SSAOPass: Unknown output type.')\n }\n }\n\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n // save original state\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n\n // setup pass state\n renderer.autoClear = false\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.fsQuad.material = passMaterial\n this.fsQuad.render(renderer)\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.overrideMaterial = overrideMaterial\n renderer.render(this.scene, this.camera)\n this.scene.overrideMaterial = null\n\n // restore original state\n\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n setSize(width, height) {\n this.width = width\n this.height = height\n\n this.beautyRenderTarget.setSize(width, height)\n this.ssaoRenderTarget.setSize(width, height)\n this.normalRenderTarget.setSize(width, height)\n this.blurRenderTarget.setSize(width, height)\n\n this.ssaoMaterial.uniforms['resolution'].value.set(width, height)\n this.ssaoMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssaoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n this.blurMaterial.uniforms['resolution'].value.set(width, height)\n }\n\n generateSampleKernel() {\n const kernelSize = this.kernelSize\n const kernel = this.kernel\n\n for (let i = 0; i < kernelSize; i++) {\n const sample = new Vector3()\n sample.x = Math.random() * 2 - 1\n sample.y = Math.random() * 2 - 1\n sample.z = Math.random()\n\n sample.normalize()\n\n let scale = i / kernelSize\n scale = MathUtils.lerp(0.1, 1, scale * scale)\n sample.multiplyScalar(scale)\n\n kernel.push(sample)\n }\n }\n\n generateRandomKernelRotations() {\n const width = 4,\n height = 4\n\n if (SimplexNoise === undefined) {\n console.error('THREE.SSAOPass: The pass relies on SimplexNoise.')\n }\n\n const simplex = new SimplexNoise()\n\n const size = width * height\n const data = new Float32Array(size)\n\n for (let i = 0; i < size; i++) {\n const x = Math.random() * 2 - 1\n const y = Math.random() * 2 - 1\n const z = 0\n\n data[i] = simplex.noise3d(x, y, z)\n }\n\n this.noiseTexture = new DataTexture(data, width, height, RedFormat, FloatType)\n this.noiseTexture.wrapS = RepeatWrapping\n this.noiseTexture.wrapT = RepeatWrapping\n this.noiseTexture.needsUpdate = true\n }\n\n overrideVisibility() {\n const scene = this.scene\n const cache = this._visibilityCache\n\n scene.traverse(function (object) {\n cache.set(object, object.visible)\n\n if (object.isPoints || object.isLine) object.visible = false\n })\n }\n\n restoreVisibility() {\n const scene = this.scene\n const cache = this._visibilityCache\n\n scene.traverse(function (object) {\n const visible = cache.get(object)\n object.visible = visible\n })\n\n cache.clear()\n }\n}\n\nexport { SSAOPass }\n", "/**\n * Depth-of-field shader with bokeh\n * ported from GLSL shader by Martins Upitis\n * http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type BokehShaderDefines = {\n DEPTH_PACKING: number\n PERSPECTIVE_CAMERA: number\n}\n\nexport type BokehShaderUniforms = {\n aperture: IUniform\n aspect: IUniform\n farClip: IUniform\n focus: IUniform\n maxblur: IUniform\n nearClip: IUniform\n tColor: IUniform\n tDepth: IUniform\n}\n\nexport interface IBokehShader extends IShader {}\n\nexport const BokehShader: IBokehShader = {\n defines: {\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n\n uniforms: {\n tColor: { value: null },\n tDepth: { value: null },\n focus: { value: 1.0 },\n aspect: { value: 1.0 },\n aperture: { value: 0.025 },\n maxblur: { value: 0.01 },\n nearClip: { value: 1.0 },\n farClip: { value: 1000.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tColor;',\n 'uniform sampler2D tDepth;',\n\n 'uniform float maxblur;', // max blur amount\n 'uniform float aperture;', // aperture - bigger values for shallower depth of field\n\n 'uniform float nearClip;',\n 'uniform float farClip;',\n\n 'uniform float focus;',\n 'uniform float aspect;',\n\n '#include ',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n '\t#if DEPTH_PACKING == 1',\n '\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );',\n '\t#else',\n '\treturn texture2D( tDepth, screenPosition ).x;',\n '\t#endif',\n '}',\n\n 'float getViewZ( const in float depth ) {',\n '\t#if PERSPECTIVE_CAMERA == 1',\n '\treturn perspectiveDepthToViewZ( depth, nearClip, farClip );',\n '\t#else',\n '\treturn orthographicDepthToViewZ( depth, nearClip, farClip );',\n '\t#endif',\n '}',\n\n 'void main() {',\n\n '\tvec2 aspectcorrect = vec2( 1.0, aspect );',\n\n '\tfloat viewZ = getViewZ( getDepth( vUv ) );',\n\n '\tfloat factor = ( focus + viewZ );', // viewZ is <= 0, so this is a difference equation\n\n '\tvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );',\n\n '\tvec2 dofblur9 = dofblur * 0.9;',\n '\tvec2 dofblur7 = dofblur * 0.7;',\n '\tvec2 dofblur4 = dofblur * 0.4;',\n\n '\tvec4 col = vec4( 0.0 );',\n\n '\tcol += texture2D( tColor, vUv.xy );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );',\n\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );',\n\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );',\n\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );',\n '\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );',\n\n '\tgl_FragColor = col / 41.0;',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Luminosity\n * http://en.wikipedia.org/wiki/Luminosity\n */\n\nexport const LuminosityShader = {\n uniforms: {\n tDiffuse: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tfloat l = linearToRelativeLuminance( texel.rgb );',\n\n '\tgl_FragColor = vec4( l, l, l, texel.w );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Full-screen tone-mapping shader based on http://www.cis.rit.edu/people/faculty/ferwerda/publications/sig02_paper.pdf\n */\n\nexport const ToneMapShader = {\n uniforms: {\n tDiffuse: { value: null },\n averageLuminance: { value: 1.0 },\n luminanceMap: { value: null },\n maxLuminance: { value: 16.0 },\n minLuminance: { value: 0.01 },\n middleGrey: { value: 0.6 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'uniform float middleGrey;',\n 'uniform float minLuminance;',\n 'uniform float maxLuminance;',\n '#ifdef ADAPTED_LUMINANCE',\n '\tuniform sampler2D luminanceMap;',\n '#else',\n '\tuniform float averageLuminance;',\n '#endif',\n\n 'vec3 ToneMap( vec3 vColor ) {',\n '\t#ifdef ADAPTED_LUMINANCE',\n // Get the calculated average luminance\n '\t\tfloat fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;',\n '\t#else',\n '\t\tfloat fLumAvg = averageLuminance;',\n '\t#endif',\n\n // Calculate the luminance of the current pixel\n '\tfloat fLumPixel = linearToRelativeLuminance( vColor );',\n\n // Apply the modified operator (Eq. 4)\n '\tfloat fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );',\n\n '\tfloat fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);',\n '\treturn fLumCompressed * vColor;',\n '}',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tgl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color } from 'three'\n\n/**\n * Luminosity\n * http://en.wikipedia.org/wiki/Luminosity\n */\n\nexport const LuminosityHighPassShader = {\n shaderID: 'luminosityHighPass',\n\n uniforms: {\n tDiffuse: { value: null },\n luminosityThreshold: { value: 1.0 },\n smoothWidth: { value: 1.0 },\n defaultColor: { value: new Color(0x000000) },\n defaultOpacity: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform vec3 defaultColor;',\n 'uniform float defaultOpacity;',\n 'uniform float luminosityThreshold;',\n 'uniform float smoothWidth;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tvec3 luma = vec3( 0.299, 0.587, 0.114 );',\n\n '\tfloat v = dot( texel.xyz, luma );',\n\n '\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );',\n\n '\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );',\n\n '\tgl_FragColor = mix( outputColor, texel, alpha );',\n\n '}',\n ].join('\\n'),\n}\n", "import {\n AdditiveBlending,\n Color,\n HalfFloatType,\n MeshBasicMaterial,\n ShaderMaterial,\n UniformsUtils,\n Vector2,\n Vector3,\n WebGLRenderTarget,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { CopyShader } from '../shaders/CopyShader'\nimport { LuminosityHighPassShader } from '../shaders/LuminosityHighPassShader'\n\n/**\n * UnrealBloomPass is inspired by the bloom pass of Unreal Engine. It creates a\n * mip map chain of bloom textures and blurs them with different radii. Because\n * of the weighted combination of mips, and because larger blurs are done on\n * higher mips, this effect provides good quality and performance.\n *\n * Reference:\n * - https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/\n */\nclass UnrealBloomPass extends Pass {\n static BlurDirectionX = new Vector2(1.0, 0.0)\n static BlurDirectionY = new Vector2(0.0, 1.0)\n\n constructor(resolution, strength, radius, threshold) {\n super()\n\n this.strength = strength !== undefined ? strength : 1\n this.radius = radius\n this.threshold = threshold\n this.resolution = resolution !== undefined ? new Vector2(resolution.x, resolution.y) : new Vector2(256, 256)\n\n // create color only once here, reuse it later inside the render function\n this.clearColor = new Color(0, 0, 0)\n\n // render targets\n this.renderTargetsHorizontal = []\n this.renderTargetsVertical = []\n this.nMips = 5\n let resx = Math.round(this.resolution.x / 2)\n let resy = Math.round(this.resolution.y / 2)\n\n this.renderTargetBright = new WebGLRenderTarget(resx, resy, { type: HalfFloatType })\n this.renderTargetBright.texture.name = 'UnrealBloomPass.bright'\n this.renderTargetBright.texture.generateMipmaps = false\n\n for (let i = 0; i < this.nMips; i++) {\n const renderTargetHorizonal = new WebGLRenderTarget(resx, resy, { type: HalfFloatType })\n\n renderTargetHorizonal.texture.name = 'UnrealBloomPass.h' + i\n renderTargetHorizonal.texture.generateMipmaps = false\n\n this.renderTargetsHorizontal.push(renderTargetHorizonal)\n\n const renderTargetVertical = new WebGLRenderTarget(resx, resy, { type: HalfFloatType })\n\n renderTargetVertical.texture.name = 'UnrealBloomPass.v' + i\n renderTargetVertical.texture.generateMipmaps = false\n\n this.renderTargetsVertical.push(renderTargetVertical)\n\n resx = Math.round(resx / 2)\n\n resy = Math.round(resy / 2)\n }\n\n // luminosity high pass material\n\n const highPassShader = LuminosityHighPassShader\n this.highPassUniforms = UniformsUtils.clone(highPassShader.uniforms)\n\n this.highPassUniforms['luminosityThreshold'].value = threshold\n this.highPassUniforms['smoothWidth'].value = 0.01\n\n this.materialHighPassFilter = new ShaderMaterial({\n uniforms: this.highPassUniforms,\n vertexShader: highPassShader.vertexShader,\n fragmentShader: highPassShader.fragmentShader,\n defines: {},\n })\n\n // Gaussian Blur Materials\n this.separableBlurMaterials = []\n const kernelSizeArray = [3, 5, 7, 9, 11]\n resx = Math.round(this.resolution.x / 2)\n resy = Math.round(this.resolution.y / 2)\n\n for (let i = 0; i < this.nMips; i++) {\n this.separableBlurMaterials.push(this.getSeperableBlurMaterial(kernelSizeArray[i]))\n\n this.separableBlurMaterials[i].uniforms['texSize'].value = new Vector2(resx, resy)\n\n resx = Math.round(resx / 2)\n\n resy = Math.round(resy / 2)\n }\n\n // Composite material\n this.compositeMaterial = this.getCompositeMaterial(this.nMips)\n this.compositeMaterial.uniforms['blurTexture1'].value = this.renderTargetsVertical[0].texture\n this.compositeMaterial.uniforms['blurTexture2'].value = this.renderTargetsVertical[1].texture\n this.compositeMaterial.uniforms['blurTexture3'].value = this.renderTargetsVertical[2].texture\n this.compositeMaterial.uniforms['blurTexture4'].value = this.renderTargetsVertical[3].texture\n this.compositeMaterial.uniforms['blurTexture5'].value = this.renderTargetsVertical[4].texture\n this.compositeMaterial.uniforms['bloomStrength'].value = strength\n this.compositeMaterial.uniforms['bloomRadius'].value = 0.1\n this.compositeMaterial.needsUpdate = true\n\n const bloomFactors = [1.0, 0.8, 0.6, 0.4, 0.2]\n this.compositeMaterial.uniforms['bloomFactors'].value = bloomFactors\n this.bloomTintColors = [\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n new Vector3(1, 1, 1),\n ]\n this.compositeMaterial.uniforms['bloomTintColors'].value = this.bloomTintColors\n\n // copy material\n\n const copyShader = CopyShader\n\n this.copyUniforms = UniformsUtils.clone(copyShader.uniforms)\n this.copyUniforms['opacity'].value = 1.0\n\n this.materialCopy = new ShaderMaterial({\n uniforms: this.copyUniforms,\n vertexShader: copyShader.vertexShader,\n fragmentShader: copyShader.fragmentShader,\n blending: AdditiveBlending,\n depthTest: false,\n depthWrite: false,\n transparent: true,\n })\n\n this.enabled = true\n this.needsSwap = false\n\n this._oldClearColor = new Color()\n this.oldClearAlpha = 1\n\n this.basic = new MeshBasicMaterial()\n\n this.fsQuad = new FullScreenQuad(null)\n }\n\n dispose() {\n for (let i = 0; i < this.renderTargetsHorizontal.length; i++) {\n this.renderTargetsHorizontal[i].dispose()\n }\n\n for (let i = 0; i < this.renderTargetsVertical.length; i++) {\n this.renderTargetsVertical[i].dispose()\n }\n\n this.renderTargetBright.dispose()\n\n //\n\n for (let i = 0; i < this.separableBlurMaterials.length; i++) {\n this.separableBlurMaterials[i].dispose()\n }\n\n this.compositeMaterial.dispose()\n this.materialCopy.dispose()\n this.basic.dispose()\n\n //\n\n this.fsQuad.dispose()\n }\n\n setSize(width, height) {\n let resx = Math.round(width / 2)\n let resy = Math.round(height / 2)\n\n this.renderTargetBright.setSize(resx, resy)\n\n for (let i = 0; i < this.nMips; i++) {\n this.renderTargetsHorizontal[i].setSize(resx, resy)\n this.renderTargetsVertical[i].setSize(resx, resy)\n\n this.separableBlurMaterials[i].uniforms['texSize'].value = new Vector2(resx, resy)\n\n resx = Math.round(resx / 2)\n resy = Math.round(resy / 2)\n }\n }\n\n render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {\n renderer.getClearColor(this._oldClearColor)\n this.oldClearAlpha = renderer.getClearAlpha()\n const oldAutoClear = renderer.autoClear\n renderer.autoClear = false\n\n renderer.setClearColor(this.clearColor, 0)\n\n if (maskActive) renderer.state.buffers.stencil.setTest(false)\n\n // Render input to screen\n\n if (this.renderToScreen) {\n this.fsQuad.material = this.basic\n this.basic.map = readBuffer.texture\n\n renderer.setRenderTarget(null)\n renderer.clear()\n this.fsQuad.render(renderer)\n }\n\n // 1. Extract Bright Areas\n\n this.highPassUniforms['tDiffuse'].value = readBuffer.texture\n this.highPassUniforms['luminosityThreshold'].value = this.threshold\n this.fsQuad.material = this.materialHighPassFilter\n\n renderer.setRenderTarget(this.renderTargetBright)\n renderer.clear()\n this.fsQuad.render(renderer)\n\n // 2. Blur All the mips progressively\n\n let inputRenderTarget = this.renderTargetBright\n\n for (let i = 0; i < this.nMips; i++) {\n this.fsQuad.material = this.separableBlurMaterials[i]\n\n this.separableBlurMaterials[i].uniforms['colorTexture'].value = inputRenderTarget.texture\n this.separableBlurMaterials[i].uniforms['direction'].value = UnrealBloomPass.BlurDirectionX\n renderer.setRenderTarget(this.renderTargetsHorizontal[i])\n renderer.clear()\n this.fsQuad.render(renderer)\n\n this.separableBlurMaterials[i].uniforms['colorTexture'].value = this.renderTargetsHorizontal[i].texture\n this.separableBlurMaterials[i].uniforms['direction'].value = UnrealBloomPass.BlurDirectionY\n renderer.setRenderTarget(this.renderTargetsVertical[i])\n renderer.clear()\n this.fsQuad.render(renderer)\n\n inputRenderTarget = this.renderTargetsVertical[i]\n }\n\n // Composite All the mips\n\n this.fsQuad.material = this.compositeMaterial\n this.compositeMaterial.uniforms['bloomStrength'].value = this.strength\n this.compositeMaterial.uniforms['bloomRadius'].value = this.radius\n this.compositeMaterial.uniforms['bloomTintColors'].value = this.bloomTintColors\n\n renderer.setRenderTarget(this.renderTargetsHorizontal[0])\n renderer.clear()\n this.fsQuad.render(renderer)\n\n // Blend it additively over the input texture\n\n this.fsQuad.material = this.materialCopy\n this.copyUniforms['tDiffuse'].value = this.renderTargetsHorizontal[0].texture\n\n if (maskActive) renderer.state.buffers.stencil.setTest(true)\n\n if (this.renderToScreen) {\n renderer.setRenderTarget(null)\n this.fsQuad.render(renderer)\n } else {\n renderer.setRenderTarget(readBuffer)\n this.fsQuad.render(renderer)\n }\n\n // Restore renderer settings\n\n renderer.setClearColor(this._oldClearColor, this.oldClearAlpha)\n renderer.autoClear = oldAutoClear\n }\n\n getSeperableBlurMaterial(kernelRadius) {\n return new ShaderMaterial({\n defines: {\n KERNEL_RADIUS: kernelRadius,\n SIGMA: kernelRadius,\n },\n\n uniforms: {\n colorTexture: { value: null },\n texSize: { value: new Vector2(0.5, 0.5) },\n direction: { value: new Vector2(0.5, 0.5) },\n },\n\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n\n fragmentShader: `#include \n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}`,\n })\n }\n\n getCompositeMaterial(nMips) {\n return new ShaderMaterial({\n defines: {\n NUM_MIPS: nMips,\n },\n\n uniforms: {\n blurTexture1: { value: null },\n blurTexture2: { value: null },\n blurTexture3: { value: null },\n blurTexture4: { value: null },\n blurTexture5: { value: null },\n bloomStrength: { value: 1.0 },\n bloomFactors: { value: null },\n bloomTintColors: { value: null },\n bloomRadius: { value: 0.0 },\n },\n\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n\n fragmentShader: `varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}`,\n })\n }\n}\n\nexport { UnrealBloomPass }\n", "import { Matrix4, Vector2 } from 'three'\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type SAOShaderDefines = Record<\n 'DEPTH_PACKING' | 'DIFFUSE_TEXTURE' | 'NORMAL_TEXTURE' | 'NUM_RINGS' | 'NUM_SAMPLES' | 'PERSPECTIVE_CAMERA',\n number\n>\n\nexport type SAOShaderUniforms = {\n bias: IUniform\n cameraFar: IUniform\n cameraInverseProjectionMatrix: IUniform\n cameraNear: IUniform\n cameraProjectionMatrix: IUniform\n intensity: IUniform\n kernelRadius: IUniform\n minResolution: IUniform\n randomSeed: IUniform\n scale: IUniform\n size: IUniform\n tDepth: IUniform\n tDiffuse: IUniform\n tNormal: IUniform\n}\n\nexport interface ISAOShader extends IShader {\n defines: SAOShaderDefines\n needsUpdate?: boolean\n}\n\nexport const SAOShader: ISAOShader = {\n defines: {\n NUM_SAMPLES: 7,\n NUM_RINGS: 4,\n NORMAL_TEXTURE: 0,\n DIFFUSE_TEXTURE: 0,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n uniforms: {\n tDepth: { value: null },\n tDiffuse: { value: null },\n tNormal: { value: null },\n size: { value: new Vector2(512, 512) },\n\n cameraNear: { value: 1 },\n cameraFar: { value: 100 },\n cameraProjectionMatrix: { value: new Matrix4() },\n cameraInverseProjectionMatrix: { value: new Matrix4() },\n\n scale: { value: 1.0 },\n intensity: { value: 0.1 },\n bias: { value: 0.5 },\n\n minResolution: { value: 0.0 },\n kernelRadius: { value: 100.0 },\n randomSeed: { value: 0.0 },\n },\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '}',\n ].join('\\n'),\n fragmentShader: [\n '#include ',\n\n 'varying vec2 vUv;',\n\n '#if DIFFUSE_TEXTURE == 1',\n 'uniform sampler2D tDiffuse;',\n '#endif',\n\n 'uniform sampler2D tDepth;',\n\n '#if NORMAL_TEXTURE == 1',\n 'uniform sampler2D tNormal;',\n '#endif',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n 'uniform mat4 cameraProjectionMatrix;',\n 'uniform mat4 cameraInverseProjectionMatrix;',\n\n 'uniform float scale;',\n 'uniform float intensity;',\n 'uniform float bias;',\n 'uniform float kernelRadius;',\n 'uniform float minResolution;',\n 'uniform vec2 size;',\n 'uniform float randomSeed;',\n\n '// RGBA depth',\n\n '#include ',\n\n 'vec4 getDefaultColor( const in vec2 screenPosition ) {',\n '\t#if DIFFUSE_TEXTURE == 1',\n '\treturn texture2D( tDiffuse, vUv );',\n '\t#else',\n '\treturn vec4( 1.0 );',\n '\t#endif',\n '}',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n '\t#if DEPTH_PACKING == 1',\n '\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );',\n '\t#else',\n '\treturn texture2D( tDepth, screenPosition ).x;',\n '\t#endif',\n '}',\n\n 'float getViewZ( const in float depth ) {',\n '\t#if PERSPECTIVE_CAMERA == 1',\n '\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#else',\n '\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#endif',\n '}',\n\n 'vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {',\n '\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];',\n '\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );',\n '\tclipPosition *= clipW; // unprojection.',\n\n '\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;',\n '}',\n\n 'vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {',\n '\t#if NORMAL_TEXTURE == 1',\n '\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );',\n '\t#else',\n '\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );',\n '\t#endif',\n '}',\n\n 'float scaleDividedByCameraFar;',\n 'float minResolutionMultipliedByCameraFar;',\n\n 'float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {',\n '\tvec3 viewDelta = sampleViewPosition - centerViewPosition;',\n '\tfloat viewDistance = length( viewDelta );',\n '\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;',\n\n '\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );',\n '}',\n\n '// moving costly divides into consts',\n 'const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );',\n 'const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );',\n\n 'float getAmbientOcclusion( const in vec3 centerViewPosition ) {',\n '\t// precompute some variables require in getOcclusion.',\n '\tscaleDividedByCameraFar = scale / cameraFar;',\n '\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;',\n '\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );',\n\n '\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/',\n '\tfloat angle = rand( vUv + randomSeed ) * PI2;',\n '\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;',\n '\tvec2 radiusStep = radius;',\n\n '\tfloat occlusionSum = 0.0;',\n '\tfloat weightSum = 0.0;',\n\n '\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {',\n '\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;',\n '\t\tradius += radiusStep;',\n '\t\tangle += ANGLE_STEP;',\n\n '\t\tfloat sampleDepth = getDepth( sampleUv );',\n '\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {',\n '\t\t\tcontinue;',\n '\t\t}',\n\n '\t\tfloat sampleViewZ = getViewZ( sampleDepth );',\n '\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );',\n '\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );',\n '\t\tweightSum += 1.0;',\n '\t}',\n\n '\tif( weightSum == 0.0 ) discard;',\n\n '\treturn occlusionSum * ( intensity / weightSum );',\n '}',\n\n 'void main() {',\n '\tfloat centerDepth = getDepth( vUv );',\n '\tif( centerDepth >= ( 1.0 - EPSILON ) ) {',\n '\t\tdiscard;',\n '\t}',\n\n '\tfloat centerViewZ = getViewZ( centerDepth );',\n '\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );',\n\n '\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );',\n\n '\tgl_FragColor = getDefaultColor( vUv );',\n '\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;',\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type DepthLimitedBlurShaderDefines = {\n DEPTH_PACKING: number\n KERNEL_RADIUS: number\n PERSPECTIVE_CAMERA: number\n}\n\nexport type DepthLimitedBlurShaderUniforms = {\n cameraFar: IUniform\n cameraNear: IUniform\n depthCutoff: IUniform\n sampleUvOffsets: IUniform\n sampleWeights: IUniform\n size: IUniform\n tDepth: IUniform\n tDiffuse: IUniform\n}\n\nexport interface IDepthLimitedBlurShader\n extends IShader {\n defines: DepthLimitedBlurShaderDefines\n needsUpdate?: boolean\n}\n\nexport const DepthLimitedBlurShader: IDepthLimitedBlurShader = {\n defines: {\n KERNEL_RADIUS: 4,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n uniforms: {\n tDiffuse: { value: null },\n size: { value: new Vector2(512, 512) },\n sampleUvOffsets: { value: [new Vector2(0, 0)] },\n sampleWeights: { value: [1.0] },\n tDepth: { value: null },\n cameraNear: { value: 10 },\n cameraFar: { value: 1000 },\n depthCutoff: { value: 10 },\n },\n vertexShader: [\n '#include ',\n\n 'uniform vec2 size;',\n\n 'varying vec2 vUv;',\n 'varying vec2 vInvSize;',\n\n 'void main() {',\n '\tvUv = uv;',\n '\tvInvSize = 1.0 / size;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '}',\n ].join('\\n'),\n fragmentShader: [\n '#include ',\n '#include ',\n\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tDepth;',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n 'uniform float depthCutoff;',\n\n 'uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];',\n 'uniform float sampleWeights[ KERNEL_RADIUS + 1 ];',\n\n 'varying vec2 vUv;',\n 'varying vec2 vInvSize;',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n '\t#if DEPTH_PACKING == 1',\n '\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );',\n '\t#else',\n '\treturn texture2D( tDepth, screenPosition ).x;',\n '\t#endif',\n '}',\n\n 'float getViewZ( const in float depth ) {',\n '\t#if PERSPECTIVE_CAMERA == 1',\n '\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#else',\n '\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#endif',\n '}',\n\n 'void main() {',\n '\tfloat depth = getDepth( vUv );',\n '\tif( depth >= ( 1.0 - EPSILON ) ) {',\n '\t\tdiscard;',\n '\t}',\n\n '\tfloat centerViewZ = -getViewZ( depth );',\n '\tbool rBreak = false, lBreak = false;',\n\n '\tfloat weightSum = sampleWeights[0];',\n '\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;',\n\n '\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {',\n\n '\t\tfloat sampleWeight = sampleWeights[i];',\n '\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;',\n\n '\t\tvec2 sampleUv = vUv + sampleUvOffset;',\n '\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );',\n\n '\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;',\n\n '\t\tif( ! rBreak ) {',\n '\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;',\n '\t\t\tweightSum += sampleWeight;',\n '\t\t}',\n\n '\t\tsampleUv = vUv - sampleUvOffset;',\n '\t\tviewZ = -getViewZ( getDepth( sampleUv ) );',\n\n '\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;',\n\n '\t\tif( ! lBreak ) {',\n '\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;',\n '\t\t\tweightSum += sampleWeight;',\n '\t\t}',\n\n '\t}',\n\n '\tgl_FragColor = diffuseSum / weightSum;',\n '}',\n ].join('\\n'),\n}\n\nexport const BlurShaderUtils = {\n createSampleWeights: (kernelRadius: number, stdDev: number): number[] => {\n const gaussian = (x: number, stdDev: number): number => {\n return Math.exp(-(x * x) / (2.0 * (stdDev * stdDev))) / (Math.sqrt(2.0 * Math.PI) * stdDev)\n }\n\n const weights: number[] = []\n\n for (let i = 0; i <= kernelRadius; i++) {\n weights.push(gaussian(i, stdDev))\n }\n\n return weights\n },\n\n createSampleOffsets: (kernelRadius: number, uvIncrement: Vector2): Vector2[] => {\n const offsets: Vector2[] = []\n\n for (let i = 0; i <= kernelRadius; i++) {\n offsets.push(uvIncrement.clone().multiplyScalar(i))\n }\n\n return offsets\n },\n\n configure: (shader: IDepthLimitedBlurShader, kernelRadius: number, stdDev: number, uvIncrement: Vector2): void => {\n shader.defines['KERNEL_RADIUS'] = kernelRadius\n shader.uniforms['sampleUvOffsets'].value = BlurShaderUtils.createSampleOffsets(kernelRadius, uvIncrement)\n shader.uniforms['sampleWeights'].value = BlurShaderUtils.createSampleWeights(kernelRadius, stdDev)\n shader.needsUpdate = true\n },\n}\n", "import {\n AddEquation,\n Color,\n CustomBlending,\n DepthTexture,\n DstAlphaFactor,\n DstColorFactor,\n HalfFloatType,\n MeshDepthMaterial,\n MeshNormalMaterial,\n NearestFilter,\n NoBlending,\n RGBADepthPacking,\n ShaderMaterial,\n UniformsUtils,\n UnsignedShortType,\n Vector2,\n WebGLRenderTarget,\n ZeroFactor,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { SAOShader } from '../shaders/SAOShader'\nimport { DepthLimitedBlurShader } from '../shaders/DepthLimitedBlurShader'\nimport { BlurShaderUtils } from '../shaders/DepthLimitedBlurShader'\nimport { CopyShader } from '../shaders/CopyShader'\nimport { UnpackDepthRGBAShader } from '../shaders/UnpackDepthRGBAShader'\n\n/**\n * SAO implementation inspired from bhouston previous SAO work\n */\nclass SAOPass extends Pass {\n static OUTPUT = {\n Beauty: 1,\n Default: 0,\n SAO: 2,\n Depth: 3,\n Normal: 4,\n }\n\n constructor(scene, camera, useDepthTexture = false, useNormals = false, resolution = new Vector2(256, 256)) {\n super()\n\n this.scene = scene\n this.camera = camera\n\n this.clear = true\n this.needsSwap = false\n\n this.supportsDepthTextureExtension = useDepthTexture\n this.supportsNormalTexture = useNormals\n\n this.originalClearColor = new Color()\n this._oldClearColor = new Color()\n this.oldClearAlpha = 1\n\n this.params = {\n output: 0,\n saoBias: 0.5,\n saoIntensity: 0.18,\n saoScale: 1,\n saoKernelRadius: 100,\n saoMinResolution: 0,\n saoBlur: true,\n saoBlurRadius: 8,\n saoBlurStdDev: 4,\n saoBlurDepthCutoff: 0.01,\n }\n\n this.resolution = new Vector2(resolution.x, resolution.y)\n\n this.saoRenderTarget = new WebGLRenderTarget(this.resolution.x, this.resolution.y, { type: HalfFloatType })\n this.blurIntermediateRenderTarget = this.saoRenderTarget.clone()\n this.beautyRenderTarget = this.saoRenderTarget.clone()\n\n this.normalRenderTarget = new WebGLRenderTarget(this.resolution.x, this.resolution.y, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n })\n this.depthRenderTarget = this.normalRenderTarget.clone()\n\n let depthTexture\n\n if (this.supportsDepthTextureExtension) {\n depthTexture = new DepthTexture()\n depthTexture.type = UnsignedShortType\n\n this.beautyRenderTarget.depthTexture = depthTexture\n this.beautyRenderTarget.depthBuffer = true\n }\n\n this.depthMaterial = new MeshDepthMaterial()\n this.depthMaterial.depthPacking = RGBADepthPacking\n this.depthMaterial.blending = NoBlending\n\n this.normalMaterial = new MeshNormalMaterial()\n this.normalMaterial.blending = NoBlending\n\n this.saoMaterial = new ShaderMaterial({\n defines: Object.assign({}, SAOShader.defines),\n fragmentShader: SAOShader.fragmentShader,\n vertexShader: SAOShader.vertexShader,\n uniforms: UniformsUtils.clone(SAOShader.uniforms),\n })\n this.saoMaterial.extensions.derivatives = true\n this.saoMaterial.defines['DEPTH_PACKING'] = this.supportsDepthTextureExtension ? 0 : 1\n this.saoMaterial.defines['NORMAL_TEXTURE'] = this.supportsNormalTexture ? 1 : 0\n this.saoMaterial.defines['PERSPECTIVE_CAMERA'] = this.camera.isPerspectiveCamera ? 1 : 0\n this.saoMaterial.uniforms['tDepth'].value = this.supportsDepthTextureExtension\n ? depthTexture\n : this.depthRenderTarget.texture\n this.saoMaterial.uniforms['tNormal'].value = this.normalRenderTarget.texture\n this.saoMaterial.uniforms['size'].value.set(this.resolution.x, this.resolution.y)\n this.saoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n this.saoMaterial.uniforms['cameraProjectionMatrix'].value = this.camera.projectionMatrix\n this.saoMaterial.blending = NoBlending\n\n this.vBlurMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(DepthLimitedBlurShader.uniforms),\n defines: Object.assign({}, DepthLimitedBlurShader.defines),\n vertexShader: DepthLimitedBlurShader.vertexShader,\n fragmentShader: DepthLimitedBlurShader.fragmentShader,\n })\n this.vBlurMaterial.defines['DEPTH_PACKING'] = this.supportsDepthTextureExtension ? 0 : 1\n this.vBlurMaterial.defines['PERSPECTIVE_CAMERA'] = this.camera.isPerspectiveCamera ? 1 : 0\n this.vBlurMaterial.uniforms['tDiffuse'].value = this.saoRenderTarget.texture\n this.vBlurMaterial.uniforms['tDepth'].value = this.supportsDepthTextureExtension\n ? depthTexture\n : this.depthRenderTarget.texture\n this.vBlurMaterial.uniforms['size'].value.set(this.resolution.x, this.resolution.y)\n this.vBlurMaterial.blending = NoBlending\n\n this.hBlurMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(DepthLimitedBlurShader.uniforms),\n defines: Object.assign({}, DepthLimitedBlurShader.defines),\n vertexShader: DepthLimitedBlurShader.vertexShader,\n fragmentShader: DepthLimitedBlurShader.fragmentShader,\n })\n this.hBlurMaterial.defines['DEPTH_PACKING'] = this.supportsDepthTextureExtension ? 0 : 1\n this.hBlurMaterial.defines['PERSPECTIVE_CAMERA'] = this.camera.isPerspectiveCamera ? 1 : 0\n this.hBlurMaterial.uniforms['tDiffuse'].value = this.blurIntermediateRenderTarget.texture\n this.hBlurMaterial.uniforms['tDepth'].value = this.supportsDepthTextureExtension\n ? depthTexture\n : this.depthRenderTarget.texture\n this.hBlurMaterial.uniforms['size'].value.set(this.resolution.x, this.resolution.y)\n this.hBlurMaterial.blending = NoBlending\n\n this.materialCopy = new ShaderMaterial({\n uniforms: UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n blending: NoBlending,\n })\n this.materialCopy.transparent = true\n this.materialCopy.depthTest = false\n this.materialCopy.depthWrite = false\n this.materialCopy.blending = CustomBlending\n this.materialCopy.blendSrc = DstColorFactor\n this.materialCopy.blendDst = ZeroFactor\n this.materialCopy.blendEquation = AddEquation\n this.materialCopy.blendSrcAlpha = DstAlphaFactor\n this.materialCopy.blendDstAlpha = ZeroFactor\n this.materialCopy.blendEquationAlpha = AddEquation\n\n this.depthCopy = new ShaderMaterial({\n uniforms: UniformsUtils.clone(UnpackDepthRGBAShader.uniforms),\n vertexShader: UnpackDepthRGBAShader.vertexShader,\n fragmentShader: UnpackDepthRGBAShader.fragmentShader,\n blending: NoBlending,\n })\n\n this.fsQuad = new FullScreenQuad(null)\n }\n\n render(renderer, writeBuffer, readBuffer /*, deltaTime, maskActive*/) {\n // Rendering readBuffer first when rendering to screen\n if (this.renderToScreen) {\n this.materialCopy.blending = NoBlending\n this.materialCopy.uniforms['tDiffuse'].value = readBuffer.texture\n this.materialCopy.needsUpdate = true\n this.renderPass(renderer, this.materialCopy, null)\n }\n\n if (this.params.output === 1) {\n return\n }\n\n renderer.getClearColor(this._oldClearColor)\n this.oldClearAlpha = renderer.getClearAlpha()\n const oldAutoClear = renderer.autoClear\n renderer.autoClear = false\n\n renderer.setRenderTarget(this.depthRenderTarget)\n renderer.clear()\n\n this.saoMaterial.uniforms['bias'].value = this.params.saoBias\n this.saoMaterial.uniforms['intensity'].value = this.params.saoIntensity\n this.saoMaterial.uniforms['scale'].value = this.params.saoScale\n this.saoMaterial.uniforms['kernelRadius'].value = this.params.saoKernelRadius\n this.saoMaterial.uniforms['minResolution'].value = this.params.saoMinResolution\n this.saoMaterial.uniforms['cameraNear'].value = this.camera.near\n this.saoMaterial.uniforms['cameraFar'].value = this.camera.far\n // this.saoMaterial.uniforms['randomSeed'].value = Math.random();\n\n const depthCutoff = this.params.saoBlurDepthCutoff * (this.camera.far - this.camera.near)\n this.vBlurMaterial.uniforms['depthCutoff'].value = depthCutoff\n this.hBlurMaterial.uniforms['depthCutoff'].value = depthCutoff\n\n this.vBlurMaterial.uniforms['cameraNear'].value = this.camera.near\n this.vBlurMaterial.uniforms['cameraFar'].value = this.camera.far\n this.hBlurMaterial.uniforms['cameraNear'].value = this.camera.near\n this.hBlurMaterial.uniforms['cameraFar'].value = this.camera.far\n\n this.params.saoBlurRadius = Math.floor(this.params.saoBlurRadius)\n if (this.prevStdDev !== this.params.saoBlurStdDev || this.prevNumSamples !== this.params.saoBlurRadius) {\n BlurShaderUtils.configure(\n this.vBlurMaterial,\n this.params.saoBlurRadius,\n this.params.saoBlurStdDev,\n new Vector2(0, 1),\n )\n BlurShaderUtils.configure(\n this.hBlurMaterial,\n this.params.saoBlurRadius,\n this.params.saoBlurStdDev,\n new Vector2(1, 0),\n )\n this.prevStdDev = this.params.saoBlurStdDev\n this.prevNumSamples = this.params.saoBlurRadius\n }\n\n // Rendering scene to depth texture\n renderer.setClearColor(0x000000)\n renderer.setRenderTarget(this.beautyRenderTarget)\n renderer.clear()\n renderer.render(this.scene, this.camera)\n\n // Re-render scene if depth texture extension is not supported\n if (!this.supportsDepthTextureExtension) {\n // Clear rule : far clipping plane in both RGBA and Basic encoding\n this.renderOverride(renderer, this.depthMaterial, this.depthRenderTarget, 0x000000, 1.0)\n }\n\n if (this.supportsNormalTexture) {\n // Clear rule : default normal is facing the camera\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0)\n }\n\n // Rendering SAO texture\n this.renderPass(renderer, this.saoMaterial, this.saoRenderTarget, 0xffffff, 1.0)\n\n // Blurring SAO texture\n if (this.params.saoBlur) {\n this.renderPass(renderer, this.vBlurMaterial, this.blurIntermediateRenderTarget, 0xffffff, 1.0)\n this.renderPass(renderer, this.hBlurMaterial, this.saoRenderTarget, 0xffffff, 1.0)\n }\n\n let outputMaterial = this.materialCopy\n // Setting up SAO rendering\n if (this.params.output === 3) {\n if (this.supportsDepthTextureExtension) {\n this.materialCopy.uniforms['tDiffuse'].value = this.beautyRenderTarget.depthTexture\n this.materialCopy.needsUpdate = true\n } else {\n this.depthCopy.uniforms['tDiffuse'].value = this.depthRenderTarget.texture\n this.depthCopy.needsUpdate = true\n outputMaterial = this.depthCopy\n }\n } else if (this.params.output === 4) {\n this.materialCopy.uniforms['tDiffuse'].value = this.normalRenderTarget.texture\n this.materialCopy.needsUpdate = true\n } else {\n this.materialCopy.uniforms['tDiffuse'].value = this.saoRenderTarget.texture\n this.materialCopy.needsUpdate = true\n }\n\n // Blending depends on output, only want a CustomBlending when showing SAO\n if (this.params.output === 0) {\n outputMaterial.blending = CustomBlending\n } else {\n outputMaterial.blending = NoBlending\n }\n\n // Rendering SAOPass result on top of previous pass\n this.renderPass(renderer, outputMaterial, this.renderToScreen ? null : readBuffer)\n\n renderer.setClearColor(this._oldClearColor, this.oldClearAlpha)\n renderer.autoClear = oldAutoClear\n }\n\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n // save original state\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n\n // setup pass state\n renderer.autoClear = false\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.fsQuad.material = passMaterial\n this.fsQuad.render(renderer)\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor)\n const originalClearAlpha = renderer.getClearAlpha()\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.overrideMaterial = overrideMaterial\n renderer.render(this.scene, this.camera)\n this.scene.overrideMaterial = null\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n setSize(width, height) {\n this.beautyRenderTarget.setSize(width, height)\n this.saoRenderTarget.setSize(width, height)\n this.blurIntermediateRenderTarget.setSize(width, height)\n this.normalRenderTarget.setSize(width, height)\n this.depthRenderTarget.setSize(width, height)\n\n this.saoMaterial.uniforms['size'].value.set(width, height)\n this.saoMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n this.saoMaterial.uniforms['cameraProjectionMatrix'].value = this.camera.projectionMatrix\n this.saoMaterial.needsUpdate = true\n\n this.vBlurMaterial.uniforms['size'].value.set(width, height)\n this.vBlurMaterial.needsUpdate = true\n\n this.hBlurMaterial.uniforms['size'].value.set(width, height)\n this.hBlurMaterial.needsUpdate = true\n }\n\n dispose() {\n this.saoRenderTarget.dispose()\n this.blurIntermediateRenderTarget.dispose()\n this.beautyRenderTarget.dispose()\n this.normalRenderTarget.dispose()\n this.depthRenderTarget.dispose()\n\n this.depthMaterial.dispose()\n this.normalMaterial.dispose()\n this.saoMaterial.dispose()\n this.vBlurMaterial.dispose()\n this.hBlurMaterial.dispose()\n this.materialCopy.dispose()\n this.depthCopy.dispose()\n\n this.fsQuad.dispose()\n }\n}\n\nexport { SAOPass }\n", "/**\n * Afterimage shader\n * I created this effect inspired by a demo on codepen:\n * https://codepen.io/brunoimbrizi/pen/MoRJaN?page=1&\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type AfterimageShaderUniforms = {\n damp: IUniform\n tNew: IUniform\n tOld: IUniform\n}\n\nexport interface IAfterimageShader extends IShader {}\n\nexport const AfterimageShader: IAfterimageShader = {\n uniforms: {\n damp: { value: 0.96 },\n tOld: { value: null },\n tNew: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float damp;',\n\n 'uniform sampler2D tOld;',\n 'uniform sampler2D tNew;',\n\n 'varying vec2 vUv;',\n\n 'vec4 when_gt( vec4 x, float y ) {',\n\n '\treturn max( sign( x - y ), 0.0 );',\n\n '}',\n\n 'void main() {',\n\n '\tvec4 texelOld = texture2D( tOld, vUv );',\n '\tvec4 texelNew = texture2D( tNew, vUv );',\n\n '\ttexelOld *= damp * when_gt( texelOld, 0.1 );',\n\n '\tgl_FragColor = max(texelNew, texelOld);',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Dot screen shader\n * based on glfx.js sepia shader\n * https://github.com/evanw/glfx.js\n */\n\nexport const DotScreenShader = {\n uniforms: {\n tDiffuse: { value: null },\n tSize: { value: new Vector2(256, 256) },\n center: { value: new Vector2(0.5, 0.5) },\n angle: { value: 1.57 },\n scale: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec2 center;',\n 'uniform float angle;',\n 'uniform float scale;',\n 'uniform vec2 tSize;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'float pattern() {',\n\n '\tfloat s = sin( angle ), c = cos( angle );',\n\n '\tvec2 tex = vUv * tSize - center;',\n '\tvec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;',\n\n '\treturn ( sin( point.x ) * sin( point.y ) ) * 4.0;',\n\n '}',\n\n 'void main() {',\n\n '\tvec4 color = texture2D( tDiffuse, vUv );',\n\n '\tfloat average = ( color.r + color.g + color.b ) / 3.0;',\n\n '\tgl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Matrix4, Vector2 } from 'three'\n/**\n * References:\n * https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html\n */\n\nexport const SSRShader = {\n defines: {\n MAX_STEP: 0,\n isPerspectiveCamera: true,\n isDistanceAttenuation: true,\n isFresnel: true,\n isInfiniteThick: false,\n isSelective: false,\n },\n\n uniforms: {\n tDiffuse: { value: null },\n tNormal: { value: null },\n tMetalness: { value: null },\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n resolution: { value: new Vector2() },\n cameraProjectionMatrix: { value: new Matrix4() },\n cameraInverseProjectionMatrix: { value: new Matrix4() },\n opacity: { value: 0.5 },\n maxDistance: { value: 180 },\n cameraRange: { value: 0 },\n surfDist: { value: 0.007 },\n thickTolerance: { value: 0.03 },\n },\n\n vertexShader: /* glsl */ `\n\n varying vec2 vUv;\n\n void main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `,\n\n fragmentShader: /* glsl */ `\n\t\t// precision highp float;\n\t\tprecision highp sampler2D;\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tDepth;\n\t\tuniform sampler2D tNormal;\n\t\tuniform sampler2D tMetalness;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float cameraRange;\n\t\tuniform vec2 resolution;\n\t\tuniform float opacity;\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n\t\tuniform float maxDistance;\n\t\tuniform float surfDist;\n\t\tuniform mat4 cameraProjectionMatrix;\n\t\tuniform mat4 cameraInverseProjectionMatrix;\n\t\tuniform float thickTolerance;\n\t\t#include \n\t\tfloat pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {\n\t\t\t//x0: point, x1: linePointA, x2: linePointB\n\t\t\t//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html\n\t\t\treturn length(cross(x0-x1,x0-x2))/length(x2-x1);\n\t\t}\n\t\tfloat pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){\n\t\t\t// https://mathworld.wolfram.com/Point-PlaneDistance.html\n\t\t\t//// https://en.wikipedia.org/wiki/Plane_(geometry)\n\t\t\t//// http://paulbourke.net/geometry/pointlineplane/\n\t\t\tfloat a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;\n\t\t\tfloat x0=point.x,y0=point.y,z0=point.z;\n\t\t\tfloat x=planePoint.x,y=planePoint.y,z=planePoint.z;\n\t\t\tfloat d=-(a*x+b*y+c*z);\n\t\t\tfloat distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);\n\t\t\treturn distance;\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#else\n\t\t\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#endif\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view\n\t\t}\n\t\tvec3 getViewNormal( const in vec2 uv ) {\n\t\t\treturn unpackRGBToNormal( texture2D( tNormal, uv ).xyz );\n\t\t}\n\t\tvec2 viewPositionToXY(vec3 viewPosition){\n\t\t\tvec2 xy;\n\t\t\tvec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);\n\t\t\txy=clip.xy;//clip\n\t\t\tfloat clipW=clip.w;\n\t\t\txy/=clipW;//NDC\n\t\t\txy=(xy+1.)/2.;//uv\n\t\t\txy*=resolution;//screen\n\t\t\treturn xy;\n\t\t}\n\t\tvoid main(){\n\t\t\t#ifdef isSelective\n\t\t\t\tfloat metalness=texture2D(tMetalness,vUv).r;\n\t\t\t\tif(metalness==0.) return;\n\t\t\t#endif\n\n\t\t\tfloat depth = getDepth( vUv );\n\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\tif(-viewZ>=cameraFar) return;\n\n\t\t\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];\n\t\t\tvec3 viewPosition=getViewPosition( vUv, depth, clipW );\n\n\t\t\tvec2 d0=gl_FragCoord.xy;\n\t\t\tvec2 d1;\n\n\t\t\tvec3 viewNormal=getViewNormal( vUv );\n\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tvec3 viewIncidenceDir=normalize(viewPosition);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#else\n\t\t\t\tvec3 viewIncidenceDir=vec3(0,0,-1);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#endif\n\n\t\t\tfloat maxReflectRayLen=maxDistance/dot(-viewIncidenceDir,viewNormal);\n\t\t\t// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html\n\t\t\t// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen=cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen==dot(a,b)\n\t\t\t// maxReflectRayLen==maxDistance/dot(a,b)\n\n\t\t\tvec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tif(d1viewPosition.z>-cameraNear){\n\t\t\t\t\t//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx\n\t\t\t\t\tfloat t=(-cameraNear-viewPosition.z)/viewReflectDir.z;\n\t\t\t\t\td1viewPosition=viewPosition+viewReflectDir*t;\n\t\t\t\t}\n\t\t\t#endif\n\t\t\td1=viewPositionToXY(d1viewPosition);\n\n\t\t\tfloat totalLen=length(d1-d0);\n\t\t\tfloat xLen=d1.x-d0.x;\n\t\t\tfloat yLen=d1.y-d0.y;\n\t\t\tfloat totalStep=max(abs(xLen),abs(yLen));\n\t\t\tfloat xSpan=xLen/totalStep;\n\t\t\tfloat ySpan=yLen/totalStep;\n\t\t\tfor(float i=0.;i=totalStep) break;\n\t\t\t\tvec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);\n\t\t\t\tif(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;\n\t\t\t\tfloat s=length(xy-d0)/totalLen;\n\t\t\t\tvec2 uv=xy/resolution;\n\n\t\t\t\tfloat d = getDepth(uv);\n\t\t\t\tfloat vZ = getViewZ( d );\n\t\t\t\tif(-vZ>=cameraFar) continue;\n\t\t\t\tfloat cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];\n\t\t\t\tvec3 vP=getViewPosition( uv, d, cW );\n\n\t\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\t\t// https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf\n\t\t\t\t\tfloat recipVPZ=1./viewPosition.z;\n\t\t\t\t\tfloat viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));\n\t\t\t\t\tfloat sD=surfDist*cW;\n\t\t\t\t#else\n\t\t\t\t\tfloat viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);\n\t\t\t\t\tfloat sD=surfDist;\n\t\t\t\t#endif\n\t\t\t\tif(viewReflectRayZ-sD>vZ) continue;\n\n\t\t\t\t#ifdef isInfiniteThick\n\t\t\t\t\tif(viewReflectRayZ+thickTolerance*clipW=0.) continue;\n\t\t\t\t\tfloat distance=pointPlaneDistance(vP,viewPosition,viewNormal);\n\t\t\t\t\tif(distance>maxDistance) break;\n\t\t\t\t\t#ifdef isDistanceAttenuation\n\t\t\t\t\t\tfloat ratio=1.-(distance/maxDistance);\n\t\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t\t#endif\n\t\t\t\t\t#ifdef isFresnel\n\t\t\t\t\t\tfloat fresnel=(dot(viewIncidenceDir,viewReflectDir)+1.)/2.;\n\t\t\t\t\t\top*=fresnel;\n\t\t\t\t\t#endif\n\t\t\t\t\tvec4 reflectColor=texture2D(tDiffuse,uv);\n\t\t\t\t\tgl_FragColor.xyz=reflectColor.xyz;\n\t\t\t\t\tgl_FragColor.a=op;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t`,\n}\n\nexport const SSRDepthShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1,\n },\n\n uniforms: {\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n },\n\n vertexShader: /* glsl */ `\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `,\n\n fragmentShader: /* glsl */ `\n\n uniform sampler2D tDepth;\n\n uniform float cameraNear;\n uniform float cameraFar;\n\n varying vec2 vUv;\n\n #include \n\n\t\tfloat getLinearDepth( const in vec2 uv ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\tfloat fragCoordZ = texture2D( tDepth, uv ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn texture2D( tDepth, uv ).x;\n\n\t\t\t#endif\n\n\t\t}\n\n void main() {\n\n \tfloat depth = getLinearDepth( vUv );\n\t\t\tfloat d = 1.0 - depth;\n\t\t\t// d=(d-.999)*1000.;\n \tgl_FragColor = vec4( vec3( d ), 1.0 );\n\n }\n\n `,\n}\n\nexport const SSRBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2() },\n opacity: { value: 0.5 },\n },\n\n vertexShader: /* glsl */ `\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `,\n\n fragmentShader: /* glsl */ `\n\n uniform sampler2D tDiffuse;\n uniform vec2 resolution;\n varying vec2 vUv;\n void main() {\n\t\t\t//reverse engineering from PhotoShop blur filter, then change coefficient\n\n \tvec2 texelSize = ( 1.0 / resolution );\n\n\t\t\tvec4 c=texture2D(tDiffuse,vUv);\n\n\t\t\tvec2 offset;\n\n\t\t\toffset=(vec2(-1,0))*texelSize;\n\t\t\tvec4 cl=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(1,0))*texelSize;\n\t\t\tvec4 cr=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,-1))*texelSize;\n\t\t\tvec4 cb=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,1))*texelSize;\n\t\t\tvec4 ct=texture2D(tDiffuse,vUv+offset);\n\n\t\t\t// float coeCenter=.5;\n\t\t\t// float coeSide=.125;\n\t\t\tfloat coeCenter=.2;\n\t\t\tfloat coeSide=.2;\n\t\t\tfloat a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;\n\t\t\tvec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;\n\t\t\tgl_FragColor=vec4(rgb,a);\n\n\t\t}\n\t`,\n}\n", "import {\n AddEquation,\n Color,\n NormalBlending,\n DepthTexture,\n SrcAlphaFactor,\n OneMinusSrcAlphaFactor,\n MeshNormalMaterial,\n MeshBasicMaterial,\n NearestFilter,\n NoBlending,\n ShaderMaterial,\n UniformsUtils,\n UnsignedShortType,\n WebGLRenderTarget,\n HalfFloatType,\n} from 'three'\nimport { Pass, FullScreenQuad } from './Pass'\nimport { SSRShader } from '../shaders/SSRShader'\nimport { SSRBlurShader } from '../shaders/SSRShader'\nimport { SSRDepthShader } from '../shaders/SSRShader'\nimport { CopyShader } from '../shaders/CopyShader'\n\nclass SSRPass extends Pass {\n static OUTPUT = {\n Default: 0,\n SSR: 1,\n Beauty: 3,\n Depth: 4,\n Normal: 5,\n Metalness: 7,\n }\n constructor({ renderer, scene, camera, width, height, selects, bouncing = false, groundReflector }) {\n super()\n\n this.width = width !== undefined ? width : 512\n this.height = height !== undefined ? height : 512\n\n this.clear = true\n\n this.renderer = renderer\n this.scene = scene\n this.camera = camera\n this.groundReflector = groundReflector\n\n this.opacity = SSRShader.uniforms.opacity.value\n this.output = 0\n\n this.maxDistance = SSRShader.uniforms.maxDistance.value\n this.thickness = SSRShader.uniforms.thickness.value\n\n this.tempColor = new Color()\n\n this._selects = selects\n this.selective = Array.isArray(this._selects)\n Object.defineProperty(this, 'selects', {\n get() {\n return this._selects\n },\n set(val) {\n if (this._selects === val) return\n this._selects = val\n if (Array.isArray(val)) {\n this.selective = true\n this.ssrMaterial.defines.SELECTIVE = true\n this.ssrMaterial.needsUpdate = true\n } else {\n this.selective = false\n this.ssrMaterial.defines.SELECTIVE = false\n this.ssrMaterial.needsUpdate = true\n }\n },\n })\n\n this._bouncing = bouncing\n Object.defineProperty(this, 'bouncing', {\n get() {\n return this._bouncing\n },\n set(val) {\n if (this._bouncing === val) return\n this._bouncing = val\n if (val) {\n this.ssrMaterial.uniforms['tDiffuse'].value = this.prevRenderTarget.texture\n } else {\n this.ssrMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n }\n },\n })\n\n this.blur = true\n\n this._distanceAttenuation = SSRShader.defines.DISTANCE_ATTENUATION\n Object.defineProperty(this, 'distanceAttenuation', {\n get() {\n return this._distanceAttenuation\n },\n set(val) {\n if (this._distanceAttenuation === val) return\n this._distanceAttenuation = val\n this.ssrMaterial.defines.DISTANCE_ATTENUATION = val\n this.ssrMaterial.needsUpdate = true\n },\n })\n\n this._fresnel = SSRShader.defines.FRESNEL\n Object.defineProperty(this, 'fresnel', {\n get() {\n return this._fresnel\n },\n set(val) {\n if (this._fresnel === val) return\n this._fresnel = val\n this.ssrMaterial.defines.FRESNEL = val\n this.ssrMaterial.needsUpdate = true\n },\n })\n\n this._infiniteThick = SSRShader.defines.INFINITE_THICK\n Object.defineProperty(this, 'infiniteThick', {\n get() {\n return this._infiniteThick\n },\n set(val) {\n if (this._infiniteThick === val) return\n this._infiniteThick = val\n this.ssrMaterial.defines.INFINITE_THICK = val\n this.ssrMaterial.needsUpdate = true\n },\n })\n\n // beauty render target with depth buffer\n\n const depthTexture = new DepthTexture()\n depthTexture.type = UnsignedShortType\n depthTexture.minFilter = NearestFilter\n depthTexture.magFilter = NearestFilter\n\n this.beautyRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n depthTexture: depthTexture,\n depthBuffer: true,\n })\n\n //for bouncing\n this.prevRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n })\n\n // normal render target\n\n this.normalRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n })\n\n // metalness render target\n\n this.metalnessRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n type: HalfFloatType,\n })\n\n // ssr render target\n\n this.ssrRenderTarget = new WebGLRenderTarget(this.width, this.height, {\n minFilter: NearestFilter,\n magFilter: NearestFilter,\n })\n\n this.blurRenderTarget = this.ssrRenderTarget.clone()\n this.blurRenderTarget2 = this.ssrRenderTarget.clone()\n // this.blurRenderTarget3 = this.ssrRenderTarget.clone();\n\n // ssr material\n\n this.ssrMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSRShader.defines, {\n MAX_STEP: Math.sqrt(this.width * this.width + this.height * this.height),\n }),\n uniforms: UniformsUtils.clone(SSRShader.uniforms),\n vertexShader: SSRShader.vertexShader,\n fragmentShader: SSRShader.fragmentShader,\n blending: NoBlending,\n })\n\n this.ssrMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.ssrMaterial.uniforms['tNormal'].value = this.normalRenderTarget.texture\n this.ssrMaterial.defines.SELECTIVE = this.selective\n this.ssrMaterial.needsUpdate = true\n this.ssrMaterial.uniforms['tMetalness'].value = this.metalnessRenderTarget.texture\n this.ssrMaterial.uniforms['tDepth'].value = this.beautyRenderTarget.depthTexture\n this.ssrMaterial.uniforms['cameraNear'].value = this.camera.near\n this.ssrMaterial.uniforms['cameraFar'].value = this.camera.far\n this.ssrMaterial.uniforms['thickness'].value = this.thickness\n this.ssrMaterial.uniforms['resolution'].value.set(this.width, this.height)\n this.ssrMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssrMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n // normal material\n\n this.normalMaterial = new MeshNormalMaterial()\n this.normalMaterial.blending = NoBlending\n\n // metalnessOn material\n\n this.metalnessOnMaterial = new MeshBasicMaterial({\n color: 'white',\n })\n\n // metalnessOff material\n\n this.metalnessOffMaterial = new MeshBasicMaterial({\n color: 'black',\n })\n\n // blur material\n\n this.blurMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSRBlurShader.defines),\n uniforms: UniformsUtils.clone(SSRBlurShader.uniforms),\n vertexShader: SSRBlurShader.vertexShader,\n fragmentShader: SSRBlurShader.fragmentShader,\n })\n this.blurMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.blurMaterial.uniforms['resolution'].value.set(this.width, this.height)\n\n // blur material 2\n\n this.blurMaterial2 = new ShaderMaterial({\n defines: Object.assign({}, SSRBlurShader.defines),\n uniforms: UniformsUtils.clone(SSRBlurShader.uniforms),\n vertexShader: SSRBlurShader.vertexShader,\n fragmentShader: SSRBlurShader.fragmentShader,\n })\n this.blurMaterial2.uniforms['tDiffuse'].value = this.blurRenderTarget.texture\n this.blurMaterial2.uniforms['resolution'].value.set(this.width, this.height)\n\n // // blur material 3\n\n // this.blurMaterial3 = new ShaderMaterial({\n // defines: Object.assign({}, SSRBlurShader.defines),\n // uniforms: UniformsUtils.clone(SSRBlurShader.uniforms),\n // vertexShader: SSRBlurShader.vertexShader,\n // fragmentShader: SSRBlurShader.fragmentShader\n // });\n // this.blurMaterial3.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture;\n // this.blurMaterial3.uniforms['resolution'].value.set(this.width, this.height);\n\n // material for rendering the depth\n\n this.depthRenderMaterial = new ShaderMaterial({\n defines: Object.assign({}, SSRDepthShader.defines),\n uniforms: UniformsUtils.clone(SSRDepthShader.uniforms),\n vertexShader: SSRDepthShader.vertexShader,\n fragmentShader: SSRDepthShader.fragmentShader,\n blending: NoBlending,\n })\n this.depthRenderMaterial.uniforms['tDepth'].value = this.beautyRenderTarget.depthTexture\n this.depthRenderMaterial.uniforms['cameraNear'].value = this.camera.near\n this.depthRenderMaterial.uniforms['cameraFar'].value = this.camera.far\n\n // material for rendering the content of a render target\n\n this.copyMaterial = new ShaderMaterial({\n uniforms: UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n blendSrc: SrcAlphaFactor,\n blendDst: OneMinusSrcAlphaFactor,\n blendEquation: AddEquation,\n blendSrcAlpha: SrcAlphaFactor,\n blendDstAlpha: OneMinusSrcAlphaFactor,\n blendEquationAlpha: AddEquation,\n // premultipliedAlpha:true,\n })\n\n this.fsQuad = new FullScreenQuad(null)\n\n this.originalClearColor = new Color()\n }\n\n dispose() {\n // dispose render targets\n\n this.beautyRenderTarget.dispose()\n this.prevRenderTarget.dispose()\n this.normalRenderTarget.dispose()\n this.metalnessRenderTarget.dispose()\n this.ssrRenderTarget.dispose()\n this.blurRenderTarget.dispose()\n this.blurRenderTarget2.dispose()\n // this.blurRenderTarget3.dispose();\n\n // dispose materials\n\n this.normalMaterial.dispose()\n this.metalnessOnMaterial.dispose()\n this.metalnessOffMaterial.dispose()\n this.blurMaterial.dispose()\n this.blurMaterial2.dispose()\n this.copyMaterial.dispose()\n this.depthRenderMaterial.dispose()\n\n // dipsose full screen quad\n\n this.fsQuad.dispose()\n }\n\n render(renderer, writeBuffer /*, readBuffer, deltaTime, maskActive */) {\n // render beauty and depth\n\n renderer.setRenderTarget(this.beautyRenderTarget)\n renderer.clear()\n if (this.groundReflector) {\n this.groundReflector.visible = false\n this.groundReflector.doRender(this.renderer, this.scene, this.camera)\n this.groundReflector.visible = true\n }\n\n renderer.render(this.scene, this.camera)\n if (this.groundReflector) this.groundReflector.visible = false\n\n // render normals\n\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 0, 0)\n\n // render metalnesses\n\n if (this.selective) {\n this.renderMetalness(renderer, this.metalnessOnMaterial, this.metalnessRenderTarget, 0, 0)\n }\n\n // render SSR\n\n this.ssrMaterial.uniforms['opacity'].value = this.opacity\n this.ssrMaterial.uniforms['maxDistance'].value = this.maxDistance\n this.ssrMaterial.uniforms['thickness'].value = this.thickness\n this.renderPass(renderer, this.ssrMaterial, this.ssrRenderTarget)\n\n // render blur\n\n if (this.blur) {\n this.renderPass(renderer, this.blurMaterial, this.blurRenderTarget)\n this.renderPass(renderer, this.blurMaterial2, this.blurRenderTarget2)\n // this.renderPass(renderer, this.blurMaterial3, this.blurRenderTarget3);\n }\n\n // output result to screen\n\n switch (this.output) {\n case SSRPass.OUTPUT.Default:\n if (this.bouncing) {\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NormalBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n\n this.copyMaterial.uniforms['tDiffuse'].value = this.prevRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n } else {\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NormalBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n }\n\n break\n case SSRPass.OUTPUT.SSR:\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n if (this.bouncing) {\n if (this.blur) this.copyMaterial.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture\n else this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n\n this.copyMaterial.uniforms['tDiffuse'].value = this.ssrRenderTarget.texture\n this.copyMaterial.blending = NormalBlending\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget)\n }\n\n break\n\n case SSRPass.OUTPUT.Beauty:\n this.copyMaterial.uniforms['tDiffuse'].value = this.beautyRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSRPass.OUTPUT.Depth:\n this.renderPass(renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSRPass.OUTPUT.Normal:\n this.copyMaterial.uniforms['tDiffuse'].value = this.normalRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n case SSRPass.OUTPUT.Metalness:\n this.copyMaterial.uniforms['tDiffuse'].value = this.metalnessRenderTarget.texture\n this.copyMaterial.blending = NoBlending\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer)\n\n break\n\n default:\n console.warn('THREE.SSRPass: Unknown output type.')\n }\n }\n\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n // save original state\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor))\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor)\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n\n // setup pass state\n renderer.autoClear = false\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.fsQuad.material = passMaterial\n this.fsQuad.render(renderer)\n\n // restore original state\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor))\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor)\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.overrideMaterial = overrideMaterial\n renderer.render(this.scene, this.camera)\n this.scene.overrideMaterial = null\n\n // restore original state\n\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n renderMetalness(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor))\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor)\n const originalAutoClear = renderer.autoClear\n\n renderer.setRenderTarget(renderTarget)\n renderer.autoClear = false\n\n clearColor = overrideMaterial.clearColor || clearColor\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha\n\n if (clearColor !== undefined && clearColor !== null) {\n renderer.setClearColor(clearColor)\n renderer.setClearAlpha(clearAlpha || 0.0)\n renderer.clear()\n }\n\n this.scene.traverseVisible((child) => {\n child._SSRPassBackupMaterial = child.material\n if (this._selects.includes(child)) {\n child.material = this.metalnessOnMaterial\n } else {\n child.material = this.metalnessOffMaterial\n }\n })\n renderer.render(this.scene, this.camera)\n this.scene.traverseVisible((child) => {\n child.material = child._SSRPassBackupMaterial\n })\n\n // restore original state\n\n renderer.autoClear = originalAutoClear\n renderer.setClearColor(this.originalClearColor)\n renderer.setClearAlpha(originalClearAlpha)\n }\n\n setSize(width, height) {\n this.width = width\n this.height = height\n\n this.ssrMaterial.defines.MAX_STEP = Math.sqrt(width * width + height * height)\n this.ssrMaterial.needsUpdate = true\n this.beautyRenderTarget.setSize(width, height)\n this.prevRenderTarget.setSize(width, height)\n this.ssrRenderTarget.setSize(width, height)\n this.normalRenderTarget.setSize(width, height)\n this.metalnessRenderTarget.setSize(width, height)\n this.blurRenderTarget.setSize(width, height)\n this.blurRenderTarget2.setSize(width, height)\n // this.blurRenderTarget3.setSize(width, height);\n\n this.ssrMaterial.uniforms['resolution'].value.set(width, height)\n this.ssrMaterial.uniforms['cameraProjectionMatrix'].value.copy(this.camera.projectionMatrix)\n this.ssrMaterial.uniforms['cameraInverseProjectionMatrix'].value.copy(this.camera.projectionMatrixInverse)\n\n this.blurMaterial.uniforms['resolution'].value.set(width, height)\n this.blurMaterial2.uniforms['resolution'].value.set(width, height)\n }\n}\n\nexport { SSRPass }\n", "import { Vector2 } from 'three'\n\n/**\n * Convolution shader\n * ported from o3d sample to WebGL / GLSL\n * http://o3d.googlecode.com/svn/trunk/samples/convolution.html\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type ConvolutionShaderDefines = {\n KERNEL_SIZE_FLOAT: string\n KERNEL_SIZE_INT: string\n}\n\nexport type ConvolutionShaderUniforms = {\n cKernel: IUniform\n tDiffuse: IUniform\n uImageIncrement: IUniform\n}\n\nexport interface IConvolutionShader extends IShader {\n buildKernel: (sigma: number) => number[]\n}\n\nexport const ConvolutionShader: IConvolutionShader = {\n defines: {\n KERNEL_SIZE_FLOAT: '25.0',\n KERNEL_SIZE_INT: '25',\n },\n\n uniforms: {\n tDiffuse: { value: null },\n uImageIncrement: { value: new Vector2(0.001953125, 0.0) },\n cKernel: { value: [] },\n },\n\n vertexShader: [\n 'uniform vec2 uImageIncrement;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float cKernel[ KERNEL_SIZE_INT ];',\n\n 'uniform sampler2D tDiffuse;',\n 'uniform vec2 uImageIncrement;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 imageCoord = vUv;',\n '\tvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );',\n\n '\tfor( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {',\n\n '\t\tsum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];',\n '\t\timageCoord += uImageIncrement;',\n\n '\t}',\n\n '\tgl_FragColor = sum;',\n\n '}',\n ].join('\\n'),\n\n buildKernel: function (sigma) {\n // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway.\n\n function gauss(x: number, sigma: number): number {\n return Math.exp(-(x * x) / (2.0 * sigma * sigma))\n }\n\n const kMaxKernelSize = 25\n\n const kernelSize = Math.min(2 * Math.ceil(sigma * 3.0) + 1, kMaxKernelSize)\n\n const halfWidth = (kernelSize - 1) * 0.5\n\n const values: number[] = new Array(kernelSize)\n\n let sum = 0.0\n\n for (let i = 0; i < kernelSize; ++i) {\n values[i] = gauss(i - halfWidth, sigma)\n sum += values[i]\n }\n\n // normalize the kernel\n\n for (let i = 0; i < kernelSize; ++i) values[i] /= sum\n\n return values\n },\n}\n", "import { WebGLRenderer } from 'three'\n\nclass ARButton {\n static createButton(renderer: WebGLRenderer, sessionInit: XRSessionInit = {}): HTMLButtonElement | HTMLAnchorElement {\n const button = document.createElement('button')\n\n function showStartAR(/*device*/): void {\n if ((sessionInit as any).domOverlay === undefined) {\n const overlay = document.createElement('div')\n overlay.style.display = 'none'\n document.body.appendChild(overlay)\n\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')\n svg.setAttribute('width', '38px')\n svg.setAttribute('height', '38px')\n svg.style.position = 'absolute'\n svg.style.right = '20px'\n svg.style.top = '20px'\n svg.addEventListener('click', function () {\n currentSession?.end()\n })\n overlay.appendChild(svg)\n\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')\n path.setAttribute('d', 'M 12,12 L 28,28 M 28,12 12,28')\n path.setAttribute('stroke', '#fff')\n path.setAttribute('stroke-width', '2px')\n svg.appendChild(path)\n\n if (sessionInit.optionalFeatures === undefined) {\n sessionInit.optionalFeatures = []\n }\n\n sessionInit.optionalFeatures.push('dom-overlay')\n ;(sessionInit as any).domOverlay = { root: overlay }\n }\n\n //\n\n let currentSession: XRSession | null = null\n\n async function onSessionStarted(session: XRSession): Promise {\n session.addEventListener('end', onSessionEnded)\n\n renderer.xr.setReferenceSpaceType('local')\n\n await renderer.xr.setSession(session as any)\n\n button.textContent = 'STOP AR'\n ;(sessionInit as any).domOverlay!.root.style.display = ''\n\n currentSession = session\n }\n\n function onSessionEnded(/*event*/): void {\n currentSession!.removeEventListener('end', onSessionEnded)\n\n button.textContent = 'START AR'\n ;(sessionInit as any).domOverlay!.root.style.display = 'none'\n\n currentSession = null\n }\n\n //\n\n button.style.display = ''\n\n button.style.cursor = 'pointer'\n button.style.left = 'calc(50% - 50px)'\n button.style.width = '100px'\n\n button.textContent = 'START AR'\n\n button.onmouseenter = (): void => {\n button.style.opacity = '1.0'\n }\n\n button.onmouseleave = (): void => {\n button.style.opacity = '0.5'\n }\n\n button.onclick = (): void => {\n if (currentSession === null) {\n ;(navigator as Navigator).xr!.requestSession('immersive-ar', sessionInit).then(onSessionStarted)\n } else {\n currentSession.end()\n }\n }\n }\n\n function disableButton(): void {\n button.style.display = ''\n\n button.style.cursor = 'auto'\n button.style.left = 'calc(50% - 75px)'\n button.style.width = '150px'\n\n button.onmouseenter = null\n button.onmouseleave = null\n\n button.onclick = null\n }\n\n function showARNotSupported(): void {\n disableButton()\n\n button.textContent = 'AR NOT SUPPORTED'\n }\n\n function stylizeElement(element: HTMLElement): void {\n element.style.position = 'absolute'\n element.style.bottom = '20px'\n element.style.padding = '12px 6px'\n element.style.border = '1px solid #fff'\n element.style.borderRadius = '4px'\n element.style.background = 'rgba(0,0,0,0.1)'\n element.style.color = '#fff'\n element.style.font = 'normal 13px sans-serif'\n element.style.textAlign = 'center'\n element.style.opacity = '0.5'\n element.style.outline = 'none'\n element.style.zIndex = '999'\n }\n\n if ('xr' in navigator) {\n button.id = 'ARButton'\n button.style.display = 'none'\n\n stylizeElement(button)\n\n // Query for session mode\n ;(navigator as Navigator)\n .xr!.isSessionSupported('immersive-ar')\n .then(function (supported: boolean) {\n supported ? showStartAR() : showARNotSupported()\n })\n .catch(showARNotSupported)\n\n return button\n } else {\n const message = document.createElement('a')\n\n if (window.isSecureContext === false) {\n message.href = document.location.href.replace(/^http:/, 'https:')\n message.innerHTML = 'WEBXR NEEDS HTTPS' // TODO Improve message\n } else {\n message.href = 'https://immersiveweb.dev/'\n message.innerHTML = 'WEBXR NOT AVAILABLE'\n }\n\n message.style.left = 'calc(50% - 90px)'\n message.style.width = '180px'\n message.style.textDecoration = 'none'\n\n stylizeElement(message)\n\n return message\n }\n }\n}\n\nexport { ARButton }\n", "export function decodeText(array) {\n if (typeof TextDecoder !== 'undefined') {\n return new TextDecoder().decode(array)\n }\n\n // Avoid the String.fromCharCode.apply(null, array) shortcut, which\n // throws a \"maximum call stack size exceeded\" error for large arrays.\n\n let s = ''\n\n for (let i = 0, il = array.length; i < il; i++) {\n // Implicitly assumes little-endian.\n s += String.fromCharCode(array[i])\n }\n\n try {\n // merges multi-byte utf-8 characters.\n\n return decodeURIComponent(escape(s))\n } catch (e) {\n // see https://github.com/mrdoob/three.js/issues/16358\n\n return s\n }\n}\n", "import {\n AnimationClip,\n Bone,\n Box3,\n BufferAttribute,\n BufferGeometry,\n ClampToEdgeWrapping,\n Color,\n DirectionalLight,\n DoubleSide,\n FileLoader,\n FrontSide,\n Group,\n ImageBitmapLoader,\n InstancedMesh,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n Interpolant,\n InterpolateDiscrete,\n InterpolateLinear,\n Line,\n LineBasicMaterial,\n LineLoop,\n LineSegments,\n LinearFilter,\n LinearMipmapLinearFilter,\n LinearMipmapNearestFilter,\n Loader,\n LoaderUtils,\n Material,\n MathUtils,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n MeshPhysicalMaterial,\n MeshStandardMaterial,\n MirroredRepeatWrapping,\n NearestFilter,\n NearestMipmapLinearFilter,\n NearestMipmapNearestFilter,\n NumberKeyframeTrack,\n Object3D,\n OrthographicCamera,\n PerspectiveCamera,\n PointLight,\n Points,\n PointsMaterial,\n PropertyBinding,\n Quaternion,\n QuaternionKeyframeTrack,\n RepeatWrapping,\n Skeleton,\n SkinnedMesh,\n Sphere,\n SpotLight,\n Texture,\n TextureLoader,\n TriangleFanDrawMode,\n TriangleStripDrawMode,\n Vector2,\n Vector3,\n VectorKeyframeTrack,\n InstancedBufferAttribute,\n} from 'three'\nimport { toTrianglesDrawMode } from '../utils/BufferGeometryUtils'\nimport { version } from '../_polyfill/constants'\nimport { decodeText } from '../_polyfill/LoaderUtils'\n\nconst SRGBColorSpace = 'srgb'\nconst LinearSRGBColorSpace = 'srgb-linear'\nconst sRGBEncoding = 3001\nconst LinearEncoding = 3000\n\nclass GLTFLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n this.dracoLoader = null\n this.ktx2Loader = null\n this.meshoptDecoder = null\n\n this.pluginCallbacks = []\n\n this.register(function (parser) {\n return new GLTFMaterialsClearcoatExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsDispersionExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFTextureBasisUExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFTextureWebPExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFTextureAVIFExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsSheenExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsTransmissionExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsVolumeExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsIorExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsEmissiveStrengthExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsSpecularExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsIridescenceExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsAnisotropyExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMaterialsBumpExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFLightsExtension(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMeshoptCompression(parser)\n })\n\n this.register(function (parser) {\n return new GLTFMeshGpuInstancing(parser)\n })\n }\n\n load(url, onLoad, onProgress, onError) {\n const scope = this\n\n let resourcePath\n\n if (this.resourcePath !== '') {\n resourcePath = this.resourcePath\n } else if (this.path !== '') {\n // If a base path is set, resources will be relative paths from that plus the relative path of the gltf file\n // Example path = 'https://my-cnd-server.com/', url = 'assets/models/model.gltf'\n // resourcePath = 'https://my-cnd-server.com/assets/models/'\n // referenced resource 'model.bin' will be loaded from 'https://my-cnd-server.com/assets/models/model.bin'\n // referenced resource '../textures/texture.png' will be loaded from 'https://my-cnd-server.com/assets/textures/texture.png'\n const relativeUrl = LoaderUtils.extractUrlBase(url)\n resourcePath = LoaderUtils.resolveURL(relativeUrl, this.path)\n } else {\n resourcePath = LoaderUtils.extractUrlBase(url)\n }\n\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\n const _onError = function (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n scope.manager.itemError(url)\n scope.manager.itemEnd(url)\n }\n\n const loader = new FileLoader(this.manager)\n\n loader.setPath(this.path)\n loader.setResponseType('arraybuffer')\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n function (data) {\n try {\n scope.parse(\n data,\n resourcePath,\n function (gltf) {\n onLoad(gltf)\n\n scope.manager.itemEnd(url)\n },\n _onError,\n )\n } catch (e) {\n _onError(e)\n }\n },\n onProgress,\n _onError,\n )\n }\n\n setDRACOLoader(dracoLoader) {\n this.dracoLoader = dracoLoader\n return this\n }\n\n setDDSLoader() {\n throw new Error('THREE.GLTFLoader: \"MSFT_texture_dds\" no longer supported. Please update to \"KHR_texture_basisu\".')\n }\n\n setKTX2Loader(ktx2Loader) {\n this.ktx2Loader = ktx2Loader\n return this\n }\n\n setMeshoptDecoder(meshoptDecoder) {\n this.meshoptDecoder = meshoptDecoder\n return this\n }\n\n register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) {\n this.pluginCallbacks.push(callback)\n }\n\n return this\n }\n\n unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) {\n this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1)\n }\n\n return this\n }\n\n parse(data, path, onLoad, onError) {\n let json\n const extensions = {}\n const plugins = {}\n\n if (typeof data === 'string') {\n json = JSON.parse(data)\n } else if (data instanceof ArrayBuffer) {\n const magic = decodeText(new Uint8Array(data.slice(0, 4)))\n\n if (magic === BINARY_EXTENSION_HEADER_MAGIC) {\n try {\n extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data)\n } catch (error) {\n if (onError) onError(error)\n return\n }\n\n json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content)\n } else {\n json = JSON.parse(decodeText(new Uint8Array(data)))\n }\n } else {\n json = data\n }\n\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\n const parser = new 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\n parser.fileLoader.setRequestHeader(this.requestHeader)\n\n for (let i = 0; i < this.pluginCallbacks.length; i++) {\n const plugin = this.pluginCallbacks[i](parser)\n\n if (!plugin.name) console.error('THREE.GLTFLoader: Invalid plugin found: missing name')\n\n plugins[plugin.name] = plugin\n\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\n if (json.extensionsUsed) {\n for (let i = 0; i < json.extensionsUsed.length; ++i) {\n const extensionName = json.extensionsUsed[i]\n const extensionsRequired = json.extensionsRequired || []\n\n switch (extensionName) {\n case EXTENSIONS.KHR_MATERIALS_UNLIT:\n extensions[extensionName] = new GLTFMaterialsUnlitExtension()\n break\n\n case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader)\n break\n\n case EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n extensions[extensionName] = new GLTFTextureTransformExtension()\n break\n\n case EXTENSIONS.KHR_MESH_QUANTIZATION:\n extensions[extensionName] = new GLTFMeshQuantizationExtension()\n break\n\n default:\n if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === undefined) {\n console.warn('THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".')\n }\n }\n }\n }\n\n parser.setExtensions(extensions)\n parser.setPlugins(plugins)\n parser.parse(onLoad, onError)\n }\n\n parseAsync(data, path) {\n const scope = this\n\n return new Promise(function (resolve, reject) {\n scope.parse(data, path, resolve, reject)\n })\n }\n}\n\n/* GLTFREGISTRY */\n\nfunction GLTFRegistry() {\n let objects = {}\n\n return {\n get: function (key) {\n return objects[key]\n },\n\n add: function (key, object) {\n objects[key] = object\n },\n\n remove: function (key) {\n delete objects[key]\n },\n\n removeAll: function () {\n objects = {}\n },\n }\n}\n\n/*********************************/\n/********** EXTENSIONS ***********/\n/*********************************/\n\nconst 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_DISPERSION: 'KHR_materials_dispersion',\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_MATERIALS_BUMP: 'EXT_materials_bump',\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/**\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL\n\n // Object3D instance caches\n this.cache = { refs: {}, uses: {} }\n }\n\n _markDefs() {\n const parser = this.parser\n const nodeDefs = this.parser.json.nodes || []\n\n for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {\n const nodeDef = nodeDefs[nodeIndex]\n\n if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== undefined) {\n parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light)\n }\n }\n }\n\n _loadLight(lightIndex) {\n const parser = this.parser\n const cacheKey = 'light:' + lightIndex\n let dependency = parser.cache.get(cacheKey)\n\n if (dependency) return dependency\n\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\n const color = new Color(0xffffff)\n\n if (lightDef.color !== undefined)\n color.setRGB(lightDef.color[0], lightDef.color[1], lightDef.color[2], LinearSRGBColorSpace)\n\n const range = lightDef.range !== undefined ? lightDef.range : 0\n\n switch (lightDef.type) {\n case 'directional':\n lightNode = new DirectionalLight(color)\n lightNode.target.position.set(0, 0, -1)\n lightNode.add(lightNode.target)\n break\n\n case 'point':\n lightNode = new PointLight(color)\n lightNode.distance = range\n break\n\n case 'spot':\n lightNode = new 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 =\n 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\n default:\n throw new Error('THREE.GLTFLoader: Unexpected light type: ' + lightDef.type)\n }\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\n lightNode.decay = 2\n\n assignExtrasToUserData(lightNode, lightDef)\n\n if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity\n\n lightNode.name = parser.createUniqueName(lightDef.name || 'light_' + lightIndex)\n\n dependency = Promise.resolve(lightNode)\n\n parser.cache.add(cacheKey, dependency)\n\n return dependency\n }\n\n getDependency(type, index) {\n if (type !== 'light') return\n\n return this._loadLight(index)\n }\n\n createNodeAttachment(nodeIndex) {\n const self = 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\n if (lightIndex === undefined) return null\n\n return this._loadLight(lightIndex).then(function (light) {\n return parser._getNodeRef(self.cache, lightIndex, light)\n })\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 constructor() {\n this.name = EXTENSIONS.KHR_MATERIALS_UNLIT\n }\n\n getMaterialType() {\n return MeshBasicMaterial\n }\n\n extendParams(materialParams, materialDef, parser) {\n const pending = []\n\n materialParams.color = new Color(1.0, 1.0, 1.0)\n materialParams.opacity = 1.0\n\n const metallicRoughness = materialDef.pbrMetallicRoughness\n\n if (metallicRoughness) {\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor\n\n materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace)\n materialParams.opacity = array[3]\n }\n\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace))\n }\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const emissiveStrength = materialDef.extensions[this.name].emissiveStrength\n\n if (emissiveStrength !== undefined) {\n materialParams.emissiveIntensity = emissiveStrength\n }\n\n return Promise.resolve()\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.clearcoatFactor !== undefined) {\n materialParams.clearcoat = extension.clearcoatFactor\n }\n\n if (extension.clearcoatTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatMap', extension.clearcoatTexture))\n }\n\n if (extension.clearcoatRoughnessFactor !== undefined) {\n materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor\n }\n\n if (extension.clearcoatRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture))\n }\n\n if (extension.clearcoatNormalTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture))\n\n if (extension.clearcoatNormalTexture.scale !== undefined) {\n const scale = extension.clearcoatNormalTexture.scale\n\n materialParams.clearcoatNormalScale = new Vector2(scale, scale)\n }\n }\n\n return Promise.all(pending)\n }\n}\n\n/**\n * Materials dispersion Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion\n */\nclass GLTFMaterialsDispersionExtension {\n constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.dispersion = extension.dispersion !== undefined ? extension.dispersion : 0\n\n return Promise.resolve()\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.iridescenceFactor !== undefined) {\n materialParams.iridescence = extension.iridescenceFactor\n }\n\n if (extension.iridescenceTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'iridescenceMap', extension.iridescenceTexture))\n }\n\n if (extension.iridescenceIor !== undefined) {\n materialParams.iridescenceIOR = extension.iridescenceIor\n }\n\n if (materialParams.iridescenceThicknessRange === undefined) {\n materialParams.iridescenceThicknessRange = [100, 400]\n }\n\n if (extension.iridescenceThicknessMinimum !== undefined) {\n materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum\n }\n\n if (extension.iridescenceThicknessMaximum !== undefined) {\n materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum\n }\n\n if (extension.iridescenceThicknessTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'iridescenceThicknessMap', extension.iridescenceThicknessTexture),\n )\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_SHEEN\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n materialParams.sheenColor = new Color(0, 0, 0)\n materialParams.sheenRoughness = 0\n materialParams.sheen = 1\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.sheenColorFactor !== undefined) {\n const colorFactor = extension.sheenColorFactor\n materialParams.sheenColor.setRGB(colorFactor[0], colorFactor[1], colorFactor[2], LinearSRGBColorSpace)\n }\n\n if (extension.sheenRoughnessFactor !== undefined) {\n materialParams.sheenRoughness = extension.sheenRoughnessFactor\n }\n\n if (extension.sheenColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'sheenColorMap', extension.sheenColorTexture, SRGBColorSpace))\n }\n\n if (extension.sheenRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.transmissionFactor !== undefined) {\n materialParams.transmission = extension.transmissionFactor\n }\n\n if (extension.transmissionTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'transmissionMap', extension.transmissionTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_VOLUME\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0\n\n if (extension.thicknessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'thicknessMap', extension.thicknessTexture))\n }\n\n materialParams.attenuationDistance = extension.attenuationDistance || Infinity\n\n const colorArray = extension.attenuationColor || [1, 1, 1]\n materialParams.attenuationColor = new Color().setRGB(\n colorArray[0],\n colorArray[1],\n colorArray[2],\n LinearSRGBColorSpace,\n )\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_IOR\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.ior = extension.ior !== undefined ? extension.ior : 1.5\n\n return Promise.resolve()\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0\n\n if (extension.specularTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'specularIntensityMap', extension.specularTexture))\n }\n\n const colorArray = extension.specularColorFactor || [1, 1, 1]\n materialParams.specularColor = new Color().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace)\n\n if (extension.specularColorTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'specularColorMap', extension.specularColorTexture, SRGBColorSpace),\n )\n }\n\n return Promise.all(pending)\n }\n}\n\n/**\n * Materials bump Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump\n */\nclass GLTFMaterialsBumpExtension {\n constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.EXT_MATERIALS_BUMP\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n materialParams.bumpScale = extension.bumpFactor !== undefined ? extension.bumpFactor : 1.0\n\n if (extension.bumpTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'bumpMap', extension.bumpTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY\n }\n\n getMaterialType(materialIndex) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null\n\n return MeshPhysicalMaterial\n }\n\n extendMaterialParams(materialIndex, materialParams) {\n const parser = this.parser\n const materialDef = parser.json.materials[materialIndex]\n\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve()\n }\n\n const pending = []\n\n const extension = materialDef.extensions[this.name]\n\n if (extension.anisotropyStrength !== undefined) {\n materialParams.anisotropy = extension.anisotropyStrength\n }\n\n if (extension.anisotropyRotation !== undefined) {\n materialParams.anisotropyRotation = extension.anisotropyRotation\n }\n\n if (extension.anisotropyTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'anisotropyMap', extension.anisotropyTexture))\n }\n\n return Promise.all(pending)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.KHR_TEXTURE_BASISU\n }\n\n loadTexture(textureIndex) {\n const parser = this.parser\n const json = parser.json\n\n const textureDef = json.textures[textureIndex]\n\n if (!textureDef.extensions || !textureDef.extensions[this.name]) {\n return null\n }\n\n const extension = textureDef.extensions[this.name]\n const loader = parser.options.ktx2Loader\n\n if (!loader) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error('THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures')\n } else {\n // Assumes that the extension is optional and that a fallback texture is present\n return null\n }\n }\n\n return parser.loadTextureImage(textureIndex, extension.source, loader)\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.EXT_TEXTURE_WEBP\n this.isSupported = null\n }\n\n loadTexture(textureIndex) {\n const name = this.name\n const parser = this.parser\n const json = parser.json\n\n const textureDef = json.textures[textureIndex]\n\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null\n }\n\n const extension = textureDef.extensions[name]\n const source = json.images[extension.source]\n\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\n return this.detectSupport().then(function (isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader)\n\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error('THREE.GLTFLoader: WebP required by asset but unsupported.')\n }\n\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex)\n })\n }\n\n detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function (resolve) {\n const image = new Image()\n\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\n image.onload = image.onerror = function () {\n resolve(image.height === 1)\n }\n })\n }\n\n return this.isSupported\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 constructor(parser) {\n this.parser = parser\n this.name = EXTENSIONS.EXT_TEXTURE_AVIF\n this.isSupported = null\n }\n\n loadTexture(textureIndex) {\n const name = this.name\n const parser = this.parser\n const json = parser.json\n\n const textureDef = json.textures[textureIndex]\n\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null\n }\n\n const extension = textureDef.extensions[name]\n const source = json.images[extension.source]\n\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\n return this.detectSupport().then(function (isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader)\n\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error('THREE.GLTFLoader: AVIF required by asset but unsupported.')\n }\n\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex)\n })\n }\n\n detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function (resolve) {\n const image = new Image()\n\n // Lossy test image.\n image.src =\n 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI='\n image.onload = image.onerror = function () {\n resolve(image.height === 1)\n }\n })\n }\n\n return this.isSupported\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 constructor(parser) {\n this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION\n this.parser = parser\n }\n\n loadBufferView(index) {\n const json = this.parser.json\n const bufferView = json.bufferViews[index]\n\n if (bufferView.extensions && bufferView.extensions[this.name]) {\n const extensionDef = bufferView.extensions[this.name]\n\n const buffer = this.parser.getDependency('buffer', extensionDef.buffer)\n const decoder = this.parser.options.meshoptDecoder\n\n if (!decoder || !decoder.supported) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error('THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files')\n } else {\n // Assumes that the extension is optional and that fallback buffer data is present\n return null\n }\n }\n\n return buffer.then(function (res) {\n const byteOffset = extensionDef.byteOffset || 0\n const byteLength = extensionDef.byteLength || 0\n\n const count = extensionDef.count\n const stride = extensionDef.byteStride\n\n const source = new Uint8Array(res, byteOffset, byteLength)\n\n if (decoder.decodeGltfBufferAsync) {\n return decoder\n .decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter)\n .then(function (res) {\n return res.buffer\n })\n } else {\n // 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(\n new Uint8Array(result),\n count,\n stride,\n source,\n extensionDef.mode,\n extensionDef.filter,\n )\n return result\n })\n }\n })\n } else {\n return null\n }\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 constructor(parser) {\n this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING\n this.parser = parser\n }\n\n createNodeMesh(nodeIndex) {\n const json = this.parser.json\n const nodeDef = json.nodes[nodeIndex]\n\n if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === undefined) {\n return null\n }\n\n const meshDef = json.meshes[nodeDef.mesh]\n\n // No Points or Lines + Instancing support yet\n\n for (const primitive of meshDef.primitives) {\n if (\n primitive.mode !== WEBGL_CONSTANTS.TRIANGLES &&\n primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP &&\n primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN &&\n primitive.mode !== undefined\n ) {\n return null\n }\n }\n\n const extensionDef = nodeDef.extensions[this.name]\n const attributesDef = extensionDef.attributes\n\n // @TODO: Can we support InstancedMesh + SkinnedMesh?\n\n const pending = []\n const attributes = {}\n\n for (const key in attributesDef) {\n pending.push(\n this.parser.getDependency('accessor', attributesDef[key]).then((accessor) => {\n attributes[key] = accessor\n return attributes[key]\n }),\n )\n }\n\n if (pending.length < 1) {\n return null\n }\n\n pending.push(this.parser.createNodeMesh(nodeIndex))\n\n return Promise.all(pending).then((results) => {\n const nodeObject = results.pop()\n const meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject]\n const count = results[0].count // All attribute counts should be same\n const instancedMeshes = []\n\n for (const mesh of meshes) {\n // Temporal variables\n const m = new Matrix4()\n const p = new Vector3()\n const q = new Quaternion()\n const s = new Vector3(1, 1, 1)\n\n const instancedMesh = new InstancedMesh(mesh.geometry, mesh.material, count)\n\n for (let i = 0; i < count; i++) {\n if (attributes.TRANSLATION) {\n p.fromBufferAttribute(attributes.TRANSLATION, i)\n }\n\n if (attributes.ROTATION) {\n q.fromBufferAttribute(attributes.ROTATION, i)\n }\n\n if (attributes.SCALE) {\n s.fromBufferAttribute(attributes.SCALE, i)\n }\n\n instancedMesh.setMatrixAt(i, m.compose(p, q, s))\n }\n\n // Add instance attributes to the geometry, excluding TRS.\n for (const attributeName in attributes) {\n if (attributeName === '_COLOR_0') {\n const attr = attributes[attributeName]\n instancedMesh.instanceColor = new InstancedBufferAttribute(attr.array, attr.itemSize, attr.normalized)\n } else if (attributeName !== 'TRANSLATION' && attributeName !== 'ROTATION' && attributeName !== 'SCALE') {\n mesh.geometry.setAttribute(attributeName, attributes[attributeName])\n }\n }\n\n // Just in case\n Object3D.prototype.copy.call(instancedMesh, mesh)\n\n this.parser.assignFinalMaterial(instancedMesh)\n\n instancedMeshes.push(instancedMesh)\n }\n\n if (nodeObject.isGroup) {\n nodeObject.clear()\n\n nodeObject.add(...instancedMeshes)\n\n return nodeObject\n }\n\n return instancedMeshes[0]\n })\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 constructor(data) {\n this.name = EXTENSIONS.KHR_BINARY_GLTF\n this.content = null\n this.body = null\n\n const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH)\n\n this.header = {\n magic: decodeText(new Uint8Array(data.slice(0, 4))),\n version: headerView.getUint32(4, true),\n length: headerView.getUint32(8, true),\n }\n\n if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {\n throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.')\n } else if (this.header.version < 2.0) {\n throw new Error('THREE.GLTFLoader: Legacy binary file detected.')\n }\n\n const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH\n const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH)\n let chunkIndex = 0\n\n while (chunkIndex < chunkContentsLength) {\n const chunkLength = chunkView.getUint32(chunkIndex, true)\n chunkIndex += 4\n\n const chunkType = chunkView.getUint32(chunkIndex, true)\n chunkIndex += 4\n\n if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {\n const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength)\n this.content = decodeText(contentArray)\n } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {\n const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex\n this.body = data.slice(byteOffset, byteOffset + chunkLength)\n }\n\n // Clients must ignore chunks with unknown types.\n\n chunkIndex += chunkLength\n }\n\n if (this.content === null) {\n throw new Error('THREE.GLTFLoader: JSON content not found.')\n }\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 constructor(json, dracoLoader) {\n if (!dracoLoader) {\n throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.')\n }\n\n this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION\n this.json = json\n this.dracoLoader = dracoLoader\n this.dracoLoader.preload()\n }\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\n for (const attributeName in gltfAttributeMap) {\n const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase()\n\n threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName]\n }\n\n for (const attributeName in primitive.attributes) {\n const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase()\n\n if (gltfAttributeMap[attributeName] !== undefined) {\n const accessorDef = json.accessors[primitive.attributes[attributeName]]\n const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType]\n\n attributeTypeMap[threeAttributeName] = componentType.name\n attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true\n }\n }\n\n return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) {\n return new Promise(function (resolve, reject) {\n dracoLoader.decodeDracoFile(\n bufferView,\n function (geometry) {\n for (const attributeName in geometry.attributes) {\n const attribute = geometry.attributes[attributeName]\n const normalized = attributeNormalizedMap[attributeName]\n\n if (normalized !== undefined) attribute.normalized = normalized\n }\n\n resolve(geometry)\n },\n threeAttributeMap,\n attributeTypeMap,\n LinearSRGBColorSpace,\n reject,\n )\n })\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 */\nclass GLTFTextureTransformExtension {\n constructor() {\n this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM\n }\n\n extendTexture(texture, transform) {\n if (\n (transform.texCoord === undefined || transform.texCoord === texture.channel) &&\n transform.offset === undefined &&\n transform.rotation === undefined &&\n transform.scale === undefined\n ) {\n // See https://github.com/mrdoob/three.js/issues/21819.\n return texture\n }\n\n texture = texture.clone()\n\n if (transform.texCoord !== undefined) {\n texture.channel = transform.texCoord\n }\n\n if (transform.offset !== undefined) {\n texture.offset.fromArray(transform.offset)\n }\n\n if (transform.rotation !== undefined) {\n texture.rotation = transform.rotation\n }\n\n if (transform.scale !== undefined) {\n texture.repeat.fromArray(transform.scale)\n }\n\n texture.needsUpdate = true\n\n return texture\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 constructor() {\n this.name = EXTENSIONS.KHR_MESH_QUANTIZATION\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 constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n super(parameterPositions, sampleValues, sampleSize, resultBuffer)\n }\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\n const result = this.resultBuffer,\n values = this.sampleValues,\n valueSize = this.valueSize,\n offset = index * valueSize * 3 + valueSize\n\n for (let i = 0; i !== valueSize; i++) {\n result[i] = values[offset + i]\n }\n\n return result\n }\n\n interpolate_(i1, t0, t, t1) {\n const result = this.resultBuffer\n const values = this.sampleValues\n const stride = this.valueSize\n\n const stride2 = stride * 2\n const stride3 = stride * 3\n\n const td = t1 - t0\n\n const p = (t - t0) / td\n const pp = p * p\n const ppp = pp * p\n\n const offset1 = i1 * stride3\n const offset0 = offset1 - stride3\n\n const s2 = -2 * ppp + 3 * pp\n const s3 = ppp - pp\n const s0 = 1 - s2\n const s1 = s3 - pp + p\n\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\n result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1\n }\n\n return result\n }\n}\n\nconst _q = new Quaternion()\n\nclass GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {\n interpolate_(i1, t0, t, t1) {\n const result = super.interpolate_(i1, t0, t, t1)\n\n _q.fromArray(result).normalize().toArray(result)\n\n return result\n }\n}\n\n/*********************************/\n/********** INTERNALS ************/\n/*********************************/\n\n/* CONSTANTS */\n\nconst 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}\n\nconst WEBGL_COMPONENT_TYPES = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array,\n}\n\nconst WEBGL_FILTERS = {\n 9728: NearestFilter,\n 9729: LinearFilter,\n 9984: NearestMipmapNearestFilter,\n 9985: LinearMipmapNearestFilter,\n 9986: NearestMipmapLinearFilter,\n 9987: LinearMipmapLinearFilter,\n}\n\nconst WEBGL_WRAPPINGS = {\n 33071: ClampToEdgeWrapping,\n 33648: MirroredRepeatWrapping,\n 10497: RepeatWrapping,\n}\n\nconst 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}\n\nconst ATTRIBUTES = {\n POSITION: 'position',\n NORMAL: 'normal',\n TANGENT: 'tangent',\n // uv => uv1, 4 uv channels\n // https://github.com/mrdoob/three.js/pull/25943\n // https://github.com/mrdoob/three.js/pull/25788\n ...(version >= 152\n ? {\n TEXCOORD_0: 'uv',\n TEXCOORD_1: 'uv1',\n TEXCOORD_2: 'uv2',\n TEXCOORD_3: 'uv3',\n }\n : {\n TEXCOORD_0: 'uv',\n TEXCOORD_1: 'uv2',\n }),\n\n COLOR_0: 'color',\n WEIGHTS_0: 'skinWeight',\n JOINTS_0: 'skinIndex',\n}\n\nconst PATH_PROPERTIES = {\n scale: 'scale',\n translation: 'position',\n rotation: 'quaternion',\n weights: 'morphTargetInfluences',\n}\n\nconst INTERPOLATION = {\n CUBICSPLINE: undefined, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each\n // keyframe track will be initialized with a default interpolation type, then modified.\n LINEAR: InterpolateLinear,\n STEP: InterpolateDiscrete,\n}\n\nconst ALPHA_MODES = {\n OPAQUE: 'OPAQUE',\n MASK: 'MASK',\n BLEND: '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 if (cache['DefaultMaterial'] === undefined) {\n cache['DefaultMaterial'] = new MeshStandardMaterial({\n color: 0xffffff,\n emissive: 0x000000,\n metalness: 1,\n roughness: 1,\n transparent: false,\n depthTest: true,\n side: FrontSide,\n })\n }\n\n return cache['DefaultMaterial']\n}\n\nfunction addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {\n // Add unknown glTF extensions to an object's userData.\n\n for (const name in objectDef.extensions) {\n if (knownExtensions[name] === undefined) {\n object.userData.gltfExtensions = object.userData.gltfExtensions || {}\n object.userData.gltfExtensions[name] = objectDef.extensions[name]\n }\n }\n}\n\n/**\n * @param {Object3D|Material|BufferGeometry} object\n * @param {GLTF.definition} gltfDef\n */\nfunction assignExtrasToUserData(object, gltfDef) {\n if (gltfDef.extras !== undefined) {\n if (typeof gltfDef.extras === 'object') {\n Object.assign(object.userData, gltfDef.extras)\n } else {\n console.warn('THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras)\n }\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 let hasMorphPosition = false\n let hasMorphNormal = false\n let hasMorphColor = false\n\n for (let i = 0, il = targets.length; i < il; i++) {\n const target = targets[i]\n\n if (target.POSITION !== undefined) hasMorphPosition = true\n if (target.NORMAL !== undefined) hasMorphNormal = true\n if (target.COLOR_0 !== undefined) hasMorphColor = true\n\n if (hasMorphPosition && hasMorphNormal && hasMorphColor) break\n }\n\n if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry)\n\n const pendingPositionAccessors = []\n const pendingNormalAccessors = []\n const pendingColorAccessors = []\n\n for (let i = 0, il = targets.length; i < il; i++) {\n const target = targets[i]\n\n if (hasMorphPosition) {\n const pendingAccessor =\n target.POSITION !== undefined ? parser.getDependency('accessor', target.POSITION) : geometry.attributes.position\n\n pendingPositionAccessors.push(pendingAccessor)\n }\n\n if (hasMorphNormal) {\n const pendingAccessor =\n target.NORMAL !== undefined ? parser.getDependency('accessor', target.NORMAL) : geometry.attributes.normal\n\n pendingNormalAccessors.push(pendingAccessor)\n }\n\n if (hasMorphColor) {\n const pendingAccessor =\n target.COLOR_0 !== undefined ? parser.getDependency('accessor', target.COLOR_0) : geometry.attributes.color\n\n pendingColorAccessors.push(pendingAccessor)\n }\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\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\n return geometry\n })\n}\n\n/**\n * @param {Mesh} mesh\n * @param {GLTF.Mesh} meshDef\n */\nfunction updateMorphTargets(mesh, meshDef) {\n mesh.updateMorphTargets()\n\n if (meshDef.weights !== undefined) {\n for (let i = 0, il = meshDef.weights.length; i < il; i++) {\n mesh.morphTargetInfluences[i] = meshDef.weights[i]\n }\n }\n\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\n if (mesh.morphTargetInfluences.length === targetNames.length) {\n mesh.morphTargetDictionary = {}\n\n for (let i = 0, il = targetNames.length; i < il; i++) {\n mesh.morphTargetDictionary[targetNames[i]] = i\n }\n } else {\n console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.')\n }\n }\n}\n\nfunction createPrimitiveKey(primitiveDef) {\n let geometryKey\n\n const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]\n\n if (dracoExtension) {\n geometryKey =\n 'draco:' +\n dracoExtension.bufferView +\n ':' +\n dracoExtension.indices +\n ':' +\n createAttributesKey(dracoExtension.attributes)\n } else {\n geometryKey = primitiveDef.indices + ':' + createAttributesKey(primitiveDef.attributes) + ':' + primitiveDef.mode\n }\n\n if (primitiveDef.targets !== undefined) {\n for (let i = 0, il = primitiveDef.targets.length; i < il; i++) {\n geometryKey += ':' + createAttributesKey(primitiveDef.targets[i])\n }\n }\n\n return geometryKey\n}\n\nfunction createAttributesKey(attributes) {\n let attributesKey = ''\n\n const keys = Object.keys(attributes).sort()\n\n for (let i = 0, il = keys.length; i < il; i++) {\n attributesKey += keys[i] + ':' + attributes[keys[i]] + ';'\n }\n\n return attributesKey\n}\n\nfunction getNormalizedComponentScale(constructor) {\n // Reference:\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data\n\n switch (constructor) {\n case Int8Array:\n return 1 / 127\n\n case Uint8Array:\n return 1 / 255\n\n case Int16Array:\n return 1 / 32767\n\n case Uint16Array:\n return 1 / 65535\n\n default:\n throw new Error('THREE.GLTFLoader: Unsupported normalized accessor component type.')\n }\n}\n\nfunction 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\n return 'image/png'\n}\n\nconst _identityMatrix = new Matrix4()\n\n/* GLTF PARSER */\n\nclass GLTFParser {\n constructor(json = {}, options = {}) {\n this.json = json\n this.extensions = {}\n this.plugins = {}\n this.options = options\n\n // loader object cache\n this.cache = new GLTFRegistry()\n\n // associations between Three.js objects and glTF elements\n this.associations = new Map()\n\n // BufferGeometry caching\n this.primitiveCache = {}\n\n // Node cache\n this.nodeCache = {}\n\n // Object3D instance caches\n this.meshCache = { refs: {}, uses: {} }\n this.cameraCache = { refs: {}, uses: {} }\n this.lightCache = { refs: {}, uses: {} }\n\n this.sourceCache = {}\n this.textureCache = {}\n\n // Track node names, to ensure no duplicates\n this.nodeNamesUsed = {}\n\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\n let isSafari = false\n let isFirefox = false\n let firefoxVersion = -1\n\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent !== '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\n if (typeof createImageBitmap === 'undefined' || isSafari || (isFirefox && firefoxVersion < 98)) {\n this.textureLoader = new TextureLoader(this.options.manager)\n } else {\n this.textureLoader = new ImageBitmapLoader(this.options.manager)\n }\n\n this.textureLoader.setCrossOrigin(this.options.crossOrigin)\n this.textureLoader.setRequestHeader(this.options.requestHeader)\n\n this.fileLoader = new FileLoader(this.options.manager)\n this.fileLoader.setResponseType('arraybuffer')\n\n if (this.options.crossOrigin === 'use-credentials') {\n this.fileLoader.setWithCredentials(true)\n }\n }\n\n setExtensions(extensions) {\n this.extensions = extensions\n }\n\n setPlugins(plugins) {\n this.plugins = plugins\n }\n\n parse(onLoad, onError) {\n const parser = this\n const json = this.json\n const extensions = this.extensions\n\n // Clear the loader cache\n this.cache.removeAll()\n this.nodeCache = {}\n\n // Mark the special nodes/meshes in json for efficient parse\n this._invokeAll(function (ext) {\n return ext._markDefs && ext._markDefs()\n })\n\n Promise.all(\n this._invokeAll(function (ext) {\n return ext.beforeRoot && ext.beforeRoot()\n }),\n )\n .then(function () {\n return Promise.all([\n parser.getDependencies('scene'),\n parser.getDependencies('animation'),\n parser.getDependencies('camera'),\n ])\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\n addUnknownExtensionsToUserData(extensions, result, json)\n\n assignExtrasToUserData(result, json)\n\n return Promise.all(\n parser._invokeAll(function (ext) {\n return ext.afterRoot && ext.afterRoot(result)\n }),\n ).then(function () {\n for (const scene of result.scenes) {\n scene.updateMatrixWorld()\n }\n\n onLoad(result)\n })\n })\n .catch(onError)\n }\n\n /**\n * Marks the special nodes/meshes in json for efficient parse.\n */\n _markDefs() {\n const nodeDefs = this.json.nodes || []\n const skinDefs = this.json.skins || []\n const meshDefs = this.json.meshes || []\n\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\n for (let i = 0, il = joints.length; i < il; i++) {\n nodeDefs[joints[i]].isBone = true\n }\n }\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\n if (nodeDef.mesh !== undefined) {\n this._addNodeRef(this.meshCache, nodeDef.mesh)\n\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) {\n meshDefs[nodeDef.mesh].isSkinnedMesh = true\n }\n }\n\n if (nodeDef.camera !== undefined) {\n this._addNodeRef(this.cameraCache, nodeDef.camera)\n }\n }\n }\n\n /**\n * Counts references to shared node / Object3D resources. These resources\n * can be reused, or \"instantiated\", at multiple nodes in the scene\n * hierarchy. Mesh, Camera, and Light instances are instantiated and must\n * be marked. Non-scenegraph resources (like Materials, Geometries, and\n * Textures) can be reused directly and are not marked here.\n *\n * Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n */\n _addNodeRef(cache, index) {\n if (index === undefined) return\n\n if (cache.refs[index] === undefined) {\n cache.refs[index] = cache.uses[index] = 0\n }\n\n cache.refs[index]++\n }\n\n /** Returns a reference to a shared resource, cloning it if necessary. */\n _getNodeRef(cache, index, object) {\n if (cache.refs[index] <= 1) return object\n\n const ref = object.clone()\n\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) {\n this.associations.set(clone, mappings)\n }\n\n for (const [i, child] of original.children.entries()) {\n updateMappings(child, clone.children[i])\n }\n }\n\n updateMappings(object, ref)\n\n ref.name += '_instance_' + cache.uses[index]++\n\n return ref\n }\n\n _invokeOne(func) {\n const extensions = Object.values(this.plugins)\n extensions.push(this)\n\n for (let i = 0; i < extensions.length; i++) {\n const result = func(extensions[i])\n\n if (result) return result\n }\n\n return null\n }\n\n _invokeAll(func) {\n const extensions = Object.values(this.plugins)\n extensions.unshift(this)\n\n const pending = []\n\n for (let i = 0; i < extensions.length; i++) {\n const result = func(extensions[i])\n\n if (result) pending.push(result)\n }\n\n return pending\n }\n\n /**\n * Requests the specified dependency asynchronously, with caching.\n * @param {string} type\n * @param {number} index\n * @return {Promise}\n */\n getDependency(type, index) {\n const cacheKey = type + ':' + index\n let dependency = this.cache.get(cacheKey)\n\n if (!dependency) {\n switch (type) {\n case 'scene':\n dependency = this.loadScene(index)\n break\n\n case 'node':\n dependency = this._invokeOne(function (ext) {\n return ext.loadNode && ext.loadNode(index)\n })\n break\n\n case 'mesh':\n dependency = this._invokeOne(function (ext) {\n return ext.loadMesh && ext.loadMesh(index)\n })\n break\n\n case 'accessor':\n dependency = this.loadAccessor(index)\n break\n\n case 'bufferView':\n dependency = this._invokeOne(function (ext) {\n return ext.loadBufferView && ext.loadBufferView(index)\n })\n break\n\n case 'buffer':\n dependency = this.loadBuffer(index)\n break\n\n case 'material':\n dependency = this._invokeOne(function (ext) {\n return ext.loadMaterial && ext.loadMaterial(index)\n })\n break\n\n case 'texture':\n dependency = this._invokeOne(function (ext) {\n return ext.loadTexture && ext.loadTexture(index)\n })\n break\n\n case 'skin':\n dependency = this.loadSkin(index)\n break\n\n case 'animation':\n dependency = this._invokeOne(function (ext) {\n return ext.loadAnimation && ext.loadAnimation(index)\n })\n break\n\n case 'camera':\n dependency = this.loadCamera(index)\n break\n\n default:\n dependency = this._invokeOne(function (ext) {\n return ext != this && ext.getDependency && ext.getDependency(type, index)\n })\n\n if (!dependency) {\n throw new Error('Unknown type: ' + type)\n }\n\n break\n }\n\n this.cache.add(cacheKey, dependency)\n }\n\n return dependency\n }\n\n /**\n * Requests all dependencies of the specified type asynchronously, with caching.\n * @param {string} type\n * @return {Promise>}\n */\n getDependencies(type) {\n let dependencies = this.cache.get(type)\n\n if (!dependencies) {\n const parser = this\n const defs = this.json[type + (type === 'mesh' ? 'es' : 's')] || []\n\n dependencies = Promise.all(\n defs.map(function (def, index) {\n return parser.getDependency(type, index)\n }),\n )\n\n this.cache.add(type, dependencies)\n }\n\n return dependencies\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferIndex\n * @return {Promise}\n */\n loadBuffer(bufferIndex) {\n const bufferDef = this.json.buffers[bufferIndex]\n const loader = this.fileLoader\n\n if (bufferDef.type && bufferDef.type !== 'arraybuffer') {\n throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.')\n }\n\n // If present, GLB container is required to be the first buffer.\n if (bufferDef.uri === undefined && bufferIndex === 0) {\n return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body)\n }\n\n const options = this.options\n\n return new Promise(function (resolve, reject) {\n loader.load(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 /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferViewIndex\n * @return {Promise}\n */\n loadBufferView(bufferViewIndex) {\n const bufferViewDef = this.json.bufferViews[bufferViewIndex]\n\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 /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n * @param {number} accessorIndex\n * @return {Promise}\n */\n loadAccessor(accessorIndex) {\n const parser = this\n const json = this.json\n\n const accessorDef = this.json.accessors[accessorIndex]\n\n if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) {\n const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]\n const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]\n const normalized = accessorDef.normalized === true\n\n const array = new TypedArray(accessorDef.count * itemSize)\n return Promise.resolve(new BufferAttribute(array, itemSize, normalized))\n }\n\n const pendingBufferViews = []\n\n if (accessorDef.bufferView !== undefined) {\n pendingBufferViews.push(this.getDependency('bufferView', accessorDef.bufferView))\n } else {\n pendingBufferViews.push(null)\n }\n\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\n return Promise.all(pendingBufferViews).then(function (bufferViews) {\n const bufferView = bufferViews[0]\n\n const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]\n const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]\n\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 =\n accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride : undefined\n const normalized = accessorDef.normalized === true\n let array, bufferAttribute\n\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 =\n 'InterleavedBuffer:' +\n accessorDef.bufferView +\n ':' +\n accessorDef.componentType +\n ':' +\n ibSlice +\n ':' +\n accessorDef.count\n let ib = parser.cache.get(ibCacheKey)\n\n if (!ib) {\n array = new TypedArray(bufferView, ibSlice * byteStride, (accessorDef.count * byteStride) / elementBytes)\n\n // Integer parameters to IB/IBA are in array elements, not bytes.\n ib = new InterleavedBuffer(array, byteStride / elementBytes)\n\n parser.cache.add(ibCacheKey, ib)\n }\n\n bufferAttribute = new InterleavedBufferAttribute(\n ib,\n itemSize,\n (byteOffset % byteStride) / elementBytes,\n normalized,\n )\n } else {\n if (bufferView === null) {\n array = new TypedArray(accessorDef.count * itemSize)\n } else {\n array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize)\n }\n\n bufferAttribute = new BufferAttribute(array, itemSize, normalized)\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors\n if (accessorDef.sparse !== undefined) {\n const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR\n const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType]\n\n const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0\n const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0\n\n const sparseIndices = new TypedArrayIndices(\n bufferViews[1],\n byteOffsetIndices,\n accessorDef.sparse.count * itemSizeIndices,\n )\n const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize)\n\n if (bufferView !== null) {\n // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.\n bufferAttribute = new BufferAttribute(\n bufferAttribute.array.slice(),\n bufferAttribute.itemSize,\n bufferAttribute.normalized,\n )\n }\n\n for (let i = 0, il = sparseIndices.length; i < il; i++) {\n const index = sparseIndices[i]\n\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\n return bufferAttribute\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n * @param {number} textureIndex\n * @return {Promise}\n */\n 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\n let loader = this.textureLoader\n\n if (sourceDef.uri) {\n const handler = options.manager.getHandler(sourceDef.uri)\n if (handler !== null) loader = handler\n }\n\n return this.loadTextureImage(textureIndex, sourceIndex, loader)\n }\n\n loadTextureImage(textureIndex, sourceIndex, loader) {\n const parser = this\n const json = this.json\n\n const textureDef = json.textures[textureIndex]\n const sourceDef = json.images[sourceIndex]\n\n const cacheKey = (sourceDef.uri || sourceDef.bufferView) + ':' + textureDef.sampler\n\n if (this.textureCache[cacheKey]) {\n // See https://github.com/mrdoob/three.js/issues/21559.\n return this.textureCache[cacheKey]\n }\n\n const promise = this.loadImageSource(sourceIndex, loader)\n .then(function (texture) {\n texture.flipY = false\n\n texture.name = textureDef.name || sourceDef.name || ''\n\n if (\n texture.name === '' &&\n typeof sourceDef.uri === 'string' &&\n sourceDef.uri.startsWith('data:image/') === false\n ) {\n texture.name = sourceDef.uri\n }\n\n const samplers = json.samplers || {}\n const sampler = samplers[textureDef.sampler] || {}\n\n texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter\n texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter\n texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping\n texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping\n\n parser.associations.set(texture, { textures: textureIndex })\n\n return texture\n })\n .catch(function () {\n return null\n })\n\n this.textureCache[cacheKey] = promise\n\n return promise\n }\n\n loadImageSource(sourceIndex, loader) {\n const parser = this\n const json = this.json\n const options = this.options\n\n if (this.sourceCache[sourceIndex] !== undefined) {\n return this.sourceCache[sourceIndex].then((texture) => texture.clone())\n }\n\n const sourceDef = json.images[sourceIndex]\n\n const URL = self.URL || self.webkitURL\n\n let sourceURI = sourceDef.uri || ''\n let isObjectURL = false\n\n if (sourceDef.bufferView !== undefined) {\n // Load binary image data from bufferView, if provided.\n\n sourceURI = parser.getDependency('bufferView', sourceDef.bufferView).then(function (bufferView) {\n isObjectURL = true\n const blob = new Blob([bufferView], { type: sourceDef.mimeType })\n sourceURI = URL.createObjectURL(blob)\n return sourceURI\n })\n } else if (sourceDef.uri === undefined) {\n throw new Error('THREE.GLTFLoader: Image ' + sourceIndex + ' is missing URI and bufferView')\n }\n\n const promise = Promise.resolve(sourceURI)\n .then(function (sourceURI) {\n return new Promise(function (resolve, reject) {\n let onLoad = resolve\n\n if (loader.isImageBitmapLoader === true) {\n onLoad = function (imageBitmap) {\n const texture = new Texture(imageBitmap)\n texture.needsUpdate = true\n\n resolve(texture)\n }\n }\n\n loader.load(LoaderUtils.resolveURL(sourceURI, options.path), onLoad, undefined, reject)\n })\n })\n .then(function (texture) {\n // Clean up resources and configure Texture.\n\n if (isObjectURL === true) {\n URL.revokeObjectURL(sourceURI)\n }\n\n assignExtrasToUserData(texture, sourceDef)\n\n texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri)\n\n return texture\n })\n .catch(function (error) {\n console.error(\"THREE.GLTFLoader: Couldn't load texture\", sourceURI)\n throw error\n })\n\n this.sourceCache[sourceIndex] = promise\n return promise\n }\n\n /**\n * Asynchronously assigns a texture to the given material parameters.\n * @param {Object} materialParams\n * @param {string} mapName\n * @param {Object} mapDef\n * @return {Promise}\n */\n assignTexture(materialParams, mapName, mapDef, colorSpace) {\n const parser = this\n\n return this.getDependency('texture', mapDef.index).then(function (texture) {\n if (!texture) return null\n\n if (mapDef.texCoord !== undefined && mapDef.texCoord > 0) {\n texture = texture.clone()\n texture.channel = mapDef.texCoord\n }\n\n if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {\n const transform =\n mapDef.extensions !== undefined ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined\n\n if (transform) {\n const gltfReference = parser.associations.get(texture)\n texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform)\n parser.associations.set(texture, gltfReference)\n }\n }\n\n if (colorSpace !== undefined) {\n // Convert from legacy encoding to colorSpace\n if (typeof colorSpace === 'number')\n colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace\n\n // Set colorSpace if able, fallback to legacy encoding\n if ('colorSpace' in texture) texture.colorSpace = colorSpace\n else texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding\n }\n\n materialParams[mapName] = texture\n\n return texture\n })\n }\n\n /**\n * Assigns final material to a Mesh, Line, or Points instance. The instance\n * already has a material (generated from the glTF material options alone)\n * but reuse of the same glTF material may require multiple threejs materials\n * to accommodate different primitive types, defines, etc. New materials will\n * be created if necessary, and reused from a cache.\n * @param {Object3D} mesh Mesh, Line, or Points instance.\n */\n assignFinalMaterial(mesh) {\n const geometry = mesh.geometry\n let material = mesh.material\n\n const useDerivativeTangents = geometry.attributes.tangent === undefined\n const useVertexColors = geometry.attributes.color !== undefined\n const useFlatShading = geometry.attributes.normal === undefined\n\n if (mesh.isPoints) {\n const cacheKey = 'PointsMaterial:' + material.uuid\n\n let pointsMaterial = this.cache.get(cacheKey)\n\n if (!pointsMaterial) {\n pointsMaterial = new PointsMaterial()\n 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\n this.cache.add(cacheKey, pointsMaterial)\n }\n\n material = pointsMaterial\n } else if (mesh.isLine) {\n const cacheKey = 'LineBasicMaterial:' + material.uuid\n\n let lineMaterial = this.cache.get(cacheKey)\n\n if (!lineMaterial) {\n lineMaterial = new LineBasicMaterial()\n Material.prototype.copy.call(lineMaterial, material)\n lineMaterial.color.copy(material.color)\n lineMaterial.map = material.map\n\n this.cache.add(cacheKey, lineMaterial)\n }\n\n material = lineMaterial\n }\n\n // Clone the material if it will be modified\n if (useDerivativeTangents || useVertexColors || useFlatShading) {\n let cacheKey = 'ClonedMaterial:' + material.uuid + ':'\n\n if (useDerivativeTangents) cacheKey += 'derivative-tangents:'\n if (useVertexColors) cacheKey += 'vertex-colors:'\n if (useFlatShading) cacheKey += 'flat-shading:'\n\n let cachedMaterial = this.cache.get(cacheKey)\n\n if (!cachedMaterial) {\n cachedMaterial = material.clone()\n\n if (useVertexColors) cachedMaterial.vertexColors = true\n if (useFlatShading) cachedMaterial.flatShading = true\n\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\n this.cache.add(cacheKey, cachedMaterial)\n\n this.associations.set(cachedMaterial, this.associations.get(material))\n }\n\n material = cachedMaterial\n }\n\n mesh.material = material\n }\n\n getMaterialType(/* materialIndex */) {\n return MeshStandardMaterial\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n * @param {number} materialIndex\n * @return {Promise}\n */\n loadMaterial(materialIndex) {\n const parser = this\n const json = this.json\n const extensions = this.extensions\n const materialDef = json.materials[materialIndex]\n\n let materialType\n const materialParams = {}\n const materialExtensions = materialDef.extensions || {}\n\n const pending = []\n\n if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) {\n const kmuExtension = extensions[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\n const metallicRoughness = materialDef.pbrMetallicRoughness || {}\n\n materialParams.color = new Color(1.0, 1.0, 1.0)\n materialParams.opacity = 1.0\n\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor\n\n materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace)\n materialParams.opacity = array[3]\n }\n\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace))\n }\n\n materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0\n materialParams.roughness =\n metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0\n\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\n materialType = this._invokeOne(function (ext) {\n return ext.getMaterialType && ext.getMaterialType(materialIndex)\n })\n\n pending.push(\n Promise.all(\n this._invokeAll(function (ext) {\n return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams)\n }),\n ),\n )\n }\n\n if (materialDef.doubleSided === true) {\n materialParams.side = DoubleSide\n }\n\n const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE\n\n if (alphaMode === ALPHA_MODES.BLEND) {\n materialParams.transparent = true\n\n // See: https://github.com/mrdoob/three.js/issues/17706\n materialParams.depthWrite = false\n } else {\n materialParams.transparent = false\n\n if (alphaMode === ALPHA_MODES.MASK) {\n materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5\n }\n }\n\n if (materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture))\n\n materialParams.normalScale = new Vector2(1, 1)\n\n if (materialDef.normalTexture.scale !== undefined) {\n const scale = materialDef.normalTexture.scale\n\n materialParams.normalScale.set(scale, scale)\n }\n }\n\n if (materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture))\n\n if (materialDef.occlusionTexture.strength !== undefined) {\n materialParams.aoMapIntensity = materialDef.occlusionTexture.strength\n }\n }\n\n if (materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial) {\n const emissiveFactor = materialDef.emissiveFactor\n materialParams.emissive = new Color().setRGB(\n emissiveFactor[0],\n emissiveFactor[1],\n emissiveFactor[2],\n LinearSRGBColorSpace,\n )\n }\n\n if (materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'emissiveMap', materialDef.emissiveTexture, SRGBColorSpace))\n }\n\n return Promise.all(pending).then(function () {\n const material = new materialType(materialParams)\n\n if (materialDef.name) material.name = materialDef.name\n\n assignExtrasToUserData(material, materialDef)\n\n parser.associations.set(material, { materials: materialIndex })\n\n if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef)\n\n return material\n })\n }\n\n /** When Object3D instances are targeted by animation, they need unique names. */\n createUniqueName(originalName) {\n const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || '')\n\n if (sanitizedName in this.nodeNamesUsed) {\n return sanitizedName + '_' + ++this.nodeNamesUsed[sanitizedName]\n } else {\n this.nodeNamesUsed[sanitizedName] = 0\n\n return sanitizedName\n }\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n *\n * Creates BufferGeometries from primitives.\n *\n * @param {Array} primitives\n * @return {Promise>}\n */\n loadGeometries(primitives) {\n const parser = this\n const extensions = this.extensions\n const cache = this.primitiveCache\n\n function createDracoPrimitive(primitive) {\n return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]\n .decodePrimitive(primitive, parser)\n .then(function (geometry) {\n return addPrimitiveAttributes(geometry, primitive, parser)\n })\n }\n\n const pending = []\n\n for (let i = 0, il = primitives.length; i < il; i++) {\n const primitive = primitives[i]\n const cacheKey = createPrimitiveKey(primitive)\n\n // See if we've already created this geometry\n const cached = cache[cacheKey]\n\n if (cached) {\n // Use the cached geometry if it exists\n pending.push(cached.promise)\n } else {\n let geometryPromise\n\n if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {\n // Use DRACO geometry if available\n geometryPromise = createDracoPrimitive(primitive)\n } else {\n // Otherwise create a new geometry\n geometryPromise = addPrimitiveAttributes(new BufferGeometry(), primitive, parser)\n }\n\n // Cache this geometry\n cache[cacheKey] = { primitive: primitive, promise: geometryPromise }\n\n pending.push(geometryPromise)\n }\n }\n\n return Promise.all(pending)\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n * @param {number} meshIndex\n * @return {Promise}\n */\n loadMesh(meshIndex) {\n const parser = this\n const json = this.json\n const extensions = this.extensions\n\n const meshDef = json.meshes[meshIndex]\n const primitives = meshDef.primitives\n\n const pending = []\n\n for (let i = 0, il = primitives.length; i < il; i++) {\n const material =\n primitives[i].material === undefined\n ? createDefaultMaterial(this.cache)\n : this.getDependency('material', primitives[i].material)\n\n pending.push(material)\n }\n\n pending.push(parser.loadGeometries(primitives))\n\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\n const meshes = []\n\n for (let i = 0, il = geometries.length; i < il; i++) {\n const geometry = geometries[i]\n const primitive = primitives[i]\n\n // 1. create Mesh\n\n let mesh\n\n const material = materials[i]\n\n if (\n primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||\n primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||\n primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ||\n primitive.mode === undefined\n ) {\n // .isSkinnedMesh isn't in glTF spec. See ._markDefs()\n mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh(geometry, material) : new Mesh(geometry, material)\n\n if (mesh.isSkinnedMesh === true) {\n // normalize skin weights to fix malformed assets (see #15319)\n mesh.normalizeSkinWeights()\n }\n\n if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode)\n } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode)\n }\n } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {\n mesh = new LineSegments(geometry, material)\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {\n mesh = new Line(geometry, material)\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {\n mesh = new LineLoop(geometry, material)\n } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {\n mesh = new Points(geometry, material)\n } else {\n throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode)\n }\n\n if (Object.keys(mesh.geometry.morphAttributes).length > 0) {\n updateMorphTargets(mesh, meshDef)\n }\n\n mesh.name = parser.createUniqueName(meshDef.name || 'mesh_' + meshIndex)\n\n assignExtrasToUserData(mesh, meshDef)\n\n if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive)\n\n parser.assignFinalMaterial(mesh)\n\n meshes.push(mesh)\n }\n\n for (let i = 0, il = meshes.length; i < il; i++) {\n parser.associations.set(meshes[i], {\n meshes: meshIndex,\n primitives: i,\n })\n }\n\n if (meshes.length === 1) {\n if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, meshes[0], meshDef)\n\n return meshes[0]\n }\n\n const group = new Group()\n\n if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, group, meshDef)\n\n parser.associations.set(group, { meshes: meshIndex })\n\n for (let i = 0, il = meshes.length; i < il; i++) {\n group.add(meshes[i])\n }\n\n return group\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n * @param {number} cameraIndex\n * @return {Promise}\n */\n loadCamera(cameraIndex) {\n let camera\n const cameraDef = this.json.cameras[cameraIndex]\n const params = cameraDef[cameraDef.type]\n\n if (!params) {\n console.warn('THREE.GLTFLoader: Missing camera parameters.')\n return\n }\n\n if (cameraDef.type === 'perspective') {\n camera = new PerspectiveCamera(\n MathUtils.radToDeg(params.yfov),\n params.aspectRatio || 1,\n params.znear || 1,\n params.zfar || 2e6,\n )\n } else if (cameraDef.type === 'orthographic') {\n camera = new OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar)\n }\n\n if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name)\n\n assignExtrasToUserData(camera, cameraDef)\n\n return Promise.resolve(camera)\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n * @param {number} skinIndex\n * @return {Promise}\n */\n loadSkin(skinIndex) {\n const skinDef = this.json.skins[skinIndex]\n\n const pending = []\n\n for (let i = 0, il = skinDef.joints.length; i < il; i++) {\n pending.push(this._loadNodeShallow(skinDef.joints[i]))\n }\n\n if (skinDef.inverseBindMatrices !== undefined) {\n pending.push(this.getDependency('accessor', skinDef.inverseBindMatrices))\n } else {\n pending.push(null)\n }\n\n return Promise.all(pending).then(function (results) {\n const inverseBindMatrices = results.pop()\n const jointNodes = results\n\n // Note that bones (joint nodes) may or may not be in the\n // scene graph at this time.\n\n const bones = []\n const boneInverses = []\n\n for (let i = 0, il = jointNodes.length; i < il; i++) {\n const jointNode = jointNodes[i]\n\n if (jointNode) {\n bones.push(jointNode)\n\n const mat = new Matrix4()\n\n if (inverseBindMatrices !== null) {\n mat.fromArray(inverseBindMatrices.array, i * 16)\n }\n\n boneInverses.push(mat)\n } else {\n console.warn('THREE.GLTFLoader: Joint \"%s\" could not be found.', skinDef.joints[i])\n }\n }\n\n return new Skeleton(bones, boneInverses)\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\n * @param {number} animationIndex\n * @return {Promise}\n */\n loadAnimation(animationIndex) {\n const json = this.json\n const parser = this\n\n const animationDef = json.animations[animationIndex]\n const animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex\n\n const pendingNodes = []\n const pendingInputAccessors = []\n const pendingOutputAccessors = []\n const pendingSamplers = []\n const pendingTargets = []\n\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\n if (target.node === undefined) continue\n\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\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\n const tracks = []\n\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\n if (node === undefined) continue\n\n if (node.updateMatrix) {\n node.updateMatrix()\n }\n\n const createdTracks = parser._createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target)\n\n if (createdTracks) {\n for (let k = 0; k < createdTracks.length; k++) {\n tracks.push(createdTracks[k])\n }\n }\n }\n\n return new AnimationClip(animationName, undefined, tracks)\n })\n }\n\n createNodeMesh(nodeIndex) {\n const json = this.json\n const parser = this\n const nodeDef = json.nodes[nodeIndex]\n\n if (nodeDef.mesh === undefined) return null\n\n return parser.getDependency('mesh', nodeDef.mesh).then(function (mesh) {\n const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh)\n\n // if weights are provided on the node, override weights on the mesh.\n if (nodeDef.weights !== undefined) {\n node.traverse(function (o) {\n if (!o.isMesh) return\n\n for (let i = 0, il = nodeDef.weights.length; i < il; i++) {\n o.morphTargetInfluences[i] = nodeDef.weights[i]\n }\n })\n }\n\n return node\n })\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy\n * @param {number} nodeIndex\n * @return {Promise}\n */\n loadNode(nodeIndex) {\n const json = this.json\n const parser = this\n\n const nodeDef = json.nodes[nodeIndex]\n\n const nodePending = parser._loadNodeShallow(nodeIndex)\n\n const childPending = []\n const childrenDef = nodeDef.children || []\n\n for (let i = 0, il = childrenDef.length; i < il; i++) {\n childPending.push(parser.getDependency('node', childrenDef[i]))\n }\n\n const skeletonPending =\n nodeDef.skin === undefined ? Promise.resolve(null) : parser.getDependency('skin', nodeDef.skin)\n\n return Promise.all([nodePending, Promise.all(childPending), skeletonPending]).then(function (results) {\n const node = results[0]\n const children = results[1]\n const skeleton = results[2]\n\n if (skeleton !== null) {\n // 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\n mesh.bind(skeleton, _identityMatrix)\n })\n }\n\n for (let i = 0, il = children.length; i < il; i++) {\n node.add(children[i])\n }\n\n return node\n })\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\n // This method is called from .loadNode() and .loadSkin().\n // Cache a node to avoid duplication.\n\n if (this.nodeCache[nodeIndex] !== undefined) {\n return this.nodeCache[nodeIndex]\n }\n\n const nodeDef = json.nodes[nodeIndex]\n\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\n const pending = []\n\n const meshPromise = parser._invokeOne(function (ext) {\n return ext.createNodeMesh && ext.createNodeMesh(nodeIndex)\n })\n\n if (meshPromise) {\n pending.push(meshPromise)\n }\n\n if (nodeDef.camera !== undefined) {\n pending.push(\n parser.getDependency('camera', nodeDef.camera).then(function (camera) {\n return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera)\n }),\n )\n }\n\n parser\n ._invokeAll(function (ext) {\n return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex)\n })\n .forEach(function (promise) {\n pending.push(promise)\n })\n\n this.nodeCache[nodeIndex] = Promise.all(pending).then(function (objects) {\n let node\n\n // .isBone isn't in glTF spec. See ._markDefs\n if (nodeDef.isBone === true) {\n node = new Bone()\n } else if (objects.length > 1) {\n node = new Group()\n } else if (objects.length === 1) {\n node = objects[0]\n } else {\n node = new Object3D()\n }\n\n if (node !== objects[0]) {\n for (let i = 0, il = objects.length; i < il; i++) {\n node.add(objects[i])\n }\n }\n\n if (nodeDef.name) {\n node.userData.name = nodeDef.name\n node.name = nodeName\n }\n\n assignExtrasToUserData(node, nodeDef)\n\n if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef)\n\n if (nodeDef.matrix !== undefined) {\n const matrix = new Matrix4()\n matrix.fromArray(nodeDef.matrix)\n node.applyMatrix4(matrix)\n } else {\n if (nodeDef.translation !== undefined) {\n node.position.fromArray(nodeDef.translation)\n }\n\n if (nodeDef.rotation !== undefined) {\n node.quaternion.fromArray(nodeDef.rotation)\n }\n\n if (nodeDef.scale !== undefined) {\n node.scale.fromArray(nodeDef.scale)\n }\n }\n\n if (!parser.associations.has(node)) {\n parser.associations.set(node, {})\n }\n\n parser.associations.get(node).nodes = nodeIndex\n\n return node\n })\n\n return this.nodeCache[nodeIndex]\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes\n * @param {number} sceneIndex\n * @return {Promise}\n */\n loadScene(sceneIndex) {\n const extensions = this.extensions\n const sceneDef = this.json.scenes[sceneIndex]\n const parser = this\n\n // Loader returns Group, not Scene.\n // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172\n const scene = new Group()\n if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name)\n\n assignExtrasToUserData(scene, sceneDef)\n\n if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef)\n\n const nodeIds = sceneDef.nodes || []\n\n const pending = []\n\n for (let i = 0, il = nodeIds.length; i < il; i++) {\n pending.push(parser.getDependency('node', nodeIds[i]))\n }\n\n return Promise.all(pending).then(function (nodes) {\n for (let i = 0, il = nodes.length; i < il; i++) {\n scene.add(nodes[i])\n }\n\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\n for (const [key, value] of parser.associations) {\n if (key instanceof Material || key instanceof Texture) {\n reducedAssociations.set(key, value)\n }\n }\n\n node.traverse((node) => {\n const mappings = parser.associations.get(node)\n\n if (mappings != null) {\n reducedAssociations.set(node, mappings)\n }\n })\n\n return reducedAssociations\n }\n\n parser.associations = reduceAssociations(scene)\n\n return scene\n })\n }\n\n _createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target) {\n const tracks = []\n\n const targetName = node.name ? node.name : node.uuid\n const targetNames = []\n\n if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {\n node.traverse(function (object) {\n if (object.morphTargetInfluences) {\n targetNames.push(object.name ? object.name : object.uuid)\n }\n })\n } else {\n targetNames.push(targetName)\n }\n\n let TypedKeyframeTrack\n\n switch (PATH_PROPERTIES[target.path]) {\n case PATH_PROPERTIES.weights:\n TypedKeyframeTrack = NumberKeyframeTrack\n break\n\n case PATH_PROPERTIES.rotation:\n TypedKeyframeTrack = QuaternionKeyframeTrack\n break\n\n case PATH_PROPERTIES.position:\n case PATH_PROPERTIES.scale:\n TypedKeyframeTrack = VectorKeyframeTrack\n break\n\n default:\n switch (outputAccessor.itemSize) {\n case 1:\n TypedKeyframeTrack = NumberKeyframeTrack\n break\n case 2:\n case 3:\n default:\n TypedKeyframeTrack = VectorKeyframeTrack\n break\n }\n\n break\n }\n\n const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[sampler.interpolation] : InterpolateLinear\n\n const outputArray = this._getArrayFromAccessor(outputAccessor)\n\n for (let j = 0, jl = targetNames.length; j < jl; j++) {\n const track = new TypedKeyframeTrack(\n targetNames[j] + '.' + PATH_PROPERTIES[target.path],\n inputAccessor.array,\n outputArray,\n interpolation,\n )\n\n // Override interpolation with custom factory method.\n if (sampler.interpolation === 'CUBICSPLINE') {\n this._createCubicSplineTrackInterpolant(track)\n }\n\n tracks.push(track)\n }\n\n return tracks\n }\n\n _getArrayFromAccessor(accessor) {\n let outputArray = accessor.array\n\n if (accessor.normalized) {\n const scale = getNormalizedComponentScale(outputArray.constructor)\n const scaled = new Float32Array(outputArray.length)\n\n for (let j = 0, jl = outputArray.length; j < jl; j++) {\n scaled[j] = outputArray[j] * scale\n }\n\n outputArray = scaled\n }\n\n return outputArray\n }\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\n const interpolantType =\n this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant\n\n return new interpolantType(this.times, this.values, this.getValueSize() / 3, result)\n }\n\n // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.\n track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true\n }\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n */\nfunction computeBounds(geometry, primitiveDef, parser) {\n const attributes = primitiveDef.attributes\n\n const box = new Box3()\n\n if (attributes.POSITION !== undefined) {\n const accessor = parser.json.accessors[attributes.POSITION]\n\n const min = accessor.min\n const max = accessor.max\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n if (min !== undefined && max !== undefined) {\n box.set(new Vector3(min[0], min[1], min[2]), new Vector3(max[0], max[1], max[2]))\n\n if (accessor.normalized) {\n const boxScale = getNormalizedComponentScale(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\n return\n }\n } else {\n return\n }\n\n const targets = primitiveDef.targets\n\n if (targets !== undefined) {\n const maxDisplacement = new Vector3()\n const vector = new Vector3()\n\n for (let i = 0, il = targets.length; i < il; i++) {\n const target = targets[i]\n\n if (target.POSITION !== undefined) {\n const accessor = parser.json.accessors[target.POSITION]\n const min = accessor.min\n const max = accessor.max\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\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\n if (accessor.normalized) {\n const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType])\n vector.multiplyScalar(boxScale)\n }\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 {\n console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.')\n }\n }\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\n geometry.boundingBox = box\n\n const sphere = new Sphere()\n\n box.getCenter(sphere.center)\n sphere.radius = box.min.distanceTo(box.max) / 2\n\n geometry.boundingSphere = sphere\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 const attributes = primitiveDef.attributes\n\n const pending = []\n\n function assignAttributeAccessor(accessorIndex, attributeName) {\n return parser.getDependency('accessor', accessorIndex).then(function (accessor) {\n geometry.setAttribute(attributeName, accessor)\n })\n }\n\n for (const gltfAttributeName in attributes) {\n const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase()\n\n // Skip attributes already provided by e.g. Draco extension.\n if (threeAttributeName in geometry.attributes) continue\n\n pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName))\n }\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\n pending.push(accessor)\n }\n\n assignExtrasToUserData(geometry, primitiveDef)\n\n computeBounds(geometry, primitiveDef, parser)\n\n return Promise.all(pending).then(function () {\n return primitiveDef.targets !== undefined ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry\n })\n}\n\nexport { GLTFLoader }\n", "import * as THREE from 'three'\n\nconst PINCH_MAX = 0.05\nconst PINCH_THRESHOLD = 0.02\nconst PINCH_MIN = 0.01\nconst POINTER_ADVANCE_MAX = 0.02\nconst POINTER_OPACITY_MAX = 1\nconst POINTER_OPACITY_MIN = 0.4\nconst POINTER_FRONT_RADIUS = 0.002\nconst POINTER_REAR_RADIUS = 0.01\nconst POINTER_REAR_RADIUS_MIN = 0.003\nconst POINTER_LENGTH = 0.035\nconst POINTER_SEGMENTS = 16\nconst POINTER_RINGS = 12\nconst POINTER_HEMISPHERE_ANGLE = 110\nconst YAXIS = new THREE.Vector3(0, 1, 0)\nconst ZAXIS = new THREE.Vector3(0, 0, 1)\n\nconst CURSOR_RADIUS = 0.02\nconst CURSOR_MAX_DISTANCE = 1.5\n\nclass OculusHandPointerModel extends THREE.Object3D {\n constructor(hand, controller) {\n super()\n\n this.hand = hand\n this.controller = controller\n\n // Unused\n this.motionController = null\n this.envMap = null\n this.mesh = null\n\n this.pointerGeometry = null\n this.pointerMesh = null\n this.pointerObject = null\n\n this.pinched = false\n this.attached = false\n\n this.cursorObject = null\n\n this.raycaster = null\n\n this._onConnected = this._onConnected.bind(this)\n this._onDisconnected = this._onDisconnected.bind(this)\n this.hand.addEventListener('connected', this._onConnected)\n this.hand.addEventListener('disconnected', this._onDisconnected)\n }\n\n _onConnected(event) {\n const xrInputSource = event.data\n if (xrInputSource.hand) {\n this.visible = true\n this.xrInputSource = xrInputSource\n\n this.createPointer()\n }\n }\n\n _onDisconnected() {\n this.visible = false\n this.xrInputSource = null\n\n this.pointerGeometry?.dispose()\n this.pointerMesh?.material.dispose()\n\n this.clear()\n }\n\n _drawVerticesRing(vertices, baseVector, ringIndex) {\n const segmentVector = baseVector.clone()\n for (var i = 0; i < POINTER_SEGMENTS; i++) {\n segmentVector.applyAxisAngle(ZAXIS, (Math.PI * 2) / POINTER_SEGMENTS)\n const vid = ringIndex * POINTER_SEGMENTS + i\n vertices[3 * vid] = segmentVector.x\n vertices[3 * vid + 1] = segmentVector.y\n vertices[3 * vid + 2] = segmentVector.z\n }\n }\n\n _updatePointerVertices(rearRadius) {\n const vertices = this.pointerGeometry.attributes.position.array\n // first ring for front face\n const frontFaceBase = new THREE.Vector3(POINTER_FRONT_RADIUS, 0, -1 * (POINTER_LENGTH - rearRadius))\n this._drawVerticesRing(vertices, frontFaceBase, 0)\n\n // rings for rear hemisphere\n const rearBase = new THREE.Vector3(\n Math.sin((Math.PI * POINTER_HEMISPHERE_ANGLE) / 180) * rearRadius,\n Math.cos((Math.PI * POINTER_HEMISPHERE_ANGLE) / 180) * rearRadius,\n 0,\n )\n for (var i = 0; i < POINTER_RINGS; i++) {\n this._drawVerticesRing(vertices, rearBase, i + 1)\n rearBase.applyAxisAngle(YAXIS, (Math.PI * POINTER_HEMISPHERE_ANGLE) / 180 / (POINTER_RINGS * -2))\n }\n\n // front and rear face center vertices\n const frontCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS)\n const rearCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS) + 1\n const frontCenter = new THREE.Vector3(0, 0, -1 * (POINTER_LENGTH - rearRadius))\n vertices[frontCenterIndex * 3] = frontCenter.x\n vertices[frontCenterIndex * 3 + 1] = frontCenter.y\n vertices[frontCenterIndex * 3 + 2] = frontCenter.z\n const rearCenter = new THREE.Vector3(0, 0, rearRadius)\n vertices[rearCenterIndex * 3] = rearCenter.x\n vertices[rearCenterIndex * 3 + 1] = rearCenter.y\n vertices[rearCenterIndex * 3 + 2] = rearCenter.z\n\n this.pointerGeometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3))\n // verticesNeedUpdate = true;\n }\n\n createPointer() {\n var i, j\n const vertices = new Array(((POINTER_RINGS + 1) * POINTER_SEGMENTS + 2) * 3).fill(0)\n // const vertices = [];\n const indices = []\n this.pointerGeometry = new THREE.BufferGeometry()\n\n this.pointerGeometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3))\n\n this._updatePointerVertices(POINTER_REAR_RADIUS)\n\n // construct faces to connect rings\n for (i = 0; i < POINTER_RINGS; i++) {\n for (j = 0; j < POINTER_SEGMENTS - 1; j++) {\n indices.push(i * POINTER_SEGMENTS + j, i * POINTER_SEGMENTS + j + 1, (i + 1) * POINTER_SEGMENTS + j)\n indices.push(i * POINTER_SEGMENTS + j + 1, (i + 1) * POINTER_SEGMENTS + j + 1, (i + 1) * POINTER_SEGMENTS + j)\n }\n\n indices.push((i + 1) * POINTER_SEGMENTS - 1, i * POINTER_SEGMENTS, (i + 2) * POINTER_SEGMENTS - 1)\n indices.push(i * POINTER_SEGMENTS, (i + 1) * POINTER_SEGMENTS, (i + 2) * POINTER_SEGMENTS - 1)\n }\n\n // construct front and rear face\n const frontCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS)\n const rearCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS) + 1\n\n for (i = 0; i < POINTER_SEGMENTS - 1; i++) {\n indices.push(frontCenterIndex, i + 1, i)\n indices.push(rearCenterIndex, i + POINTER_SEGMENTS * POINTER_RINGS, i + POINTER_SEGMENTS * POINTER_RINGS + 1)\n }\n\n indices.push(frontCenterIndex, 0, POINTER_SEGMENTS - 1)\n indices.push(rearCenterIndex, POINTER_SEGMENTS * (POINTER_RINGS + 1) - 1, POINTER_SEGMENTS * POINTER_RINGS)\n\n const material = new THREE.MeshBasicMaterial()\n material.transparent = true\n material.opacity = POINTER_OPACITY_MIN\n\n this.pointerGeometry.setIndex(indices)\n\n this.pointerMesh = new THREE.Mesh(this.pointerGeometry, material)\n\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS)\n this.pointerObject = new THREE.Object3D()\n this.pointerObject.add(this.pointerMesh)\n\n this.raycaster = new THREE.Raycaster()\n\n // create cursor\n const cursorGeometry = new THREE.SphereGeometry(CURSOR_RADIUS, 10, 10)\n const cursorMaterial = new THREE.MeshBasicMaterial()\n cursorMaterial.transparent = true\n cursorMaterial.opacity = POINTER_OPACITY_MIN\n\n this.cursorObject = new THREE.Mesh(cursorGeometry, cursorMaterial)\n this.pointerObject.add(this.cursorObject)\n\n this.add(this.pointerObject)\n }\n\n _updateRaycaster() {\n if (this.raycaster) {\n const pointerMatrix = this.pointerObject.matrixWorld\n const tempMatrix = new THREE.Matrix4()\n tempMatrix.identity().extractRotation(pointerMatrix)\n this.raycaster.ray.origin.setFromMatrixPosition(pointerMatrix)\n this.raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix)\n }\n }\n\n _updatePointer() {\n this.pointerObject.visible = this.controller.visible\n const indexTip = this.hand.joints['index-finger-tip']\n const thumbTip = this.hand.joints['thumb-tip']\n const distance = indexTip.position.distanceTo(thumbTip.position)\n const position = indexTip.position.clone().add(thumbTip.position).multiplyScalar(0.5)\n this.pointerObject.position.copy(position)\n this.pointerObject.quaternion.copy(this.controller.quaternion)\n\n this.pinched = distance <= PINCH_THRESHOLD\n\n const pinchScale = (distance - PINCH_MIN) / (PINCH_MAX - PINCH_MIN)\n const focusScale = (distance - PINCH_MIN) / (PINCH_THRESHOLD - PINCH_MIN)\n if (pinchScale > 1) {\n this._updatePointerVertices(POINTER_REAR_RADIUS)\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS)\n this.pointerMesh.material.opacity = POINTER_OPACITY_MIN\n } else if (pinchScale > 0) {\n const rearRadius = (POINTER_REAR_RADIUS - POINTER_REAR_RADIUS_MIN) * pinchScale + POINTER_REAR_RADIUS_MIN\n this._updatePointerVertices(rearRadius)\n if (focusScale < 1) {\n this.pointerMesh.position.set(0, 0, -1 * rearRadius - (1 - focusScale) * POINTER_ADVANCE_MAX)\n this.pointerMesh.material.opacity =\n POINTER_OPACITY_MIN + (1 - focusScale) * (POINTER_OPACITY_MAX - POINTER_OPACITY_MIN)\n } else {\n this.pointerMesh.position.set(0, 0, -1 * rearRadius)\n this.pointerMesh.material.opacity = POINTER_OPACITY_MIN\n }\n } else {\n this._updatePointerVertices(POINTER_REAR_RADIUS_MIN)\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS_MIN - POINTER_ADVANCE_MAX)\n this.pointerMesh.material.opacity = POINTER_OPACITY_MAX\n }\n\n this.cursorObject.material.opacity = this.pointerMesh.material.opacity\n }\n\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force)\n if (this.pointerGeometry) {\n this._updatePointer()\n this._updateRaycaster()\n }\n }\n\n isPinched() {\n return this.pinched\n }\n\n setAttached(attached) {\n this.attached = attached\n }\n\n isAttached() {\n return this.attached\n }\n\n intersectObject(object, recursive = true) {\n if (this.raycaster) {\n return this.raycaster.intersectObject(object, recursive)\n }\n }\n\n intersectObjects(objects, recursive = true) {\n if (this.raycaster) {\n return this.raycaster.intersectObjects(objects, recursive)\n }\n }\n\n checkIntersections(objects, recursive = false) {\n if (this.raycaster && !this.attached) {\n const intersections = this.raycaster.intersectObjects(objects, recursive)\n const direction = new THREE.Vector3(0, 0, -1)\n if (intersections.length > 0) {\n const intersection = intersections[0]\n const distance = intersection.distance\n this.cursorObject.position.copy(direction.multiplyScalar(distance))\n } else {\n this.cursorObject.position.copy(direction.multiplyScalar(CURSOR_MAX_DISTANCE))\n }\n }\n }\n\n setCursor(distance) {\n const direction = new THREE.Vector3(0, 0, -1)\n if (this.raycaster && !this.attached) {\n this.cursorObject.position.copy(direction.multiplyScalar(distance))\n }\n }\n\n dispose() {\n this._onDisconnected()\n this.hand.removeEventListener('connected', this._onConnected)\n this.hand.removeEventListener('disconnected', this._onDisconnected)\n }\n}\n\nexport { OculusHandPointerModel }\n", "import { WebGLRenderer } from 'three'\n\nclass VRButton {\n static createButton(renderer: WebGLRenderer, sessionInit: XRSessionInit = {}): HTMLButtonElement | HTMLAnchorElement {\n const button = document.createElement('button')\n\n function showEnterVR(/*device*/): void {\n let currentSession: XRSession | null = null\n\n async function onSessionStarted(session: XRSession): Promise {\n session.addEventListener('end', onSessionEnded)\n\n await renderer.xr.setSession(session as any)\n button.textContent = 'EXIT VR'\n\n currentSession = session\n }\n\n function onSessionEnded(/*event*/): void {\n currentSession!.removeEventListener('end', onSessionEnded)\n\n button.textContent = 'ENTER VR'\n\n currentSession = null\n }\n\n //\n\n button.style.display = ''\n\n button.style.cursor = 'pointer'\n button.style.left = 'calc(50% - 50px)'\n button.style.width = '100px'\n\n button.textContent = 'ENTER VR'\n\n button.onmouseenter = (): void => {\n button.style.opacity = '1.0'\n }\n\n button.onmouseleave = (): void => {\n button.style.opacity = '0.5'\n }\n\n button.onclick = (): void => {\n if (currentSession === null) {\n // WebXR's requestReferenceSpace only works if the corresponding feature\n // was requested at session creation time. For simplicity, just ask for\n // the interesting ones as optional features, but be aware that the\n // requestReferenceSpace call will fail if it turns out to be unavailable.\n // ('local' is always available for immersive sessions and doesn't need to\n // be requested separately.)\n\n const optionalFeatures = [sessionInit.optionalFeatures, 'local-floor', 'bounded-floor', 'hand-tracking']\n .flat()\n .filter(Boolean) as string[]\n\n ;(navigator as Navigator).xr\n ?.requestSession('immersive-vr', { ...sessionInit, optionalFeatures })\n .then(onSessionStarted)\n } else {\n currentSession.end()\n }\n }\n }\n\n function disableButton(): void {\n button.style.display = ''\n\n button.style.cursor = 'auto'\n button.style.left = 'calc(50% - 75px)'\n button.style.width = '150px'\n\n button.onmouseenter = null\n button.onmouseleave = null\n\n button.onclick = null\n }\n\n function showWebXRNotFound(): void {\n disableButton()\n\n button.textContent = 'VR NOT SUPPORTED'\n }\n\n function stylizeElement(element: HTMLElement): void {\n element.style.position = 'absolute'\n element.style.bottom = '20px'\n element.style.padding = '12px 6px'\n element.style.border = '1px solid #fff'\n element.style.borderRadius = '4px'\n element.style.background = 'rgba(0,0,0,0.1)'\n element.style.color = '#fff'\n element.style.font = 'normal 13px sans-serif'\n element.style.textAlign = 'center'\n element.style.opacity = '0.5'\n element.style.outline = 'none'\n element.style.zIndex = '999'\n }\n\n if ('xr' in navigator) {\n stylizeElement(button)\n button.id = 'VRButton'\n button.style.display = 'none'\n\n // Query for session mode\n navigator.xr!.isSessionSupported('immersive-vr').then((supported) => {\n supported ? showEnterVR() : showWebXRNotFound()\n\n if (supported && VRButton.xrSessionIsGranted) {\n button.click()\n }\n })\n\n return button\n } else {\n const message = document.createElement('a')\n\n if (window.isSecureContext === false) {\n message.href = document.location.href.replace(/^http:/, 'https:')\n message.innerHTML = 'WEBXR NEEDS HTTPS' // TODO Improve message\n } else {\n message.href = 'https://immersiveweb.dev/'\n message.innerHTML = 'WEBXR NOT AVAILABLE'\n }\n\n message.style.left = 'calc(50% - 90px)'\n message.style.width = '180px'\n message.style.textDecoration = 'none'\n\n stylizeElement(message)\n\n return message\n }\n }\n\n static xrSessionIsGranted = false\n\n static registerSessionGrantedListener(): void {\n if (typeof navigator !== 'undefined' && 'xr' in navigator) {\n ;(navigator as Navigator).xr!.addEventListener('sessiongranted', () => {\n VRButton.xrSessionIsGranted = true\n })\n }\n }\n}\n\nVRButton.registerSessionGrantedListener()\n\nexport { VRButton }\n", "/**\n * @webxr-input-profiles/motion-controllers 1.0.0 https://github.com/immersive-web/webxr-input-profiles\n */\n\nimport type { Object3D } from 'three'\n\ninterface GamepadIndices {\n button: number\n xAxis?: number\n yAxis?: number\n}\n\ninterface VisualResponseDescription {\n componentProperty: string\n states: string[]\n valueNodeProperty: string\n valueNodeName: string\n minNodeName?: string\n maxNodeName?: string\n}\n\ntype VisualResponses = Record\n\ninterface ComponentDescription {\n type: string\n gamepadIndices: GamepadIndices\n rootNodeName: string\n visualResponses: VisualResponses\n touchPointNodeName?: string\n}\n\ninterface Components {\n [componentKey: string]: ComponentDescription\n}\n\ninterface LayoutDescription {\n selectComponentId: string\n components: Components\n gamepadMapping: string\n rootNodeName: string\n assetPath: string\n}\n\ntype Layouts = Partial>\n\nexport interface Profile {\n profileId: string\n fallbackProfileIds: string[]\n layouts: Layouts\n}\n\ninterface ProfilesList {\n [profileId: string]: { path: string; deprecated?: boolean } | undefined\n}\n\nconst MotionControllerConstants = {\n Handedness: {\n NONE: 'none',\n LEFT: 'left',\n RIGHT: 'right',\n },\n\n ComponentState: {\n DEFAULT: 'default',\n TOUCHED: 'touched',\n PRESSED: 'pressed',\n },\n\n ComponentProperty: {\n BUTTON: 'button',\n X_AXIS: 'xAxis',\n Y_AXIS: 'yAxis',\n STATE: 'state',\n },\n\n ComponentType: {\n TRIGGER: 'trigger',\n SQUEEZE: 'squeeze',\n TOUCHPAD: 'touchpad',\n THUMBSTICK: 'thumbstick',\n BUTTON: 'button',\n },\n\n ButtonTouchThreshold: 0.05,\n\n AxisTouchThreshold: 0.1,\n\n VisualResponseProperty: {\n TRANSFORM: 'transform',\n VISIBILITY: 'visibility',\n },\n}\n\n/**\n * @description Static helper function to fetch a JSON file and turn it into a JS object\n * @param {string} path - Path to JSON file to be fetched\n */\nasync function fetchJsonFile(path: string): Promise {\n const response = await fetch(path)\n if (!response.ok) {\n throw new Error(response.statusText)\n } else {\n return response.json()\n }\n}\n\nasync function fetchProfilesList(basePath: string): Promise {\n if (!basePath) {\n throw new Error('No basePath supplied')\n }\n\n const profileListFileName = 'profilesList.json'\n const profilesList = await fetchJsonFile(`${basePath}/${profileListFileName}`)\n return profilesList\n}\n\nasync function fetchProfile(\n xrInputSource: XRInputSource,\n basePath: string,\n defaultProfile: string | null = null,\n getAssetPath = true,\n): Promise<{ profile: Profile; assetPath: string | undefined }> {\n if (!xrInputSource) {\n throw new Error('No xrInputSource supplied')\n }\n\n if (!basePath) {\n throw new Error('No basePath supplied')\n }\n\n // Get the list of profiles\n const supportedProfilesList = await fetchProfilesList(basePath)\n\n // Find the relative path to the first requested profile that is recognized\n let match: { profileId: string; profilePath: string; deprecated: boolean } | undefined = undefined\n xrInputSource.profiles.some((profileId: string) => {\n const supportedProfile = supportedProfilesList[profileId]\n if (supportedProfile) {\n match = {\n profileId,\n profilePath: `${basePath}/${supportedProfile.path}`,\n deprecated: !!supportedProfile.deprecated,\n }\n }\n return !!match\n })\n\n if (!match) {\n if (!defaultProfile) {\n throw new Error('No matching profile name found')\n }\n\n const supportedProfile = supportedProfilesList[defaultProfile]\n if (!supportedProfile) {\n throw new Error(`No matching profile name found and default profile \"${defaultProfile}\" missing.`)\n }\n\n match = {\n profileId: defaultProfile,\n profilePath: `${basePath}/${supportedProfile.path}`,\n deprecated: !!supportedProfile.deprecated,\n }\n }\n\n const profile = await fetchJsonFile(match.profilePath)\n\n let assetPath: string | undefined = undefined\n if (getAssetPath) {\n let layout\n if ((xrInputSource.handedness as string) === 'any') {\n layout = profile.layouts[Object.keys(profile.layouts)[0] as XRHandedness]\n } else {\n layout = profile.layouts[xrInputSource.handedness]\n }\n if (!layout) {\n throw new Error(`No matching handedness, ${xrInputSource.handedness}, in profile ${match.profileId}`)\n }\n\n if (layout.assetPath) {\n assetPath = match.profilePath.replace('profile.json', layout.assetPath)\n }\n }\n\n return { profile, assetPath }\n}\n\n/** @constant {Object} */\nconst defaultComponentValues = {\n xAxis: 0,\n yAxis: 0,\n button: 0,\n state: MotionControllerConstants.ComponentState.DEFAULT,\n}\n\n/**\n * @description Converts an X, Y coordinate from the range -1 to 1 (as reported by the Gamepad\n * API) to the range 0 to 1 (for interpolation). Also caps the X, Y values to be bounded within\n * a circle. This ensures that thumbsticks are not animated outside the bounds of their physical\n * range of motion and touchpads do not report touch locations off their physical bounds.\n * @param {number | undefined} x The original x coordinate in the range -1 to 1\n * @param {number | undefined} y The original y coordinate in the range -1 to 1\n */\nfunction normalizeAxes(\n x: number | undefined = 0,\n y: number | undefined = 0,\n): { normalizedXAxis: number; normalizedYAxis: number } {\n let xAxis = x\n let yAxis = y\n\n // Determine if the point is outside the bounds of the circle\n // and, if so, place it on the edge of the circle\n const hypotenuse = Math.sqrt(x * x + y * y)\n if (hypotenuse > 1) {\n const theta = Math.atan2(y, x)\n xAxis = Math.cos(theta)\n yAxis = Math.sin(theta)\n }\n\n // Scale and move the circle so values are in the interpolation range. The circle's origin moves\n // from (0, 0) to (0.5, 0.5). The circle's radius scales from 1 to be 0.5.\n const result = {\n normalizedXAxis: xAxis * 0.5 + 0.5,\n normalizedYAxis: yAxis * 0.5 + 0.5,\n }\n return result\n}\n\n/**\n * Contains the description of how the 3D model should visually respond to a specific user input.\n * This is accomplished by initializing the object with the name of a node in the 3D model and\n * property that need to be modified in response to user input, the name of the nodes representing\n * the allowable range of motion, and the name of the input which triggers the change. In response\n * to the named input changing, this object computes the appropriate weighting to use for\n * interpolating between the range of motion nodes.\n */\nclass VisualResponse implements VisualResponseDescription {\n value: number | boolean\n componentProperty: string\n states: string[]\n valueNodeName: string\n valueNodeProperty: string\n minNodeName?: string\n maxNodeName?: string\n valueNode: Object3D | undefined\n minNode: Object3D | undefined\n maxNode: Object3D | undefined\n constructor(visualResponseDescription: VisualResponseDescription) {\n this.componentProperty = visualResponseDescription.componentProperty\n this.states = visualResponseDescription.states\n this.valueNodeName = visualResponseDescription.valueNodeName\n this.valueNodeProperty = visualResponseDescription.valueNodeProperty\n\n if (this.valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM) {\n this.minNodeName = visualResponseDescription.minNodeName\n this.maxNodeName = visualResponseDescription.maxNodeName\n }\n\n // Initializes the response's current value based on default data\n this.value = 0\n this.updateFromComponent(defaultComponentValues)\n }\n\n /**\n * Computes the visual response's interpolation weight based on component state\n * @param {Object} componentValues - The component from which to update\n * @param {number | undefined} xAxis - The reported X axis value of the component\n * @param {number | undefined} yAxis - The reported Y axis value of the component\n * @param {number | undefined} button - The reported value of the component's button\n * @param {string} state - The component's active state\n */\n updateFromComponent({\n xAxis,\n yAxis,\n button,\n state,\n }: {\n xAxis?: number\n yAxis?: number\n button?: number\n state: string\n }): void {\n const { normalizedXAxis, normalizedYAxis } = normalizeAxes(xAxis, yAxis)\n switch (this.componentProperty) {\n case MotionControllerConstants.ComponentProperty.X_AXIS:\n this.value = this.states.includes(state) ? normalizedXAxis : 0.5\n break\n case MotionControllerConstants.ComponentProperty.Y_AXIS:\n this.value = this.states.includes(state) ? normalizedYAxis : 0.5\n break\n case MotionControllerConstants.ComponentProperty.BUTTON:\n this.value = this.states.includes(state) && button ? button : 0\n break\n case MotionControllerConstants.ComponentProperty.STATE:\n if (this.valueNodeProperty === MotionControllerConstants.VisualResponseProperty.VISIBILITY) {\n this.value = this.states.includes(state)\n } else {\n this.value = this.states.includes(state) ? 1.0 : 0.0\n }\n break\n default:\n throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)\n }\n }\n}\n\nclass Component implements ComponentDescription {\n id: string\n values: {\n state: string\n button: number | undefined\n xAxis: number | undefined\n yAxis: number | undefined\n }\n\n type: string\n gamepadIndices: GamepadIndices\n rootNodeName: string\n visualResponses: Record\n touchPointNodeName?: string | undefined\n touchPointNode?: Object3D\n\n /**\n * @param {string} componentId - Id of the component\n * @param {InputProfileComponent} componentDescription - Description of the component to be created\n */\n constructor(componentId: string, componentDescription: ComponentDescription) {\n if (\n !componentId ||\n !componentDescription ||\n !componentDescription.visualResponses ||\n !componentDescription.gamepadIndices ||\n Object.keys(componentDescription.gamepadIndices).length === 0\n ) {\n throw new Error('Invalid arguments supplied')\n }\n\n this.id = componentId\n this.type = componentDescription.type\n this.rootNodeName = componentDescription.rootNodeName\n this.touchPointNodeName = componentDescription.touchPointNodeName\n\n // Build all the visual responses for this component\n this.visualResponses = {}\n Object.keys(componentDescription.visualResponses).forEach((responseName) => {\n const visualResponse = new VisualResponse(componentDescription.visualResponses[responseName])\n this.visualResponses[responseName] = visualResponse\n })\n\n // Set default values\n this.gamepadIndices = Object.assign({}, componentDescription.gamepadIndices)\n\n this.values = {\n state: MotionControllerConstants.ComponentState.DEFAULT,\n button: this.gamepadIndices.button !== undefined ? 0 : undefined,\n xAxis: this.gamepadIndices.xAxis !== undefined ? 0 : undefined,\n yAxis: this.gamepadIndices.yAxis !== undefined ? 0 : undefined,\n }\n }\n\n get data(): { id: Component['id'] } & Component['values'] {\n const data = { id: this.id, ...this.values }\n return data\n }\n\n /**\n * @description Poll for updated data based on current gamepad state\n * @param {Object} gamepad - The gamepad object from which the component data should be polled\n */\n updateFromGamepad(gamepad: Gamepad): void {\n // Set the state to default before processing other data sources\n this.values.state = MotionControllerConstants.ComponentState.DEFAULT\n\n // Get and normalize button\n if (this.gamepadIndices.button !== undefined && gamepad.buttons.length > this.gamepadIndices.button) {\n const gamepadButton = gamepad.buttons[this.gamepadIndices.button]\n this.values.button = gamepadButton.value\n this.values.button = this.values.button! < 0 ? 0 : this.values.button\n this.values.button = this.values.button! > 1 ? 1 : this.values.button\n\n // Set the state based on the button\n if (gamepadButton.pressed || this.values.button === 1) {\n this.values.state = MotionControllerConstants.ComponentState.PRESSED\n } else if (gamepadButton.touched || this.values.button! > MotionControllerConstants.ButtonTouchThreshold) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED\n }\n }\n\n // Get and normalize x axis value\n if (this.gamepadIndices.xAxis !== undefined && gamepad.axes.length > this.gamepadIndices.xAxis) {\n this.values.xAxis = gamepad.axes[this.gamepadIndices.xAxis]\n this.values.xAxis = this.values.xAxis! < -1 ? -1 : this.values.xAxis\n this.values.xAxis = this.values.xAxis! > 1 ? 1 : this.values.xAxis\n\n // If the state is still default, check if the xAxis makes it touched\n if (\n this.values.state === MotionControllerConstants.ComponentState.DEFAULT &&\n Math.abs(this.values.xAxis!) > MotionControllerConstants.AxisTouchThreshold\n ) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED\n }\n }\n\n // Get and normalize Y axis value\n if (this.gamepadIndices.yAxis !== undefined && gamepad.axes.length > this.gamepadIndices.yAxis) {\n this.values.yAxis = gamepad.axes[this.gamepadIndices.yAxis]\n this.values.yAxis = this.values.yAxis! < -1 ? -1 : this.values.yAxis\n this.values.yAxis = this.values.yAxis! > 1 ? 1 : this.values.yAxis\n\n // If the state is still default, check if the yAxis makes it touched\n if (\n this.values.state === MotionControllerConstants.ComponentState.DEFAULT &&\n Math.abs(this.values.yAxis!) > MotionControllerConstants.AxisTouchThreshold\n ) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED\n }\n }\n\n // Update the visual response weights based on the current component data\n Object.values(this.visualResponses).forEach((visualResponse) => {\n visualResponse.updateFromComponent(this.values)\n })\n }\n}\n/**\n * @description Builds a motion controller with components and visual responses based on the\n * supplied profile description. Data is polled from the xrInputSource's gamepad.\n * @author Nell Waliczek / https://github.com/NellWaliczek\n */\nclass MotionController {\n xrInputSource: XRInputSource\n assetUrl: string\n layoutDescription: LayoutDescription\n id: string\n components: Record\n /**\n * @param {XRInputSource} xrInputSource - The XRInputSource to build the MotionController around\n * @param {Profile} profile - The best matched profile description for the supplied xrInputSource\n * @param {string} assetUrl\n */\n constructor(xrInputSource: XRInputSource, profile: Profile, assetUrl: string) {\n if (!xrInputSource) {\n throw new Error('No xrInputSource supplied')\n }\n\n if (!profile) {\n throw new Error('No profile supplied')\n }\n\n if (!profile.layouts[xrInputSource.handedness]) {\n throw new Error('No layout for ' + xrInputSource.handedness + ' handedness')\n }\n\n this.xrInputSource = xrInputSource\n this.assetUrl = assetUrl\n this.id = profile.profileId\n\n // Build child components as described in the profile description\n this.layoutDescription = profile.layouts[xrInputSource.handedness]!\n\n this.components = {}\n Object.keys(this.layoutDescription.components).forEach((componentId) => {\n const componentDescription = this.layoutDescription.components[componentId]\n this.components[componentId] = new Component(componentId, componentDescription)\n })\n\n // Initialize components based on current gamepad state\n this.updateFromGamepad()\n }\n\n get gripSpace(): XRInputSource['gripSpace'] {\n return this.xrInputSource.gripSpace\n }\n\n get targetRaySpace(): XRInputSource['targetRaySpace'] {\n return this.xrInputSource.targetRaySpace\n }\n\n /**\n * @description Returns a subset of component data for simplified debugging\n */\n get data(): Array {\n const data: Array = []\n Object.values(this.components).forEach((component) => {\n data.push(component.data)\n })\n return data\n }\n\n /**\n * @description Poll for updated data based on current gamepad state\n */\n updateFromGamepad(): void {\n Object.values(this.components).forEach((component) => {\n component.updateFromGamepad(this.xrInputSource.gamepad!)\n })\n }\n}\n\nexport { MotionControllerConstants, MotionController, fetchProfile, fetchProfilesList }\n", "import {\n DynamicDrawUsage,\n SphereGeometry,\n BoxGeometry,\n MeshStandardMaterial,\n InstancedMesh,\n Matrix4,\n Vector3,\n} from 'three'\n\nconst _matrix = new Matrix4()\nconst _vector = new Vector3()\n\nclass XRHandPrimitiveModel {\n constructor(handModel, controller, path, handedness, options) {\n this.controller = controller\n this.handModel = handModel\n this.envMap = null\n\n let geometry\n\n if (!options || !options.primitive || options.primitive === 'sphere') {\n geometry = new SphereGeometry(1, 10, 10)\n } else if (options.primitive === 'box') {\n geometry = new BoxGeometry(1, 1, 1)\n }\n\n const material = new MeshStandardMaterial()\n\n this.handMesh = new InstancedMesh(geometry, material, 30)\n this.handMesh.instanceMatrix.setUsage(DynamicDrawUsage) // will be updated every frame\n this.handMesh.castShadow = true\n this.handMesh.receiveShadow = true\n this.handModel.add(this.handMesh)\n\n this.joints = [\n 'wrist',\n 'thumb-metacarpal',\n 'thumb-phalanx-proximal',\n 'thumb-phalanx-distal',\n 'thumb-tip',\n 'index-finger-metacarpal',\n 'index-finger-phalanx-proximal',\n 'index-finger-phalanx-intermediate',\n 'index-finger-phalanx-distal',\n 'index-finger-tip',\n 'middle-finger-metacarpal',\n 'middle-finger-phalanx-proximal',\n 'middle-finger-phalanx-intermediate',\n 'middle-finger-phalanx-distal',\n 'middle-finger-tip',\n 'ring-finger-metacarpal',\n 'ring-finger-phalanx-proximal',\n 'ring-finger-phalanx-intermediate',\n 'ring-finger-phalanx-distal',\n 'ring-finger-tip',\n 'pinky-finger-metacarpal',\n 'pinky-finger-phalanx-proximal',\n 'pinky-finger-phalanx-intermediate',\n 'pinky-finger-phalanx-distal',\n 'pinky-finger-tip',\n ]\n }\n\n updateMesh() {\n const defaultRadius = 0.008\n const joints = this.controller.joints\n\n let count = 0\n\n for (let i = 0; i < this.joints.length; i++) {\n const joint = joints[this.joints[i]]\n\n if (joint.visible) {\n _vector.setScalar(joint.jointRadius || defaultRadius)\n _matrix.compose(joint.position, joint.quaternion, _vector)\n this.handMesh.setMatrixAt(i, _matrix)\n\n count++\n }\n }\n\n this.handMesh.count = count\n this.handMesh.instanceMatrix.needsUpdate = true\n }\n}\n\nexport { XRHandPrimitiveModel }\n", "import { BoxGeometry, Vector3 } from 'three'\n\nconst tempNormal = new Vector3()\n\nfunction getUv(faceDirVector, normal, uvAxis, projectionAxis, radius, sideLength) {\n const totArcLength = (2 * Math.PI * radius) / 4\n\n // length of the planes between the arcs on each axis\n const centerLength = Math.max(sideLength - 2 * radius, 0)\n const halfArc = Math.PI / 4\n\n // Get the vector projected onto the Y plane\n tempNormal.copy(normal)\n tempNormal[projectionAxis] = 0\n tempNormal.normalize()\n\n // total amount of UV space alloted to a single arc\n const arcUvRatio = (0.5 * totArcLength) / (totArcLength + centerLength)\n\n // the distance along one arc the point is at\n const arcAngleRatio = 1.0 - tempNormal.angleTo(faceDirVector) / halfArc\n\n if (Math.sign(tempNormal[uvAxis]) === 1) {\n return arcAngleRatio * arcUvRatio\n } else {\n // total amount of UV space alloted to the plane between the arcs\n const lenUv = centerLength / (totArcLength + centerLength)\n return lenUv + arcUvRatio + arcUvRatio * (1.0 - arcAngleRatio)\n }\n}\n\nclass RoundedBoxGeometry extends BoxGeometry {\n constructor(width = 1, height = 1, depth = 1, segments = 2, radius = 0.1) {\n // ensure segments is odd so we have a plane connecting the rounded corners\n segments = segments * 2 + 1\n\n // ensure radius isn't bigger than shortest side\n radius = Math.min(width / 2, height / 2, depth / 2, radius)\n\n super(1, 1, 1, segments, segments, segments)\n\n // if we just have one segment we're the same as a regular box\n if (segments === 1) return\n\n const geometry2 = this.toNonIndexed()\n\n this.index = null\n this.attributes.position = geometry2.attributes.position\n this.attributes.normal = geometry2.attributes.normal\n this.attributes.uv = geometry2.attributes.uv\n\n //\n\n const position = new Vector3()\n const normal = new Vector3()\n\n const box = new Vector3(width, height, depth).divideScalar(2).subScalar(radius)\n\n const positions = this.attributes.position.array\n const normals = this.attributes.normal.array\n const uvs = this.attributes.uv.array\n\n const faceTris = positions.length / 6\n const faceDirVector = new Vector3()\n const halfSegmentSize = 0.5 / segments\n\n for (let i = 0, j = 0; i < positions.length; i += 3, j += 2) {\n position.fromArray(positions, i)\n normal.copy(position)\n normal.x -= Math.sign(normal.x) * halfSegmentSize\n normal.y -= Math.sign(normal.y) * halfSegmentSize\n normal.z -= Math.sign(normal.z) * halfSegmentSize\n normal.normalize()\n\n positions[i + 0] = box.x * Math.sign(position.x) + normal.x * radius\n positions[i + 1] = box.y * Math.sign(position.y) + normal.y * radius\n positions[i + 2] = box.z * Math.sign(position.z) + normal.z * radius\n\n normals[i + 0] = normal.x\n normals[i + 1] = normal.y\n normals[i + 2] = normal.z\n\n const side = Math.floor(i / faceTris)\n\n switch (side) {\n case 0: // right\n // generate UVs along Z then Y\n faceDirVector.set(1, 0, 0)\n uvs[j + 0] = getUv(faceDirVector, normal, 'z', 'y', radius, depth)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'z', radius, height)\n break\n\n case 1: // left\n // generate UVs along Z then Y\n faceDirVector.set(-1, 0, 0)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'z', 'y', radius, depth)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'z', radius, height)\n break\n\n case 2: // top\n // generate UVs along X then Z\n faceDirVector.set(0, 1, 0)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'x', 'z', radius, width)\n uvs[j + 1] = getUv(faceDirVector, normal, 'z', 'x', radius, depth)\n break\n\n case 3: // bottom\n // generate UVs along X then Z\n faceDirVector.set(0, -1, 0)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'x', 'z', radius, width)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'z', 'x', radius, depth)\n break\n\n case 4: // front\n // generate UVs along X then Y\n faceDirVector.set(0, 0, 1)\n uvs[j + 0] = 1.0 - getUv(faceDirVector, normal, 'x', 'y', radius, width)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'x', radius, height)\n break\n\n case 5: // back\n // generate UVs along X then Y\n faceDirVector.set(0, 0, -1)\n uvs[j + 0] = getUv(faceDirVector, normal, 'x', 'y', radius, width)\n uvs[j + 1] = 1.0 - getUv(faceDirVector, normal, 'y', 'x', radius, height)\n break\n }\n }\n }\n}\n\nexport { RoundedBoxGeometry }\n", "import { Vector3, Matrix4 } from 'three'\n\nconst inverseProjectionMatrix = new Matrix4()\n\nclass CSMFrustum {\n constructor(data) {\n data = data || {}\n\n this.vertices = {\n near: [new Vector3(), new Vector3(), new Vector3(), new Vector3()],\n far: [new Vector3(), new Vector3(), new Vector3(), new Vector3()],\n }\n\n if (data.projectionMatrix !== undefined) {\n this.setFromProjectionMatrix(data.projectionMatrix, data.maxFar || 10000)\n }\n }\n\n setFromProjectionMatrix(projectionMatrix, maxFar) {\n const isOrthographic = projectionMatrix.elements[2 * 4 + 3] === 0\n\n inverseProjectionMatrix.copy(projectionMatrix).invert()\n\n // 3 --- 0 vertices.near/far order\n // | |\n // 2 --- 1\n // clip space spans from [-1, 1]\n\n this.vertices.near[0].set(1, 1, -1)\n this.vertices.near[1].set(1, -1, -1)\n this.vertices.near[2].set(-1, -1, -1)\n this.vertices.near[3].set(-1, 1, -1)\n this.vertices.near.forEach(function (v) {\n v.applyMatrix4(inverseProjectionMatrix)\n })\n\n this.vertices.far[0].set(1, 1, 1)\n this.vertices.far[1].set(1, -1, 1)\n this.vertices.far[2].set(-1, -1, 1)\n this.vertices.far[3].set(-1, 1, 1)\n this.vertices.far.forEach(function (v) {\n v.applyMatrix4(inverseProjectionMatrix)\n\n const absZ = Math.abs(v.z)\n if (isOrthographic) {\n v.z *= Math.min(maxFar / absZ, 1.0)\n } else {\n v.multiplyScalar(Math.min(maxFar / absZ, 1.0))\n }\n })\n\n return this.vertices\n }\n\n split(breaks, target) {\n while (breaks.length > target.length) {\n target.push(new CSMFrustum())\n }\n\n target.length = breaks.length\n\n for (let i = 0; i < breaks.length; i++) {\n const cascade = target[i]\n\n if (i === 0) {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.near[j].copy(this.vertices.near[j])\n }\n } else {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.near[j].lerpVectors(this.vertices.near[j], this.vertices.far[j], breaks[i - 1])\n }\n }\n\n if (i === breaks.length - 1) {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.far[j].copy(this.vertices.far[j])\n }\n } else {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.far[j].lerpVectors(this.vertices.near[j], this.vertices.far[j], breaks[i])\n }\n }\n }\n }\n\n toSpace(cameraMatrix, target) {\n for (let i = 0; i < 4; i++) {\n target.vertices.near[i].copy(this.vertices.near[i]).applyMatrix4(cameraMatrix)\n\n target.vertices.far[i].copy(this.vertices.far[i]).applyMatrix4(cameraMatrix)\n }\n }\n}\n\nexport { CSMFrustum }\n", "import { Vector2, Vector3, DirectionalLight, MathUtils, ShaderChunk, Matrix4, Box3 } from 'three'\nimport { CSMFrustum } from './CSMFrustum'\nimport { CSMShader } from './CSMShader'\n\nconst _cameraToLightMatrix = new Matrix4()\nconst _lightSpaceFrustum = new CSMFrustum()\nconst _center = new Vector3()\nconst _bbox = new Box3()\nconst _uniformArray = []\nconst _logArray = []\n\nexport class CSM {\n constructor(data) {\n data = data || {}\n\n this.camera = data.camera\n this.parent = data.parent\n this.cascades = data.cascades || 3\n this.maxFar = data.maxFar || 100000\n this.mode = data.mode || 'practical'\n this.shadowMapSize = data.shadowMapSize || 2048\n this.shadowBias = data.shadowBias || 0.000001\n this.lightDirection = data.lightDirection || new Vector3(1, -1, 1).normalize()\n this.lightIntensity = data.lightIntensity || 1\n this.lightNear = data.lightNear || 1\n this.lightFar = data.lightFar || 2000\n this.lightMargin = data.lightMargin || 200\n this.customSplitsCallback = data.customSplitsCallback\n this.fade = false\n this.mainFrustum = new CSMFrustum()\n this.frustums = []\n this.breaks = []\n\n this.lights = []\n this.shaders = new Map()\n\n this.createLights()\n this.updateFrustums()\n this.injectInclude()\n }\n\n createLights() {\n for (let i = 0; i < this.cascades; i++) {\n const light = new DirectionalLight(0xffffff, this.lightIntensity)\n light.castShadow = true\n light.shadow.mapSize.width = this.shadowMapSize\n light.shadow.mapSize.height = this.shadowMapSize\n\n light.shadow.camera.near = this.lightNear\n light.shadow.camera.far = this.lightFar\n light.shadow.bias = this.shadowBias\n\n this.parent.add(light)\n this.parent.add(light.target)\n this.lights.push(light)\n }\n }\n\n initCascades() {\n const camera = this.camera\n camera.updateProjectionMatrix()\n this.mainFrustum.setFromProjectionMatrix(camera.projectionMatrix, this.maxFar)\n this.mainFrustum.split(this.breaks, this.frustums)\n }\n\n updateShadowBounds() {\n const frustums = this.frustums\n for (let i = 0; i < frustums.length; i++) {\n const light = this.lights[i]\n const shadowCam = light.shadow.camera\n const frustum = this.frustums[i]\n\n // Get the two points that represent that furthest points on the frustum assuming\n // that's either the diagonal across the far plane or the diagonal across the whole\n // frustum itself.\n const nearVerts = frustum.vertices.near\n const farVerts = frustum.vertices.far\n const point1 = farVerts[0]\n let point2\n if (point1.distanceTo(farVerts[2]) > point1.distanceTo(nearVerts[2])) {\n point2 = farVerts[2]\n } else {\n point2 = nearVerts[2]\n }\n\n let squaredBBWidth = point1.distanceTo(point2)\n if (this.fade) {\n // expand the shadow extents by the fade margin if fade is enabled.\n const camera = this.camera\n const far = Math.max(camera.far, this.maxFar)\n const linearDepth = frustum.vertices.far[0].z / (far - camera.near)\n const margin = 0.25 * Math.pow(linearDepth, 2.0) * (far - camera.near)\n\n squaredBBWidth += margin\n }\n\n shadowCam.left = -squaredBBWidth / 2\n shadowCam.right = squaredBBWidth / 2\n shadowCam.top = squaredBBWidth / 2\n shadowCam.bottom = -squaredBBWidth / 2\n shadowCam.updateProjectionMatrix()\n }\n }\n\n getBreaks() {\n const camera = this.camera\n const far = Math.min(camera.far, this.maxFar)\n this.breaks.length = 0\n\n switch (this.mode) {\n case 'uniform':\n uniformSplit(this.cascades, camera.near, far, this.breaks)\n break\n case 'logarithmic':\n logarithmicSplit(this.cascades, camera.near, far, this.breaks)\n break\n case 'practical':\n practicalSplit(this.cascades, camera.near, far, 0.5, this.breaks)\n break\n case 'custom':\n if (this.customSplitsCallback === undefined) console.error('CSM: Custom split scheme callback not defined.')\n this.customSplitsCallback(this.cascades, camera.near, far, this.breaks)\n break\n }\n\n function uniformSplit(amount, near, far, target) {\n for (let i = 1; i < amount; i++) {\n target.push((near + ((far - near) * i) / amount) / far)\n }\n\n target.push(1)\n }\n\n function logarithmicSplit(amount, near, far, target) {\n for (let i = 1; i < amount; i++) {\n target.push((near * (far / near) ** (i / amount)) / far)\n }\n\n target.push(1)\n }\n\n function practicalSplit(amount, near, far, lambda, target) {\n _uniformArray.length = 0\n _logArray.length = 0\n logarithmicSplit(amount, near, far, _logArray)\n uniformSplit(amount, near, far, _uniformArray)\n\n for (let i = 1; i < amount; i++) {\n target.push(MathUtils.lerp(_uniformArray[i - 1], _logArray[i - 1], lambda))\n }\n\n target.push(1)\n }\n }\n\n update() {\n const camera = this.camera\n const frustums = this.frustums\n for (let i = 0; i < frustums.length; i++) {\n const light = this.lights[i]\n const shadowCam = light.shadow.camera\n const texelWidth = (shadowCam.right - shadowCam.left) / this.shadowMapSize\n const texelHeight = (shadowCam.top - shadowCam.bottom) / this.shadowMapSize\n light.shadow.camera.updateMatrixWorld(true)\n _cameraToLightMatrix.multiplyMatrices(light.shadow.camera.matrixWorldInverse, camera.matrixWorld)\n frustums[i].toSpace(_cameraToLightMatrix, _lightSpaceFrustum)\n\n const nearVerts = _lightSpaceFrustum.vertices.near\n const farVerts = _lightSpaceFrustum.vertices.far\n _bbox.makeEmpty()\n for (let j = 0; j < 4; j++) {\n _bbox.expandByPoint(nearVerts[j])\n _bbox.expandByPoint(farVerts[j])\n }\n\n _bbox.getCenter(_center)\n _center.z = _bbox.max.z + this.lightMargin\n _center.x = Math.floor(_center.x / texelWidth) * texelWidth\n _center.y = Math.floor(_center.y / texelHeight) * texelHeight\n _center.applyMatrix4(light.shadow.camera.matrixWorld)\n\n light.position.copy(_center)\n light.target.position.copy(_center)\n\n light.target.position.x += this.lightDirection.x\n light.target.position.y += this.lightDirection.y\n light.target.position.z += this.lightDirection.z\n }\n }\n\n injectInclude() {\n ShaderChunk.lights_fragment_begin = CSMShader.lights_fragment_begin\n ShaderChunk.lights_pars_begin = CSMShader.lights_pars_begin\n }\n\n setupMaterial(material) {\n material.defines = material.defines || {}\n material.defines.USE_CSM = 1\n material.defines.CSM_CASCADES = this.cascades\n\n if (this.fade) {\n material.defines.CSM_FADE = ''\n }\n\n const breaksVec2 = []\n const scope = this\n const shaders = this.shaders\n\n material.onBeforeCompile = function (shader) {\n const far = Math.min(scope.camera.far, scope.maxFar)\n scope.getExtendedBreaks(breaksVec2)\n\n shader.uniforms.CSM_cascades = { value: breaksVec2 }\n shader.uniforms.cameraNear = { value: scope.camera.near }\n shader.uniforms.shadowFar = { value: far }\n\n shaders.set(material, shader)\n }\n\n shaders.set(material, null)\n }\n\n updateUniforms() {\n const far = Math.min(this.camera.far, this.maxFar)\n const shaders = this.shaders\n\n shaders.forEach(function (shader, material) {\n if (shader !== null) {\n const uniforms = shader.uniforms\n this.getExtendedBreaks(uniforms.CSM_cascades.value)\n uniforms.cameraNear.value = this.camera.near\n uniforms.shadowFar.value = far\n }\n\n if (!this.fade && 'CSM_FADE' in material.defines) {\n delete material.defines.CSM_FADE\n material.needsUpdate = true\n } else if (this.fade && !('CSM_FADE' in material.defines)) {\n material.defines.CSM_FADE = ''\n material.needsUpdate = true\n }\n }, this)\n }\n\n getExtendedBreaks(target) {\n while (target.length < this.breaks.length) {\n target.push(new Vector2())\n }\n\n target.length = this.breaks.length\n\n for (let i = 0; i < this.cascades; i++) {\n const amount = this.breaks[i]\n const prev = this.breaks[i - 1] || 0\n target[i].x = prev\n target[i].y = amount\n }\n }\n\n updateFrustums() {\n this.getBreaks()\n this.initCascades()\n this.updateShadowBounds()\n this.updateUniforms()\n }\n\n remove() {\n for (let i = 0; i < this.lights.length; i++) {\n this.parent.remove(this.lights[i])\n }\n }\n\n dispose() {\n const shaders = this.shaders\n shaders.forEach(function (shader, material) {\n delete material.onBeforeCompile\n delete material.defines.USE_CSM\n delete material.defines.CSM_CASCADES\n delete material.defines.CSM_FADE\n\n if (shader !== null) {\n delete shader.uniforms.CSM_cascades\n delete shader.uniforms.cameraNear\n delete shader.uniforms.shadowFar\n }\n\n material.needsUpdate = true\n })\n shaders.clear()\n }\n}\n", "/**\n * ACES Filmic Tone Mapping Shader by Stephen Hill\n * source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\n *\n * this implementation of ACES is modified to accommodate a brighter viewing environment.\n * the scale factor of 1/0.6 is subjective. see discussion in #19621.\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type ACESFilmicToneMappingShaderUniforms = {\n exposure: IUniform\n tDiffuse: IUniform\n}\n\nexport interface IACESFilmicToneMappingShader extends IShader {}\n\nexport const ACESFilmicToneMappingShader: IACESFilmicToneMappingShader = {\n uniforms: {\n tDiffuse: { value: null },\n exposure: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define saturate(a) clamp( a, 0.0, 1.0 )',\n\n 'uniform sampler2D tDiffuse;',\n\n 'uniform float exposure;',\n\n 'varying vec2 vUv;',\n\n 'vec3 RRTAndODTFit( vec3 v ) {',\n\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\n '}',\n\n 'vec3 ACESFilmicToneMapping( vec3 color ) {',\n\n // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n '\tconst mat3 ACESInputMat = mat3(',\n '\t\tvec3( 0.59719, 0.07600, 0.02840 ),', // transposed from source\n '\t\tvec3( 0.35458, 0.90834, 0.13383 ),',\n '\t\tvec3( 0.04823, 0.01566, 0.83777 )',\n '\t);',\n\n // ODT_SAT => XYZ => D60_2_D65 => sRGB\n '\tconst mat3 ACESOutputMat = mat3(',\n '\t\tvec3( 1.60475, -0.10208, -0.00327 ),', // transposed from source\n '\t\tvec3( -0.53108, 1.10813, -0.07276 ),',\n '\t\tvec3( -0.07367, -0.00605, 1.07602 )',\n '\t);',\n\n '\tcolor = ACESInputMat * color;',\n\n // Apply RRT and ODT\n '\tcolor = RRTAndODTFit( color );',\n\n '\tcolor = ACESOutputMat * color;',\n\n // Clamp to [0, 1]\n '\treturn saturate( color );',\n\n '}',\n\n 'void main() {',\n\n '\tvec4 tex = texture2D( tDiffuse, vUv );',\n\n '\ttex.rgb *= exposure / 0.6;', // pre-exposed, outside of the tone mapping function\n\n '\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Simple test shader\n */\n\nimport type { IShader } from './types'\n\nexport type BasicShaderUniforms = {}\n\nexport interface IBasicShader extends IShader {}\n\nexport const BasicShader: IBasicShader = {\n uniforms: {},\n\n vertexShader: [\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: ['void main() {', '\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );', '}'].join('\\n'),\n}\n", "/**\n * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass]\n * - based on Nvidia example\n * http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type BleachBypassShaderUniforms = {\n opacity: IUniform\n tDiffuse: IUniform\n}\n\nexport interface IBleachBypassShader extends IShader {}\n\nexport const BleachBypassShader: IBleachBypassShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 base = texture2D( tDiffuse, vUv );',\n\n '\tvec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );',\n '\tfloat lum = dot( lumCoeff, base.rgb );',\n '\tvec3 blend = vec3( lum );',\n\n '\tfloat L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );',\n\n '\tvec3 result1 = 2.0 * base.rgb * blend;',\n '\tvec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );',\n\n '\tvec3 newColor = mix( result1, result2, L );',\n\n '\tfloat A2 = opacity * base.a;',\n '\tvec3 mixRGB = A2 * newColor.rgb;',\n '\tmixRGB += ( ( 1.0 - A2 ) * base.rgb );',\n\n '\tgl_FragColor = vec4( mixRGB, base.a );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Blend two textures\n */\n\nexport const BlendShader = {\n uniforms: {\n tDiffuse1: { value: null },\n tDiffuse2: { value: null },\n mixRatio: { value: 0.5 },\n opacity: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float opacity;',\n 'uniform float mixRatio;',\n\n 'uniform sampler2D tDiffuse1;',\n 'uniform sampler2D tDiffuse2;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel1 = texture2D( tDiffuse1, vUv );',\n '\tvec4 texel2 = texture2D( tDiffuse2, vUv );',\n '\tgl_FragColor = opacity * mix( texel1, texel2, mixRatio );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Brightness and contrast adjustment\n * https://github.com/evanw/glfx.js\n * brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)\n * contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)\n */\n\nexport const BrightnessContrastShader = {\n uniforms: {\n tDiffuse: { value: null },\n brightness: { value: 0 },\n contrast: { value: 0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float brightness;',\n 'uniform float contrast;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tgl_FragColor = texture2D( tDiffuse, vUv );',\n\n '\tgl_FragColor.rgb += brightness;',\n\n '\tif (contrast > 0.0) {',\n '\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;',\n '\t} else {',\n '\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;',\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector3 } from 'three'\n\n/**\n * Color correction\n */\n\nexport const ColorCorrectionShader = {\n uniforms: {\n tDiffuse: { value: null },\n powRGB: { value: new Vector3(2, 2, 2) },\n mulRGB: { value: new Vector3(1, 1, 1) },\n addRGB: { value: new Vector3(0, 0, 0) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform vec3 powRGB;',\n 'uniform vec3 mulRGB;',\n 'uniform vec3 addRGB;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tgl_FragColor = texture2D( tDiffuse, vUv );',\n '\tgl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color } from 'three'\n\n/**\n * Colorify shader\n */\n\nexport const ColorifyShader = {\n uniforms: {\n tDiffuse: { value: null },\n color: { value: new Color(0xffffff) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 color;',\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n\n '\tvec3 luma = vec3( 0.299, 0.587, 0.114 );',\n '\tfloat v = dot( texel.xyz, luma );',\n\n '\tgl_FragColor = vec4( v * color, texel.w );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Depth-of-field shader using mipmaps\n * - from Matt Handley @applmak\n * - requires power-of-2 sized render target with enabled mipmaps\n */\n\nexport const DOFMipMapShader = {\n uniforms: {\n tColor: { value: null },\n tDepth: { value: null },\n focus: { value: 1.0 },\n maxblur: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float focus;',\n 'uniform float maxblur;',\n\n 'uniform sampler2D tColor;',\n 'uniform sampler2D tDepth;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 depth = texture2D( tDepth, vUv );',\n\n '\tfloat factor = depth.x - focus;',\n\n '\tvec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );',\n\n '\tgl_FragColor = col;',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * NVIDIA FXAA by Timothy Lottes\n * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n * - WebGL port by @supereggbert\n * http://www.glge.org/demos/fxaa/\n */\n\nexport const FXAAShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2(1 / 1024, 1 / 512) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'precision highp float;',\n '',\n 'uniform sampler2D tDiffuse;',\n '',\n 'uniform vec2 resolution;',\n '',\n 'varying vec2 vUv;',\n '',\n '// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)',\n '',\n '//----------------------------------------------------------------------------------',\n '// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag',\n '// SDK Version: v3.00',\n '// Email: gameworks@nvidia.com',\n '// Site: http://developer.nvidia.com/',\n '//',\n '// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.',\n '//',\n '// Redistribution and use in source and binary forms, with or without',\n '// modification, are permitted provided that the following conditions',\n '// are met:',\n '// * Redistributions of source code must retain the above copyright',\n '// notice, this list of conditions and the following disclaimer.',\n '// * Redistributions in binary form must reproduce the above copyright',\n '// notice, this list of conditions and the following disclaimer in the',\n '// documentation and/or other materials provided with the distribution.',\n '// * Neither the name of NVIDIA CORPORATION nor the names of its',\n '// contributors may be used to endorse or promote products derived',\n '// from this software without specific prior written permission.',\n '//',\n \"// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY\",\n '// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE',\n '// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR',\n '// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR',\n '// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,',\n '// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,',\n '// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR',\n '// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY',\n '// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT',\n '// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE',\n '// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.',\n '//',\n '//----------------------------------------------------------------------------------',\n '',\n '#define FXAA_PC 1',\n '#define FXAA_GLSL_100 1',\n '#define FXAA_QUALITY_PRESET 12',\n '',\n '#define FXAA_GREEN_AS_LUMA 1',\n '',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_PC_CONSOLE',\n ' //',\n ' // The console algorithm for PC is included',\n ' // for developers targeting really low spec machines.',\n ' // Likely better to just run FXAA_PC, and use a really low preset.',\n ' //',\n ' #define FXAA_PC_CONSOLE 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_GLSL_120',\n ' #define FXAA_GLSL_120 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_GLSL_130',\n ' #define FXAA_GLSL_130 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_HLSL_3',\n ' #define FXAA_HLSL_3 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_HLSL_4',\n ' #define FXAA_HLSL_4 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_HLSL_5',\n ' #define FXAA_HLSL_5 0',\n '#endif',\n '/*==========================================================================*/',\n '#ifndef FXAA_GREEN_AS_LUMA',\n ' //',\n ' // For those using non-linear color,',\n ' // and either not able to get luma in alpha, or not wanting to,',\n ' // this enables FXAA to run using green as a proxy for luma.',\n ' // So with this enabled, no need to pack luma in alpha.',\n ' //',\n ' // This will turn off AA on anything which lacks some amount of green.',\n ' // Pure red and blue or combination of only R and B, will get no AA.',\n ' //',\n ' // Might want to lower the settings for both,',\n ' // fxaaConsoleEdgeThresholdMin',\n ' // fxaaQualityEdgeThresholdMin',\n ' // In order to insure AA does not get turned off on colors',\n ' // which contain a minor amount of green.',\n ' //',\n ' // 1 = On.',\n ' // 0 = Off.',\n ' //',\n ' #define FXAA_GREEN_AS_LUMA 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_EARLY_EXIT',\n ' //',\n \" // Controls algorithm's early exit path.\",\n ' // On PS3 turning this ON adds 2 cycles to the shader.',\n ' // On 360 turning this OFF adds 10ths of a millisecond to the shader.',\n ' // Turning this off on console will result in a more blurry image.',\n ' // So this defaults to on.',\n ' //',\n ' // 1 = On.',\n ' // 0 = Off.',\n ' //',\n ' #define FXAA_EARLY_EXIT 1',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_DISCARD',\n ' //',\n ' // Only valid for PC OpenGL currently.',\n ' // Probably will not work when FXAA_GREEN_AS_LUMA = 1.',\n ' //',\n \" // 1 = Use discard on pixels which don't need AA.\",\n ' // For APIs which enable concurrent TEX+ROP from same surface.',\n \" // 0 = Return unchanged color on pixels which don't need AA.\",\n ' //',\n ' #define FXAA_DISCARD 0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_FAST_PIXEL_OFFSET',\n ' //',\n ' // Used for GLSL 120 only.',\n ' //',\n ' // 1 = GL API supports fast pixel offsets',\n ' // 0 = do not use fast pixel offsets',\n ' //',\n ' #ifdef GL_EXT_gpu_shader4',\n ' #define FXAA_FAST_PIXEL_OFFSET 1',\n ' #endif',\n ' #ifdef GL_NV_gpu_shader5',\n ' #define FXAA_FAST_PIXEL_OFFSET 1',\n ' #endif',\n ' #ifdef GL_ARB_gpu_shader5',\n ' #define FXAA_FAST_PIXEL_OFFSET 1',\n ' #endif',\n ' #ifndef FXAA_FAST_PIXEL_OFFSET',\n ' #define FXAA_FAST_PIXEL_OFFSET 0',\n ' #endif',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#ifndef FXAA_GATHER4_ALPHA',\n ' //',\n ' // 1 = API supports gather4 on alpha channel.',\n ' // 0 = API does not support gather4 on alpha channel.',\n ' //',\n ' #if (FXAA_HLSL_5 == 1)',\n ' #define FXAA_GATHER4_ALPHA 1',\n ' #endif',\n ' #ifdef GL_ARB_gpu_shader5',\n ' #define FXAA_GATHER4_ALPHA 1',\n ' #endif',\n ' #ifdef GL_NV_gpu_shader5',\n ' #define FXAA_GATHER4_ALPHA 1',\n ' #endif',\n ' #ifndef FXAA_GATHER4_ALPHA',\n ' #define FXAA_GATHER4_ALPHA 0',\n ' #endif',\n '#endif',\n '',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - TUNING KNOBS',\n '------------------------------------------------------------------------------',\n 'NOTE the other tuning knobs are now in the shader function inputs!',\n '============================================================================*/',\n '#ifndef FXAA_QUALITY_PRESET',\n ' //',\n ' // Choose the quality preset.',\n ' // This needs to be compiled into the shader as it effects code.',\n ' // Best option to include multiple presets is to',\n ' // in each shader define the preset, then include this file.',\n ' //',\n ' // OPTIONS',\n ' // -----------------------------------------------------------------------',\n ' // 10 to 15 - default medium dither (10=fastest, 15=highest quality)',\n ' // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)',\n ' // 39 - no dither, very expensive',\n ' //',\n ' // NOTES',\n ' // -----------------------------------------------------------------------',\n ' // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)',\n ' // 13 = about same speed as FXAA 3.9 and better than 12',\n ' // 23 = closest to FXAA 3.9 visually and performance wise',\n ' // _ = the lowest digit is directly related to performance',\n ' // _ = the highest digit is directly related to style',\n ' //',\n ' #define FXAA_QUALITY_PRESET 12',\n '#endif',\n '',\n '',\n '/*============================================================================',\n '',\n ' FXAA QUALITY - PRESETS',\n '',\n '============================================================================*/',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - MEDIUM DITHER PRESETS',\n '============================================================================*/',\n '#if (FXAA_QUALITY_PRESET == 10)',\n ' #define FXAA_QUALITY_PS 3',\n ' #define FXAA_QUALITY_P0 1.5',\n ' #define FXAA_QUALITY_P1 3.0',\n ' #define FXAA_QUALITY_P2 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 11)',\n ' #define FXAA_QUALITY_PS 4',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 3.0',\n ' #define FXAA_QUALITY_P3 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 12)',\n ' #define FXAA_QUALITY_PS 5',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 4.0',\n ' #define FXAA_QUALITY_P4 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 13)',\n ' #define FXAA_QUALITY_PS 6',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 4.0',\n ' #define FXAA_QUALITY_P5 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 14)',\n ' #define FXAA_QUALITY_PS 7',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 4.0',\n ' #define FXAA_QUALITY_P6 12.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 15)',\n ' #define FXAA_QUALITY_PS 8',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 4.0',\n ' #define FXAA_QUALITY_P7 12.0',\n '#endif',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - LOW DITHER PRESETS',\n '============================================================================*/',\n '#if (FXAA_QUALITY_PRESET == 20)',\n ' #define FXAA_QUALITY_PS 3',\n ' #define FXAA_QUALITY_P0 1.5',\n ' #define FXAA_QUALITY_P1 2.0',\n ' #define FXAA_QUALITY_P2 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 21)',\n ' #define FXAA_QUALITY_PS 4',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 22)',\n ' #define FXAA_QUALITY_PS 5',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 23)',\n ' #define FXAA_QUALITY_PS 6',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 24)',\n ' #define FXAA_QUALITY_PS 7',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 3.0',\n ' #define FXAA_QUALITY_P6 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 25)',\n ' #define FXAA_QUALITY_PS 8',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 4.0',\n ' #define FXAA_QUALITY_P7 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 26)',\n ' #define FXAA_QUALITY_PS 9',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 4.0',\n ' #define FXAA_QUALITY_P8 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 27)',\n ' #define FXAA_QUALITY_PS 10',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 4.0',\n ' #define FXAA_QUALITY_P9 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 28)',\n ' #define FXAA_QUALITY_PS 11',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 2.0',\n ' #define FXAA_QUALITY_P9 4.0',\n ' #define FXAA_QUALITY_P10 8.0',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_QUALITY_PRESET == 29)',\n ' #define FXAA_QUALITY_PS 12',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.5',\n ' #define FXAA_QUALITY_P2 2.0',\n ' #define FXAA_QUALITY_P3 2.0',\n ' #define FXAA_QUALITY_P4 2.0',\n ' #define FXAA_QUALITY_P5 2.0',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 2.0',\n ' #define FXAA_QUALITY_P9 2.0',\n ' #define FXAA_QUALITY_P10 4.0',\n ' #define FXAA_QUALITY_P11 8.0',\n '#endif',\n '',\n '/*============================================================================',\n ' FXAA QUALITY - EXTREME QUALITY',\n '============================================================================*/',\n '#if (FXAA_QUALITY_PRESET == 39)',\n ' #define FXAA_QUALITY_PS 12',\n ' #define FXAA_QUALITY_P0 1.0',\n ' #define FXAA_QUALITY_P1 1.0',\n ' #define FXAA_QUALITY_P2 1.0',\n ' #define FXAA_QUALITY_P3 1.0',\n ' #define FXAA_QUALITY_P4 1.0',\n ' #define FXAA_QUALITY_P5 1.5',\n ' #define FXAA_QUALITY_P6 2.0',\n ' #define FXAA_QUALITY_P7 2.0',\n ' #define FXAA_QUALITY_P8 2.0',\n ' #define FXAA_QUALITY_P9 2.0',\n ' #define FXAA_QUALITY_P10 4.0',\n ' #define FXAA_QUALITY_P11 8.0',\n '#endif',\n '',\n '',\n '',\n '/*============================================================================',\n '',\n ' API PORTING',\n '',\n '============================================================================*/',\n '#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)',\n ' #define FxaaBool bool',\n ' #define FxaaDiscard discard',\n ' #define FxaaFloat float',\n ' #define FxaaFloat2 vec2',\n ' #define FxaaFloat3 vec3',\n ' #define FxaaFloat4 vec4',\n ' #define FxaaHalf float',\n ' #define FxaaHalf2 vec2',\n ' #define FxaaHalf3 vec3',\n ' #define FxaaHalf4 vec4',\n ' #define FxaaInt2 ivec2',\n ' #define FxaaSat(x) clamp(x, 0.0, 1.0)',\n ' #define FxaaTex sampler2D',\n '#else',\n ' #define FxaaBool bool',\n ' #define FxaaDiscard clip(-1)',\n ' #define FxaaFloat float',\n ' #define FxaaFloat2 float2',\n ' #define FxaaFloat3 float3',\n ' #define FxaaFloat4 float4',\n ' #define FxaaHalf half',\n ' #define FxaaHalf2 half2',\n ' #define FxaaHalf3 half3',\n ' #define FxaaHalf4 half4',\n ' #define FxaaSat(x) saturate(x)',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_GLSL_100 == 1)',\n ' #define FxaaTexTop(t, p) texture2D(t, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_GLSL_120 == 1)',\n ' // Requires,',\n ' // #version 120',\n ' // And at least,',\n ' // #extension GL_EXT_gpu_shader4 : enable',\n ' // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)',\n ' #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)',\n ' #if (FXAA_FAST_PIXEL_OFFSET == 1)',\n ' #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)',\n ' #else',\n ' #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)',\n ' #endif',\n ' #if (FXAA_GATHER4_ALPHA == 1)',\n ' // use #extension GL_ARB_gpu_shader5 : enable',\n ' #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)',\n ' #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)',\n ' #define FxaaTexGreen4(t, p) textureGather(t, p, 1)',\n ' #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)',\n ' #endif',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_GLSL_130 == 1)',\n ' // Requires \"#version 130\" or better',\n ' #define FxaaTexTop(t, p) textureLod(t, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)',\n ' #if (FXAA_GATHER4_ALPHA == 1)',\n ' // use #extension GL_ARB_gpu_shader5 : enable',\n ' #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)',\n ' #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)',\n ' #define FxaaTexGreen4(t, p) textureGather(t, p, 1)',\n ' #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)',\n ' #endif',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_HLSL_3 == 1)',\n ' #define FxaaInt2 float2',\n ' #define FxaaTex sampler2D',\n ' #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))',\n ' #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_HLSL_4 == 1)',\n ' #define FxaaInt2 int2',\n ' struct FxaaTex { SamplerState smpl; Texture2D tex; };',\n ' #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)',\n '#endif',\n '/*--------------------------------------------------------------------------*/',\n '#if (FXAA_HLSL_5 == 1)',\n ' #define FxaaInt2 int2',\n ' struct FxaaTex { SamplerState smpl; Texture2D tex; };',\n ' #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)',\n ' #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)',\n ' #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)',\n ' #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)',\n ' #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)',\n ' #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)',\n '#endif',\n '',\n '',\n '/*============================================================================',\n ' GREEN AS LUMA OPTION SUPPORT FUNCTION',\n '============================================================================*/',\n '#if (FXAA_GREEN_AS_LUMA == 0)',\n ' FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }',\n '#else',\n ' FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }',\n '#endif',\n '',\n '',\n '',\n '',\n '/*============================================================================',\n '',\n ' FXAA3 QUALITY - PC',\n '',\n '============================================================================*/',\n '#if (FXAA_PC == 1)',\n '/*--------------------------------------------------------------------------*/',\n 'FxaaFloat4 FxaaPixelShader(',\n ' //',\n ' // Use noperspective interpolation here (turn off perspective interpolation).',\n ' // {xy} = center of pixel',\n ' FxaaFloat2 pos,',\n ' //',\n ' // Used only for FXAA Console, and not used on the 360 version.',\n ' // Use noperspective interpolation here (turn off perspective interpolation).',\n ' // {xy_} = upper left of pixel',\n ' // {_zw} = lower right of pixel',\n ' FxaaFloat4 fxaaConsolePosPos,',\n ' //',\n ' // Input color texture.',\n ' // {rgb_} = color in linear or perceptual color space',\n ' // if (FXAA_GREEN_AS_LUMA == 0)',\n ' // {__a} = luma in perceptual color space (not linear)',\n ' FxaaTex tex,',\n ' //',\n ' // Only used on the optimized 360 version of FXAA Console.',\n ' // For everything but 360, just use the same input here as for \"tex\".',\n ' // For 360, same texture, just alias with a 2nd sampler.',\n ' // This sampler needs to have an exponent bias of -1.',\n ' FxaaTex fxaaConsole360TexExpBiasNegOne,',\n ' //',\n ' // Only used on the optimized 360 version of FXAA Console.',\n ' // For everything but 360, just use the same input here as for \"tex\".',\n ' // For 360, same texture, just alias with a 3nd sampler.',\n ' // This sampler needs to have an exponent bias of -2.',\n ' FxaaTex fxaaConsole360TexExpBiasNegTwo,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This must be from a constant/uniform.',\n ' // {x_} = 1.0/screenWidthInPixels',\n ' // {_y} = 1.0/screenHeightInPixels',\n ' FxaaFloat2 fxaaQualityRcpFrame,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This must be from a constant/uniform.',\n ' // This effects sub-pixel AA quality and inversely sharpness.',\n ' // Where N ranges between,',\n ' // N = 0.50 (default)',\n ' // N = 0.33 (sharper)',\n ' // {x__} = -N/screenWidthInPixels',\n ' // {_y_} = -N/screenHeightInPixels',\n ' // {_z_} = N/screenWidthInPixels',\n ' // {__w} = N/screenHeightInPixels',\n ' FxaaFloat4 fxaaConsoleRcpFrameOpt,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // Not used on 360, but used on PS3 and PC.',\n ' // This must be from a constant/uniform.',\n ' // {x__} = -2.0/screenWidthInPixels',\n ' // {_y_} = -2.0/screenHeightInPixels',\n ' // {_z_} = 2.0/screenWidthInPixels',\n ' // {__w} = 2.0/screenHeightInPixels',\n ' FxaaFloat4 fxaaConsoleRcpFrameOpt2,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.',\n ' // This must be from a constant/uniform.',\n ' // {x__} = 8.0/screenWidthInPixels',\n ' // {_y_} = 8.0/screenHeightInPixels',\n ' // {_z_} = -4.0/screenWidthInPixels',\n ' // {__w} = -4.0/screenHeightInPixels',\n ' FxaaFloat4 fxaaConsole360RcpFrameOpt2,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This used to be the FXAA_QUALITY_SUBPIX define.',\n ' // It is here now to allow easier tuning.',\n ' // Choose the amount of sub-pixel aliasing removal.',\n ' // This can effect sharpness.',\n ' // 1.00 - upper limit (softer)',\n ' // 0.75 - default amount of filtering',\n ' // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)',\n ' // 0.25 - almost off',\n ' // 0.00 - completely off',\n ' FxaaFloat fxaaQualitySubpix,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.',\n ' // It is here now to allow easier tuning.',\n ' // The minimum amount of local contrast required to apply algorithm.',\n ' // 0.333 - too little (faster)',\n ' // 0.250 - low quality',\n ' // 0.166 - default',\n ' // 0.125 - high quality',\n ' // 0.063 - overkill (slower)',\n ' FxaaFloat fxaaQualityEdgeThreshold,',\n ' //',\n ' // Only used on FXAA Quality.',\n ' // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.',\n ' // It is here now to allow easier tuning.',\n ' // Trims the algorithm from processing darks.',\n ' // 0.0833 - upper limit (default, the start of visible unfiltered edges)',\n ' // 0.0625 - high quality (faster)',\n ' // 0.0312 - visible limit (slower)',\n ' // Special notes when using FXAA_GREEN_AS_LUMA,',\n ' // Likely want to set this to zero.',\n ' // As colors that are mostly not-green',\n ' // will appear very dark in the green channel!',\n ' // Tune by looking at mostly non-green content,',\n ' // then start at zero and increase until aliasing is a problem.',\n ' FxaaFloat fxaaQualityEdgeThresholdMin,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.',\n ' // It is here now to allow easier tuning.',\n ' // This does not effect PS3, as this needs to be compiled in.',\n ' // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.',\n ' // Due to the PS3 being ALU bound,',\n ' // there are only three safe values here: 2 and 4 and 8.',\n ' // These options use the shaders ability to a free *|/ by 2|4|8.',\n ' // For all other platforms can be a non-power of two.',\n ' // 8.0 is sharper (default!!!)',\n ' // 4.0 is softer',\n ' // 2.0 is really soft (good only for vector graphics inputs)',\n ' FxaaFloat fxaaConsoleEdgeSharpness,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.',\n ' // It is here now to allow easier tuning.',\n ' // This does not effect PS3, as this needs to be compiled in.',\n ' // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.',\n ' // Due to the PS3 being ALU bound,',\n ' // there are only two safe values here: 1/4 and 1/8.',\n ' // These options use the shaders ability to a free *|/ by 2|4|8.',\n ' // The console setting has a different mapping than the quality setting.',\n ' // Other platforms can use other values.',\n ' // 0.125 leaves less aliasing, but is softer (default!!!)',\n ' // 0.25 leaves more aliasing, and is sharper',\n ' FxaaFloat fxaaConsoleEdgeThreshold,',\n ' //',\n ' // Only used on FXAA Console.',\n ' // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.',\n ' // It is here now to allow easier tuning.',\n ' // Trims the algorithm from processing darks.',\n ' // The console setting has a different mapping than the quality setting.',\n ' // This only applies when FXAA_EARLY_EXIT is 1.',\n ' // This does not apply to PS3,',\n ' // PS3 was simplified to avoid more shader instructions.',\n ' // 0.06 - faster but more aliasing in darks',\n ' // 0.05 - default',\n ' // 0.04 - slower and less aliasing in darks',\n ' // Special notes when using FXAA_GREEN_AS_LUMA,',\n ' // Likely want to set this to zero.',\n ' // As colors that are mostly not-green',\n ' // will appear very dark in the green channel!',\n ' // Tune by looking at mostly non-green content,',\n ' // then start at zero and increase until aliasing is a problem.',\n ' FxaaFloat fxaaConsoleEdgeThresholdMin,',\n ' //',\n ' // Extra constants for 360 FXAA Console only.',\n ' // Use zeros or anything else for other platforms.',\n ' // These must be in physical constant registers and NOT immediates.',\n ' // Immediates will result in compiler un-optimizing.',\n ' // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)',\n ' FxaaFloat4 fxaaConsole360ConstDir',\n ') {',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat2 posM;',\n ' posM.x = pos.x;',\n ' posM.y = pos.y;',\n ' #if (FXAA_GATHER4_ALPHA == 1)',\n ' #if (FXAA_DISCARD == 0)',\n ' FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);',\n ' #if (FXAA_GREEN_AS_LUMA == 0)',\n ' #define lumaM rgbyM.w',\n ' #else',\n ' #define lumaM rgbyM.y',\n ' #endif',\n ' #endif',\n ' #if (FXAA_GREEN_AS_LUMA == 0)',\n ' FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);',\n ' FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));',\n ' #else',\n ' FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);',\n ' FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));',\n ' #endif',\n ' #if (FXAA_DISCARD == 1)',\n ' #define lumaM luma4A.w',\n ' #endif',\n ' #define lumaE luma4A.z',\n ' #define lumaS luma4A.x',\n ' #define lumaSE luma4A.y',\n ' #define lumaNW luma4B.w',\n ' #define lumaN luma4B.z',\n ' #define lumaW luma4B.x',\n ' #else',\n ' FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);',\n ' #if (FXAA_GREEN_AS_LUMA == 0)',\n ' #define lumaM rgbyM.w',\n ' #else',\n ' #define lumaM rgbyM.y',\n ' #endif',\n ' #if (FXAA_GLSL_100 == 1)',\n ' FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));',\n ' #else',\n ' FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));',\n ' #endif',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat maxSM = max(lumaS, lumaM);',\n ' FxaaFloat minSM = min(lumaS, lumaM);',\n ' FxaaFloat maxESM = max(lumaE, maxSM);',\n ' FxaaFloat minESM = min(lumaE, minSM);',\n ' FxaaFloat maxWN = max(lumaN, lumaW);',\n ' FxaaFloat minWN = min(lumaN, lumaW);',\n ' FxaaFloat rangeMax = max(maxWN, maxESM);',\n ' FxaaFloat rangeMin = min(minWN, minESM);',\n ' FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;',\n ' FxaaFloat range = rangeMax - rangeMin;',\n ' FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);',\n ' FxaaBool earlyExit = range < rangeMaxClamped;',\n '/*--------------------------------------------------------------------------*/',\n ' if(earlyExit)',\n ' #if (FXAA_DISCARD == 1)',\n ' FxaaDiscard;',\n ' #else',\n ' return rgbyM;',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_GATHER4_ALPHA == 0)',\n ' #if (FXAA_GLSL_100 == 1)',\n ' FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));',\n ' #else',\n ' FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));',\n ' #endif',\n ' #else',\n ' FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));',\n ' FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat lumaNS = lumaN + lumaS;',\n ' FxaaFloat lumaWE = lumaW + lumaE;',\n ' FxaaFloat subpixRcpRange = 1.0/range;',\n ' FxaaFloat subpixNSWE = lumaNS + lumaWE;',\n ' FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;',\n ' FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat lumaNESE = lumaNE + lumaSE;',\n ' FxaaFloat lumaNWNE = lumaNW + lumaNE;',\n ' FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;',\n ' FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat lumaNWSW = lumaNW + lumaSW;',\n ' FxaaFloat lumaSWSE = lumaSW + lumaSE;',\n ' FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);',\n ' FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);',\n ' FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;',\n ' FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;',\n ' FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;',\n ' FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;',\n ' FxaaFloat lengthSign = fxaaQualityRcpFrame.x;',\n ' FxaaBool horzSpan = edgeHorz >= edgeVert;',\n ' FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;',\n '/*--------------------------------------------------------------------------*/',\n ' if(!horzSpan) lumaN = lumaW;',\n ' if(!horzSpan) lumaS = lumaE;',\n ' if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;',\n ' FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat gradientN = lumaN - lumaM;',\n ' FxaaFloat gradientS = lumaS - lumaM;',\n ' FxaaFloat lumaNN = lumaN + lumaM;',\n ' FxaaFloat lumaSS = lumaS + lumaM;',\n ' FxaaBool pairN = abs(gradientN) >= abs(gradientS);',\n ' FxaaFloat gradient = max(abs(gradientN), abs(gradientS));',\n ' if(pairN) lengthSign = -lengthSign;',\n ' FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat2 posB;',\n ' posB.x = posM.x;',\n ' posB.y = posM.y;',\n ' FxaaFloat2 offNP;',\n ' offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;',\n ' offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;',\n ' if(!horzSpan) posB.x += lengthSign * 0.5;',\n ' if( horzSpan) posB.y += lengthSign * 0.5;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat2 posN;',\n ' posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;',\n ' posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;',\n ' FxaaFloat2 posP;',\n ' posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;',\n ' posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;',\n ' FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;',\n ' FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));',\n ' FxaaFloat subpixE = subpixC * subpixC;',\n ' FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));',\n '/*--------------------------------------------------------------------------*/',\n ' if(!pairN) lumaNN = lumaSS;',\n ' FxaaFloat gradientScaled = gradient * 1.0/4.0;',\n ' FxaaFloat lumaMM = lumaM - lumaNN * 0.5;',\n ' FxaaFloat subpixF = subpixD * subpixE;',\n ' FxaaBool lumaMLTZero = lumaMM < 0.0;',\n '/*--------------------------------------------------------------------------*/',\n ' lumaEndN -= lumaNN * 0.5;',\n ' lumaEndP -= lumaNN * 0.5;',\n ' FxaaBool doneN = abs(lumaEndN) >= gradientScaled;',\n ' FxaaBool doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;',\n ' FxaaBool doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;',\n '/*--------------------------------------------------------------------------*/',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 3)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 4)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 5)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 6)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 7)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 8)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 9)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 10)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 11)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;',\n '/*--------------------------------------------------------------------------*/',\n ' #if (FXAA_QUALITY_PS > 12)',\n ' if(doneNP) {',\n ' if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));',\n ' if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));',\n ' if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;',\n ' if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;',\n ' doneN = abs(lumaEndN) >= gradientScaled;',\n ' doneP = abs(lumaEndP) >= gradientScaled;',\n ' if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;',\n ' if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;',\n ' doneNP = (!doneN) || (!doneP);',\n ' if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;',\n ' if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n ' #endif',\n '/*--------------------------------------------------------------------------*/',\n ' }',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat dstN = posM.x - posN.x;',\n ' FxaaFloat dstP = posP.x - posM.x;',\n ' if(!horzSpan) dstN = posM.y - posN.y;',\n ' if(!horzSpan) dstP = posP.y - posM.y;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;',\n ' FxaaFloat spanLength = (dstP + dstN);',\n ' FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;',\n ' FxaaFloat spanLengthRcp = 1.0/spanLength;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaBool directionN = dstN < dstP;',\n ' FxaaFloat dst = min(dstN, dstP);',\n ' FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;',\n ' FxaaFloat subpixG = subpixF * subpixF;',\n ' FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;',\n ' FxaaFloat subpixH = subpixG * fxaaQualitySubpix;',\n '/*--------------------------------------------------------------------------*/',\n ' FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;',\n ' FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);',\n ' if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;',\n ' if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;',\n ' #if (FXAA_DISCARD == 1)',\n ' return FxaaTexTop(tex, posM);',\n ' #else',\n ' return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);',\n ' #endif',\n '}',\n '/*==========================================================================*/',\n '#endif',\n '',\n 'void main() {',\n ' gl_FragColor = FxaaPixelShader(',\n ' vUv,',\n ' vec4(0.0),',\n ' tDiffuse,',\n ' tDiffuse,',\n ' tDiffuse,',\n ' resolution,',\n ' vec4(0.0),',\n ' vec4(0.0),',\n ' vec4(0.0),',\n ' 0.75,',\n ' 0.166,',\n ' 0.0833,',\n ' 0.0,',\n ' 0.0,',\n ' 0.0,',\n ' vec4(0.0)',\n ' );',\n '',\n ' // TODO avoid querying texture twice for same texel',\n ' gl_FragColor.a = texture2D(tDiffuse, vUv).a;',\n '}',\n ].join('\\n'),\n}\n", "/**\n * Focus shader\n * based on PaintEffect postprocess from ro.me\n * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js\n */\n\nexport const FocusShader = {\n uniforms: {\n tDiffuse: { value: null },\n screenWidth: { value: 1024 },\n screenHeight: { value: 1024 },\n sampleDistance: { value: 0.94 },\n waveFactor: { value: 0.00125 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float screenWidth;',\n 'uniform float screenHeight;',\n 'uniform float sampleDistance;',\n 'uniform float waveFactor;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 color, org, tmp, add;',\n '\tfloat sample_dist, f;',\n '\tvec2 vin;',\n '\tvec2 uv = vUv;',\n\n '\tadd = color = org = texture2D( tDiffuse, uv );',\n\n '\tvin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );',\n '\tsample_dist = dot( vin, vin ) * 2.0;',\n\n '\tf = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;',\n\n '\tvec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );',\n '\tif( tmp.b < color.b ) color = tmp;',\n\n '\tcolor = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );',\n '\tcolor = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );',\n\n '\tgl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Edge Detection Shader using Frei-Chen filter\n * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector\n *\n * aspect: vec2 of (1/width, 1/height)\n */\n\nexport const FreiChenShader = {\n uniforms: {\n tDiffuse: { value: null },\n aspect: { value: new Vector2(512, 512) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'varying vec2 vUv;',\n\n 'uniform vec2 aspect;',\n\n 'vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);',\n\n 'mat3 G[9];',\n\n // hard coded matrix values!!!! as suggested in https://github.com/neilmendoza/ofxPostProcessing/blob/master/src/EdgePass.cpp#L45\n\n 'const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );',\n 'const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );',\n 'const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );',\n 'const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );',\n 'const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );',\n 'const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );',\n 'const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );',\n 'const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );',\n 'const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );',\n\n 'void main(void)',\n '{',\n\n '\tG[0] = g0,',\n '\tG[1] = g1,',\n '\tG[2] = g2,',\n '\tG[3] = g3,',\n '\tG[4] = g4,',\n '\tG[5] = g5,',\n '\tG[6] = g6,',\n '\tG[7] = g7,',\n '\tG[8] = g8;',\n\n '\tmat3 I;',\n '\tfloat cnv[9];',\n '\tvec3 sample;',\n\n /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */\n '\tfor (float i=0.0; i<3.0; i++) {',\n '\t\tfor (float j=0.0; j<3.0; j++) {',\n '\t\t\tsample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;',\n '\t\t\tI[int(i)][int(j)] = length(sample);',\n '\t\t}',\n '\t}',\n\n /* calculate the convolution values for all the masks */\n '\tfor (int i=0; i<9; i++) {',\n '\t\tfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);',\n '\t\tcnv[i] = dp3 * dp3;',\n '\t}',\n\n '\tfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);',\n '\tfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);',\n\n '\tgl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);',\n '}',\n ].join('\\n'),\n}\n", "/**\n * Based on Nvidia Cg tutorial\n */\n\nexport const FresnelShader = {\n uniforms: {\n mRefractionRatio: { value: 1.02 },\n mFresnelBias: { value: 0.1 },\n mFresnelPower: { value: 2.0 },\n mFresnelScale: { value: 1.0 },\n tCube: { value: null },\n },\n\n vertexShader: [\n 'uniform float mRefractionRatio;',\n 'uniform float mFresnelBias;',\n 'uniform float mFresnelScale;',\n 'uniform float mFresnelPower;',\n\n 'varying vec3 vReflect;',\n 'varying vec3 vRefract[3];',\n 'varying float vReflectionFactor;',\n\n 'void main() {',\n\n '\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n '\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n\n '\tvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );',\n\n '\tvec3 I = worldPosition.xyz - cameraPosition;',\n\n '\tvReflect = reflect( I, worldNormal );',\n '\tvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );',\n '\tvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );',\n '\tvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );',\n '\tvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );',\n\n '\tgl_Position = projectionMatrix * mvPosition;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform samplerCube tCube;',\n\n 'varying vec3 vReflect;',\n 'varying vec3 vRefract[3];',\n 'varying float vReflectionFactor;',\n\n 'void main() {',\n\n '\tvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );',\n '\tvec4 refractedColor = vec4( 1.0 );',\n\n '\trefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;',\n '\trefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;',\n '\trefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;',\n\n '\tgl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Gamma Correction Shader\n * http://en.wikipedia.org/wiki/gamma_correction\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type GammaCorrectionShaderUniforms = {\n tDiffuse: IUniform\n}\n\nexport interface IGammaCorrectionShader extends IShader {}\n\nexport const GammaCorrectionShader: IGammaCorrectionShader = {\n uniforms: {\n tDiffuse: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 tex = texture2D( tDiffuse, vUv );',\n\n '\tgl_FragColor = LinearTosRGB( tex );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color, Vector3 } from 'three'\n\n/**\n * God-rays (crepuscular rays)\n *\n * Similar implementation to the one used by Crytek for CryEngine 2 [Sousa2008].\n * Blurs a mask generated from the depth map along radial lines emanating from the light\n * source. The blur repeatedly applies a blur filter of increasing support but constant\n * sample count to produce a blur filter with large support.\n *\n * My implementation performs 3 passes, similar to the implementation from Sousa. I found\n * just 6 samples per pass produced acceptible results. The blur is applied three times,\n * with decreasing filter support. The result is equivalent to a single pass with\n * 6*6*6 = 216 samples.\n *\n * References:\n *\n * Sousa2008 - Crysis Next Gen Effects, GDC2008, http://www.crytek.com/sites/default/files/GDC08_SousaT_CrysisEffects.ppt\n */\n\nexport const GodRaysDepthMaskShader = {\n uniforms: {\n tInput: {\n value: null,\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n ' vUv = uv;',\n ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tInput;',\n\n 'void main() {',\n\n '\tgl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv );',\n\n '}',\n ].join('\\n'),\n}\n\n/**\n * The god-ray generation shader.\n *\n * First pass:\n *\n * The depth map is blurred along radial lines towards the \"sun\". The\n * output is written to a temporary render target (I used a 1/4 sized\n * target).\n *\n * Pass two & three:\n *\n * The results of the previous pass are re-blurred, each time with a\n * decreased distance between samples.\n */\n\nexport const GodRaysGenerateShader = {\n uniforms: {\n tInput: {\n value: null,\n },\n fStepSize: {\n value: 1.0,\n },\n vSunPositionScreenSpace: {\n value: new Vector3(),\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n ' vUv = uv;',\n ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#define TAPS_PER_PASS 6.0',\n\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tInput;',\n\n 'uniform vec3 vSunPositionScreenSpace;',\n 'uniform float fStepSize;', // filter step size\n\n 'void main() {',\n\n // delta from current pixel to \"sun\" position\n\n '\tvec2 delta = vSunPositionScreenSpace.xy - vUv;',\n '\tfloat dist = length( delta );',\n\n // Step vector (uv space)\n\n '\tvec2 stepv = fStepSize * delta / dist;',\n\n // Number of iterations between pixel and sun\n\n '\tfloat iters = dist/fStepSize;',\n\n '\tvec2 uv = vUv.xy;',\n '\tfloat col = 0.0;',\n\n // This breaks ANGLE in Chrome 22\n //\t- see http://code.google.com/p/chromium/issues/detail?id=153105\n\n /*\n\t\t// Unrolling didnt do much on my hardware (ATI Mobility Radeon 3450),\n\t\t// so i've just left the loop\n\n\t\t\"for ( float i = 0.0; i < TAPS_PER_PASS; i += 1.0 ) {\",\n\n\t\t// Accumulate samples, making sure we dont walk past the light source.\n\n\t\t// The check for uv.y < 1 would not be necessary with \"border\" UV wrap\n\t\t// mode, with a black border color. I don't think this is currently\n\t\t// exposed by three.js. As a result there might be artifacts when the\n\t\t// sun is to the left, right or bottom of screen as these cases are\n\t\t// not specifically handled.\n\n\t\t\"\tcol += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );\",\n\t\t\"\tuv += stepv;\",\n\n\t\t\"}\",\n\t\t*/\n\n // Unrolling loop manually makes it work in ANGLE\n\n '\tfloat f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) );', // used to fade out godrays\n\n '\tif ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n '\tif ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;',\n '\tuv += stepv;',\n\n // Should technically be dividing by 'iters', but 'TAPS_PER_PASS' smooths out\n // objectionable artifacts, in particular near the sun position. The side\n // effect is that the result is darker than it should be around the sun, as\n // TAPS_PER_PASS is greater than the number of samples actually accumulated.\n // When the result is inverted (in the shader 'godrays_combine', this produces\n // a slight bright spot at the position of the sun, even when it is occluded.\n\n '\tgl_FragColor = vec4( col/TAPS_PER_PASS );',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n\n/**\n * Additively applies god rays from texture tGodRays to a background (tColors).\n * fGodRayIntensity attenuates the god rays.\n */\n\nexport const GodRaysCombineShader = {\n uniforms: {\n tColors: {\n value: null,\n },\n\n tGodRays: {\n value: null,\n },\n\n fGodRayIntensity: {\n value: 0.69,\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'varying vec2 vUv;',\n\n 'uniform sampler2D tColors;',\n 'uniform sampler2D tGodRays;',\n\n 'uniform float fGodRayIntensity;',\n\n 'void main() {',\n\n // Since THREE.MeshDepthMaterial renders foreground objects white and background\n // objects black, the god-rays will be white streaks. Therefore value is inverted\n // before being combined with tColors\n\n '\tgl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r );',\n '\tgl_FragColor.a = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n\n/**\n * A dodgy sun/sky shader. Makes a bright spot at the sun location. Would be\n * cheaper/faster/simpler to implement this as a simple sun sprite.\n */\n\nexport const GodRaysFakeSunShader = {\n uniforms: {\n vSunPositionScreenSpace: {\n value: new Vector3(),\n },\n\n fAspect: {\n value: 1.0,\n },\n\n sunColor: {\n value: new Color(0xffee00),\n },\n\n bgColor: {\n value: new Color(0x000000),\n },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'varying vec2 vUv;',\n\n 'uniform vec3 vSunPositionScreenSpace;',\n 'uniform float fAspect;',\n\n 'uniform vec3 sunColor;',\n 'uniform vec3 bgColor;',\n\n 'void main() {',\n\n '\tvec2 diff = vUv - vSunPositionScreenSpace.xy;',\n\n // Correct for aspect ratio\n\n '\tdiff.x *= fAspect;',\n\n '\tfloat prop = clamp( length( diff ) / 0.5, 0.0, 1.0 );',\n '\tprop = 0.35 * pow( 1.0 - prop, 3.0 );',\n\n '\tgl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor;',\n '\tgl_FragColor.w = 1.0;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Two pass Gaussian blur filter (horizontal and vertical blur shaders)\n * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/\n * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type HorizontalBlurShaderUniforms = {\n tDiffuse: IUniform\n h: IUniform\n}\n\nexport interface IHorizontalBlurShader extends IShader {}\n\nexport const HorizontalBlurShader: IHorizontalBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n h: { value: 1.0 / 512.0 },\n },\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n fragmentShader: /* glsl */ `\n uniform sampler2D tDiffuse;\n uniform float h;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec4 sum = vec4( 0.0 );\n\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n \tgl_FragColor = sum;\n\n }\n `,\n}\n", "/**\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nexport const HorizontalTiltShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n h: { value: 1.0 / 512.0 },\n r: { value: 0.35 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float h;',\n 'uniform float r;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 sum = vec4( 0.0 );',\n\n '\tfloat hh = h * abs( r - vUv.y );',\n\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;',\n\n '\tgl_FragColor = sum;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Hue and saturation adjustment\n * https://github.com/evanw/glfx.js\n * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc.\n * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)\n */\n\nexport const HueSaturationShader = {\n uniforms: {\n tDiffuse: { value: null },\n hue: { value: 0 },\n saturation: { value: 0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float hue;',\n 'uniform float saturation;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tgl_FragColor = texture2D( tDiffuse, vUv );',\n\n // hue\n '\tfloat angle = hue * 3.14159265;',\n '\tfloat s = sin(angle), c = cos(angle);',\n '\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;',\n '\tfloat len = length(gl_FragColor.rgb);',\n '\tgl_FragColor.rgb = vec3(',\n '\t\tdot(gl_FragColor.rgb, weights.xyz),',\n '\t\tdot(gl_FragColor.rgb, weights.zxy),',\n '\t\tdot(gl_FragColor.rgb, weights.yzx)',\n '\t);',\n\n // saturation\n '\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;',\n '\tif (saturation > 0.0) {',\n '\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));',\n '\t} else {',\n '\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);',\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Kaleidoscope Shader\n * Radial reflection around center point\n * Ported from: http://pixelshaders.com/editor/\n * by Toby Schachman / http://tobyschachman.com/\n *\n * sides: number of reflections\n * angle: initial angle in radians\n */\n\nexport const KaleidoShader = {\n uniforms: {\n tDiffuse: { value: null },\n sides: { value: 6.0 },\n angle: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float sides;',\n 'uniform float angle;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 p = vUv - 0.5;',\n '\tfloat r = length(p);',\n '\tfloat a = atan(p.y, p.x) + angle;',\n '\tfloat tau = 2. * 3.1416 ;',\n '\ta = mod(a, tau/sides);',\n '\ta = abs(a - tau/sides/2.) ;',\n '\tp = r * vec2(cos(a), sin(a));',\n '\tvec4 color = texture2D(tDiffuse, p + 0.5);',\n '\tgl_FragColor = color;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Mirror Shader\n * Copies half the input to the other half\n *\n * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom)\n */\n\nexport const MirrorShader = {\n uniforms: {\n tDiffuse: { value: null },\n side: { value: 1 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform int side;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 p = vUv;',\n '\tif (side == 0){',\n '\t\tif (p.x > 0.5) p.x = 1.0 - p.x;',\n '\t}else if (side == 1){',\n '\t\tif (p.x < 0.5) p.x = 1.0 - p.x;',\n '\t}else if (side == 2){',\n '\t\tif (p.y < 0.5) p.y = 1.0 - p.y;',\n '\t}else if (side == 3){',\n '\t\tif (p.y > 0.5) p.y = 1.0 - p.y;',\n '\t} ',\n '\tvec4 color = texture2D(tDiffuse, p);',\n '\tgl_FragColor = color;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Normal map shader\n * - compute normals from heightmap\n */\n\nexport const NormalMapShader = {\n uniforms: {\n heightMap: { value: null },\n resolution: { value: new Vector2(512, 512) },\n scale: { value: new Vector2(1, 1) },\n height: { value: 0.05 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float height;',\n 'uniform vec2 resolution;',\n 'uniform sampler2D heightMap;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tfloat val = texture2D( heightMap, vUv ).x;',\n\n '\tfloat valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;',\n '\tfloat valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;',\n\n '\tgl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "// Parallax Occlusion shaders from\n// http://sunandblackcat.com/tipFullView.php?topicid=28\n// No tangent-space transforms logic based on\n// http://mmikkelsen3d.blogspot.sk/2012/02/parallaxpoc-mapping-and-no-tangent.html\n\nexport const ParallaxShader = {\n // Ordered from fastest to best quality.\n modes: {\n none: 'NO_PARALLAX',\n basic: 'USE_BASIC_PARALLAX',\n steep: 'USE_STEEP_PARALLAX',\n occlusion: 'USE_OCLUSION_PARALLAX', // a.k.a. POM\n relief: 'USE_RELIEF_PARALLAX',\n },\n\n uniforms: {\n bumpMap: { value: null },\n map: { value: null },\n parallaxScale: { value: null },\n parallaxMinLayers: { value: null },\n parallaxMaxLayers: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n 'varying vec3 vViewPosition;',\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n '\tvViewPosition = -mvPosition.xyz;',\n '\tvNormal = normalize( normalMatrix * normal );',\n '\tgl_Position = projectionMatrix * mvPosition;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D bumpMap;',\n 'uniform sampler2D map;',\n\n 'uniform float parallaxScale;',\n 'uniform float parallaxMinLayers;',\n 'uniform float parallaxMaxLayers;',\n\n 'varying vec2 vUv;',\n 'varying vec3 vViewPosition;',\n 'varying vec3 vNormal;',\n\n '#ifdef USE_BASIC_PARALLAX',\n\n '\tvec2 parallaxMap( in vec3 V ) {',\n\n '\t\tfloat initialHeight = texture2D( bumpMap, vUv ).r;',\n\n // No Offset Limitting: messy, floating output at grazing angles.\n //\"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;\",\n\n // Offset Limiting\n '\t\tvec2 texCoordOffset = parallaxScale * V.xy * initialHeight;',\n '\t\treturn vUv - texCoordOffset;',\n\n '\t}',\n\n '#else',\n\n '\tvec2 parallaxMap( in vec3 V ) {',\n\n // Determine number of layers from angle between V and N\n '\t\tfloat numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );',\n\n '\t\tfloat layerHeight = 1.0 / numLayers;',\n '\t\tfloat currentLayerHeight = 0.0;',\n // Shift of texture coordinates for each iteration\n '\t\tvec2 dtex = parallaxScale * V.xy / V.z / numLayers;',\n\n '\t\tvec2 currentTextureCoords = vUv;',\n\n '\t\tfloat heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;',\n\n // while ( heightFromTexture > currentLayerHeight )\n // Infinite loops are not well supported. Do a \"large\" finite\n // loop, but not too large, as it slows down some compilers.\n '\t\tfor ( int i = 0; i < 30; i += 1 ) {',\n '\t\t\tif ( heightFromTexture <= currentLayerHeight ) {',\n '\t\t\t\tbreak;',\n '\t\t\t}',\n '\t\t\tcurrentLayerHeight += layerHeight;',\n // Shift texture coordinates along vector V\n '\t\t\tcurrentTextureCoords -= dtex;',\n '\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;',\n '\t\t}',\n\n '\t\t#ifdef USE_STEEP_PARALLAX',\n\n '\t\t\treturn currentTextureCoords;',\n\n '\t\t#elif defined( USE_RELIEF_PARALLAX )',\n\n '\t\t\tvec2 deltaTexCoord = dtex / 2.0;',\n '\t\t\tfloat deltaHeight = layerHeight / 2.0;',\n\n // Return to the mid point of previous layer\n '\t\t\tcurrentTextureCoords += deltaTexCoord;',\n '\t\t\tcurrentLayerHeight -= deltaHeight;',\n\n // Binary search to increase precision of Steep Parallax Mapping\n '\t\t\tconst int numSearches = 5;',\n '\t\t\tfor ( int i = 0; i < numSearches; i += 1 ) {',\n\n '\t\t\t\tdeltaTexCoord /= 2.0;',\n '\t\t\t\tdeltaHeight /= 2.0;',\n '\t\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;',\n // Shift along or against vector V\n '\t\t\t\tif( heightFromTexture > currentLayerHeight ) {', // Below the surface\n\n '\t\t\t\t\tcurrentTextureCoords -= deltaTexCoord;',\n '\t\t\t\t\tcurrentLayerHeight += deltaHeight;',\n\n '\t\t\t\t} else {', // above the surface\n\n '\t\t\t\t\tcurrentTextureCoords += deltaTexCoord;',\n '\t\t\t\t\tcurrentLayerHeight -= deltaHeight;',\n\n '\t\t\t\t}',\n\n '\t\t\t}',\n '\t\t\treturn currentTextureCoords;',\n\n '\t\t#elif defined( USE_OCLUSION_PARALLAX )',\n\n '\t\t\tvec2 prevTCoords = currentTextureCoords + dtex;',\n\n // Heights for linear interpolation\n '\t\t\tfloat nextH = heightFromTexture - currentLayerHeight;',\n '\t\t\tfloat prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;',\n\n // Proportions for linear interpolation\n '\t\t\tfloat weight = nextH / ( nextH - prevH );',\n\n // Interpolation of texture coordinates\n '\t\t\treturn prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );',\n\n '\t\t#else', // NO_PARALLAX\n\n '\t\t\treturn vUv;',\n\n '\t\t#endif',\n\n '\t}',\n '#endif',\n\n 'vec2 perturbUv( vec3 surfPosition, vec3 surfNormal, vec3 viewPosition ) {',\n\n '\tvec2 texDx = dFdx( vUv );',\n '\tvec2 texDy = dFdy( vUv );',\n\n '\tvec3 vSigmaX = dFdx( surfPosition );',\n '\tvec3 vSigmaY = dFdy( surfPosition );',\n '\tvec3 vR1 = cross( vSigmaY, surfNormal );',\n '\tvec3 vR2 = cross( surfNormal, vSigmaX );',\n '\tfloat fDet = dot( vSigmaX, vR1 );',\n\n '\tvec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );',\n '\tvec3 vProjVtex;',\n '\tvProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;',\n '\tvProjVtex.z = dot( surfNormal, viewPosition );',\n\n '\treturn parallaxMap( vProjVtex );',\n '}',\n\n 'void main() {',\n\n '\tvec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );',\n '\tgl_FragColor = texture2D( map, mapUv );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Pixelation shader\n */\n\nexport const PixelShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: null },\n pixelSize: { value: 1 },\n },\n\n vertexShader: [\n 'varying highp vec2 vUv;',\n\n 'void main() {',\n\n 'vUv = uv;',\n 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float pixelSize;',\n 'uniform vec2 resolution;',\n\n 'varying highp vec2 vUv;',\n\n 'void main(){',\n\n 'vec2 dxy = pixelSize / resolution;',\n 'vec2 coord = dxy * floor( vUv / dxy );',\n 'gl_FragColor = texture2D(tDiffuse, coord);',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * RGB Shift Shader\n * Shifts red and blue channels from center in opposite directions\n * Ported from http://kriss.cx/tom/2009/05/rgb-shift/\n * by Tom Butterworth / http://kriss.cx/tom/\n *\n * amount: shift distance (1 is width of input)\n * angle: shift angle in radians\n */\n\nexport const RGBShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 0.005 },\n angle: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float amount;',\n 'uniform float angle;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 offset = amount * vec2( cos(angle), sin(angle));',\n '\tvec4 cr = texture2D(tDiffuse, vUv + offset);',\n '\tvec4 cga = texture2D(tDiffuse, vUv);',\n '\tvec4 cb = texture2D(tDiffuse, vUv - offset);',\n '\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Sepia tone shader\n * based on glfx.js sepia shader\n * https://github.com/evanw/glfx.js\n */\n\nexport const SepiaShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float amount;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 color = texture2D( tDiffuse, vUv );',\n '\tvec3 c = color.rgb;',\n\n '\tcolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );',\n '\tcolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );',\n '\tcolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );',\n\n '\tgl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Sobel Edge Detection (see https://youtu.be/uihBwtPIBxM)\n *\n * As mentioned in the video the Sobel operator expects a grayscale image as input.\n *\n */\n\nexport const SobelOperatorShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: new Vector2() },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform vec2 resolution;',\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );',\n\n // kernel definition (in glsl matrices are filled in column-major order)\n\n '\tconst mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );', // x direction kernel\n '\tconst mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );', // y direction kernel\n\n // fetch the 3x3 neighbourhood of a fragment\n\n // first column\n\n '\tfloat tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;',\n '\tfloat tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;',\n '\tfloat tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;',\n\n // second column\n\n '\tfloat tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;',\n '\tfloat tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;',\n '\tfloat tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;',\n\n // third column\n\n '\tfloat tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;',\n '\tfloat tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;',\n '\tfloat tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;',\n\n // gradient value in x direction\n\n '\tfloat valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ',\n '\t\tGx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ',\n '\t\tGx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ',\n\n // gradient value in y direction\n\n '\tfloat valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ',\n '\t\tGy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ',\n '\t\tGy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ',\n\n // magnitute of the total gradient\n\n '\tfloat G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );',\n\n '\tgl_FragColor = vec4( vec3( G ), 1 );',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Technicolor Shader\n * Simulates the look of the two-strip technicolor process popular in early 20th century films.\n * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm\n * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html\n */\n\nexport const TechnicolorShader = {\n uniforms: {\n tDiffuse: { value: null },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );',\n '\tvec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);',\n\n '\tgl_FragColor = newTex;',\n\n '}',\n ].join('\\n'),\n}\n", "import { Color, Vector3 } from 'three'\n\n/**\n * Currently contains:\n *\n *\ttoon1\n *\ttoon2\n *\thatching\n *\tdotted\n */\n\nexport const ToonShader1 = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xffffff) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n 'varying vec3 vRefract;',\n\n 'void main() {',\n\n '\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n '\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n '\tvec3 worldNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );',\n\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '\tvec3 I = worldPosition.xyz - cameraPosition;',\n '\tvRefract = refract( normalize( I ), worldNormal, 1.02 );',\n\n '\tgl_Position = projectionMatrix * mvPosition;',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'varying vec3 vRefract;',\n\n 'void main() {',\n\n '\tfloat directionalLightWeighting = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);',\n '\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;',\n\n '\tfloat intensity = smoothstep( - 0.5, 1.0, pow( length(lightWeighting), 20.0 ) );',\n '\tintensity += length(lightWeighting) * 0.2;',\n\n '\tfloat cameraWeighting = dot( normalize( vNormal ), vRefract );',\n '\tintensity += pow( 1.0 - length( cameraWeighting ), 6.0 );',\n '\tintensity = intensity * 0.2 + 0.3;',\n\n '\tif ( intensity < 0.50 ) {',\n\n '\t\tgl_FragColor = vec4( 2.0 * intensity * uBaseColor, 1.0 );',\n\n '\t} else {',\n\n '\t\tgl_FragColor = vec4( 1.0 - 2.0 * ( 1.0 - intensity ) * ( 1.0 - uBaseColor ), 1.0 );',\n\n '}',\n\n '}',\n ].join('\\n'),\n}\n\nexport const ToonShader2 = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xeeeeee) },\n uLineColor1: { value: new Color(0x808080) },\n uLineColor2: { value: new Color(0x000000) },\n uLineColor3: { value: new Color(0x000000) },\n uLineColor4: { value: new Color(0x000000) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n 'uniform vec3 uLineColor1;',\n 'uniform vec3 uLineColor2;',\n 'uniform vec3 uLineColor3;',\n 'uniform vec3 uLineColor4;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tfloat camera = max( dot( normalize( vNormal ), vec3( 0.0, 0.0, 1.0 ) ), 0.4);',\n '\tfloat light = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);',\n\n '\tgl_FragColor = vec4( uBaseColor, 1.0 );',\n\n '\tif ( length(uAmbientLightColor + uDirLightColor * light) < 1.00 ) {',\n\n '\t\tgl_FragColor *= vec4( uLineColor1, 1.0 );',\n\n '\t}',\n\n '\tif ( length(uAmbientLightColor + uDirLightColor * camera) < 0.50 ) {',\n\n '\t\tgl_FragColor *= vec4( uLineColor2, 1.0 );',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n\nexport const ToonShaderHatching = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xffffff) },\n uLineColor1: { value: new Color(0x000000) },\n uLineColor2: { value: new Color(0x000000) },\n uLineColor3: { value: new Color(0x000000) },\n uLineColor4: { value: new Color(0x000000) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n 'uniform vec3 uLineColor1;',\n 'uniform vec3 uLineColor2;',\n 'uniform vec3 uLineColor3;',\n 'uniform vec3 uLineColor4;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tfloat directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);',\n '\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;',\n\n '\tgl_FragColor = vec4( uBaseColor, 1.0 );',\n\n '\tif ( length(lightWeighting) < 1.00 ) {',\n\n '\t\tif ( mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.75 ) {',\n\n '\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor2, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.50 ) {',\n\n '\t\tif (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor3, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.3465 ) {',\n\n '\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor4, 1.0 );',\n\n '\t}',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n\nexport const ToonShaderDotted = {\n uniforms: {\n uDirLightPos: { value: new Vector3() },\n uDirLightColor: { value: new Color(0xeeeeee) },\n\n uAmbientLightColor: { value: new Color(0x050505) },\n\n uBaseColor: { value: new Color(0xffffff) },\n uLineColor1: { value: new Color(0x000000) },\n },\n\n vertexShader: [\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '\tvNormal = normalize( normalMatrix * normal );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 uBaseColor;',\n 'uniform vec3 uLineColor1;',\n 'uniform vec3 uLineColor2;',\n 'uniform vec3 uLineColor3;',\n 'uniform vec3 uLineColor4;',\n\n 'uniform vec3 uDirLightPos;',\n 'uniform vec3 uDirLightColor;',\n\n 'uniform vec3 uAmbientLightColor;',\n\n 'varying vec3 vNormal;',\n\n 'void main() {',\n\n 'float directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);',\n 'vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;',\n\n 'gl_FragColor = vec4( uBaseColor, 1.0 );',\n\n 'if ( length(lightWeighting) < 1.00 ) {',\n\n '\t\tif ( ( mod(gl_FragCoord.x, 4.001) + mod(gl_FragCoord.y, 4.0) ) > 6.00 ) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '\tif ( length(lightWeighting) < 0.50 ) {',\n\n '\t\tif ( ( mod(gl_FragCoord.x + 2.0, 4.001) + mod(gl_FragCoord.y + 2.0, 4.0) ) > 6.00 ) {',\n\n '\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );',\n\n '\t\t}',\n\n '\t}',\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2 } from 'three'\n\n/**\n * Triangle blur shader\n * based on glfx.js triangle blur shader\n * https://github.com/evanw/glfx.js\n *\n * A basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\n\nexport const TriangleBlurShader = {\n uniforms: {\n texture: { value: null },\n delta: { value: new Vector2(1, 1) },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n '#include ',\n\n '#define ITERATIONS 10.0',\n\n 'uniform sampler2D texture;',\n 'uniform vec2 delta;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 color = vec4( 0.0 );',\n\n '\tfloat total = 0.0;',\n\n // randomize the lookup values to hide the fixed number of samples\n\n '\tfloat offset = rand( vUv );',\n\n '\tfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {',\n\n '\t\tfloat percent = ( t + offset - 0.5 ) / ITERATIONS;',\n '\t\tfloat weight = 1.0 - abs( percent );',\n\n '\t\tcolor += texture2D( texture, vUv + delta * percent ) * weight;',\n '\t\ttotal += weight;',\n\n '\t}',\n\n '\tgl_FragColor = color / total;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Two pass Gaussian blur filter (horizontal and vertical blur shaders)\n * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/\n * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n */\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type VerticalBlurShaderUniforms = {\n tDiffuse: IUniform\n v: IUniform\n}\n\nexport interface IVerticalBlurShader extends IShader {}\n\nexport const VerticalBlurShader: IVerticalBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n v: { value: 1.0 / 512.0 },\n },\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n fragmentShader: /* glsl */ `\n\n uniform sampler2D tDiffuse;\n uniform float v;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 sum = vec4( 0.0 );\n\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n gl_FragColor = sum;\n\n }\n `,\n}\n", "/**\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nexport const VerticalTiltShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n v: { value: 1.0 / 512.0 },\n r: { value: 0.35 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float v;',\n 'uniform float r;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec4 sum = vec4( 0.0 );',\n\n '\tfloat vv = v * abs( r - vUv.y );',\n\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;',\n '\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;',\n\n '\tgl_FragColor = sum;',\n\n '}',\n ].join('\\n'),\n}\n", "/**\n * Vignette shader\n * based on PaintEffect postprocess from ro.me\n * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js\n */\n\nexport const VignetteShader = {\n uniforms: {\n tDiffuse: { value: null },\n offset: { value: 1.0 },\n darkness: { value: 1.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform float offset;',\n 'uniform float darkness;',\n\n 'uniform sampler2D tDiffuse;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n // Eskil's vignette\n\n '\tvec4 texel = texture2D( tDiffuse, vUv );',\n '\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );',\n '\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );',\n\n /*\n\t\t// alternative version from glfx.js\n\t\t// this one makes more \"dusty\" look (as opposed to \"burned\")\n\n\t\t\"\tvec4 color = texture2D( tDiffuse, vUv );\",\n\t\t\"\tfloat dist = distance( vUv, vec2( 0.5 ) );\",\n\t\t\"\tcolor.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );\",\n\t\t\"\tgl_FragColor = color;\",\n\t\t*/\n\n '}',\n ].join('\\n'),\n}\n", "import { Vector2, Vector3 } from 'three'\n\n/**\n * Shaders to render 3D volumes using raycasting.\n * The applied techniques are based on similar implementations in the Visvis and Vispy projects.\n * This is not the only approach, therefore it's marked 1.\n */\n\nexport const VolumeRenderShader1 = {\n uniforms: {\n u_size: { value: new Vector3(1, 1, 1) },\n u_renderstyle: { value: 0 },\n u_renderthreshold: { value: 0.5 },\n u_clim: { value: new Vector2(1, 1) },\n u_data: { value: null },\n u_cmdata: { value: null },\n },\n vertexShader: [\n '\t\tvarying vec4 v_nearpos;',\n '\t\tvarying vec4 v_farpos;',\n '\t\tvarying vec3 v_position;',\n\n '\t\tvoid main() {',\n // Prepare transforms to map to \"camera view\". See also:\n // https://threejs.org/docs/#api/renderers/webgl/WebGLProgram\n '\t\t\t\tmat4 viewtransformf = modelViewMatrix;',\n '\t\t\t\tmat4 viewtransformi = inverse(modelViewMatrix);',\n\n // Project local vertex coordinate to camera position. Then do a step\n // backward (in cam coords) to the near clipping plane, and project back. Do\n // the same for the far clipping plane. This gives us all the information we\n // need to calculate the ray and truncate it to the viewing cone.\n '\t\t\t\tvec4 position4 = vec4(position, 1.0);',\n '\t\t\t\tvec4 pos_in_cam = viewtransformf * position4;',\n\n // Intersection of ray and near clipping plane (z = -1 in clip coords)\n '\t\t\t\tpos_in_cam.z = -pos_in_cam.w;',\n '\t\t\t\tv_nearpos = viewtransformi * pos_in_cam;',\n\n // Intersection of ray and far clipping plane (z = +1 in clip coords)\n '\t\t\t\tpos_in_cam.z = pos_in_cam.w;',\n '\t\t\t\tv_farpos = viewtransformi * pos_in_cam;',\n\n // Set varyings and output pos\n '\t\t\t\tv_position = position;',\n '\t\t\t\tgl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;',\n '\t\t}',\n ].join('\\n'),\n fragmentShader: [\n '\t\tprecision highp float;',\n '\t\tprecision mediump sampler3D;',\n\n '\t\tuniform vec3 u_size;',\n '\t\tuniform int u_renderstyle;',\n '\t\tuniform float u_renderthreshold;',\n '\t\tuniform vec2 u_clim;',\n\n '\t\tuniform sampler3D u_data;',\n '\t\tuniform sampler2D u_cmdata;',\n\n '\t\tvarying vec3 v_position;',\n '\t\tvarying vec4 v_nearpos;',\n '\t\tvarying vec4 v_farpos;',\n\n // The maximum distance through our rendering volume is sqrt(3).\n '\t\tconst int MAX_STEPS = 887;\t// 887 for 512^3, 1774 for 1024^3',\n '\t\tconst int REFINEMENT_STEPS = 4;',\n '\t\tconst float relative_step_size = 1.0;',\n '\t\tconst vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);',\n '\t\tconst vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);',\n '\t\tconst vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);',\n '\t\tconst float shininess = 40.0;',\n\n '\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);',\n '\t\tvoid cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);',\n\n '\t\tfloat sample1(vec3 texcoords);',\n '\t\tvec4 apply_colormap(float val);',\n '\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);',\n\n '\t\tvoid main() {',\n // Normalize clipping plane info\n '\t\t\t\tvec3 farpos = v_farpos.xyz / v_farpos.w;',\n '\t\t\t\tvec3 nearpos = v_nearpos.xyz / v_nearpos.w;',\n\n // Calculate unit vector pointing in the view direction through this fragment.\n '\t\t\t\tvec3 view_ray = normalize(nearpos.xyz - farpos.xyz);',\n\n // Compute the (negative) distance to the front surface or near clipping plane.\n // v_position is the back face of the cuboid, so the initial distance calculated in the dot\n // product below is the distance from near clip plane to the back of the cuboid\n '\t\t\t\tfloat distance = dot(nearpos - v_position, view_ray);',\n '\t\t\t\tdistance = max(distance, min((-0.5 - v_position.x) / view_ray.x,',\n '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.x - 0.5 - v_position.x) / view_ray.x));',\n '\t\t\t\tdistance = max(distance, min((-0.5 - v_position.y) / view_ray.y,',\n '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.y - 0.5 - v_position.y) / view_ray.y));',\n '\t\t\t\tdistance = max(distance, min((-0.5 - v_position.z) / view_ray.z,',\n '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.z - 0.5 - v_position.z) / view_ray.z));',\n\n // Now we have the starting position on the front surface\n '\t\t\t\tvec3 front = v_position + view_ray * distance;',\n\n // Decide how many steps to take\n '\t\t\t\tint nsteps = int(-distance / relative_step_size + 0.5);',\n '\t\t\t\tif ( nsteps < 1 )',\n '\t\t\t\t\t\tdiscard;',\n\n // Get starting location and step vector in texture coordinates\n '\t\t\t\tvec3 step = ((v_position - front) / u_size) / float(nsteps);',\n '\t\t\t\tvec3 start_loc = front / u_size;',\n\n // For testing: show the number of steps. This helps to establish\n // whether the rays are correctly oriented\n //'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);',\n //'return;',\n\n '\t\t\t\tif (u_renderstyle == 0)',\n '\t\t\t\t\t\tcast_mip(start_loc, step, nsteps, view_ray);',\n '\t\t\t\telse if (u_renderstyle == 1)',\n '\t\t\t\t\t\tcast_iso(start_loc, step, nsteps, view_ray);',\n\n '\t\t\t\tif (gl_FragColor.a < 0.05)',\n '\t\t\t\t\t\tdiscard;',\n '\t\t}',\n\n '\t\tfloat sample1(vec3 texcoords) {',\n '\t\t\t\t/* Sample float value from a 3D texture. Assumes intensity data. */',\n '\t\t\t\treturn texture(u_data, texcoords.xyz).r;',\n '\t\t}',\n\n '\t\tvec4 apply_colormap(float val) {',\n '\t\t\t\tval = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);',\n '\t\t\t\treturn texture2D(u_cmdata, vec2(val, 0.5));',\n '\t\t}',\n\n '\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {',\n\n '\t\t\t\tfloat max_val = -1e6;',\n '\t\t\t\tint max_i = 100;',\n '\t\t\t\tvec3 loc = start_loc;',\n\n // Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with\n // non-constant expression. So we use a hard-coded max, and an additional condition\n // inside the loop.\n '\t\t\t\tfor (int iter=0; iter= nsteps)',\n '\t\t\t\t\t\t\t\tbreak;',\n // Sample from the 3D texture\n '\t\t\t\t\t\tfloat val = sample1(loc);',\n // Apply MIP operation\n '\t\t\t\t\t\tif (val > max_val) {',\n '\t\t\t\t\t\t\t\tmax_val = val;',\n '\t\t\t\t\t\t\t\tmax_i = iter;',\n '\t\t\t\t\t\t}',\n // Advance location deeper into the volume\n '\t\t\t\t\t\tloc += step;',\n '\t\t\t\t}',\n\n // Refine location, gives crispier images\n '\t\t\t\tvec3 iloc = start_loc + step * (float(max_i) - 0.5);',\n '\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);',\n '\t\t\t\tfor (int i=0; i= nsteps)',\n '\t\t\t\t\t\t\t\tbreak;',\n\n // Sample from the 3D texture\n '\t\t\t\t\t\tfloat val = sample1(loc);',\n\n '\t\t\t\t\t\tif (val > low_threshold) {',\n // Take the last interval in smaller steps\n '\t\t\t\t\t\t\t\tvec3 iloc = loc - 0.5 * step;',\n '\t\t\t\t\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);',\n '\t\t\t\t\t\t\t\tfor (int i=0; i u_renderthreshold) {',\n '\t\t\t\t\t\t\t\t\t\t\t\tgl_FragColor = add_lighting(val, iloc, dstep, view_ray);',\n '\t\t\t\t\t\t\t\t\t\t\t\treturn;',\n '\t\t\t\t\t\t\t\t\t\t}',\n '\t\t\t\t\t\t\t\t\t\tiloc += istep;',\n '\t\t\t\t\t\t\t\t}',\n '\t\t\t\t\t\t}',\n\n // Advance location deeper into the volume\n '\t\t\t\t\t\tloc += step;',\n '\t\t\t\t}',\n '\t\t}',\n\n '\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)',\n '\t\t{',\n // Calculate color by incorporating lighting\n\n // View direction\n '\t\t\t\tvec3 V = normalize(view_ray);',\n\n // calculate normal vector from gradient\n '\t\t\t\tvec3 N;',\n '\t\t\t\tfloat val1, val2;',\n '\t\t\t\tval1 = sample1(loc + vec3(-step[0], 0.0, 0.0));',\n '\t\t\t\tval2 = sample1(loc + vec3(+step[0], 0.0, 0.0));',\n '\t\t\t\tN[0] = val1 - val2;',\n '\t\t\t\tval = max(max(val1, val2), val);',\n '\t\t\t\tval1 = sample1(loc + vec3(0.0, -step[1], 0.0));',\n '\t\t\t\tval2 = sample1(loc + vec3(0.0, +step[1], 0.0));',\n '\t\t\t\tN[1] = val1 - val2;',\n '\t\t\t\tval = max(max(val1, val2), val);',\n '\t\t\t\tval1 = sample1(loc + vec3(0.0, 0.0, -step[2]));',\n '\t\t\t\tval2 = sample1(loc + vec3(0.0, 0.0, +step[2]));',\n '\t\t\t\tN[2] = val1 - val2;',\n '\t\t\t\tval = max(max(val1, val2), val);',\n\n '\t\t\t\tfloat gm = length(N); // gradient magnitude',\n '\t\t\t\tN = normalize(N);',\n\n // Flip normal so it points towards viewer\n '\t\t\t\tfloat Nselect = float(dot(N, V) > 0.0);',\n '\t\t\t\tN = (2.0 * Nselect - 1.0) * N;\t// ==\tNselect * N - (1.0-Nselect)*N;',\n\n // Init colors\n '\t\t\t\tvec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);',\n '\t\t\t\tvec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);',\n '\t\t\t\tvec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);',\n\n // note: could allow multiple lights\n '\t\t\t\tfor (int i=0; i<1; i++)',\n '\t\t\t\t{',\n // Get light direction (make sure to prevent zero devision)\n '\t\t\t\t\t\tvec3 L = normalize(view_ray);\t//lightDirs[i];',\n '\t\t\t\t\t\tfloat lightEnabled = float( length(L) > 0.0 );',\n '\t\t\t\t\t\tL = normalize(L + (1.0 - lightEnabled));',\n\n // Calculate lighting properties\n '\t\t\t\t\t\tfloat lambertTerm = clamp(dot(N, L), 0.0, 1.0);',\n '\t\t\t\t\t\tvec3 H = normalize(L+V); // Halfway vector',\n '\t\t\t\t\t\tfloat specularTerm = pow(max(dot(H, N), 0.0), shininess);',\n\n // Calculate mask\n '\t\t\t\t\t\tfloat mask1 = lightEnabled;',\n\n // Calculate colors\n '\t\t\t\t\t\tambient_color +=\tmask1 * ambient_color;\t// * gl_LightSource[i].ambient;',\n '\t\t\t\t\t\tdiffuse_color +=\tmask1 * lambertTerm;',\n '\t\t\t\t\t\tspecular_color += mask1 * specularTerm * specular_color;',\n '\t\t\t\t}',\n\n // Calculate final color by componing different components\n '\t\t\t\tvec4 final_color;',\n '\t\t\t\tvec4 color = apply_colormap(val);',\n '\t\t\t\tfinal_color = color * (ambient_color + diffuse_color) + specular_color;',\n '\t\t\t\tfinal_color.a = color.a;',\n '\t\t\t\treturn final_color;',\n '\t\t}',\n ].join('\\n'),\n}\n", "export const WaterRefractionShader = {\n uniforms: {\n color: {\n value: null,\n },\n\n time: {\n value: 0,\n },\n\n tDiffuse: {\n value: null,\n },\n\n tDudv: {\n value: null,\n },\n\n textureMatrix: {\n value: null,\n },\n },\n\n vertexShader: [\n 'uniform mat4 textureMatrix;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vUvRefraction;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n\n '\tvUvRefraction = textureMatrix * vec4( position, 1.0 );',\n\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform vec3 color;',\n 'uniform float time;',\n 'uniform sampler2D tDiffuse;',\n 'uniform sampler2D tDudv;',\n\n 'varying vec2 vUv;',\n 'varying vec4 vUvRefraction;',\n\n 'float blendOverlay( float base, float blend ) {',\n\n '\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );',\n\n '}',\n\n 'vec3 blendOverlay( vec3 base, vec3 blend ) {',\n\n '\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );',\n\n '}',\n\n 'void main() {',\n\n ' float waveStrength = 0.1;',\n ' float waveSpeed = 0.03;',\n\n // simple distortion (ripple) via dudv map (see https://www.youtube.com/watch?v=6B7IF6GOu7s)\n\n '\tvec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;',\n '\tdistortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );',\n '\tvec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;',\n\n // new uv coords\n\n ' vec4 uv = vec4( vUvRefraction );',\n ' uv.xy += distortion;',\n\n '\tvec4 base = texture2DProj( tDiffuse, uv );',\n\n '\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );',\n\n '}',\n ].join('\\n'),\n}\n", "import { Group, Matrix4, Raycaster, Vector2 } from 'three'\n\nconst _pointer = new Vector2()\nconst _event = { type: '', data: _pointer }\n\nclass InteractiveGroup extends Group {\n constructor(renderer, camera) {\n super()\n\n const scope = this\n\n const raycaster = new Raycaster()\n const tempMatrix = new Matrix4()\n\n // Pointer Events\n\n const element = renderer.domElement\n\n function onPointerEvent(event) {\n event.stopPropagation()\n\n _pointer.x = (event.clientX / element.clientWidth) * 2 - 1\n _pointer.y = -(event.clientY / element.clientHeight) * 2 + 1\n\n raycaster.setFromCamera(_pointer, camera)\n\n const intersects = raycaster.intersectObjects(scope.children, false)\n\n if (intersects.length > 0) {\n const intersection = intersects[0]\n\n const object = intersection.object\n const uv = intersection.uv\n\n _event.type = event.type\n _event.data.set(uv.x, 1 - uv.y)\n\n object.dispatchEvent(_event)\n }\n }\n\n element.addEventListener('pointerdown', onPointerEvent)\n element.addEventListener('pointerup', onPointerEvent)\n element.addEventListener('pointermove', onPointerEvent)\n element.addEventListener('mousedown', onPointerEvent)\n element.addEventListener('mouseup', onPointerEvent)\n element.addEventListener('mousemove', onPointerEvent)\n element.addEventListener('click', onPointerEvent)\n\n // WebXR Controller Events\n // TODO: Dispatch pointerevents too\n\n const events = {\n move: 'mousemove',\n select: 'click',\n selectstart: 'mousedown',\n selectend: 'mouseup',\n }\n\n function onXRControllerEvent(event) {\n const controller = event.target\n\n tempMatrix.identity().extractRotation(controller.matrixWorld)\n\n raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld)\n raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix)\n\n const intersections = raycaster.intersectObjects(scope.children, false)\n\n if (intersections.length > 0) {\n const intersection = intersections[0]\n\n const object = intersection.object\n const uv = intersection.uv\n\n _event.type = events[event.type]\n _event.data.set(uv.x, 1 - uv.y)\n\n object.dispatchEvent(_event)\n }\n }\n\n const controller1 = renderer.xr.getController(0)\n controller1.addEventListener('move', onXRControllerEvent)\n controller1.addEventListener('select', onXRControllerEvent)\n controller1.addEventListener('selectstart', onXRControllerEvent)\n controller1.addEventListener('selectend', onXRControllerEvent)\n\n const controller2 = renderer.xr.getController(1)\n controller2.addEventListener('move', onXRControllerEvent)\n controller2.addEventListener('select', onXRControllerEvent)\n controller2.addEventListener('selectstart', onXRControllerEvent)\n controller2.addEventListener('selectend', onXRControllerEvent)\n }\n}\n\nexport { InteractiveGroup }\n", "import { Frustum, Vector3 } from 'three'\n\nconst frustum = new Frustum()\nconst center = new Vector3()\n\nconst tmpPoint = new Vector3()\n\nconst vecNear = new Vector3()\nconst vecTopLeft = new Vector3()\nconst vecTopRight = new Vector3()\nconst vecDownRight = new Vector3()\nconst vecDownLeft = new Vector3()\n\nconst vecFarTopLeft = new Vector3()\nconst vecFarTopRight = new Vector3()\nconst vecFarDownRight = new Vector3()\nconst vecFarDownLeft = new Vector3()\n\nconst vectemp1 = new Vector3()\nconst vectemp2 = new Vector3()\nconst vectemp3 = new Vector3()\n\nclass SelectionBox {\n constructor(camera, scene, deep) {\n this.camera = camera\n this.scene = scene\n this.startPoint = new Vector3()\n this.endPoint = new Vector3()\n this.collection = []\n this.deep = deep || Number.MAX_VALUE\n }\n\n select(startPoint, endPoint) {\n this.startPoint = startPoint || this.startPoint\n this.endPoint = endPoint || this.endPoint\n this.collection = []\n\n this.updateFrustum(this.startPoint, this.endPoint)\n this.searchChildInFrustum(frustum, this.scene)\n\n return this.collection\n }\n\n updateFrustum(startPoint, endPoint) {\n startPoint = startPoint || this.startPoint\n endPoint = endPoint || this.endPoint\n\n // Avoid invalid frustum\n\n if (startPoint.x === endPoint.x) {\n endPoint.x += Number.EPSILON\n }\n\n if (startPoint.y === endPoint.y) {\n endPoint.y += Number.EPSILON\n }\n\n this.camera.updateProjectionMatrix()\n this.camera.updateMatrixWorld()\n\n if (this.camera.isPerspectiveCamera) {\n tmpPoint.copy(startPoint)\n tmpPoint.x = Math.min(startPoint.x, endPoint.x)\n tmpPoint.y = Math.max(startPoint.y, endPoint.y)\n endPoint.x = Math.max(startPoint.x, endPoint.x)\n endPoint.y = Math.min(startPoint.y, endPoint.y)\n\n vecNear.setFromMatrixPosition(this.camera.matrixWorld)\n vecTopLeft.copy(tmpPoint)\n vecTopRight.set(endPoint.x, tmpPoint.y, 0)\n vecDownRight.copy(endPoint)\n vecDownLeft.set(tmpPoint.x, endPoint.y, 0)\n\n vecTopLeft.unproject(this.camera)\n vecTopRight.unproject(this.camera)\n vecDownRight.unproject(this.camera)\n vecDownLeft.unproject(this.camera)\n\n vectemp1.copy(vecTopLeft).sub(vecNear)\n vectemp2.copy(vecTopRight).sub(vecNear)\n vectemp3.copy(vecDownRight).sub(vecNear)\n vectemp1.normalize()\n vectemp2.normalize()\n vectemp3.normalize()\n\n vectemp1.multiplyScalar(this.deep)\n vectemp2.multiplyScalar(this.deep)\n vectemp3.multiplyScalar(this.deep)\n vectemp1.add(vecNear)\n vectemp2.add(vecNear)\n vectemp3.add(vecNear)\n\n var planes = frustum.planes\n\n planes[0].setFromCoplanarPoints(vecNear, vecTopLeft, vecTopRight)\n planes[1].setFromCoplanarPoints(vecNear, vecTopRight, vecDownRight)\n planes[2].setFromCoplanarPoints(vecDownRight, vecDownLeft, vecNear)\n planes[3].setFromCoplanarPoints(vecDownLeft, vecTopLeft, vecNear)\n planes[4].setFromCoplanarPoints(vecTopRight, vecDownRight, vecDownLeft)\n planes[5].setFromCoplanarPoints(vectemp3, vectemp2, vectemp1)\n planes[5].normal.multiplyScalar(-1)\n } else if (this.camera.isOrthographicCamera) {\n const left = Math.min(startPoint.x, endPoint.x)\n const top = Math.max(startPoint.y, endPoint.y)\n const right = Math.max(startPoint.x, endPoint.x)\n const down = Math.min(startPoint.y, endPoint.y)\n\n vecTopLeft.set(left, top, -1)\n vecTopRight.set(right, top, -1)\n vecDownRight.set(right, down, -1)\n vecDownLeft.set(left, down, -1)\n\n vecFarTopLeft.set(left, top, 1)\n vecFarTopRight.set(right, top, 1)\n vecFarDownRight.set(right, down, 1)\n vecFarDownLeft.set(left, down, 1)\n\n vecTopLeft.unproject(this.camera)\n vecTopRight.unproject(this.camera)\n vecDownRight.unproject(this.camera)\n vecDownLeft.unproject(this.camera)\n\n vecFarTopLeft.unproject(this.camera)\n vecFarTopRight.unproject(this.camera)\n vecFarDownRight.unproject(this.camera)\n vecFarDownLeft.unproject(this.camera)\n\n var planes = frustum.planes\n\n planes[0].setFromCoplanarPoints(vecTopLeft, vecFarTopLeft, vecFarTopRight)\n planes[1].setFromCoplanarPoints(vecTopRight, vecFarTopRight, vecFarDownRight)\n planes[2].setFromCoplanarPoints(vecFarDownRight, vecFarDownLeft, vecDownLeft)\n planes[3].setFromCoplanarPoints(vecFarDownLeft, vecFarTopLeft, vecTopLeft)\n planes[4].setFromCoplanarPoints(vecTopRight, vecDownRight, vecDownLeft)\n planes[5].setFromCoplanarPoints(vecFarDownRight, vecFarTopRight, vecFarTopLeft)\n planes[5].normal.multiplyScalar(-1)\n } else {\n console.error('THREE.SelectionBox: Unsupported camera type.')\n }\n }\n\n searchChildInFrustum(frustum, object) {\n if (object.isMesh || object.isLine || object.isPoints) {\n if (object.material !== undefined) {\n if (object.geometry.boundingSphere === null) object.geometry.computeBoundingSphere()\n\n center.copy(object.geometry.boundingSphere.center)\n\n center.applyMatrix4(object.matrixWorld)\n\n if (frustum.containsPoint(center)) {\n this.collection.push(object)\n }\n }\n }\n\n if (object.children.length > 0) {\n for (let x = 0; x < object.children.length; x++) {\n this.searchChildInFrustum(frustum, object.children[x])\n }\n }\n }\n}\n\nexport { SelectionBox }\n", "async function AmmoPhysics() {\n if ('Ammo' in window === false) {\n console.error(\"AmmoPhysics: Couldn't find Ammo.js\")\n return\n }\n\n const AmmoLib = await Ammo()\n\n const frameRate = 60\n\n const collisionConfiguration = new AmmoLib.btDefaultCollisionConfiguration()\n const dispatcher = new AmmoLib.btCollisionDispatcher(collisionConfiguration)\n const broadphase = new AmmoLib.btDbvtBroadphase()\n const solver = new AmmoLib.btSequentialImpulseConstraintSolver()\n const world = new AmmoLib.btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration)\n world.setGravity(new AmmoLib.btVector3(0, -9.8, 0))\n\n const worldTransform = new AmmoLib.btTransform()\n\n //\n\n function getShape(geometry) {\n const parameters = geometry.parameters\n\n // TODO change type to is*\n\n if (geometry.type === 'BoxGeometry') {\n const sx = parameters.width !== undefined ? parameters.width / 2 : 0.5\n const sy = parameters.height !== undefined ? parameters.height / 2 : 0.5\n const sz = parameters.depth !== undefined ? parameters.depth / 2 : 0.5\n\n const shape = new AmmoLib.btBoxShape(new AmmoLib.btVector3(sx, sy, sz))\n shape.setMargin(0.05)\n\n return shape\n } else if (geometry.type === 'SphereGeometry' || geometry.type === 'IcosahedronGeometry') {\n const radius = parameters.radius !== undefined ? parameters.radius : 1\n\n const shape = new AmmoLib.btSphereShape(radius)\n shape.setMargin(0.05)\n\n return shape\n }\n\n return null\n }\n\n const meshes = []\n const meshMap = new WeakMap()\n\n function addMesh(mesh, mass = 0) {\n const shape = getShape(mesh.geometry)\n\n if (shape !== null) {\n if (mesh.isInstancedMesh) {\n handleInstancedMesh(mesh, mass, shape)\n } else if (mesh.isMesh) {\n handleMesh(mesh, mass, shape)\n }\n }\n }\n\n function handleMesh(mesh, mass, shape) {\n const position = mesh.position\n const quaternion = mesh.quaternion\n\n const transform = new AmmoLib.btTransform()\n transform.setIdentity()\n transform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z))\n transform.setRotation(new AmmoLib.btQuaternion(quaternion.x, quaternion.y, quaternion.z, quaternion.w))\n\n const motionState = new AmmoLib.btDefaultMotionState(transform)\n\n const localInertia = new AmmoLib.btVector3(0, 0, 0)\n shape.calculateLocalInertia(mass, localInertia)\n\n const rbInfo = new AmmoLib.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia)\n\n const body = new AmmoLib.btRigidBody(rbInfo)\n // body.setFriction( 4 );\n world.addRigidBody(body)\n\n if (mass > 0) {\n meshes.push(mesh)\n meshMap.set(mesh, body)\n }\n }\n\n function handleInstancedMesh(mesh, mass, shape) {\n const array = mesh.instanceMatrix.array\n\n const bodies = []\n\n for (let i = 0; i < mesh.count; i++) {\n const index = i * 16\n\n const transform = new AmmoLib.btTransform()\n transform.setFromOpenGLMatrix(array.slice(index, index + 16))\n\n const motionState = new AmmoLib.btDefaultMotionState(transform)\n\n const localInertia = new AmmoLib.btVector3(0, 0, 0)\n shape.calculateLocalInertia(mass, localInertia)\n\n const rbInfo = new AmmoLib.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia)\n\n const body = new AmmoLib.btRigidBody(rbInfo)\n world.addRigidBody(body)\n\n bodies.push(body)\n }\n\n if (mass > 0) {\n mesh.instanceMatrix.setUsage(35048) // THREE.DynamicDrawUsage = 35048\n meshes.push(mesh)\n\n meshMap.set(mesh, bodies)\n }\n }\n\n //\n\n function setMeshPosition(mesh, position, index = 0) {\n if (mesh.isInstancedMesh) {\n const bodies = meshMap.get(mesh)\n const body = bodies[index]\n\n body.setAngularVelocity(new AmmoLib.btVector3(0, 0, 0))\n body.setLinearVelocity(new AmmoLib.btVector3(0, 0, 0))\n\n worldTransform.setIdentity()\n worldTransform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z))\n body.setWorldTransform(worldTransform)\n } else if (mesh.isMesh) {\n const body = meshMap.get(mesh)\n\n body.setAngularVelocity(new AmmoLib.btVector3(0, 0, 0))\n body.setLinearVelocity(new AmmoLib.btVector3(0, 0, 0))\n\n worldTransform.setIdentity()\n worldTransform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z))\n body.setWorldTransform(worldTransform)\n }\n }\n\n //\n\n let lastTime = 0\n\n function step() {\n const time = performance.now()\n\n if (lastTime > 0) {\n const delta = (time - lastTime) / 1000\n\n // console.time( 'world.step' );\n world.stepSimulation(delta, 10)\n // console.timeEnd( 'world.step' );\n }\n\n lastTime = time\n\n //\n\n for (let i = 0, l = meshes.length; i < l; i++) {\n const mesh = meshes[i]\n\n if (mesh.isInstancedMesh) {\n const array = mesh.instanceMatrix.array\n const bodies = meshMap.get(mesh)\n\n for (let j = 0; j < bodies.length; j++) {\n const body = bodies[j]\n\n const motionState = body.getMotionState()\n motionState.getWorldTransform(worldTransform)\n\n const position = worldTransform.getOrigin()\n const quaternion = worldTransform.getRotation()\n\n compose(position, quaternion, array, j * 16)\n }\n\n mesh.instanceMatrix.needsUpdate = true\n } else if (mesh.isMesh) {\n const body = meshMap.get(mesh)\n\n const motionState = body.getMotionState()\n motionState.getWorldTransform(worldTransform)\n\n const position = worldTransform.getOrigin()\n const quaternion = worldTransform.getRotation()\n mesh.position.set(position.x(), position.y(), position.z())\n mesh.quaternion.set(quaternion.x(), quaternion.y(), quaternion.z(), quaternion.w())\n }\n }\n }\n\n // animate\n\n setInterval(step, 1000 / frameRate)\n\n return {\n addMesh: addMesh,\n setMeshPosition: setMeshPosition,\n // addCompoundMesh\n }\n}\n\nfunction compose(position, quaternion, array, index) {\n const x = quaternion.x(),\n y = quaternion.y(),\n z = quaternion.z(),\n w = quaternion.w()\n const x2 = x + x,\n y2 = y + y,\n z2 = z + z\n const xx = x * x2,\n xy = x * y2,\n xz = x * z2\n const yy = y * y2,\n yz = y * z2,\n zz = z * z2\n const wx = w * x2,\n wy = w * y2,\n wz = w * z2\n\n array[index + 0] = 1 - (yy + zz)\n array[index + 1] = xy + wz\n array[index + 2] = xz - wy\n array[index + 3] = 0\n\n array[index + 4] = xy - wz\n array[index + 5] = 1 - (xx + zz)\n array[index + 6] = yz + wx\n array[index + 7] = 0\n\n array[index + 8] = xz + wy\n array[index + 9] = yz - wx\n array[index + 10] = 1 - (xx + yy)\n array[index + 11] = 0\n\n array[index + 12] = position.x()\n array[index + 13] = position.y()\n array[index + 14] = position.z()\n array[index + 15] = 1\n}\n\nexport { AmmoPhysics }\n", "/**\n * Ascii generation is based on https://github.com/hassadee/jsascii/blob/master/jsascii.js\n *\n * 16 April 2012 - @blurspline\n */\n\nclass AsciiEffect {\n constructor(renderer, charSet = ' .:-=+*#%@', options = {}) {\n // ' .,:;=|iI+hHOE#`$';\n // darker bolder character set from https://github.com/saw/Canvas-ASCII-Art/\n // ' .\\'`^\",:;Il!i~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$'.split('');\n\n // Some ASCII settings\n\n const fResolution = options['resolution'] || 0.15 // Higher for more details\n const iScale = options['scale'] || 1\n const bColor = options['color'] || false // nice but slows down rendering!\n const bAlpha = options['alpha'] || false // Transparency\n const bBlock = options['block'] || false // blocked characters. like good O dos\n const bInvert = options['invert'] || false // black is white, white is black\n const strResolution = options['strResolution'] || 'low'\n\n let width, height\n\n const domElement = document.createElement('div')\n domElement.style.cursor = 'default'\n\n const oAscii = document.createElement('table')\n domElement.appendChild(oAscii)\n\n let iWidth, iHeight\n let oImg\n\n this.setSize = function (w, h) {\n width = w\n height = h\n\n renderer.setSize(w, h)\n\n initAsciiSize()\n }\n\n this.render = function (scene, camera) {\n renderer.render(scene, camera)\n asciifyImage(oAscii)\n }\n\n this.domElement = domElement\n\n // Throw in ascii library from https://github.com/hassadee/jsascii/blob/master/jsascii.js (MIT License)\n\n function initAsciiSize() {\n iWidth = Math.floor(width * fResolution)\n iHeight = Math.floor(height * fResolution)\n\n oCanvas.width = iWidth\n oCanvas.height = iHeight\n // oCanvas.style.display = \"none\";\n // oCanvas.style.width = iWidth;\n // oCanvas.style.height = iHeight;\n\n oImg = renderer.domElement\n\n if (oImg.style.backgroundColor) {\n oAscii.rows[0].cells[0].style.backgroundColor = oImg.style.backgroundColor\n oAscii.rows[0].cells[0].style.color = oImg.style.color\n }\n\n oAscii.cellSpacing = 0\n oAscii.cellPadding = 0\n\n const oStyle = oAscii.style\n oStyle.whiteSpace = 'pre'\n oStyle.margin = '0px'\n oStyle.padding = '0px'\n oStyle.letterSpacing = fLetterSpacing + 'px'\n oStyle.fontFamily = strFont\n oStyle.fontSize = fFontSize + 'px'\n oStyle.lineHeight = fLineHeight + 'px'\n oStyle.textAlign = 'left'\n oStyle.textDecoration = 'none'\n }\n\n const aDefaultCharList = ' .,:;i1tfLCG08@'.split('')\n const aDefaultColorCharList = ' CGO08@'.split('')\n const strFont = 'courier new, monospace'\n\n const oCanvasImg = renderer.domElement\n\n const oCanvas = document.createElement('canvas')\n if (!oCanvas.getContext) {\n return\n }\n\n const oCtx = oCanvas.getContext('2d')\n if (!oCtx.getImageData) {\n return\n }\n\n let aCharList = bColor ? aDefaultColorCharList : aDefaultCharList\n\n if (charSet) aCharList = charSet\n\n // Setup dom\n\n const fFontSize = (2 / fResolution) * iScale\n const fLineHeight = (2 / fResolution) * iScale\n\n // adjust letter-spacing for all combinations of scale and resolution to get it to fit the image width.\n\n let fLetterSpacing = 0\n\n if (strResolution == 'low') {\n switch (iScale) {\n case 1:\n fLetterSpacing = -1\n break\n case 2:\n case 3:\n fLetterSpacing = -2.1\n break\n case 4:\n fLetterSpacing = -3.1\n break\n case 5:\n fLetterSpacing = -4.15\n break\n }\n }\n\n if (strResolution == 'medium') {\n switch (iScale) {\n case 1:\n fLetterSpacing = 0\n break\n case 2:\n fLetterSpacing = -1\n break\n case 3:\n fLetterSpacing = -1.04\n break\n case 4:\n case 5:\n fLetterSpacing = -2.1\n break\n }\n }\n\n if (strResolution == 'high') {\n switch (iScale) {\n case 1:\n case 2:\n fLetterSpacing = 0\n break\n case 3:\n case 4:\n case 5:\n fLetterSpacing = -1\n break\n }\n }\n\n // can't get a span or div to flow like an img element, but a table works?\n\n // convert img element to ascii\n\n function asciifyImage(oAscii) {\n oCtx.clearRect(0, 0, iWidth, iHeight)\n oCtx.drawImage(oCanvasImg, 0, 0, iWidth, iHeight)\n const oImgData = oCtx.getImageData(0, 0, iWidth, iHeight).data\n\n // Coloring loop starts now\n let strChars = ''\n\n // console.time('rendering');\n\n for (let y = 0; y < iHeight; y += 2) {\n for (let x = 0; x < iWidth; x++) {\n const iOffset = (y * iWidth + x) * 4\n\n const iRed = oImgData[iOffset]\n const iGreen = oImgData[iOffset + 1]\n const iBlue = oImgData[iOffset + 2]\n const iAlpha = oImgData[iOffset + 3]\n let iCharIdx\n\n let fBrightness\n\n fBrightness = (0.3 * iRed + 0.59 * iGreen + 0.11 * iBlue) / 255\n // fBrightness = (0.3*iRed + 0.5*iGreen + 0.3*iBlue) / 255;\n\n if (iAlpha == 0) {\n // should calculate alpha instead, but quick hack :)\n //fBrightness *= (iAlpha / 255);\n fBrightness = 1\n }\n\n iCharIdx = Math.floor((1 - fBrightness) * (aCharList.length - 1))\n\n if (bInvert) {\n iCharIdx = aCharList.length - iCharIdx - 1\n }\n\n // good for debugging\n //fBrightness = Math.floor(fBrightness * 10);\n //strThisChar = fBrightness;\n\n let strThisChar = aCharList[iCharIdx]\n\n if (strThisChar === undefined || strThisChar == ' ') strThisChar = ' '\n\n if (bColor) {\n strChars +=\n \"\" +\n strThisChar +\n ''\n } else {\n strChars += strThisChar\n }\n }\n\n strChars += '
'\n }\n\n oAscii.innerHTML = `${strChars}`\n\n // console.timeEnd('rendering');\n\n // return oAscii;\n }\n }\n}\n\nexport { AsciiEffect }\n", "import {\n AmbientLight,\n AnimationClip,\n Bone,\n BufferGeometry,\n ClampToEdgeWrapping,\n Color,\n DirectionalLight,\n EquirectangularReflectionMapping,\n Euler,\n FileLoader,\n Float32BufferAttribute,\n Group,\n Line,\n LineBasicMaterial,\n Loader,\n LoaderUtils,\n MathUtils,\n Matrix3,\n Matrix4,\n Mesh,\n MeshLambertMaterial,\n MeshPhongMaterial,\n NumberKeyframeTrack,\n Object3D,\n OrthographicCamera,\n PerspectiveCamera,\n PointLight,\n PropertyBinding,\n Quaternion,\n QuaternionKeyframeTrack,\n RepeatWrapping,\n Skeleton,\n SkinnedMesh,\n SpotLight,\n Texture,\n TextureLoader,\n Uint16BufferAttribute,\n Vector3,\n Vector4,\n VectorKeyframeTrack,\n} from 'three'\nimport { unzlibSync } from 'fflate'\nimport { NURBSCurve } from '../curves/NURBSCurve'\nimport { decodeText } from '../_polyfill/LoaderUtils'\n\n/**\n * Loader loads FBX file and generates Group representing FBX scene.\n * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format\n * Versions lower than this may load but will probably have errors\n *\n * Needs Support:\n * Morph normals / blend shape normals\n *\n * FBX format references:\n * \thttps://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html (C++ SDK reference)\n *\n * Binary format specification:\n *\thttps://code.blender.org/2013/08/fbx-binary-file-format-specification/\n */\n\nlet fbxTree\nlet connections\nlet sceneGraph\n\nclass FBXLoader extends Loader {\n constructor(manager) {\n super(manager)\n }\n\n load(url, onLoad, onProgress, onError) {\n const scope = this\n\n const path = scope.path === '' ? LoaderUtils.extractUrlBase(url) : scope.path\n\n const loader = new FileLoader(this.manager)\n loader.setPath(scope.path)\n loader.setResponseType('arraybuffer')\n loader.setRequestHeader(scope.requestHeader)\n loader.setWithCredentials(scope.withCredentials)\n\n loader.load(\n url,\n function (buffer) {\n try {\n onLoad(scope.parse(buffer, path))\n } catch (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n scope.manager.itemError(url)\n }\n },\n onProgress,\n onError,\n )\n }\n\n parse(FBXBuffer, path) {\n if (isFbxFormatBinary(FBXBuffer)) {\n fbxTree = new BinaryParser().parse(FBXBuffer)\n } else {\n const FBXText = convertArrayBufferToString(FBXBuffer)\n\n if (!isFbxFormatASCII(FBXText)) {\n throw new Error('THREE.FBXLoader: Unknown format.')\n }\n\n if (getFbxVersion(FBXText) < 7000) {\n throw new Error('THREE.FBXLoader: FBX version not supported, FileVersion: ' + getFbxVersion(FBXText))\n }\n\n fbxTree = new TextParser().parse(FBXText)\n }\n\n // console.log( fbxTree );\n\n const textureLoader = new TextureLoader(this.manager)\n .setPath(this.resourcePath || path)\n .setCrossOrigin(this.crossOrigin)\n\n return new FBXTreeParser(textureLoader, this.manager).parse(fbxTree)\n }\n}\n\n// Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group\nclass FBXTreeParser {\n constructor(textureLoader, manager) {\n this.textureLoader = textureLoader\n this.manager = manager\n }\n\n parse() {\n connections = this.parseConnections()\n\n const images = this.parseImages()\n const textures = this.parseTextures(images)\n const materials = this.parseMaterials(textures)\n const deformers = this.parseDeformers()\n const geometryMap = new GeometryParser().parse(deformers)\n\n this.parseScene(deformers, geometryMap, materials)\n\n return sceneGraph\n }\n\n // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )\n // and details the connection type\n parseConnections() {\n const connectionMap = new Map()\n\n if ('Connections' in fbxTree) {\n const rawConnections = fbxTree.Connections.connections\n\n rawConnections.forEach(function (rawConnection) {\n const fromID = rawConnection[0]\n const toID = rawConnection[1]\n const relationship = rawConnection[2]\n\n if (!connectionMap.has(fromID)) {\n connectionMap.set(fromID, {\n parents: [],\n children: [],\n })\n }\n\n const parentRelationship = { ID: toID, relationship: relationship }\n connectionMap.get(fromID).parents.push(parentRelationship)\n\n if (!connectionMap.has(toID)) {\n connectionMap.set(toID, {\n parents: [],\n children: [],\n })\n }\n\n const childRelationship = { ID: fromID, relationship: relationship }\n connectionMap.get(toID).children.push(childRelationship)\n })\n }\n\n return connectionMap\n }\n\n // Parse FBXTree.Objects.Video for embedded image data\n // These images are connected to textures in FBXTree.Objects.Textures\n // via FBXTree.Connections.\n parseImages() {\n const images = {}\n const blobs = {}\n\n if ('Video' in fbxTree.Objects) {\n const videoNodes = fbxTree.Objects.Video\n\n for (const nodeID in videoNodes) {\n const videoNode = videoNodes[nodeID]\n\n const id = parseInt(nodeID)\n\n images[id] = videoNode.RelativeFilename || videoNode.Filename\n\n // raw image data is in videoNode.Content\n if ('Content' in videoNode) {\n const arrayBufferContent = videoNode.Content instanceof ArrayBuffer && videoNode.Content.byteLength > 0\n const base64Content = typeof videoNode.Content === 'string' && videoNode.Content !== ''\n\n if (arrayBufferContent || base64Content) {\n const image = this.parseImage(videoNodes[nodeID])\n\n blobs[videoNode.RelativeFilename || videoNode.Filename] = image\n }\n }\n }\n }\n\n for (const id in images) {\n const filename = images[id]\n\n if (blobs[filename] !== undefined) images[id] = blobs[filename]\n else images[id] = images[id].split('\\\\').pop()\n }\n\n return images\n }\n\n // Parse embedded image data in FBXTree.Video.Content\n parseImage(videoNode) {\n const content = videoNode.Content\n const fileName = videoNode.RelativeFilename || videoNode.Filename\n const extension = fileName.slice(fileName.lastIndexOf('.') + 1).toLowerCase()\n\n let type\n\n switch (extension) {\n case 'bmp':\n type = 'image/bmp'\n break\n\n case 'jpg':\n case 'jpeg':\n type = 'image/jpeg'\n break\n\n case 'png':\n type = 'image/png'\n break\n\n case 'tif':\n type = 'image/tiff'\n break\n\n case 'tga':\n if (this.manager.getHandler('.tga') === null) {\n console.warn('FBXLoader: TGA loader not found, skipping ', fileName)\n }\n\n type = 'image/tga'\n break\n\n default:\n console.warn('FBXLoader: Image type \"' + extension + '\" is not supported.')\n return\n }\n\n if (typeof content === 'string') {\n // ASCII format\n\n return 'data:' + type + ';base64,' + content\n } else {\n // Binary Format\n\n const array = new Uint8Array(content)\n return window.URL.createObjectURL(new Blob([array], { type: type }))\n }\n }\n\n // Parse nodes in FBXTree.Objects.Texture\n // These contain details such as UV scaling, cropping, rotation etc and are connected\n // to images in FBXTree.Objects.Video\n parseTextures(images) {\n const textureMap = new Map()\n\n if ('Texture' in fbxTree.Objects) {\n const textureNodes = fbxTree.Objects.Texture\n for (const nodeID in textureNodes) {\n const texture = this.parseTexture(textureNodes[nodeID], images)\n textureMap.set(parseInt(nodeID), texture)\n }\n }\n\n return textureMap\n }\n\n // Parse individual node in FBXTree.Objects.Texture\n parseTexture(textureNode, images) {\n const texture = this.loadTexture(textureNode, images)\n\n texture.ID = textureNode.id\n\n texture.name = textureNode.attrName\n\n const wrapModeU = textureNode.WrapModeU\n const wrapModeV = textureNode.WrapModeV\n\n const valueU = wrapModeU !== undefined ? wrapModeU.value : 0\n const valueV = wrapModeV !== undefined ? wrapModeV.value : 0\n\n // http://download.autodesk.com/us/fbx/SDKdocs/FBX_SDK_Help/files/fbxsdkref/class_k_fbx_texture.html#889640e63e2e681259ea81061b85143a\n // 0: repeat(default), 1: clamp\n\n texture.wrapS = valueU === 0 ? RepeatWrapping : ClampToEdgeWrapping\n texture.wrapT = valueV === 0 ? RepeatWrapping : ClampToEdgeWrapping\n\n if ('Scaling' in textureNode) {\n const values = textureNode.Scaling.value\n\n texture.repeat.x = values[0]\n texture.repeat.y = values[1]\n }\n\n return texture\n }\n\n // load a texture specified as a blob or data URI, or via an external URL using TextureLoader\n loadTexture(textureNode, images) {\n let fileName\n\n const currentPath = this.textureLoader.path\n\n const children = connections.get(textureNode.id).children\n\n if (children !== undefined && children.length > 0 && images[children[0].ID] !== undefined) {\n fileName = images[children[0].ID]\n\n if (fileName.indexOf('blob:') === 0 || fileName.indexOf('data:') === 0) {\n this.textureLoader.setPath(undefined)\n }\n }\n\n let texture\n\n const extension = textureNode.FileName.slice(-3).toLowerCase()\n\n if (extension === 'tga') {\n const loader = this.manager.getHandler('.tga')\n\n if (loader === null) {\n console.warn('FBXLoader: TGA loader not found, creating placeholder texture for', textureNode.RelativeFilename)\n texture = new Texture()\n } else {\n loader.setPath(this.textureLoader.path)\n texture = loader.load(fileName)\n }\n } else if (extension === 'psd') {\n console.warn(\n 'FBXLoader: PSD textures are not supported, creating placeholder texture for',\n textureNode.RelativeFilename,\n )\n texture = new Texture()\n } else {\n texture = this.textureLoader.load(fileName)\n }\n\n this.textureLoader.setPath(currentPath)\n\n return texture\n }\n\n // Parse nodes in FBXTree.Objects.Material\n parseMaterials(textureMap) {\n const materialMap = new Map()\n\n if ('Material' in fbxTree.Objects) {\n const materialNodes = fbxTree.Objects.Material\n\n for (const nodeID in materialNodes) {\n const material = this.parseMaterial(materialNodes[nodeID], textureMap)\n\n if (material !== null) materialMap.set(parseInt(nodeID), material)\n }\n }\n\n return materialMap\n }\n\n // Parse single node in FBXTree.Objects.Material\n // Materials are connected to texture maps in FBXTree.Objects.Textures\n // FBX format currently only supports Lambert and Phong shading models\n parseMaterial(materialNode, textureMap) {\n const ID = materialNode.id\n const name = materialNode.attrName\n let type = materialNode.ShadingModel\n\n // Case where FBX wraps shading model in property object.\n if (typeof type === 'object') {\n type = type.value\n }\n\n // Ignore unused materials which don't have any connections.\n if (!connections.has(ID)) return null\n\n const parameters = this.parseParameters(materialNode, textureMap, ID)\n\n let material\n\n switch (type.toLowerCase()) {\n case 'phong':\n material = new MeshPhongMaterial()\n break\n case 'lambert':\n material = new MeshLambertMaterial()\n break\n default:\n console.warn('THREE.FBXLoader: unknown material type \"%s\". Defaulting to MeshPhongMaterial.', type)\n material = new MeshPhongMaterial()\n break\n }\n\n material.setValues(parameters)\n material.name = name\n\n return material\n }\n\n // Parse FBX material and return parameters suitable for a three.js material\n // Also parse the texture map and return any textures associated with the material\n parseParameters(materialNode, textureMap, ID) {\n const parameters = {}\n\n if (materialNode.BumpFactor) {\n parameters.bumpScale = materialNode.BumpFactor.value\n }\n\n if (materialNode.Diffuse) {\n parameters.color = new Color().fromArray(materialNode.Diffuse.value)\n } else if (\n materialNode.DiffuseColor &&\n (materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB')\n ) {\n // The blender exporter exports diffuse here instead of in materialNode.Diffuse\n parameters.color = new Color().fromArray(materialNode.DiffuseColor.value)\n }\n\n if (materialNode.DisplacementFactor) {\n parameters.displacementScale = materialNode.DisplacementFactor.value\n }\n\n if (materialNode.Emissive) {\n parameters.emissive = new Color().fromArray(materialNode.Emissive.value)\n } else if (\n materialNode.EmissiveColor &&\n (materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB')\n ) {\n // The blender exporter exports emissive color here instead of in materialNode.Emissive\n parameters.emissive = new Color().fromArray(materialNode.EmissiveColor.value)\n }\n\n if (materialNode.EmissiveFactor) {\n parameters.emissiveIntensity = parseFloat(materialNode.EmissiveFactor.value)\n }\n\n if (materialNode.Opacity) {\n parameters.opacity = parseFloat(materialNode.Opacity.value)\n }\n\n if (parameters.opacity < 1.0) {\n parameters.transparent = true\n }\n\n if (materialNode.ReflectionFactor) {\n parameters.reflectivity = materialNode.ReflectionFactor.value\n }\n\n if (materialNode.Shininess) {\n parameters.shininess = materialNode.Shininess.value\n }\n\n if (materialNode.Specular) {\n parameters.specular = new Color().fromArray(materialNode.Specular.value)\n } else if (materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color') {\n // The blender exporter exports specular color here instead of in materialNode.Specular\n parameters.specular = new Color().fromArray(materialNode.SpecularColor.value)\n }\n\n const scope = this\n connections.get(ID).children.forEach(function (child) {\n const type = child.relationship\n\n switch (type) {\n case 'Bump':\n parameters.bumpMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'Maya|TEX_ao_map':\n parameters.aoMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'DiffuseColor':\n case 'Maya|TEX_color_map':\n parameters.map = scope.getTexture(textureMap, child.ID)\n if (parameters.map !== undefined) {\n if ('colorSpace' in parameters.map) parameters.map.colorSpace = 'srgb'\n else parameters.map.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'DisplacementColor':\n parameters.displacementMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'EmissiveColor':\n parameters.emissiveMap = scope.getTexture(textureMap, child.ID)\n if (parameters.emissiveMap !== undefined) {\n if ('colorSpace' in parameters.emissiveMap) parameters.emissiveMap.colorSpace = 'srgb'\n else parameters.emissiveMap.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'NormalMap':\n case 'Maya|TEX_normal_map':\n parameters.normalMap = scope.getTexture(textureMap, child.ID)\n break\n\n case 'ReflectionColor':\n parameters.envMap = scope.getTexture(textureMap, child.ID)\n if (parameters.envMap !== undefined) {\n parameters.envMap.mapping = EquirectangularReflectionMapping\n\n if ('colorSpace' in parameters.envMap) parameters.envMap.colorSpace = 'srgb'\n else parameters.envMap.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'SpecularColor':\n parameters.specularMap = scope.getTexture(textureMap, child.ID)\n if (parameters.specularMap !== undefined) {\n if ('colorSpace' in parameters.specularMap) parameters.specularMap.colorSpace = 'srgb'\n else parameters.specularMap.encoding = 3001 // sRGBEncoding\n }\n\n break\n\n case 'TransparentColor':\n case 'TransparencyFactor':\n parameters.alphaMap = scope.getTexture(textureMap, child.ID)\n parameters.transparent = true\n break\n\n case 'AmbientColor':\n case 'ShininessExponent': // AKA glossiness map\n case 'SpecularFactor': // AKA specularLevel\n case 'VectorDisplacementColor': // NOTE: Seems to be a copy of DisplacementColor\n default:\n console.warn('THREE.FBXLoader: %s map is not supported in three.js, skipping texture.', type)\n break\n }\n })\n\n return parameters\n }\n\n // get a texture from the textureMap for use by a material.\n getTexture(textureMap, id) {\n // if the texture is a layered texture, just use the first layer and issue a warning\n if ('LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture) {\n console.warn('THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.')\n id = connections.get(id).children[0].ID\n }\n\n return textureMap.get(id)\n }\n\n // Parse nodes in FBXTree.Objects.Deformer\n // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here\n // Generates map of Skeleton-like objects for use later when generating and binding skeletons.\n parseDeformers() {\n const skeletons = {}\n const morphTargets = {}\n\n if ('Deformer' in fbxTree.Objects) {\n const DeformerNodes = fbxTree.Objects.Deformer\n\n for (const nodeID in DeformerNodes) {\n const deformerNode = DeformerNodes[nodeID]\n\n const relationships = connections.get(parseInt(nodeID))\n\n if (deformerNode.attrType === 'Skin') {\n const skeleton = this.parseSkeleton(relationships, DeformerNodes)\n skeleton.ID = nodeID\n\n if (relationships.parents.length > 1) {\n console.warn('THREE.FBXLoader: skeleton attached to more than one geometry is not supported.')\n }\n skeleton.geometryID = relationships.parents[0].ID\n\n skeletons[nodeID] = skeleton\n } else if (deformerNode.attrType === 'BlendShape') {\n const morphTarget = {\n id: nodeID,\n }\n\n morphTarget.rawTargets = this.parseMorphTargets(relationships, DeformerNodes)\n morphTarget.id = nodeID\n\n if (relationships.parents.length > 1) {\n console.warn('THREE.FBXLoader: morph target attached to more than one geometry is not supported.')\n }\n\n morphTargets[nodeID] = morphTarget\n }\n }\n }\n\n return {\n skeletons: skeletons,\n morphTargets: morphTargets,\n }\n }\n\n // Parse single nodes in FBXTree.Objects.Deformer\n // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'\n // Each skin node represents a skeleton and each cluster node represents a bone\n parseSkeleton(relationships, deformerNodes) {\n const rawBones = []\n\n relationships.children.forEach(function (child) {\n const boneNode = deformerNodes[child.ID]\n\n if (boneNode.attrType !== 'Cluster') return\n\n const rawBone = {\n ID: child.ID,\n indices: [],\n weights: [],\n transformLink: new Matrix4().fromArray(boneNode.TransformLink.a),\n // transform: new Matrix4().fromArray( boneNode.Transform.a ),\n // linkMode: boneNode.Mode,\n }\n\n if ('Indexes' in boneNode) {\n rawBone.indices = boneNode.Indexes.a\n rawBone.weights = boneNode.Weights.a\n }\n\n rawBones.push(rawBone)\n })\n\n return {\n rawBones: rawBones,\n bones: [],\n }\n }\n\n // The top level morph deformer node has type \"BlendShape\" and sub nodes have type \"BlendShapeChannel\"\n parseMorphTargets(relationships, deformerNodes) {\n const rawMorphTargets = []\n\n for (let i = 0; i < relationships.children.length; i++) {\n const child = relationships.children[i]\n\n const morphTargetNode = deformerNodes[child.ID]\n\n const rawMorphTarget = {\n name: morphTargetNode.attrName,\n initialWeight: morphTargetNode.DeformPercent,\n id: morphTargetNode.id,\n fullWeights: morphTargetNode.FullWeights.a,\n }\n\n if (morphTargetNode.attrType !== 'BlendShapeChannel') return\n\n rawMorphTarget.geoID = connections.get(parseInt(child.ID)).children.filter(function (child) {\n return child.relationship === undefined\n })[0].ID\n\n rawMorphTargets.push(rawMorphTarget)\n }\n\n return rawMorphTargets\n }\n\n // create the main Group() to be returned by the loader\n parseScene(deformers, geometryMap, materialMap) {\n sceneGraph = new Group()\n\n const modelMap = this.parseModels(deformers.skeletons, geometryMap, materialMap)\n\n const modelNodes = fbxTree.Objects.Model\n\n const scope = this\n modelMap.forEach(function (model) {\n const modelNode = modelNodes[model.ID]\n scope.setLookAtProperties(model, modelNode)\n\n const parentConnections = connections.get(model.ID).parents\n\n parentConnections.forEach(function (connection) {\n const parent = modelMap.get(connection.ID)\n if (parent !== undefined) parent.add(model)\n })\n\n if (model.parent === null) {\n sceneGraph.add(model)\n }\n })\n\n this.bindSkeleton(deformers.skeletons, geometryMap, modelMap)\n\n this.createAmbientLight()\n\n sceneGraph.traverse(function (node) {\n if (node.userData.transformData) {\n if (node.parent) {\n node.userData.transformData.parentMatrix = node.parent.matrix\n node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld\n }\n\n const transform = generateTransform(node.userData.transformData)\n\n node.applyMatrix4(transform)\n node.updateWorldMatrix()\n }\n })\n\n const animations = new AnimationParser().parse()\n\n // if all the models where already combined in a single group, just return that\n if (sceneGraph.children.length === 1 && sceneGraph.children[0].isGroup) {\n sceneGraph.children[0].animations = animations\n sceneGraph = sceneGraph.children[0]\n }\n\n sceneGraph.animations = animations\n }\n\n // parse nodes in FBXTree.Objects.Model\n parseModels(skeletons, geometryMap, materialMap) {\n const modelMap = new Map()\n const modelNodes = fbxTree.Objects.Model\n\n for (const nodeID in modelNodes) {\n const id = parseInt(nodeID)\n const node = modelNodes[nodeID]\n const relationships = connections.get(id)\n\n let model = this.buildSkeleton(relationships, skeletons, id, node.attrName)\n\n if (!model) {\n switch (node.attrType) {\n case 'Camera':\n model = this.createCamera(relationships)\n break\n case 'Light':\n model = this.createLight(relationships)\n break\n case 'Mesh':\n model = this.createMesh(relationships, geometryMap, materialMap)\n break\n case 'NurbsCurve':\n model = this.createCurve(relationships, geometryMap)\n break\n case 'LimbNode':\n case 'Root':\n model = new Bone()\n break\n case 'Null':\n default:\n model = new Group()\n break\n }\n\n model.name = node.attrName ? PropertyBinding.sanitizeNodeName(node.attrName) : ''\n\n model.ID = id\n }\n\n this.getTransformData(model, node)\n modelMap.set(id, model)\n }\n\n return modelMap\n }\n\n buildSkeleton(relationships, skeletons, id, name) {\n let bone = null\n\n relationships.parents.forEach(function (parent) {\n for (const ID in skeletons) {\n const skeleton = skeletons[ID]\n\n skeleton.rawBones.forEach(function (rawBone, i) {\n if (rawBone.ID === parent.ID) {\n const subBone = bone\n bone = new Bone()\n\n bone.matrixWorld.copy(rawBone.transformLink)\n\n // set name and id here - otherwise in cases where \"subBone\" is created it will not have a name / id\n\n bone.name = name ? PropertyBinding.sanitizeNodeName(name) : ''\n bone.ID = id\n\n skeleton.bones[i] = bone\n\n // In cases where a bone is shared between multiple meshes\n // duplicate the bone here and and it as a child of the first bone\n if (subBone !== null) {\n bone.add(subBone)\n }\n }\n })\n }\n })\n\n return bone\n }\n\n // create a PerspectiveCamera or OrthographicCamera\n createCamera(relationships) {\n let model\n let cameraAttribute\n\n relationships.children.forEach(function (child) {\n const attr = fbxTree.Objects.NodeAttribute[child.ID]\n\n if (attr !== undefined) {\n cameraAttribute = attr\n }\n })\n\n if (cameraAttribute === undefined) {\n model = new Object3D()\n } else {\n let type = 0\n if (cameraAttribute.CameraProjectionType !== undefined && cameraAttribute.CameraProjectionType.value === 1) {\n type = 1\n }\n\n let nearClippingPlane = 1\n if (cameraAttribute.NearPlane !== undefined) {\n nearClippingPlane = cameraAttribute.NearPlane.value / 1000\n }\n\n let farClippingPlane = 1000\n if (cameraAttribute.FarPlane !== undefined) {\n farClippingPlane = cameraAttribute.FarPlane.value / 1000\n }\n\n let width = window.innerWidth\n let height = window.innerHeight\n\n if (cameraAttribute.AspectWidth !== undefined && cameraAttribute.AspectHeight !== undefined) {\n width = cameraAttribute.AspectWidth.value\n height = cameraAttribute.AspectHeight.value\n }\n\n const aspect = width / height\n\n let fov = 45\n if (cameraAttribute.FieldOfView !== undefined) {\n fov = cameraAttribute.FieldOfView.value\n }\n\n const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null\n\n switch (type) {\n case 0: // Perspective\n model = new PerspectiveCamera(fov, aspect, nearClippingPlane, farClippingPlane)\n if (focalLength !== null) model.setFocalLength(focalLength)\n break\n\n case 1: // Orthographic\n model = new OrthographicCamera(\n -width / 2,\n width / 2,\n height / 2,\n -height / 2,\n nearClippingPlane,\n farClippingPlane,\n )\n break\n\n default:\n console.warn('THREE.FBXLoader: Unknown camera type ' + type + '.')\n model = new Object3D()\n break\n }\n }\n\n return model\n }\n\n // Create a DirectionalLight, PointLight or SpotLight\n createLight(relationships) {\n let model\n let lightAttribute\n\n relationships.children.forEach(function (child) {\n const attr = fbxTree.Objects.NodeAttribute[child.ID]\n\n if (attr !== undefined) {\n lightAttribute = attr\n }\n })\n\n if (lightAttribute === undefined) {\n model = new Object3D()\n } else {\n let type\n\n // LightType can be undefined for Point lights\n if (lightAttribute.LightType === undefined) {\n type = 0\n } else {\n type = lightAttribute.LightType.value\n }\n\n let color = 0xffffff\n\n if (lightAttribute.Color !== undefined) {\n color = new Color().fromArray(lightAttribute.Color.value)\n }\n\n let intensity = lightAttribute.Intensity === undefined ? 1 : lightAttribute.Intensity.value / 100\n\n // light disabled\n if (lightAttribute.CastLightOnObject !== undefined && lightAttribute.CastLightOnObject.value === 0) {\n intensity = 0\n }\n\n let distance = 0\n if (lightAttribute.FarAttenuationEnd !== undefined) {\n if (lightAttribute.EnableFarAttenuation !== undefined && lightAttribute.EnableFarAttenuation.value === 0) {\n distance = 0\n } else {\n distance = lightAttribute.FarAttenuationEnd.value\n }\n }\n\n // TODO: could this be calculated linearly from FarAttenuationStart to FarAttenuationEnd?\n const decay = 1\n\n switch (type) {\n case 0: // Point\n model = new PointLight(color, intensity, distance, decay)\n break\n\n case 1: // Directional\n model = new DirectionalLight(color, intensity)\n break\n\n case 2: // Spot\n let angle = Math.PI / 3\n\n if (lightAttribute.InnerAngle !== undefined) {\n angle = MathUtils.degToRad(lightAttribute.InnerAngle.value)\n }\n\n let penumbra = 0\n if (lightAttribute.OuterAngle !== undefined) {\n // TODO: this is not correct - FBX calculates outer and inner angle in degrees\n // with OuterAngle > InnerAngle && OuterAngle <= Math.PI\n // while three.js uses a penumbra between (0, 1) to attenuate the inner angle\n penumbra = MathUtils.degToRad(lightAttribute.OuterAngle.value)\n penumbra = Math.max(penumbra, 1)\n }\n\n model = new SpotLight(color, intensity, distance, angle, penumbra, decay)\n break\n\n default:\n console.warn(\n 'THREE.FBXLoader: Unknown light type ' + lightAttribute.LightType.value + ', defaulting to a PointLight.',\n )\n model = new PointLight(color, intensity)\n break\n }\n\n if (lightAttribute.CastShadows !== undefined && lightAttribute.CastShadows.value === 1) {\n model.castShadow = true\n }\n }\n\n return model\n }\n\n createMesh(relationships, geometryMap, materialMap) {\n let model\n let geometry = null\n let material = null\n const materials = []\n\n // get geometry and materials(s) from connections\n relationships.children.forEach(function (child) {\n if (geometryMap.has(child.ID)) {\n geometry = geometryMap.get(child.ID)\n }\n\n if (materialMap.has(child.ID)) {\n materials.push(materialMap.get(child.ID))\n }\n })\n\n if (materials.length > 1) {\n material = materials\n } else if (materials.length > 0) {\n material = materials[0]\n } else {\n material = new MeshPhongMaterial({ color: 0xcccccc })\n materials.push(material)\n }\n\n if ('color' in geometry.attributes) {\n materials.forEach(function (material) {\n material.vertexColors = true\n })\n }\n\n if (geometry.FBX_Deformer) {\n model = new SkinnedMesh(geometry, material)\n model.normalizeSkinWeights()\n } else {\n model = new Mesh(geometry, material)\n }\n\n return model\n }\n\n createCurve(relationships, geometryMap) {\n const geometry = relationships.children.reduce(function (geo, child) {\n if (geometryMap.has(child.ID)) geo = geometryMap.get(child.ID)\n\n return geo\n }, null)\n\n // FBX does not list materials for Nurbs lines, so we'll just put our own in here.\n const material = new LineBasicMaterial({ color: 0x3300ff, linewidth: 1 })\n return new Line(geometry, material)\n }\n\n // parse the model node for transform data\n getTransformData(model, modelNode) {\n const transformData = {}\n\n if ('InheritType' in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value)\n\n if ('RotationOrder' in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value)\n else transformData.eulerOrder = 'ZYX'\n\n if ('Lcl_Translation' in modelNode) transformData.translation = modelNode.Lcl_Translation.value\n\n if ('PreRotation' in modelNode) transformData.preRotation = modelNode.PreRotation.value\n if ('Lcl_Rotation' in modelNode) transformData.rotation = modelNode.Lcl_Rotation.value\n if ('PostRotation' in modelNode) transformData.postRotation = modelNode.PostRotation.value\n\n if ('Lcl_Scaling' in modelNode) transformData.scale = modelNode.Lcl_Scaling.value\n\n if ('ScalingOffset' in modelNode) transformData.scalingOffset = modelNode.ScalingOffset.value\n if ('ScalingPivot' in modelNode) transformData.scalingPivot = modelNode.ScalingPivot.value\n\n if ('RotationOffset' in modelNode) transformData.rotationOffset = modelNode.RotationOffset.value\n if ('RotationPivot' in modelNode) transformData.rotationPivot = modelNode.RotationPivot.value\n\n model.userData.transformData = transformData\n }\n\n setLookAtProperties(model, modelNode) {\n if ('LookAtProperty' in modelNode) {\n const children = connections.get(model.ID).children\n\n children.forEach(function (child) {\n if (child.relationship === 'LookAtProperty') {\n const lookAtTarget = fbxTree.Objects.Model[child.ID]\n\n if ('Lcl_Translation' in lookAtTarget) {\n const pos = lookAtTarget.Lcl_Translation.value\n\n // DirectionalLight, SpotLight\n if (model.target !== undefined) {\n model.target.position.fromArray(pos)\n sceneGraph.add(model.target)\n } else {\n // Cameras and other Object3Ds\n\n model.lookAt(new Vector3().fromArray(pos))\n }\n }\n }\n })\n }\n }\n\n bindSkeleton(skeletons, geometryMap, modelMap) {\n const bindMatrices = this.parsePoseNodes()\n\n for (const ID in skeletons) {\n const skeleton = skeletons[ID]\n\n const parents = connections.get(parseInt(skeleton.ID)).parents\n\n parents.forEach(function (parent) {\n if (geometryMap.has(parent.ID)) {\n const geoID = parent.ID\n const geoRelationships = connections.get(geoID)\n\n geoRelationships.parents.forEach(function (geoConnParent) {\n if (modelMap.has(geoConnParent.ID)) {\n const model = modelMap.get(geoConnParent.ID)\n\n model.bind(new Skeleton(skeleton.bones), bindMatrices[geoConnParent.ID])\n }\n })\n }\n })\n }\n }\n\n parsePoseNodes() {\n const bindMatrices = {}\n\n if ('Pose' in fbxTree.Objects) {\n const BindPoseNode = fbxTree.Objects.Pose\n\n for (const nodeID in BindPoseNode) {\n if (BindPoseNode[nodeID].attrType === 'BindPose' && BindPoseNode[nodeID].NbPoseNodes > 0) {\n const poseNodes = BindPoseNode[nodeID].PoseNode\n\n if (Array.isArray(poseNodes)) {\n poseNodes.forEach(function (poseNode) {\n bindMatrices[poseNode.Node] = new Matrix4().fromArray(poseNode.Matrix.a)\n })\n } else {\n bindMatrices[poseNodes.Node] = new Matrix4().fromArray(poseNodes.Matrix.a)\n }\n }\n }\n }\n\n return bindMatrices\n }\n\n // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light\n createAmbientLight() {\n if ('GlobalSettings' in fbxTree && 'AmbientColor' in fbxTree.GlobalSettings) {\n const ambientColor = fbxTree.GlobalSettings.AmbientColor.value\n const r = ambientColor[0]\n const g = ambientColor[1]\n const b = ambientColor[2]\n\n if (r !== 0 || g !== 0 || b !== 0) {\n const color = new Color(r, g, b)\n sceneGraph.add(new AmbientLight(color, 1))\n }\n }\n }\n}\n\n// parse Geometry data from FBXTree and return map of BufferGeometries\nclass GeometryParser {\n // Parse nodes in FBXTree.Objects.Geometry\n parse(deformers) {\n const geometryMap = new Map()\n\n if ('Geometry' in fbxTree.Objects) {\n const geoNodes = fbxTree.Objects.Geometry\n\n for (const nodeID in geoNodes) {\n const relationships = connections.get(parseInt(nodeID))\n const geo = this.parseGeometry(relationships, geoNodes[nodeID], deformers)\n\n geometryMap.set(parseInt(nodeID), geo)\n }\n }\n\n return geometryMap\n }\n\n // Parse single node in FBXTree.Objects.Geometry\n parseGeometry(relationships, geoNode, deformers) {\n switch (geoNode.attrType) {\n case 'Mesh':\n return this.parseMeshGeometry(relationships, geoNode, deformers)\n break\n\n case 'NurbsCurve':\n return this.parseNurbsGeometry(geoNode)\n break\n }\n }\n\n // Parse single node mesh geometry in FBXTree.Objects.Geometry\n parseMeshGeometry(relationships, geoNode, deformers) {\n const skeletons = deformers.skeletons\n const morphTargets = []\n\n const modelNodes = relationships.parents.map(function (parent) {\n return fbxTree.Objects.Model[parent.ID]\n })\n\n // don't create geometry if it is not associated with any models\n if (modelNodes.length === 0) return\n\n const skeleton = relationships.children.reduce(function (skeleton, child) {\n if (skeletons[child.ID] !== undefined) skeleton = skeletons[child.ID]\n\n return skeleton\n }, null)\n\n relationships.children.forEach(function (child) {\n if (deformers.morphTargets[child.ID] !== undefined) {\n morphTargets.push(deformers.morphTargets[child.ID])\n }\n })\n\n // Assume one model and get the preRotation from that\n // if there is more than one model associated with the geometry this may cause problems\n const modelNode = modelNodes[0]\n\n const transformData = {}\n\n if ('RotationOrder' in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value)\n if ('InheritType' in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value)\n\n if ('GeometricTranslation' in modelNode) transformData.translation = modelNode.GeometricTranslation.value\n if ('GeometricRotation' in modelNode) transformData.rotation = modelNode.GeometricRotation.value\n if ('GeometricScaling' in modelNode) transformData.scale = modelNode.GeometricScaling.value\n\n const transform = generateTransform(transformData)\n\n return this.genGeometry(geoNode, skeleton, morphTargets, transform)\n }\n\n // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry\n genGeometry(geoNode, skeleton, morphTargets, preTransform) {\n const geo = new BufferGeometry()\n if (geoNode.attrName) geo.name = geoNode.attrName\n\n const geoInfo = this.parseGeoNode(geoNode, skeleton)\n const buffers = this.genBuffers(geoInfo)\n\n const positionAttribute = new Float32BufferAttribute(buffers.vertex, 3)\n\n positionAttribute.applyMatrix4(preTransform)\n\n geo.setAttribute('position', positionAttribute)\n\n if (buffers.colors.length > 0) {\n geo.setAttribute('color', new Float32BufferAttribute(buffers.colors, 3))\n }\n\n if (skeleton) {\n geo.setAttribute('skinIndex', new Uint16BufferAttribute(buffers.weightsIndices, 4))\n\n geo.setAttribute('skinWeight', new Float32BufferAttribute(buffers.vertexWeights, 4))\n\n // used later to bind the skeleton to the model\n geo.FBX_Deformer = skeleton\n }\n\n if (buffers.normal.length > 0) {\n const normalMatrix = new Matrix3().getNormalMatrix(preTransform)\n\n const normalAttribute = new Float32BufferAttribute(buffers.normal, 3)\n normalAttribute.applyNormalMatrix(normalMatrix)\n\n geo.setAttribute('normal', normalAttribute)\n }\n\n buffers.uvs.forEach(function (uvBuffer, i) {\n // subsequent uv buffers are called 'uv1', 'uv2', ...\n let name = 'uv' + (i + 1).toString()\n\n // the first uv buffer is just called 'uv'\n if (i === 0) {\n name = 'uv'\n }\n\n geo.setAttribute(name, new Float32BufferAttribute(buffers.uvs[i], 2))\n })\n\n if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {\n // Convert the material indices of each vertex into rendering groups on the geometry.\n let prevMaterialIndex = buffers.materialIndex[0]\n let startIndex = 0\n\n buffers.materialIndex.forEach(function (currentIndex, i) {\n if (currentIndex !== prevMaterialIndex) {\n geo.addGroup(startIndex, i - startIndex, prevMaterialIndex)\n\n prevMaterialIndex = currentIndex\n startIndex = i\n }\n })\n\n // the loop above doesn't add the last group, do that here.\n if (geo.groups.length > 0) {\n const lastGroup = geo.groups[geo.groups.length - 1]\n const lastIndex = lastGroup.start + lastGroup.count\n\n if (lastIndex !== buffers.materialIndex.length) {\n geo.addGroup(lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex)\n }\n }\n\n // case where there are multiple materials but the whole geometry is only\n // using one of them\n if (geo.groups.length === 0) {\n geo.addGroup(0, buffers.materialIndex.length, buffers.materialIndex[0])\n }\n }\n\n this.addMorphTargets(geo, geoNode, morphTargets, preTransform)\n\n return geo\n }\n\n parseGeoNode(geoNode, skeleton) {\n const geoInfo = {}\n\n geoInfo.vertexPositions = geoNode.Vertices !== undefined ? geoNode.Vertices.a : []\n geoInfo.vertexIndices = geoNode.PolygonVertexIndex !== undefined ? geoNode.PolygonVertexIndex.a : []\n\n if (geoNode.LayerElementColor) {\n geoInfo.color = this.parseVertexColors(geoNode.LayerElementColor[0])\n }\n\n if (geoNode.LayerElementMaterial) {\n geoInfo.material = this.parseMaterialIndices(geoNode.LayerElementMaterial[0])\n }\n\n if (geoNode.LayerElementNormal) {\n geoInfo.normal = this.parseNormals(geoNode.LayerElementNormal[0])\n }\n\n if (geoNode.LayerElementUV) {\n geoInfo.uv = []\n\n let i = 0\n while (geoNode.LayerElementUV[i]) {\n if (geoNode.LayerElementUV[i].UV) {\n geoInfo.uv.push(this.parseUVs(geoNode.LayerElementUV[i]))\n }\n\n i++\n }\n }\n\n geoInfo.weightTable = {}\n\n if (skeleton !== null) {\n geoInfo.skeleton = skeleton\n\n skeleton.rawBones.forEach(function (rawBone, i) {\n // loop over the bone's vertex indices and weights\n rawBone.indices.forEach(function (index, j) {\n if (geoInfo.weightTable[index] === undefined) geoInfo.weightTable[index] = []\n\n geoInfo.weightTable[index].push({\n id: i,\n weight: rawBone.weights[j],\n })\n })\n })\n }\n\n return geoInfo\n }\n\n genBuffers(geoInfo) {\n const buffers = {\n vertex: [],\n normal: [],\n colors: [],\n uvs: [],\n materialIndex: [],\n vertexWeights: [],\n weightsIndices: [],\n }\n\n let polygonIndex = 0\n let faceLength = 0\n let displayedWeightsWarning = false\n\n // these will hold data for a single face\n let facePositionIndexes = []\n let faceNormals = []\n let faceColors = []\n let faceUVs = []\n let faceWeights = []\n let faceWeightIndices = []\n\n const scope = this\n geoInfo.vertexIndices.forEach(function (vertexIndex, polygonVertexIndex) {\n let materialIndex\n let endOfFace = false\n\n // Face index and vertex index arrays are combined in a single array\n // A cube with quad faces looks like this:\n // PolygonVertexIndex: *24 {\n // a: 0, 1, 3, -3, 2, 3, 5, -5, 4, 5, 7, -7, 6, 7, 1, -1, 1, 7, 5, -4, 6, 0, 2, -5\n // }\n // Negative numbers mark the end of a face - first face here is 0, 1, 3, -3\n // to find index of last vertex bit shift the index: ^ - 1\n if (vertexIndex < 0) {\n vertexIndex = vertexIndex ^ -1 // equivalent to ( x * -1 ) - 1\n endOfFace = true\n }\n\n let weightIndices = []\n let weights = []\n\n facePositionIndexes.push(vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2)\n\n if (geoInfo.color) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color)\n\n faceColors.push(data[0], data[1], data[2])\n }\n\n if (geoInfo.skeleton) {\n if (geoInfo.weightTable[vertexIndex] !== undefined) {\n geoInfo.weightTable[vertexIndex].forEach(function (wt) {\n weights.push(wt.weight)\n weightIndices.push(wt.id)\n })\n }\n\n if (weights.length > 4) {\n if (!displayedWeightsWarning) {\n console.warn(\n 'THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.',\n )\n displayedWeightsWarning = true\n }\n\n const wIndex = [0, 0, 0, 0]\n const Weight = [0, 0, 0, 0]\n\n weights.forEach(function (weight, weightIndex) {\n let currentWeight = weight\n let currentIndex = weightIndices[weightIndex]\n\n Weight.forEach(function (comparedWeight, comparedWeightIndex, comparedWeightArray) {\n if (currentWeight > comparedWeight) {\n comparedWeightArray[comparedWeightIndex] = currentWeight\n currentWeight = comparedWeight\n\n const tmp = wIndex[comparedWeightIndex]\n wIndex[comparedWeightIndex] = currentIndex\n currentIndex = tmp\n }\n })\n })\n\n weightIndices = wIndex\n weights = Weight\n }\n\n // if the weight array is shorter than 4 pad with 0s\n while (weights.length < 4) {\n weights.push(0)\n weightIndices.push(0)\n }\n\n for (let i = 0; i < 4; ++i) {\n faceWeights.push(weights[i])\n faceWeightIndices.push(weightIndices[i])\n }\n }\n\n if (geoInfo.normal) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal)\n\n faceNormals.push(data[0], data[1], data[2])\n }\n\n if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {\n materialIndex = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material)[0]\n }\n\n if (geoInfo.uv) {\n geoInfo.uv.forEach(function (uv, i) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, uv)\n\n if (faceUVs[i] === undefined) {\n faceUVs[i] = []\n }\n\n faceUVs[i].push(data[0])\n faceUVs[i].push(data[1])\n })\n }\n\n faceLength++\n\n if (endOfFace) {\n scope.genFace(\n buffers,\n geoInfo,\n facePositionIndexes,\n materialIndex,\n faceNormals,\n faceColors,\n faceUVs,\n faceWeights,\n faceWeightIndices,\n faceLength,\n )\n\n polygonIndex++\n faceLength = 0\n\n // reset arrays for the next face\n facePositionIndexes = []\n faceNormals = []\n faceColors = []\n faceUVs = []\n faceWeights = []\n faceWeightIndices = []\n }\n })\n\n return buffers\n }\n\n // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris\n genFace(\n buffers,\n geoInfo,\n facePositionIndexes,\n materialIndex,\n faceNormals,\n faceColors,\n faceUVs,\n faceWeights,\n faceWeightIndices,\n faceLength,\n ) {\n for (let i = 2; i < faceLength; i++) {\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[0]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[1]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[2]])\n\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3 + 1]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i - 1) * 3 + 2]])\n\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3 + 1]])\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i * 3 + 2]])\n\n if (geoInfo.skeleton) {\n buffers.vertexWeights.push(faceWeights[0])\n buffers.vertexWeights.push(faceWeights[1])\n buffers.vertexWeights.push(faceWeights[2])\n buffers.vertexWeights.push(faceWeights[3])\n\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4])\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 1])\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 2])\n buffers.vertexWeights.push(faceWeights[(i - 1) * 4 + 3])\n\n buffers.vertexWeights.push(faceWeights[i * 4])\n buffers.vertexWeights.push(faceWeights[i * 4 + 1])\n buffers.vertexWeights.push(faceWeights[i * 4 + 2])\n buffers.vertexWeights.push(faceWeights[i * 4 + 3])\n\n buffers.weightsIndices.push(faceWeightIndices[0])\n buffers.weightsIndices.push(faceWeightIndices[1])\n buffers.weightsIndices.push(faceWeightIndices[2])\n buffers.weightsIndices.push(faceWeightIndices[3])\n\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4])\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 1])\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 2])\n buffers.weightsIndices.push(faceWeightIndices[(i - 1) * 4 + 3])\n\n buffers.weightsIndices.push(faceWeightIndices[i * 4])\n buffers.weightsIndices.push(faceWeightIndices[i * 4 + 1])\n buffers.weightsIndices.push(faceWeightIndices[i * 4 + 2])\n buffers.weightsIndices.push(faceWeightIndices[i * 4 + 3])\n }\n\n if (geoInfo.color) {\n buffers.colors.push(faceColors[0])\n buffers.colors.push(faceColors[1])\n buffers.colors.push(faceColors[2])\n\n buffers.colors.push(faceColors[(i - 1) * 3])\n buffers.colors.push(faceColors[(i - 1) * 3 + 1])\n buffers.colors.push(faceColors[(i - 1) * 3 + 2])\n\n buffers.colors.push(faceColors[i * 3])\n buffers.colors.push(faceColors[i * 3 + 1])\n buffers.colors.push(faceColors[i * 3 + 2])\n }\n\n if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {\n buffers.materialIndex.push(materialIndex)\n buffers.materialIndex.push(materialIndex)\n buffers.materialIndex.push(materialIndex)\n }\n\n if (geoInfo.normal) {\n buffers.normal.push(faceNormals[0])\n buffers.normal.push(faceNormals[1])\n buffers.normal.push(faceNormals[2])\n\n buffers.normal.push(faceNormals[(i - 1) * 3])\n buffers.normal.push(faceNormals[(i - 1) * 3 + 1])\n buffers.normal.push(faceNormals[(i - 1) * 3 + 2])\n\n buffers.normal.push(faceNormals[i * 3])\n buffers.normal.push(faceNormals[i * 3 + 1])\n buffers.normal.push(faceNormals[i * 3 + 2])\n }\n\n if (geoInfo.uv) {\n geoInfo.uv.forEach(function (uv, j) {\n if (buffers.uvs[j] === undefined) buffers.uvs[j] = []\n\n buffers.uvs[j].push(faceUVs[j][0])\n buffers.uvs[j].push(faceUVs[j][1])\n\n buffers.uvs[j].push(faceUVs[j][(i - 1) * 2])\n buffers.uvs[j].push(faceUVs[j][(i - 1) * 2 + 1])\n\n buffers.uvs[j].push(faceUVs[j][i * 2])\n buffers.uvs[j].push(faceUVs[j][i * 2 + 1])\n })\n }\n }\n }\n\n addMorphTargets(parentGeo, parentGeoNode, morphTargets, preTransform) {\n if (morphTargets.length === 0) return\n\n parentGeo.morphTargetsRelative = true\n\n parentGeo.morphAttributes.position = []\n // parentGeo.morphAttributes.normal = []; // not implemented\n\n const scope = this\n morphTargets.forEach(function (morphTarget) {\n morphTarget.rawTargets.forEach(function (rawTarget) {\n const morphGeoNode = fbxTree.Objects.Geometry[rawTarget.geoID]\n\n if (morphGeoNode !== undefined) {\n scope.genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name)\n }\n })\n })\n }\n\n // a morph geometry node is similar to a standard node, and the node is also contained\n // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal\n // and a special attribute Index defining which vertices of the original geometry are affected\n // Normal and position attributes only have data for the vertices that are affected by the morph\n genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, name) {\n const vertexIndices = parentGeoNode.PolygonVertexIndex !== undefined ? parentGeoNode.PolygonVertexIndex.a : []\n\n const morphPositionsSparse = morphGeoNode.Vertices !== undefined ? morphGeoNode.Vertices.a : []\n const indices = morphGeoNode.Indexes !== undefined ? morphGeoNode.Indexes.a : []\n\n const length = parentGeo.attributes.position.count * 3\n const morphPositions = new Float32Array(length)\n\n for (let i = 0; i < indices.length; i++) {\n const morphIndex = indices[i] * 3\n\n morphPositions[morphIndex] = morphPositionsSparse[i * 3]\n morphPositions[morphIndex + 1] = morphPositionsSparse[i * 3 + 1]\n morphPositions[morphIndex + 2] = morphPositionsSparse[i * 3 + 2]\n }\n\n // TODO: add morph normal support\n const morphGeoInfo = {\n vertexIndices: vertexIndices,\n vertexPositions: morphPositions,\n }\n\n const morphBuffers = this.genBuffers(morphGeoInfo)\n\n const positionAttribute = new Float32BufferAttribute(morphBuffers.vertex, 3)\n positionAttribute.name = name || morphGeoNode.attrName\n\n positionAttribute.applyMatrix4(preTransform)\n\n parentGeo.morphAttributes.position.push(positionAttribute)\n }\n\n // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists\n parseNormals(NormalNode) {\n const mappingType = NormalNode.MappingInformationType\n const referenceType = NormalNode.ReferenceInformationType\n const buffer = NormalNode.Normals.a\n let indexBuffer = []\n if (referenceType === 'IndexToDirect') {\n if ('NormalIndex' in NormalNode) {\n indexBuffer = NormalNode.NormalIndex.a\n } else if ('NormalsIndex' in NormalNode) {\n indexBuffer = NormalNode.NormalsIndex.a\n }\n }\n\n return {\n dataSize: 3,\n buffer: buffer,\n indices: indexBuffer,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists\n parseUVs(UVNode) {\n const mappingType = UVNode.MappingInformationType\n const referenceType = UVNode.ReferenceInformationType\n const buffer = UVNode.UV.a\n let indexBuffer = []\n if (referenceType === 'IndexToDirect') {\n indexBuffer = UVNode.UVIndex.a\n }\n\n return {\n dataSize: 2,\n buffer: buffer,\n indices: indexBuffer,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists\n parseVertexColors(ColorNode) {\n const mappingType = ColorNode.MappingInformationType\n const referenceType = ColorNode.ReferenceInformationType\n const buffer = ColorNode.Colors.a\n let indexBuffer = []\n if (referenceType === 'IndexToDirect') {\n indexBuffer = ColorNode.ColorIndex.a\n }\n\n return {\n dataSize: 4,\n buffer: buffer,\n indices: indexBuffer,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists\n parseMaterialIndices(MaterialNode) {\n const mappingType = MaterialNode.MappingInformationType\n const referenceType = MaterialNode.ReferenceInformationType\n\n if (mappingType === 'NoMappingInformation') {\n return {\n dataSize: 1,\n buffer: [0],\n indices: [0],\n mappingType: 'AllSame',\n referenceType: referenceType,\n }\n }\n\n const materialIndexBuffer = MaterialNode.Materials.a\n\n // Since materials are stored as indices, there's a bit of a mismatch between FBX and what\n // we expect.So we create an intermediate buffer that points to the index in the buffer,\n // for conforming with the other functions we've written for other data.\n const materialIndices = []\n\n for (let i = 0; i < materialIndexBuffer.length; ++i) {\n materialIndices.push(i)\n }\n\n return {\n dataSize: 1,\n buffer: materialIndexBuffer,\n indices: materialIndices,\n mappingType: mappingType,\n referenceType: referenceType,\n }\n }\n\n // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry\n parseNurbsGeometry(geoNode) {\n if (NURBSCurve === undefined) {\n console.error(\n 'THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.',\n )\n return new BufferGeometry()\n }\n\n const order = parseInt(geoNode.Order)\n\n if (isNaN(order)) {\n console.error('THREE.FBXLoader: Invalid Order %s given for geometry ID: %s', geoNode.Order, geoNode.id)\n return new BufferGeometry()\n }\n\n const degree = order - 1\n\n const knots = geoNode.KnotVector.a\n const controlPoints = []\n const pointsValues = geoNode.Points.a\n\n for (let i = 0, l = pointsValues.length; i < l; i += 4) {\n controlPoints.push(new Vector4().fromArray(pointsValues, i))\n }\n\n let startKnot, endKnot\n\n if (geoNode.Form === 'Closed') {\n controlPoints.push(controlPoints[0])\n } else if (geoNode.Form === 'Periodic') {\n startKnot = degree\n endKnot = knots.length - 1 - startKnot\n\n for (let i = 0; i < degree; ++i) {\n controlPoints.push(controlPoints[i])\n }\n }\n\n const curve = new NURBSCurve(degree, knots, controlPoints, startKnot, endKnot)\n const points = curve.getPoints(controlPoints.length * 12)\n\n return new BufferGeometry().setFromPoints(points)\n }\n}\n\n// parse animation data from FBXTree\nclass AnimationParser {\n // take raw animation clips and turn them into three.js animation clips\n parse() {\n const animationClips = []\n\n const rawClips = this.parseClips()\n\n if (rawClips !== undefined) {\n for (const key in rawClips) {\n const rawClip = rawClips[key]\n\n const clip = this.addClip(rawClip)\n\n animationClips.push(clip)\n }\n }\n\n return animationClips\n }\n\n parseClips() {\n // since the actual transformation data is stored in FBXTree.Objects.AnimationCurve,\n // if this is undefined we can safely assume there are no animations\n if (fbxTree.Objects.AnimationCurve === undefined) return undefined\n\n const curveNodesMap = this.parseAnimationCurveNodes()\n\n this.parseAnimationCurves(curveNodesMap)\n\n const layersMap = this.parseAnimationLayers(curveNodesMap)\n const rawClips = this.parseAnimStacks(layersMap)\n\n return rawClips\n }\n\n // parse nodes in FBXTree.Objects.AnimationCurveNode\n // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )\n // and is referenced by an AnimationLayer\n parseAnimationCurveNodes() {\n const rawCurveNodes = fbxTree.Objects.AnimationCurveNode\n\n const curveNodesMap = new Map()\n\n for (const nodeID in rawCurveNodes) {\n const rawCurveNode = rawCurveNodes[nodeID]\n\n if (rawCurveNode.attrName.match(/S|R|T|DeformPercent/) !== null) {\n const curveNode = {\n id: rawCurveNode.id,\n attr: rawCurveNode.attrName,\n curves: {},\n }\n\n curveNodesMap.set(curveNode.id, curveNode)\n }\n }\n\n return curveNodesMap\n }\n\n // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to\n // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated\n // axis ( e.g. times and values of x rotation)\n parseAnimationCurves(curveNodesMap) {\n const rawCurves = fbxTree.Objects.AnimationCurve\n\n // TODO: Many values are identical up to roundoff error, but won't be optimised\n // e.g. position times: [0, 0.4, 0. 8]\n // position values: [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.235384487103147e-7, 93.67520904541016, -0.9982695579528809]\n // clearly, this should be optimised to\n // times: [0], positions [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809]\n // this shows up in nearly every FBX file, and generally time array is length > 100\n\n for (const nodeID in rawCurves) {\n const animationCurve = {\n id: rawCurves[nodeID].id,\n times: rawCurves[nodeID].KeyTime.a.map(convertFBXTimeToSeconds),\n values: rawCurves[nodeID].KeyValueFloat.a,\n }\n\n const relationships = connections.get(animationCurve.id)\n\n if (relationships !== undefined) {\n const animationCurveID = relationships.parents[0].ID\n const animationCurveRelationship = relationships.parents[0].relationship\n\n if (animationCurveRelationship.match(/X/)) {\n curveNodesMap.get(animationCurveID).curves['x'] = animationCurve\n } else if (animationCurveRelationship.match(/Y/)) {\n curveNodesMap.get(animationCurveID).curves['y'] = animationCurve\n } else if (animationCurveRelationship.match(/Z/)) {\n curveNodesMap.get(animationCurveID).curves['z'] = animationCurve\n } else if (animationCurveRelationship.match(/d|DeformPercent/) && curveNodesMap.has(animationCurveID)) {\n curveNodesMap.get(animationCurveID).curves['morph'] = animationCurve\n }\n }\n }\n }\n\n // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references\n // to various AnimationCurveNodes and is referenced by an AnimationStack node\n // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack\n parseAnimationLayers(curveNodesMap) {\n const rawLayers = fbxTree.Objects.AnimationLayer\n\n const layersMap = new Map()\n\n for (const nodeID in rawLayers) {\n const layerCurveNodes = []\n\n const connection = connections.get(parseInt(nodeID))\n\n if (connection !== undefined) {\n // all the animationCurveNodes used in the layer\n const children = connection.children\n\n children.forEach(function (child, i) {\n if (curveNodesMap.has(child.ID)) {\n const curveNode = curveNodesMap.get(child.ID)\n\n // check that the curves are defined for at least one axis, otherwise ignore the curveNode\n if (\n curveNode.curves.x !== undefined ||\n curveNode.curves.y !== undefined ||\n curveNode.curves.z !== undefined\n ) {\n if (layerCurveNodes[i] === undefined) {\n const modelID = connections.get(child.ID).parents.filter(function (parent) {\n return parent.relationship !== undefined\n })[0].ID\n\n if (modelID !== undefined) {\n const rawModel = fbxTree.Objects.Model[modelID.toString()]\n\n if (rawModel === undefined) {\n console.warn('THREE.FBXLoader: Encountered a unused curve.', child)\n return\n }\n\n const node = {\n modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : '',\n ID: rawModel.id,\n initialPosition: [0, 0, 0],\n initialRotation: [0, 0, 0],\n initialScale: [1, 1, 1],\n }\n\n sceneGraph.traverse(function (child) {\n if (child.ID === rawModel.id) {\n node.transform = child.matrix\n\n if (child.userData.transformData) node.eulerOrder = child.userData.transformData.eulerOrder\n }\n })\n\n if (!node.transform) node.transform = new Matrix4()\n\n // if the animated model is pre rotated, we'll have to apply the pre rotations to every\n // animation value as well\n if ('PreRotation' in rawModel) node.preRotation = rawModel.PreRotation.value\n if ('PostRotation' in rawModel) node.postRotation = rawModel.PostRotation.value\n\n layerCurveNodes[i] = node\n }\n }\n\n if (layerCurveNodes[i]) layerCurveNodes[i][curveNode.attr] = curveNode\n } else if (curveNode.curves.morph !== undefined) {\n if (layerCurveNodes[i] === undefined) {\n const deformerID = connections.get(child.ID).parents.filter(function (parent) {\n return parent.relationship !== undefined\n })[0].ID\n\n const morpherID = connections.get(deformerID).parents[0].ID\n const geoID = connections.get(morpherID).parents[0].ID\n\n // assuming geometry is not used in more than one model\n const modelID = connections.get(geoID).parents[0].ID\n\n const rawModel = fbxTree.Objects.Model[modelID]\n\n const node = {\n modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : '',\n morphName: fbxTree.Objects.Deformer[deformerID].attrName,\n }\n\n layerCurveNodes[i] = node\n }\n\n layerCurveNodes[i][curveNode.attr] = curveNode\n }\n }\n })\n\n layersMap.set(parseInt(nodeID), layerCurveNodes)\n }\n }\n\n return layersMap\n }\n\n // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation\n // hierarchy. Each Stack node will be used to create a AnimationClip\n parseAnimStacks(layersMap) {\n const rawStacks = fbxTree.Objects.AnimationStack\n\n // connect the stacks (clips) up to the layers\n const rawClips = {}\n\n for (const nodeID in rawStacks) {\n const children = connections.get(parseInt(nodeID)).children\n\n if (children.length > 1) {\n // it seems like stacks will always be associated with a single layer. But just in case there are files\n // where there are multiple layers per stack, we'll display a warning\n console.warn(\n 'THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.',\n )\n }\n\n const layer = layersMap.get(children[0].ID)\n\n rawClips[nodeID] = {\n name: rawStacks[nodeID].attrName,\n layer: layer,\n }\n }\n\n return rawClips\n }\n\n addClip(rawClip) {\n let tracks = []\n\n const scope = this\n rawClip.layer.forEach(function (rawTracks) {\n tracks = tracks.concat(scope.generateTracks(rawTracks))\n })\n\n return new AnimationClip(rawClip.name, -1, tracks)\n }\n\n generateTracks(rawTracks) {\n const tracks = []\n\n let initialPosition = new Vector3()\n let initialRotation = new Quaternion()\n let initialScale = new Vector3()\n\n if (rawTracks.transform) rawTracks.transform.decompose(initialPosition, initialRotation, initialScale)\n\n initialPosition = initialPosition.toArray()\n initialRotation = new Euler().setFromQuaternion(initialRotation, rawTracks.eulerOrder).toArray()\n initialScale = initialScale.toArray()\n\n if (rawTracks.T !== undefined && Object.keys(rawTracks.T.curves).length > 0) {\n const positionTrack = this.generateVectorTrack(\n rawTracks.modelName,\n rawTracks.T.curves,\n initialPosition,\n 'position',\n )\n if (positionTrack !== undefined) tracks.push(positionTrack)\n }\n\n if (rawTracks.R !== undefined && Object.keys(rawTracks.R.curves).length > 0) {\n const rotationTrack = this.generateRotationTrack(\n rawTracks.modelName,\n rawTracks.R.curves,\n initialRotation,\n rawTracks.preRotation,\n rawTracks.postRotation,\n rawTracks.eulerOrder,\n )\n if (rotationTrack !== undefined) tracks.push(rotationTrack)\n }\n\n if (rawTracks.S !== undefined && Object.keys(rawTracks.S.curves).length > 0) {\n const scaleTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.S.curves, initialScale, 'scale')\n if (scaleTrack !== undefined) tracks.push(scaleTrack)\n }\n\n if (rawTracks.DeformPercent !== undefined) {\n const morphTrack = this.generateMorphTrack(rawTracks)\n if (morphTrack !== undefined) tracks.push(morphTrack)\n }\n\n return tracks\n }\n\n generateVectorTrack(modelName, curves, initialValue, type) {\n const times = this.getTimesForAllAxes(curves)\n const values = this.getKeyframeTrackValues(times, curves, initialValue)\n\n return new VectorKeyframeTrack(modelName + '.' + type, times, values)\n }\n\n generateRotationTrack(modelName, curves, initialValue, preRotation, postRotation, eulerOrder) {\n if (curves.x !== undefined) {\n this.interpolateRotations(curves.x)\n curves.x.values = curves.x.values.map(MathUtils.degToRad)\n }\n\n if (curves.y !== undefined) {\n this.interpolateRotations(curves.y)\n curves.y.values = curves.y.values.map(MathUtils.degToRad)\n }\n\n if (curves.z !== undefined) {\n this.interpolateRotations(curves.z)\n curves.z.values = curves.z.values.map(MathUtils.degToRad)\n }\n\n const times = this.getTimesForAllAxes(curves)\n const values = this.getKeyframeTrackValues(times, curves, initialValue)\n\n if (preRotation !== undefined) {\n preRotation = preRotation.map(MathUtils.degToRad)\n preRotation.push(eulerOrder)\n\n preRotation = new Euler().fromArray(preRotation)\n preRotation = new Quaternion().setFromEuler(preRotation)\n }\n\n if (postRotation !== undefined) {\n postRotation = postRotation.map(MathUtils.degToRad)\n postRotation.push(eulerOrder)\n\n postRotation = new Euler().fromArray(postRotation)\n postRotation = new Quaternion().setFromEuler(postRotation).invert()\n }\n\n const quaternion = new Quaternion()\n const euler = new Euler()\n\n const quaternionValues = []\n\n for (let i = 0; i < values.length; i += 3) {\n euler.set(values[i], values[i + 1], values[i + 2], eulerOrder)\n\n quaternion.setFromEuler(euler)\n\n if (preRotation !== undefined) quaternion.premultiply(preRotation)\n if (postRotation !== undefined) quaternion.multiply(postRotation)\n\n quaternion.toArray(quaternionValues, (i / 3) * 4)\n }\n\n return new QuaternionKeyframeTrack(modelName + '.quaternion', times, quaternionValues)\n }\n\n generateMorphTrack(rawTracks) {\n const curves = rawTracks.DeformPercent.curves.morph\n const values = curves.values.map(function (val) {\n return val / 100\n })\n\n const morphNum = sceneGraph.getObjectByName(rawTracks.modelName).morphTargetDictionary[rawTracks.morphName]\n\n return new NumberKeyframeTrack(\n rawTracks.modelName + '.morphTargetInfluences[' + morphNum + ']',\n curves.times,\n values,\n )\n }\n\n // For all animated objects, times are defined separately for each axis\n // Here we'll combine the times into one sorted array without duplicates\n getTimesForAllAxes(curves) {\n let times = []\n\n // first join together the times for each axis, if defined\n if (curves.x !== undefined) times = times.concat(curves.x.times)\n if (curves.y !== undefined) times = times.concat(curves.y.times)\n if (curves.z !== undefined) times = times.concat(curves.z.times)\n\n // then sort them\n times = times.sort(function (a, b) {\n return a - b\n })\n\n // and remove duplicates\n if (times.length > 1) {\n let targetIndex = 1\n let lastValue = times[0]\n for (let i = 1; i < times.length; i++) {\n const currentValue = times[i]\n if (currentValue !== lastValue) {\n times[targetIndex] = currentValue\n lastValue = currentValue\n targetIndex++\n }\n }\n\n times = times.slice(0, targetIndex)\n }\n\n return times\n }\n\n getKeyframeTrackValues(times, curves, initialValue) {\n const prevValue = initialValue\n\n const values = []\n\n let xIndex = -1\n let yIndex = -1\n let zIndex = -1\n\n times.forEach(function (time) {\n if (curves.x) xIndex = curves.x.times.indexOf(time)\n if (curves.y) yIndex = curves.y.times.indexOf(time)\n if (curves.z) zIndex = curves.z.times.indexOf(time)\n\n // if there is an x value defined for this frame, use that\n if (xIndex !== -1) {\n const xValue = curves.x.values[xIndex]\n values.push(xValue)\n prevValue[0] = xValue\n } else {\n // otherwise use the x value from the previous frame\n values.push(prevValue[0])\n }\n\n if (yIndex !== -1) {\n const yValue = curves.y.values[yIndex]\n values.push(yValue)\n prevValue[1] = yValue\n } else {\n values.push(prevValue[1])\n }\n\n if (zIndex !== -1) {\n const zValue = curves.z.values[zIndex]\n values.push(zValue)\n prevValue[2] = zValue\n } else {\n values.push(prevValue[2])\n }\n })\n\n return values\n }\n\n // Rotations are defined as Euler angles which can have values of any size\n // These will be converted to quaternions which don't support values greater than\n // PI, so we'll interpolate large rotations\n interpolateRotations(curve) {\n for (let i = 1; i < curve.values.length; i++) {\n const initialValue = curve.values[i - 1]\n const valuesSpan = curve.values[i] - initialValue\n\n const absoluteSpan = Math.abs(valuesSpan)\n\n if (absoluteSpan >= 180) {\n const numSubIntervals = absoluteSpan / 180\n\n const step = valuesSpan / numSubIntervals\n let nextValue = initialValue + step\n\n const initialTime = curve.times[i - 1]\n const timeSpan = curve.times[i] - initialTime\n const interval = timeSpan / numSubIntervals\n let nextTime = initialTime + interval\n\n const interpolatedTimes = []\n const interpolatedValues = []\n\n while (nextTime < curve.times[i]) {\n interpolatedTimes.push(nextTime)\n nextTime += interval\n\n interpolatedValues.push(nextValue)\n nextValue += step\n }\n\n curve.times = inject(curve.times, i, interpolatedTimes)\n curve.values = inject(curve.values, i, interpolatedValues)\n }\n }\n }\n}\n\n// parse an FBX file in ASCII format\nclass TextParser {\n getPrevNode() {\n return this.nodeStack[this.currentIndent - 2]\n }\n\n getCurrentNode() {\n return this.nodeStack[this.currentIndent - 1]\n }\n\n getCurrentProp() {\n return this.currentProp\n }\n\n pushStack(node) {\n this.nodeStack.push(node)\n this.currentIndent += 1\n }\n\n popStack() {\n this.nodeStack.pop()\n this.currentIndent -= 1\n }\n\n setCurrentProp(val, name) {\n this.currentProp = val\n this.currentPropName = name\n }\n\n parse(text) {\n this.currentIndent = 0\n\n this.allNodes = new FBXTree()\n this.nodeStack = []\n this.currentProp = []\n this.currentPropName = ''\n\n const scope = this\n\n const split = text.split(/[\\r\\n]+/)\n\n split.forEach(function (line, i) {\n const matchComment = line.match(/^[\\s\\t]*;/)\n const matchEmpty = line.match(/^[\\s\\t]*$/)\n\n if (matchComment || matchEmpty) return\n\n const matchBeginning = line.match('^\\\\t{' + scope.currentIndent + '}(\\\\w+):(.*){', '')\n const matchProperty = line.match('^\\\\t{' + scope.currentIndent + '}(\\\\w+):[\\\\s\\\\t\\\\r\\\\n](.*)')\n const matchEnd = line.match('^\\\\t{' + (scope.currentIndent - 1) + '}}')\n\n if (matchBeginning) {\n scope.parseNodeBegin(line, matchBeginning)\n } else if (matchProperty) {\n scope.parseNodeProperty(line, matchProperty, split[++i])\n } else if (matchEnd) {\n scope.popStack()\n } else if (line.match(/^[^\\s\\t}]/)) {\n // large arrays are split over multiple lines terminated with a ',' character\n // if this is encountered the line needs to be joined to the previous line\n scope.parseNodePropertyContinued(line)\n }\n })\n\n return this.allNodes\n }\n\n parseNodeBegin(line, property) {\n const nodeName = property[1].trim().replace(/^\"/, '').replace(/\"$/, '')\n\n const nodeAttrs = property[2].split(',').map(function (attr) {\n return attr.trim().replace(/^\"/, '').replace(/\"$/, '')\n })\n\n const node = { name: nodeName }\n const attrs = this.parseNodeAttr(nodeAttrs)\n\n const currentNode = this.getCurrentNode()\n\n // a top node\n if (this.currentIndent === 0) {\n this.allNodes.add(nodeName, node)\n } else {\n // a subnode\n\n // if the subnode already exists, append it\n if (nodeName in currentNode) {\n // special case Pose needs PoseNodes as an array\n if (nodeName === 'PoseNode') {\n currentNode.PoseNode.push(node)\n } else if (currentNode[nodeName].id !== undefined) {\n currentNode[nodeName] = {}\n currentNode[nodeName][currentNode[nodeName].id] = currentNode[nodeName]\n }\n\n if (attrs.id !== '') currentNode[nodeName][attrs.id] = node\n } else if (typeof attrs.id === 'number') {\n currentNode[nodeName] = {}\n currentNode[nodeName][attrs.id] = node\n } else if (nodeName !== 'Properties70') {\n if (nodeName === 'PoseNode') currentNode[nodeName] = [node]\n else currentNode[nodeName] = node\n }\n }\n\n if (typeof attrs.id === 'number') node.id = attrs.id\n if (attrs.name !== '') node.attrName = attrs.name\n if (attrs.type !== '') node.attrType = attrs.type\n\n this.pushStack(node)\n }\n\n parseNodeAttr(attrs) {\n let id = attrs[0]\n\n if (attrs[0] !== '') {\n id = parseInt(attrs[0])\n\n if (isNaN(id)) {\n id = attrs[0]\n }\n }\n\n let name = '',\n type = ''\n\n if (attrs.length > 1) {\n name = attrs[1].replace(/^(\\w+)::/, '')\n type = attrs[2]\n }\n\n return { id: id, name: name, type: type }\n }\n\n parseNodeProperty(line, property, contentLine) {\n let propName = property[1].replace(/^\"/, '').replace(/\"$/, '').trim()\n let propValue = property[2].replace(/^\"/, '').replace(/\"$/, '').trim()\n\n // for special case: base64 image data follows \"Content: ,\" line\n //\tContent: ,\n //\t \"/9j/4RDaRXhpZgAATU0A...\"\n if (propName === 'Content' && propValue === ',') {\n propValue = contentLine.replace(/\"/g, '').replace(/,$/, '').trim()\n }\n\n const currentNode = this.getCurrentNode()\n const parentName = currentNode.name\n\n if (parentName === 'Properties70') {\n this.parseNodeSpecialProperty(line, propName, propValue)\n return\n }\n\n // Connections\n if (propName === 'C') {\n const connProps = propValue.split(',').slice(1)\n const from = parseInt(connProps[0])\n const to = parseInt(connProps[1])\n\n let rest = propValue.split(',').slice(3)\n\n rest = rest.map(function (elem) {\n return elem.trim().replace(/^\"/, '')\n })\n\n propName = 'connections'\n propValue = [from, to]\n append(propValue, rest)\n\n if (currentNode[propName] === undefined) {\n currentNode[propName] = []\n }\n }\n\n // Node\n if (propName === 'Node') currentNode.id = propValue\n\n // connections\n if (propName in currentNode && Array.isArray(currentNode[propName])) {\n currentNode[propName].push(propValue)\n } else {\n if (propName !== 'a') currentNode[propName] = propValue\n else currentNode.a = propValue\n }\n\n this.setCurrentProp(currentNode, propName)\n\n // convert string to array, unless it ends in ',' in which case more will be added to it\n if (propName === 'a' && propValue.slice(-1) !== ',') {\n currentNode.a = parseNumberArray(propValue)\n }\n }\n\n parseNodePropertyContinued(line) {\n const currentNode = this.getCurrentNode()\n\n currentNode.a += line\n\n // if the line doesn't end in ',' we have reached the end of the property value\n // so convert the string to an array\n if (line.slice(-1) !== ',') {\n currentNode.a = parseNumberArray(currentNode.a)\n }\n }\n\n // parse \"Property70\"\n parseNodeSpecialProperty(line, propName, propValue) {\n // split this\n // P: \"Lcl Scaling\", \"Lcl Scaling\", \"\", \"A\",1,1,1\n // into array like below\n // [\"Lcl Scaling\", \"Lcl Scaling\", \"\", \"A\", \"1,1,1\" ]\n const props = propValue.split('\",').map(function (prop) {\n return prop.trim().replace(/^\\\"/, '').replace(/\\s/, '_')\n })\n\n const innerPropName = props[0]\n const innerPropType1 = props[1]\n const innerPropType2 = props[2]\n const innerPropFlag = props[3]\n let innerPropValue = props[4]\n\n // cast values where needed, otherwise leave as strings\n switch (innerPropType1) {\n case 'int':\n case 'enum':\n case 'bool':\n case 'ULongLong':\n case 'double':\n case 'Number':\n case 'FieldOfView':\n innerPropValue = parseFloat(innerPropValue)\n break\n\n case 'Color':\n case 'ColorRGB':\n case 'Vector3D':\n case 'Lcl_Translation':\n case 'Lcl_Rotation':\n case 'Lcl_Scaling':\n innerPropValue = parseNumberArray(innerPropValue)\n break\n }\n\n // CAUTION: these props must append to parent's parent\n this.getPrevNode()[innerPropName] = {\n type: innerPropType1,\n type2: innerPropType2,\n flag: innerPropFlag,\n value: innerPropValue,\n }\n\n this.setCurrentProp(this.getPrevNode(), innerPropName)\n }\n}\n\n// Parse an FBX file in Binary format\nclass BinaryParser {\n parse(buffer) {\n const reader = new BinaryReader(buffer)\n reader.skip(23) // skip magic 23 bytes\n\n const version = reader.getUint32()\n\n if (version < 6400) {\n throw new Error('THREE.FBXLoader: FBX version not supported, FileVersion: ' + version)\n }\n\n const allNodes = new FBXTree()\n\n while (!this.endOfContent(reader)) {\n const node = this.parseNode(reader, version)\n if (node !== null) allNodes.add(node.name, node)\n }\n\n return allNodes\n }\n\n // Check if reader has reached the end of content.\n endOfContent(reader) {\n // footer size: 160bytes + 16-byte alignment padding\n // - 16bytes: magic\n // - padding til 16-byte alignment (at least 1byte?)\n //\t(seems like some exporters embed fixed 15 or 16bytes?)\n // - 4bytes: magic\n // - 4bytes: version\n // - 120bytes: zero\n // - 16bytes: magic\n if (reader.size() % 16 === 0) {\n return ((reader.getOffset() + 160 + 16) & ~0xf) >= reader.size()\n } else {\n return reader.getOffset() + 160 + 16 >= reader.size()\n }\n }\n\n // recursively parse nodes until the end of the file is reached\n parseNode(reader, version) {\n const node = {}\n\n // The first three data sizes depends on version.\n const endOffset = version >= 7500 ? reader.getUint64() : reader.getUint32()\n const numProperties = version >= 7500 ? reader.getUint64() : reader.getUint32()\n\n version >= 7500 ? reader.getUint64() : reader.getUint32() // the returned propertyListLen is not used\n\n const nameLen = reader.getUint8()\n const name = reader.getString(nameLen)\n\n // Regards this node as NULL-record if endOffset is zero\n if (endOffset === 0) return null\n\n const propertyList = []\n\n for (let i = 0; i < numProperties; i++) {\n propertyList.push(this.parseProperty(reader))\n }\n\n // Regards the first three elements in propertyList as id, attrName, and attrType\n const id = propertyList.length > 0 ? propertyList[0] : ''\n const attrName = propertyList.length > 1 ? propertyList[1] : ''\n const attrType = propertyList.length > 2 ? propertyList[2] : ''\n\n // check if this node represents just a single property\n // like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]}\n node.singleProperty = numProperties === 1 && reader.getOffset() === endOffset ? true : false\n\n while (endOffset > reader.getOffset()) {\n const subNode = this.parseNode(reader, version)\n\n if (subNode !== null) this.parseSubNode(name, node, subNode)\n }\n\n node.propertyList = propertyList // raw property list used by parent\n\n if (typeof id === 'number') node.id = id\n if (attrName !== '') node.attrName = attrName\n if (attrType !== '') node.attrType = attrType\n if (name !== '') node.name = name\n\n return node\n }\n\n parseSubNode(name, node, subNode) {\n // special case: child node is single property\n if (subNode.singleProperty === true) {\n const value = subNode.propertyList[0]\n\n if (Array.isArray(value)) {\n node[subNode.name] = subNode\n\n subNode.a = value\n } else {\n node[subNode.name] = value\n }\n } else if (name === 'Connections' && subNode.name === 'C') {\n const array = []\n\n subNode.propertyList.forEach(function (property, i) {\n // first Connection is FBX type (OO, OP, etc.). We'll discard these\n if (i !== 0) array.push(property)\n })\n\n if (node.connections === undefined) {\n node.connections = []\n }\n\n node.connections.push(array)\n } else if (subNode.name === 'Properties70') {\n const keys = Object.keys(subNode)\n\n keys.forEach(function (key) {\n node[key] = subNode[key]\n })\n } else if (name === 'Properties70' && subNode.name === 'P') {\n let innerPropName = subNode.propertyList[0]\n let innerPropType1 = subNode.propertyList[1]\n const innerPropType2 = subNode.propertyList[2]\n const innerPropFlag = subNode.propertyList[3]\n let innerPropValue\n\n if (innerPropName.indexOf('Lcl ') === 0) innerPropName = innerPropName.replace('Lcl ', 'Lcl_')\n if (innerPropType1.indexOf('Lcl ') === 0) innerPropType1 = innerPropType1.replace('Lcl ', 'Lcl_')\n\n if (\n innerPropType1 === 'Color' ||\n innerPropType1 === 'ColorRGB' ||\n innerPropType1 === 'Vector' ||\n innerPropType1 === 'Vector3D' ||\n innerPropType1.indexOf('Lcl_') === 0\n ) {\n innerPropValue = [subNode.propertyList[4], subNode.propertyList[5], subNode.propertyList[6]]\n } else {\n innerPropValue = subNode.propertyList[4]\n }\n\n // this will be copied to parent, see above\n node[innerPropName] = {\n type: innerPropType1,\n type2: innerPropType2,\n flag: innerPropFlag,\n value: innerPropValue,\n }\n } else if (node[subNode.name] === undefined) {\n if (typeof subNode.id === 'number') {\n node[subNode.name] = {}\n node[subNode.name][subNode.id] = subNode\n } else {\n node[subNode.name] = subNode\n }\n } else {\n if (subNode.name === 'PoseNode') {\n if (!Array.isArray(node[subNode.name])) {\n node[subNode.name] = [node[subNode.name]]\n }\n\n node[subNode.name].push(subNode)\n } else if (node[subNode.name][subNode.id] === undefined) {\n node[subNode.name][subNode.id] = subNode\n }\n }\n }\n\n parseProperty(reader) {\n const type = reader.getString(1)\n let length\n\n switch (type) {\n case 'C':\n return reader.getBoolean()\n\n case 'D':\n return reader.getFloat64()\n\n case 'F':\n return reader.getFloat32()\n\n case 'I':\n return reader.getInt32()\n\n case 'L':\n return reader.getInt64()\n\n case 'R':\n length = reader.getUint32()\n return reader.getArrayBuffer(length)\n\n case 'S':\n length = reader.getUint32()\n return reader.getString(length)\n\n case 'Y':\n return reader.getInt16()\n\n case 'b':\n case 'c':\n case 'd':\n case 'f':\n case 'i':\n case 'l':\n const arrayLength = reader.getUint32()\n const encoding = reader.getUint32() // 0: non-compressed, 1: compressed\n const compressedLength = reader.getUint32()\n\n if (encoding === 0) {\n switch (type) {\n case 'b':\n case 'c':\n return reader.getBooleanArray(arrayLength)\n\n case 'd':\n return reader.getFloat64Array(arrayLength)\n\n case 'f':\n return reader.getFloat32Array(arrayLength)\n\n case 'i':\n return reader.getInt32Array(arrayLength)\n\n case 'l':\n return reader.getInt64Array(arrayLength)\n }\n }\n\n const data = unzlibSync(new Uint8Array(reader.getArrayBuffer(compressedLength)))\n const reader2 = new BinaryReader(data.buffer)\n\n switch (type) {\n case 'b':\n case 'c':\n return reader2.getBooleanArray(arrayLength)\n\n case 'd':\n return reader2.getFloat64Array(arrayLength)\n\n case 'f':\n return reader2.getFloat32Array(arrayLength)\n\n case 'i':\n return reader2.getInt32Array(arrayLength)\n\n case 'l':\n return reader2.getInt64Array(arrayLength)\n }\n\n default:\n throw new Error('THREE.FBXLoader: Unknown property type ' + type)\n }\n }\n}\n\nclass BinaryReader {\n constructor(buffer, littleEndian) {\n this.dv = new DataView(buffer)\n this.offset = 0\n this.littleEndian = littleEndian !== undefined ? littleEndian : true\n }\n\n getOffset() {\n return this.offset\n }\n\n size() {\n return this.dv.buffer.byteLength\n }\n\n skip(length) {\n this.offset += length\n }\n\n // seems like true/false representation depends on exporter.\n // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)\n // then sees LSB.\n getBoolean() {\n return (this.getUint8() & 1) === 1\n }\n\n getBooleanArray(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getBoolean())\n }\n\n return a\n }\n\n getUint8() {\n const value = this.dv.getUint8(this.offset)\n this.offset += 1\n return value\n }\n\n getInt16() {\n const value = this.dv.getInt16(this.offset, this.littleEndian)\n this.offset += 2\n return value\n }\n\n getInt32() {\n const value = this.dv.getInt32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n\n getInt32Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getInt32())\n }\n\n return a\n }\n\n getUint32() {\n const value = this.dv.getUint32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n\n // JavaScript doesn't support 64-bit integer so calculate this here\n // 1 << 32 will return 1 so using multiply operation instead here.\n // There's a possibility that this method returns wrong value if the value\n // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.\n // TODO: safely handle 64-bit integer\n getInt64() {\n let low, high\n\n if (this.littleEndian) {\n low = this.getUint32()\n high = this.getUint32()\n } else {\n high = this.getUint32()\n low = this.getUint32()\n }\n\n // calculate negative value\n if (high & 0x80000000) {\n high = ~high & 0xffffffff\n low = ~low & 0xffffffff\n\n if (low === 0xffffffff) high = (high + 1) & 0xffffffff\n\n low = (low + 1) & 0xffffffff\n\n return -(high * 0x100000000 + low)\n }\n\n return high * 0x100000000 + low\n }\n\n getInt64Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getInt64())\n }\n\n return a\n }\n\n // Note: see getInt64() comment\n getUint64() {\n let low, high\n\n if (this.littleEndian) {\n low = this.getUint32()\n high = this.getUint32()\n } else {\n high = this.getUint32()\n low = this.getUint32()\n }\n\n return high * 0x100000000 + low\n }\n\n getFloat32() {\n const value = this.dv.getFloat32(this.offset, this.littleEndian)\n this.offset += 4\n return value\n }\n\n getFloat32Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getFloat32())\n }\n\n return a\n }\n\n getFloat64() {\n const value = this.dv.getFloat64(this.offset, this.littleEndian)\n this.offset += 8\n return value\n }\n\n getFloat64Array(size) {\n const a = []\n\n for (let i = 0; i < size; i++) {\n a.push(this.getFloat64())\n }\n\n return a\n }\n\n getArrayBuffer(size) {\n const value = this.dv.buffer.slice(this.offset, this.offset + size)\n this.offset += size\n return value\n }\n\n getString(size) {\n // note: safari 9 doesn't support Uint8Array.indexOf; create intermediate array instead\n let a = []\n\n for (let i = 0; i < size; i++) {\n a[i] = this.getUint8()\n }\n\n const nullByte = a.indexOf(0)\n if (nullByte >= 0) a = a.slice(0, nullByte)\n\n return decodeText(new Uint8Array(a))\n }\n}\n\n// FBXTree holds a representation of the FBX data, returned by the TextParser ( FBX ASCII format)\n// and BinaryParser( FBX Binary format)\nclass FBXTree {\n add(key, val) {\n this[key] = val\n }\n}\n\n// ************** UTILITY FUNCTIONS **************\n\nfunction isFbxFormatBinary(buffer) {\n const CORRECT = 'Kaydara\\u0020FBX\\u0020Binary\\u0020\\u0020\\0'\n\n return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString(buffer, 0, CORRECT.length)\n}\n\nfunction isFbxFormatASCII(text) {\n const CORRECT = [\n 'K',\n 'a',\n 'y',\n 'd',\n 'a',\n 'r',\n 'a',\n '\\\\',\n 'F',\n 'B',\n 'X',\n '\\\\',\n 'B',\n 'i',\n 'n',\n 'a',\n 'r',\n 'y',\n '\\\\',\n '\\\\',\n ]\n\n let cursor = 0\n\n function read(offset) {\n const result = text[offset - 1]\n text = text.slice(cursor + offset)\n cursor++\n return result\n }\n\n for (let i = 0; i < CORRECT.length; ++i) {\n const num = read(1)\n if (num === CORRECT[i]) {\n return false\n }\n }\n\n return true\n}\n\nfunction getFbxVersion(text) {\n const versionRegExp = /FBXVersion: (\\d+)/\n const match = text.match(versionRegExp)\n\n if (match) {\n const version = parseInt(match[1])\n return version\n }\n\n throw new Error('THREE.FBXLoader: Cannot find the version number for the file given.')\n}\n\n// Converts FBX ticks into real time seconds.\nfunction convertFBXTimeToSeconds(time) {\n return time / 46186158000\n}\n\nconst dataArray = []\n\n// extracts the data from the correct position in the FBX array based on indexing type\nfunction getData(polygonVertexIndex, polygonIndex, vertexIndex, infoObject) {\n let index\n\n switch (infoObject.mappingType) {\n case 'ByPolygonVertex':\n index = polygonVertexIndex\n break\n case 'ByPolygon':\n index = polygonIndex\n break\n case 'ByVertice':\n index = vertexIndex\n break\n case 'AllSame':\n index = infoObject.indices[0]\n break\n default:\n console.warn('THREE.FBXLoader: unknown attribute mapping type ' + infoObject.mappingType)\n }\n\n if (infoObject.referenceType === 'IndexToDirect') index = infoObject.indices[index]\n\n const from = index * infoObject.dataSize\n const to = from + infoObject.dataSize\n\n return slice(dataArray, infoObject.buffer, from, to)\n}\n\nconst tempEuler = new Euler()\nconst tempVec = new Vector3()\n\n// generate transformation from FBX transform data\n// ref: https://help.autodesk.com/view/FBX/2017/ENU/?guid=__files_GUID_10CDD63C_79C1_4F2D_BB28_AD2BE65A02ED_htm\n// ref: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=cpp_ref/_transformations_2main_8cxx-example.html,topicNumber=cpp_ref__transformations_2main_8cxx_example_htmlfc10a1e1-b18d-4e72-9dc0-70d0f1959f5e\nfunction generateTransform(transformData) {\n const lTranslationM = new Matrix4()\n const lPreRotationM = new Matrix4()\n const lRotationM = new Matrix4()\n const lPostRotationM = new Matrix4()\n\n const lScalingM = new Matrix4()\n const lScalingPivotM = new Matrix4()\n const lScalingOffsetM = new Matrix4()\n const lRotationOffsetM = new Matrix4()\n const lRotationPivotM = new Matrix4()\n\n const lParentGX = new Matrix4()\n const lParentLX = new Matrix4()\n const lGlobalT = new Matrix4()\n\n const inheritType = transformData.inheritType ? transformData.inheritType : 0\n\n if (transformData.translation) lTranslationM.setPosition(tempVec.fromArray(transformData.translation))\n\n if (transformData.preRotation) {\n const array = transformData.preRotation.map(MathUtils.degToRad)\n array.push(transformData.eulerOrder)\n lPreRotationM.makeRotationFromEuler(tempEuler.fromArray(array))\n }\n\n if (transformData.rotation) {\n const array = transformData.rotation.map(MathUtils.degToRad)\n array.push(transformData.eulerOrder)\n lRotationM.makeRotationFromEuler(tempEuler.fromArray(array))\n }\n\n if (transformData.postRotation) {\n const array = transformData.postRotation.map(MathUtils.degToRad)\n array.push(transformData.eulerOrder)\n lPostRotationM.makeRotationFromEuler(tempEuler.fromArray(array))\n lPostRotationM.invert()\n }\n\n if (transformData.scale) lScalingM.scale(tempVec.fromArray(transformData.scale))\n\n // Pivots and offsets\n if (transformData.scalingOffset) lScalingOffsetM.setPosition(tempVec.fromArray(transformData.scalingOffset))\n if (transformData.scalingPivot) lScalingPivotM.setPosition(tempVec.fromArray(transformData.scalingPivot))\n if (transformData.rotationOffset) lRotationOffsetM.setPosition(tempVec.fromArray(transformData.rotationOffset))\n if (transformData.rotationPivot) lRotationPivotM.setPosition(tempVec.fromArray(transformData.rotationPivot))\n\n // parent transform\n if (transformData.parentMatrixWorld) {\n lParentLX.copy(transformData.parentMatrix)\n lParentGX.copy(transformData.parentMatrixWorld)\n }\n\n const lLRM = lPreRotationM.clone().multiply(lRotationM).multiply(lPostRotationM)\n // Global Rotation\n const lParentGRM = new Matrix4()\n lParentGRM.extractRotation(lParentGX)\n\n // Global Shear*Scaling\n const lParentTM = new Matrix4()\n lParentTM.copyPosition(lParentGX)\n\n const lParentGRSM = lParentTM.clone().invert().multiply(lParentGX)\n const lParentGSM = lParentGRM.clone().invert().multiply(lParentGRSM)\n const lLSM = lScalingM\n\n const lGlobalRS = new Matrix4()\n\n if (inheritType === 0) {\n lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM).multiply(lLSM)\n } else if (inheritType === 1) {\n lGlobalRS.copy(lParentGRM).multiply(lParentGSM).multiply(lLRM).multiply(lLSM)\n } else {\n const lParentLSM = new Matrix4().scale(new Vector3().setFromMatrixScale(lParentLX))\n const lParentLSM_inv = lParentLSM.clone().invert()\n const lParentGSM_noLocal = lParentGSM.clone().multiply(lParentLSM_inv)\n\n lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM_noLocal).multiply(lLSM)\n }\n\n const lRotationPivotM_inv = lRotationPivotM.clone().invert()\n const lScalingPivotM_inv = lScalingPivotM.clone().invert()\n // Calculate the local transform matrix\n let lTransform = lTranslationM\n .clone()\n .multiply(lRotationOffsetM)\n .multiply(lRotationPivotM)\n .multiply(lPreRotationM)\n .multiply(lRotationM)\n .multiply(lPostRotationM)\n .multiply(lRotationPivotM_inv)\n .multiply(lScalingOffsetM)\n .multiply(lScalingPivotM)\n .multiply(lScalingM)\n .multiply(lScalingPivotM_inv)\n\n const lLocalTWithAllPivotAndOffsetInfo = new Matrix4().copyPosition(lTransform)\n\n const lGlobalTranslation = lParentGX.clone().multiply(lLocalTWithAllPivotAndOffsetInfo)\n lGlobalT.copyPosition(lGlobalTranslation)\n\n lTransform = lGlobalT.clone().multiply(lGlobalRS)\n\n // from global to local\n lTransform.premultiply(lParentGX.invert())\n\n return lTransform\n}\n\n// Returns the three.js intrinsic Euler order corresponding to FBX extrinsic Euler order\n// ref: http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html\nfunction getEulerOrder(order) {\n order = order || 0\n\n const enums = [\n 'ZYX', // -> XYZ extrinsic\n 'YZX', // -> XZY extrinsic\n 'XZY', // -> YZX extrinsic\n 'ZXY', // -> YXZ extrinsic\n 'YXZ', // -> ZXY extrinsic\n 'XYZ', // -> ZYX extrinsic\n //'SphericXYZ', // not possible to support\n ]\n\n if (order === 6) {\n console.warn('THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.')\n return enums[0]\n }\n\n return enums[order]\n}\n\n// Parses comma separated list of numbers and returns them an array.\n// Used internally by the TextParser\nfunction parseNumberArray(value) {\n const array = value.split(',').map(function (val) {\n return parseFloat(val)\n })\n\n return array\n}\n\nfunction convertArrayBufferToString(buffer, from, to) {\n if (from === undefined) from = 0\n if (to === undefined) to = buffer.byteLength\n\n return decodeText(new Uint8Array(buffer, from, to))\n}\n\nfunction append(a, b) {\n for (let i = 0, j = a.length, l = b.length; i < l; i++, j++) {\n a[j] = b[i]\n }\n}\n\nfunction slice(a, b, from, to) {\n for (let i = from, j = 0; i < to; i++, j++) {\n a[j] = b[i]\n }\n\n return a\n}\n\n// inject array a2 into array a1 at index\nfunction inject(a1, index, a2) {\n return a1.slice(0, index).concat(a2).concat(a1.slice(index))\n}\n\nexport { FBXLoader }\n", "import { Loader, FileLoader, ShapePath } from 'three'\n\nimport type { LoadingManager, Shape } from 'three'\n\ntype Options = {\n lineHeight: number\n letterSpacing: number\n}\n\nexport class FontLoader extends Loader {\n constructor(manager?: LoadingManager) {\n super(manager)\n }\n\n public load(\n url: string,\n onLoad?: (responseFont: Font) => void,\n onProgress?: (event: ProgressEvent) => void,\n onError?: (event: ErrorEvent) => void,\n ): void {\n const loader = new FileLoader(this.manager)\n\n loader.setPath(this.path)\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n (response) => {\n if (typeof response !== 'string') throw new Error('unsupported data type')\n\n const json = JSON.parse(response)\n\n const font = this.parse(json)\n\n if (onLoad) onLoad(font)\n },\n onProgress,\n onError as (event: unknown) => void,\n )\n }\n\n loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise {\n // @ts-ignore\n return super.loadAsync(url, onProgress)\n }\n\n public parse(json: FontData): Font {\n return new Font(json)\n }\n}\n\ntype Glyph = {\n _cachedOutline: string[]\n ha: number\n o: string\n}\n\ntype FontData = {\n boundingBox: { yMax: number; yMin: number }\n familyName: string\n glyphs: { [k: string]: Glyph }\n resolution: number\n underlineThickness: number\n}\n\nexport class Font {\n public data: FontData\n public static isFont: true\n public static type: 'Font'\n\n constructor(data: FontData) {\n this.data = data\n }\n\n public generateShapes(text: string, size = 100, _options?: Partial): Shape[] {\n const shapes: Shape[] = []\n const options = { letterSpacing: 0, lineHeight: 1, ..._options }\n const paths = createPaths(text, size, this.data, options)\n for (let p = 0, pl = paths.length; p < pl; p++) {\n Array.prototype.push.apply(shapes, paths[p].toShapes(false))\n }\n return shapes\n }\n}\n\nfunction createPaths(text: string, size: number, data: FontData, options: Options): ShapePath[] {\n const chars = Array.from(text)\n const scale = size / data.resolution\n const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale\n\n const paths: ShapePath[] = []\n\n let offsetX = 0,\n offsetY = 0\n\n for (let i = 0; i < chars.length; i++) {\n const char = chars[i]\n\n if (char === '\\n') {\n offsetX = 0\n offsetY -= line_height * options.lineHeight\n } else {\n const ret = createPath(char, scale, offsetX, offsetY, data)\n if (ret) {\n offsetX += ret.offsetX + options.letterSpacing\n paths.push(ret.path)\n }\n }\n }\n\n return paths\n}\n\nfunction createPath(\n char: string,\n scale: number,\n offsetX: number,\n offsetY: number,\n data: FontData,\n): { offsetX: number; path: ShapePath } | undefined {\n const glyph = data.glyphs[char] || data.glyphs['?']\n\n if (!glyph) {\n console.error('THREE.Font: character \"' + char + '\" does not exists in font family ' + data.familyName + '.')\n return\n }\n\n const path = new ShapePath()\n\n let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2\n\n if (glyph.o) {\n const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' '))\n\n for (let i = 0, l = outline.length; i < l; ) {\n const action = outline[i++]\n\n switch (action) {\n case 'm': // moveTo\n x = parseInt(outline[i++]) * scale + offsetX\n y = parseInt(outline[i++]) * scale + offsetY\n\n path.moveTo(x, y)\n\n break\n\n case 'l': // lineTo\n x = parseInt(outline[i++]) * scale + offsetX\n y = parseInt(outline[i++]) * scale + offsetY\n\n path.lineTo(x, y)\n\n break\n\n case 'q': // quadraticCurveTo\n cpx = parseInt(outline[i++]) * scale + offsetX\n cpy = parseInt(outline[i++]) * scale + offsetY\n cpx1 = parseInt(outline[i++]) * scale + offsetX\n cpy1 = parseInt(outline[i++]) * scale + offsetY\n\n path.quadraticCurveTo(cpx1, cpy1, cpx, cpy)\n\n break\n\n case 'b': // bezierCurveTo\n cpx = parseInt(outline[i++]) * scale + offsetX\n cpy = parseInt(outline[i++]) * scale + offsetY\n cpx1 = parseInt(outline[i++]) * scale + offsetX\n cpy1 = parseInt(outline[i++]) * scale + offsetY\n cpx2 = parseInt(outline[i++]) * scale + offsetX\n cpy2 = parseInt(outline[i++]) * scale + offsetY\n\n path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy)\n\n break\n }\n }\n }\n\n return { offsetX: glyph.ha * scale, path }\n}\n", "import { Texture, ClampToEdgeWrapping, NearestFilter } from 'three'\n\nclass Data3DTexture extends Texture {\n constructor(data = null, width = 1, height = 1, depth = 1) {\n super(null)\n\n this.isData3DTexture = true\n\n this.image = { data, width, height, depth }\n\n this.magFilter = NearestFilter\n this.minFilter = NearestFilter\n\n this.wrapR = ClampToEdgeWrapping\n\n this.generateMipmaps = false\n this.flipY = false\n this.unpackAlignment = 1\n }\n}\n\nexport { Data3DTexture }\n", "import {\n AnimationClip,\n AnimationMixer,\n Bone,\n BufferGeometry,\n FileLoader,\n Float32BufferAttribute,\n FrontSide,\n Loader,\n LoaderUtils,\n Matrix4,\n Mesh,\n MeshPhongMaterial,\n Quaternion,\n Skeleton,\n SkinnedMesh,\n TextureLoader,\n Uint16BufferAttribute,\n Vector2,\n Vector3,\n} from 'three'\nimport { decodeText } from '../_polyfill/LoaderUtils'\n\nvar XLoader = (function () {\n var classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError('Cannot call a class as a function')\n }\n }\n\n var createClass = (function () {\n function defineProperties(target, props) {\n for (let i = 0; i < props.length; i++) {\n var descriptor = props[i]\n descriptor.enumerable = descriptor.enumerable || false\n descriptor.configurable = true\n if ('value' in descriptor) descriptor.writable = true\n Object.defineProperty(target, descriptor.key, descriptor)\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps)\n if (staticProps) defineProperties(Constructor, staticProps)\n return Constructor\n }\n })()\n\n var XboneInf = function XboneInf() {\n classCallCheck(this, XboneInf)\n\n this.boneName = ''\n this.BoneIndex = 0\n this.Indeces = []\n this.Weights = []\n this.initMatrix = null\n this.OffsetMatrix = null\n }\n\n var XAnimationInfo = function XAnimationInfo() {\n classCallCheck(this, XAnimationInfo)\n\n this.animeName = ''\n this.boneName = ''\n this.targetBone = null\n this.keyType = 4\n this.frameStartLv = 0\n this.keyFrames = []\n this.InverseMx = null\n }\n\n var XAnimationObj = (function () {\n function XAnimationObj(_flags) {\n classCallCheck(this, XAnimationObj)\n\n this.fps = 30\n this.name = 'xanimation'\n this.length = 0\n this.hierarchy = []\n this.putFlags = _flags\n if (this.putFlags.putPos === undefined) {\n this.putFlags.putPos = true\n }\n\n if (this.putFlags.putRot === undefined) {\n this.putFlags.putRot = true\n }\n\n if (this.putFlags.putScl === undefined) {\n this.putFlags.putScl = true\n }\n }\n\n createClass(XAnimationObj, [\n {\n key: 'make',\n value: function make(XAnimationInfoArray) {\n for (let i = 0; i < XAnimationInfoArray.length; i++) {\n this.hierarchy.push(this.makeBonekeys(XAnimationInfoArray[i]))\n }\n\n this.length = this.hierarchy[0].keys[this.hierarchy[0].keys.length - 1].time\n },\n },\n {\n key: 'clone',\n value: function clone() {\n return Object.assign({}, this)\n },\n },\n {\n key: 'makeBonekeys',\n value: function makeBonekeys(XAnimationInfo) {\n var refObj = {}\n refObj.name = XAnimationInfo.boneName\n refObj.parent = ''\n refObj.keys = this.keyFrameRefactor(XAnimationInfo)\n refObj.copy = function () {\n return Object.assign({}, this)\n }\n\n return refObj\n },\n },\n {\n key: 'keyFrameRefactor',\n value: function keyFrameRefactor(XAnimationInfo) {\n var keys = []\n for (let i = 0; i < XAnimationInfo.keyFrames.length; i++) {\n var keyframe = {}\n keyframe.time = XAnimationInfo.keyFrames[i].time * this.fps\n if (XAnimationInfo.keyFrames[i].pos && this.putFlags.putPos) {\n keyframe.pos = XAnimationInfo.keyFrames[i].pos\n }\n\n if (XAnimationInfo.keyFrames[i].rot && this.putFlags.putRot) {\n keyframe.rot = XAnimationInfo.keyFrames[i].rot\n }\n\n if (XAnimationInfo.keyFrames[i].scl && this.putFlags.putScl) {\n keyframe.scl = XAnimationInfo.keyFrames[i].scl\n }\n\n if (XAnimationInfo.keyFrames[i].matrix) {\n keyframe.matrix = XAnimationInfo.keyFrames[i].matrix\n if (this.putFlags.putPos) {\n keyframe.pos = new Vector3().setFromMatrixPosition(keyframe.matrix)\n }\n\n if (this.putFlags.putRot) {\n keyframe.rot = new Quaternion().setFromRotationMatrix(keyframe.matrix)\n }\n\n if (this.putFlags.putScl) {\n keyframe.scl = new Vector3().setFromMatrixScale(keyframe.matrix)\n }\n }\n\n keys.push(keyframe)\n }\n\n return keys\n },\n },\n ])\n return XAnimationObj\n })()\n\n var XKeyFrameInfo = function XKeyFrameInfo() {\n classCallCheck(this, XKeyFrameInfo)\n\n this.index = 0\n this.Frame = 0\n this.time = 0.0\n this.matrix = null\n }\n\n var XLoader = (function () {\n function XLoader(manager) {\n Loader.call(this, manager)\n\n classCallCheck(this, XLoader)\n\n this.debug = false\n this.texloader = new TextureLoader(this.manager)\n this.url = ''\n this._putMatLength = 0\n this._nowMat = null\n this._nowFrameName = ''\n this.frameHierarchie = []\n this.Hierarchies = {}\n this.HieStack = []\n this._currentObject = {}\n this._currentFrame = {}\n this._data = null\n this.onLoad = null\n this.IsUvYReverse = true\n this.Meshes = []\n this.animations = []\n this.animTicksPerSecond = 30\n this._currentGeo = null\n this._currentAnime = null\n this._currentAnimeFrames = null\n }\n\n createClass(XLoader, [\n {\n key: '_setArgOption',\n value: function _setArgOption(_arg) {\n var _start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0\n\n if (!_arg) {\n return\n }\n\n for (let i = _start; i < _arg.length; i++) {\n switch (i) {\n case 0:\n this.url = _arg[i]\n break\n case 1:\n this.options = _arg[i]\n break\n }\n }\n\n if (this.options === undefined) {\n this.options = {}\n }\n },\n },\n {\n key: 'load',\n value: function load(_arg, onLoad, onProgress, onError) {\n var _this = this\n\n this._setArgOption(_arg)\n var loader = new 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(\n this.url,\n function (response) {\n try {\n _this.parse(response, onLoad)\n } catch (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n _this.manager.itemError(_this.url)\n }\n },\n onProgress,\n onError,\n )\n },\n },\n {\n key: '_readLine',\n value: function _readLine(line) {\n var readed = 0\n while (true) {\n var find = -1\n find = line.indexOf('//', readed)\n if (find === -1) {\n find = line.indexOf('#', readed)\n }\n\n if (find > -1 && find < 2) {\n var foundNewLine = -1\n foundNewLine = line.indexOf('\\r\\n', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 2\n } else {\n foundNewLine = line.indexOf('\\r', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 1\n } else {\n readed = line.indexOf('\\n', readed) + 1\n }\n }\n } else {\n break\n }\n }\n\n return line.substr(readed)\n },\n },\n {\n key: '_readLine',\n value: function _readLine(line) {\n var readed = 0\n while (true) {\n var find = -1\n find = line.indexOf('//', readed)\n if (find === -1) {\n find = line.indexOf('#', readed)\n }\n\n if (find > -1 && find < 2) {\n var foundNewLine = -1\n foundNewLine = line.indexOf('\\r\\n', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 2\n } else {\n foundNewLine = line.indexOf('\\r', readed)\n if (foundNewLine > 0) {\n readed = foundNewLine + 1\n } else {\n readed = line.indexOf('\\n', readed) + 1\n }\n }\n } else {\n break\n }\n }\n\n return line.substr(readed)\n },\n },\n {\n key: '_isBinary',\n value: function _isBinary(binData) {\n var reader = new DataView(binData)\n var face_size = (32 / 8) * 3 + (32 / 8) * 3 * 3 + 16 / 8\n var n_faces = reader.getUint32(80, true)\n var expect = 80 + 32 / 8 + n_faces * face_size\n if (expect === reader.byteLength) {\n return true\n }\n\n var fileLength = reader.byteLength\n for (let index = 0; index < fileLength; index++) {\n if (reader.getUint8(index, false) > 127) {\n return true\n }\n }\n\n return false\n },\n },\n {\n key: '_ensureBinary',\n value: function _ensureBinary(buf) {\n if (typeof buf === 'string') {\n var array_buffer = new Uint8Array(buf.length)\n for (let i = 0; i < buf.length; i++) {\n array_buffer[i] = buf.charCodeAt(i) & 0xff\n }\n\n return array_buffer.buffer || array_buffer\n } else {\n return buf\n }\n },\n },\n {\n key: '_ensureString',\n value: function _ensureString(buf) {\n if (typeof buf !== 'string') {\n return decodeText(new Uint8Array(buf))\n } else {\n return buf\n }\n },\n },\n {\n key: 'parse',\n value: function _parse(data, onLoad) {\n var binData = this._ensureBinary(data)\n this._data = this._ensureString(data)\n this.onLoad = onLoad\n return this._isBinary(binData) ? this._parseBinary(binData) : this._parseASCII()\n },\n },\n {\n key: '_parseBinary',\n value: function _parseBinary(data) {\n return this._parseASCII(decodeText(new Uint8Array(data)))\n },\n },\n {\n key: '_parseASCII',\n value: function _parseASCII() {\n var path\n\n if (this.resourcePath !== '') {\n path = this.resourcePath\n } else if (this.path !== '') {\n path = this.path\n } else {\n path = LoaderUtils.extractUrlBase(this.url)\n }\n\n this.texloader.setPath(path).setCrossOrigin(this.crossOrigin)\n\n var endRead = 16\n this.Hierarchies.children = []\n this._hierarchieParse(this.Hierarchies, endRead)\n this._changeRoot()\n this._currentObject = this.Hierarchies.children.shift()\n this._mainloop()\n },\n },\n {\n key: '_hierarchieParse',\n value: function _hierarchieParse(_parent, _end) {\n var endRead = _end\n while (true) {\n var find1 = this._data.indexOf('{', endRead) + 1\n var findEnd = this._data.indexOf('}', endRead)\n var findNext = this._data.indexOf('{', find1) + 1\n if (find1 > 0 && findEnd > find1) {\n var _currentObject = {}\n _currentObject.children = []\n var nameData = this._readLine(this._data.substr(endRead, find1 - endRead - 1)).trim()\n var word = nameData.split(/ /g)\n if (word.length > 0) {\n _currentObject.type = word[0]\n if (word.length >= 2) {\n _currentObject.name = word[1]\n } else {\n _currentObject.name = word[0] + this.Hierarchies.children.length\n }\n } else {\n _currentObject.name = nameData\n _currentObject.type = ''\n }\n\n if (_currentObject.type === 'Animation') {\n _currentObject.data = this._data.substr(findNext, findEnd - findNext).trim()\n var refs = this._hierarchieParse(_currentObject, findEnd + 1)\n endRead = refs.end\n _currentObject.children = refs.parent.children\n } else {\n var DataEnder = this._data.lastIndexOf(';', findNext > 0 ? Math.min(findNext, findEnd) : findEnd)\n _currentObject.data = this._data.substr(find1, DataEnder - find1).trim()\n if (findNext <= 0 || findEnd < findNext) {\n endRead = findEnd + 1\n } else {\n var nextStart = Math.max(DataEnder + 1, find1)\n var _refs = this._hierarchieParse(_currentObject, nextStart)\n endRead = _refs.end\n _currentObject.children = _refs.parent.children\n }\n }\n\n _currentObject.parent = _parent\n if (_currentObject.type != 'template') {\n _parent.children.push(_currentObject)\n }\n } else {\n endRead = find1 === -1 ? this._data.length : findEnd + 1\n break\n }\n }\n\n return {\n parent: _parent,\n end: endRead,\n }\n },\n },\n {\n key: '_mainloop',\n value: function _mainloop() {\n var _this2 = this\n\n this._mainProc()\n if (this._currentObject.parent || this._currentObject.children.length > 0 || !this._currentObject.worked) {\n setTimeout(function () {\n _this2._mainloop()\n }, 1)\n } else {\n setTimeout(function () {\n _this2.onLoad({\n models: _this2.Meshes,\n animations: _this2.animations,\n })\n }, 1)\n }\n },\n },\n {\n key: '_mainProc',\n value: function _mainProc() {\n var breakFlag = false\n while (true) {\n if (!this._currentObject.worked) {\n switch (this._currentObject.type) {\n case 'template':\n break\n case 'AnimTicksPerSecond':\n this.animTicksPerSecond = parseInt(this._currentObject.data)\n break\n case 'Frame':\n this._setFrame()\n break\n case 'FrameTransformMatrix':\n this._setFrameTransformMatrix()\n break\n case 'Mesh':\n this._changeRoot()\n this._currentGeo = {}\n this._currentGeo.name = this._currentObject.name.trim()\n this._currentGeo.parentName = this._getParentName(this._currentObject).trim()\n this._currentGeo.VertexSetedBoneCount = []\n this._currentGeo.GeometryData = {\n vertices: [],\n normals: [],\n uvs: [],\n skinIndices: [],\n skinWeights: [],\n indices: [],\n materialIndices: [],\n }\n this._currentGeo.Materials = []\n this._currentGeo.normalVectors = []\n this._currentGeo.BoneInfs = []\n this._currentGeo.baseFrame = this._currentFrame\n this._makeBoneFrom_CurrentFrame()\n this._readVertexDatas()\n breakFlag = true\n break\n case 'MeshNormals':\n this._readVertexDatas()\n break\n case 'MeshTextureCoords':\n this._setMeshTextureCoords()\n break\n case 'VertexDuplicationIndices':\n break\n case 'MeshMaterialList':\n this._setMeshMaterialList()\n break\n case 'Material':\n this._setMaterial()\n break\n case 'SkinWeights':\n this._setSkinWeights()\n break\n case 'AnimationSet':\n this._changeRoot()\n this._currentAnime = {}\n this._currentAnime.name = this._currentObject.name.trim()\n this._currentAnime.AnimeFrames = []\n break\n case 'Animation':\n if (this._currentAnimeFrames) {\n this._currentAnime.AnimeFrames.push(this._currentAnimeFrames)\n }\n\n this._currentAnimeFrames = new XAnimationInfo()\n this._currentAnimeFrames.boneName = this._currentObject.data.trim()\n break\n case 'AnimationKey':\n this._readAnimationKey()\n breakFlag = true\n break\n }\n\n this._currentObject.worked = true\n }\n\n if (this._currentObject.children.length > 0) {\n this._currentObject = this._currentObject.children.shift()\n if (this.debug) {\n console.log('processing ' + this._currentObject.name)\n }\n\n if (breakFlag) break\n } else {\n if (this._currentObject.worked) {\n if (this._currentObject.parent && !this._currentObject.parent.parent) {\n this._changeRoot()\n }\n }\n\n if (this._currentObject.parent) {\n this._currentObject = this._currentObject.parent\n } else {\n breakFlag = true\n }\n\n if (breakFlag) break\n }\n }\n\n return\n },\n },\n {\n key: '_changeRoot',\n value: function _changeRoot() {\n if (this._currentGeo != null && this._currentGeo.name) {\n this._makeOutputGeometry()\n }\n\n this._currentGeo = {}\n if (this._currentAnime != null && this._currentAnime.name) {\n if (this._currentAnimeFrames) {\n this._currentAnime.AnimeFrames.push(this._currentAnimeFrames)\n this._currentAnimeFrames = null\n }\n\n this._makeOutputAnimation()\n }\n\n this._currentAnime = {}\n },\n },\n {\n key: '_getParentName',\n value: function _getParentName(_obj) {\n if (_obj.parent) {\n if (_obj.parent.name) {\n return _obj.parent.name\n } else {\n return this._getParentName(_obj.parent)\n }\n } else {\n return ''\n }\n },\n },\n {\n key: '_setFrame',\n value: function _setFrame() {\n this._nowFrameName = this._currentObject.name.trim()\n this._currentFrame = {}\n this._currentFrame.name = this._nowFrameName\n this._currentFrame.children = []\n if (this._currentObject.parent && this._currentObject.parent.name) {\n this._currentFrame.parentName = this._currentObject.parent.name\n }\n\n this.frameHierarchie.push(this._nowFrameName)\n this.HieStack[this._nowFrameName] = this._currentFrame\n },\n },\n {\n key: '_setFrameTransformMatrix',\n value: function _setFrameTransformMatrix() {\n this._currentFrame.FrameTransformMatrix = new Matrix4()\n var data = this._currentObject.data.split(',')\n this._ParseMatrixData(this._currentFrame.FrameTransformMatrix, data)\n this._makeBoneFrom_CurrentFrame()\n },\n },\n {\n key: '_makeBoneFrom_CurrentFrame',\n value: function _makeBoneFrom_CurrentFrame() {\n if (!this._currentFrame.FrameTransformMatrix) {\n return\n }\n\n var b = new Bone()\n b.name = this._currentFrame.name\n b.applyMatrix4(this._currentFrame.FrameTransformMatrix)\n b.matrixWorld = b.matrix\n b.FrameTransformMatrix = this._currentFrame.FrameTransformMatrix\n this._currentFrame.putBone = b\n if (this._currentFrame.parentName) {\n for (let frame in this.HieStack) {\n if (this.HieStack[frame].name === this._currentFrame.parentName) {\n this.HieStack[frame].putBone.add(this._currentFrame.putBone)\n }\n }\n }\n },\n },\n {\n key: '_readVertexDatas',\n value: function _readVertexDatas() {\n var endRead = 0\n var mode = 0\n var mode_local = 0\n var maxLength = 0\n while (true) {\n var changeMode = false\n if (mode_local === 0) {\n var refO = this._readInt1(endRead)\n endRead = refO.endRead\n mode_local = 1\n maxLength = this._currentObject.data.indexOf(';;', endRead) + 1\n if (maxLength <= 0) {\n maxLength = this._currentObject.data.length\n }\n } else {\n var find = 0\n switch (mode) {\n case 0:\n find = this._currentObject.data.indexOf(',', endRead) + 1\n break\n case 1:\n find = this._currentObject.data.indexOf(';,', endRead) + 1\n break\n }\n\n if (find === 0 || find > maxLength) {\n find = maxLength\n mode_local = 0\n changeMode = true\n }\n\n switch (this._currentObject.type) {\n case 'Mesh':\n switch (mode) {\n case 0:\n this._readVertex1(this._currentObject.data.substr(endRead, find - endRead))\n break\n case 1:\n this._readFace1(this._currentObject.data.substr(endRead, find - endRead))\n break\n }\n\n break\n case 'MeshNormals':\n switch (mode) {\n case 0:\n this._readNormalVector1(this._currentObject.data.substr(endRead, find - endRead))\n break\n }\n\n break\n }\n\n endRead = find + 1\n if (changeMode) {\n mode++\n }\n }\n\n if (endRead >= this._currentObject.data.length) {\n break\n }\n }\n },\n },\n {\n key: '_readInt1',\n value: function _readInt1(start) {\n var find = this._currentObject.data.indexOf(';', start)\n return {\n refI: parseInt(this._currentObject.data.substr(start, find - start)),\n endRead: find + 1,\n }\n },\n },\n {\n key: '_readVertex1',\n value: function _readVertex1(line) {\n var data = this._readLine(line.trim())\n .substr(0, line.length - 2)\n .split(';')\n this._currentGeo.GeometryData.vertices.push(parseFloat(data[0]), parseFloat(data[1]), parseFloat(data[2]))\n this._currentGeo.GeometryData.skinIndices.push(0, 0, 0, 0)\n this._currentGeo.GeometryData.skinWeights.push(1, 0, 0, 0)\n this._currentGeo.VertexSetedBoneCount.push(0)\n },\n },\n {\n key: '_readFace1',\n value: function _readFace1(line) {\n var data = this._readLine(line.trim())\n .substr(2, line.length - 4)\n .split(',')\n this._currentGeo.GeometryData.indices.push(\n parseInt(data[0], 10),\n parseInt(data[1], 10),\n parseInt(data[2], 10),\n )\n },\n },\n {\n key: '_readNormalVector1',\n value: function _readNormalVector1(line) {\n var data = this._readLine(line.trim())\n .substr(0, line.length - 2)\n .split(';')\n this._currentGeo.GeometryData.normals.push(parseFloat(data[0]), parseFloat(data[1]), parseFloat(data[2]))\n },\n },\n {\n key: '_buildGeometry',\n value: function _buildGeometry() {\n var bufferGeometry = new BufferGeometry()\n var position = []\n var normals = []\n var uvs = []\n var skinIndices = []\n var skinWeights = []\n\n //\n\n var data = this._currentGeo.GeometryData\n\n for (let i = 0, l = data.indices.length; i < l; i++) {\n var stride2 = data.indices[i] * 2\n var stride3 = data.indices[i] * 3\n var stride4 = data.indices[i] * 4\n\n position.push(data.vertices[stride3], data.vertices[stride3 + 1], data.vertices[stride3 + 2])\n normals.push(data.normals[stride3], data.normals[stride3 + 1], data.normals[stride3 + 2])\n skinIndices.push(\n data.skinIndices[stride4],\n data.skinIndices[stride4 + 1],\n data.skinIndices[stride4 + 2],\n data.skinIndices[stride4 + 3],\n )\n skinWeights.push(\n data.skinWeights[stride4],\n data.skinWeights[stride4 + 1],\n data.skinWeights[stride4 + 2],\n data.skinWeights[stride4 + 3],\n )\n uvs.push(data.uvs[stride2], data.uvs[stride2 + 1])\n }\n\n //\n\n bufferGeometry.setAttribute('position', new Float32BufferAttribute(position, 3))\n bufferGeometry.setAttribute('normal', new Float32BufferAttribute(normals, 3))\n bufferGeometry.setAttribute('uv', new Float32BufferAttribute(uvs, 2))\n bufferGeometry.setAttribute('skinIndex', new Uint16BufferAttribute(skinIndices, 4))\n bufferGeometry.setAttribute('skinWeight', new Float32BufferAttribute(skinWeights, 4))\n\n this._computeGroups(bufferGeometry, data.materialIndices)\n\n return bufferGeometry\n },\n },\n {\n key: '_computeGroups',\n value: function _computeGroups(bufferGeometry, materialIndices) {\n var group\n var groups = []\n var materialIndex = undefined\n\n for (let i = 0; i < materialIndices.length; i++) {\n var currentMaterialIndex = materialIndices[i]\n\n if (currentMaterialIndex !== materialIndex) {\n materialIndex = currentMaterialIndex\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n group = {\n start: i * 3,\n materialIndex: materialIndex,\n }\n }\n }\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n bufferGeometry.groups = groups\n },\n },\n {\n key: '_setMeshTextureCoords',\n value: function _setMeshTextureCoords() {\n var endRead = 0\n var mode = 0\n var mode_local = 0\n while (true) {\n switch (mode) {\n case 0:\n if (mode_local === 0) {\n var refO = this._readInt1(0)\n endRead = refO.endRead\n mode_local = 1\n } else {\n var find = this._currentObject.data.indexOf(',', endRead) + 1\n if (find === 0) {\n find = this._currentObject.data.length\n mode = 2\n mode_local = 0\n }\n\n var line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(';')\n if (this.IsUvYReverse) {\n this._currentGeo.GeometryData.uvs.push(parseFloat(data[0]), 1 - parseFloat(data[1]))\n } else {\n this._currentGeo.GeometryData.uvs.push(parseFloat(data[0]), parseFloat(data[1]))\n }\n\n endRead = find + 1\n }\n\n break\n }\n\n if (endRead >= this._currentObject.data.length) {\n break\n }\n }\n },\n },\n {\n key: '_setMeshMaterialList',\n value: function _setMeshMaterialList() {\n var endRead = 0\n var mode = 0\n var mode_local = 0\n while (true) {\n if (mode_local < 2) {\n var refO = this._readInt1(endRead)\n endRead = refO.endRead\n mode_local++\n } else {\n var find = this._currentObject.data.indexOf(';', endRead)\n if (find === -1) {\n find = this._currentObject.data.length\n mode = 3\n mode_local = 0\n }\n\n var line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(',')\n for (let i = 0; i < data.length; i++) {\n this._currentGeo.GeometryData.materialIndices[i] = parseInt(data[i])\n }\n\n endRead = this._currentObject.data.length\n }\n\n if (endRead >= this._currentObject.data.length || mode >= 3) {\n break\n }\n }\n },\n },\n {\n key: '_setMaterial',\n value: function _setMaterial() {\n var _nowMat = new MeshPhongMaterial({\n color: Math.random() * 0xffffff,\n })\n _nowMat.side = FrontSide\n _nowMat.name = this._currentObject.name\n var endRead = 0\n var find = this._currentObject.data.indexOf(';;', endRead)\n var line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(';')\n _nowMat.color.r = parseFloat(data[0])\n _nowMat.color.g = parseFloat(data[1])\n _nowMat.color.b = parseFloat(data[2])\n endRead = find + 2\n find = this._currentObject.data.indexOf(';', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n _nowMat.shininess = parseFloat(this._readLine(line))\n endRead = find + 1\n find = this._currentObject.data.indexOf(';;', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data2 = this._readLine(line.trim()).split(';')\n _nowMat.specular.r = parseFloat(data2[0])\n _nowMat.specular.g = parseFloat(data2[1])\n _nowMat.specular.b = parseFloat(data2[2])\n endRead = find + 2\n find = this._currentObject.data.indexOf(';;', endRead)\n if (find === -1) {\n find = this._currentObject.data.length\n }\n\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data3 = this._readLine(line.trim()).split(';')\n _nowMat.emissive.r = parseFloat(data3[0])\n _nowMat.emissive.g = parseFloat(data3[1])\n _nowMat.emissive.b = parseFloat(data3[2])\n var localObject = null\n while (true) {\n if (this._currentObject.children.length > 0) {\n localObject = this._currentObject.children.shift()\n if (this.debug) {\n console.log('processing ' + localObject.name)\n }\n\n var fileName = localObject.data.substr(1, localObject.data.length - 2)\n switch (localObject.type) {\n case 'TextureFilename':\n _nowMat.map = this.texloader.load(fileName)\n break\n case 'BumpMapFilename':\n _nowMat.bumpMap = this.texloader.load(fileName)\n _nowMat.bumpScale = 0.05\n break\n case 'NormalMapFilename':\n _nowMat.normalMap = this.texloader.load(fileName)\n _nowMat.normalScale = new Vector2(2, 2)\n break\n case 'EmissiveMapFilename':\n _nowMat.emissiveMap = this.texloader.load(fileName)\n break\n case 'LightMapFilename':\n _nowMat.lightMap = this.texloader.load(fileName)\n break\n }\n } else {\n break\n }\n }\n\n this._currentGeo.Materials.push(_nowMat)\n },\n },\n {\n key: '_setSkinWeights',\n value: function _setSkinWeights() {\n var boneInf = new XboneInf()\n var endRead = 0\n var find = this._currentObject.data.indexOf(';', endRead)\n var line = this._currentObject.data.substr(endRead, find - endRead)\n endRead = find + 1\n boneInf.boneName = line.substr(1, line.length - 2)\n boneInf.BoneIndex = this._currentGeo.BoneInfs.length\n find = this._currentObject.data.indexOf(';', endRead)\n endRead = find + 1\n find = this._currentObject.data.indexOf(';', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data = this._readLine(line.trim()).split(',')\n for (let i = 0; i < data.length; i++) {\n boneInf.Indeces.push(parseInt(data[i]))\n }\n\n endRead = find + 1\n find = this._currentObject.data.indexOf(';', endRead)\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data2 = this._readLine(line.trim()).split(',')\n for (let _i = 0; _i < data2.length; _i++) {\n boneInf.Weights.push(parseFloat(data2[_i]))\n }\n\n endRead = find + 1\n find = this._currentObject.data.indexOf(';', endRead)\n if (find <= 0) {\n find = this._currentObject.data.length\n }\n\n line = this._currentObject.data.substr(endRead, find - endRead)\n var data3 = this._readLine(line.trim()).split(',')\n boneInf.OffsetMatrix = new Matrix4()\n this._ParseMatrixData(boneInf.OffsetMatrix, data3)\n this._currentGeo.BoneInfs.push(boneInf)\n },\n },\n {\n key: '_makePutBoneList',\n value: function _makePutBoneList(_RootName, _bones) {\n var putting = false\n for (let frame in this.HieStack) {\n if (this.HieStack[frame].name === _RootName || putting) {\n putting = true\n var b = new Bone()\n b.name = this.HieStack[frame].name\n b.applyMatrix4(this.HieStack[frame].FrameTransformMatrix)\n b.matrixWorld = b.matrix\n b.FrameTransformMatrix = this.HieStack[frame].FrameTransformMatrix\n b.pos = new Vector3().setFromMatrixPosition(b.FrameTransformMatrix).toArray()\n b.rotq = new Quaternion().setFromRotationMatrix(b.FrameTransformMatrix).toArray()\n b.scl = new Vector3().setFromMatrixScale(b.FrameTransformMatrix).toArray()\n if (this.HieStack[frame].parentName && this.HieStack[frame].parentName.length > 0) {\n for (let i = 0; i < _bones.length; i++) {\n if (this.HieStack[frame].parentName === _bones[i].name) {\n _bones[i].add(b)\n b.parent = i\n break\n }\n }\n }\n\n _bones.push(b)\n }\n }\n },\n },\n {\n key: '_makeOutputGeometry',\n value: function _makeOutputGeometry() {\n var mesh = null\n if (this._currentGeo.BoneInfs.length > 0) {\n var putBones = []\n this._makePutBoneList(this._currentGeo.baseFrame.parentName, putBones)\n for (let bi = 0; bi < this._currentGeo.BoneInfs.length; bi++) {\n var boneIndex = 0\n for (let bb = 0; bb < putBones.length; bb++) {\n if (putBones[bb].name === this._currentGeo.BoneInfs[bi].boneName) {\n boneIndex = bb\n putBones[bb].OffsetMatrix = new Matrix4()\n putBones[bb].OffsetMatrix.copy(this._currentGeo.BoneInfs[bi].OffsetMatrix)\n break\n }\n }\n\n for (let vi = 0; vi < this._currentGeo.BoneInfs[bi].Indeces.length; vi++) {\n var nowVertexID = this._currentGeo.BoneInfs[bi].Indeces[vi]\n var nowVal = this._currentGeo.BoneInfs[bi].Weights[vi]\n\n var stride = nowVertexID * 4\n\n switch (this._currentGeo.VertexSetedBoneCount[nowVertexID]) {\n case 0:\n this._currentGeo.GeometryData.skinIndices[stride] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride] = nowVal\n break\n case 1:\n this._currentGeo.GeometryData.skinIndices[stride + 1] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride + 1] = nowVal\n break\n case 2:\n this._currentGeo.GeometryData.skinIndices[stride + 2] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride + 2] = nowVal\n break\n case 3:\n this._currentGeo.GeometryData.skinIndices[stride + 3] = boneIndex\n this._currentGeo.GeometryData.skinWeights[stride + 3] = nowVal\n break\n }\n\n this._currentGeo.VertexSetedBoneCount[nowVertexID]++\n if (this._currentGeo.VertexSetedBoneCount[nowVertexID] > 4) {\n console.log('warn! over 4 bone weight! :' + nowVertexID)\n }\n }\n }\n\n for (let sk = 0; sk < this._currentGeo.Materials.length; sk++) {\n this._currentGeo.Materials[sk].skinning = true\n }\n\n var offsetList = []\n for (let _bi = 0; _bi < putBones.length; _bi++) {\n if (putBones[_bi].OffsetMatrix) {\n offsetList.push(putBones[_bi].OffsetMatrix)\n } else {\n offsetList.push(new Matrix4())\n }\n }\n\n var bufferGeometry = this._buildGeometry()\n mesh = new SkinnedMesh(\n bufferGeometry,\n this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[0] : this._currentGeo.Materials,\n )\n\n this._initSkeleton(mesh, putBones, offsetList)\n } else {\n var _bufferGeometry = this._buildGeometry()\n mesh = new Mesh(\n _bufferGeometry,\n this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[0] : this._currentGeo.Materials,\n )\n }\n\n mesh.name = this._currentGeo.name\n var worldBaseMx = new Matrix4()\n var currentMxFrame = this._currentGeo.baseFrame.putBone\n if (currentMxFrame && currentMxFrame.parent) {\n while (true) {\n currentMxFrame = currentMxFrame.parent\n if (currentMxFrame) {\n worldBaseMx.multiply(currentMxFrame.FrameTransformMatrix)\n } else {\n break\n }\n }\n\n mesh.applyMatrix4(worldBaseMx)\n }\n\n this.Meshes.push(mesh)\n },\n },\n {\n key: '_initSkeleton',\n value: function _initSkeleton(mesh, boneList, boneInverses) {\n var bones = [],\n bone,\n gbone\n var i, il\n\n for (i = 0, il = boneList.length; i < il; i++) {\n gbone = boneList[i]\n\n bone = new Bone()\n bones.push(bone)\n\n bone.name = gbone.name\n bone.position.fromArray(gbone.pos)\n bone.quaternion.fromArray(gbone.rotq)\n if (gbone.scl !== undefined) bone.scale.fromArray(gbone.scl)\n }\n\n for (i = 0, il = boneList.length; i < il; i++) {\n gbone = boneList[i]\n\n if (gbone.parent !== -1 && gbone.parent !== null && bones[gbone.parent] !== undefined) {\n bones[gbone.parent].add(bones[i])\n } else {\n mesh.add(bones[i])\n }\n }\n\n mesh.updateMatrixWorld(true)\n\n var skeleton = new Skeleton(bones, boneInverses)\n mesh.bind(skeleton, mesh.matrixWorld)\n },\n },\n {\n key: '_readAnimationKey',\n value: function _readAnimationKey() {\n var endRead = 0\n var find = this._currentObject.data.indexOf(';', endRead)\n var line = this._currentObject.data.substr(endRead, find - endRead)\n endRead = find + 1\n var nowKeyType = parseInt(this._readLine(line))\n find = this._currentObject.data.indexOf(';', endRead)\n endRead = find + 1\n line = this._currentObject.data.substr(endRead)\n var data = this._readLine(line.trim()).split(';;,')\n for (let i = 0; i < data.length; i++) {\n var data2 = data[i].split(';')\n var keyInfo = new XKeyFrameInfo()\n keyInfo.type = nowKeyType\n keyInfo.Frame = parseInt(data2[0])\n keyInfo.index = this._currentAnimeFrames.keyFrames.length\n keyInfo.time = keyInfo.Frame\n if (nowKeyType != 4) {\n var frameFound = false\n for (let mm = 0; mm < this._currentAnimeFrames.keyFrames.length; mm++) {\n if (this._currentAnimeFrames.keyFrames[mm].Frame === keyInfo.Frame) {\n keyInfo = this._currentAnimeFrames.keyFrames[mm]\n frameFound = true\n break\n }\n }\n\n var frameValue = data2[2].split(',')\n switch (nowKeyType) {\n case 0:\n keyInfo.rot = new Quaternion(\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2]),\n parseFloat(frameValue[3]),\n parseFloat(frameValue[0]) * -1,\n )\n break\n case 1:\n keyInfo.scl = new Vector3(\n parseFloat(frameValue[0]),\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2]),\n )\n break\n case 2:\n keyInfo.pos = new Vector3(\n parseFloat(frameValue[0]),\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2]),\n )\n break\n }\n\n if (!frameFound) {\n this._currentAnimeFrames.keyFrames.push(keyInfo)\n }\n } else {\n keyInfo.matrix = new Matrix4()\n this._ParseMatrixData(keyInfo.matrix, data2[2].split(','))\n this._currentAnimeFrames.keyFrames.push(keyInfo)\n }\n }\n },\n },\n {\n key: '_makeOutputAnimation',\n value: function _makeOutputAnimation() {\n var animationObj = new XAnimationObj(this.options)\n animationObj.fps = this.animTicksPerSecond\n animationObj.name = this._currentAnime.name\n animationObj.make(this._currentAnime.AnimeFrames)\n this.animations.push(animationObj)\n },\n },\n {\n key: 'assignAnimation',\n value: function assignAnimation(_model, _animation) {\n var model = _model\n var animation = _animation\n if (!model) {\n model = this.Meshes[0]\n }\n\n if (!animation) {\n animation = this.animations[0]\n }\n\n if (!model || !animation) {\n return null\n }\n\n var put = {}\n put.fps = animation.fps\n put.name = animation.name\n put.length = animation.length\n put.hierarchy = []\n for (let b = 0; b < model.skeleton.bones.length; b++) {\n var findAnimation = false\n for (let i = 0; i < animation.hierarchy.length; i++) {\n if (model.skeleton.bones[b].name === animation.hierarchy[i].name) {\n findAnimation = true\n var c_key = animation.hierarchy[i].copy()\n c_key.parent = -1\n if (model.skeleton.bones[b].parent && model.skeleton.bones[b].parent.type === 'Bone') {\n for (let bb = 0; bb < put.hierarchy.length; bb++) {\n if (put.hierarchy[bb].name === model.skeleton.bones[b].parent.name) {\n c_key.parent = bb\n c_key.parentName = model.skeleton.bones[b].parent.name\n }\n }\n }\n\n put.hierarchy.push(c_key)\n break\n }\n }\n\n if (!findAnimation) {\n var _c_key = animation.hierarchy[0].copy()\n _c_key.name = model.skeleton.bones[b].name\n _c_key.parent = -1\n for (let k = 0; k < _c_key.keys.length; k++) {\n if (_c_key.keys[k].pos) {\n _c_key.keys[k].pos.set(0, 0, 0)\n }\n\n if (_c_key.keys[k].scl) {\n _c_key.keys[k].scl.set(1, 1, 1)\n }\n\n if (_c_key.keys[k].rot) {\n _c_key.keys[k].rot.set(0, 0, 0, 1)\n }\n }\n\n put.hierarchy.push(_c_key)\n }\n }\n\n if (!model.geometry.animations) {\n model.geometry.animations = []\n }\n\n model.geometry.animations.push(AnimationClip.parseAnimation(put, model.skeleton.bones))\n if (!model.animationMixer) {\n model.animationMixer = new AnimationMixer(model)\n }\n\n return put\n },\n },\n {\n key: '_ParseMatrixData',\n value: function _ParseMatrixData(targetMatrix, data) {\n targetMatrix.set(\n parseFloat(data[0]),\n parseFloat(data[4]),\n parseFloat(data[8]),\n parseFloat(data[12]),\n parseFloat(data[1]),\n parseFloat(data[5]),\n parseFloat(data[9]),\n parseFloat(data[13]),\n parseFloat(data[2]),\n parseFloat(data[6]),\n parseFloat(data[10]),\n parseFloat(data[14]),\n parseFloat(data[3]),\n parseFloat(data[7]),\n parseFloat(data[11]),\n parseFloat(data[15]),\n )\n },\n },\n ])\n return XLoader\n })()\n\n return XLoader\n})()\n\nexport { XLoader }\n", "const { CstParser, Lexer, createToken } = (() => {\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = typeof global == 'object' && global && global.Object === Object && global\n\n const freeGlobal$1 = freeGlobal\n\n /** Detect free variable `self`. */\n var freeSelf = typeof self == 'object' && self && self.Object === Object && self\n\n /** Used as a reference to the global object. */\n var root = freeGlobal$1 || freeSelf || Function('return this')()\n\n const root$1 = root\n\n /** Built-in value references. */\n var Symbol$1 = root$1.Symbol\n\n const Symbol$2 = Symbol$1\n\n /** Used for built-in method references. */\n var objectProto$j = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$g = objectProto$j.hasOwnProperty\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString$1 = objectProto$j.toString\n\n /** Built-in value references. */\n var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined\n\n /**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\n function getRawTag(value) {\n var isOwn = hasOwnProperty$g.call(value, symToStringTag$1),\n tag = value[symToStringTag$1]\n\n try {\n value[symToStringTag$1] = undefined\n var unmasked = true\n } catch (e) {}\n\n var result = nativeObjectToString$1.call(value)\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag$1] = tag\n } else {\n delete value[symToStringTag$1]\n }\n }\n return result\n }\n\n /** Used for built-in method references. */\n var objectProto$i = Object.prototype\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString = objectProto$i.toString\n\n /**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\n function objectToString(value) {\n return nativeObjectToString.call(value)\n }\n\n /** `Object#toString` result references. */\n var nullTag = '[object Null]',\n undefinedTag = '[object Undefined]'\n\n /** Built-in value references. */\n var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined\n\n /**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n function baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag\n }\n return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value)\n }\n\n /**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\n function isObjectLike(value) {\n return value != null && typeof value == 'object'\n }\n\n /** `Object#toString` result references. */\n var symbolTag$3 = '[object Symbol]'\n\n /**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\n function isSymbol(value) {\n return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag$3)\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length)\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array)\n }\n return result\n }\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\n var isArray = Array.isArray\n\n const isArray$1 = isArray\n\n /** Used as references for various `Number` constants. */\n var INFINITY$3 = 1 / 0\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : undefined,\n symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined\n\n /**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value\n }\n if (isArray$1(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + ''\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : ''\n }\n var result = value + ''\n return result == '0' && 1 / value == -INFINITY$3 ? '-0' : result\n }\n\n /** Used to match a single whitespace character. */\n var reWhitespace = /\\s/\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\n function trimmedEndIndex(string) {\n var index = string.length\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index\n }\n\n /** Used to match leading whitespace. */\n var reTrimStart = /^\\s+/\n\n /**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\n function baseTrim(string) {\n return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string\n }\n\n /**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\n function isObject(value) {\n var type = typeof value\n return value != null && (type == 'object' || type == 'function')\n }\n\n /** Used as references for various `Number` constants. */\n var NAN = 0 / 0\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseInt = parseInt\n\n /**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\n function toNumber(value) {\n if (typeof value == 'number') {\n return value\n }\n if (isSymbol(value)) {\n return NAN\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value\n value = isObject(other) ? other + '' : other\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value\n }\n value = baseTrim(value)\n var isBinary = reIsBinary.test(value)\n return isBinary || reIsOctal.test(value)\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : reIsBadHex.test(value)\n ? NAN\n : +value\n }\n\n /** Used as references for various `Number` constants. */\n var INFINITY$2 = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e308\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0\n }\n value = toNumber(value)\n if (value === INFINITY$2 || value === -INFINITY$2) {\n var sign = value < 0 ? -1 : 1\n return sign * MAX_INTEGER\n }\n return value === value ? value : 0\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1\n\n return result === result ? (remainder ? result - remainder : result) : 0\n }\n\n /**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\n function identity(value) {\n return value\n }\n\n /** `Object#toString` result references. */\n var asyncTag = '[object AsyncFunction]',\n funcTag$2 = '[object Function]',\n genTag$1 = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]'\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n if (!isObject(value)) {\n return false\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value)\n return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag\n }\n\n /** Used to detect overreaching core-js shims. */\n var coreJsData = root$1['__core-js_shared__']\n\n const coreJsData$1 = coreJsData\n\n /** Used to detect methods masquerading as native. */\n var maskSrcKey = (function () {\n var uid = /[^.]+$/.exec((coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO) || '')\n return uid ? 'Symbol(src)_1.' + uid : ''\n })()\n\n /**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\n function isMasked(func) {\n return !!maskSrcKey && maskSrcKey in func\n }\n\n /** Used for built-in method references. */\n var funcProto$1 = Function.prototype\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString$1 = funcProto$1.toString\n\n /**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\n function toSource(func) {\n if (func != null) {\n try {\n return funcToString$1.call(func)\n } catch (e) {}\n try {\n return func + ''\n } catch (e) {}\n }\n return ''\n }\n\n /**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\n var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g\n\n /** Used to detect host constructors (Safari). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/\n\n /** Used for built-in method references. */\n var funcProto = Function.prototype,\n objectProto$h = Object.prototype\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString = funcProto.toString\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$f = objectProto$h.hasOwnProperty\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp(\n '^' +\n funcToString\n .call(hasOwnProperty$f)\n .replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') +\n '$',\n )\n\n /**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\n function baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor\n return pattern.test(toSource(value))\n }\n\n /**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function getValue(object, key) {\n return object == null ? undefined : object[key]\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = getValue(object, key)\n return baseIsNative(value) ? value : undefined\n }\n\n /* Built-in method references that are verified to be native. */\n var WeakMap = getNative(root$1, 'WeakMap')\n\n const WeakMap$1 = WeakMap\n\n /** Built-in value references. */\n var objectCreate = Object.create\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function () {\n function object() {}\n return function (proto) {\n if (!isObject(proto)) {\n return {}\n }\n if (objectCreate) {\n return objectCreate(proto)\n }\n object.prototype = proto\n var result = new object()\n object.prototype = undefined\n return result\n }\n })()\n\n const baseCreate$1 = baseCreate\n\n /**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\n function apply(func, thisArg, args) {\n switch (args.length) {\n case 0:\n return func.call(thisArg)\n case 1:\n return func.call(thisArg, args[0])\n case 2:\n return func.call(thisArg, args[0], args[1])\n case 3:\n return func.call(thisArg, args[0], args[1], args[2])\n }\n return func.apply(thisArg, args)\n }\n\n /**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\n function noop() {\n // No operation performed.\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function copyArray(source, array) {\n var index = -1,\n length = source.length\n\n array || (array = Array(length))\n while (++index < length) {\n array[index] = source[index]\n }\n return array\n }\n\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\n var HOT_COUNT = 800,\n HOT_SPAN = 16\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeNow = Date.now\n\n /**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\n function shortOut(func) {\n var count = 0,\n lastCalled = 0\n\n return function () {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled)\n\n lastCalled = stamp\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0]\n }\n } else {\n count = 0\n }\n return func.apply(undefined, arguments)\n }\n }\n\n /**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\n function constant(value) {\n return function () {\n return value\n }\n }\n\n var defineProperty = (function () {\n try {\n var func = getNative(Object, 'defineProperty')\n func({}, '', {})\n return func\n } catch (e) {}\n })()\n\n const defineProperty$1 = defineProperty\n\n /**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var baseSetToString = !defineProperty$1\n ? identity\n : function (func, string) {\n return defineProperty$1(func, 'toString', {\n configurable: true,\n enumerable: false,\n value: constant(string),\n writable: true,\n })\n }\n\n const baseSetToString$1 = baseSetToString\n\n /**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var setToString = shortOut(baseSetToString$1)\n\n const setToString$1 = setToString\n\n /**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break\n }\n }\n return array\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1)\n\n while (fromRight ? index-- : ++index < length) {\n if (predicate(array[index], index, array)) {\n return index\n }\n }\n return -1\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value\n }\n\n /**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length\n\n while (++index < length) {\n if (array[index] === value) {\n return index\n }\n }\n return -1\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex)\n }\n\n /**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length\n return !!length && baseIndexOf(array, value, 0) > -1\n }\n\n /** Used as references for various `Number` constants. */\n var MAX_SAFE_INTEGER$1 = 9007199254740991\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^(?:0|[1-9]\\d*)$/\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n var type = typeof value\n length = length == null ? MAX_SAFE_INTEGER$1 : length\n\n return (\n !!length &&\n (type == 'number' || (type != 'symbol' && reIsUint.test(value))) &&\n value > -1 &&\n value % 1 == 0 &&\n value < length\n )\n }\n\n /**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty$1) {\n defineProperty$1(object, key, {\n configurable: true,\n enumerable: true,\n value: value,\n writable: true,\n })\n } else {\n object[key] = value\n }\n }\n\n /**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other)\n }\n\n /** Used for built-in method references. */\n var objectProto$g = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$e = objectProto$g.hasOwnProperty\n\n /**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignValue(object, key, value) {\n var objValue = object[key]\n if (!(hasOwnProperty$e.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value)\n }\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\n function copyObject(source, props, object, customizer) {\n var isNew = !object\n object || (object = {})\n\n var index = -1,\n length = props.length\n\n while (++index < length) {\n var key = props[index]\n\n var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined\n\n if (newValue === undefined) {\n newValue = source[key]\n }\n if (isNew) {\n baseAssignValue(object, key, newValue)\n } else {\n assignValue(object, key, newValue)\n }\n }\n return object\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax$3 = Math.max\n\n /**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\n function overRest(func, start, transform) {\n start = nativeMax$3(start === undefined ? func.length - 1 : start, 0)\n return function () {\n var args = arguments,\n index = -1,\n length = nativeMax$3(args.length - start, 0),\n array = Array(length)\n\n while (++index < length) {\n array[index] = args[start + index]\n }\n index = -1\n var otherArgs = Array(start + 1)\n while (++index < start) {\n otherArgs[index] = args[index]\n }\n otherArgs[start] = transform(array)\n return apply(func, this, otherArgs)\n }\n }\n\n /**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\n function baseRest(func, start) {\n return setToString$1(overRest(func, start, identity), func + '')\n }\n\n /** Used as references for various `Number` constants. */\n var MAX_SAFE_INTEGER = 9007199254740991\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\n function isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER\n }\n\n /**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\n function isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value)\n }\n\n /**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false\n }\n var type = typeof index\n if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) {\n return eq(object[index], value)\n }\n return false\n }\n\n /**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return baseRest(function (object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined\n\n customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer\n length = 1\n }\n object = Object(object)\n while (++index < length) {\n var source = sources[index]\n if (source) {\n assigner(object, source, index, customizer)\n }\n }\n return object\n })\n }\n\n /** Used for built-in method references. */\n var objectProto$f = Object.prototype\n\n /**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\n function isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$f\n\n return value === proto\n }\n\n /**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\n function baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n)\n\n while (++index < n) {\n result[index] = iteratee(index)\n }\n return result\n }\n\n /** `Object#toString` result references. */\n var argsTag$3 = '[object Arguments]'\n\n /**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\n function baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag$3\n }\n\n /** Used for built-in method references. */\n var objectProto$e = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$d = objectProto$e.hasOwnProperty\n\n /** Built-in value references. */\n var propertyIsEnumerable$1 = objectProto$e.propertyIsEnumerable\n\n /**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n var isArguments = baseIsArguments(\n (function () {\n return arguments\n })(),\n )\n ? baseIsArguments\n : function (value) {\n return (\n isObjectLike(value) && hasOwnProperty$d.call(value, 'callee') && !propertyIsEnumerable$1.call(value, 'callee')\n )\n }\n\n const isArguments$1 = isArguments\n\n /**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\n function stubFalse() {\n return false\n }\n\n /** Detect free variable `exports`. */\n var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports\n\n /** Detect free variable `module`. */\n var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2\n\n /** Built-in value references. */\n var Buffer$1 = moduleExports$2 ? root$1.Buffer : undefined\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined\n\n /**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\n var isBuffer = nativeIsBuffer || stubFalse\n\n const isBuffer$1 = isBuffer\n\n /** `Object#toString` result references. */\n var argsTag$2 = '[object Arguments]',\n arrayTag$2 = '[object Array]',\n boolTag$3 = '[object Boolean]',\n dateTag$3 = '[object Date]',\n errorTag$2 = '[object Error]',\n funcTag$1 = '[object Function]',\n mapTag$6 = '[object Map]',\n numberTag$3 = '[object Number]',\n objectTag$3 = '[object Object]',\n regexpTag$4 = '[object RegExp]',\n setTag$6 = '[object Set]',\n stringTag$4 = '[object String]',\n weakMapTag$2 = '[object WeakMap]'\n\n var arrayBufferTag$3 = '[object ArrayBuffer]',\n dataViewTag$4 = '[object DataView]',\n float32Tag$2 = '[object Float32Array]',\n float64Tag$2 = '[object Float64Array]',\n int8Tag$2 = '[object Int8Array]',\n int16Tag$2 = '[object Int16Array]',\n int32Tag$2 = '[object Int32Array]',\n uint8Tag$2 = '[object Uint8Array]',\n uint8ClampedTag$2 = '[object Uint8ClampedArray]',\n uint16Tag$2 = '[object Uint16Array]',\n uint32Tag$2 = '[object Uint32Array]'\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {}\n typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[\n int16Tag$2\n ] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[\n uint16Tag$2\n ] = typedArrayTags[uint32Tag$2] = true\n typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[\n boolTag$3\n ] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[\n funcTag$1\n ] = typedArrayTags[mapTag$6] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[\n regexpTag$4\n ] = typedArrayTags[setTag$6] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$2] = false\n\n /**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\n function baseIsTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]\n }\n\n /**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\n function baseUnary(func) {\n return function (value) {\n return func(value)\n }\n }\n\n /** Detect free variable `exports`. */\n var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports\n\n /** Detect free variable `module`. */\n var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1\n\n /** Detect free variable `process` from Node.js. */\n var freeProcess = moduleExports$1 && freeGlobal$1.process\n\n /** Used to access faster Node.js helpers. */\n var nodeUtil = (function () {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types\n\n if (types) {\n return types\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util')\n } catch (e) {}\n })()\n\n const nodeUtil$1 = nodeUtil\n\n /* Node.js helper references. */\n var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray\n\n const isTypedArray$1 = isTypedArray\n\n /** Used for built-in method references. */\n var objectProto$d = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$c = objectProto$d.hasOwnProperty\n\n /**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\n function arrayLikeKeys(value, inherited) {\n var isArr = isArray$1(value),\n isArg = !isArr && isArguments$1(value),\n isBuff = !isArr && !isArg && isBuffer$1(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length\n\n for (var key in value) {\n if (\n (inherited || hasOwnProperty$c.call(value, key)) &&\n !(\n skipIndexes &&\n // Safari 9 has enumerable `arguments.length` in strict mode.\n (key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length))\n )\n ) {\n result.push(key)\n }\n }\n return result\n }\n\n /**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\n function overArg(func, transform) {\n return function (arg) {\n return func(transform(arg))\n }\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeKeys = overArg(Object.keys, Object)\n\n const nativeKeys$1 = nativeKeys\n\n /** Used for built-in method references. */\n var objectProto$c = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$b = objectProto$c.hasOwnProperty\n\n /**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys$1(object)\n }\n var result = []\n for (var key in Object(object)) {\n if (hasOwnProperty$b.call(object, key) && key != 'constructor') {\n result.push(key)\n }\n }\n return result\n }\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n function keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object)\n }\n\n /** Used for built-in method references. */\n var objectProto$b = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$a = objectProto$b.hasOwnProperty\n\n /**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\n var assign = createAssigner(function (object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object)\n return\n }\n for (var key in source) {\n if (hasOwnProperty$a.call(source, key)) {\n assignValue(object, key, source[key])\n }\n }\n })\n\n const assign$1 = assign\n\n /**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function nativeKeysIn(object) {\n var result = []\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key)\n }\n }\n return result\n }\n\n /** Used for built-in method references. */\n var objectProto$a = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$9 = objectProto$a.hasOwnProperty\n\n /**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object)\n }\n var isProto = isPrototype(object),\n result = []\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {\n result.push(key)\n }\n }\n return result\n }\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object)\n }\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n if (isArray$1(value)) {\n return false\n }\n var type = typeof value\n if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {\n return true\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))\n }\n\n /* Built-in method references that are verified to be native. */\n var nativeCreate = getNative(Object, 'create')\n\n const nativeCreate$1 = nativeCreate\n\n /**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\n function hashClear() {\n this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {}\n this.size = 0\n }\n\n /**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key]\n this.size -= result ? 1 : 0\n return result\n }\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'\n\n /** Used for built-in method references. */\n var objectProto$9 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$8 = objectProto$9.hasOwnProperty\n\n /**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function hashGet(key) {\n var data = this.__data__\n if (nativeCreate$1) {\n var result = data[key]\n return result === HASH_UNDEFINED$2 ? undefined : result\n }\n return hasOwnProperty$8.call(data, key) ? data[key] : undefined\n }\n\n /** Used for built-in method references. */\n var objectProto$8 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$7 = objectProto$8.hasOwnProperty\n\n /**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function hashHas(key) {\n var data = this.__data__\n return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty$7.call(data, key)\n }\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'\n\n /**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\n function hashSet(key, value) {\n var data = this.__data__\n this.size += this.has(key) ? 0 : 1\n data[key] = nativeCreate$1 && value === undefined ? HASH_UNDEFINED$1 : value\n return this\n }\n\n /**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length\n\n this.clear()\n while (++index < length) {\n var entry = entries[index]\n this.set(entry[0], entry[1])\n }\n }\n\n // Add methods to `Hash`.\n Hash.prototype.clear = hashClear\n Hash.prototype['delete'] = hashDelete\n Hash.prototype.get = hashGet\n Hash.prototype.has = hashHas\n Hash.prototype.set = hashSet\n\n /**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\n function listCacheClear() {\n this.__data__ = []\n this.size = 0\n }\n\n /**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function assocIndexOf(array, key) {\n var length = array.length\n while (length--) {\n if (eq(array[length][0], key)) {\n return length\n }\n }\n return -1\n }\n\n /** Used for built-in method references. */\n var arrayProto = Array.prototype\n\n /** Built-in value references. */\n var splice = arrayProto.splice\n\n /**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key)\n\n if (index < 0) {\n return false\n }\n var lastIndex = data.length - 1\n if (index == lastIndex) {\n data.pop()\n } else {\n splice.call(data, index, 1)\n }\n --this.size\n return true\n }\n\n /**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key)\n\n return index < 0 ? undefined : data[index][1]\n }\n\n /**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1\n }\n\n /**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\n function listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key)\n\n if (index < 0) {\n ++this.size\n data.push([key, value])\n } else {\n data[index][1] = value\n }\n return this\n }\n\n /**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length\n\n this.clear()\n while (++index < length) {\n var entry = entries[index]\n this.set(entry[0], entry[1])\n }\n }\n\n // Add methods to `ListCache`.\n ListCache.prototype.clear = listCacheClear\n ListCache.prototype['delete'] = listCacheDelete\n ListCache.prototype.get = listCacheGet\n ListCache.prototype.has = listCacheHas\n ListCache.prototype.set = listCacheSet\n\n /* Built-in method references that are verified to be native. */\n var Map$1 = getNative(root$1, 'Map')\n\n const Map$2 = Map$1\n\n /**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\n function mapCacheClear() {\n this.size = 0\n this.__data__ = {\n hash: new Hash(),\n map: new (Map$2 || ListCache)(),\n string: new Hash(),\n }\n }\n\n /**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\n function isKeyable(value) {\n var type = typeof value\n return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean'\n ? value !== '__proto__'\n : value === null\n }\n\n /**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\n function getMapData(map, key) {\n var data = map.__data__\n return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map\n }\n\n /**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key)\n this.size -= result ? 1 : 0\n return result\n }\n\n /**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function mapCacheGet(key) {\n return getMapData(this, key).get(key)\n }\n\n /**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapCacheHas(key) {\n return getMapData(this, key).has(key)\n }\n\n /**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\n function mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size\n\n data.set(key, value)\n this.size += data.size == size ? 0 : 1\n return this\n }\n\n /**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length\n\n this.clear()\n while (++index < length) {\n var entry = entries[index]\n this.set(entry[0], entry[1])\n }\n }\n\n // Add methods to `MapCache`.\n MapCache.prototype.clear = mapCacheClear\n MapCache.prototype['delete'] = mapCacheDelete\n MapCache.prototype.get = mapCacheGet\n MapCache.prototype.has = mapCacheHas\n MapCache.prototype.set = mapCacheSet\n\n /** Error message constants. */\n var FUNC_ERROR_TEXT$1 = 'Expected a function'\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT$1)\n }\n var memoized = function () {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache\n\n if (cache.has(key)) {\n return cache.get(key)\n }\n var result = func.apply(this, args)\n memoized.cache = cache.set(key, result) || cache\n return result\n }\n memoized.cache = new (memoize.Cache || MapCache)()\n return memoized\n }\n\n // Expose `MapCache`.\n memoize.Cache = MapCache\n\n /** Used as the maximum memoize cache size. */\n var MAX_MEMOIZE_SIZE = 500\n\n /**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\n function memoizeCapped(func) {\n var result = memoize(func, function (key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear()\n }\n return key\n })\n\n var cache = result.cache\n return result\n }\n\n /** Used to match property names within property paths. */\n var rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g\n\n /**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\n var stringToPath = memoizeCapped(function (string) {\n var result = []\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('')\n }\n string.replace(rePropName, function (match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : number || match)\n })\n return result\n })\n\n const stringToPath$1 = stringToPath\n\n /**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\n function toString(value) {\n return value == null ? '' : baseToString(value)\n }\n\n /**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\n function castPath(value, object) {\n if (isArray$1(value)) {\n return value\n }\n return isKey(value, object) ? [value] : stringToPath$1(toString(value))\n }\n\n /** Used as references for various `Number` constants. */\n var INFINITY$1 = 1 / 0\n\n /**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\n function toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value\n }\n var result = value + ''\n return result == '0' && 1 / value == -INFINITY$1 ? '-0' : result\n }\n\n /**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path) {\n path = castPath(path, object)\n\n var index = 0,\n length = path.length\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])]\n }\n return index && index == length ? object : undefined\n }\n\n /**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path)\n return result === undefined ? defaultValue : result\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length\n\n while (++index < length) {\n array[offset + index] = values[index]\n }\n return array\n }\n\n /** Built-in value references. */\n var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : undefined\n\n /**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\n function isFlattenable(value) {\n return isArray$1(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol])\n }\n\n /**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length\n\n predicate || (predicate = isFlattenable)\n result || (result = [])\n\n while (++index < length) {\n var value = array[index]\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result)\n } else {\n arrayPush(result, value)\n }\n } else if (!isStrict) {\n result[result.length] = value\n }\n }\n return result\n }\n\n /**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\n function flatten(array) {\n var length = array == null ? 0 : array.length\n return length ? baseFlatten(array, 1) : []\n }\n\n /** Built-in value references. */\n var getPrototype = overArg(Object.getPrototypeOf, Object)\n\n const getPrototype$1 = getPrototype\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length\n\n if (start < 0) {\n start = -start > length ? 0 : length + start\n }\n end = end > length ? length : end\n if (end < 0) {\n end += length\n }\n length = start > end ? 0 : (end - start) >>> 0\n start >>>= 0\n\n var result = Array(length)\n while (++index < length) {\n result[index] = array[index + start]\n }\n return result\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n if (initAccum && length) {\n accumulator = array[++index]\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array)\n }\n return accumulator\n }\n\n /**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\n function stackClear() {\n this.__data__ = new ListCache()\n this.size = 0\n }\n\n /**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key)\n\n this.size = data.size\n return result\n }\n\n /**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function stackGet(key) {\n return this.__data__.get(key)\n }\n\n /**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function stackHas(key) {\n return this.__data__.has(key)\n }\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE$2 = 200\n\n /**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\n function stackSet(key, value) {\n var data = this.__data__\n if (data instanceof ListCache) {\n var pairs = data.__data__\n if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {\n pairs.push([key, value])\n this.size = ++data.size\n return this\n }\n data = this.__data__ = new MapCache(pairs)\n }\n data.set(key, value)\n this.size = data.size\n return this\n }\n\n /**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Stack(entries) {\n var data = (this.__data__ = new ListCache(entries))\n this.size = data.size\n }\n\n // Add methods to `Stack`.\n Stack.prototype.clear = stackClear\n Stack.prototype['delete'] = stackDelete\n Stack.prototype.get = stackGet\n Stack.prototype.has = stackHas\n Stack.prototype.set = stackSet\n\n /**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return object && copyObject(source, keys(source), object)\n }\n\n /**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object)\n }\n\n /** Detect free variable `exports`. */\n var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports\n\n /** Detect free variable `module`. */\n var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports\n\n /** Built-in value references. */\n var Buffer = moduleExports ? root$1.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined\n\n /**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\n function cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice()\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length)\n\n buffer.copy(result)\n return result\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = []\n\n while (++index < length) {\n var value = array[index]\n if (predicate(value, index, array)) {\n result[resIndex++] = value\n }\n }\n return result\n }\n\n /**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\n function stubArray() {\n return []\n }\n\n /** Used for built-in method references. */\n var objectProto$7 = Object.prototype\n\n /** Built-in value references. */\n var propertyIsEnumerable = objectProto$7.propertyIsEnumerable\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeGetSymbols$1 = Object.getOwnPropertySymbols\n\n /**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbols = !nativeGetSymbols$1\n ? stubArray\n : function (object) {\n if (object == null) {\n return []\n }\n object = Object(object)\n return arrayFilter(nativeGetSymbols$1(object), function (symbol) {\n return propertyIsEnumerable.call(object, symbol)\n })\n }\n\n const getSymbols$1 = getSymbols\n\n /**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbols(source, object) {\n return copyObject(source, getSymbols$1(source), object)\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeGetSymbols = Object.getOwnPropertySymbols\n\n /**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbolsIn = !nativeGetSymbols\n ? stubArray\n : function (object) {\n var result = []\n while (object) {\n arrayPush(result, getSymbols$1(object))\n object = getPrototype$1(object)\n }\n return result\n }\n\n const getSymbolsIn$1 = getSymbolsIn\n\n /**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn$1(source), object)\n }\n\n /**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object)\n return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object))\n }\n\n /**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols$1)\n }\n\n /**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn$1)\n }\n\n /* Built-in method references that are verified to be native. */\n var DataView = getNative(root$1, 'DataView')\n\n const DataView$1 = DataView\n\n /* Built-in method references that are verified to be native. */\n var Promise$1 = getNative(root$1, 'Promise')\n\n const Promise$2 = Promise$1\n\n /* Built-in method references that are verified to be native. */\n var Set = getNative(root$1, 'Set')\n\n const Set$1 = Set\n\n /** `Object#toString` result references. */\n var mapTag$5 = '[object Map]',\n objectTag$2 = '[object Object]',\n promiseTag = '[object Promise]',\n setTag$5 = '[object Set]',\n weakMapTag$1 = '[object WeakMap]'\n\n var dataViewTag$3 = '[object DataView]'\n\n /** Used to detect maps, sets, and weakmaps. */\n var dataViewCtorString = toSource(DataView$1),\n mapCtorString = toSource(Map$2),\n promiseCtorString = toSource(Promise$2),\n setCtorString = toSource(Set$1),\n weakMapCtorString = toSource(WeakMap$1)\n\n /**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n var getTag = baseGetTag\n\n // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\n if (\n (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3) ||\n (Map$2 && getTag(new Map$2()) != mapTag$5) ||\n (Promise$2 && getTag(Promise$2.resolve()) != promiseTag) ||\n (Set$1 && getTag(new Set$1()) != setTag$5) ||\n (WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1)\n ) {\n getTag = function (value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag$2 ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : ''\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString:\n return dataViewTag$3\n case mapCtorString:\n return mapTag$5\n case promiseCtorString:\n return promiseTag\n case setCtorString:\n return setTag$5\n case weakMapCtorString:\n return weakMapTag$1\n }\n }\n return result\n }\n }\n\n const getTag$1 = getTag\n\n /** Used for built-in method references. */\n var objectProto$6 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$6 = objectProto$6.hasOwnProperty\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length)\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty$6.call(array, 'index')) {\n result.index = array.index\n result.input = array.input\n }\n return result\n }\n\n /** Built-in value references. */\n var Uint8Array = root$1.Uint8Array\n\n const Uint8Array$1 = Uint8Array\n\n /**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength)\n new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer))\n return result\n }\n\n /**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\n function cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength)\n }\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/\n\n /**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\n function cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp))\n result.lastIndex = regexp.lastIndex\n return result\n }\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : undefined,\n symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined\n\n /**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\n function cloneSymbol(symbol) {\n return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {}\n }\n\n /**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\n function cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length)\n }\n\n /** `Object#toString` result references. */\n var boolTag$2 = '[object Boolean]',\n dateTag$2 = '[object Date]',\n mapTag$4 = '[object Map]',\n numberTag$2 = '[object Number]',\n regexpTag$3 = '[object RegExp]',\n setTag$4 = '[object Set]',\n stringTag$3 = '[object String]',\n symbolTag$2 = '[object Symbol]'\n\n var arrayBufferTag$2 = '[object ArrayBuffer]',\n dataViewTag$2 = '[object DataView]',\n float32Tag$1 = '[object Float32Array]',\n float64Tag$1 = '[object Float64Array]',\n int8Tag$1 = '[object Int8Array]',\n int16Tag$1 = '[object Int16Array]',\n int32Tag$1 = '[object Int32Array]',\n uint8Tag$1 = '[object Uint8Array]',\n uint8ClampedTag$1 = '[object Uint8ClampedArray]',\n uint16Tag$1 = '[object Uint16Array]',\n uint32Tag$1 = '[object Uint32Array]'\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor\n switch (tag) {\n case arrayBufferTag$2:\n return cloneArrayBuffer(object)\n\n case boolTag$2:\n case dateTag$2:\n return new Ctor(+object)\n\n case dataViewTag$2:\n return cloneDataView(object, isDeep)\n\n case float32Tag$1:\n case float64Tag$1:\n case int8Tag$1:\n case int16Tag$1:\n case int32Tag$1:\n case uint8Tag$1:\n case uint8ClampedTag$1:\n case uint16Tag$1:\n case uint32Tag$1:\n return cloneTypedArray(object, isDeep)\n\n case mapTag$4:\n return new Ctor()\n\n case numberTag$2:\n case stringTag$3:\n return new Ctor(object)\n\n case regexpTag$3:\n return cloneRegExp(object)\n\n case setTag$4:\n return new Ctor()\n\n case symbolTag$2:\n return cloneSymbol(object)\n }\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate$1(getPrototype$1(object)) : {}\n }\n\n /** `Object#toString` result references. */\n var mapTag$3 = '[object Map]'\n\n /**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\n function baseIsMap(value) {\n return isObjectLike(value) && getTag$1(value) == mapTag$3\n }\n\n /* Node.js helper references. */\n var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap\n\n /**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\n var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap\n\n const isMap$1 = isMap\n\n /** `Object#toString` result references. */\n var setTag$3 = '[object Set]'\n\n /**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\n function baseIsSet(value) {\n return isObjectLike(value) && getTag$1(value) == setTag$3\n }\n\n /* Node.js helper references. */\n var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet\n\n /**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\n var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet\n\n const isSet$1 = isSet\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG$1 = 4\n\n /** `Object#toString` result references. */\n var argsTag$1 = '[object Arguments]',\n arrayTag$1 = '[object Array]',\n boolTag$1 = '[object Boolean]',\n dateTag$1 = '[object Date]',\n errorTag$1 = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag$2 = '[object Map]',\n numberTag$1 = '[object Number]',\n objectTag$1 = '[object Object]',\n regexpTag$2 = '[object RegExp]',\n setTag$2 = '[object Set]',\n stringTag$2 = '[object String]',\n symbolTag$1 = '[object Symbol]',\n weakMapTag = '[object WeakMap]'\n\n var arrayBufferTag$1 = '[object ArrayBuffer]',\n dataViewTag$1 = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]'\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {}\n cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[\n dataViewTag$1\n ] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[\n float64Tag\n ] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[\n mapTag$2\n ] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$2] = cloneableTags[\n setTag$2\n ] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[\n uint8ClampedTag\n ] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true\n cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false\n\n /**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG$1\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value)\n }\n if (result !== undefined) {\n return result\n }\n if (!isObject(value)) {\n return value\n }\n var isArr = isArray$1(value)\n if (isArr) {\n result = initCloneArray(value)\n if (!isDeep) {\n return copyArray(value, result)\n }\n } else {\n var tag = getTag$1(value),\n isFunc = tag == funcTag || tag == genTag\n\n if (isBuffer$1(value)) {\n return cloneBuffer(value, isDeep)\n }\n if (tag == objectTag$1 || tag == argsTag$1 || (isFunc && !object)) {\n result = isFlat || isFunc ? {} : initCloneObject(value)\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value))\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {}\n }\n result = initCloneByTag(value, tag, isDeep)\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack())\n var stacked = stack.get(value)\n if (stacked) {\n return stacked\n }\n stack.set(value, result)\n\n if (isSet$1(value)) {\n value.forEach(function (subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack))\n })\n } else if (isMap$1(value)) {\n value.forEach(function (subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack))\n })\n }\n\n var keysFunc = isFull ? (isFlat ? getAllKeysIn : getAllKeys) : isFlat ? keysIn : keys\n\n var props = isArr ? undefined : keysFunc(value)\n arrayEach(props || value, function (subValue, key) {\n if (props) {\n key = subValue\n subValue = value[key]\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack))\n })\n return result\n }\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_SYMBOLS_FLAG = 4\n\n /**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\n function clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG)\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = []\n\n while (++index < length) {\n var value = array[index]\n if (value) {\n result[resIndex++] = value\n }\n }\n return result\n }\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED = '__lodash_hash_undefined__'\n\n /**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\n function setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED)\n return this\n }\n\n /**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\n function setCacheHas(value) {\n return this.__data__.has(value)\n }\n\n /**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length\n\n this.__data__ = new MapCache()\n while (++index < length) {\n this.add(values[index])\n }\n }\n\n // Add methods to `SetCache`.\n SetCache.prototype.add = SetCache.prototype.push = setCacheAdd\n SetCache.prototype.has = setCacheHas\n\n /**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true\n }\n }\n return false\n }\n\n /**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function cacheHas(cache, key) {\n return cache.has(key)\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$5 = 1,\n COMPARE_UNORDERED_FLAG$3 = 2\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,\n arrLength = array.length,\n othLength = other.length\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array)\n var othStacked = stack.get(other)\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array\n }\n var index = -1,\n result = true,\n seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : undefined\n\n stack.set(array, other)\n stack.set(other, array)\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index]\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack)\n }\n if (compared !== undefined) {\n if (compared) {\n continue\n }\n result = false\n break\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (\n !arraySome(other, function (othValue, othIndex) {\n if (\n !cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))\n ) {\n return seen.push(othIndex)\n }\n })\n ) {\n result = false\n break\n }\n } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n result = false\n break\n }\n }\n stack['delete'](array)\n stack['delete'](other)\n return result\n }\n\n /**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\n function mapToArray(map) {\n var index = -1,\n result = Array(map.size)\n\n map.forEach(function (value, key) {\n result[++index] = [key, value]\n })\n return result\n }\n\n /**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\n function setToArray(set) {\n var index = -1,\n result = Array(set.size)\n\n set.forEach(function (value) {\n result[++index] = value\n })\n return result\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$4 = 1,\n COMPARE_UNORDERED_FLAG$2 = 2\n\n /** `Object#toString` result references. */\n var boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag$1 = '[object Map]',\n numberTag = '[object Number]',\n regexpTag$1 = '[object RegExp]',\n setTag$1 = '[object Set]',\n stringTag$1 = '[object String]',\n symbolTag = '[object Symbol]'\n\n var arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]'\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {\n return false\n }\n object = object.buffer\n other = other.buffer\n\n case arrayBufferTag:\n if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {\n return false\n }\n return true\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other)\n\n case errorTag:\n return object.name == other.name && object.message == other.message\n\n case regexpTag$1:\n case stringTag$1:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == other + ''\n\n case mapTag$1:\n var convert = mapToArray\n\n case setTag$1:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4\n convert || (convert = setToArray)\n\n if (object.size != other.size && !isPartial) {\n return false\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object)\n if (stacked) {\n return stacked == other\n }\n bitmask |= COMPARE_UNORDERED_FLAG$2\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other)\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack)\n stack['delete'](object)\n return result\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other)\n }\n }\n return false\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$3 = 1\n\n /** Used for built-in method references. */\n var objectProto$5 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$5 = objectProto$5.hasOwnProperty\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length\n\n if (objLength != othLength && !isPartial) {\n return false\n }\n var index = objLength\n while (index--) {\n var key = objProps[index]\n if (!(isPartial ? key in other : hasOwnProperty$5.call(other, key))) {\n return false\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object)\n var othStacked = stack.get(other)\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object\n }\n var result = true\n stack.set(object, other)\n stack.set(other, object)\n\n var skipCtor = isPartial\n while (++index < objLength) {\n key = objProps[index]\n var objValue = object[key],\n othValue = other[key]\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack)\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (\n !(compared === undefined\n ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)\n : compared)\n ) {\n result = false\n break\n }\n skipCtor || (skipCtor = key == 'constructor')\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor\n\n // Non `Object` object instances with different constructors are not equal.\n if (\n objCtor != othCtor &&\n 'constructor' in object &&\n 'constructor' in other &&\n !(\n typeof objCtor == 'function' &&\n objCtor instanceof objCtor &&\n typeof othCtor == 'function' &&\n othCtor instanceof othCtor\n )\n ) {\n result = false\n }\n }\n stack['delete'](object)\n stack['delete'](other)\n return result\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$2 = 1\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]'\n\n /** Used for built-in method references. */\n var objectProto$4 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$4 = objectProto$4.hasOwnProperty\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray$1(object),\n othIsArr = isArray$1(other),\n objTag = objIsArr ? arrayTag : getTag$1(object),\n othTag = othIsArr ? arrayTag : getTag$1(other)\n\n objTag = objTag == argsTag ? objectTag : objTag\n othTag = othTag == argsTag ? objectTag : othTag\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag\n\n if (isSameTag && isBuffer$1(object)) {\n if (!isBuffer$1(other)) {\n return false\n }\n objIsArr = true\n objIsObj = false\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack())\n return objIsArr || isTypedArray$1(object)\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack)\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {\n var objIsWrapped = objIsObj && hasOwnProperty$4.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty$4.call(other, '__wrapped__')\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other\n\n stack || (stack = new Stack())\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack)\n }\n }\n if (!isSameTag) {\n return false\n }\n stack || (stack = new Stack())\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack)\n }\n\n /**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack)\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG$1 = 1,\n COMPARE_UNORDERED_FLAG$1 = 2\n\n /**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer\n\n if (object == null) {\n return !length\n }\n object = Object(object)\n while (index--) {\n var data = matchData[index]\n if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {\n return false\n }\n }\n while (++index < length) {\n data = matchData[index]\n var key = data[0],\n objValue = object[key],\n srcValue = data[1]\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false\n }\n } else {\n var stack = new Stack()\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack)\n }\n if (\n !(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)\n : result)\n ) {\n return false\n }\n }\n }\n return true\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value)\n }\n\n /**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = keys(object),\n length = result.length\n\n while (length--) {\n var key = result[length],\n value = object[key]\n\n result[length] = [key, value, isStrictComparable(value)]\n }\n return result\n }\n\n /**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function matchesStrictComparable(key, srcValue) {\n return function (object) {\n if (object == null) {\n return false\n }\n return object[key] === srcValue && (srcValue !== undefined || key in Object(object))\n }\n }\n\n /**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source)\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1])\n }\n return function (object) {\n return object === source || baseIsMatch(object, source, matchData)\n }\n }\n\n /**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHasIn(object, key) {\n return object != null && key in Object(object)\n }\n\n /**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\n function hasPath(object, path, hasFunc) {\n path = castPath(path, object)\n\n var index = -1,\n length = path.length,\n result = false\n\n while (++index < length) {\n var key = toKey(path[index])\n if (!(result = object != null && hasFunc(object, key))) {\n break\n }\n object = object[key]\n }\n if (result || ++index != length) {\n return result\n }\n length = object == null ? 0 : object.length\n return !!length && isLength(length) && isIndex(key, length) && (isArray$1(object) || isArguments$1(object))\n }\n\n /**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\n function hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn)\n }\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2\n\n /**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue)\n }\n return function (object) {\n var objValue = get(object, path)\n return objValue === undefined && objValue === srcValue\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)\n }\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function baseProperty(key) {\n return function (object) {\n return object == null ? undefined : object[key]\n }\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyDeep(path) {\n return function (object) {\n return baseGet(object, path)\n }\n }\n\n /**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\n function property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path)\n }\n\n /**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\n function baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value\n }\n if (value == null) {\n return identity\n }\n if (typeof value == 'object') {\n return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value)\n }\n return property(value)\n }\n\n /**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n var value = array[index]\n setter(accumulator, value, iteratee(value), array)\n }\n return accumulator\n }\n\n /**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function (object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length\n\n while (length--) {\n var key = props[fromRight ? length : ++index]\n if (iteratee(iterable[key], key, iterable) === false) {\n break\n }\n }\n return object\n }\n }\n\n /**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor()\n\n const baseFor$1 = baseFor\n\n /**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return object && baseFor$1(object, iteratee, keys)\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function (collection, iteratee) {\n if (collection == null) {\n return collection\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee)\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection)\n\n while (fromRight ? index-- : ++index < length) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break\n }\n }\n return collection\n }\n }\n\n /**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn)\n\n const baseEach$1 = baseEach\n\n /**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach$1(collection, function (value, key, collection) {\n setter(accumulator, value, iteratee(value), collection)\n })\n return accumulator\n }\n\n /**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function (collection, iteratee) {\n var func = isArray$1(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {}\n\n return func(collection, setter, baseIteratee(iteratee), accumulator)\n }\n }\n\n /** Used for built-in method references. */\n var objectProto$3 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$3 = objectProto$3.hasOwnProperty\n\n /**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var defaults = baseRest(function (object, sources) {\n object = Object(object)\n\n var index = -1\n var length = sources.length\n var guard = length > 2 ? sources[2] : undefined\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1\n }\n\n while (++index < length) {\n var source = sources[index]\n var props = keysIn(source)\n var propsIndex = -1\n var propsLength = props.length\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex]\n var value = object[key]\n\n if (value === undefined || (eq(value, objectProto$3[key]) && !hasOwnProperty$3.call(object, key))) {\n object[key] = source[key]\n }\n }\n }\n\n return object\n })\n\n const defaults$1 = defaults\n\n /**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\n function isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value)\n }\n\n /**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true\n }\n }\n return false\n }\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE$1 = 200\n\n /**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length\n\n if (!length) {\n return result\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee))\n }\n if (comparator) {\n includes = arrayIncludesWith\n isCommon = false\n } else if (values.length >= LARGE_ARRAY_SIZE$1) {\n includes = cacheHas\n isCommon = false\n values = new SetCache(values)\n }\n outer: while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value)\n\n value = comparator || value !== 0 ? value : 0\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer\n }\n }\n result.push(value)\n } else if (!includes(values, computed, comparator)) {\n result.push(value)\n }\n }\n return result\n }\n\n /**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\n var difference = baseRest(function (array, values) {\n return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []\n })\n\n const difference$1 = difference\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array == null ? 0 : array.length\n return length ? array[length - 1] : undefined\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return []\n }\n n = guard || n === undefined ? 1 : toInteger(n)\n return baseSlice(array, n < 0 ? 0 : n, length)\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return []\n }\n n = guard || n === undefined ? 1 : toInteger(n)\n n = length - n\n return baseSlice(array, 0, n < 0 ? 0 : n)\n }\n\n /**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\n function castFunction(value) {\n return typeof value == 'function' ? value : identity\n }\n\n /**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forEach(collection, iteratee) {\n var func = isArray$1(collection) ? arrayEach : baseEach$1\n return func(collection, castFunction(iteratee))\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false\n }\n }\n return true\n }\n\n /**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true\n baseEach$1(collection, function (value, index, collection) {\n result = !!predicate(value, index, collection)\n return result\n })\n return result\n }\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, guard) {\n var func = isArray$1(collection) ? arrayEvery : baseEvery\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined\n }\n return func(collection, baseIteratee(predicate))\n }\n\n /**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = []\n baseEach$1(collection, function (value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value)\n }\n })\n return result\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\n function filter(collection, predicate) {\n var func = isArray$1(collection) ? arrayFilter : baseFilter\n return func(collection, baseIteratee(predicate))\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\n function createFind(findIndexFunc) {\n return function (collection, predicate, fromIndex) {\n var iterable = Object(collection)\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate)\n collection = keys(collection)\n predicate = function (key) {\n return iteratee(iterable[key], key, iterable)\n }\n }\n var index = findIndexFunc(collection, predicate, fromIndex)\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined\n }\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax$2 = Math.max\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\n function findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return -1\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex)\n if (index < 0) {\n index = nativeMax$2(length + index, 0)\n }\n return baseFindIndex(array, baseIteratee(predicate), index)\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\n var find = createFind(findIndex)\n\n const find$1 = find\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\n function head(array) {\n return array && array.length ? array[0] : undefined\n }\n\n /**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : []\n\n baseEach$1(collection, function (value, key, collection) {\n result[++index] = iteratee(value, key, collection)\n })\n return result\n }\n\n /**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee) {\n var func = isArray$1(collection) ? arrayMap : baseMap\n return func(collection, baseIteratee(iteratee))\n }\n\n /**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1)\n }\n\n /** Used for built-in method references. */\n var objectProto$2 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$2 = objectProto$2.hasOwnProperty\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function (result, value, key) {\n if (hasOwnProperty$2.call(result, key)) {\n result[key].push(value)\n } else {\n baseAssignValue(result, key, [value])\n }\n })\n\n const groupBy$1 = groupBy\n\n /** Used for built-in method references. */\n var objectProto$1 = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty$1 = objectProto$1.hasOwnProperty\n\n /**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHas(object, key) {\n return object != null && hasOwnProperty$1.call(object, key)\n }\n\n /**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\n function has(object, path) {\n return object != null && hasPath(object, path, baseHas)\n }\n\n /** `Object#toString` result references. */\n var stringTag = '[object String]'\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' || (!isArray$1(value) && isObjectLike(value) && baseGetTag(value) == stringTag)\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n return arrayMap(props, function (key) {\n return object[key]\n })\n }\n\n /**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return object == null ? [] : baseValues(object, keys(object))\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax$1 = Math.max\n\n /**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\n function includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection)\n fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0\n\n var length = collection.length\n if (fromIndex < 0) {\n fromIndex = nativeMax$1(length + fromIndex, 0)\n }\n return isString(collection)\n ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1\n : !!length && baseIndexOf(collection, value, fromIndex) > -1\n }\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax = Math.max\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length\n if (!length) {\n return -1\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex)\n if (index < 0) {\n index = nativeMax(length + index, 0)\n }\n return baseIndexOf(array, value, index)\n }\n\n /** `Object#toString` result references. */\n var mapTag = '[object Map]',\n setTag = '[object Set]'\n\n /** Used for built-in method references. */\n var objectProto = Object.prototype\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty\n\n /**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true\n }\n if (\n isArrayLike(value) &&\n (isArray$1(value) ||\n typeof value == 'string' ||\n typeof value.splice == 'function' ||\n isBuffer$1(value) ||\n isTypedArray$1(value) ||\n isArguments$1(value))\n ) {\n return !value.length\n }\n var tag = getTag$1(value)\n if (tag == mapTag || tag == setTag) {\n return !value.size\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false\n }\n }\n return true\n }\n\n /** `Object#toString` result references. */\n var regexpTag = '[object RegExp]'\n\n /**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\n function baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag\n }\n\n /* Node.js helper references. */\n var nodeIsRegExp = nodeUtil$1 && nodeUtil$1.isRegExp\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp\n\n const isRegExp$1 = isRegExp\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined\n }\n\n /** Error message constants. */\n var FUNC_ERROR_TEXT = 'Expected a function'\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT)\n }\n return function () {\n var args = arguments\n switch (args.length) {\n case 0:\n return !predicate.call(this)\n case 1:\n return !predicate.call(this, args[0])\n case 2:\n return !predicate.call(this, args[0], args[1])\n case 3:\n return !predicate.call(this, args[0], args[1], args[2])\n }\n return !predicate.apply(this, args)\n }\n }\n\n /**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object\n }\n path = castPath(path, object)\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object\n }\n\n if (index != lastIndex) {\n var objValue = nested[key]\n newValue = customizer ? customizer(objValue, key, nested) : undefined\n if (newValue === undefined) {\n newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}\n }\n }\n assignValue(nested, key, newValue)\n nested = nested[key]\n }\n return object\n }\n\n /**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\n function basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {}\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path)\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value)\n }\n }\n return result\n }\n\n /**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\n function pickBy(object, predicate) {\n if (object == null) {\n return {}\n }\n var props = arrayMap(getAllKeysIn(object), function (prop) {\n return [prop]\n })\n predicate = baseIteratee(predicate)\n return basePickBy(object, props, function (value, path) {\n return predicate(value, path[0])\n })\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function (value, index, collection) {\n accumulator = initAccum ? ((initAccum = false), value) : iteratee(accumulator, value, index, collection)\n })\n return accumulator\n }\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\n function reduce(collection, iteratee, accumulator) {\n var func = isArray$1(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3\n\n return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1)\n }\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\n function reject(collection, predicate) {\n var func = isArray$1(collection) ? arrayFilter : baseFilter\n return func(collection, negate(baseIteratee(predicate)))\n }\n\n /**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result\n\n baseEach$1(collection, function (value, index, collection) {\n result = predicate(value, index, collection)\n return !result\n })\n return !!result\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, guard) {\n var func = isArray$1(collection) ? arraySome : baseSome\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined\n }\n return func(collection, baseIteratee(predicate))\n }\n\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0\n\n /**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\n var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY)\n ? noop\n : function (values) {\n return new Set$1(values)\n }\n\n const createSet$1 = createSet\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200\n\n /**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result\n\n if (comparator) {\n isCommon = false\n includes = arrayIncludesWith\n } else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet$1(array)\n if (set) {\n return setToArray(set)\n }\n isCommon = false\n includes = cacheHas\n seen = new SetCache()\n } else {\n seen = iteratee ? [] : result\n }\n outer: while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value\n\n value = comparator || value !== 0 ? value : 0\n if (isCommon && computed === computed) {\n var seenIndex = seen.length\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer\n }\n }\n if (iteratee) {\n seen.push(computed)\n }\n result.push(value)\n } else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed)\n }\n result.push(value)\n }\n }\n return result\n }\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\n function uniq(array) {\n return array && array.length ? baseUniq(array) : []\n }\n\n function PRINT_ERROR(msg) {\n /* istanbul ignore else - can't override global.console in node.js */\n if (console && console.error) {\n console.error(`Error: ${msg}`)\n }\n }\n function PRINT_WARNING(msg) {\n /* istanbul ignore else - can't override global.console in node.js*/\n if (console && console.warn) {\n // TODO: modify docs accordingly\n console.warn(`Warning: ${msg}`)\n }\n }\n\n function timer(func) {\n const start = new Date().getTime()\n const val = func()\n const end = new Date().getTime()\n const total = end - start\n return { time: total, value: val }\n }\n\n // based on: https://github.com/petkaantonov/bluebird/blob/b97c0d2d487e8c5076e8bd897e0dcd4622d31846/src/util.js#L201-L216\n function toFastProperties(toBecomeFast) {\n function FakeConstructor() {}\n // If our object is used as a constructor, it would receive\n FakeConstructor.prototype = toBecomeFast\n const fakeInstance = new FakeConstructor()\n function fakeAccess() {\n return typeof fakeInstance.bar\n }\n // help V8 understand this is a \"real\" prototype by actually using\n // the fake instance.\n fakeAccess()\n fakeAccess()\n // Always true condition to suppress the Firefox warning of unreachable\n // code after a return statement.\n return toBecomeFast\n }\n\n // TODO: duplicated code to avoid extracting another sub-package -- how to avoid?\n function tokenLabel$1(tokType) {\n if (hasTokenLabel$1(tokType)) {\n return tokType.LABEL\n } else {\n return tokType.name\n }\n }\n // TODO: duplicated code to avoid extracting another sub-package -- how to avoid?\n function hasTokenLabel$1(obj) {\n return isString(obj.LABEL) && obj.LABEL !== ''\n }\n class AbstractProduction {\n get definition() {\n return this._definition\n }\n set definition(value) {\n this._definition = value\n }\n constructor(_definition) {\n this._definition = _definition\n }\n accept(visitor) {\n visitor.visit(this)\n forEach(this.definition, (prod) => {\n prod.accept(visitor)\n })\n }\n }\n class NonTerminal extends AbstractProduction {\n constructor(options) {\n super([])\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n set definition(definition) {\n // immutable\n }\n get definition() {\n if (this.referencedRule !== undefined) {\n return this.referencedRule.definition\n }\n return []\n }\n accept(visitor) {\n visitor.visit(this)\n // don't visit children of a reference, we will get cyclic infinite loops if we do so\n }\n }\n class Rule extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.orgText = ''\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Alternative extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.ignoreAmbiguities = false\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Option extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class RepetitionMandatory extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class RepetitionMandatoryWithSeparator extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Repetition extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class RepetitionWithSeparator extends AbstractProduction {\n constructor(options) {\n super(options.definition)\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Alternation extends AbstractProduction {\n get definition() {\n return this._definition\n }\n set definition(value) {\n this._definition = value\n }\n constructor(options) {\n super(options.definition)\n this.idx = 1\n this.ignoreAmbiguities = false\n this.hasPredicates = false\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n }\n class Terminal {\n constructor(options) {\n this.idx = 1\n assign$1(\n this,\n pickBy(options, (v) => v !== undefined),\n )\n }\n accept(visitor) {\n visitor.visit(this)\n }\n }\n function serializeGrammar(topRules) {\n return map(topRules, serializeProduction)\n }\n function serializeProduction(node) {\n function convertDefinition(definition) {\n return map(definition, serializeProduction)\n }\n /* istanbul ignore else */\n if (node instanceof NonTerminal) {\n const serializedNonTerminal = {\n type: 'NonTerminal',\n name: node.nonTerminalName,\n idx: node.idx,\n }\n if (isString(node.label)) {\n serializedNonTerminal.label = node.label\n }\n return serializedNonTerminal\n } else if (node instanceof Alternative) {\n return {\n type: 'Alternative',\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Option) {\n return {\n type: 'Option',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof RepetitionMandatory) {\n return {\n type: 'RepetitionMandatory',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof RepetitionMandatoryWithSeparator) {\n return {\n type: 'RepetitionMandatoryWithSeparator',\n idx: node.idx,\n separator: serializeProduction(new Terminal({ terminalType: node.separator })),\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof RepetitionWithSeparator) {\n return {\n type: 'RepetitionWithSeparator',\n idx: node.idx,\n separator: serializeProduction(new Terminal({ terminalType: node.separator })),\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Repetition) {\n return {\n type: 'Repetition',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Alternation) {\n return {\n type: 'Alternation',\n idx: node.idx,\n definition: convertDefinition(node.definition),\n }\n } else if (node instanceof Terminal) {\n const serializedTerminal = {\n type: 'Terminal',\n name: node.terminalType.name,\n label: tokenLabel$1(node.terminalType),\n idx: node.idx,\n }\n if (isString(node.label)) {\n serializedTerminal.terminalLabel = node.label\n }\n const pattern = node.terminalType.PATTERN\n if (node.terminalType.PATTERN) {\n serializedTerminal.pattern = isRegExp$1(pattern) ? pattern.source : pattern\n }\n return serializedTerminal\n } else if (node instanceof Rule) {\n return {\n type: 'Rule',\n name: node.name,\n orgText: node.orgText,\n definition: convertDefinition(node.definition),\n }\n /* c8 ignore next 3 */\n } else {\n throw Error('non exhaustive match')\n }\n }\n\n class GAstVisitor {\n visit(node) {\n const nodeAny = node\n switch (nodeAny.constructor) {\n case NonTerminal:\n return this.visitNonTerminal(nodeAny)\n case Alternative:\n return this.visitAlternative(nodeAny)\n case Option:\n return this.visitOption(nodeAny)\n case RepetitionMandatory:\n return this.visitRepetitionMandatory(nodeAny)\n case RepetitionMandatoryWithSeparator:\n return this.visitRepetitionMandatoryWithSeparator(nodeAny)\n case RepetitionWithSeparator:\n return this.visitRepetitionWithSeparator(nodeAny)\n case Repetition:\n return this.visitRepetition(nodeAny)\n case Alternation:\n return this.visitAlternation(nodeAny)\n case Terminal:\n return this.visitTerminal(nodeAny)\n case Rule:\n return this.visitRule(nodeAny)\n /* c8 ignore next 2 */\n default:\n throw Error('non exhaustive match')\n }\n }\n /* c8 ignore next */\n visitNonTerminal(node) {}\n /* c8 ignore next */\n visitAlternative(node) {}\n /* c8 ignore next */\n visitOption(node) {}\n /* c8 ignore next */\n visitRepetition(node) {}\n /* c8 ignore next */\n visitRepetitionMandatory(node) {}\n /* c8 ignore next 3 */\n visitRepetitionMandatoryWithSeparator(node) {}\n /* c8 ignore next */\n visitRepetitionWithSeparator(node) {}\n /* c8 ignore next */\n visitAlternation(node) {}\n /* c8 ignore next */\n visitTerminal(node) {}\n /* c8 ignore next */\n visitRule(node) {}\n }\n\n function isSequenceProd(prod) {\n return (\n prod instanceof Alternative ||\n prod instanceof Option ||\n prod instanceof Repetition ||\n prod instanceof RepetitionMandatory ||\n prod instanceof RepetitionMandatoryWithSeparator ||\n prod instanceof RepetitionWithSeparator ||\n prod instanceof Terminal ||\n prod instanceof Rule\n )\n }\n function isOptionalProd(prod, alreadyVisited = []) {\n const isDirectlyOptional =\n prod instanceof Option || prod instanceof Repetition || prod instanceof RepetitionWithSeparator\n if (isDirectlyOptional) {\n return true\n }\n // note that this can cause infinite loop if one optional empty TOP production has a cyclic dependency with another\n // empty optional top rule\n // may be indirectly optional ((A?B?C?) | (D?E?F?))\n if (prod instanceof Alternation) {\n // for OR its enough for just one of the alternatives to be optional\n return some(prod.definition, (subProd) => {\n return isOptionalProd(subProd, alreadyVisited)\n })\n } else if (prod instanceof NonTerminal && includes(alreadyVisited, prod)) {\n // avoiding stack overflow due to infinite recursion\n return false\n } else if (prod instanceof AbstractProduction) {\n if (prod instanceof NonTerminal) {\n alreadyVisited.push(prod)\n }\n return every(prod.definition, (subProd) => {\n return isOptionalProd(subProd, alreadyVisited)\n })\n } else {\n return false\n }\n }\n function isBranchingProd(prod) {\n return prod instanceof Alternation\n }\n function getProductionDslName(prod) {\n /* istanbul ignore else */\n if (prod instanceof NonTerminal) {\n return 'SUBRULE'\n } else if (prod instanceof Option) {\n return 'OPTION'\n } else if (prod instanceof Alternation) {\n return 'OR'\n } else if (prod instanceof RepetitionMandatory) {\n return 'AT_LEAST_ONE'\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n return 'AT_LEAST_ONE_SEP'\n } else if (prod instanceof RepetitionWithSeparator) {\n return 'MANY_SEP'\n } else if (prod instanceof Repetition) {\n return 'MANY'\n } else if (prod instanceof Terminal) {\n return 'CONSUME'\n /* c8 ignore next 3 */\n } else {\n throw Error('non exhaustive match')\n }\n }\n\n /**\n * A Grammar Walker that computes the \"remaining\" grammar \"after\" a productions in the grammar.\n */\n class RestWalker {\n walk(prod, prevRest = []) {\n forEach(prod.definition, (subProd, index) => {\n const currRest = drop(prod.definition, index + 1)\n /* istanbul ignore else */\n if (subProd instanceof NonTerminal) {\n this.walkProdRef(subProd, currRest, prevRest)\n } else if (subProd instanceof Terminal) {\n this.walkTerminal(subProd, currRest, prevRest)\n } else if (subProd instanceof Alternative) {\n this.walkFlat(subProd, currRest, prevRest)\n } else if (subProd instanceof Option) {\n this.walkOption(subProd, currRest, prevRest)\n } else if (subProd instanceof RepetitionMandatory) {\n this.walkAtLeastOne(subProd, currRest, prevRest)\n } else if (subProd instanceof RepetitionMandatoryWithSeparator) {\n this.walkAtLeastOneSep(subProd, currRest, prevRest)\n } else if (subProd instanceof RepetitionWithSeparator) {\n this.walkManySep(subProd, currRest, prevRest)\n } else if (subProd instanceof Repetition) {\n this.walkMany(subProd, currRest, prevRest)\n } else if (subProd instanceof Alternation) {\n this.walkOr(subProd, currRest, prevRest)\n } else {\n throw Error('non exhaustive match')\n }\n })\n }\n walkTerminal(terminal, currRest, prevRest) {}\n walkProdRef(refProd, currRest, prevRest) {}\n walkFlat(flatProd, currRest, prevRest) {\n // ABCDEF => after the D the rest is EF\n const fullOrRest = currRest.concat(prevRest)\n this.walk(flatProd, fullOrRest)\n }\n walkOption(optionProd, currRest, prevRest) {\n // ABC(DE)?F => after the (DE)? the rest is F\n const fullOrRest = currRest.concat(prevRest)\n this.walk(optionProd, fullOrRest)\n }\n walkAtLeastOne(atLeastOneProd, currRest, prevRest) {\n // ABC(DE)+F => after the (DE)+ the rest is (DE)?F\n const fullAtLeastOneRest = [new Option({ definition: atLeastOneProd.definition })].concat(currRest, prevRest)\n this.walk(atLeastOneProd, fullAtLeastOneRest)\n }\n walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {\n // ABC DE(,DE)* F => after the (,DE)+ the rest is (,DE)?F\n const fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest)\n this.walk(atLeastOneSepProd, fullAtLeastOneSepRest)\n }\n walkMany(manyProd, currRest, prevRest) {\n // ABC(DE)*F => after the (DE)* the rest is (DE)?F\n const fullManyRest = [new Option({ definition: manyProd.definition })].concat(currRest, prevRest)\n this.walk(manyProd, fullManyRest)\n }\n walkManySep(manySepProd, currRest, prevRest) {\n // ABC (DE(,DE)*)? F => after the (,DE)* the rest is (,DE)?F\n const fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest)\n this.walk(manySepProd, fullManySepRest)\n }\n walkOr(orProd, currRest, prevRest) {\n // ABC(D|E|F)G => when finding the (D|E|F) the rest is G\n const fullOrRest = currRest.concat(prevRest)\n // walk all different alternatives\n forEach(orProd.definition, (alt) => {\n // wrapping each alternative in a single definition wrapper\n // to avoid errors in computing the rest of that alternative in the invocation to computeInProdFollows\n // (otherwise for OR([alt1,alt2]) alt2 will be considered in 'rest' of alt1\n const prodWrapper = new Alternative({ definition: [alt] })\n this.walk(prodWrapper, fullOrRest)\n })\n }\n }\n function restForRepetitionWithSeparator(repSepProd, currRest, prevRest) {\n const repSepRest = [\n new Option({\n definition: [new Terminal({ terminalType: repSepProd.separator })].concat(repSepProd.definition),\n }),\n ]\n const fullRepSepRest = repSepRest.concat(currRest, prevRest)\n return fullRepSepRest\n }\n\n function first(prod) {\n /* istanbul ignore else */\n if (prod instanceof NonTerminal) {\n // this could in theory cause infinite loops if\n // (1) prod A refs prod B.\n // (2) prod B refs prod A\n // (3) AB can match the empty set\n // in other words a cycle where everything is optional so the first will keep\n // looking ahead for the next optional part and will never exit\n // currently there is no safeguard for this unique edge case because\n // (1) not sure a grammar in which this can happen is useful for anything (productive)\n return first(prod.referencedRule)\n } else if (prod instanceof Terminal) {\n return firstForTerminal(prod)\n } else if (isSequenceProd(prod)) {\n return firstForSequence(prod)\n } else if (isBranchingProd(prod)) {\n return firstForBranching(prod)\n } else {\n throw Error('non exhaustive match')\n }\n }\n function firstForSequence(prod) {\n let firstSet = []\n const seq = prod.definition\n let nextSubProdIdx = 0\n let hasInnerProdsRemaining = seq.length > nextSubProdIdx\n let currSubProd\n // so we enter the loop at least once (if the definition is not empty\n let isLastInnerProdOptional = true\n // scan a sequence until it's end or until we have found a NONE optional production in it\n while (hasInnerProdsRemaining && isLastInnerProdOptional) {\n currSubProd = seq[nextSubProdIdx]\n isLastInnerProdOptional = isOptionalProd(currSubProd)\n firstSet = firstSet.concat(first(currSubProd))\n nextSubProdIdx = nextSubProdIdx + 1\n hasInnerProdsRemaining = seq.length > nextSubProdIdx\n }\n return uniq(firstSet)\n }\n function firstForBranching(prod) {\n const allAlternativesFirsts = map(prod.definition, (innerProd) => {\n return first(innerProd)\n })\n return uniq(flatten(allAlternativesFirsts))\n }\n function firstForTerminal(terminal) {\n return [terminal.terminalType]\n }\n\n // TODO: can this be removed? where is it used?\n const IN = '_~IN~_'\n\n // This ResyncFollowsWalker computes all of the follows required for RESYNC\n // (skipping reference production).\n class ResyncFollowsWalker extends RestWalker {\n constructor(topProd) {\n super()\n this.topProd = topProd\n this.follows = {}\n }\n startWalking() {\n this.walk(this.topProd)\n return this.follows\n }\n walkTerminal(terminal, currRest, prevRest) {\n // do nothing! just like in the public sector after 13:00\n }\n walkProdRef(refProd, currRest, prevRest) {\n const followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) + this.topProd.name\n const fullRest = currRest.concat(prevRest)\n const restProd = new Alternative({ definition: fullRest })\n const t_in_topProd_follows = first(restProd)\n this.follows[followName] = t_in_topProd_follows\n }\n }\n function computeAllProdsFollows(topProductions) {\n const reSyncFollows = {}\n forEach(topProductions, (topProd) => {\n const currRefsFollow = new ResyncFollowsWalker(topProd).startWalking()\n assign$1(reSyncFollows, currRefsFollow)\n })\n return reSyncFollows\n }\n function buildBetweenProdsFollowPrefix(inner, occurenceInParent) {\n return inner.name + occurenceInParent + IN\n }\n\n function cc(char) {\n return char.charCodeAt(0)\n }\n function insertToSet(item, set) {\n if (Array.isArray(item)) {\n item.forEach(function (subItem) {\n set.push(subItem)\n })\n } else {\n set.push(item)\n }\n }\n function addFlag(flagObj, flagKey) {\n if (flagObj[flagKey] === true) {\n throw 'duplicate flag ' + flagKey\n }\n flagObj[flagKey]\n flagObj[flagKey] = true\n }\n function ASSERT_EXISTS(obj) {\n // istanbul ignore next\n if (obj === undefined) {\n throw Error('Internal Error - Should never get here!')\n }\n return true\n }\n // istanbul ignore next\n function ASSERT_NEVER_REACH_HERE() {\n throw Error('Internal Error - Should never get here!')\n }\n function isCharacter(obj) {\n return obj['type'] === 'Character'\n }\n\n const digitsCharCodes = []\n for (let i = cc('0'); i <= cc('9'); i++) {\n digitsCharCodes.push(i)\n }\n const wordCharCodes = [cc('_')].concat(digitsCharCodes)\n for (let i = cc('a'); i <= cc('z'); i++) {\n wordCharCodes.push(i)\n }\n for (let i = cc('A'); i <= cc('Z'); i++) {\n wordCharCodes.push(i)\n }\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#character-classes\n const whitespaceCodes = [\n cc(' '),\n cc('\\f'),\n cc('\\n'),\n cc('\\r'),\n cc('\\t'),\n cc('\\v'),\n cc('\\t'),\n cc('\\u00a0'),\n cc('\\u1680'),\n cc('\\u2000'),\n cc('\\u2001'),\n cc('\\u2002'),\n cc('\\u2003'),\n cc('\\u2004'),\n cc('\\u2005'),\n cc('\\u2006'),\n cc('\\u2007'),\n cc('\\u2008'),\n cc('\\u2009'),\n cc('\\u200a'),\n cc('\\u2028'),\n cc('\\u2029'),\n cc('\\u202f'),\n cc('\\u205f'),\n cc('\\u3000'),\n cc('\\ufeff'),\n ]\n\n // consts and utilities\n const hexDigitPattern = /[0-9a-fA-F]/\n const decimalPattern = /[0-9]/\n const decimalPatternNoZero = /[1-9]/\n // https://hackernoon.com/the-madness-of-parsing-real-world-javascript-regexps-d9ee336df983\n // https://www.ecma-international.org/ecma-262/8.0/index.html#prod-Pattern\n class RegExpParser {\n constructor() {\n this.idx = 0\n this.input = ''\n this.groupIdx = 0\n }\n saveState() {\n return {\n idx: this.idx,\n input: this.input,\n groupIdx: this.groupIdx,\n }\n }\n restoreState(newState) {\n this.idx = newState.idx\n this.input = newState.input\n this.groupIdx = newState.groupIdx\n }\n pattern(input) {\n // parser state\n this.idx = 0\n this.input = input\n this.groupIdx = 0\n this.consumeChar('/')\n const value = this.disjunction()\n this.consumeChar('/')\n const flags = {\n type: 'Flags',\n loc: { begin: this.idx, end: input.length },\n global: false,\n ignoreCase: false,\n multiLine: false,\n unicode: false,\n sticky: false,\n }\n while (this.isRegExpFlag()) {\n switch (this.popChar()) {\n case 'g':\n addFlag(flags, 'global')\n break\n case 'i':\n addFlag(flags, 'ignoreCase')\n break\n case 'm':\n addFlag(flags, 'multiLine')\n break\n case 'u':\n addFlag(flags, 'unicode')\n break\n case 'y':\n addFlag(flags, 'sticky')\n break\n }\n }\n if (this.idx !== this.input.length) {\n throw Error('Redundant input: ' + this.input.substring(this.idx))\n }\n return {\n type: 'Pattern',\n flags: flags,\n value: value,\n loc: this.loc(0),\n }\n }\n disjunction() {\n const alts = []\n const begin = this.idx\n alts.push(this.alternative())\n while (this.peekChar() === '|') {\n this.consumeChar('|')\n alts.push(this.alternative())\n }\n return { type: 'Disjunction', value: alts, loc: this.loc(begin) }\n }\n alternative() {\n const terms = []\n const begin = this.idx\n while (this.isTerm()) {\n terms.push(this.term())\n }\n return { type: 'Alternative', value: terms, loc: this.loc(begin) }\n }\n term() {\n if (this.isAssertion()) {\n return this.assertion()\n } else {\n return this.atom()\n }\n }\n assertion() {\n const begin = this.idx\n switch (this.popChar()) {\n case '^':\n return {\n type: 'StartAnchor',\n loc: this.loc(begin),\n }\n case '$':\n return { type: 'EndAnchor', loc: this.loc(begin) }\n // '\\b' or '\\B'\n case '\\\\':\n switch (this.popChar()) {\n case 'b':\n return {\n type: 'WordBoundary',\n loc: this.loc(begin),\n }\n case 'B':\n return {\n type: 'NonWordBoundary',\n loc: this.loc(begin),\n }\n }\n // istanbul ignore next\n throw Error('Invalid Assertion Escape')\n // '(?=' or '(?!'\n case '(':\n this.consumeChar('?')\n let type\n switch (this.popChar()) {\n case '=':\n type = 'Lookahead'\n break\n case '!':\n type = 'NegativeLookahead'\n break\n }\n ASSERT_EXISTS(type)\n const disjunction = this.disjunction()\n this.consumeChar(')')\n return {\n type: type,\n value: disjunction,\n loc: this.loc(begin),\n }\n }\n // istanbul ignore next\n return ASSERT_NEVER_REACH_HERE()\n }\n quantifier(isBacktracking = false) {\n let range = undefined\n const begin = this.idx\n switch (this.popChar()) {\n case '*':\n range = {\n atLeast: 0,\n atMost: Infinity,\n }\n break\n case '+':\n range = {\n atLeast: 1,\n atMost: Infinity,\n }\n break\n case '?':\n range = {\n atLeast: 0,\n atMost: 1,\n }\n break\n case '{':\n const atLeast = this.integerIncludingZero()\n switch (this.popChar()) {\n case '}':\n range = {\n atLeast: atLeast,\n atMost: atLeast,\n }\n break\n case ',':\n let atMost\n if (this.isDigit()) {\n atMost = this.integerIncludingZero()\n range = {\n atLeast: atLeast,\n atMost: atMost,\n }\n } else {\n range = {\n atLeast: atLeast,\n atMost: Infinity,\n }\n }\n this.consumeChar('}')\n break\n }\n // throwing exceptions from \"ASSERT_EXISTS\" during backtracking\n // causes severe performance degradations\n if (isBacktracking === true && range === undefined) {\n return undefined\n }\n ASSERT_EXISTS(range)\n break\n }\n // throwing exceptions from \"ASSERT_EXISTS\" during backtracking\n // causes severe performance degradations\n if (isBacktracking === true && range === undefined) {\n return undefined\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(range)) {\n if (this.peekChar(0) === '?') {\n this.consumeChar('?')\n range.greedy = false\n } else {\n range.greedy = true\n }\n range.type = 'Quantifier'\n range.loc = this.loc(begin)\n return range\n }\n }\n atom() {\n let atom\n const begin = this.idx\n switch (this.peekChar()) {\n case '.':\n atom = this.dotAll()\n break\n case '\\\\':\n atom = this.atomEscape()\n break\n case '[':\n atom = this.characterClass()\n break\n case '(':\n atom = this.group()\n break\n }\n if (atom === undefined && this.isPatternCharacter()) {\n atom = this.patternCharacter()\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(atom)) {\n atom.loc = this.loc(begin)\n if (this.isQuantifier()) {\n atom.quantifier = this.quantifier()\n }\n return atom\n }\n }\n dotAll() {\n this.consumeChar('.')\n return {\n type: 'Set',\n complement: true,\n value: [cc('\\n'), cc('\\r'), cc('\\u2028'), cc('\\u2029')],\n }\n }\n atomEscape() {\n this.consumeChar('\\\\')\n switch (this.peekChar()) {\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n return this.decimalEscapeAtom()\n case 'd':\n case 'D':\n case 's':\n case 'S':\n case 'w':\n case 'W':\n return this.characterClassEscape()\n case 'f':\n case 'n':\n case 'r':\n case 't':\n case 'v':\n return this.controlEscapeAtom()\n case 'c':\n return this.controlLetterEscapeAtom()\n case '0':\n return this.nulCharacterAtom()\n case 'x':\n return this.hexEscapeSequenceAtom()\n case 'u':\n return this.regExpUnicodeEscapeSequenceAtom()\n default:\n return this.identityEscapeAtom()\n }\n }\n decimalEscapeAtom() {\n const value = this.positiveInteger()\n return { type: 'GroupBackReference', value: value }\n }\n characterClassEscape() {\n let set\n let complement = false\n switch (this.popChar()) {\n case 'd':\n set = digitsCharCodes\n break\n case 'D':\n set = digitsCharCodes\n complement = true\n break\n case 's':\n set = whitespaceCodes\n break\n case 'S':\n set = whitespaceCodes\n complement = true\n break\n case 'w':\n set = wordCharCodes\n break\n case 'W':\n set = wordCharCodes\n complement = true\n break\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(set)) {\n return { type: 'Set', value: set, complement: complement }\n }\n }\n controlEscapeAtom() {\n let escapeCode\n switch (this.popChar()) {\n case 'f':\n escapeCode = cc('\\f')\n break\n case 'n':\n escapeCode = cc('\\n')\n break\n case 'r':\n escapeCode = cc('\\r')\n break\n case 't':\n escapeCode = cc('\\t')\n break\n case 'v':\n escapeCode = cc('\\v')\n break\n }\n // istanbul ignore else\n if (ASSERT_EXISTS(escapeCode)) {\n return { type: 'Character', value: escapeCode }\n }\n }\n controlLetterEscapeAtom() {\n this.consumeChar('c')\n const letter = this.popChar()\n if (/[a-zA-Z]/.test(letter) === false) {\n throw Error('Invalid ')\n }\n const letterCode = letter.toUpperCase().charCodeAt(0) - 64\n return { type: 'Character', value: letterCode }\n }\n nulCharacterAtom() {\n // TODO implement '[lookahead ∉ DecimalDigit]'\n // TODO: for the deprecated octal escape sequence\n this.consumeChar('0')\n return { type: 'Character', value: cc('\\0') }\n }\n hexEscapeSequenceAtom() {\n this.consumeChar('x')\n return this.parseHexDigits(2)\n }\n regExpUnicodeEscapeSequenceAtom() {\n this.consumeChar('u')\n return this.parseHexDigits(4)\n }\n identityEscapeAtom() {\n // TODO: implement \"SourceCharacter but not UnicodeIDContinue\"\n // // http://unicode.org/reports/tr31/#Specific_Character_Adjustments\n const escapedChar = this.popChar()\n return { type: 'Character', value: cc(escapedChar) }\n }\n classPatternCharacterAtom() {\n switch (this.peekChar()) {\n // istanbul ignore next\n case '\\n':\n // istanbul ignore next\n case '\\r':\n // istanbul ignore next\n case '\\u2028':\n // istanbul ignore next\n case '\\u2029':\n // istanbul ignore next\n case '\\\\':\n // istanbul ignore next\n case ']':\n throw Error('TBD')\n default:\n const nextChar = this.popChar()\n return { type: 'Character', value: cc(nextChar) }\n }\n }\n characterClass() {\n const set = []\n let complement = false\n this.consumeChar('[')\n if (this.peekChar(0) === '^') {\n this.consumeChar('^')\n complement = true\n }\n while (this.isClassAtom()) {\n const from = this.classAtom()\n from.type === 'Character'\n if (isCharacter(from) && this.isRangeDash()) {\n this.consumeChar('-')\n const to = this.classAtom()\n to.type === 'Character'\n // a range can only be used when both sides are single characters\n if (isCharacter(to)) {\n if (to.value < from.value) {\n throw Error('Range out of order in character class')\n }\n set.push({ from: from.value, to: to.value })\n } else {\n // literal dash\n insertToSet(from.value, set)\n set.push(cc('-'))\n insertToSet(to.value, set)\n }\n } else {\n insertToSet(from.value, set)\n }\n }\n this.consumeChar(']')\n return { type: 'Set', complement: complement, value: set }\n }\n classAtom() {\n switch (this.peekChar()) {\n // istanbul ignore next\n case ']':\n // istanbul ignore next\n case '\\n':\n // istanbul ignore next\n case '\\r':\n // istanbul ignore next\n case '\\u2028':\n // istanbul ignore next\n case '\\u2029':\n throw Error('TBD')\n case '\\\\':\n return this.classEscape()\n default:\n return this.classPatternCharacterAtom()\n }\n }\n classEscape() {\n this.consumeChar('\\\\')\n switch (this.peekChar()) {\n // Matches a backspace.\n // (Not to be confused with \\b word boundary outside characterClass)\n case 'b':\n this.consumeChar('b')\n return { type: 'Character', value: cc('\\u0008') }\n case 'd':\n case 'D':\n case 's':\n case 'S':\n case 'w':\n case 'W':\n return this.characterClassEscape()\n case 'f':\n case 'n':\n case 'r':\n case 't':\n case 'v':\n return this.controlEscapeAtom()\n case 'c':\n return this.controlLetterEscapeAtom()\n case '0':\n return this.nulCharacterAtom()\n case 'x':\n return this.hexEscapeSequenceAtom()\n case 'u':\n return this.regExpUnicodeEscapeSequenceAtom()\n default:\n return this.identityEscapeAtom()\n }\n }\n group() {\n let capturing = true\n this.consumeChar('(')\n switch (this.peekChar(0)) {\n case '?':\n this.consumeChar('?')\n this.consumeChar(':')\n capturing = false\n break\n default:\n this.groupIdx++\n break\n }\n const value = this.disjunction()\n this.consumeChar(')')\n const groupAst = {\n type: 'Group',\n capturing: capturing,\n value: value,\n }\n if (capturing) {\n groupAst['idx'] = this.groupIdx\n }\n return groupAst\n }\n positiveInteger() {\n let number = this.popChar()\n // istanbul ignore next - can't ever get here due to previous lookahead checks\n // still implementing this error checking in case this ever changes.\n if (decimalPatternNoZero.test(number) === false) {\n throw Error('Expecting a positive integer')\n }\n while (decimalPattern.test(this.peekChar(0))) {\n number += this.popChar()\n }\n return parseInt(number, 10)\n }\n integerIncludingZero() {\n let number = this.popChar()\n if (decimalPattern.test(number) === false) {\n throw Error('Expecting an integer')\n }\n while (decimalPattern.test(this.peekChar(0))) {\n number += this.popChar()\n }\n return parseInt(number, 10)\n }\n patternCharacter() {\n const nextChar = this.popChar()\n switch (nextChar) {\n // istanbul ignore next\n case '\\n':\n // istanbul ignore next\n case '\\r':\n // istanbul ignore next\n case '\\u2028':\n // istanbul ignore next\n case '\\u2029':\n // istanbul ignore next\n case '^':\n // istanbul ignore next\n case '$':\n // istanbul ignore next\n case '\\\\':\n // istanbul ignore next\n case '.':\n // istanbul ignore next\n case '*':\n // istanbul ignore next\n case '+':\n // istanbul ignore next\n case '?':\n // istanbul ignore next\n case '(':\n // istanbul ignore next\n case ')':\n // istanbul ignore next\n case '[':\n // istanbul ignore next\n case '|':\n // istanbul ignore next\n throw Error('TBD')\n default:\n return { type: 'Character', value: cc(nextChar) }\n }\n }\n isRegExpFlag() {\n switch (this.peekChar(0)) {\n case 'g':\n case 'i':\n case 'm':\n case 'u':\n case 'y':\n return true\n default:\n return false\n }\n }\n isRangeDash() {\n return this.peekChar() === '-' && this.isClassAtom(1)\n }\n isDigit() {\n return decimalPattern.test(this.peekChar(0))\n }\n isClassAtom(howMuch = 0) {\n switch (this.peekChar(howMuch)) {\n case ']':\n case '\\n':\n case '\\r':\n case '\\u2028':\n case '\\u2029':\n return false\n default:\n return true\n }\n }\n isTerm() {\n return this.isAtom() || this.isAssertion()\n }\n isAtom() {\n if (this.isPatternCharacter()) {\n return true\n }\n switch (this.peekChar(0)) {\n case '.':\n case '\\\\': // atomEscape\n case '[': // characterClass\n // TODO: isAtom must be called before isAssertion - disambiguate\n case '(': // group\n return true\n default:\n return false\n }\n }\n isAssertion() {\n switch (this.peekChar(0)) {\n case '^':\n case '$':\n return true\n // '\\b' or '\\B'\n case '\\\\':\n switch (this.peekChar(1)) {\n case 'b':\n case 'B':\n return true\n default:\n return false\n }\n // '(?=' or '(?!'\n case '(':\n return this.peekChar(1) === '?' && (this.peekChar(2) === '=' || this.peekChar(2) === '!')\n default:\n return false\n }\n }\n isQuantifier() {\n const prevState = this.saveState()\n try {\n return this.quantifier(true) !== undefined\n } catch (e) {\n return false\n } finally {\n this.restoreState(prevState)\n }\n }\n isPatternCharacter() {\n switch (this.peekChar()) {\n case '^':\n case '$':\n case '\\\\':\n case '.':\n case '*':\n case '+':\n case '?':\n case '(':\n case ')':\n case '[':\n case '|':\n case '/':\n case '\\n':\n case '\\r':\n case '\\u2028':\n case '\\u2029':\n return false\n default:\n return true\n }\n }\n parseHexDigits(howMany) {\n let hexString = ''\n for (let i = 0; i < howMany; i++) {\n const hexChar = this.popChar()\n if (hexDigitPattern.test(hexChar) === false) {\n throw Error('Expecting a HexDecimal digits')\n }\n hexString += hexChar\n }\n const charCode = parseInt(hexString, 16)\n return { type: 'Character', value: charCode }\n }\n peekChar(howMuch = 0) {\n return this.input[this.idx + howMuch]\n }\n popChar() {\n const nextChar = this.peekChar(0)\n this.consumeChar(undefined)\n return nextChar\n }\n consumeChar(char) {\n if (char !== undefined && this.input[this.idx] !== char) {\n throw Error(\"Expected: '\" + char + \"' but found: '\" + this.input[this.idx] + \"' at offset: \" + this.idx)\n }\n if (this.idx >= this.input.length) {\n throw Error('Unexpected end of input')\n }\n this.idx++\n }\n loc(begin) {\n return { begin: begin, end: this.idx }\n }\n }\n\n class BaseRegExpVisitor {\n visitChildren(node) {\n for (const key in node) {\n const child = node[key]\n /* istanbul ignore else */\n if (node.hasOwnProperty(key)) {\n if (child.type !== undefined) {\n this.visit(child)\n } else if (Array.isArray(child)) {\n child.forEach((subChild) => {\n this.visit(subChild)\n }, this)\n }\n }\n }\n }\n visit(node) {\n switch (node.type) {\n case 'Pattern':\n this.visitPattern(node)\n break\n case 'Flags':\n this.visitFlags(node)\n break\n case 'Disjunction':\n this.visitDisjunction(node)\n break\n case 'Alternative':\n this.visitAlternative(node)\n break\n case 'StartAnchor':\n this.visitStartAnchor(node)\n break\n case 'EndAnchor':\n this.visitEndAnchor(node)\n break\n case 'WordBoundary':\n this.visitWordBoundary(node)\n break\n case 'NonWordBoundary':\n this.visitNonWordBoundary(node)\n break\n case 'Lookahead':\n this.visitLookahead(node)\n break\n case 'NegativeLookahead':\n this.visitNegativeLookahead(node)\n break\n case 'Character':\n this.visitCharacter(node)\n break\n case 'Set':\n this.visitSet(node)\n break\n case 'Group':\n this.visitGroup(node)\n break\n case 'GroupBackReference':\n this.visitGroupBackReference(node)\n break\n case 'Quantifier':\n this.visitQuantifier(node)\n break\n }\n this.visitChildren(node)\n }\n visitPattern(node) {}\n visitFlags(node) {}\n visitDisjunction(node) {}\n visitAlternative(node) {}\n // Assertion\n visitStartAnchor(node) {}\n visitEndAnchor(node) {}\n visitWordBoundary(node) {}\n visitNonWordBoundary(node) {}\n visitLookahead(node) {}\n visitNegativeLookahead(node) {}\n // atoms\n visitCharacter(node) {}\n visitSet(node) {}\n visitGroup(node) {}\n visitGroupBackReference(node) {}\n visitQuantifier(node) {}\n }\n\n let regExpAstCache = {}\n const regExpParser = new RegExpParser()\n function getRegExpAst(regExp) {\n const regExpStr = regExp.toString()\n if (regExpAstCache.hasOwnProperty(regExpStr)) {\n return regExpAstCache[regExpStr]\n } else {\n const regExpAst = regExpParser.pattern(regExpStr)\n regExpAstCache[regExpStr] = regExpAst\n return regExpAst\n }\n }\n function clearRegExpParserCache() {\n regExpAstCache = {}\n }\n\n const complementErrorMessage = 'Complement Sets are not supported for first char optimization'\n const failedOptimizationPrefixMsg = 'Unable to use \"first char\" lexer optimizations:\\n'\n function getOptimizedStartCodesIndices(regExp, ensureOptimizations = false) {\n try {\n const ast = getRegExpAst(regExp)\n const firstChars = firstCharOptimizedIndices(ast.value, {}, ast.flags.ignoreCase)\n return firstChars\n } catch (e) {\n /* istanbul ignore next */\n // Testing this relies on the regexp-to-ast library having a bug... */\n // TODO: only the else branch needs to be ignored, try to fix with newer prettier / tsc\n if (e.message === complementErrorMessage) {\n if (ensureOptimizations) {\n PRINT_WARNING(\n `${failedOptimizationPrefixMsg}` +\n `\\tUnable to optimize: < ${regExp.toString()} >\\n` +\n '\\tComplement Sets cannot be automatically optimized.\\n' +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.',\n )\n }\n } else {\n let msgSuffix = ''\n if (ensureOptimizations) {\n msgSuffix =\n \"\\n\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.'\n }\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}\\n` +\n `\\tFailed parsing: < ${regExp.toString()} >\\n` +\n `\\tUsing the @chevrotain/regexp-to-ast library\\n` +\n '\\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues' +\n msgSuffix,\n )\n }\n }\n return []\n }\n function firstCharOptimizedIndices(ast, result, ignoreCase) {\n switch (ast.type) {\n case 'Disjunction':\n for (let i = 0; i < ast.value.length; i++) {\n firstCharOptimizedIndices(ast.value[i], result, ignoreCase)\n }\n break\n case 'Alternative':\n const terms = ast.value\n for (let i = 0; i < terms.length; i++) {\n const term = terms[i]\n // skip terms that cannot effect the first char results\n switch (term.type) {\n case 'EndAnchor':\n // A group back reference cannot affect potential starting char.\n // because if a back reference is the first production than automatically\n // the group being referenced has had to come BEFORE so its codes have already been added\n case 'GroupBackReference':\n // assertions do not affect potential starting codes\n case 'Lookahead':\n case 'NegativeLookahead':\n case 'StartAnchor':\n case 'WordBoundary':\n case 'NonWordBoundary':\n continue\n }\n const atom = term\n switch (atom.type) {\n case 'Character':\n addOptimizedIdxToResult(atom.value, result, ignoreCase)\n break\n case 'Set':\n if (atom.complement === true) {\n throw Error(complementErrorMessage)\n }\n forEach(atom.value, (code) => {\n if (typeof code === 'number') {\n addOptimizedIdxToResult(code, result, ignoreCase)\n } else {\n // range\n const range = code\n // cannot optimize when ignoreCase is\n if (ignoreCase === true) {\n for (let rangeCode = range.from; rangeCode <= range.to; rangeCode++) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase)\n }\n }\n // Optimization (2 orders of magnitude less work for very large ranges)\n else {\n // handle unoptimized values\n for (\n let rangeCode = range.from;\n rangeCode <= range.to && rangeCode < minOptimizationVal;\n rangeCode++\n ) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase)\n }\n // Less common charCode where we optimize for faster init time, by using larger \"buckets\"\n if (range.to >= minOptimizationVal) {\n const minUnOptVal = range.from >= minOptimizationVal ? range.from : minOptimizationVal\n const maxUnOptVal = range.to\n const minOptIdx = charCodeToOptimizedIndex(minUnOptVal)\n const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal)\n for (let currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) {\n result[currOptIdx] = currOptIdx\n }\n }\n }\n }\n })\n break\n case 'Group':\n firstCharOptimizedIndices(atom.value, result, ignoreCase)\n break\n /* istanbul ignore next */\n default:\n throw Error('Non Exhaustive Match')\n }\n // reached a mandatory production, no more **start** codes can be found on this alternative\n const isOptionalQuantifier = atom.quantifier !== undefined && atom.quantifier.atLeast === 0\n if (\n // A group may be optional due to empty contents /(?:)/\n // or if everything inside it is optional /((a)?)/\n (atom.type === 'Group' && isWholeOptional(atom) === false) ||\n // If this term is not a group it may only be optional if it has an optional quantifier\n (atom.type !== 'Group' && isOptionalQuantifier === false)\n ) {\n break\n }\n }\n break\n /* istanbul ignore next */\n default:\n throw Error('non exhaustive match!')\n }\n // console.log(Object.keys(result).length)\n return values(result)\n }\n function addOptimizedIdxToResult(code, result, ignoreCase) {\n const optimizedCharIdx = charCodeToOptimizedIndex(code)\n result[optimizedCharIdx] = optimizedCharIdx\n if (ignoreCase === true) {\n handleIgnoreCase(code, result)\n }\n }\n function handleIgnoreCase(code, result) {\n const char = String.fromCharCode(code)\n const upperChar = char.toUpperCase()\n /* istanbul ignore else */\n if (upperChar !== char) {\n const optimizedCharIdx = charCodeToOptimizedIndex(upperChar.charCodeAt(0))\n result[optimizedCharIdx] = optimizedCharIdx\n } else {\n const lowerChar = char.toLowerCase()\n if (lowerChar !== char) {\n const optimizedCharIdx = charCodeToOptimizedIndex(lowerChar.charCodeAt(0))\n result[optimizedCharIdx] = optimizedCharIdx\n }\n }\n }\n function findCode(setNode, targetCharCodes) {\n return find$1(setNode.value, (codeOrRange) => {\n if (typeof codeOrRange === 'number') {\n return includes(targetCharCodes, codeOrRange)\n } else {\n // range\n const range = codeOrRange\n return find$1(targetCharCodes, (targetCode) => range.from <= targetCode && targetCode <= range.to) !== undefined\n }\n })\n }\n function isWholeOptional(ast) {\n const quantifier = ast.quantifier\n if (quantifier && quantifier.atLeast === 0) {\n return true\n }\n if (!ast.value) {\n return false\n }\n return isArray$1(ast.value) ? every(ast.value, isWholeOptional) : isWholeOptional(ast.value)\n }\n class CharCodeFinder extends BaseRegExpVisitor {\n constructor(targetCharCodes) {\n super()\n this.targetCharCodes = targetCharCodes\n this.found = false\n }\n visitChildren(node) {\n // No need to keep looking...\n if (this.found === true) {\n return\n }\n // switch lookaheads as they do not actually consume any characters thus\n // finding a charCode at lookahead context does not mean that regexp can actually contain it in a match.\n switch (node.type) {\n case 'Lookahead':\n this.visitLookahead(node)\n return\n case 'NegativeLookahead':\n this.visitNegativeLookahead(node)\n return\n }\n super.visitChildren(node)\n }\n visitCharacter(node) {\n if (includes(this.targetCharCodes, node.value)) {\n this.found = true\n }\n }\n visitSet(node) {\n if (node.complement) {\n if (findCode(node, this.targetCharCodes) === undefined) {\n this.found = true\n }\n } else {\n if (findCode(node, this.targetCharCodes) !== undefined) {\n this.found = true\n }\n }\n }\n }\n function canMatchCharCode(charCodes, pattern) {\n if (pattern instanceof RegExp) {\n const ast = getRegExpAst(pattern)\n const charCodeFinder = new CharCodeFinder(charCodes)\n charCodeFinder.visit(ast)\n return charCodeFinder.found\n } else {\n return (\n find$1(pattern, (char) => {\n return includes(charCodes, char.charCodeAt(0))\n }) !== undefined\n )\n }\n }\n\n const PATTERN = 'PATTERN'\n const DEFAULT_MODE = 'defaultMode'\n const MODES = 'modes'\n let SUPPORT_STICKY = typeof new RegExp('(?:)').sticky === 'boolean'\n function analyzeTokenTypes(tokenTypes, options) {\n options = defaults$1(options, {\n useSticky: SUPPORT_STICKY,\n debug: false,\n safeMode: false,\n positionTracking: 'full',\n lineTerminatorCharacters: ['\\r', '\\n'],\n tracer: (msg, action) => action(),\n })\n const tracer = options.tracer\n tracer('initCharCodeToOptimizedIndexMap', () => {\n initCharCodeToOptimizedIndexMap()\n })\n let onlyRelevantTypes\n tracer('Reject Lexer.NA', () => {\n onlyRelevantTypes = reject(tokenTypes, (currType) => {\n return currType[PATTERN] === Lexer.NA\n })\n })\n let hasCustom = false\n let allTransformedPatterns\n tracer('Transform Patterns', () => {\n hasCustom = false\n allTransformedPatterns = map(onlyRelevantTypes, (currType) => {\n const currPattern = currType[PATTERN]\n /* istanbul ignore else */\n if (isRegExp$1(currPattern)) {\n const regExpSource = currPattern.source\n if (\n regExpSource.length === 1 &&\n // only these regExp meta characters which can appear in a length one regExp\n regExpSource !== '^' &&\n regExpSource !== '$' &&\n regExpSource !== '.' &&\n !currPattern.ignoreCase\n ) {\n return regExpSource\n } else if (\n regExpSource.length === 2 &&\n regExpSource[0] === '\\\\' &&\n // not a meta character\n !includes(['d', 'D', 's', 'S', 't', 'r', 'n', 't', '0', 'c', 'b', 'B', 'f', 'v', 'w', 'W'], regExpSource[1])\n ) {\n // escaped meta Characters: /\\+/ /\\[/\n // or redundant escaping: /\\a/\n // without the escaping \"\\\"\n return regExpSource[1]\n } else {\n return options.useSticky ? addStickyFlag(currPattern) : addStartOfInput(currPattern)\n }\n } else if (isFunction(currPattern)) {\n hasCustom = true\n // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object\n return { exec: currPattern }\n } else if (typeof currPattern === 'object') {\n hasCustom = true\n // ICustomPattern\n return currPattern\n } else if (typeof currPattern === 'string') {\n if (currPattern.length === 1) {\n return currPattern\n } else {\n const escapedRegExpString = currPattern.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n const wrappedRegExp = new RegExp(escapedRegExpString)\n return options.useSticky ? addStickyFlag(wrappedRegExp) : addStartOfInput(wrappedRegExp)\n }\n } else {\n throw Error('non exhaustive match')\n }\n })\n })\n let patternIdxToType\n let patternIdxToGroup\n let patternIdxToLongerAltIdxArr\n let patternIdxToPushMode\n let patternIdxToPopMode\n tracer('misc mapping', () => {\n patternIdxToType = map(onlyRelevantTypes, (currType) => currType.tokenTypeIdx)\n patternIdxToGroup = map(onlyRelevantTypes, (clazz) => {\n const groupName = clazz.GROUP\n /* istanbul ignore next */\n if (groupName === Lexer.SKIPPED) {\n return undefined\n } else if (isString(groupName)) {\n return groupName\n } else if (isUndefined(groupName)) {\n return false\n } else {\n throw Error('non exhaustive match')\n }\n })\n patternIdxToLongerAltIdxArr = map(onlyRelevantTypes, (clazz) => {\n const longerAltType = clazz.LONGER_ALT\n if (longerAltType) {\n const longerAltIdxArr = isArray$1(longerAltType)\n ? map(longerAltType, (type) => indexOf(onlyRelevantTypes, type))\n : [indexOf(onlyRelevantTypes, longerAltType)]\n return longerAltIdxArr\n }\n })\n patternIdxToPushMode = map(onlyRelevantTypes, (clazz) => clazz.PUSH_MODE)\n patternIdxToPopMode = map(onlyRelevantTypes, (clazz) => has(clazz, 'POP_MODE'))\n })\n let patternIdxToCanLineTerminator\n tracer('Line Terminator Handling', () => {\n const lineTerminatorCharCodes = getCharCodes(options.lineTerminatorCharacters)\n patternIdxToCanLineTerminator = map(onlyRelevantTypes, (tokType) => false)\n if (options.positionTracking !== 'onlyOffset') {\n patternIdxToCanLineTerminator = map(onlyRelevantTypes, (tokType) => {\n if (has(tokType, 'LINE_BREAKS')) {\n return !!tokType.LINE_BREAKS\n } else {\n return (\n checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false &&\n canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN)\n )\n }\n })\n }\n })\n let patternIdxToIsCustom\n let patternIdxToShort\n let emptyGroups\n let patternIdxToConfig\n tracer('Misc Mapping #2', () => {\n patternIdxToIsCustom = map(onlyRelevantTypes, isCustomPattern)\n patternIdxToShort = map(allTransformedPatterns, isShortPattern)\n emptyGroups = reduce(\n onlyRelevantTypes,\n (acc, clazz) => {\n const groupName = clazz.GROUP\n if (isString(groupName) && !(groupName === Lexer.SKIPPED)) {\n acc[groupName] = []\n }\n return acc\n },\n {},\n )\n patternIdxToConfig = map(allTransformedPatterns, (x, idx) => {\n return {\n pattern: allTransformedPatterns[idx],\n longerAlt: patternIdxToLongerAltIdxArr[idx],\n canLineTerminator: patternIdxToCanLineTerminator[idx],\n isCustom: patternIdxToIsCustom[idx],\n short: patternIdxToShort[idx],\n group: patternIdxToGroup[idx],\n push: patternIdxToPushMode[idx],\n pop: patternIdxToPopMode[idx],\n tokenTypeIdx: patternIdxToType[idx],\n tokenType: onlyRelevantTypes[idx],\n }\n })\n })\n let canBeOptimized = true\n let charCodeToPatternIdxToConfig = []\n if (!options.safeMode) {\n tracer('First Char Optimization', () => {\n charCodeToPatternIdxToConfig = reduce(\n onlyRelevantTypes,\n (result, currTokType, idx) => {\n if (typeof currTokType.PATTERN === 'string') {\n const charCode = currTokType.PATTERN.charCodeAt(0)\n const optimizedIdx = charCodeToOptimizedIndex(charCode)\n addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx])\n } else if (isArray$1(currTokType.START_CHARS_HINT)) {\n let lastOptimizedIdx\n forEach(currTokType.START_CHARS_HINT, (charOrInt) => {\n const charCode = typeof charOrInt === 'string' ? charOrInt.charCodeAt(0) : charOrInt\n const currOptimizedIdx = charCodeToOptimizedIndex(charCode)\n // Avoid adding the config multiple times\n /* istanbul ignore else */\n // - Difficult to check this scenario effects as it is only a performance\n // optimization that does not change correctness\n if (lastOptimizedIdx !== currOptimizedIdx) {\n lastOptimizedIdx = currOptimizedIdx\n addToMapOfArrays(result, currOptimizedIdx, patternIdxToConfig[idx])\n }\n })\n } else if (isRegExp$1(currTokType.PATTERN)) {\n if (currTokType.PATTERN.unicode) {\n canBeOptimized = false\n if (options.ensureOptimizations) {\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}` +\n `\\tUnable to analyze < ${currTokType.PATTERN.toString()} > pattern.\\n` +\n '\\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\\n' +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE',\n )\n }\n } else {\n const optimizedCodes = getOptimizedStartCodesIndices(currTokType.PATTERN, options.ensureOptimizations)\n /* istanbul ignore if */\n // start code will only be empty given an empty regExp or failure of regexp-to-ast library\n // the first should be a different validation and the second cannot be tested.\n if (isEmpty(optimizedCodes)) {\n // we cannot understand what codes may start possible matches\n // The optimization correctness requires knowing start codes for ALL patterns.\n // Not actually sure this is an error, no debug message\n canBeOptimized = false\n }\n forEach(optimizedCodes, (code) => {\n addToMapOfArrays(result, code, patternIdxToConfig[idx])\n })\n }\n } else {\n if (options.ensureOptimizations) {\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}` +\n `\\tTokenType: <${currTokType.name}> is using a custom token pattern without providing parameter.\\n` +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE',\n )\n }\n canBeOptimized = false\n }\n return result\n },\n [],\n )\n })\n }\n return {\n emptyGroups: emptyGroups,\n patternIdxToConfig: patternIdxToConfig,\n charCodeToPatternIdxToConfig: charCodeToPatternIdxToConfig,\n hasCustom: hasCustom,\n canBeOptimized: canBeOptimized,\n }\n }\n function validatePatterns(tokenTypes, validModesNames) {\n let errors = []\n const missingResult = findMissingPatterns(tokenTypes)\n errors = errors.concat(missingResult.errors)\n const invalidResult = findInvalidPatterns(missingResult.valid)\n const validTokenTypes = invalidResult.valid\n errors = errors.concat(invalidResult.errors)\n errors = errors.concat(validateRegExpPattern(validTokenTypes))\n errors = errors.concat(findInvalidGroupType(validTokenTypes))\n errors = errors.concat(findModesThatDoNotExist(validTokenTypes, validModesNames))\n errors = errors.concat(findUnreachablePatterns(validTokenTypes))\n return errors\n }\n function validateRegExpPattern(tokenTypes) {\n let errors = []\n const withRegExpPatterns = filter(tokenTypes, (currTokType) => isRegExp$1(currTokType[PATTERN]))\n errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns))\n errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns))\n errors = errors.concat(findUnsupportedFlags(withRegExpPatterns))\n errors = errors.concat(findDuplicatePatterns(withRegExpPatterns))\n errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns))\n return errors\n }\n function findMissingPatterns(tokenTypes) {\n const tokenTypesWithMissingPattern = filter(tokenTypes, (currType) => {\n return !has(currType, PATTERN)\n })\n const errors = map(tokenTypesWithMissingPattern, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- missing static 'PATTERN' property\",\n type: LexerDefinitionErrorType.MISSING_PATTERN,\n tokenTypes: [currType],\n }\n })\n const valid = difference$1(tokenTypes, tokenTypesWithMissingPattern)\n return { errors, valid }\n }\n function findInvalidPatterns(tokenTypes) {\n const tokenTypesWithInvalidPattern = filter(tokenTypes, (currType) => {\n const pattern = currType[PATTERN]\n return !isRegExp$1(pattern) && !isFunction(pattern) && !has(pattern, 'exec') && !isString(pattern)\n })\n const errors = map(tokenTypesWithInvalidPattern, (currType) => {\n return {\n message:\n 'Token Type: ->' +\n currType.name +\n \"<- static 'PATTERN' can only be a RegExp, a\" +\n ' Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.',\n type: LexerDefinitionErrorType.INVALID_PATTERN,\n tokenTypes: [currType],\n }\n })\n const valid = difference$1(tokenTypes, tokenTypesWithInvalidPattern)\n return { errors, valid }\n }\n const end_of_input = /[^\\\\][$]/\n function findEndOfInputAnchor(tokenTypes) {\n class EndAnchorFinder extends BaseRegExpVisitor {\n constructor() {\n super(...arguments)\n this.found = false\n }\n visitEndAnchor(node) {\n this.found = true\n }\n }\n const invalidRegex = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN\n try {\n const regexpAst = getRegExpAst(pattern)\n const endAnchorVisitor = new EndAnchorFinder()\n endAnchorVisitor.visit(regexpAst)\n return endAnchorVisitor.found\n } catch (e) {\n // old behavior in case of runtime exceptions with regexp-to-ast.\n /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/\n return end_of_input.test(pattern.source)\n }\n })\n const errors = map(invalidRegex, (currType) => {\n return {\n message:\n 'Unexpected RegExp Anchor Error:\\n' +\n '\\tToken Type: ->' +\n currType.name +\n \"<- static 'PATTERN' cannot contain end of input anchor '$'\\n\" +\n '\\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS' +\n '\\tfor details.',\n type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n function findEmptyMatchRegExps(tokenTypes) {\n const matchesEmptyString = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN\n return pattern.test('')\n })\n const errors = map(matchesEmptyString, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- static 'PATTERN' must not match an empty string\",\n type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n const start_of_input = /[^\\\\[][\\^]|^\\^/\n function findStartOfInputAnchor(tokenTypes) {\n class StartAnchorFinder extends BaseRegExpVisitor {\n constructor() {\n super(...arguments)\n this.found = false\n }\n visitStartAnchor(node) {\n this.found = true\n }\n }\n const invalidRegex = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN\n try {\n const regexpAst = getRegExpAst(pattern)\n const startAnchorVisitor = new StartAnchorFinder()\n startAnchorVisitor.visit(regexpAst)\n return startAnchorVisitor.found\n } catch (e) {\n // old behavior in case of runtime exceptions with regexp-to-ast.\n /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/\n return start_of_input.test(pattern.source)\n }\n })\n const errors = map(invalidRegex, (currType) => {\n return {\n message:\n 'Unexpected RegExp Anchor Error:\\n' +\n '\\tToken Type: ->' +\n currType.name +\n \"<- static 'PATTERN' cannot contain start of input anchor '^'\\n\" +\n '\\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS' +\n '\\tfor details.',\n type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n function findUnsupportedFlags(tokenTypes) {\n const invalidFlags = filter(tokenTypes, (currType) => {\n const pattern = currType[PATTERN]\n return pattern instanceof RegExp && (pattern.multiline || pattern.global)\n })\n const errors = map(invalidFlags, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- static 'PATTERN' may NOT contain global('g') or multiline('m')\",\n type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n // This can only test for identical duplicate RegExps, not semantically equivalent ones.\n function findDuplicatePatterns(tokenTypes) {\n const found = []\n let identicalPatterns = map(tokenTypes, (outerType) => {\n return reduce(\n tokenTypes,\n (result, innerType) => {\n if (\n outerType.PATTERN.source === innerType.PATTERN.source &&\n !includes(found, innerType) &&\n innerType.PATTERN !== Lexer.NA\n ) {\n // this avoids duplicates in the result, each Token Type may only appear in one \"set\"\n // in essence we are creating Equivalence classes on equality relation.\n found.push(innerType)\n result.push(innerType)\n return result\n }\n return result\n },\n [],\n )\n })\n identicalPatterns = compact(identicalPatterns)\n const duplicatePatterns = filter(identicalPatterns, (currIdenticalSet) => {\n return currIdenticalSet.length > 1\n })\n const errors = map(duplicatePatterns, (setOfIdentical) => {\n const tokenTypeNames = map(setOfIdentical, (currType) => {\n return currType.name\n })\n const dupPatternSrc = head(setOfIdentical).PATTERN\n return {\n message:\n `The same RegExp pattern ->${dupPatternSrc}<-` +\n `has been used in all of the following Token Types: ${tokenTypeNames.join(', ')} <-`,\n type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,\n tokenTypes: setOfIdentical,\n }\n })\n return errors\n }\n function findInvalidGroupType(tokenTypes) {\n const invalidTypes = filter(tokenTypes, (clazz) => {\n if (!has(clazz, 'GROUP')) {\n return false\n }\n const group = clazz.GROUP\n return group !== Lexer.SKIPPED && group !== Lexer.NA && !isString(group)\n })\n const errors = map(invalidTypes, (currType) => {\n return {\n message: 'Token Type: ->' + currType.name + \"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String\",\n type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,\n tokenTypes: [currType],\n }\n })\n return errors\n }\n function findModesThatDoNotExist(tokenTypes, validModes) {\n const invalidModes = filter(tokenTypes, (clazz) => {\n return clazz.PUSH_MODE !== undefined && !includes(validModes, clazz.PUSH_MODE)\n })\n const errors = map(invalidModes, (tokType) => {\n const msg =\n `Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-` +\n `which does not exist`\n return {\n message: msg,\n type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,\n tokenTypes: [tokType],\n }\n })\n return errors\n }\n function findUnreachablePatterns(tokenTypes) {\n const errors = []\n const canBeTested = reduce(\n tokenTypes,\n (result, tokType, idx) => {\n const pattern = tokType.PATTERN\n if (pattern === Lexer.NA) {\n return result\n }\n // a more comprehensive validation for all forms of regExps would require\n // deeper regExp analysis capabilities\n if (isString(pattern)) {\n result.push({ str: pattern, idx, tokenType: tokType })\n } else if (isRegExp$1(pattern) && noMetaChar(pattern)) {\n result.push({ str: pattern.source, idx, tokenType: tokType })\n }\n return result\n },\n [],\n )\n forEach(tokenTypes, (tokType, testIdx) => {\n forEach(canBeTested, ({ str, idx, tokenType }) => {\n if (testIdx < idx && testTokenType(str, tokType.PATTERN)) {\n const msg =\n `Token: ->${tokenType.name}<- can never be matched.\\n` +\n `Because it appears AFTER the Token Type ->${tokType.name}<-` +\n `in the lexer's definition.\\n` +\n `See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`\n errors.push({\n message: msg,\n type: LexerDefinitionErrorType.UNREACHABLE_PATTERN,\n tokenTypes: [tokType, tokenType],\n })\n }\n })\n })\n return errors\n }\n function testTokenType(str, pattern) {\n /* istanbul ignore else */\n if (isRegExp$1(pattern)) {\n const regExpArray = pattern.exec(str)\n return regExpArray !== null && regExpArray.index === 0\n } else if (isFunction(pattern)) {\n // maintain the API of custom patterns\n return pattern(str, 0, [], {})\n } else if (has(pattern, 'exec')) {\n // maintain the API of custom patterns\n return pattern.exec(str, 0, [], {})\n } else if (typeof pattern === 'string') {\n return pattern === str\n } else {\n throw Error('non exhaustive match')\n }\n }\n function noMetaChar(regExp) {\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n const metaChars = ['.', '\\\\', '[', ']', '|', '^', '$', '(', ')', '?', '*', '+', '{']\n return find$1(metaChars, (char) => regExp.source.indexOf(char) !== -1) === undefined\n }\n function addStartOfInput(pattern) {\n const flags = pattern.ignoreCase ? 'i' : ''\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(`^(?:${pattern.source})`, flags)\n }\n function addStickyFlag(pattern) {\n const flags = pattern.ignoreCase ? 'iy' : 'y'\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(`${pattern.source}`, flags)\n }\n function performRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {\n const errors = []\n // some run time checks to help the end users.\n if (!has(lexerDefinition, DEFAULT_MODE)) {\n errors.push({\n message:\n 'A MultiMode Lexer cannot be initialized without a <' + DEFAULT_MODE + '> property in its definition\\n',\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE,\n })\n }\n if (!has(lexerDefinition, MODES)) {\n errors.push({\n message: 'A MultiMode Lexer cannot be initialized without a <' + MODES + '> property in its definition\\n',\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY,\n })\n }\n if (\n has(lexerDefinition, MODES) &&\n has(lexerDefinition, DEFAULT_MODE) &&\n !has(lexerDefinition.modes, lexerDefinition.defaultMode)\n ) {\n errors.push({\n message:\n `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${lexerDefinition.defaultMode}>` +\n `which does not exist\\n`,\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST,\n })\n }\n if (has(lexerDefinition, MODES)) {\n forEach(lexerDefinition.modes, (currModeValue, currModeName) => {\n forEach(currModeValue, (currTokType, currIdx) => {\n if (isUndefined(currTokType)) {\n errors.push({\n message:\n `A Lexer cannot be initialized using an undefined Token Type. Mode:` +\n `<${currModeName}> at index: <${currIdx}>\\n`,\n type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED,\n })\n } else if (has(currTokType, 'LONGER_ALT')) {\n const longerAlt = isArray$1(currTokType.LONGER_ALT) ? currTokType.LONGER_ALT : [currTokType.LONGER_ALT]\n forEach(longerAlt, (currLongerAlt) => {\n if (!isUndefined(currLongerAlt) && !includes(currModeValue, currLongerAlt)) {\n errors.push({\n message: `A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}>\\n`,\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE,\n })\n }\n })\n }\n })\n })\n }\n return errors\n }\n function performWarningRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {\n const warnings = []\n let hasAnyLineBreak = false\n const allTokenTypes = compact(flatten(values(lexerDefinition.modes)))\n const concreteTokenTypes = reject(allTokenTypes, (currType) => currType[PATTERN] === Lexer.NA)\n const terminatorCharCodes = getCharCodes(lineTerminatorCharacters)\n if (trackLines) {\n forEach(concreteTokenTypes, (tokType) => {\n const currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes)\n if (currIssue !== false) {\n const message = buildLineBreakIssueMessage(tokType, currIssue)\n const warningDescriptor = {\n message,\n type: currIssue.issue,\n tokenType: tokType,\n }\n warnings.push(warningDescriptor)\n } else {\n // we don't want to attempt to scan if the user explicitly specified the line_breaks option.\n if (has(tokType, 'LINE_BREAKS')) {\n if (tokType.LINE_BREAKS === true) {\n hasAnyLineBreak = true\n }\n } else {\n if (canMatchCharCode(terminatorCharCodes, tokType.PATTERN)) {\n hasAnyLineBreak = true\n }\n }\n }\n })\n }\n if (trackLines && !hasAnyLineBreak) {\n warnings.push({\n message:\n 'Warning: No LINE_BREAKS Found.\\n' +\n '\\tThis Lexer has been defined to track line and column information,\\n' +\n '\\tBut none of the Token Types can be identified as matching a line terminator.\\n' +\n '\\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \\n' +\n '\\tfor details.',\n type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS,\n })\n }\n return warnings\n }\n function cloneEmptyGroups(emptyGroups) {\n const clonedResult = {}\n const groupKeys = keys(emptyGroups)\n forEach(groupKeys, (currKey) => {\n const currGroupValue = emptyGroups[currKey]\n /* istanbul ignore else */\n if (isArray$1(currGroupValue)) {\n clonedResult[currKey] = []\n } else {\n throw Error('non exhaustive match')\n }\n })\n return clonedResult\n }\n // TODO: refactor to avoid duplication\n function isCustomPattern(tokenType) {\n const pattern = tokenType.PATTERN\n /* istanbul ignore else */\n if (isRegExp$1(pattern)) {\n return false\n } else if (isFunction(pattern)) {\n // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object\n return true\n } else if (has(pattern, 'exec')) {\n // ICustomPattern\n return true\n } else if (isString(pattern)) {\n return false\n } else {\n throw Error('non exhaustive match')\n }\n }\n function isShortPattern(pattern) {\n if (isString(pattern) && pattern.length === 1) {\n return pattern.charCodeAt(0)\n } else {\n return false\n }\n }\n /**\n * Faster than using a RegExp for default newline detection during lexing.\n */\n const LineTerminatorOptimizedTester = {\n // implements /\\n|\\r\\n?/g.test\n test: function (text) {\n const len = text.length\n for (let i = this.lastIndex; i < len; i++) {\n const c = text.charCodeAt(i)\n if (c === 10) {\n this.lastIndex = i + 1\n return true\n } else if (c === 13) {\n if (text.charCodeAt(i + 1) === 10) {\n this.lastIndex = i + 2\n } else {\n this.lastIndex = i + 1\n }\n return true\n }\n }\n return false\n },\n lastIndex: 0,\n }\n function checkLineBreaksIssues(tokType, lineTerminatorCharCodes) {\n if (has(tokType, 'LINE_BREAKS')) {\n // if the user explicitly declared the line_breaks option we will respect their choice\n // and assume it is correct.\n return false\n } else {\n /* istanbul ignore else */\n if (isRegExp$1(tokType.PATTERN)) {\n try {\n // TODO: why is the casting suddenly needed?\n canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN)\n } catch (e) {\n /* istanbul ignore next - to test this we would have to mock to throw an error */\n return {\n issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR,\n errMsg: e.message,\n }\n }\n return false\n } else if (isString(tokType.PATTERN)) {\n // string literal patterns can always be analyzed to detect line terminator usage\n return false\n } else if (isCustomPattern(tokType)) {\n // custom token types\n return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK }\n } else {\n throw Error('non exhaustive match')\n }\n }\n }\n function buildLineBreakIssueMessage(tokType, details) {\n /* istanbul ignore else */\n if (details.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) {\n return (\n 'Warning: unable to identify line terminator usage in pattern.\\n' +\n `\\tThe problem is in the <${tokType.name}> Token Type\\n` +\n `\\t Root cause: ${details.errMsg}.\\n` +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR'\n )\n } else if (details.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) {\n return (\n 'Warning: A Custom Token Pattern should specify the option.\\n' +\n `\\tThe problem is in the <${tokType.name}> Token Type\\n` +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK'\n )\n } else {\n throw Error('non exhaustive match')\n }\n }\n function getCharCodes(charsOrCodes) {\n const charCodes = map(charsOrCodes, (numOrString) => {\n if (isString(numOrString)) {\n return numOrString.charCodeAt(0)\n } else {\n return numOrString\n }\n })\n return charCodes\n }\n function addToMapOfArrays(map, key, value) {\n if (map[key] === undefined) {\n map[key] = [value]\n } else {\n map[key].push(value)\n }\n }\n const minOptimizationVal = 256\n /**\n * We are mapping charCode above ASCI (256) into buckets each in the size of 256.\n * This is because ASCI are the most common start chars so each one of those will get its own\n * possible token configs vector.\n *\n * Tokens starting with charCodes \"above\" ASCI are uncommon, so we can \"afford\"\n * to place these into buckets of possible token configs, What we gain from\n * this is avoiding the case of creating an optimization 'charCodeToPatternIdxToConfig'\n * which would contain 10,000+ arrays of small size (e.g unicode Identifiers scenario).\n * Our 'charCodeToPatternIdxToConfig' max size will now be:\n * 256 + (2^16 / 2^8) - 1 === 511\n *\n * note the hack for fast division integer part extraction\n * See: https://stackoverflow.com/a/4228528\n */\n let charCodeToOptimizedIdxMap = []\n function charCodeToOptimizedIndex(charCode) {\n return charCode < minOptimizationVal ? charCode : charCodeToOptimizedIdxMap[charCode]\n }\n /**\n * This is a compromise between cold start / hot running performance\n * Creating this array takes ~3ms on a modern machine,\n * But if we perform the computation at runtime as needed the CSS Lexer benchmark\n * performance degrades by ~10%\n *\n * TODO: Perhaps it should be lazy initialized only if a charCode > 255 is used.\n */\n function initCharCodeToOptimizedIndexMap() {\n if (isEmpty(charCodeToOptimizedIdxMap)) {\n charCodeToOptimizedIdxMap = new Array(65536)\n for (let i = 0; i < 65536; i++) {\n charCodeToOptimizedIdxMap[i] = i > 255 ? 255 + ~~(i / 255) : i\n }\n }\n }\n\n function tokenStructuredMatcher(tokInstance, tokConstructor) {\n const instanceType = tokInstance.tokenTypeIdx\n if (instanceType === tokConstructor.tokenTypeIdx) {\n return true\n } else {\n return tokConstructor.isParent === true && tokConstructor.categoryMatchesMap[instanceType] === true\n }\n }\n // Optimized tokenMatcher in case our grammar does not use token categories\n // Being so tiny it is much more likely to be in-lined and this avoid the function call overhead\n function tokenStructuredMatcherNoCategories(token, tokType) {\n return token.tokenTypeIdx === tokType.tokenTypeIdx\n }\n let tokenShortNameIdx = 1\n const tokenIdxToClass = {}\n function augmentTokenTypes(tokenTypes) {\n // collect the parent Token Types as well.\n const tokenTypesAndParents = expandCategories(tokenTypes)\n // add required tokenType and categoryMatches properties\n assignTokenDefaultProps(tokenTypesAndParents)\n // fill up the categoryMatches\n assignCategoriesMapProp(tokenTypesAndParents)\n assignCategoriesTokensProp(tokenTypesAndParents)\n forEach(tokenTypesAndParents, (tokType) => {\n tokType.isParent = tokType.categoryMatches.length > 0\n })\n }\n function expandCategories(tokenTypes) {\n let result = clone(tokenTypes)\n let categories = tokenTypes\n let searching = true\n while (searching) {\n categories = compact(flatten(map(categories, (currTokType) => currTokType.CATEGORIES)))\n const newCategories = difference$1(categories, result)\n result = result.concat(newCategories)\n if (isEmpty(newCategories)) {\n searching = false\n } else {\n categories = newCategories\n }\n }\n return result\n }\n function assignTokenDefaultProps(tokenTypes) {\n forEach(tokenTypes, (currTokType) => {\n if (!hasShortKeyProperty(currTokType)) {\n tokenIdxToClass[tokenShortNameIdx] = currTokType\n currTokType.tokenTypeIdx = tokenShortNameIdx++\n }\n // CATEGORIES? : TokenType | TokenType[]\n if (\n hasCategoriesProperty(currTokType) &&\n !isArray$1(currTokType.CATEGORIES)\n // &&\n // !isUndefined(currTokType.CATEGORIES.PATTERN)\n ) {\n currTokType.CATEGORIES = [currTokType.CATEGORIES]\n }\n if (!hasCategoriesProperty(currTokType)) {\n currTokType.CATEGORIES = []\n }\n if (!hasExtendingTokensTypesProperty(currTokType)) {\n currTokType.categoryMatches = []\n }\n if (!hasExtendingTokensTypesMapProperty(currTokType)) {\n currTokType.categoryMatchesMap = {}\n }\n })\n }\n function assignCategoriesTokensProp(tokenTypes) {\n forEach(tokenTypes, (currTokType) => {\n // avoid duplications\n currTokType.categoryMatches = []\n forEach(currTokType.categoryMatchesMap, (val, key) => {\n currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx)\n })\n })\n }\n function assignCategoriesMapProp(tokenTypes) {\n forEach(tokenTypes, (currTokType) => {\n singleAssignCategoriesToksMap([], currTokType)\n })\n }\n function singleAssignCategoriesToksMap(path, nextNode) {\n forEach(path, (pathNode) => {\n nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true\n })\n forEach(nextNode.CATEGORIES, (nextCategory) => {\n const newPath = path.concat(nextNode)\n // avoids infinite loops due to cyclic categories.\n if (!includes(newPath, nextCategory)) {\n singleAssignCategoriesToksMap(newPath, nextCategory)\n }\n })\n }\n function hasShortKeyProperty(tokType) {\n return has(tokType, 'tokenTypeIdx')\n }\n function hasCategoriesProperty(tokType) {\n return has(tokType, 'CATEGORIES')\n }\n function hasExtendingTokensTypesProperty(tokType) {\n return has(tokType, 'categoryMatches')\n }\n function hasExtendingTokensTypesMapProperty(tokType) {\n return has(tokType, 'categoryMatchesMap')\n }\n function isTokenType(tokType) {\n return has(tokType, 'tokenTypeIdx')\n }\n\n const defaultLexerErrorProvider = {\n buildUnableToPopLexerModeMessage(token) {\n return `Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`\n },\n buildUnexpectedCharactersMessage(fullText, startOffset, length, line, column) {\n return (\n `unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset},` +\n ` skipped ${length} characters.`\n )\n },\n }\n\n var LexerDefinitionErrorType\n ;(function (LexerDefinitionErrorType) {\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MISSING_PATTERN'] = 0)] = 'MISSING_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['INVALID_PATTERN'] = 1)] = 'INVALID_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['EOI_ANCHOR_FOUND'] = 2)] = 'EOI_ANCHOR_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['UNSUPPORTED_FLAGS_FOUND'] = 3)] = 'UNSUPPORTED_FLAGS_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['DUPLICATE_PATTERNS_FOUND'] = 4)] = 'DUPLICATE_PATTERNS_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['INVALID_GROUP_TYPE_FOUND'] = 5)] = 'INVALID_GROUP_TYPE_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['PUSH_MODE_DOES_NOT_EXIST'] = 6)] = 'PUSH_MODE_DOES_NOT_EXIST'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE'] = 7)] =\n 'MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY'] = 8)] =\n 'MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST'] = 9)] =\n 'MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED'] = 10)] =\n 'LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['SOI_ANCHOR_FOUND'] = 11)] = 'SOI_ANCHOR_FOUND'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['EMPTY_MATCH_PATTERN'] = 12)] = 'EMPTY_MATCH_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['NO_LINE_BREAKS_FLAGS'] = 13)] = 'NO_LINE_BREAKS_FLAGS'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['UNREACHABLE_PATTERN'] = 14)] = 'UNREACHABLE_PATTERN'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['IDENTIFY_TERMINATOR'] = 15)] = 'IDENTIFY_TERMINATOR'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['CUSTOM_LINE_BREAK'] = 16)] = 'CUSTOM_LINE_BREAK'\n LexerDefinitionErrorType[(LexerDefinitionErrorType['MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE'] = 17)] =\n 'MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE'\n })(LexerDefinitionErrorType || (LexerDefinitionErrorType = {}))\n const DEFAULT_LEXER_CONFIG = {\n deferDefinitionErrorsHandling: false,\n positionTracking: 'full',\n lineTerminatorsPattern: /\\n|\\r\\n?/g,\n lineTerminatorCharacters: ['\\n', '\\r'],\n ensureOptimizations: false,\n safeMode: false,\n errorMessageProvider: defaultLexerErrorProvider,\n traceInitPerf: false,\n skipValidations: false,\n recoveryEnabled: true,\n }\n Object.freeze(DEFAULT_LEXER_CONFIG)\n class Lexer {\n constructor(lexerDefinition, config = DEFAULT_LEXER_CONFIG) {\n this.lexerDefinition = lexerDefinition\n this.lexerDefinitionErrors = []\n this.lexerDefinitionWarning = []\n this.patternIdxToConfig = {}\n this.charCodeToPatternIdxToConfig = {}\n this.modes = []\n this.emptyGroups = {}\n this.trackStartLines = true\n this.trackEndLines = true\n this.hasCustom = false\n this.canModeBeOptimized = {}\n // Duplicated from the parser's perf trace trait to allow future extraction\n // of the lexer to a separate package.\n this.TRACE_INIT = (phaseDesc, phaseImpl) => {\n // No need to optimize this using NOOP pattern because\n // It is not called in a hot spot...\n if (this.traceInitPerf === true) {\n this.traceInitIndent++\n const indent = new Array(this.traceInitIndent + 1).join('\\t')\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n console.log(`${indent}--> <${phaseDesc}>`)\n }\n const { time, value } = timer(phaseImpl)\n /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */\n const traceMethod = time > 10 ? console.warn : console.log\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`)\n }\n this.traceInitIndent--\n return value\n } else {\n return phaseImpl()\n }\n }\n if (typeof config === 'boolean') {\n throw Error(\n 'The second argument to the Lexer constructor is now an ILexerConfig Object.\\n' +\n 'a boolean 2nd argument is no longer supported',\n )\n }\n // todo: defaults func?\n this.config = assign$1({}, DEFAULT_LEXER_CONFIG, config)\n const traceInitVal = this.config.traceInitPerf\n if (traceInitVal === true) {\n this.traceInitMaxIdent = Infinity\n this.traceInitPerf = true\n } else if (typeof traceInitVal === 'number') {\n this.traceInitMaxIdent = traceInitVal\n this.traceInitPerf = true\n }\n this.traceInitIndent = -1\n this.TRACE_INIT('Lexer Constructor', () => {\n let actualDefinition\n let hasOnlySingleMode = true\n this.TRACE_INIT('Lexer Config handling', () => {\n if (this.config.lineTerminatorsPattern === DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) {\n // optimized built-in implementation for the defaults definition of lineTerminators\n this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester\n } else {\n if (this.config.lineTerminatorCharacters === DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) {\n throw Error(\n 'Error: Missing property on the Lexer config.\\n' +\n '\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS',\n )\n }\n }\n if (config.safeMode && config.ensureOptimizations) {\n throw Error('\"safeMode\" and \"ensureOptimizations\" flags are mutually exclusive.')\n }\n this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking)\n this.trackEndLines = /full/i.test(this.config.positionTracking)\n // Convert SingleModeLexerDefinition into a IMultiModeLexerDefinition.\n if (isArray$1(lexerDefinition)) {\n actualDefinition = {\n modes: { defaultMode: clone(lexerDefinition) },\n defaultMode: DEFAULT_MODE,\n }\n } else {\n // no conversion needed, input should already be a IMultiModeLexerDefinition\n hasOnlySingleMode = false\n actualDefinition = clone(lexerDefinition)\n }\n })\n if (this.config.skipValidations === false) {\n this.TRACE_INIT('performRuntimeChecks', () => {\n this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(\n performRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters),\n )\n })\n this.TRACE_INIT('performWarningRuntimeChecks', () => {\n this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(\n performWarningRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters),\n )\n })\n }\n // for extra robustness to avoid throwing an none informative error message\n actualDefinition.modes = actualDefinition.modes ? actualDefinition.modes : {}\n // an error of undefined TokenTypes will be detected in \"performRuntimeChecks\" above.\n // this transformation is to increase robustness in the case of partially invalid lexer definition.\n forEach(actualDefinition.modes, (currModeValue, currModeName) => {\n actualDefinition.modes[currModeName] = reject(currModeValue, (currTokType) => isUndefined(currTokType))\n })\n const allModeNames = keys(actualDefinition.modes)\n forEach(actualDefinition.modes, (currModDef, currModName) => {\n this.TRACE_INIT(`Mode: <${currModName}> processing`, () => {\n this.modes.push(currModName)\n if (this.config.skipValidations === false) {\n this.TRACE_INIT(`validatePatterns`, () => {\n this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(\n validatePatterns(currModDef, allModeNames),\n )\n })\n }\n // If definition errors were encountered, the analysis phase may fail unexpectedly/\n // Considering a lexer with definition errors may never be used, there is no point\n // to performing the analysis anyhow...\n if (isEmpty(this.lexerDefinitionErrors)) {\n augmentTokenTypes(currModDef)\n let currAnalyzeResult\n this.TRACE_INIT(`analyzeTokenTypes`, () => {\n currAnalyzeResult = analyzeTokenTypes(currModDef, {\n lineTerminatorCharacters: this.config.lineTerminatorCharacters,\n positionTracking: config.positionTracking,\n ensureOptimizations: config.ensureOptimizations,\n safeMode: config.safeMode,\n tracer: this.TRACE_INIT,\n })\n })\n this.patternIdxToConfig[currModName] = currAnalyzeResult.patternIdxToConfig\n this.charCodeToPatternIdxToConfig[currModName] = currAnalyzeResult.charCodeToPatternIdxToConfig\n this.emptyGroups = assign$1({}, this.emptyGroups, currAnalyzeResult.emptyGroups)\n this.hasCustom = currAnalyzeResult.hasCustom || this.hasCustom\n this.canModeBeOptimized[currModName] = currAnalyzeResult.canBeOptimized\n }\n })\n })\n this.defaultMode = actualDefinition.defaultMode\n if (!isEmpty(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) {\n const allErrMessages = map(this.lexerDefinitionErrors, (error) => {\n return error.message\n })\n const allErrMessagesString = allErrMessages.join('-----------------------\\n')\n throw new Error('Errors detected in definition of Lexer:\\n' + allErrMessagesString)\n }\n // Only print warning if there are no errors, This will avoid pl\n forEach(this.lexerDefinitionWarning, (warningDescriptor) => {\n PRINT_WARNING(warningDescriptor.message)\n })\n this.TRACE_INIT('Choosing sub-methods implementations', () => {\n // Choose the relevant internal implementations for this specific parser.\n // These implementations should be in-lined by the JavaScript engine\n // to provide optimal performance in each scenario.\n if (SUPPORT_STICKY) {\n this.chopInput = identity\n this.match = this.matchWithTest\n } else {\n this.updateLastIndex = noop\n this.match = this.matchWithExec\n }\n if (hasOnlySingleMode) {\n this.handleModes = noop\n }\n if (this.trackStartLines === false) {\n this.computeNewColumn = identity\n }\n if (this.trackEndLines === false) {\n this.updateTokenEndLineColumnLocation = noop\n }\n if (/full/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createFullToken\n } else if (/onlyStart/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createStartOnlyToken\n } else if (/onlyOffset/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createOffsetOnlyToken\n } else {\n throw Error(`Invalid config option: \"${this.config.positionTracking}\"`)\n }\n if (this.hasCustom) {\n this.addToken = this.addTokenUsingPush\n this.handlePayload = this.handlePayloadWithCustom\n } else {\n this.addToken = this.addTokenUsingMemberAccess\n this.handlePayload = this.handlePayloadNoCustom\n }\n })\n this.TRACE_INIT('Failed Optimization Warnings', () => {\n const unOptimizedModes = reduce(\n this.canModeBeOptimized,\n (cannotBeOptimized, canBeOptimized, modeName) => {\n if (canBeOptimized === false) {\n cannotBeOptimized.push(modeName)\n }\n return cannotBeOptimized\n },\n [],\n )\n if (config.ensureOptimizations && !isEmpty(unOptimizedModes)) {\n throw Error(\n `Lexer Modes: < ${unOptimizedModes.join(', ')} > cannot be optimized.\\n` +\n '\\t Disable the \"ensureOptimizations\" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\\n' +\n '\\t Or inspect the console log for details on how to resolve these issues.',\n )\n }\n })\n this.TRACE_INIT('clearRegExpParserCache', () => {\n clearRegExpParserCache()\n })\n this.TRACE_INIT('toFastProperties', () => {\n toFastProperties(this)\n })\n })\n }\n tokenize(text, initialMode = this.defaultMode) {\n if (!isEmpty(this.lexerDefinitionErrors)) {\n const allErrMessages = map(this.lexerDefinitionErrors, (error) => {\n return error.message\n })\n const allErrMessagesString = allErrMessages.join('-----------------------\\n')\n throw new Error('Unable to Tokenize because Errors detected in definition of Lexer:\\n' + allErrMessagesString)\n }\n return this.tokenizeInternal(text, initialMode)\n }\n // There is quite a bit of duplication between this and \"tokenizeInternalLazy\"\n // This is intentional due to performance considerations.\n // this method also used quite a bit of `!` none null assertions because it is too optimized\n // for `tsc` to always understand it is \"safe\"\n tokenizeInternal(text, initialMode) {\n let i,\n j,\n k,\n matchAltImage,\n longerAlt,\n matchedImage,\n payload,\n altPayload,\n imageLength,\n group,\n tokType,\n newToken,\n errLength,\n msg,\n match\n const orgText = text\n const orgLength = orgText.length\n let offset = 0\n let matchedTokensIndex = 0\n // initializing the tokensArray to the \"guessed\" size.\n // guessing too little will still reduce the number of array re-sizes on pushes.\n // guessing too large (Tested by guessing x4 too large) may cost a bit more of memory\n // but would still have a faster runtime by avoiding (All but one) array resizing.\n const guessedNumberOfTokens = this.hasCustom\n ? 0 // will break custom token pattern APIs the matchedTokens array will contain undefined elements.\n : Math.floor(text.length / 10)\n const matchedTokens = new Array(guessedNumberOfTokens)\n const errors = []\n let line = this.trackStartLines ? 1 : undefined\n let column = this.trackStartLines ? 1 : undefined\n const groups = cloneEmptyGroups(this.emptyGroups)\n const trackLines = this.trackStartLines\n const lineTerminatorPattern = this.config.lineTerminatorsPattern\n let currModePatternsLength = 0\n let patternIdxToConfig = []\n let currCharCodeToPatternIdxToConfig = []\n const modeStack = []\n const emptyArray = []\n Object.freeze(emptyArray)\n let getPossiblePatterns\n function getPossiblePatternsSlow() {\n return patternIdxToConfig\n }\n function getPossiblePatternsOptimized(charCode) {\n const optimizedCharIdx = charCodeToOptimizedIndex(charCode)\n const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx]\n if (possiblePatterns === undefined) {\n return emptyArray\n } else {\n return possiblePatterns\n }\n }\n const pop_mode = (popToken) => {\n // TODO: perhaps avoid this error in the edge case there is no more input?\n if (\n modeStack.length === 1 &&\n // if we have both a POP_MODE and a PUSH_MODE this is in-fact a \"transition\"\n // So no error should occur.\n popToken.tokenType.PUSH_MODE === undefined\n ) {\n // if we try to pop the last mode there lexer will no longer have ANY mode.\n // thus the pop is ignored, an error will be created and the lexer will continue parsing in the previous mode.\n const msg = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken)\n errors.push({\n offset: popToken.startOffset,\n line: popToken.startLine,\n column: popToken.startColumn,\n length: popToken.image.length,\n message: msg,\n })\n } else {\n modeStack.pop()\n const newMode = last(modeStack)\n patternIdxToConfig = this.patternIdxToConfig[newMode]\n currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]\n currModePatternsLength = patternIdxToConfig.length\n const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized\n } else {\n getPossiblePatterns = getPossiblePatternsSlow\n }\n }\n }\n function push_mode(newMode) {\n modeStack.push(newMode)\n currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]\n patternIdxToConfig = this.patternIdxToConfig[newMode]\n currModePatternsLength = patternIdxToConfig.length\n currModePatternsLength = patternIdxToConfig.length\n const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized\n } else {\n getPossiblePatterns = getPossiblePatternsSlow\n }\n }\n // this pattern seems to avoid a V8 de-optimization, although that de-optimization does not\n // seem to matter performance wise.\n push_mode.call(this, initialMode)\n let currConfig\n const recoveryEnabled = this.config.recoveryEnabled\n while (offset < orgLength) {\n matchedImage = null\n const nextCharCode = orgText.charCodeAt(offset)\n const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode)\n const chosenPatternsLength = chosenPatternIdxToConfig.length\n for (i = 0; i < chosenPatternsLength; i++) {\n currConfig = chosenPatternIdxToConfig[i]\n const currPattern = currConfig.pattern\n payload = null\n // manually in-lined because > 600 chars won't be in-lined in V8\n const singleCharCode = currConfig.short\n if (singleCharCode !== false) {\n if (nextCharCode === singleCharCode) {\n // single character string\n matchedImage = currPattern\n }\n } else if (currConfig.isCustom === true) {\n match = currPattern.exec(orgText, offset, matchedTokens, groups)\n if (match !== null) {\n matchedImage = match[0]\n if (match.payload !== undefined) {\n payload = match.payload\n }\n } else {\n matchedImage = null\n }\n } else {\n this.updateLastIndex(currPattern, offset)\n matchedImage = this.match(currPattern, text, offset)\n }\n if (matchedImage !== null) {\n // even though this pattern matched we must try a another longer alternative.\n // this can be used to prioritize keywords over identifiers\n longerAlt = currConfig.longerAlt\n if (longerAlt !== undefined) {\n // TODO: micro optimize, avoid extra prop access\n // by saving/linking longerAlt on the original config?\n const longerAltLength = longerAlt.length\n for (k = 0; k < longerAltLength; k++) {\n const longerAltConfig = patternIdxToConfig[longerAlt[k]]\n const longerAltPattern = longerAltConfig.pattern\n altPayload = null\n // single Char can never be a longer alt so no need to test it.\n // manually in-lined because > 600 chars won't be in-lined in V8\n if (longerAltConfig.isCustom === true) {\n match = longerAltPattern.exec(orgText, offset, matchedTokens, groups)\n if (match !== null) {\n matchAltImage = match[0]\n if (match.payload !== undefined) {\n altPayload = match.payload\n }\n } else {\n matchAltImage = null\n }\n } else {\n this.updateLastIndex(longerAltPattern, offset)\n matchAltImage = this.match(longerAltPattern, text, offset)\n }\n if (matchAltImage && matchAltImage.length > matchedImage.length) {\n matchedImage = matchAltImage\n payload = altPayload\n currConfig = longerAltConfig\n // Exit the loop early after matching one of the longer alternatives\n // The first matched alternative takes precedence\n break\n }\n }\n }\n break\n }\n }\n // successful match\n if (matchedImage !== null) {\n imageLength = matchedImage.length\n group = currConfig.group\n if (group !== undefined) {\n tokType = currConfig.tokenTypeIdx\n // TODO: \"offset + imageLength\" and the new column may be computed twice in case of \"full\" location information inside\n // createFullToken method\n newToken = this.createTokenInstance(\n matchedImage,\n offset,\n tokType,\n currConfig.tokenType,\n line,\n column,\n imageLength,\n )\n this.handlePayload(newToken, payload)\n // TODO: optimize NOOP in case there are no special groups?\n if (group === false) {\n matchedTokensIndex = this.addToken(matchedTokens, matchedTokensIndex, newToken)\n } else {\n groups[group].push(newToken)\n }\n }\n text = this.chopInput(text, imageLength)\n offset = offset + imageLength\n // TODO: with newlines the column may be assigned twice\n column = this.computeNewColumn(column, imageLength)\n if (trackLines === true && currConfig.canLineTerminator === true) {\n let numOfLTsInMatch = 0\n let foundTerminator\n let lastLTEndOffset\n lineTerminatorPattern.lastIndex = 0\n do {\n foundTerminator = lineTerminatorPattern.test(matchedImage)\n if (foundTerminator === true) {\n lastLTEndOffset = lineTerminatorPattern.lastIndex - 1\n numOfLTsInMatch++\n }\n } while (foundTerminator === true)\n if (numOfLTsInMatch !== 0) {\n line = line + numOfLTsInMatch\n column = imageLength - lastLTEndOffset\n this.updateTokenEndLineColumnLocation(\n newToken,\n group,\n lastLTEndOffset,\n numOfLTsInMatch,\n line,\n column,\n imageLength,\n )\n }\n }\n // will be NOOP if no modes present\n this.handleModes(currConfig, pop_mode, push_mode, newToken)\n } else {\n // error recovery, drop characters until we identify a valid token's start point\n const errorStartOffset = offset\n const errorLine = line\n const errorColumn = column\n let foundResyncPoint = recoveryEnabled === false\n while (foundResyncPoint === false && offset < orgLength) {\n // Identity Func (when sticky flag is enabled)\n text = this.chopInput(text, 1)\n offset++\n for (j = 0; j < currModePatternsLength; j++) {\n const currConfig = patternIdxToConfig[j]\n const currPattern = currConfig.pattern\n // manually in-lined because > 600 chars won't be in-lined in V8\n const singleCharCode = currConfig.short\n if (singleCharCode !== false) {\n if (orgText.charCodeAt(offset) === singleCharCode) {\n // single character string\n foundResyncPoint = true\n }\n } else if (currConfig.isCustom === true) {\n foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null\n } else {\n this.updateLastIndex(currPattern, offset)\n foundResyncPoint = currPattern.exec(text) !== null\n }\n if (foundResyncPoint === true) {\n break\n }\n }\n }\n errLength = offset - errorStartOffset\n column = this.computeNewColumn(column, errLength)\n // at this point we either re-synced or reached the end of the input text\n msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(\n orgText,\n errorStartOffset,\n errLength,\n errorLine,\n errorColumn,\n )\n errors.push({\n offset: errorStartOffset,\n line: errorLine,\n column: errorColumn,\n length: errLength,\n message: msg,\n })\n if (recoveryEnabled === false) {\n break\n }\n }\n }\n // if we do have custom patterns which push directly into the\n // TODO: custom tokens should not push directly??\n if (!this.hasCustom) {\n // if we guessed a too large size for the tokens array this will shrink it to the right size.\n matchedTokens.length = matchedTokensIndex\n }\n return {\n tokens: matchedTokens,\n groups: groups,\n errors: errors,\n }\n }\n handleModes(config, pop_mode, push_mode, newToken) {\n if (config.pop === true) {\n // need to save the PUSH_MODE property as if the mode is popped\n // patternIdxToPopMode is updated to reflect the new mode after popping the stack\n const pushMode = config.push\n pop_mode(newToken)\n if (pushMode !== undefined) {\n push_mode.call(this, pushMode)\n }\n } else if (config.push !== undefined) {\n push_mode.call(this, config.push)\n }\n }\n chopInput(text, length) {\n return text.substring(length)\n }\n updateLastIndex(regExp, newLastIndex) {\n regExp.lastIndex = newLastIndex\n }\n // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler\n updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {\n let lastCharIsLT, fixForEndingInLT\n if (group !== undefined) {\n // a none skipped multi line Token, need to update endLine/endColumn\n lastCharIsLT = lastLTIdx === imageLength - 1\n fixForEndingInLT = lastCharIsLT ? -1 : 0\n if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) {\n // if a token ends in a LT that last LT only affects the line numbering of following Tokens\n newToken.endLine = line + fixForEndingInLT\n // the last LT in a token does not affect the endColumn either as the [columnStart ... columnEnd)\n // inclusive to exclusive range.\n newToken.endColumn = column - 1 + -fixForEndingInLT\n }\n // else single LT in the last character of a token, no need to modify the endLine/EndColumn\n }\n }\n computeNewColumn(oldColumn, imageLength) {\n return oldColumn + imageLength\n }\n createOffsetOnlyToken(image, startOffset, tokenTypeIdx, tokenType) {\n return {\n image,\n startOffset,\n tokenTypeIdx,\n tokenType,\n }\n }\n createStartOnlyToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn) {\n return {\n image,\n startOffset,\n startLine,\n startColumn,\n tokenTypeIdx,\n tokenType,\n }\n }\n createFullToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn, imageLength) {\n return {\n image,\n startOffset,\n endOffset: startOffset + imageLength - 1,\n startLine,\n endLine: startLine,\n startColumn,\n endColumn: startColumn + imageLength - 1,\n tokenTypeIdx,\n tokenType,\n }\n }\n addTokenUsingPush(tokenVector, index, tokenToAdd) {\n tokenVector.push(tokenToAdd)\n return index\n }\n addTokenUsingMemberAccess(tokenVector, index, tokenToAdd) {\n tokenVector[index] = tokenToAdd\n index++\n return index\n }\n handlePayloadNoCustom(token, payload) {}\n handlePayloadWithCustom(token, payload) {\n if (payload !== null) {\n token.payload = payload\n }\n }\n matchWithTest(pattern, text, offset) {\n const found = pattern.test(text)\n if (found === true) {\n return text.substring(offset, pattern.lastIndex)\n }\n return null\n }\n matchWithExec(pattern, text) {\n const regExpArray = pattern.exec(text)\n return regExpArray !== null ? regExpArray[0] : null\n }\n }\n Lexer.SKIPPED =\n 'This marks a skipped Token pattern, this means each token identified by it will' +\n 'be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.'\n Lexer.NA = /NOT_APPLICABLE/\n\n function tokenLabel(tokType) {\n if (hasTokenLabel(tokType)) {\n return tokType.LABEL\n } else {\n return tokType.name\n }\n }\n function hasTokenLabel(obj) {\n return isString(obj.LABEL) && obj.LABEL !== ''\n }\n const PARENT = 'parent'\n const CATEGORIES = 'categories'\n const LABEL = 'label'\n const GROUP = 'group'\n const PUSH_MODE = 'push_mode'\n const POP_MODE = 'pop_mode'\n const LONGER_ALT = 'longer_alt'\n const LINE_BREAKS = 'line_breaks'\n const START_CHARS_HINT = 'start_chars_hint'\n function createToken(config) {\n return createTokenInternal(config)\n }\n function createTokenInternal(config) {\n const pattern = config.pattern\n const tokenType = {}\n tokenType.name = config.name\n if (!isUndefined(pattern)) {\n tokenType.PATTERN = pattern\n }\n if (has(config, PARENT)) {\n throw (\n 'The parent property is no longer supported.\\n' +\n 'See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.'\n )\n }\n if (has(config, CATEGORIES)) {\n // casting to ANY as this will be fixed inside `augmentTokenTypes``\n tokenType.CATEGORIES = config[CATEGORIES]\n }\n augmentTokenTypes([tokenType])\n if (has(config, LABEL)) {\n tokenType.LABEL = config[LABEL]\n }\n if (has(config, GROUP)) {\n tokenType.GROUP = config[GROUP]\n }\n if (has(config, POP_MODE)) {\n tokenType.POP_MODE = config[POP_MODE]\n }\n if (has(config, PUSH_MODE)) {\n tokenType.PUSH_MODE = config[PUSH_MODE]\n }\n if (has(config, LONGER_ALT)) {\n tokenType.LONGER_ALT = config[LONGER_ALT]\n }\n if (has(config, LINE_BREAKS)) {\n tokenType.LINE_BREAKS = config[LINE_BREAKS]\n }\n if (has(config, START_CHARS_HINT)) {\n tokenType.START_CHARS_HINT = config[START_CHARS_HINT]\n }\n return tokenType\n }\n const EOF = createToken({ name: 'EOF', pattern: Lexer.NA })\n augmentTokenTypes([EOF])\n function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) {\n return {\n image,\n startOffset,\n endOffset,\n startLine,\n endLine,\n startColumn,\n endColumn,\n tokenTypeIdx: tokType.tokenTypeIdx,\n tokenType: tokType,\n }\n }\n function tokenMatcher(token, tokType) {\n return tokenStructuredMatcher(token, tokType)\n }\n\n const defaultParserErrorProvider = {\n buildMismatchTokenMessage({ expected, actual, previous, ruleName }) {\n const hasLabel = hasTokenLabel(expected)\n const expectedMsg = hasLabel ? `--> ${tokenLabel(expected)} <--` : `token of type --> ${expected.name} <--`\n const msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`\n return msg\n },\n buildNotAllInputParsedMessage({ firstRedundant, ruleName }) {\n return 'Redundant input, expecting EOF but found: ' + firstRedundant.image\n },\n buildNoViableAltMessage({ expectedPathsPerAlt, actual, previous, customUserDescription, ruleName }) {\n const errPrefix = 'Expecting: '\n // TODO: issue: No Viable Alternative Error may have incomplete details. #502\n const actualText = head(actual).image\n const errSuffix = \"\\nbut found: '\" + actualText + \"'\"\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix\n } else {\n const allLookAheadPaths = reduce(expectedPathsPerAlt, (result, currAltPaths) => result.concat(currAltPaths), [])\n const nextValidTokenSequences = map(\n allLookAheadPaths,\n (currPath) => `[${map(currPath, (currTokenType) => tokenLabel(currTokenType)).join(', ')}]`,\n )\n const nextValidSequenceItems = map(nextValidTokenSequences, (itemMsg, idx) => ` ${idx + 1}. ${itemMsg}`)\n const calculatedDescription = `one of these possible Token sequences:\\n${nextValidSequenceItems.join('\\n')}`\n return errPrefix + calculatedDescription + errSuffix\n }\n },\n buildEarlyExitMessage({ expectedIterationPaths, actual, customUserDescription, ruleName }) {\n const errPrefix = 'Expecting: '\n // TODO: issue: No Viable Alternative Error may have incomplete details. #502\n const actualText = head(actual).image\n const errSuffix = \"\\nbut found: '\" + actualText + \"'\"\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix\n } else {\n const nextValidTokenSequences = map(\n expectedIterationPaths,\n (currPath) => `[${map(currPath, (currTokenType) => tokenLabel(currTokenType)).join(',')}]`,\n )\n const calculatedDescription =\n `expecting at least one iteration which starts with one of these possible Token sequences::\\n ` +\n `<${nextValidTokenSequences.join(' ,')}>`\n return errPrefix + calculatedDescription + errSuffix\n }\n },\n }\n Object.freeze(defaultParserErrorProvider)\n const defaultGrammarResolverErrorProvider = {\n buildRuleNotFoundError(topLevelRule, undefinedRule) {\n const msg =\n 'Invalid grammar, reference to a rule which is not defined: ->' +\n undefinedRule.nonTerminalName +\n '<-\\n' +\n 'inside top level rule: ->' +\n topLevelRule.name +\n '<-'\n return msg\n },\n }\n const defaultGrammarValidatorErrorProvider = {\n buildDuplicateFoundError(topLevelRule, duplicateProds) {\n function getExtraProductionArgument(prod) {\n if (prod instanceof Terminal) {\n return prod.terminalType.name\n } else if (prod instanceof NonTerminal) {\n return prod.nonTerminalName\n } else {\n return ''\n }\n }\n const topLevelName = topLevelRule.name\n const duplicateProd = head(duplicateProds)\n const index = duplicateProd.idx\n const dslName = getProductionDslName(duplicateProd)\n const extraArgument = getExtraProductionArgument(duplicateProd)\n const hasExplicitIndex = index > 0\n let msg = `->${dslName}${hasExplicitIndex ? index : ''}<- ${\n extraArgument ? `with argument: ->${extraArgument}<-` : ''\n }\n appears more than once (${\n duplicateProds.length\n } times) in the top level rule: ->${topLevelName}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `\n // white space trimming time! better to trim afterwards as it allows to use WELL formatted multi line template strings...\n msg = msg.replace(/[ \\t]+/g, ' ')\n msg = msg.replace(/\\s\\s+/g, '\\n')\n return msg\n },\n buildNamespaceConflictError(rule) {\n const errMsg =\n `Namespace conflict found in grammar.\\n` +\n `The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.name}>.\\n` +\n `To resolve this make sure each Terminal and Non-Terminal names are unique\\n` +\n `This is easy to accomplish by using the convention that Terminal names start with an uppercase letter\\n` +\n `and Non-Terminal names start with a lower case letter.`\n return errMsg\n },\n buildAlternationPrefixAmbiguityError(options) {\n const pathMsg = map(options.prefixPath, (currTok) => tokenLabel(currTok)).join(', ')\n const occurrence = options.alternation.idx === 0 ? '' : options.alternation.idx\n const errMsg =\n `Ambiguous alternatives: <${options.ambiguityIndices.join(' ,')}> due to common lookahead prefix\\n` +\n `in inside <${options.topLevelRule.name}> Rule,\\n` +\n `<${pathMsg}> may appears as a prefix path in all these alternatives.\\n` +\n `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\\n` +\n `For Further details.`\n return errMsg\n },\n buildAlternationAmbiguityError(options) {\n const pathMsg = map(options.prefixPath, (currtok) => tokenLabel(currtok)).join(', ')\n const occurrence = options.alternation.idx === 0 ? '' : options.alternation.idx\n let currMessage =\n `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(' ,')}> in ` +\n ` inside <${options.topLevelRule.name}> Rule,\\n` +\n `<${pathMsg}> may appears as a prefix path in all these alternatives.\\n`\n currMessage =\n currMessage +\n `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\\n` +\n `For Further details.`\n return currMessage\n },\n buildEmptyRepetitionError(options) {\n let dslName = getProductionDslName(options.repetition)\n if (options.repetition.idx !== 0) {\n dslName += options.repetition.idx\n }\n const errMsg =\n `The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens.\\n` +\n `This could lead to an infinite loop.`\n return errMsg\n },\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildTokenNameError(options) {\n /* istanbul ignore next */\n return 'deprecated'\n },\n buildEmptyAlternationError(options) {\n const errMsg =\n `Ambiguous empty alternative: <${options.emptyChoiceIdx + 1}>` +\n ` in inside <${options.topLevelRule.name}> Rule.\\n` +\n `Only the last alternative may be an empty alternative.`\n return errMsg\n },\n buildTooManyAlternativesError(options) {\n const errMsg =\n `An Alternation cannot have more than 256 alternatives:\\n` +\n ` inside <${options.topLevelRule.name}> Rule.\\n has ${\n options.alternation.definition.length + 1\n } alternatives.`\n return errMsg\n },\n buildLeftRecursionError(options) {\n const ruleName = options.topLevelRule.name\n const pathNames = map(options.leftRecursionPath, (currRule) => currRule.name)\n const leftRecursivePath = `${ruleName} --> ${pathNames.concat([ruleName]).join(' --> ')}`\n const errMsg =\n `Left Recursion found in grammar.\\n` +\n `rule: <${ruleName}> can be invoked from itself (directly or indirectly)\\n` +\n `without consuming any Tokens. The grammar path that causes this is: \\n ${leftRecursivePath}\\n` +\n ` To fix this refactor your grammar to remove the left recursion.\\n` +\n `see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`\n return errMsg\n },\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildInvalidRuleNameError(options) {\n /* istanbul ignore next */\n return 'deprecated'\n },\n buildDuplicateRuleNameError(options) {\n let ruleName\n if (options.topLevelRule instanceof Rule) {\n ruleName = options.topLevelRule.name\n } else {\n ruleName = options.topLevelRule\n }\n const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`\n return errMsg\n },\n }\n\n function resolveGrammar$1(topLevels, errMsgProvider) {\n const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider)\n refResolver.resolveRefs()\n return refResolver.errors\n }\n class GastRefResolverVisitor extends GAstVisitor {\n constructor(nameToTopRule, errMsgProvider) {\n super()\n this.nameToTopRule = nameToTopRule\n this.errMsgProvider = errMsgProvider\n this.errors = []\n }\n resolveRefs() {\n forEach(values(this.nameToTopRule), (prod) => {\n this.currTopLevel = prod\n prod.accept(this)\n })\n }\n visitNonTerminal(node) {\n const ref = this.nameToTopRule[node.nonTerminalName]\n if (!ref) {\n const msg = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, node)\n this.errors.push({\n message: msg,\n type: ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,\n ruleName: this.currTopLevel.name,\n unresolvedRefName: node.nonTerminalName,\n })\n } else {\n node.referencedRule = ref\n }\n }\n }\n\n class AbstractNextPossibleTokensWalker extends RestWalker {\n constructor(topProd, path) {\n super()\n this.topProd = topProd\n this.path = path\n this.possibleTokTypes = []\n this.nextProductionName = ''\n this.nextProductionOccurrence = 0\n this.found = false\n this.isAtEndOfPath = false\n }\n startWalking() {\n this.found = false\n if (this.path.ruleStack[0] !== this.topProd.name) {\n throw Error(\"The path does not start with the walker's top Rule!\")\n }\n // immutable for the win\n this.ruleStack = clone(this.path.ruleStack).reverse() // intelij bug requires assertion\n this.occurrenceStack = clone(this.path.occurrenceStack).reverse() // intelij bug requires assertion\n // already verified that the first production is valid, we now seek the 2nd production\n this.ruleStack.pop()\n this.occurrenceStack.pop()\n this.updateExpectedNext()\n this.walk(this.topProd)\n return this.possibleTokTypes\n }\n walk(prod, prevRest = []) {\n // stop scanning once we found the path\n if (!this.found) {\n super.walk(prod, prevRest)\n }\n }\n walkProdRef(refProd, currRest, prevRest) {\n // found the next production, need to keep walking in it\n if (refProd.referencedRule.name === this.nextProductionName && refProd.idx === this.nextProductionOccurrence) {\n const fullRest = currRest.concat(prevRest)\n this.updateExpectedNext()\n this.walk(refProd.referencedRule, fullRest)\n }\n }\n updateExpectedNext() {\n // need to consume the Terminal\n if (isEmpty(this.ruleStack)) {\n // must reset nextProductionXXX to avoid walking down another Top Level production while what we are\n // really seeking is the last Terminal...\n this.nextProductionName = ''\n this.nextProductionOccurrence = 0\n this.isAtEndOfPath = true\n } else {\n this.nextProductionName = this.ruleStack.pop()\n this.nextProductionOccurrence = this.occurrenceStack.pop()\n }\n }\n }\n class NextAfterTokenWalker extends AbstractNextPossibleTokensWalker {\n constructor(topProd, path) {\n super(topProd, path)\n this.path = path\n this.nextTerminalName = ''\n this.nextTerminalOccurrence = 0\n this.nextTerminalName = this.path.lastTok.name\n this.nextTerminalOccurrence = this.path.lastTokOccurrence\n }\n walkTerminal(terminal, currRest, prevRest) {\n if (\n this.isAtEndOfPath &&\n terminal.terminalType.name === this.nextTerminalName &&\n terminal.idx === this.nextTerminalOccurrence &&\n !this.found\n ) {\n const fullRest = currRest.concat(prevRest)\n const restProd = new Alternative({ definition: fullRest })\n this.possibleTokTypes = first(restProd)\n this.found = true\n }\n }\n }\n /**\n * This walker only \"walks\" a single \"TOP\" level in the Grammar Ast, this means\n * it never \"follows\" production refs\n */\n class AbstractNextTerminalAfterProductionWalker extends RestWalker {\n constructor(topRule, occurrence) {\n super()\n this.topRule = topRule\n this.occurrence = occurrence\n this.result = {\n token: undefined,\n occurrence: undefined,\n isEndOfRule: undefined,\n }\n }\n startWalking() {\n this.walk(this.topRule)\n return this.result\n }\n }\n class NextTerminalAfterManyWalker extends AbstractNextTerminalAfterProductionWalker {\n walkMany(manyProd, currRest, prevRest) {\n if (manyProd.idx === this.occurrence) {\n const firstAfterMany = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterMany === undefined\n if (firstAfterMany instanceof Terminal) {\n this.result.token = firstAfterMany.terminalType\n this.result.occurrence = firstAfterMany.idx\n }\n } else {\n super.walkMany(manyProd, currRest, prevRest)\n }\n }\n }\n class NextTerminalAfterManySepWalker extends AbstractNextTerminalAfterProductionWalker {\n walkManySep(manySepProd, currRest, prevRest) {\n if (manySepProd.idx === this.occurrence) {\n const firstAfterManySep = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterManySep === undefined\n if (firstAfterManySep instanceof Terminal) {\n this.result.token = firstAfterManySep.terminalType\n this.result.occurrence = firstAfterManySep.idx\n }\n } else {\n super.walkManySep(manySepProd, currRest, prevRest)\n }\n }\n }\n class NextTerminalAfterAtLeastOneWalker extends AbstractNextTerminalAfterProductionWalker {\n walkAtLeastOne(atLeastOneProd, currRest, prevRest) {\n if (atLeastOneProd.idx === this.occurrence) {\n const firstAfterAtLeastOne = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterAtLeastOne === undefined\n if (firstAfterAtLeastOne instanceof Terminal) {\n this.result.token = firstAfterAtLeastOne.terminalType\n this.result.occurrence = firstAfterAtLeastOne.idx\n }\n } else {\n super.walkAtLeastOne(atLeastOneProd, currRest, prevRest)\n }\n }\n }\n // TODO: reduce code duplication in the AfterWalkers\n class NextTerminalAfterAtLeastOneSepWalker extends AbstractNextTerminalAfterProductionWalker {\n walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest) {\n if (atleastOneSepProd.idx === this.occurrence) {\n const firstAfterfirstAfterAtLeastOneSep = head(currRest.concat(prevRest))\n this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === undefined\n if (firstAfterfirstAfterAtLeastOneSep instanceof Terminal) {\n this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType\n this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx\n }\n } else {\n super.walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest)\n }\n }\n }\n function possiblePathsFrom(targetDef, maxLength, currPath = []) {\n // avoid side effects\n currPath = clone(currPath)\n let result = []\n let i = 0\n // TODO: avoid inner funcs\n function remainingPathWith(nextDef) {\n return nextDef.concat(drop(targetDef, i + 1))\n }\n // TODO: avoid inner funcs\n function getAlternativesForProd(definition) {\n const alternatives = possiblePathsFrom(remainingPathWith(definition), maxLength, currPath)\n return result.concat(alternatives)\n }\n /**\n * Mandatory productions will halt the loop as the paths computed from their recursive calls will already contain the\n * following (rest) of the targetDef.\n *\n * For optional productions (Option/Repetition/...) the loop will continue to represent the paths that do not include the\n * the optional production.\n */\n while (currPath.length < maxLength && i < targetDef.length) {\n const prod = targetDef[i]\n /* istanbul ignore else */\n if (prod instanceof Alternative) {\n return getAlternativesForProd(prod.definition)\n } else if (prod instanceof NonTerminal) {\n return getAlternativesForProd(prod.definition)\n } else if (prod instanceof Option) {\n result = getAlternativesForProd(prod.definition)\n } else if (prod instanceof RepetitionMandatory) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: prod.definition,\n }),\n ])\n return getAlternativesForProd(newDef)\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n const newDef = [\n new Alternative({ definition: prod.definition }),\n new Repetition({\n definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition),\n }),\n ]\n return getAlternativesForProd(newDef)\n } else if (prod instanceof RepetitionWithSeparator) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition),\n }),\n ])\n result = getAlternativesForProd(newDef)\n } else if (prod instanceof Repetition) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: prod.definition,\n }),\n ])\n result = getAlternativesForProd(newDef)\n } else if (prod instanceof Alternation) {\n forEach(prod.definition, (currAlt) => {\n // TODO: this is a limited check for empty alternatives\n // It would prevent a common case of infinite loops during parser initialization.\n // However **in-directly** empty alternatives may still cause issues.\n if (isEmpty(currAlt.definition) === false) {\n result = getAlternativesForProd(currAlt.definition)\n }\n })\n return result\n } else if (prod instanceof Terminal) {\n currPath.push(prod.terminalType)\n } else {\n throw Error('non exhaustive match')\n }\n i++\n }\n result.push({\n partialPath: currPath,\n suffixDef: drop(targetDef, i),\n })\n return result\n }\n function nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) {\n const EXIT_NON_TERMINAL = 'EXIT_NONE_TERMINAL'\n // to avoid creating a new Array each time.\n const EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL]\n const EXIT_ALTERNATIVE = 'EXIT_ALTERNATIVE'\n let foundCompletePath = false\n const tokenVectorLength = tokenVector.length\n const minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1\n const result = []\n const possiblePaths = []\n possiblePaths.push({\n idx: -1,\n def: initialDef,\n ruleStack: [],\n occurrenceStack: [],\n })\n while (!isEmpty(possiblePaths)) {\n const currPath = possiblePaths.pop()\n // skip alternatives if no more results can be found (assuming deterministic grammar with fixed lookahead)\n if (currPath === EXIT_ALTERNATIVE) {\n if (foundCompletePath && last(possiblePaths).idx <= minimalAlternativesIndex) {\n // remove irrelevant alternative\n possiblePaths.pop()\n }\n continue\n }\n const currDef = currPath.def\n const currIdx = currPath.idx\n const currRuleStack = currPath.ruleStack\n const currOccurrenceStack = currPath.occurrenceStack\n // For Example: an empty path could exist in a valid grammar in the case of an EMPTY_ALT\n if (isEmpty(currDef)) {\n continue\n }\n const prod = currDef[0]\n /* istanbul ignore else */\n if (prod === EXIT_NON_TERMINAL) {\n const nextPath = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: dropRight(currRuleStack),\n occurrenceStack: dropRight(currOccurrenceStack),\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof Terminal) {\n /* istanbul ignore else */\n if (currIdx < tokenVectorLength - 1) {\n const nextIdx = currIdx + 1\n const actualToken = tokenVector[nextIdx]\n if (tokMatcher(actualToken, prod.terminalType)) {\n const nextPath = {\n idx: nextIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n }\n // end of the line\n } else if (currIdx === tokenVectorLength - 1) {\n // IGNORE ABOVE ELSE\n result.push({\n nextTokenType: prod.terminalType,\n nextTokenOccurrence: prod.idx,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n })\n foundCompletePath = true\n } else {\n throw Error('non exhaustive match')\n }\n } else if (prod instanceof NonTerminal) {\n const newRuleStack = clone(currRuleStack)\n newRuleStack.push(prod.nonTerminalName)\n const newOccurrenceStack = clone(currOccurrenceStack)\n newOccurrenceStack.push(prod.idx)\n const nextPath = {\n idx: currIdx,\n def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, drop(currDef)),\n ruleStack: newRuleStack,\n occurrenceStack: newOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof Option) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWithout)\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE)\n const nextPathWith = {\n idx: currIdx,\n def: prod.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWith)\n } else if (prod instanceof RepetitionMandatory) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n const secondIteration = new Repetition({\n definition: prod.definition,\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([secondIteration], drop(currDef))\n const nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n const separatorGast = new Terminal({\n terminalType: prod.separator,\n })\n const secondIteration = new Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([secondIteration], drop(currDef))\n const nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPath)\n } else if (prod instanceof RepetitionWithSeparator) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWithout)\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE)\n const separatorGast = new Terminal({\n terminalType: prod.separator,\n })\n const nthRepetition = new Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([nthRepetition], drop(currDef))\n const nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWith)\n } else if (prod instanceof Repetition) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWithout)\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE)\n // TODO: an empty repetition will cause infinite loops here, will the parser detect this in selfAnalysis?\n const nthRepetition = new Repetition({\n definition: prod.definition,\n idx: prod.idx,\n })\n const nextDef = prod.definition.concat([nthRepetition], drop(currDef))\n const nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(nextPathWith)\n } else if (prod instanceof Alternation) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n for (let i = prod.definition.length - 1; i >= 0; i--) {\n const currAlt = prod.definition[i]\n const currAltPath = {\n idx: currIdx,\n def: currAlt.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n }\n possiblePaths.push(currAltPath)\n possiblePaths.push(EXIT_ALTERNATIVE)\n }\n } else if (prod instanceof Alternative) {\n possiblePaths.push({\n idx: currIdx,\n def: prod.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n })\n } else if (prod instanceof Rule) {\n // last because we should only encounter at most a single one of these per invocation.\n possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack))\n } else {\n throw Error('non exhaustive match')\n }\n }\n return result\n }\n function expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) {\n const newRuleStack = clone(currRuleStack)\n newRuleStack.push(topRule.name)\n const newCurrOccurrenceStack = clone(currOccurrenceStack)\n // top rule is always assumed to have been called with occurrence index 1\n newCurrOccurrenceStack.push(1)\n return {\n idx: currIdx,\n def: topRule.definition,\n ruleStack: newRuleStack,\n occurrenceStack: newCurrOccurrenceStack,\n }\n }\n\n var PROD_TYPE\n ;(function (PROD_TYPE) {\n PROD_TYPE[(PROD_TYPE['OPTION'] = 0)] = 'OPTION'\n PROD_TYPE[(PROD_TYPE['REPETITION'] = 1)] = 'REPETITION'\n PROD_TYPE[(PROD_TYPE['REPETITION_MANDATORY'] = 2)] = 'REPETITION_MANDATORY'\n PROD_TYPE[(PROD_TYPE['REPETITION_MANDATORY_WITH_SEPARATOR'] = 3)] = 'REPETITION_MANDATORY_WITH_SEPARATOR'\n PROD_TYPE[(PROD_TYPE['REPETITION_WITH_SEPARATOR'] = 4)] = 'REPETITION_WITH_SEPARATOR'\n PROD_TYPE[(PROD_TYPE['ALTERNATION'] = 5)] = 'ALTERNATION'\n })(PROD_TYPE || (PROD_TYPE = {}))\n function getProdType(prod) {\n /* istanbul ignore else */\n if (prod instanceof Option || prod === 'Option') {\n return PROD_TYPE.OPTION\n } else if (prod instanceof Repetition || prod === 'Repetition') {\n return PROD_TYPE.REPETITION\n } else if (prod instanceof RepetitionMandatory || prod === 'RepetitionMandatory') {\n return PROD_TYPE.REPETITION_MANDATORY\n } else if (prod instanceof RepetitionMandatoryWithSeparator || prod === 'RepetitionMandatoryWithSeparator') {\n return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR\n } else if (prod instanceof RepetitionWithSeparator || prod === 'RepetitionWithSeparator') {\n return PROD_TYPE.REPETITION_WITH_SEPARATOR\n } else if (prod instanceof Alternation || prod === 'Alternation') {\n return PROD_TYPE.ALTERNATION\n } else {\n throw Error('non exhaustive match')\n }\n }\n function buildLookaheadFuncForOr(\n occurrence,\n ruleGrammar,\n maxLookahead,\n hasPredicates,\n dynamicTokensEnabled,\n laFuncBuilder,\n ) {\n const lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, maxLookahead)\n const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)\n ? tokenStructuredMatcherNoCategories\n : tokenStructuredMatcher\n return laFuncBuilder(lookAheadPaths, hasPredicates, tokenMatcher, dynamicTokensEnabled)\n }\n /**\n * When dealing with an Optional production (OPTION/MANY/2nd iteration of AT_LEAST_ONE/...) we need to compare\n * the lookahead \"inside\" the production and the lookahead immediately \"after\" it in the same top level rule (context free).\n *\n * Example: given a production:\n * ABC(DE)?DF\n *\n * The optional '(DE)?' should only be entered if we see 'DE'. a single Token 'D' is not sufficient to distinguish between the two\n * alternatives.\n *\n * @returns A Lookahead function which will return true IFF the parser should parse the Optional production.\n */\n function buildLookaheadFuncForOptionalProd(\n occurrence,\n ruleGrammar,\n k,\n dynamicTokensEnabled,\n prodType,\n lookaheadBuilder,\n ) {\n const lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k)\n const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)\n ? tokenStructuredMatcherNoCategories\n : tokenStructuredMatcher\n return lookaheadBuilder(lookAheadPaths[0], tokenMatcher, dynamicTokensEnabled)\n }\n function buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher, dynamicTokensEnabled) {\n const numOfAlts = alts.length\n const areAllOneTokenLookahead = every(alts, (currAlt) => {\n return every(currAlt, (currPath) => {\n return currPath.length === 1\n })\n })\n // This version takes into account the predicates as well.\n if (hasPredicates) {\n /**\n * @returns {number} - The chosen alternative index\n */\n return function (orAlts) {\n // unfortunately the predicates must be extracted every single time\n // as they cannot be cached due to references to parameters(vars) which are no longer valid.\n // note that in the common case of no predicates, no cpu time will be wasted on this (see else block)\n const predicates = map(orAlts, (currAlt) => currAlt.GATE)\n for (let t = 0; t < numOfAlts; t++) {\n const currAlt = alts[t]\n const currNumOfPaths = currAlt.length\n const currPredicate = predicates[t]\n if (currPredicate !== undefined && currPredicate.call(this) === false) {\n // if the predicate does not match there is no point in checking the paths\n continue\n }\n nextPath: for (let j = 0; j < currNumOfPaths; j++) {\n const currPath = currAlt[j]\n const currPathLength = currPath.length\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1)\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined\n }\n } else if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n // optimized (common) case of all the lookaheads paths requiring only\n // a single token lookahead. These Optimizations cannot work if dynamically defined Tokens are used.\n const singleTokenAlts = map(alts, (currAlt) => {\n return flatten(currAlt)\n })\n const choiceToAlt = reduce(\n singleTokenAlts,\n (result, currAlt, idx) => {\n forEach(currAlt, (currTokType) => {\n if (!has(result, currTokType.tokenTypeIdx)) {\n result[currTokType.tokenTypeIdx] = idx\n }\n forEach(currTokType.categoryMatches, (currExtendingType) => {\n if (!has(result, currExtendingType)) {\n result[currExtendingType] = idx\n }\n })\n })\n return result\n },\n {},\n )\n /**\n * @returns {number} - The chosen alternative index\n */\n return function () {\n const nextToken = this.LA(1)\n return choiceToAlt[nextToken.tokenTypeIdx]\n }\n } else {\n // optimized lookahead without needing to check the predicates at all.\n // this causes code duplication which is intentional to improve performance.\n /**\n * @returns {number} - The chosen alternative index\n */\n return function () {\n for (let t = 0; t < numOfAlts; t++) {\n const currAlt = alts[t]\n const currNumOfPaths = currAlt.length\n nextPath: for (let j = 0; j < currNumOfPaths; j++) {\n const currPath = currAlt[j]\n const currPathLength = currPath.length\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1)\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined\n }\n }\n }\n function buildSingleAlternativeLookaheadFunction(alt, tokenMatcher, dynamicTokensEnabled) {\n const areAllOneTokenLookahead = every(alt, (currPath) => {\n return currPath.length === 1\n })\n const numOfPaths = alt.length\n // optimized (common) case of all the lookaheads paths requiring only\n // a single token lookahead.\n if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n const singleTokensTypes = flatten(alt)\n if (singleTokensTypes.length === 1 && isEmpty(singleTokensTypes[0].categoryMatches)) {\n const expectedTokenType = singleTokensTypes[0]\n const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx\n return function () {\n return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey\n }\n } else {\n const choiceToAlt = reduce(\n singleTokensTypes,\n (result, currTokType, idx) => {\n result[currTokType.tokenTypeIdx] = true\n forEach(currTokType.categoryMatches, (currExtendingType) => {\n result[currExtendingType] = true\n })\n return result\n },\n [],\n )\n return function () {\n const nextToken = this.LA(1)\n return choiceToAlt[nextToken.tokenTypeIdx] === true\n }\n }\n } else {\n return function () {\n nextPath: for (let j = 0; j < numOfPaths; j++) {\n const currPath = alt[j]\n const currPathLength = currPath.length\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1)\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath\n }\n }\n // found a full path that matches.\n return true\n }\n // none of the paths matched\n return false\n }\n }\n }\n class RestDefinitionFinderWalker extends RestWalker {\n constructor(topProd, targetOccurrence, targetProdType) {\n super()\n this.topProd = topProd\n this.targetOccurrence = targetOccurrence\n this.targetProdType = targetProdType\n }\n startWalking() {\n this.walk(this.topProd)\n return this.restDef\n }\n checkIsTarget(node, expectedProdType, currRest, prevRest) {\n if (node.idx === this.targetOccurrence && this.targetProdType === expectedProdType) {\n this.restDef = currRest.concat(prevRest)\n return true\n }\n // performance optimization, do not iterate over the entire Grammar ast after we have found the target\n return false\n }\n walkOption(optionProd, currRest, prevRest) {\n if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) {\n super.walkOption(optionProd, currRest, prevRest)\n }\n }\n walkAtLeastOne(atLeastOneProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) {\n super.walkOption(atLeastOneProd, currRest, prevRest)\n }\n }\n walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) {\n super.walkOption(atLeastOneSepProd, currRest, prevRest)\n }\n }\n walkMany(manyProd, currRest, prevRest) {\n if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) {\n super.walkOption(manyProd, currRest, prevRest)\n }\n }\n walkManySep(manySepProd, currRest, prevRest) {\n if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) {\n super.walkOption(manySepProd, currRest, prevRest)\n }\n }\n }\n /**\n * Returns the definition of a target production in a top level level rule.\n */\n class InsideDefinitionFinderVisitor extends GAstVisitor {\n constructor(targetOccurrence, targetProdType, targetRef) {\n super()\n this.targetOccurrence = targetOccurrence\n this.targetProdType = targetProdType\n this.targetRef = targetRef\n this.result = []\n }\n checkIsTarget(node, expectedProdName) {\n if (\n node.idx === this.targetOccurrence &&\n this.targetProdType === expectedProdName &&\n (this.targetRef === undefined || node === this.targetRef)\n ) {\n this.result = node.definition\n }\n }\n visitOption(node) {\n this.checkIsTarget(node, PROD_TYPE.OPTION)\n }\n visitRepetition(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION)\n }\n visitRepetitionMandatory(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY)\n }\n visitRepetitionMandatoryWithSeparator(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR)\n }\n visitRepetitionWithSeparator(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_WITH_SEPARATOR)\n }\n visitAlternation(node) {\n this.checkIsTarget(node, PROD_TYPE.ALTERNATION)\n }\n }\n function initializeArrayOfArrays(size) {\n const result = new Array(size)\n for (let i = 0; i < size; i++) {\n result[i] = []\n }\n return result\n }\n /**\n * A sort of hash function between a Path in the grammar and a string.\n * Note that this returns multiple \"hashes\" to support the scenario of token categories.\n * - A single path with categories may match multiple **actual** paths.\n */\n function pathToHashKeys(path) {\n let keys = ['']\n for (let i = 0; i < path.length; i++) {\n const tokType = path[i]\n const longerKeys = []\n for (let j = 0; j < keys.length; j++) {\n const currShorterKey = keys[j]\n longerKeys.push(currShorterKey + '_' + tokType.tokenTypeIdx)\n for (let t = 0; t < tokType.categoryMatches.length; t++) {\n const categoriesKeySuffix = '_' + tokType.categoryMatches[t]\n longerKeys.push(currShorterKey + categoriesKeySuffix)\n }\n }\n keys = longerKeys\n }\n return keys\n }\n /**\n * Imperative style due to being called from a hot spot\n */\n function isUniquePrefixHash(altKnownPathsKeys, searchPathKeys, idx) {\n for (let currAltIdx = 0; currAltIdx < altKnownPathsKeys.length; currAltIdx++) {\n // We only want to test vs the other alternatives\n if (currAltIdx === idx) {\n continue\n }\n const otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx]\n for (let searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) {\n const searchKey = searchPathKeys[searchIdx]\n if (otherAltKnownPathsKeys[searchKey] === true) {\n return false\n }\n }\n }\n // None of the SearchPathKeys were found in any of the other alternatives\n return true\n }\n function lookAheadSequenceFromAlternatives(altsDefs, k) {\n const partialAlts = map(altsDefs, (currAlt) => possiblePathsFrom([currAlt], 1))\n const finalResult = initializeArrayOfArrays(partialAlts.length)\n const altsHashes = map(partialAlts, (currAltPaths) => {\n const dict = {}\n forEach(currAltPaths, (item) => {\n const keys = pathToHashKeys(item.partialPath)\n forEach(keys, (currKey) => {\n dict[currKey] = true\n })\n })\n return dict\n })\n let newData = partialAlts\n // maxLookahead loop\n for (let pathLength = 1; pathLength <= k; pathLength++) {\n const currDataset = newData\n newData = initializeArrayOfArrays(currDataset.length)\n // alternatives loop\n for (let altIdx = 0; altIdx < currDataset.length; altIdx++) {\n const currAltPathsAndSuffixes = currDataset[altIdx]\n // paths in current alternative loop\n for (let currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) {\n const currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath\n const suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef\n const prefixKeys = pathToHashKeys(currPathPrefix)\n const isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx)\n // End of the line for this path.\n if (isUnique || isEmpty(suffixDef) || currPathPrefix.length === k) {\n const currAltResult = finalResult[altIdx]\n // TODO: Can we implement a containsPath using Maps/Dictionaries?\n if (containsPath(currAltResult, currPathPrefix) === false) {\n currAltResult.push(currPathPrefix)\n // Update all new keys for the current path.\n for (let j = 0; j < prefixKeys.length; j++) {\n const currKey = prefixKeys[j]\n altsHashes[altIdx][currKey] = true\n }\n }\n }\n // Expand longer paths\n else {\n const newPartialPathsAndSuffixes = possiblePathsFrom(suffixDef, pathLength + 1, currPathPrefix)\n newData[altIdx] = newData[altIdx].concat(newPartialPathsAndSuffixes)\n // Update keys for new known paths\n forEach(newPartialPathsAndSuffixes, (item) => {\n const prefixKeys = pathToHashKeys(item.partialPath)\n forEach(prefixKeys, (key) => {\n altsHashes[altIdx][key] = true\n })\n })\n }\n }\n }\n }\n return finalResult\n }\n function getLookaheadPathsForOr(occurrence, ruleGrammar, k, orProd) {\n const visitor = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION, orProd)\n ruleGrammar.accept(visitor)\n return lookAheadSequenceFromAlternatives(visitor.result, k)\n }\n function getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k) {\n const insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType)\n ruleGrammar.accept(insideDefVisitor)\n const insideDef = insideDefVisitor.result\n const afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType)\n const afterDef = afterDefWalker.startWalking()\n const insideFlat = new Alternative({ definition: insideDef })\n const afterFlat = new Alternative({ definition: afterDef })\n return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k)\n }\n function containsPath(alternative, searchPath) {\n compareOtherPath: for (let i = 0; i < alternative.length; i++) {\n const otherPath = alternative[i]\n if (otherPath.length !== searchPath.length) {\n continue\n }\n for (let j = 0; j < otherPath.length; j++) {\n const searchTok = searchPath[j]\n const otherTok = otherPath[j]\n const matchingTokens =\n searchTok === otherTok || otherTok.categoryMatchesMap[searchTok.tokenTypeIdx] !== undefined\n if (matchingTokens === false) {\n continue compareOtherPath\n }\n }\n return true\n }\n return false\n }\n function isStrictPrefixOfPath(prefix, other) {\n return (\n prefix.length < other.length &&\n every(prefix, (tokType, idx) => {\n const otherTokType = other[idx]\n return tokType === otherTokType || otherTokType.categoryMatchesMap[tokType.tokenTypeIdx]\n })\n )\n }\n function areTokenCategoriesNotUsed(lookAheadPaths) {\n return every(lookAheadPaths, (singleAltPaths) =>\n every(singleAltPaths, (singlePath) => every(singlePath, (token) => isEmpty(token.categoryMatches))),\n )\n }\n\n function validateLookahead(options) {\n const lookaheadValidationErrorMessages = options.lookaheadStrategy.validate({\n rules: options.rules,\n tokenTypes: options.tokenTypes,\n grammarName: options.grammarName,\n })\n return map(lookaheadValidationErrorMessages, (errorMessage) =>\n Object.assign({ type: ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION }, errorMessage),\n )\n }\n function validateGrammar$1(topLevels, tokenTypes, errMsgProvider, grammarName) {\n const duplicateErrors = flatMap(topLevels, (currTopLevel) =>\n validateDuplicateProductions(currTopLevel, errMsgProvider),\n )\n const termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider)\n const tooManyAltsErrors = flatMap(topLevels, (curRule) => validateTooManyAlts(curRule, errMsgProvider))\n const duplicateRulesError = flatMap(topLevels, (curRule) =>\n validateRuleDoesNotAlreadyExist(curRule, topLevels, grammarName, errMsgProvider),\n )\n return duplicateErrors.concat(termsNamespaceConflictErrors, tooManyAltsErrors, duplicateRulesError)\n }\n function validateDuplicateProductions(topLevelRule, errMsgProvider) {\n const collectorVisitor = new OccurrenceValidationCollector()\n topLevelRule.accept(collectorVisitor)\n const allRuleProductions = collectorVisitor.allProductions\n const productionGroups = groupBy$1(allRuleProductions, identifyProductionForDuplicates)\n const duplicates = pickBy(productionGroups, (currGroup) => {\n return currGroup.length > 1\n })\n const errors = map(values(duplicates), (currDuplicates) => {\n const firstProd = head(currDuplicates)\n const msg = errMsgProvider.buildDuplicateFoundError(topLevelRule, currDuplicates)\n const dslName = getProductionDslName(firstProd)\n const defError = {\n message: msg,\n type: ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,\n ruleName: topLevelRule.name,\n dslName: dslName,\n occurrence: firstProd.idx,\n }\n const param = getExtraProductionArgument(firstProd)\n if (param) {\n defError.parameter = param\n }\n return defError\n })\n return errors\n }\n function identifyProductionForDuplicates(prod) {\n return `${getProductionDslName(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`\n }\n function getExtraProductionArgument(prod) {\n if (prod instanceof Terminal) {\n return prod.terminalType.name\n } else if (prod instanceof NonTerminal) {\n return prod.nonTerminalName\n } else {\n return ''\n }\n }\n class OccurrenceValidationCollector extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.allProductions = []\n }\n visitNonTerminal(subrule) {\n this.allProductions.push(subrule)\n }\n visitOption(option) {\n this.allProductions.push(option)\n }\n visitRepetitionWithSeparator(manySep) {\n this.allProductions.push(manySep)\n }\n visitRepetitionMandatory(atLeastOne) {\n this.allProductions.push(atLeastOne)\n }\n visitRepetitionMandatoryWithSeparator(atLeastOneSep) {\n this.allProductions.push(atLeastOneSep)\n }\n visitRepetition(many) {\n this.allProductions.push(many)\n }\n visitAlternation(or) {\n this.allProductions.push(or)\n }\n visitTerminal(terminal) {\n this.allProductions.push(terminal)\n }\n }\n function validateRuleDoesNotAlreadyExist(rule, allRules, className, errMsgProvider) {\n const errors = []\n const occurrences = reduce(\n allRules,\n (result, curRule) => {\n if (curRule.name === rule.name) {\n return result + 1\n }\n return result\n },\n 0,\n )\n if (occurrences > 1) {\n const errMsg = errMsgProvider.buildDuplicateRuleNameError({\n topLevelRule: rule,\n grammarName: className,\n })\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: rule.name,\n })\n }\n return errors\n }\n // TODO: is there anyway to get only the rule names of rules inherited from the super grammars?\n // This is not part of the IGrammarErrorProvider because the validation cannot be performed on\n // The grammar structure, only at runtime.\n function validateRuleIsOverridden(ruleName, definedRulesNames, className) {\n const errors = []\n let errMsg\n if (!includes(definedRulesNames, ruleName)) {\n errMsg =\n `Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-` +\n `as it is not defined in any of the super grammars `\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,\n ruleName: ruleName,\n })\n }\n return errors\n }\n function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path = []) {\n const errors = []\n const nextNonTerminals = getFirstNoneTerminal(currRule.definition)\n if (isEmpty(nextNonTerminals)) {\n return []\n } else {\n const ruleName = topRule.name\n const foundLeftRecursion = includes(nextNonTerminals, topRule)\n if (foundLeftRecursion) {\n errors.push({\n message: errMsgProvider.buildLeftRecursionError({\n topLevelRule: topRule,\n leftRecursionPath: path,\n }),\n type: ParserDefinitionErrorType.LEFT_RECURSION,\n ruleName: ruleName,\n })\n }\n // we are only looking for cyclic paths leading back to the specific topRule\n // other cyclic paths are ignored, we still need this difference to avoid infinite loops...\n const validNextSteps = difference$1(nextNonTerminals, path.concat([topRule]))\n const errorsFromNextSteps = flatMap(validNextSteps, (currRefRule) => {\n const newPath = clone(path)\n newPath.push(currRefRule)\n return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath)\n })\n return errors.concat(errorsFromNextSteps)\n }\n }\n function getFirstNoneTerminal(definition) {\n let result = []\n if (isEmpty(definition)) {\n return result\n }\n const firstProd = head(definition)\n /* istanbul ignore else */\n if (firstProd instanceof NonTerminal) {\n result.push(firstProd.referencedRule)\n } else if (\n firstProd instanceof Alternative ||\n firstProd instanceof Option ||\n firstProd instanceof RepetitionMandatory ||\n firstProd instanceof RepetitionMandatoryWithSeparator ||\n firstProd instanceof RepetitionWithSeparator ||\n firstProd instanceof Repetition\n ) {\n result = result.concat(getFirstNoneTerminal(firstProd.definition))\n } else if (firstProd instanceof Alternation) {\n // each sub definition in alternation is a FLAT\n result = flatten(map(firstProd.definition, (currSubDef) => getFirstNoneTerminal(currSubDef.definition)))\n } else if (firstProd instanceof Terminal);\n else {\n throw Error('non exhaustive match')\n }\n const isFirstOptional = isOptionalProd(firstProd)\n const hasMore = definition.length > 1\n if (isFirstOptional && hasMore) {\n const rest = drop(definition)\n return result.concat(getFirstNoneTerminal(rest))\n } else {\n return result\n }\n }\n class OrCollector extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.alternations = []\n }\n visitAlternation(node) {\n this.alternations.push(node)\n }\n }\n function validateEmptyOrAlternative(topLevelRule, errMsgProvider) {\n const orCollector = new OrCollector()\n topLevelRule.accept(orCollector)\n const ors = orCollector.alternations\n const errors = flatMap(ors, (currOr) => {\n const exceptLast = dropRight(currOr.definition)\n return flatMap(exceptLast, (currAlternative, currAltIdx) => {\n const possibleFirstInAlt = nextPossibleTokensAfter([currAlternative], [], tokenStructuredMatcher, 1)\n if (isEmpty(possibleFirstInAlt)) {\n return [\n {\n message: errMsgProvider.buildEmptyAlternationError({\n topLevelRule: topLevelRule,\n alternation: currOr,\n emptyChoiceIdx: currAltIdx,\n }),\n type: ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx,\n alternative: currAltIdx + 1,\n },\n ]\n } else {\n return []\n }\n })\n })\n return errors\n }\n function validateAmbiguousAlternationAlternatives(topLevelRule, globalMaxLookahead, errMsgProvider) {\n const orCollector = new OrCollector()\n topLevelRule.accept(orCollector)\n let ors = orCollector.alternations\n // New Handling of ignoring ambiguities\n // - https://github.com/chevrotain/chevrotain/issues/869\n ors = reject(ors, (currOr) => currOr.ignoreAmbiguities === true)\n const errors = flatMap(ors, (currOr) => {\n const currOccurrence = currOr.idx\n const actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead\n const alternatives = getLookaheadPathsForOr(currOccurrence, topLevelRule, actualMaxLookahead, currOr)\n const altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider)\n const altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(\n alternatives,\n currOr,\n topLevelRule,\n errMsgProvider,\n )\n return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors)\n })\n return errors\n }\n class RepetitionCollector extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.allProductions = []\n }\n visitRepetitionWithSeparator(manySep) {\n this.allProductions.push(manySep)\n }\n visitRepetitionMandatory(atLeastOne) {\n this.allProductions.push(atLeastOne)\n }\n visitRepetitionMandatoryWithSeparator(atLeastOneSep) {\n this.allProductions.push(atLeastOneSep)\n }\n visitRepetition(many) {\n this.allProductions.push(many)\n }\n }\n function validateTooManyAlts(topLevelRule, errMsgProvider) {\n const orCollector = new OrCollector()\n topLevelRule.accept(orCollector)\n const ors = orCollector.alternations\n const errors = flatMap(ors, (currOr) => {\n if (currOr.definition.length > 255) {\n return [\n {\n message: errMsgProvider.buildTooManyAlternativesError({\n topLevelRule: topLevelRule,\n alternation: currOr,\n }),\n type: ParserDefinitionErrorType.TOO_MANY_ALTS,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx,\n },\n ]\n } else {\n return []\n }\n })\n return errors\n }\n function validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead, errMsgProvider) {\n const errors = []\n forEach(topLevelRules, (currTopRule) => {\n const collectorVisitor = new RepetitionCollector()\n currTopRule.accept(collectorVisitor)\n const allRuleProductions = collectorVisitor.allProductions\n forEach(allRuleProductions, (currProd) => {\n const prodType = getProdType(currProd)\n const actualMaxLookahead = currProd.maxLookahead || maxLookahead\n const currOccurrence = currProd.idx\n const paths = getLookaheadPathsForOptionalProd(currOccurrence, currTopRule, prodType, actualMaxLookahead)\n const pathsInsideProduction = paths[0]\n if (isEmpty(flatten(pathsInsideProduction))) {\n const errMsg = errMsgProvider.buildEmptyRepetitionError({\n topLevelRule: currTopRule,\n repetition: currProd,\n })\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,\n ruleName: currTopRule.name,\n })\n }\n })\n })\n return errors\n }\n function checkAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {\n const foundAmbiguousPaths = []\n const identicalAmbiguities = reduce(\n alternatives,\n (result, currAlt, currAltIdx) => {\n // ignore (skip) ambiguities with this alternative\n if (alternation.definition[currAltIdx].ignoreAmbiguities === true) {\n return result\n }\n forEach(currAlt, (currPath) => {\n const altsCurrPathAppearsIn = [currAltIdx]\n forEach(alternatives, (currOtherAlt, currOtherAltIdx) => {\n if (\n currAltIdx !== currOtherAltIdx &&\n containsPath(currOtherAlt, currPath) &&\n // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[currOtherAltIdx].ignoreAmbiguities !== true\n ) {\n altsCurrPathAppearsIn.push(currOtherAltIdx)\n }\n })\n if (altsCurrPathAppearsIn.length > 1 && !containsPath(foundAmbiguousPaths, currPath)) {\n foundAmbiguousPaths.push(currPath)\n result.push({\n alts: altsCurrPathAppearsIn,\n path: currPath,\n })\n }\n })\n return result\n },\n [],\n )\n const currErrors = map(identicalAmbiguities, (currAmbDescriptor) => {\n const ambgIndices = map(currAmbDescriptor.alts, (currAltIdx) => currAltIdx + 1)\n const currMessage = errMsgProvider.buildAlternationAmbiguityError({\n topLevelRule: rule,\n alternation: alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbDescriptor.path,\n })\n return {\n message: currMessage,\n type: ParserDefinitionErrorType.AMBIGUOUS_ALTS,\n ruleName: rule.name,\n occurrence: alternation.idx,\n alternatives: currAmbDescriptor.alts,\n }\n })\n return currErrors\n }\n function checkPrefixAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {\n // flatten\n const pathsAndIndices = reduce(\n alternatives,\n (result, currAlt, idx) => {\n const currPathsAndIdx = map(currAlt, (currPath) => {\n return { idx: idx, path: currPath }\n })\n return result.concat(currPathsAndIdx)\n },\n [],\n )\n const errors = compact(\n flatMap(pathsAndIndices, (currPathAndIdx) => {\n const alternativeGast = alternation.definition[currPathAndIdx.idx]\n // ignore (skip) ambiguities with this alternative\n if (alternativeGast.ignoreAmbiguities === true) {\n return []\n }\n const targetIdx = currPathAndIdx.idx\n const targetPath = currPathAndIdx.path\n const prefixAmbiguitiesPathsAndIndices = filter(pathsAndIndices, (searchPathAndIdx) => {\n // prefix ambiguity can only be created from lower idx (higher priority) path\n return (\n // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[searchPathAndIdx.idx].ignoreAmbiguities !== true &&\n searchPathAndIdx.idx < targetIdx &&\n // checking for strict prefix because identical lookaheads\n // will be be detected using a different validation.\n isStrictPrefixOfPath(searchPathAndIdx.path, targetPath)\n )\n })\n const currPathPrefixErrors = map(prefixAmbiguitiesPathsAndIndices, (currAmbPathAndIdx) => {\n const ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1]\n const occurrence = alternation.idx === 0 ? '' : alternation.idx\n const message = errMsgProvider.buildAlternationPrefixAmbiguityError({\n topLevelRule: rule,\n alternation: alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbPathAndIdx.path,\n })\n return {\n message: message,\n type: ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,\n ruleName: rule.name,\n occurrence: occurrence,\n alternatives: ambgIndices,\n }\n })\n return currPathPrefixErrors\n }),\n )\n return errors\n }\n function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider) {\n const errors = []\n const tokenNames = map(tokenTypes, (currToken) => currToken.name)\n forEach(topLevels, (currRule) => {\n const currRuleName = currRule.name\n if (includes(tokenNames, currRuleName)) {\n const errMsg = errMsgProvider.buildNamespaceConflictError(currRule)\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,\n ruleName: currRuleName,\n })\n }\n })\n return errors\n }\n\n function resolveGrammar(options) {\n const actualOptions = defaults$1(options, {\n errMsgProvider: defaultGrammarResolverErrorProvider,\n })\n const topRulesTable = {}\n forEach(options.rules, (rule) => {\n topRulesTable[rule.name] = rule\n })\n return resolveGrammar$1(topRulesTable, actualOptions.errMsgProvider)\n }\n function validateGrammar(options) {\n options = defaults$1(options, {\n errMsgProvider: defaultGrammarValidatorErrorProvider,\n })\n return validateGrammar$1(options.rules, options.tokenTypes, options.errMsgProvider, options.grammarName)\n }\n\n const MISMATCHED_TOKEN_EXCEPTION = 'MismatchedTokenException'\n const NO_VIABLE_ALT_EXCEPTION = 'NoViableAltException'\n const EARLY_EXIT_EXCEPTION = 'EarlyExitException'\n const NOT_ALL_INPUT_PARSED_EXCEPTION = 'NotAllInputParsedException'\n const RECOGNITION_EXCEPTION_NAMES = [\n MISMATCHED_TOKEN_EXCEPTION,\n NO_VIABLE_ALT_EXCEPTION,\n EARLY_EXIT_EXCEPTION,\n NOT_ALL_INPUT_PARSED_EXCEPTION,\n ]\n Object.freeze(RECOGNITION_EXCEPTION_NAMES)\n // hacks to bypass no support for custom Errors in javascript/typescript\n function isRecognitionException(error) {\n // can't do instanceof on hacked custom js exceptions\n return includes(RECOGNITION_EXCEPTION_NAMES, error.name)\n }\n class RecognitionException extends Error {\n constructor(message, token) {\n super(message)\n this.token = token\n this.resyncedTokens = []\n // fix prototype chain when typescript target is ES5\n Object.setPrototypeOf(this, new.target.prototype)\n /* istanbul ignore next - V8 workaround to remove constructor from stacktrace when typescript target is ES5 */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor)\n }\n }\n }\n class MismatchedTokenException extends RecognitionException {\n constructor(message, token, previousToken) {\n super(message, token)\n this.previousToken = previousToken\n this.name = MISMATCHED_TOKEN_EXCEPTION\n }\n }\n class NoViableAltException extends RecognitionException {\n constructor(message, token, previousToken) {\n super(message, token)\n this.previousToken = previousToken\n this.name = NO_VIABLE_ALT_EXCEPTION\n }\n }\n class NotAllInputParsedException extends RecognitionException {\n constructor(message, token) {\n super(message, token)\n this.name = NOT_ALL_INPUT_PARSED_EXCEPTION\n }\n }\n class EarlyExitException extends RecognitionException {\n constructor(message, token, previousToken) {\n super(message, token)\n this.previousToken = previousToken\n this.name = EARLY_EXIT_EXCEPTION\n }\n }\n\n const EOF_FOLLOW_KEY = {}\n const IN_RULE_RECOVERY_EXCEPTION = 'InRuleRecoveryException'\n class InRuleRecoveryException extends Error {\n constructor(message) {\n super(message)\n this.name = IN_RULE_RECOVERY_EXCEPTION\n }\n }\n /**\n * This trait is responsible for the error recovery and fault tolerant logic\n */\n class Recoverable {\n initRecoverable(config) {\n this.firstAfterRepMap = {}\n this.resyncFollows = {}\n this.recoveryEnabled = has(config, 'recoveryEnabled')\n ? config.recoveryEnabled // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.recoveryEnabled\n // performance optimization, NOOP will be inlined which\n // effectively means that this optional feature does not exist\n // when not used.\n if (this.recoveryEnabled) {\n this.attemptInRepetitionRecovery = attemptInRepetitionRecovery\n }\n }\n getTokenToInsert(tokType) {\n const tokToInsert = createTokenInstance(tokType, '', NaN, NaN, NaN, NaN, NaN, NaN)\n tokToInsert.isInsertedInRecovery = true\n return tokToInsert\n }\n canTokenTypeBeInsertedInRecovery(tokType) {\n return true\n }\n canTokenTypeBeDeletedInRecovery(tokType) {\n return true\n }\n tryInRepetitionRecovery(grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) {\n // TODO: can the resyncTokenType be cached?\n const reSyncTokType = this.findReSyncTokenType()\n const savedLexerState = this.exportLexerState()\n const resyncedTokens = []\n let passedResyncPoint = false\n const nextTokenWithoutResync = this.LA(1)\n let currToken = this.LA(1)\n const generateErrorMessage = () => {\n const previousToken = this.LA(0)\n // we are preemptively re-syncing before an error has been detected, therefor we must reproduce\n // the error that would have been thrown\n const msg = this.errorMessageProvider.buildMismatchTokenMessage({\n expected: expectedTokType,\n actual: nextTokenWithoutResync,\n previous: previousToken,\n ruleName: this.getCurrRuleFullName(),\n })\n const error = new MismatchedTokenException(msg, nextTokenWithoutResync, this.LA(0))\n // the first token here will be the original cause of the error, this is not part of the resyncedTokens property.\n error.resyncedTokens = dropRight(resyncedTokens)\n this.SAVE_ERROR(error)\n }\n while (!passedResyncPoint) {\n // re-synced to a point where we can safely exit the repetition/\n if (this.tokenMatcher(currToken, expectedTokType)) {\n generateErrorMessage()\n return // must return here to avoid reverting the inputIdx\n } else if (lookAheadFunc.call(this)) {\n // we skipped enough tokens so we can resync right back into another iteration of the repetition grammar rule\n generateErrorMessage()\n // recursive invocation in other to support multiple re-syncs in the same top level repetition grammar rule\n grammarRule.apply(this, grammarRuleArgs)\n return // must return here to avoid reverting the inputIdx\n } else if (this.tokenMatcher(currToken, reSyncTokType)) {\n passedResyncPoint = true\n } else {\n currToken = this.SKIP_TOKEN()\n this.addToResyncTokens(currToken, resyncedTokens)\n }\n }\n // we were unable to find a CLOSER point to resync inside the Repetition, reset the state.\n // The parsing exception we were trying to prevent will happen in the NEXT parsing step. it may be handled by\n // \"between rules\" resync recovery later in the flow.\n this.importLexerState(savedLexerState)\n }\n shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck) {\n // Edge case of arriving from a MANY repetition which is stuck\n // Attempting recovery in this case could cause an infinite loop\n if (notStuck === false) {\n return false\n }\n // no need to recover, next token is what we expect...\n if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) {\n return false\n }\n // error recovery is disabled during backtracking as it can make the parser ignore a valid grammar path\n // and prefer some backtracking path that includes recovered errors.\n if (this.isBackTracking()) {\n return false\n }\n // if we can perform inRule recovery (single token insertion or deletion) we always prefer that recovery algorithm\n // because if it works, it makes the least amount of changes to the input stream (greedy algorithm)\n //noinspection RedundantIfStatementJS\n if (\n this.canPerformInRuleRecovery(\n expectTokAfterLastMatch,\n this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx),\n )\n ) {\n return false\n }\n return true\n }\n // Error Recovery functionality\n getFollowsForInRuleRecovery(tokType, tokIdxInRule) {\n const grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule)\n const follows = this.getNextPossibleTokenTypes(grammarPath)\n return follows\n }\n tryInRuleRecovery(expectedTokType, follows) {\n if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) {\n const tokToInsert = this.getTokenToInsert(expectedTokType)\n return tokToInsert\n }\n if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) {\n const nextTok = this.SKIP_TOKEN()\n this.consumeToken()\n return nextTok\n }\n throw new InRuleRecoveryException('sad sad panda')\n }\n canPerformInRuleRecovery(expectedToken, follows) {\n return (\n this.canRecoverWithSingleTokenInsertion(expectedToken, follows) ||\n this.canRecoverWithSingleTokenDeletion(expectedToken)\n )\n }\n canRecoverWithSingleTokenInsertion(expectedTokType, follows) {\n if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) {\n return false\n }\n // must know the possible following tokens to perform single token insertion\n if (isEmpty(follows)) {\n return false\n }\n const mismatchedTok = this.LA(1)\n const isMisMatchedTokInFollows =\n find$1(follows, (possibleFollowsTokType) => {\n return this.tokenMatcher(mismatchedTok, possibleFollowsTokType)\n }) !== undefined\n return isMisMatchedTokInFollows\n }\n canRecoverWithSingleTokenDeletion(expectedTokType) {\n if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) {\n return false\n }\n const isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType)\n return isNextTokenWhatIsExpected\n }\n isInCurrentRuleReSyncSet(tokenTypeIdx) {\n const followKey = this.getCurrFollowKey()\n const currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey)\n return includes(currentRuleReSyncSet, tokenTypeIdx)\n }\n findReSyncTokenType() {\n const allPossibleReSyncTokTypes = this.flattenFollowSet()\n // this loop will always terminate as EOF is always in the follow stack and also always (virtually) in the input\n let nextToken = this.LA(1)\n let k = 2\n while (true) {\n const foundMatch = find$1(allPossibleReSyncTokTypes, (resyncTokType) => {\n const canMatch = tokenMatcher(nextToken, resyncTokType)\n return canMatch\n })\n if (foundMatch !== undefined) {\n return foundMatch\n }\n nextToken = this.LA(k)\n k++\n }\n }\n getCurrFollowKey() {\n // the length is at least one as we always add the ruleName to the stack before invoking the rule.\n if (this.RULE_STACK.length === 1) {\n return EOF_FOLLOW_KEY\n }\n const currRuleShortName = this.getLastExplicitRuleShortName()\n const currRuleIdx = this.getLastExplicitRuleOccurrenceIndex()\n const prevRuleShortName = this.getPreviousExplicitRuleShortName()\n return {\n ruleName: this.shortRuleNameToFullName(currRuleShortName),\n idxInCallingRule: currRuleIdx,\n inRule: this.shortRuleNameToFullName(prevRuleShortName),\n }\n }\n buildFullFollowKeyStack() {\n const explicitRuleStack = this.RULE_STACK\n const explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK\n return map(explicitRuleStack, (ruleName, idx) => {\n if (idx === 0) {\n return EOF_FOLLOW_KEY\n }\n return {\n ruleName: this.shortRuleNameToFullName(ruleName),\n idxInCallingRule: explicitOccurrenceStack[idx],\n inRule: this.shortRuleNameToFullName(explicitRuleStack[idx - 1]),\n }\n })\n }\n flattenFollowSet() {\n const followStack = map(this.buildFullFollowKeyStack(), (currKey) => {\n return this.getFollowSetFromFollowKey(currKey)\n })\n return flatten(followStack)\n }\n getFollowSetFromFollowKey(followKey) {\n if (followKey === EOF_FOLLOW_KEY) {\n return [EOF]\n }\n const followName = followKey.ruleName + followKey.idxInCallingRule + IN + followKey.inRule\n return this.resyncFollows[followName]\n }\n // It does not make any sense to include a virtual EOF token in the list of resynced tokens\n // as EOF does not really exist and thus does not contain any useful information (line/column numbers)\n addToResyncTokens(token, resyncTokens) {\n if (!this.tokenMatcher(token, EOF)) {\n resyncTokens.push(token)\n }\n return resyncTokens\n }\n reSyncTo(tokType) {\n const resyncedTokens = []\n let nextTok = this.LA(1)\n while (this.tokenMatcher(nextTok, tokType) === false) {\n nextTok = this.SKIP_TOKEN()\n this.addToResyncTokens(nextTok, resyncedTokens)\n }\n // the last token is not part of the error.\n return dropRight(resyncedTokens)\n }\n attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {\n // by default this is a NO-OP\n // The actual implementation is with the function(not method) below\n }\n getCurrentGrammarPath(tokType, tokIdxInRule) {\n const pathRuleStack = this.getHumanReadableRuleStack()\n const pathOccurrenceStack = clone(this.RULE_OCCURRENCE_STACK)\n const grammarPath = {\n ruleStack: pathRuleStack,\n occurrenceStack: pathOccurrenceStack,\n lastTok: tokType,\n lastTokOccurrence: tokIdxInRule,\n }\n return grammarPath\n }\n getHumanReadableRuleStack() {\n return map(this.RULE_STACK, (currShortName) => this.shortRuleNameToFullName(currShortName))\n }\n }\n function attemptInRepetitionRecovery(\n prodFunc,\n args,\n lookaheadFunc,\n dslMethodIdx,\n prodOccurrence,\n nextToksWalker,\n notStuck,\n ) {\n const key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence)\n let firstAfterRepInfo = this.firstAfterRepMap[key]\n if (firstAfterRepInfo === undefined) {\n const currRuleName = this.getCurrRuleFullName()\n const ruleGrammar = this.getGAstProductions()[currRuleName]\n const walker = new nextToksWalker(ruleGrammar, prodOccurrence)\n firstAfterRepInfo = walker.startWalking()\n this.firstAfterRepMap[key] = firstAfterRepInfo\n }\n let expectTokAfterLastMatch = firstAfterRepInfo.token\n let nextTokIdx = firstAfterRepInfo.occurrence\n const isEndOfRule = firstAfterRepInfo.isEndOfRule\n // special edge case of a TOP most repetition after which the input should END.\n // this will force an attempt for inRule recovery in that scenario.\n if (this.RULE_STACK.length === 1 && isEndOfRule && expectTokAfterLastMatch === undefined) {\n expectTokAfterLastMatch = EOF\n nextTokIdx = 1\n }\n // We don't have anything to re-sync to...\n // this condition was extracted from `shouldInRepetitionRecoveryBeTried` to act as a type-guard\n if (expectTokAfterLastMatch === undefined || nextTokIdx === undefined) {\n return\n }\n if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck)) {\n // TODO: performance optimization: instead of passing the original args here, we modify\n // the args param (or create a new one) and make sure the lookahead func is explicitly provided\n // to avoid searching the cache for it once more.\n this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch)\n }\n }\n\n // Lookahead keys are 32Bit integers in the form\n // TTTTTTTT-ZZZZZZZZZZZZ-YYYY-XXXXXXXX\n // XXXX -> Occurrence Index bitmap.\n // YYYY -> DSL Method Type bitmap.\n // ZZZZZZZZZZZZZZZ -> Rule short Index bitmap.\n // TTTTTTTTT -> alternation alternative index bitmap\n const BITS_FOR_METHOD_TYPE = 4\n const BITS_FOR_OCCURRENCE_IDX = 8\n // short string used as part of mapping keys.\n // being short improves the performance when composing KEYS for maps out of these\n // The 5 - 8 bits (16 possible values, are reserved for the DSL method indices)\n const OR_IDX = 1 << BITS_FOR_OCCURRENCE_IDX\n const OPTION_IDX = 2 << BITS_FOR_OCCURRENCE_IDX\n const MANY_IDX = 3 << BITS_FOR_OCCURRENCE_IDX\n const AT_LEAST_ONE_IDX = 4 << BITS_FOR_OCCURRENCE_IDX\n const MANY_SEP_IDX = 5 << BITS_FOR_OCCURRENCE_IDX\n const AT_LEAST_ONE_SEP_IDX = 6 << BITS_FOR_OCCURRENCE_IDX\n // this actually returns a number, but it is always used as a string (object prop key)\n function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) {\n return occurrence | dslMethodIdx | ruleIdx\n }\n\n class LLkLookaheadStrategy {\n constructor(options) {\n var _a\n this.maxLookahead =\n (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0\n ? _a\n : DEFAULT_PARSER_CONFIG.maxLookahead\n }\n validate(options) {\n const leftRecursionErrors = this.validateNoLeftRecursion(options.rules)\n if (isEmpty(leftRecursionErrors)) {\n const emptyAltErrors = this.validateEmptyOrAlternatives(options.rules)\n const ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(options.rules, this.maxLookahead)\n const emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(options.rules, this.maxLookahead)\n const allErrors = [...leftRecursionErrors, ...emptyAltErrors, ...ambiguousAltsErrors, ...emptyRepetitionErrors]\n return allErrors\n }\n return leftRecursionErrors\n }\n validateNoLeftRecursion(rules) {\n return flatMap(rules, (currTopRule) =>\n validateNoLeftRecursion(currTopRule, currTopRule, defaultGrammarValidatorErrorProvider),\n )\n }\n validateEmptyOrAlternatives(rules) {\n return flatMap(rules, (currTopRule) =>\n validateEmptyOrAlternative(currTopRule, defaultGrammarValidatorErrorProvider),\n )\n }\n validateAmbiguousAlternationAlternatives(rules, maxLookahead) {\n return flatMap(rules, (currTopRule) =>\n validateAmbiguousAlternationAlternatives(currTopRule, maxLookahead, defaultGrammarValidatorErrorProvider),\n )\n }\n validateSomeNonEmptyLookaheadPath(rules, maxLookahead) {\n return validateSomeNonEmptyLookaheadPath(rules, maxLookahead, defaultGrammarValidatorErrorProvider)\n }\n buildLookaheadForAlternation(options) {\n return buildLookaheadFuncForOr(\n options.prodOccurrence,\n options.rule,\n options.maxLookahead,\n options.hasPredicates,\n options.dynamicTokensEnabled,\n buildAlternativesLookAheadFunc,\n )\n }\n buildLookaheadForOptional(options) {\n return buildLookaheadFuncForOptionalProd(\n options.prodOccurrence,\n options.rule,\n options.maxLookahead,\n options.dynamicTokensEnabled,\n getProdType(options.prodType),\n buildSingleAlternativeLookaheadFunction,\n )\n }\n }\n\n /**\n * Trait responsible for the lookahead related utilities and optimizations.\n */\n class LooksAhead {\n initLooksAhead(config) {\n this.dynamicTokensEnabled = has(config, 'dynamicTokensEnabled')\n ? config.dynamicTokensEnabled // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled\n this.maxLookahead = has(config, 'maxLookahead')\n ? config.maxLookahead // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.maxLookahead\n this.lookaheadStrategy = has(config, 'lookaheadStrategy')\n ? config.lookaheadStrategy // assumes end user provides the correct config value/type\n : new LLkLookaheadStrategy({ maxLookahead: this.maxLookahead })\n this.lookAheadFuncsCache = new Map()\n }\n preComputeLookaheadFunctions(rules) {\n forEach(rules, (currRule) => {\n this.TRACE_INIT(`${currRule.name} Rule Lookahead`, () => {\n const {\n alternation,\n repetition,\n option,\n repetitionMandatory,\n repetitionMandatoryWithSeparator,\n repetitionWithSeparator,\n } = collectMethods(currRule)\n forEach(alternation, (currProd) => {\n const prodIdx = currProd.idx === 0 ? '' : currProd.idx\n this.TRACE_INIT(`${getProductionDslName(currProd)}${prodIdx}`, () => {\n const laFunc = this.lookaheadStrategy.buildLookaheadForAlternation({\n prodOccurrence: currProd.idx,\n rule: currRule,\n maxLookahead: currProd.maxLookahead || this.maxLookahead,\n hasPredicates: currProd.hasPredicates,\n dynamicTokensEnabled: this.dynamicTokensEnabled,\n })\n const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name], OR_IDX, currProd.idx)\n this.setLaFuncCache(key, laFunc)\n })\n })\n forEach(repetition, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n MANY_IDX,\n 'Repetition',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(option, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n OPTION_IDX,\n 'Option',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(repetitionMandatory, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n AT_LEAST_ONE_IDX,\n 'RepetitionMandatory',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(repetitionMandatoryWithSeparator, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n AT_LEAST_ONE_SEP_IDX,\n 'RepetitionMandatoryWithSeparator',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n forEach(repetitionWithSeparator, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n MANY_SEP_IDX,\n 'RepetitionWithSeparator',\n currProd.maxLookahead,\n getProductionDslName(currProd),\n )\n })\n })\n })\n }\n computeLookaheadFunc(rule, prodOccurrence, prodKey, prodType, prodMaxLookahead, dslMethodName) {\n this.TRACE_INIT(`${dslMethodName}${prodOccurrence === 0 ? '' : prodOccurrence}`, () => {\n const laFunc = this.lookaheadStrategy.buildLookaheadForOptional({\n prodOccurrence,\n rule,\n maxLookahead: prodMaxLookahead || this.maxLookahead,\n dynamicTokensEnabled: this.dynamicTokensEnabled,\n prodType,\n })\n const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name], prodKey, prodOccurrence)\n this.setLaFuncCache(key, laFunc)\n })\n }\n // this actually returns a number, but it is always used as a string (object prop key)\n getKeyForAutomaticLookahead(dslMethodIdx, occurrence) {\n const currRuleShortName = this.getLastExplicitRuleShortName()\n return getKeyForAutomaticLookahead(currRuleShortName, dslMethodIdx, occurrence)\n }\n getLaFuncFromCache(key) {\n return this.lookAheadFuncsCache.get(key)\n }\n /* istanbul ignore next */\n setLaFuncCache(key, value) {\n this.lookAheadFuncsCache.set(key, value)\n }\n }\n class DslMethodsCollectorVisitor extends GAstVisitor {\n constructor() {\n super(...arguments)\n this.dslMethods = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: [],\n }\n }\n reset() {\n this.dslMethods = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: [],\n }\n }\n visitOption(option) {\n this.dslMethods.option.push(option)\n }\n visitRepetitionWithSeparator(manySep) {\n this.dslMethods.repetitionWithSeparator.push(manySep)\n }\n visitRepetitionMandatory(atLeastOne) {\n this.dslMethods.repetitionMandatory.push(atLeastOne)\n }\n visitRepetitionMandatoryWithSeparator(atLeastOneSep) {\n this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep)\n }\n visitRepetition(many) {\n this.dslMethods.repetition.push(many)\n }\n visitAlternation(or) {\n this.dslMethods.alternation.push(or)\n }\n }\n const collectorVisitor = new DslMethodsCollectorVisitor()\n function collectMethods(rule) {\n collectorVisitor.reset()\n rule.accept(collectorVisitor)\n const dslMethods = collectorVisitor.dslMethods\n // avoid uncleaned references\n collectorVisitor.reset()\n return dslMethods\n }\n\n /**\n * This nodeLocation tracking is not efficient and should only be used\n * when error recovery is enabled or the Token Vector contains virtual Tokens\n * (e.g, Python Indent/Outdent)\n * As it executes the calculation for every single terminal/nonTerminal\n * and does not rely on the fact the token vector is **sorted**\n */\n function setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) {\n // First (valid) update for this cst node\n if (isNaN(currNodeLocation.startOffset) === true) {\n // assumption1: Token location information is either NaN or a valid number\n // assumption2: Token location information is fully valid if it exist\n // (both start/end offsets exist and are numbers).\n currNodeLocation.startOffset = newLocationInfo.startOffset\n currNodeLocation.endOffset = newLocationInfo.endOffset\n }\n // Once the startOffset has been updated with a valid number it should never receive\n // any farther updates as the Token vector is sorted.\n // We still have to check this this condition for every new possible location info\n // because with error recovery enabled we may encounter invalid tokens (NaN location props)\n else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset\n }\n }\n /**\n * This nodeLocation tracking is not efficient and should only be used\n * when error recovery is enabled or the Token Vector contains virtual Tokens\n * (e.g, Python Indent/Outdent)\n * As it executes the calculation for every single terminal/nonTerminal\n * and does not rely on the fact the token vector is **sorted**\n */\n function setNodeLocationFull(currNodeLocation, newLocationInfo) {\n // First (valid) update for this cst node\n if (isNaN(currNodeLocation.startOffset) === true) {\n // assumption1: Token location information is either NaN or a valid number\n // assumption2: Token location information is fully valid if it exist\n // (all start/end props exist and are numbers).\n currNodeLocation.startOffset = newLocationInfo.startOffset\n currNodeLocation.startColumn = newLocationInfo.startColumn\n currNodeLocation.startLine = newLocationInfo.startLine\n currNodeLocation.endOffset = newLocationInfo.endOffset\n currNodeLocation.endColumn = newLocationInfo.endColumn\n currNodeLocation.endLine = newLocationInfo.endLine\n }\n // Once the start props has been updated with a valid number it should never receive\n // any farther updates as the Token vector is sorted.\n // We still have to check this this condition for every new possible location info\n // because with error recovery enabled we may encounter invalid tokens (NaN location props)\n else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset\n currNodeLocation.endColumn = newLocationInfo.endColumn\n currNodeLocation.endLine = newLocationInfo.endLine\n }\n }\n function addTerminalToCst(node, token, tokenTypeName) {\n if (node.children[tokenTypeName] === undefined) {\n node.children[tokenTypeName] = [token]\n } else {\n node.children[tokenTypeName].push(token)\n }\n }\n function addNoneTerminalToCst(node, ruleName, ruleResult) {\n if (node.children[ruleName] === undefined) {\n node.children[ruleName] = [ruleResult]\n } else {\n node.children[ruleName].push(ruleResult)\n }\n }\n\n const NAME = 'name'\n function defineNameProp(obj, nameValue) {\n Object.defineProperty(obj, NAME, {\n enumerable: false,\n configurable: true,\n writable: false,\n value: nameValue,\n })\n }\n\n function defaultVisit(ctx, param) {\n const childrenNames = keys(ctx)\n const childrenNamesLength = childrenNames.length\n for (let i = 0; i < childrenNamesLength; i++) {\n const currChildName = childrenNames[i]\n const currChildArray = ctx[currChildName]\n const currChildArrayLength = currChildArray.length\n for (let j = 0; j < currChildArrayLength; j++) {\n const currChild = currChildArray[j]\n // distinction between Tokens Children and CstNode children\n if (currChild.tokenTypeIdx === undefined) {\n this[currChild.name](currChild.children, param)\n }\n }\n }\n // defaultVisit does not support generic out param\n }\n function createBaseSemanticVisitorConstructor(grammarName, ruleNames) {\n const derivedConstructor = function () {}\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n defineNameProp(derivedConstructor, grammarName + 'BaseSemantics')\n const semanticProto = {\n visit: function (cstNode, param) {\n // enables writing more concise visitor methods when CstNode has only a single child\n if (isArray$1(cstNode)) {\n // A CST Node's children dictionary can never have empty arrays as values\n // If a key is defined there will be at least one element in the corresponding value array.\n cstNode = cstNode[0]\n }\n // enables passing optional CstNodes concisely.\n if (isUndefined(cstNode)) {\n return undefined\n }\n return this[cstNode.name](cstNode.children, param)\n },\n validateVisitor: function () {\n const semanticDefinitionErrors = validateVisitor(this, ruleNames)\n if (!isEmpty(semanticDefinitionErrors)) {\n const errorMessages = map(semanticDefinitionErrors, (currDefError) => currDefError.msg)\n throw Error(\n `Errors Detected in CST Visitor <${this.constructor.name}>:\\n\\t` +\n `${errorMessages.join('\\n\\n').replace(/\\n/g, '\\n\\t')}`,\n )\n }\n },\n }\n derivedConstructor.prototype = semanticProto\n derivedConstructor.prototype.constructor = derivedConstructor\n derivedConstructor._RULE_NAMES = ruleNames\n return derivedConstructor\n }\n function createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) {\n const derivedConstructor = function () {}\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n defineNameProp(derivedConstructor, grammarName + 'BaseSemanticsWithDefaults')\n const withDefaultsProto = Object.create(baseConstructor.prototype)\n forEach(ruleNames, (ruleName) => {\n withDefaultsProto[ruleName] = defaultVisit\n })\n derivedConstructor.prototype = withDefaultsProto\n derivedConstructor.prototype.constructor = derivedConstructor\n return derivedConstructor\n }\n var CstVisitorDefinitionError\n ;(function (CstVisitorDefinitionError) {\n CstVisitorDefinitionError[(CstVisitorDefinitionError['REDUNDANT_METHOD'] = 0)] = 'REDUNDANT_METHOD'\n CstVisitorDefinitionError[(CstVisitorDefinitionError['MISSING_METHOD'] = 1)] = 'MISSING_METHOD'\n })(CstVisitorDefinitionError || (CstVisitorDefinitionError = {}))\n function validateVisitor(visitorInstance, ruleNames) {\n const missingErrors = validateMissingCstMethods(visitorInstance, ruleNames)\n return missingErrors\n }\n function validateMissingCstMethods(visitorInstance, ruleNames) {\n const missingRuleNames = filter(ruleNames, (currRuleName) => {\n return isFunction(visitorInstance[currRuleName]) === false\n })\n const errors = map(missingRuleNames, (currRuleName) => {\n return {\n msg: `Missing visitor method: <${currRuleName}> on ${visitorInstance.constructor.name} CST Visitor.`,\n type: CstVisitorDefinitionError.MISSING_METHOD,\n methodName: currRuleName,\n }\n })\n return compact(errors)\n }\n\n /**\n * This trait is responsible for the CST building logic.\n */\n class TreeBuilder {\n initTreeBuilder(config) {\n this.CST_STACK = []\n // outputCst is no longer exposed/defined in the pubic API\n this.outputCst = config.outputCst\n this.nodeLocationTracking = has(config, 'nodeLocationTracking')\n ? config.nodeLocationTracking // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.nodeLocationTracking\n if (!this.outputCst) {\n this.cstInvocationStateUpdate = noop\n this.cstFinallyStateUpdate = noop\n this.cstPostTerminal = noop\n this.cstPostNonTerminal = noop\n this.cstPostRule = noop\n } else {\n if (/full/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = setNodeLocationFull\n this.setNodeLocationFromNode = setNodeLocationFull\n this.cstPostRule = noop\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery\n } else {\n this.setNodeLocationFromToken = noop\n this.setNodeLocationFromNode = noop\n this.cstPostRule = this.cstPostRuleFull\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular\n }\n } else if (/onlyOffset/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = setNodeLocationOnlyOffset\n this.setNodeLocationFromNode = setNodeLocationOnlyOffset\n this.cstPostRule = noop\n this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery\n } else {\n this.setNodeLocationFromToken = noop\n this.setNodeLocationFromNode = noop\n this.cstPostRule = this.cstPostRuleOnlyOffset\n this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular\n }\n } else if (/none/i.test(this.nodeLocationTracking)) {\n this.setNodeLocationFromToken = noop\n this.setNodeLocationFromNode = noop\n this.cstPostRule = noop\n this.setInitialNodeLocation = noop\n } else {\n throw Error(`Invalid config option: \"${config.nodeLocationTracking}\"`)\n }\n }\n }\n setInitialNodeLocationOnlyOffsetRecovery(cstNode) {\n cstNode.location = {\n startOffset: NaN,\n endOffset: NaN,\n }\n }\n setInitialNodeLocationOnlyOffsetRegular(cstNode) {\n cstNode.location = {\n // without error recovery the starting Location of a new CstNode is guaranteed\n // To be the next Token's startOffset (for valid inputs).\n // For invalid inputs there won't be any CSTOutput so this potential\n // inaccuracy does not matter\n startOffset: this.LA(1).startOffset,\n endOffset: NaN,\n }\n }\n setInitialNodeLocationFullRecovery(cstNode) {\n cstNode.location = {\n startOffset: NaN,\n startLine: NaN,\n startColumn: NaN,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN,\n }\n }\n /**\n * @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work\n \n * @param cstNode\n */\n setInitialNodeLocationFullRegular(cstNode) {\n const nextToken = this.LA(1)\n cstNode.location = {\n startOffset: nextToken.startOffset,\n startLine: nextToken.startLine,\n startColumn: nextToken.startColumn,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN,\n }\n }\n cstInvocationStateUpdate(fullRuleName) {\n const cstNode = {\n name: fullRuleName,\n children: Object.create(null),\n }\n this.setInitialNodeLocation(cstNode)\n this.CST_STACK.push(cstNode)\n }\n cstFinallyStateUpdate() {\n this.CST_STACK.pop()\n }\n cstPostRuleFull(ruleCstNode) {\n // casts to `required` are safe because `cstPostRuleFull` should only be invoked when full location is enabled\n const prevToken = this.LA(0)\n const loc = ruleCstNode.location\n // If this condition is true it means we consumed at least one Token\n // In this CstNode.\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset\n loc.endLine = prevToken.endLine\n loc.endColumn = prevToken.endColumn\n }\n // \"empty\" CstNode edge case\n else {\n loc.startOffset = NaN\n loc.startLine = NaN\n loc.startColumn = NaN\n }\n }\n cstPostRuleOnlyOffset(ruleCstNode) {\n const prevToken = this.LA(0)\n // `location' is not null because `cstPostRuleOnlyOffset` will only be invoked when location tracking is enabled.\n const loc = ruleCstNode.location\n // If this condition is true it means we consumed at least one Token\n // In this CstNode.\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset\n }\n // \"empty\" CstNode edge case\n else {\n loc.startOffset = NaN\n }\n }\n cstPostTerminal(key, consumedToken) {\n const rootCst = this.CST_STACK[this.CST_STACK.length - 1]\n addTerminalToCst(rootCst, consumedToken, key)\n // This is only used when **both** error recovery and CST Output are enabled.\n this.setNodeLocationFromToken(rootCst.location, consumedToken)\n }\n cstPostNonTerminal(ruleCstResult, ruleName) {\n const preCstNode = this.CST_STACK[this.CST_STACK.length - 1]\n addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult)\n // This is only used when **both** error recovery and CST Output are enabled.\n this.setNodeLocationFromNode(preCstNode.location, ruleCstResult.location)\n }\n getBaseCstVisitorConstructor() {\n if (isUndefined(this.baseCstVisitorConstructor)) {\n const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(\n this.className,\n keys(this.gastProductionsCache),\n )\n this.baseCstVisitorConstructor = newBaseCstVisitorConstructor\n return newBaseCstVisitorConstructor\n }\n return this.baseCstVisitorConstructor\n }\n getBaseCstVisitorConstructorWithDefaults() {\n if (isUndefined(this.baseCstVisitorWithDefaultsConstructor)) {\n const newConstructor = createBaseVisitorConstructorWithDefaults(\n this.className,\n keys(this.gastProductionsCache),\n this.getBaseCstVisitorConstructor(),\n )\n this.baseCstVisitorWithDefaultsConstructor = newConstructor\n return newConstructor\n }\n return this.baseCstVisitorWithDefaultsConstructor\n }\n getLastExplicitRuleShortName() {\n const ruleStack = this.RULE_STACK\n return ruleStack[ruleStack.length - 1]\n }\n getPreviousExplicitRuleShortName() {\n const ruleStack = this.RULE_STACK\n return ruleStack[ruleStack.length - 2]\n }\n getLastExplicitRuleOccurrenceIndex() {\n const occurrenceStack = this.RULE_OCCURRENCE_STACK\n return occurrenceStack[occurrenceStack.length - 1]\n }\n }\n\n /**\n * Trait responsible abstracting over the interaction with Lexer output (Token vector).\n *\n * This could be generalized to support other kinds of lexers, e.g.\n * - Just in Time Lexing / Lexer-Less parsing.\n * - Streaming Lexer.\n */\n class LexerAdapter {\n initLexerAdapter() {\n this.tokVector = []\n this.tokVectorLength = 0\n this.currIdx = -1\n }\n set input(newInput) {\n // @ts-ignore - `this parameter` not supported in setters/getters\n // - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters\n if (this.selfAnalysisDone !== true) {\n throw Error(`Missing invocation at the end of the Parser's constructor.`)\n }\n // @ts-ignore - `this parameter` not supported in setters/getters\n // - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters\n this.reset()\n this.tokVector = newInput\n this.tokVectorLength = newInput.length\n }\n get input() {\n return this.tokVector\n }\n // skips a token and returns the next token\n SKIP_TOKEN() {\n if (this.currIdx <= this.tokVector.length - 2) {\n this.consumeToken()\n return this.LA(1)\n } else {\n return END_OF_FILE\n }\n }\n // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers\n // or lexers dependent on parser context.\n LA(howMuch) {\n const soughtIdx = this.currIdx + howMuch\n if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) {\n return END_OF_FILE\n } else {\n return this.tokVector[soughtIdx]\n }\n }\n consumeToken() {\n this.currIdx++\n }\n exportLexerState() {\n return this.currIdx\n }\n importLexerState(newState) {\n this.currIdx = newState\n }\n resetLexerState() {\n this.currIdx = -1\n }\n moveToTerminatedState() {\n this.currIdx = this.tokVector.length - 1\n }\n getLexerPosition() {\n return this.exportLexerState()\n }\n }\n\n /**\n * This trait is responsible for implementing the public API\n * for defining Chevrotain parsers, i.e:\n * - CONSUME\n * - RULE\n * - OPTION\n * - ...\n */\n class RecognizerApi {\n ACTION(impl) {\n return impl.call(this)\n }\n consume(idx, tokType, options) {\n return this.consumeInternal(tokType, idx, options)\n }\n subrule(idx, ruleToCall, options) {\n return this.subruleInternal(ruleToCall, idx, options)\n }\n option(idx, actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, idx)\n }\n or(idx, altsOrOpts) {\n return this.orInternal(altsOrOpts, idx)\n }\n many(idx, actionORMethodDef) {\n return this.manyInternal(idx, actionORMethodDef)\n }\n atLeastOne(idx, actionORMethodDef) {\n return this.atLeastOneInternal(idx, actionORMethodDef)\n }\n CONSUME(tokType, options) {\n return this.consumeInternal(tokType, 0, options)\n }\n CONSUME1(tokType, options) {\n return this.consumeInternal(tokType, 1, options)\n }\n CONSUME2(tokType, options) {\n return this.consumeInternal(tokType, 2, options)\n }\n CONSUME3(tokType, options) {\n return this.consumeInternal(tokType, 3, options)\n }\n CONSUME4(tokType, options) {\n return this.consumeInternal(tokType, 4, options)\n }\n CONSUME5(tokType, options) {\n return this.consumeInternal(tokType, 5, options)\n }\n CONSUME6(tokType, options) {\n return this.consumeInternal(tokType, 6, options)\n }\n CONSUME7(tokType, options) {\n return this.consumeInternal(tokType, 7, options)\n }\n CONSUME8(tokType, options) {\n return this.consumeInternal(tokType, 8, options)\n }\n CONSUME9(tokType, options) {\n return this.consumeInternal(tokType, 9, options)\n }\n SUBRULE(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 0, options)\n }\n SUBRULE1(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 1, options)\n }\n SUBRULE2(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 2, options)\n }\n SUBRULE3(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 3, options)\n }\n SUBRULE4(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 4, options)\n }\n SUBRULE5(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 5, options)\n }\n SUBRULE6(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 6, options)\n }\n SUBRULE7(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 7, options)\n }\n SUBRULE8(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 8, options)\n }\n SUBRULE9(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 9, options)\n }\n OPTION(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 0)\n }\n OPTION1(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 1)\n }\n OPTION2(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 2)\n }\n OPTION3(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 3)\n }\n OPTION4(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 4)\n }\n OPTION5(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 5)\n }\n OPTION6(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 6)\n }\n OPTION7(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 7)\n }\n OPTION8(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 8)\n }\n OPTION9(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 9)\n }\n OR(altsOrOpts) {\n return this.orInternal(altsOrOpts, 0)\n }\n OR1(altsOrOpts) {\n return this.orInternal(altsOrOpts, 1)\n }\n OR2(altsOrOpts) {\n return this.orInternal(altsOrOpts, 2)\n }\n OR3(altsOrOpts) {\n return this.orInternal(altsOrOpts, 3)\n }\n OR4(altsOrOpts) {\n return this.orInternal(altsOrOpts, 4)\n }\n OR5(altsOrOpts) {\n return this.orInternal(altsOrOpts, 5)\n }\n OR6(altsOrOpts) {\n return this.orInternal(altsOrOpts, 6)\n }\n OR7(altsOrOpts) {\n return this.orInternal(altsOrOpts, 7)\n }\n OR8(altsOrOpts) {\n return this.orInternal(altsOrOpts, 8)\n }\n OR9(altsOrOpts) {\n return this.orInternal(altsOrOpts, 9)\n }\n MANY(actionORMethodDef) {\n this.manyInternal(0, actionORMethodDef)\n }\n MANY1(actionORMethodDef) {\n this.manyInternal(1, actionORMethodDef)\n }\n MANY2(actionORMethodDef) {\n this.manyInternal(2, actionORMethodDef)\n }\n MANY3(actionORMethodDef) {\n this.manyInternal(3, actionORMethodDef)\n }\n MANY4(actionORMethodDef) {\n this.manyInternal(4, actionORMethodDef)\n }\n MANY5(actionORMethodDef) {\n this.manyInternal(5, actionORMethodDef)\n }\n MANY6(actionORMethodDef) {\n this.manyInternal(6, actionORMethodDef)\n }\n MANY7(actionORMethodDef) {\n this.manyInternal(7, actionORMethodDef)\n }\n MANY8(actionORMethodDef) {\n this.manyInternal(8, actionORMethodDef)\n }\n MANY9(actionORMethodDef) {\n this.manyInternal(9, actionORMethodDef)\n }\n MANY_SEP(options) {\n this.manySepFirstInternal(0, options)\n }\n MANY_SEP1(options) {\n this.manySepFirstInternal(1, options)\n }\n MANY_SEP2(options) {\n this.manySepFirstInternal(2, options)\n }\n MANY_SEP3(options) {\n this.manySepFirstInternal(3, options)\n }\n MANY_SEP4(options) {\n this.manySepFirstInternal(4, options)\n }\n MANY_SEP5(options) {\n this.manySepFirstInternal(5, options)\n }\n MANY_SEP6(options) {\n this.manySepFirstInternal(6, options)\n }\n MANY_SEP7(options) {\n this.manySepFirstInternal(7, options)\n }\n MANY_SEP8(options) {\n this.manySepFirstInternal(8, options)\n }\n MANY_SEP9(options) {\n this.manySepFirstInternal(9, options)\n }\n AT_LEAST_ONE(actionORMethodDef) {\n this.atLeastOneInternal(0, actionORMethodDef)\n }\n AT_LEAST_ONE1(actionORMethodDef) {\n return this.atLeastOneInternal(1, actionORMethodDef)\n }\n AT_LEAST_ONE2(actionORMethodDef) {\n this.atLeastOneInternal(2, actionORMethodDef)\n }\n AT_LEAST_ONE3(actionORMethodDef) {\n this.atLeastOneInternal(3, actionORMethodDef)\n }\n AT_LEAST_ONE4(actionORMethodDef) {\n this.atLeastOneInternal(4, actionORMethodDef)\n }\n AT_LEAST_ONE5(actionORMethodDef) {\n this.atLeastOneInternal(5, actionORMethodDef)\n }\n AT_LEAST_ONE6(actionORMethodDef) {\n this.atLeastOneInternal(6, actionORMethodDef)\n }\n AT_LEAST_ONE7(actionORMethodDef) {\n this.atLeastOneInternal(7, actionORMethodDef)\n }\n AT_LEAST_ONE8(actionORMethodDef) {\n this.atLeastOneInternal(8, actionORMethodDef)\n }\n AT_LEAST_ONE9(actionORMethodDef) {\n this.atLeastOneInternal(9, actionORMethodDef)\n }\n AT_LEAST_ONE_SEP(options) {\n this.atLeastOneSepFirstInternal(0, options)\n }\n AT_LEAST_ONE_SEP1(options) {\n this.atLeastOneSepFirstInternal(1, options)\n }\n AT_LEAST_ONE_SEP2(options) {\n this.atLeastOneSepFirstInternal(2, options)\n }\n AT_LEAST_ONE_SEP3(options) {\n this.atLeastOneSepFirstInternal(3, options)\n }\n AT_LEAST_ONE_SEP4(options) {\n this.atLeastOneSepFirstInternal(4, options)\n }\n AT_LEAST_ONE_SEP5(options) {\n this.atLeastOneSepFirstInternal(5, options)\n }\n AT_LEAST_ONE_SEP6(options) {\n this.atLeastOneSepFirstInternal(6, options)\n }\n AT_LEAST_ONE_SEP7(options) {\n this.atLeastOneSepFirstInternal(7, options)\n }\n AT_LEAST_ONE_SEP8(options) {\n this.atLeastOneSepFirstInternal(8, options)\n }\n AT_LEAST_ONE_SEP9(options) {\n this.atLeastOneSepFirstInternal(9, options)\n }\n RULE(name, implementation, config = DEFAULT_RULE_CONFIG) {\n if (includes(this.definedRulesNames, name)) {\n const errMsg = defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({\n topLevelRule: name,\n grammarName: this.className,\n })\n const error = {\n message: errMsg,\n type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: name,\n }\n this.definitionErrors.push(error)\n }\n this.definedRulesNames.push(name)\n const ruleImplementation = this.defineRule(name, implementation, config)\n this[name] = ruleImplementation\n return ruleImplementation\n }\n OVERRIDE_RULE(name, impl, config = DEFAULT_RULE_CONFIG) {\n const ruleErrors = validateRuleIsOverridden(name, this.definedRulesNames, this.className)\n this.definitionErrors = this.definitionErrors.concat(ruleErrors)\n const ruleImplementation = this.defineRule(name, impl, config)\n this[name] = ruleImplementation\n return ruleImplementation\n }\n BACKTRACK(grammarRule, args) {\n return function () {\n // save org state\n this.isBackTrackingStack.push(1)\n const orgState = this.saveRecogState()\n try {\n grammarRule.apply(this, args)\n // if no exception was thrown we have succeed parsing the rule.\n return true\n } catch (e) {\n if (isRecognitionException(e)) {\n return false\n } else {\n throw e\n }\n } finally {\n this.reloadRecogState(orgState)\n this.isBackTrackingStack.pop()\n }\n }\n }\n // GAST export APIs\n getGAstProductions() {\n return this.gastProductionsCache\n }\n getSerializedGastProductions() {\n return serializeGrammar(values(this.gastProductionsCache))\n }\n }\n\n /**\n * This trait is responsible for the runtime parsing engine\n * Used by the official API (recognizer_api.ts)\n */\n class RecognizerEngine {\n initRecognizerEngine(tokenVocabulary, config) {\n this.className = this.constructor.name\n // TODO: would using an ES6 Map or plain object be faster (CST building scenario)\n this.shortRuleNameToFull = {}\n this.fullRuleNameToShort = {}\n this.ruleShortNameIdx = 256\n this.tokenMatcher = tokenStructuredMatcherNoCategories\n this.subruleIdx = 0\n this.definedRulesNames = []\n this.tokensMap = {}\n this.isBackTrackingStack = []\n this.RULE_STACK = []\n this.RULE_OCCURRENCE_STACK = []\n this.gastProductionsCache = {}\n if (has(config, 'serializedGrammar')) {\n throw Error(\n \"The Parser's configuration can no longer contain a property.\\n\" +\n '\\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\\n' +\n '\\tFor Further details.',\n )\n }\n if (isArray$1(tokenVocabulary)) {\n // This only checks for Token vocabularies provided as arrays.\n // That is good enough because the main objective is to detect users of pre-V4.0 APIs\n // rather than all edge cases of empty Token vocabularies.\n if (isEmpty(tokenVocabulary)) {\n throw Error(\n 'A Token Vocabulary cannot be empty.\\n' +\n '\\tNote that the first argument for the parser constructor\\n' +\n '\\tis no longer a Token vector (since v4.0).',\n )\n }\n if (typeof tokenVocabulary[0].startOffset === 'number') {\n throw Error(\n 'The Parser constructor no longer accepts a token vector as the first argument.\\n' +\n '\\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\\n' +\n '\\tFor Further details.',\n )\n }\n }\n if (isArray$1(tokenVocabulary)) {\n this.tokensMap = reduce(\n tokenVocabulary,\n (acc, tokType) => {\n acc[tokType.name] = tokType\n return acc\n },\n {},\n )\n } else if (has(tokenVocabulary, 'modes') && every(flatten(values(tokenVocabulary.modes)), isTokenType)) {\n const allTokenTypes = flatten(values(tokenVocabulary.modes))\n const uniqueTokens = uniq(allTokenTypes)\n this.tokensMap = reduce(\n uniqueTokens,\n (acc, tokType) => {\n acc[tokType.name] = tokType\n return acc\n },\n {},\n )\n } else if (isObject(tokenVocabulary)) {\n this.tokensMap = clone(tokenVocabulary)\n } else {\n throw new Error(\n ' argument must be An Array of Token constructors,' +\n ' A dictionary of Token constructors or an IMultiModeLexerDefinition',\n )\n }\n // always add EOF to the tokenNames -> constructors map. it is useful to assure all the input has been\n // parsed with a clear error message (\"expecting EOF but found ...\")\n this.tokensMap['EOF'] = EOF\n const allTokenTypes = has(tokenVocabulary, 'modes')\n ? flatten(values(tokenVocabulary.modes))\n : values(tokenVocabulary)\n const noTokenCategoriesUsed = every(allTokenTypes, (tokenConstructor) =>\n isEmpty(tokenConstructor.categoryMatches),\n )\n this.tokenMatcher = noTokenCategoriesUsed ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher\n // Because ES2015+ syntax should be supported for creating Token classes\n // We cannot assume that the Token classes were created using the \"extendToken\" utilities\n // Therefore we must augment the Token classes both on Lexer initialization and on Parser initialization\n augmentTokenTypes(values(this.tokensMap))\n }\n defineRule(ruleName, impl, config) {\n if (this.selfAnalysisDone) {\n throw Error(\n `Grammar rule <${ruleName}> may not be defined after the 'performSelfAnalysis' method has been called'\\n` +\n `Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`,\n )\n }\n const resyncEnabled = has(config, 'resyncEnabled')\n ? config.resyncEnabled // assumes end user provides the correct config value/type\n : DEFAULT_RULE_CONFIG.resyncEnabled\n const recoveryValueFunc = has(config, 'recoveryValueFunc')\n ? config.recoveryValueFunc // assumes end user provides the correct config value/type\n : DEFAULT_RULE_CONFIG.recoveryValueFunc\n // performance optimization: Use small integers as keys for the longer human readable \"full\" rule names.\n // this greatly improves Map access time (as much as 8% for some performance benchmarks).\n const shortName = this.ruleShortNameIdx << (BITS_FOR_METHOD_TYPE + BITS_FOR_OCCURRENCE_IDX)\n this.ruleShortNameIdx++\n this.shortRuleNameToFull[shortName] = ruleName\n this.fullRuleNameToShort[ruleName] = shortName\n let invokeRuleWithTry\n // Micro optimization, only check the condition **once** on rule definition\n // instead of **every single** rule invocation.\n if (this.outputCst === true) {\n invokeRuleWithTry = function invokeRuleWithTry(...args) {\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx)\n impl.apply(this, args)\n const cst = this.CST_STACK[this.CST_STACK.length - 1]\n this.cstPostRule(cst)\n return cst\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc)\n } finally {\n this.ruleFinallyStateUpdate()\n }\n }\n } else {\n invokeRuleWithTry = function invokeRuleWithTryCst(...args) {\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx)\n return impl.apply(this, args)\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc)\n } finally {\n this.ruleFinallyStateUpdate()\n }\n }\n }\n const wrappedGrammarRule = Object.assign(invokeRuleWithTry, { ruleName, originalGrammarAction: impl })\n return wrappedGrammarRule\n }\n invokeRuleCatch(e, resyncEnabledConfig, recoveryValueFunc) {\n const isFirstInvokedRule = this.RULE_STACK.length === 1\n // note the reSync is always enabled for the first rule invocation, because we must always be able to\n // reSync with EOF and just output some INVALID ParseTree\n // during backtracking reSync recovery is disabled, otherwise we can't be certain the backtracking\n // path is really the most valid one\n const reSyncEnabled = resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled\n if (isRecognitionException(e)) {\n const recogError = e\n if (reSyncEnabled) {\n const reSyncTokType = this.findReSyncTokenType()\n if (this.isInCurrentRuleReSyncSet(reSyncTokType)) {\n recogError.resyncedTokens = this.reSyncTo(reSyncTokType)\n if (this.outputCst) {\n const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]\n partialCstResult.recoveredNode = true\n return partialCstResult\n } else {\n return recoveryValueFunc(e)\n }\n } else {\n if (this.outputCst) {\n const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]\n partialCstResult.recoveredNode = true\n recogError.partialCstResult = partialCstResult\n }\n // to be handled Further up the call stack\n throw recogError\n }\n } else if (isFirstInvokedRule) {\n // otherwise a Redundant input error will be created as well and we cannot guarantee that this is indeed the case\n this.moveToTerminatedState()\n // the parser should never throw one of its own errors outside its flow.\n // even if error recovery is disabled\n return recoveryValueFunc(e)\n } else {\n // to be recovered Further up the call stack\n throw recogError\n }\n } else {\n // some other Error type which we don't know how to handle (for example a built in JavaScript Error)\n throw e\n }\n }\n // Implementation of parsing DSL\n optionInternal(actionORMethodDef, occurrence) {\n const key = this.getKeyForAutomaticLookahead(OPTION_IDX, occurrence)\n return this.optionInternalLogic(actionORMethodDef, occurrence, key)\n }\n optionInternalLogic(actionORMethodDef, occurrence, key) {\n let lookAheadFunc = this.getLaFuncFromCache(key)\n let action\n if (typeof actionORMethodDef !== 'function') {\n action = actionORMethodDef.DEF\n const predicate = actionORMethodDef.GATE\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookAheadFunc\n lookAheadFunc = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this)\n }\n }\n } else {\n action = actionORMethodDef\n }\n if (lookAheadFunc.call(this) === true) {\n return action.call(this)\n }\n return undefined\n }\n atLeastOneInternal(prodOccurrence, actionORMethodDef) {\n const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_IDX, prodOccurrence)\n return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, laKey)\n }\n atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, key) {\n let lookAheadFunc = this.getLaFuncFromCache(key)\n let action\n if (typeof actionORMethodDef !== 'function') {\n action = actionORMethodDef.DEF\n const predicate = actionORMethodDef.GATE\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookAheadFunc\n lookAheadFunc = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this)\n }\n }\n } else {\n action = actionORMethodDef\n }\n if (lookAheadFunc.call(this) === true) {\n let notStuck = this.doSingleRepetition(action)\n while (lookAheadFunc.call(this) === true && notStuck === true) {\n notStuck = this.doSingleRepetition(action)\n }\n } else {\n throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG)\n }\n // note that while it may seem that this can cause an error because by using a recursive call to\n // AT_LEAST_ONE we change the grammar to AT_LEAST_TWO, AT_LEAST_THREE ... , the possible recursive call\n // from the tryInRepetitionRecovery(...) will only happen IFF there really are TWO/THREE/.... items.\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.atLeastOneInternal,\n [prodOccurrence, actionORMethodDef],\n lookAheadFunc,\n AT_LEAST_ONE_IDX,\n prodOccurrence,\n NextTerminalAfterAtLeastOneWalker,\n )\n }\n atLeastOneSepFirstInternal(prodOccurrence, options) {\n const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_SEP_IDX, prodOccurrence)\n this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, laKey)\n }\n atLeastOneSepFirstInternalLogic(prodOccurrence, options, key) {\n const action = options.DEF\n const separator = options.SEP\n const firstIterationLookaheadFunc = this.getLaFuncFromCache(key)\n // 1st iteration\n if (firstIterationLookaheadFunc.call(this) === true) {\n action.call(this)\n // TODO: Optimization can move this function construction into \"attemptInRepetitionRecovery\"\n // because it is only needed in error recovery scenarios.\n const separatorLookAheadFunc = () => {\n return this.tokenMatcher(this.LA(1), separator)\n }\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator)\n // No need for checking infinite loop here due to consuming the separator.\n action.call(this)\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [prodOccurrence, separator, separatorLookAheadFunc, action, NextTerminalAfterAtLeastOneSepWalker],\n separatorLookAheadFunc,\n AT_LEAST_ONE_SEP_IDX,\n prodOccurrence,\n NextTerminalAfterAtLeastOneSepWalker,\n )\n } else {\n throw this.raiseEarlyExitException(\n prodOccurrence,\n PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,\n options.ERR_MSG,\n )\n }\n }\n manyInternal(prodOccurrence, actionORMethodDef) {\n const laKey = this.getKeyForAutomaticLookahead(MANY_IDX, prodOccurrence)\n return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey)\n }\n manyInternalLogic(prodOccurrence, actionORMethodDef, key) {\n let lookaheadFunction = this.getLaFuncFromCache(key)\n let action\n if (typeof actionORMethodDef !== 'function') {\n action = actionORMethodDef.DEF\n const predicate = actionORMethodDef.GATE\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookaheadFunction\n lookaheadFunction = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this)\n }\n }\n } else {\n action = actionORMethodDef\n }\n let notStuck = true\n while (lookaheadFunction.call(this) === true && notStuck === true) {\n notStuck = this.doSingleRepetition(action)\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.manyInternal,\n [prodOccurrence, actionORMethodDef],\n lookaheadFunction,\n MANY_IDX,\n prodOccurrence,\n NextTerminalAfterManyWalker,\n // The notStuck parameter is only relevant when \"attemptInRepetitionRecovery\"\n // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP]\n // An infinite loop cannot occur as:\n // - Either the lookahead is guaranteed to consume something (Single Token Separator)\n // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out).\n notStuck,\n )\n }\n manySepFirstInternal(prodOccurrence, options) {\n const laKey = this.getKeyForAutomaticLookahead(MANY_SEP_IDX, prodOccurrence)\n this.manySepFirstInternalLogic(prodOccurrence, options, laKey)\n }\n manySepFirstInternalLogic(prodOccurrence, options, key) {\n const action = options.DEF\n const separator = options.SEP\n const firstIterationLaFunc = this.getLaFuncFromCache(key)\n // 1st iteration\n if (firstIterationLaFunc.call(this) === true) {\n action.call(this)\n const separatorLookAheadFunc = () => {\n return this.tokenMatcher(this.LA(1), separator)\n }\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator)\n // No need for checking infinite loop here due to consuming the separator.\n action.call(this)\n }\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [prodOccurrence, separator, separatorLookAheadFunc, action, NextTerminalAfterManySepWalker],\n separatorLookAheadFunc,\n MANY_SEP_IDX,\n prodOccurrence,\n NextTerminalAfterManySepWalker,\n )\n }\n }\n repetitionSepSecondInternal(prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker) {\n while (separatorLookAheadFunc()) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator)\n action.call(this)\n }\n // we can only arrive to this function after an error\n // has occurred (hence the name 'second') so the following\n // IF will always be entered, its possible to remove it...\n // however it is kept to avoid confusion and be consistent.\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n /* istanbul ignore else */\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker],\n separatorLookAheadFunc,\n AT_LEAST_ONE_SEP_IDX,\n prodOccurrence,\n nextTerminalAfterWalker,\n )\n }\n doSingleRepetition(action) {\n const beforeIteration = this.getLexerPosition()\n action.call(this)\n const afterIteration = this.getLexerPosition()\n // This boolean will indicate if this repetition progressed\n // or if we are \"stuck\" (potential infinite loop in the repetition).\n return afterIteration > beforeIteration\n }\n orInternal(altsOrOpts, occurrence) {\n const laKey = this.getKeyForAutomaticLookahead(OR_IDX, occurrence)\n const alts = isArray$1(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF\n const laFunc = this.getLaFuncFromCache(laKey)\n const altIdxToTake = laFunc.call(this, alts)\n if (altIdxToTake !== undefined) {\n const chosenAlternative = alts[altIdxToTake]\n return chosenAlternative.ALT.call(this)\n }\n this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG)\n }\n ruleFinallyStateUpdate() {\n this.RULE_STACK.pop()\n this.RULE_OCCURRENCE_STACK.pop()\n // NOOP when cst is disabled\n this.cstFinallyStateUpdate()\n if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) {\n const firstRedundantTok = this.LA(1)\n const errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({\n firstRedundant: firstRedundantTok,\n ruleName: this.getCurrRuleFullName(),\n })\n this.SAVE_ERROR(new NotAllInputParsedException(errMsg, firstRedundantTok))\n }\n }\n subruleInternal(ruleToCall, idx, options) {\n let ruleResult\n try {\n const args = options !== undefined ? options.ARGS : undefined\n this.subruleIdx = idx\n ruleResult = ruleToCall.apply(this, args)\n this.cstPostNonTerminal(\n ruleResult,\n options !== undefined && options.LABEL !== undefined ? options.LABEL : ruleToCall.ruleName,\n )\n return ruleResult\n } catch (e) {\n throw this.subruleInternalError(e, options, ruleToCall.ruleName)\n }\n }\n subruleInternalError(e, options, ruleName) {\n if (isRecognitionException(e) && e.partialCstResult !== undefined) {\n this.cstPostNonTerminal(\n e.partialCstResult,\n options !== undefined && options.LABEL !== undefined ? options.LABEL : ruleName,\n )\n delete e.partialCstResult\n }\n throw e\n }\n consumeInternal(tokType, idx, options) {\n let consumedToken\n try {\n const nextToken = this.LA(1)\n if (this.tokenMatcher(nextToken, tokType) === true) {\n this.consumeToken()\n consumedToken = nextToken\n } else {\n this.consumeInternalError(tokType, nextToken, options)\n }\n } catch (eFromConsumption) {\n consumedToken = this.consumeInternalRecovery(tokType, idx, eFromConsumption)\n }\n this.cstPostTerminal(\n options !== undefined && options.LABEL !== undefined ? options.LABEL : tokType.name,\n consumedToken,\n )\n return consumedToken\n }\n consumeInternalError(tokType, nextToken, options) {\n let msg\n const previousToken = this.LA(0)\n if (options !== undefined && options.ERR_MSG) {\n msg = options.ERR_MSG\n } else {\n msg = this.errorMessageProvider.buildMismatchTokenMessage({\n expected: tokType,\n actual: nextToken,\n previous: previousToken,\n ruleName: this.getCurrRuleFullName(),\n })\n }\n throw this.SAVE_ERROR(new MismatchedTokenException(msg, nextToken, previousToken))\n }\n consumeInternalRecovery(tokType, idx, eFromConsumption) {\n // no recovery allowed during backtracking, otherwise backtracking may recover invalid syntax and accept it\n // but the original syntax could have been parsed successfully without any backtracking + recovery\n if (\n this.recoveryEnabled &&\n // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?\n eFromConsumption.name === 'MismatchedTokenException' &&\n !this.isBackTracking()\n ) {\n const follows = this.getFollowsForInRuleRecovery(tokType, idx)\n try {\n return this.tryInRuleRecovery(tokType, follows)\n } catch (eFromInRuleRecovery) {\n if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) {\n // failed in RuleRecovery.\n // throw the original error in order to trigger reSync error recovery\n throw eFromConsumption\n } else {\n throw eFromInRuleRecovery\n }\n }\n } else {\n throw eFromConsumption\n }\n }\n saveRecogState() {\n // errors is a getter which will clone the errors array\n const savedErrors = this.errors\n const savedRuleStack = clone(this.RULE_STACK)\n return {\n errors: savedErrors,\n lexerState: this.exportLexerState(),\n RULE_STACK: savedRuleStack,\n CST_STACK: this.CST_STACK,\n }\n }\n reloadRecogState(newState) {\n this.errors = newState.errors\n this.importLexerState(newState.lexerState)\n this.RULE_STACK = newState.RULE_STACK\n }\n ruleInvocationStateUpdate(shortName, fullName, idxInCallingRule) {\n this.RULE_OCCURRENCE_STACK.push(idxInCallingRule)\n this.RULE_STACK.push(shortName)\n // NOOP when cst is disabled\n this.cstInvocationStateUpdate(fullName)\n }\n isBackTracking() {\n return this.isBackTrackingStack.length !== 0\n }\n getCurrRuleFullName() {\n const shortName = this.getLastExplicitRuleShortName()\n return this.shortRuleNameToFull[shortName]\n }\n shortRuleNameToFullName(shortName) {\n return this.shortRuleNameToFull[shortName]\n }\n isAtEndOfInput() {\n return this.tokenMatcher(this.LA(1), EOF)\n }\n reset() {\n this.resetLexerState()\n this.subruleIdx = 0\n this.isBackTrackingStack = []\n this.errors = []\n this.RULE_STACK = []\n // TODO: extract a specific reset for TreeBuilder trait\n this.CST_STACK = []\n this.RULE_OCCURRENCE_STACK = []\n }\n }\n\n /**\n * Trait responsible for runtime parsing errors.\n */\n class ErrorHandler {\n initErrorHandler(config) {\n this._errors = []\n this.errorMessageProvider = has(config, 'errorMessageProvider')\n ? config.errorMessageProvider // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.errorMessageProvider\n }\n SAVE_ERROR(error) {\n if (isRecognitionException(error)) {\n error.context = {\n ruleStack: this.getHumanReadableRuleStack(),\n ruleOccurrenceStack: clone(this.RULE_OCCURRENCE_STACK),\n }\n this._errors.push(error)\n return error\n } else {\n throw Error('Trying to save an Error which is not a RecognitionException')\n }\n }\n get errors() {\n return clone(this._errors)\n }\n set errors(newErrors) {\n this._errors = newErrors\n }\n // TODO: consider caching the error message computed information\n raiseEarlyExitException(occurrence, prodType, userDefinedErrMsg) {\n const ruleName = this.getCurrRuleFullName()\n const ruleGrammar = this.getGAstProductions()[ruleName]\n const lookAheadPathsPerAlternative = getLookaheadPathsForOptionalProd(\n occurrence,\n ruleGrammar,\n prodType,\n this.maxLookahead,\n )\n const insideProdPaths = lookAheadPathsPerAlternative[0]\n const actualTokens = []\n for (let i = 1; i <= this.maxLookahead; i++) {\n actualTokens.push(this.LA(i))\n }\n const msg = this.errorMessageProvider.buildEarlyExitMessage({\n expectedIterationPaths: insideProdPaths,\n actual: actualTokens,\n previous: this.LA(0),\n customUserDescription: userDefinedErrMsg,\n ruleName: ruleName,\n })\n throw this.SAVE_ERROR(new EarlyExitException(msg, this.LA(1), this.LA(0)))\n }\n // TODO: consider caching the error message computed information\n raiseNoAltException(occurrence, errMsgTypes) {\n const ruleName = this.getCurrRuleFullName()\n const ruleGrammar = this.getGAstProductions()[ruleName]\n // TODO: getLookaheadPathsForOr can be slow for large enough maxLookahead and certain grammars, consider caching ?\n const lookAheadPathsPerAlternative = getLookaheadPathsForOr(occurrence, ruleGrammar, this.maxLookahead)\n const actualTokens = []\n for (let i = 1; i <= this.maxLookahead; i++) {\n actualTokens.push(this.LA(i))\n }\n const previousToken = this.LA(0)\n const errMsg = this.errorMessageProvider.buildNoViableAltMessage({\n expectedPathsPerAlt: lookAheadPathsPerAlternative,\n actual: actualTokens,\n previous: previousToken,\n customUserDescription: errMsgTypes,\n ruleName: this.getCurrRuleFullName(),\n })\n throw this.SAVE_ERROR(new NoViableAltException(errMsg, this.LA(1), previousToken))\n }\n }\n\n class ContentAssist {\n initContentAssist() {}\n computeContentAssist(startRuleName, precedingInput) {\n const startRuleGast = this.gastProductionsCache[startRuleName]\n if (isUndefined(startRuleGast)) {\n throw Error(`Rule ->${startRuleName}<- does not exist in this grammar.`)\n }\n return nextPossibleTokensAfter([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead)\n }\n // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'...\n // TODO: should this be more explicitly part of the public API?\n getNextPossibleTokenTypes(grammarPath) {\n const topRuleName = head(grammarPath.ruleStack)\n const gastProductions = this.getGAstProductions()\n const topProduction = gastProductions[topRuleName]\n const nextPossibleTokenTypes = new NextAfterTokenWalker(topProduction, grammarPath).startWalking()\n return nextPossibleTokenTypes\n }\n }\n\n const RECORDING_NULL_OBJECT = {\n description: 'This Object indicates the Parser is during Recording Phase',\n }\n Object.freeze(RECORDING_NULL_OBJECT)\n const HANDLE_SEPARATOR = true\n const MAX_METHOD_IDX = Math.pow(2, BITS_FOR_OCCURRENCE_IDX) - 1\n const RFT = createToken({ name: 'RECORDING_PHASE_TOKEN', pattern: Lexer.NA })\n augmentTokenTypes([RFT])\n const RECORDING_PHASE_TOKEN = createTokenInstance(\n RFT,\n 'This IToken indicates the Parser is in Recording Phase\\n\\t' +\n '' +\n 'See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details',\n // Using \"-1\" instead of NaN (as in EOF) because an actual number is less likely to\n // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase.\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n )\n Object.freeze(RECORDING_PHASE_TOKEN)\n const RECORDING_PHASE_CSTNODE = {\n name:\n 'This CSTNode indicates the Parser is in Recording Phase\\n\\t' +\n 'See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details',\n children: {},\n }\n /**\n * This trait handles the creation of the GAST structure for Chevrotain Grammars\n */\n class GastRecorder {\n initGastRecorder(config) {\n this.recordingProdStack = []\n this.RECORDING_PHASE = false\n }\n enableRecording() {\n this.RECORDING_PHASE = true\n this.TRACE_INIT('Enable Recording', () => {\n /**\n * Warning Dark Voodoo Magic upcoming!\n * We are \"replacing\" the public parsing DSL methods API\n * With **new** alternative implementations on the Parser **instance**\n *\n * So far this is the only way I've found to avoid performance regressions during parsing time.\n * - Approx 30% performance regression was measured on Chrome 75 Canary when attempting to replace the \"internal\"\n * implementations directly instead.\n */\n for (let i = 0; i < 10; i++) {\n const idx = i > 0 ? i : ''\n this[`CONSUME${idx}`] = function (arg1, arg2) {\n return this.consumeInternalRecord(arg1, i, arg2)\n }\n this[`SUBRULE${idx}`] = function (arg1, arg2) {\n return this.subruleInternalRecord(arg1, i, arg2)\n }\n this[`OPTION${idx}`] = function (arg1) {\n return this.optionInternalRecord(arg1, i)\n }\n this[`OR${idx}`] = function (arg1) {\n return this.orInternalRecord(arg1, i)\n }\n this[`MANY${idx}`] = function (arg1) {\n this.manyInternalRecord(i, arg1)\n }\n this[`MANY_SEP${idx}`] = function (arg1) {\n this.manySepFirstInternalRecord(i, arg1)\n }\n this[`AT_LEAST_ONE${idx}`] = function (arg1) {\n this.atLeastOneInternalRecord(i, arg1)\n }\n this[`AT_LEAST_ONE_SEP${idx}`] = function (arg1) {\n this.atLeastOneSepFirstInternalRecord(i, arg1)\n }\n }\n // DSL methods with the idx(suffix) as an argument\n this[`consume`] = function (idx, arg1, arg2) {\n return this.consumeInternalRecord(arg1, idx, arg2)\n }\n this[`subrule`] = function (idx, arg1, arg2) {\n return this.subruleInternalRecord(arg1, idx, arg2)\n }\n this[`option`] = function (idx, arg1) {\n return this.optionInternalRecord(arg1, idx)\n }\n this[`or`] = function (idx, arg1) {\n return this.orInternalRecord(arg1, idx)\n }\n this[`many`] = function (idx, arg1) {\n this.manyInternalRecord(idx, arg1)\n }\n this[`atLeastOne`] = function (idx, arg1) {\n this.atLeastOneInternalRecord(idx, arg1)\n }\n this.ACTION = this.ACTION_RECORD\n this.BACKTRACK = this.BACKTRACK_RECORD\n this.LA = this.LA_RECORD\n })\n }\n disableRecording() {\n this.RECORDING_PHASE = false\n // By deleting these **instance** properties, any future invocation\n // will be deferred to the original methods on the **prototype** object\n // This seems to get rid of any incorrect optimizations that V8 may\n // do during the recording phase.\n this.TRACE_INIT('Deleting Recording methods', () => {\n const that = this\n for (let i = 0; i < 10; i++) {\n const idx = i > 0 ? i : ''\n delete that[`CONSUME${idx}`]\n delete that[`SUBRULE${idx}`]\n delete that[`OPTION${idx}`]\n delete that[`OR${idx}`]\n delete that[`MANY${idx}`]\n delete that[`MANY_SEP${idx}`]\n delete that[`AT_LEAST_ONE${idx}`]\n delete that[`AT_LEAST_ONE_SEP${idx}`]\n }\n delete that[`consume`]\n delete that[`subrule`]\n delete that[`option`]\n delete that[`or`]\n delete that[`many`]\n delete that[`atLeastOne`]\n delete that.ACTION\n delete that.BACKTRACK\n delete that.LA\n })\n }\n // Parser methods are called inside an ACTION?\n // Maybe try/catch/finally on ACTIONS while disabling the recorders state changes?\n // @ts-expect-error -- noop place holder\n ACTION_RECORD(impl) {\n // NO-OP during recording\n }\n // Executing backtracking logic will break our recording logic assumptions\n BACKTRACK_RECORD(grammarRule, args) {\n return () => true\n }\n // LA is part of the official API and may be used for custom lookahead logic\n // by end users who may forget to wrap it in ACTION or inside a GATE\n LA_RECORD(howMuch) {\n // We cannot use the RECORD_PHASE_TOKEN here because someone may depend\n // On LA return EOF at the end of the input so an infinite loop may occur.\n return END_OF_FILE\n }\n topLevelRuleRecord(name, def) {\n try {\n const newTopLevelRule = new Rule({ definition: [], name: name })\n newTopLevelRule.name = name\n this.recordingProdStack.push(newTopLevelRule)\n def.call(this)\n this.recordingProdStack.pop()\n return newTopLevelRule\n } catch (originalError) {\n if (originalError.KNOWN_RECORDER_ERROR !== true) {\n try {\n originalError.message =\n originalError.message +\n '\\n\\t This error was thrown during the \"grammar recording phase\" For more info see:\\n\\t' +\n 'https://chevrotain.io/docs/guide/internals.html#grammar-recording'\n } catch (mutabilityError) {\n // We may not be able to modify the original error object\n throw originalError\n }\n }\n throw originalError\n }\n }\n // Implementation of parsing DSL\n optionInternalRecord(actionORMethodDef, occurrence) {\n return recordProd.call(this, Option, actionORMethodDef, occurrence)\n }\n atLeastOneInternalRecord(occurrence, actionORMethodDef) {\n recordProd.call(this, RepetitionMandatory, actionORMethodDef, occurrence)\n }\n atLeastOneSepFirstInternalRecord(occurrence, options) {\n recordProd.call(this, RepetitionMandatoryWithSeparator, options, occurrence, HANDLE_SEPARATOR)\n }\n manyInternalRecord(occurrence, actionORMethodDef) {\n recordProd.call(this, Repetition, actionORMethodDef, occurrence)\n }\n manySepFirstInternalRecord(occurrence, options) {\n recordProd.call(this, RepetitionWithSeparator, options, occurrence, HANDLE_SEPARATOR)\n }\n orInternalRecord(altsOrOpts, occurrence) {\n return recordOrProd.call(this, altsOrOpts, occurrence)\n }\n subruleInternalRecord(ruleToCall, occurrence, options) {\n assertMethodIdxIsValid(occurrence)\n if (!ruleToCall || has(ruleToCall, 'ruleName') === false) {\n const error = new Error(\n ` argument is invalid` +\n ` expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}>` +\n `\\n inside top level rule: <${this.recordingProdStack[0].name}>`,\n )\n error.KNOWN_RECORDER_ERROR = true\n throw error\n }\n const prevProd = last(this.recordingProdStack)\n const ruleName = ruleToCall.ruleName\n const newNoneTerminal = new NonTerminal({\n idx: occurrence,\n nonTerminalName: ruleName,\n label: options === null || options === void 0 ? void 0 : options.LABEL,\n // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created\n referencedRule: undefined,\n })\n prevProd.definition.push(newNoneTerminal)\n return this.outputCst ? RECORDING_PHASE_CSTNODE : RECORDING_NULL_OBJECT\n }\n consumeInternalRecord(tokType, occurrence, options) {\n assertMethodIdxIsValid(occurrence)\n if (!hasShortKeyProperty(tokType)) {\n const error = new Error(\n ` argument is invalid` +\n ` expecting a TokenType reference but got: <${JSON.stringify(tokType)}>` +\n `\\n inside top level rule: <${this.recordingProdStack[0].name}>`,\n )\n error.KNOWN_RECORDER_ERROR = true\n throw error\n }\n const prevProd = last(this.recordingProdStack)\n const newNoneTerminal = new Terminal({\n idx: occurrence,\n terminalType: tokType,\n label: options === null || options === void 0 ? void 0 : options.LABEL,\n })\n prevProd.definition.push(newNoneTerminal)\n return RECORDING_PHASE_TOKEN\n }\n }\n function recordProd(prodConstructor, mainProdArg, occurrence, handleSep = false) {\n assertMethodIdxIsValid(occurrence)\n const prevProd = last(this.recordingProdStack)\n const grammarAction = isFunction(mainProdArg) ? mainProdArg : mainProdArg.DEF\n const newProd = new prodConstructor({ definition: [], idx: occurrence })\n if (handleSep) {\n newProd.separator = mainProdArg.SEP\n }\n if (has(mainProdArg, 'MAX_LOOKAHEAD')) {\n newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD\n }\n this.recordingProdStack.push(newProd)\n grammarAction.call(this)\n prevProd.definition.push(newProd)\n this.recordingProdStack.pop()\n return RECORDING_NULL_OBJECT\n }\n function recordOrProd(mainProdArg, occurrence) {\n assertMethodIdxIsValid(occurrence)\n const prevProd = last(this.recordingProdStack)\n // Only an array of alternatives\n const hasOptions = isArray$1(mainProdArg) === false\n const alts = hasOptions === false ? mainProdArg : mainProdArg.DEF\n const newOrProd = new Alternation({\n definition: [],\n idx: occurrence,\n ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true,\n })\n if (has(mainProdArg, 'MAX_LOOKAHEAD')) {\n newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD\n }\n const hasPredicates = some(alts, (currAlt) => isFunction(currAlt.GATE))\n newOrProd.hasPredicates = hasPredicates\n prevProd.definition.push(newOrProd)\n forEach(alts, (currAlt) => {\n const currAltFlat = new Alternative({ definition: [] })\n newOrProd.definition.push(currAltFlat)\n if (has(currAlt, 'IGNORE_AMBIGUITIES')) {\n currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES // assumes end user provides the correct config value/type\n }\n // **implicit** ignoreAmbiguities due to usage of gate\n else if (has(currAlt, 'GATE')) {\n currAltFlat.ignoreAmbiguities = true\n }\n this.recordingProdStack.push(currAltFlat)\n currAlt.ALT.call(this)\n this.recordingProdStack.pop()\n })\n return RECORDING_NULL_OBJECT\n }\n function getIdxSuffix(idx) {\n return idx === 0 ? '' : `${idx}`\n }\n function assertMethodIdxIsValid(idx) {\n if (idx < 0 || idx > MAX_METHOD_IDX) {\n const error = new Error(\n // The stack trace will contain all the needed details\n `Invalid DSL Method idx value: <${idx}>\\n\\t` +\n `Idx value must be a none negative value smaller than ${MAX_METHOD_IDX + 1}`,\n )\n error.KNOWN_RECORDER_ERROR = true\n throw error\n }\n }\n\n /**\n * Trait responsible for runtime parsing errors.\n */\n class PerformanceTracer {\n initPerformanceTracer(config) {\n if (has(config, 'traceInitPerf')) {\n const userTraceInitPerf = config.traceInitPerf\n const traceIsNumber = typeof userTraceInitPerf === 'number'\n this.traceInitMaxIdent = traceIsNumber ? userTraceInitPerf : Infinity\n this.traceInitPerf = traceIsNumber ? userTraceInitPerf > 0 : userTraceInitPerf // assumes end user provides the correct config value/type\n } else {\n this.traceInitMaxIdent = 0\n this.traceInitPerf = DEFAULT_PARSER_CONFIG.traceInitPerf\n }\n this.traceInitIndent = -1\n }\n TRACE_INIT(phaseDesc, phaseImpl) {\n // No need to optimize this using NOOP pattern because\n // It is not called in a hot spot...\n if (this.traceInitPerf === true) {\n this.traceInitIndent++\n const indent = new Array(this.traceInitIndent + 1).join('\\t')\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n console.log(`${indent}--> <${phaseDesc}>`)\n }\n const { time, value } = timer(phaseImpl)\n /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */\n const traceMethod = time > 10 ? console.warn : console.log\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`)\n }\n this.traceInitIndent--\n return value\n } else {\n return phaseImpl()\n }\n }\n }\n\n function applyMixins(derivedCtor, baseCtors) {\n baseCtors.forEach((baseCtor) => {\n const baseProto = baseCtor.prototype\n Object.getOwnPropertyNames(baseProto).forEach((propName) => {\n if (propName === 'constructor') {\n return\n }\n const basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName)\n // Handle Accessors\n if (basePropDescriptor && (basePropDescriptor.get || basePropDescriptor.set)) {\n Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor)\n } else {\n derivedCtor.prototype[propName] = baseCtor.prototype[propName]\n }\n })\n })\n }\n\n const END_OF_FILE = createTokenInstance(EOF, '', NaN, NaN, NaN, NaN, NaN, NaN)\n Object.freeze(END_OF_FILE)\n const DEFAULT_PARSER_CONFIG = Object.freeze({\n recoveryEnabled: false,\n maxLookahead: 3,\n dynamicTokensEnabled: false,\n outputCst: true,\n errorMessageProvider: defaultParserErrorProvider,\n nodeLocationTracking: 'none',\n traceInitPerf: false,\n skipValidations: false,\n })\n const DEFAULT_RULE_CONFIG = Object.freeze({\n recoveryValueFunc: () => undefined,\n resyncEnabled: true,\n })\n var ParserDefinitionErrorType\n ;(function (ParserDefinitionErrorType) {\n ParserDefinitionErrorType[(ParserDefinitionErrorType['INVALID_RULE_NAME'] = 0)] = 'INVALID_RULE_NAME'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['DUPLICATE_RULE_NAME'] = 1)] = 'DUPLICATE_RULE_NAME'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['INVALID_RULE_OVERRIDE'] = 2)] = 'INVALID_RULE_OVERRIDE'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['DUPLICATE_PRODUCTIONS'] = 3)] = 'DUPLICATE_PRODUCTIONS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['UNRESOLVED_SUBRULE_REF'] = 4)] = 'UNRESOLVED_SUBRULE_REF'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['LEFT_RECURSION'] = 5)] = 'LEFT_RECURSION'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['NONE_LAST_EMPTY_ALT'] = 6)] = 'NONE_LAST_EMPTY_ALT'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['AMBIGUOUS_ALTS'] = 7)] = 'AMBIGUOUS_ALTS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['CONFLICT_TOKENS_RULES_NAMESPACE'] = 8)] =\n 'CONFLICT_TOKENS_RULES_NAMESPACE'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['INVALID_TOKEN_NAME'] = 9)] = 'INVALID_TOKEN_NAME'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['NO_NON_EMPTY_LOOKAHEAD'] = 10)] = 'NO_NON_EMPTY_LOOKAHEAD'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['AMBIGUOUS_PREFIX_ALTS'] = 11)] = 'AMBIGUOUS_PREFIX_ALTS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['TOO_MANY_ALTS'] = 12)] = 'TOO_MANY_ALTS'\n ParserDefinitionErrorType[(ParserDefinitionErrorType['CUSTOM_LOOKAHEAD_VALIDATION'] = 13)] =\n 'CUSTOM_LOOKAHEAD_VALIDATION'\n })(ParserDefinitionErrorType || (ParserDefinitionErrorType = {}))\n class Parser {\n /**\n * @deprecated use the **instance** method with the same name instead\n */\n static performSelfAnalysis(parserInstance) {\n throw Error(\n 'The **static** `performSelfAnalysis` method has been deprecated.' +\n '\\t\\nUse the **instance** method with the same name instead.',\n )\n }\n performSelfAnalysis() {\n this.TRACE_INIT('performSelfAnalysis', () => {\n let defErrorsMsgs\n this.selfAnalysisDone = true\n const className = this.className\n this.TRACE_INIT('toFastProps', () => {\n // Without this voodoo magic the parser would be x3-x4 slower\n // It seems it is better to invoke `toFastProperties` **before**\n // Any manipulations of the `this` object done during the recording phase.\n toFastProperties(this)\n })\n this.TRACE_INIT('Grammar Recording', () => {\n try {\n this.enableRecording()\n // Building the GAST\n forEach(this.definedRulesNames, (currRuleName) => {\n const wrappedRule = this[currRuleName]\n const originalGrammarAction = wrappedRule['originalGrammarAction']\n let recordedRuleGast\n this.TRACE_INIT(`${currRuleName} Rule`, () => {\n recordedRuleGast = this.topLevelRuleRecord(currRuleName, originalGrammarAction)\n })\n this.gastProductionsCache[currRuleName] = recordedRuleGast\n })\n } finally {\n this.disableRecording()\n }\n })\n let resolverErrors = []\n this.TRACE_INIT('Grammar Resolving', () => {\n resolverErrors = resolveGrammar({\n rules: values(this.gastProductionsCache),\n })\n this.definitionErrors = this.definitionErrors.concat(resolverErrors)\n })\n this.TRACE_INIT('Grammar Validations', () => {\n // only perform additional grammar validations IFF no resolving errors have occurred.\n // as unresolved grammar may lead to unhandled runtime exceptions in the follow up validations.\n if (isEmpty(resolverErrors) && this.skipValidations === false) {\n const validationErrors = validateGrammar({\n rules: values(this.gastProductionsCache),\n tokenTypes: values(this.tokensMap),\n errMsgProvider: defaultGrammarValidatorErrorProvider,\n grammarName: className,\n })\n const lookaheadValidationErrors = validateLookahead({\n lookaheadStrategy: this.lookaheadStrategy,\n rules: values(this.gastProductionsCache),\n tokenTypes: values(this.tokensMap),\n grammarName: className,\n })\n this.definitionErrors = this.definitionErrors.concat(validationErrors, lookaheadValidationErrors)\n }\n })\n // this analysis may fail if the grammar is not perfectly valid\n if (isEmpty(this.definitionErrors)) {\n // The results of these computations are not needed unless error recovery is enabled.\n if (this.recoveryEnabled) {\n this.TRACE_INIT('computeAllProdsFollows', () => {\n const allFollows = computeAllProdsFollows(values(this.gastProductionsCache))\n this.resyncFollows = allFollows\n })\n }\n this.TRACE_INIT('ComputeLookaheadFunctions', () => {\n var _a, _b\n ;(_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0\n ? void 0\n : _b.call(_a, {\n rules: values(this.gastProductionsCache),\n })\n this.preComputeLookaheadFunctions(values(this.gastProductionsCache))\n })\n }\n if (!Parser.DEFER_DEFINITION_ERRORS_HANDLING && !isEmpty(this.definitionErrors)) {\n defErrorsMsgs = map(this.definitionErrors, (defError) => defError.message)\n throw new Error(\n `Parser Definition Errors detected:\\n ${defErrorsMsgs.join('\\n-------------------------------\\n')}`,\n )\n }\n })\n }\n constructor(tokenVocabulary, config) {\n this.definitionErrors = []\n this.selfAnalysisDone = false\n const that = this\n that.initErrorHandler(config)\n that.initLexerAdapter()\n that.initLooksAhead(config)\n that.initRecognizerEngine(tokenVocabulary, config)\n that.initRecoverable(config)\n that.initTreeBuilder(config)\n that.initContentAssist()\n that.initGastRecorder(config)\n that.initPerformanceTracer(config)\n if (has(config, 'ignoredIssues')) {\n throw new Error(\n 'The IParserConfig property has been deprecated.\\n\\t' +\n 'Please use the flag on the relevant DSL method instead.\\n\\t' +\n 'See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\\n\\t' +\n 'For further details.',\n )\n }\n this.skipValidations = has(config, 'skipValidations')\n ? config.skipValidations // casting assumes the end user passing the correct type\n : DEFAULT_PARSER_CONFIG.skipValidations\n }\n }\n // Set this flag to true if you don't want the Parser to throw error when problems in it's definition are detected.\n // (normally during the parser's constructor).\n // This is a design time flag, it will not affect the runtime error handling of the parser, just design time errors,\n // for example: duplicate rule names, referencing an unresolved subrule, ect...\n // This flag should not be enabled during normal usage, it is used in special situations, for example when\n // needing to display the parser definition errors in some GUI(online playground).\n Parser.DEFER_DEFINITION_ERRORS_HANDLING = false\n applyMixins(Parser, [\n Recoverable,\n LooksAhead,\n TreeBuilder,\n LexerAdapter,\n RecognizerEngine,\n RecognizerApi,\n ErrorHandler,\n ContentAssist,\n GastRecorder,\n PerformanceTracer,\n ])\n class CstParser extends Parser {\n constructor(tokenVocabulary, config = DEFAULT_PARSER_CONFIG) {\n const configClone = clone(config)\n configClone.outputCst = true\n super(tokenVocabulary, configClone)\n }\n }\n\n return { CstParser, Lexer, createToken }\n})()\n\nexport { CstParser, Lexer, createToken }\n", "/**\n * @author Deepkolos / https://github.com/deepkolos\n */\n\nexport class WorkerPool {\n constructor(pool = 4) {\n this.pool = pool\n this.queue = []\n this.workers = []\n this.workersResolve = []\n this.workerStatus = 0\n }\n\n _initWorker(workerId) {\n if (!this.workers[workerId]) {\n const worker = this.workerCreator()\n worker.addEventListener('message', this._onMessage.bind(this, workerId))\n this.workers[workerId] = worker\n }\n }\n\n _getIdleWorker() {\n for (let i = 0; i < this.pool; i++) if (!(this.workerStatus & (1 << i))) return i\n\n return -1\n }\n\n _onMessage(workerId, msg) {\n const resolve = this.workersResolve[workerId]\n resolve && resolve(msg)\n\n if (this.queue.length) {\n const { resolve, msg, transfer } = this.queue.shift()\n this.workersResolve[workerId] = resolve\n this.workers[workerId].postMessage(msg, transfer)\n } else {\n this.workerStatus ^= 1 << workerId\n }\n }\n\n setWorkerCreator(workerCreator) {\n this.workerCreator = workerCreator\n }\n\n setWorkerLimit(pool) {\n this.pool = pool\n }\n\n postMessage(msg, transfer) {\n return new Promise((resolve) => {\n const workerId = this._getIdleWorker()\n\n if (workerId !== -1) {\n this._initWorker(workerId)\n this.workerStatus |= 1 << workerId\n this.workersResolve[workerId] = resolve\n this.workers[workerId].postMessage(msg, transfer)\n } else {\n this.queue.push({ resolve, msg, transfer })\n }\n })\n }\n\n dispose() {\n this.workers.forEach((worker) => worker.terminate())\n this.workersResolve.length = 0\n this.workers.length = 0\n this.queue.length = 0\n this.workerStatus = 0\n }\n}\n", "///////////////////////////////////////////////////\n// KTX2 Header.\n///////////////////////////////////////////////////\nconst KHR_SUPERCOMPRESSION_NONE = 0\nconst KHR_SUPERCOMPRESSION_BASISLZ = 1\nconst KHR_SUPERCOMPRESSION_ZSTD = 2\nconst KHR_SUPERCOMPRESSION_ZLIB = 3 ///////////////////////////////////////////////////\n// Data Format Descriptor (DFD).\n///////////////////////////////////////////////////\n\nconst KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = 0\nconst KHR_DF_VENDORID_KHRONOS = 0\nconst KHR_DF_VERSION = 2\nconst KHR_DF_MODEL_UNSPECIFIED = 0\nconst KHR_DF_MODEL_RGBSDA = 1 // ...\n\nconst KHR_DF_MODEL_ETC1 = 160\nconst KHR_DF_MODEL_ETC2 = 161\nconst KHR_DF_MODEL_ASTC = 162\nconst KHR_DF_MODEL_ETC1S = 163\nconst KHR_DF_MODEL_UASTC = 166\nconst KHR_DF_FLAG_ALPHA_STRAIGHT = 0\nconst KHR_DF_FLAG_ALPHA_PREMULTIPLIED = 1\nconst KHR_DF_TRANSFER_UNSPECIFIED = 0\nconst KHR_DF_TRANSFER_LINEAR = 1\nconst KHR_DF_TRANSFER_SRGB = 2\nconst KHR_DF_TRANSFER_ITU = 3\nconst KHR_DF_TRANSFER_NTSC = 4\nconst KHR_DF_TRANSFER_SLOG = 5\nconst KHR_DF_TRANSFER_SLOG2 = 6\nconst KHR_DF_TRANSFER_BT1886 = 7\nconst KHR_DF_TRANSFER_HLG_OETF = 8\nconst KHR_DF_TRANSFER_HLG_EOTF = 9\nconst KHR_DF_TRANSFER_PQ_EOTF = 10\nconst KHR_DF_TRANSFER_PQ_OETF = 11\nconst KHR_DF_TRANSFER_DCIP3 = 12\nconst KHR_DF_TRANSFER_PAL_OETF = 13\nconst KHR_DF_TRANSFER_PAL625_EOTF = 14\nconst KHR_DF_TRANSFER_ST240 = 15\nconst KHR_DF_TRANSFER_ACESCC = 16\nconst KHR_DF_TRANSFER_ACESCCT = 17\nconst KHR_DF_TRANSFER_ADOBERGB = 18\nconst KHR_DF_PRIMARIES_UNSPECIFIED = 0\nconst KHR_DF_PRIMARIES_BT709 = 1\nconst KHR_DF_PRIMARIES_BT601_EBU = 2\nconst KHR_DF_PRIMARIES_BT601_SMPTE = 3\nconst KHR_DF_PRIMARIES_BT2020 = 4\nconst KHR_DF_PRIMARIES_CIEXYZ = 5\nconst KHR_DF_PRIMARIES_ACES = 6\nconst KHR_DF_PRIMARIES_ACESCC = 7\nconst KHR_DF_PRIMARIES_NTSC1953 = 8\nconst KHR_DF_PRIMARIES_PAL525 = 9\nconst KHR_DF_PRIMARIES_DISPLAYP3 = 10\nconst KHR_DF_PRIMARIES_ADOBERGB = 11\nconst KHR_DF_CHANNEL_RGBSDA_RED = 0\nconst KHR_DF_CHANNEL_RGBSDA_GREEN = 1\nconst KHR_DF_CHANNEL_RGBSDA_BLUE = 2\nconst KHR_DF_CHANNEL_RGBSDA_STENCIL = 13\nconst KHR_DF_CHANNEL_RGBSDA_DEPTH = 14\nconst KHR_DF_CHANNEL_RGBSDA_ALPHA = 15\nconst KHR_DF_SAMPLE_DATATYPE_FLOAT = 0x80\nconst KHR_DF_SAMPLE_DATATYPE_SIGNED = 0x40\nconst KHR_DF_SAMPLE_DATATYPE_EXPONENT = 0x20\nconst KHR_DF_SAMPLE_DATATYPE_LINEAR = 0x10 ///////////////////////////////////////////////////\n// VK FORMAT.\n///////////////////////////////////////////////////\n\nconst VK_FORMAT_UNDEFINED = 0\nconst VK_FORMAT_R4G4_UNORM_PACK8 = 1\nconst VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2\nconst VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3\nconst VK_FORMAT_R5G6B5_UNORM_PACK16 = 4\nconst VK_FORMAT_B5G6R5_UNORM_PACK16 = 5\nconst VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6\nconst VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7\nconst VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8\nconst VK_FORMAT_R8_UNORM = 9\nconst VK_FORMAT_R8_SNORM = 10\nconst VK_FORMAT_R8_UINT = 13\nconst VK_FORMAT_R8_SINT = 14\nconst VK_FORMAT_R8_SRGB = 15\nconst VK_FORMAT_R8G8_UNORM = 16\nconst VK_FORMAT_R8G8_SNORM = 17\nconst VK_FORMAT_R8G8_UINT = 20\nconst VK_FORMAT_R8G8_SINT = 21\nconst VK_FORMAT_R8G8_SRGB = 22\nconst VK_FORMAT_R8G8B8_UNORM = 23\nconst VK_FORMAT_R8G8B8_SNORM = 24\nconst VK_FORMAT_R8G8B8_UINT = 27\nconst VK_FORMAT_R8G8B8_SINT = 28\nconst VK_FORMAT_R8G8B8_SRGB = 29\nconst VK_FORMAT_B8G8R8_UNORM = 30\nconst VK_FORMAT_B8G8R8_SNORM = 31\nconst VK_FORMAT_B8G8R8_UINT = 34\nconst VK_FORMAT_B8G8R8_SINT = 35\nconst VK_FORMAT_B8G8R8_SRGB = 36\nconst VK_FORMAT_R8G8B8A8_UNORM = 37\nconst VK_FORMAT_R8G8B8A8_SNORM = 38\nconst VK_FORMAT_R8G8B8A8_UINT = 41\nconst VK_FORMAT_R8G8B8A8_SINT = 42\nconst VK_FORMAT_R8G8B8A8_SRGB = 43\nconst VK_FORMAT_B8G8R8A8_UNORM = 44\nconst VK_FORMAT_B8G8R8A8_SNORM = 45\nconst VK_FORMAT_B8G8R8A8_UINT = 48\nconst VK_FORMAT_B8G8R8A8_SINT = 49\nconst VK_FORMAT_B8G8R8A8_SRGB = 50\nconst VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58\nconst VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59\nconst VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62\nconst VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63\nconst VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64\nconst VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65\nconst VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68\nconst VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69\nconst VK_FORMAT_R16_UNORM = 70\nconst VK_FORMAT_R16_SNORM = 71\nconst VK_FORMAT_R16_UINT = 74\nconst VK_FORMAT_R16_SINT = 75\nconst VK_FORMAT_R16_SFLOAT = 76\nconst VK_FORMAT_R16G16_UNORM = 77\nconst VK_FORMAT_R16G16_SNORM = 78\nconst VK_FORMAT_R16G16_UINT = 81\nconst VK_FORMAT_R16G16_SINT = 82\nconst VK_FORMAT_R16G16_SFLOAT = 83\nconst VK_FORMAT_R16G16B16_UNORM = 84\nconst VK_FORMAT_R16G16B16_SNORM = 85\nconst VK_FORMAT_R16G16B16_UINT = 88\nconst VK_FORMAT_R16G16B16_SINT = 89\nconst VK_FORMAT_R16G16B16_SFLOAT = 90\nconst VK_FORMAT_R16G16B16A16_UNORM = 91\nconst VK_FORMAT_R16G16B16A16_SNORM = 92\nconst VK_FORMAT_R16G16B16A16_UINT = 95\nconst VK_FORMAT_R16G16B16A16_SINT = 96\nconst VK_FORMAT_R16G16B16A16_SFLOAT = 97\nconst VK_FORMAT_R32_UINT = 98\nconst VK_FORMAT_R32_SINT = 99\nconst VK_FORMAT_R32_SFLOAT = 100\nconst VK_FORMAT_R32G32_UINT = 101\nconst VK_FORMAT_R32G32_SINT = 102\nconst VK_FORMAT_R32G32_SFLOAT = 103\nconst VK_FORMAT_R32G32B32_UINT = 104\nconst VK_FORMAT_R32G32B32_SINT = 105\nconst VK_FORMAT_R32G32B32_SFLOAT = 106\nconst VK_FORMAT_R32G32B32A32_UINT = 107\nconst VK_FORMAT_R32G32B32A32_SINT = 108\nconst VK_FORMAT_R32G32B32A32_SFLOAT = 109\nconst VK_FORMAT_R64_UINT = 110\nconst VK_FORMAT_R64_SINT = 111\nconst VK_FORMAT_R64_SFLOAT = 112\nconst VK_FORMAT_R64G64_UINT = 113\nconst VK_FORMAT_R64G64_SINT = 114\nconst VK_FORMAT_R64G64_SFLOAT = 115\nconst VK_FORMAT_R64G64B64_UINT = 116\nconst VK_FORMAT_R64G64B64_SINT = 117\nconst VK_FORMAT_R64G64B64_SFLOAT = 118\nconst VK_FORMAT_R64G64B64A64_UINT = 119\nconst VK_FORMAT_R64G64B64A64_SINT = 120\nconst VK_FORMAT_R64G64B64A64_SFLOAT = 121\nconst VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122\nconst VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123\nconst VK_FORMAT_D16_UNORM = 124\nconst VK_FORMAT_X8_D24_UNORM_PACK32 = 125\nconst VK_FORMAT_D32_SFLOAT = 126\nconst VK_FORMAT_S8_UINT = 127\nconst VK_FORMAT_D16_UNORM_S8_UINT = 128\nconst VK_FORMAT_D24_UNORM_S8_UINT = 129\nconst VK_FORMAT_D32_SFLOAT_S8_UINT = 130\nconst VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131\nconst VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132\nconst VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133\nconst VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134\nconst VK_FORMAT_BC2_UNORM_BLOCK = 135\nconst VK_FORMAT_BC2_SRGB_BLOCK = 136\nconst VK_FORMAT_BC3_UNORM_BLOCK = 137\nconst VK_FORMAT_BC3_SRGB_BLOCK = 138\nconst VK_FORMAT_BC4_UNORM_BLOCK = 139\nconst VK_FORMAT_BC4_SNORM_BLOCK = 140\nconst VK_FORMAT_BC5_UNORM_BLOCK = 141\nconst VK_FORMAT_BC5_SNORM_BLOCK = 142\nconst VK_FORMAT_BC6H_UFLOAT_BLOCK = 143\nconst VK_FORMAT_BC6H_SFLOAT_BLOCK = 144\nconst VK_FORMAT_BC7_UNORM_BLOCK = 145\nconst VK_FORMAT_BC7_SRGB_BLOCK = 146\nconst VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147\nconst VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148\nconst VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149\nconst VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150\nconst VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151\nconst VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152\nconst VK_FORMAT_EAC_R11_UNORM_BLOCK = 153\nconst VK_FORMAT_EAC_R11_SNORM_BLOCK = 154\nconst VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155\nconst VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156\nconst VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157\nconst VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158\nconst VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159\nconst VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160\nconst VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161\nconst VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162\nconst VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163\nconst VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164\nconst VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165\nconst VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166\nconst VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167\nconst VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168\nconst VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169\nconst VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170\nconst VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171\nconst VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172\nconst VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173\nconst VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174\nconst VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175\nconst VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176\nconst VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177\nconst VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178\nconst VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179\nconst VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180\nconst VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181\nconst VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182\nconst VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183\nconst VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184\nconst VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007\nconst VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008\nconst VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009\nconst VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010\nconst VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011\nconst VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017\nconst VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018\nconst VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019\nconst VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020\nconst VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021\nconst VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000\nconst VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001\nconst VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002\nconst VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003\nconst VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004\nconst VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005\nconst VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006\nconst VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007\nconst VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = 1000066000\nconst VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = 1000066001\nconst VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = 1000066002\nconst VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = 1000066003\nconst VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = 1000066004\nconst VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = 1000066005\nconst VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = 1000066006\nconst VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = 1000066007\nconst VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = 1000066008\nconst VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = 1000066009\nconst VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = 1000066010\nconst VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = 1000066011\nconst VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = 1000066012\nconst VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = 1000066013\nconst VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = 1000340000\nconst VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = 1000340001\n\n/**\n * Represents an unpacked KTX 2.0 texture container. Data for individual mip levels are stored in\n * the `.levels` array, typically compressed in Basis Universal formats. Additional properties\n * provide metadata required to process, transcode, and upload these textures.\n */\n\nclass KTX2Container {\n constructor() {\n this.vkFormat = VK_FORMAT_UNDEFINED\n this.typeSize = 1\n this.pixelWidth = 0\n this.pixelHeight = 0\n this.pixelDepth = 0\n this.layerCount = 0\n this.faceCount = 1\n this.supercompressionScheme = KHR_SUPERCOMPRESSION_NONE\n this.levels = []\n this.dataFormatDescriptor = [\n {\n vendorId: KHR_DF_VENDORID_KHRONOS,\n descriptorType: KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,\n descriptorBlockSize: 0,\n versionNumber: KHR_DF_VERSION,\n colorModel: KHR_DF_MODEL_UNSPECIFIED,\n colorPrimaries: KHR_DF_PRIMARIES_BT709,\n transferFunction: KHR_DF_TRANSFER_SRGB,\n flags: KHR_DF_FLAG_ALPHA_STRAIGHT,\n texelBlockDimension: [0, 0, 0, 0],\n bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0],\n samples: [],\n },\n ]\n this.keyValue = {}\n this.globalData = null\n }\n}\n\nclass BufferReader {\n constructor(data, byteOffset, byteLength, littleEndian) {\n this._dataView = void 0\n this._littleEndian = void 0\n this._offset = void 0\n this._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength)\n this._littleEndian = littleEndian\n this._offset = 0\n }\n\n _nextUint8() {\n const value = this._dataView.getUint8(this._offset)\n\n this._offset += 1\n return value\n }\n\n _nextUint16() {\n const value = this._dataView.getUint16(this._offset, this._littleEndian)\n\n this._offset += 2\n return value\n }\n\n _nextUint32() {\n const value = this._dataView.getUint32(this._offset, this._littleEndian)\n\n this._offset += 4\n return value\n }\n\n _nextUint64() {\n const left = this._dataView.getUint32(this._offset, this._littleEndian)\n\n const right = this._dataView.getUint32(this._offset + 4, this._littleEndian) // TODO(cleanup): Just test this...\n // const value = this._littleEndian ? left + (2 ** 32 * right) : (2 ** 32 * left) + right;\n\n const value = left + 2 ** 32 * right\n this._offset += 8\n return value\n }\n\n _nextInt32() {\n const value = this._dataView.getInt32(this._offset, this._littleEndian)\n\n this._offset += 4\n return value\n }\n\n _nextUint8Array(len) {\n const value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._offset, len)\n this._offset += len\n return value\n }\n\n _skip(bytes) {\n this._offset += bytes\n return this\n }\n\n _scan(maxByteLength, term) {\n if (term === void 0) {\n term = 0x00\n }\n\n const byteOffset = this._offset\n let byteLength = 0\n\n while (this._dataView.getUint8(this._offset) !== term && byteLength < maxByteLength) {\n byteLength++\n this._offset++\n }\n\n if (byteLength < maxByteLength) this._offset++\n return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength)\n }\n}\n\n///////////////////////////////////////////////////\n// Common.\n///////////////////////////////////////////////////\nconst KTX_WRITER = 'KTX-Parse v' + '0.6.0'\nconst NUL = new Uint8Array([0x00]) ///////////////////////////////////////////////////\n// KTX2 Header.\n///////////////////////////////////////////////////\n\nconst KTX2_ID = [\n // '´', 'K', 'T', 'X', '2', '0', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n 0xab,\n 0x4b,\n 0x54,\n 0x58,\n 0x20,\n 0x32,\n 0x30,\n 0xbb,\n 0x0d,\n 0x0a,\n 0x1a,\n 0x0a,\n]\nconst HEADER_BYTE_LENGTH = 68 // 13 * 4 + 2 * 8\n\n/** Encodes text to an ArrayBuffer. */\nfunction encodeText(text) {\n if (typeof TextEncoder !== 'undefined') {\n return new TextEncoder().encode(text)\n }\n\n return Buffer.from(text)\n}\n/** Decodes an ArrayBuffer to text. */\n\nfunction decodeText(buffer) {\n if (typeof TextDecoder !== 'undefined') {\n return new TextDecoder().decode(buffer)\n }\n\n return Buffer.from(buffer).toString('utf8')\n}\n/** Concatenates N ArrayBuffers. */\n\nfunction concat(buffers) {\n let totalByteLength = 0\n\n for (const buffer of buffers) {\n totalByteLength += buffer.byteLength\n }\n\n const result = new Uint8Array(totalByteLength)\n let byteOffset = 0\n\n for (const buffer of buffers) {\n result.set(new Uint8Array(buffer), byteOffset)\n byteOffset += buffer.byteLength\n }\n\n return result\n}\n\n/**\n * Parses a KTX 2.0 file, returning an unpacked {@link KTX2Container} instance with all associated\n * data. The container's mip levels and other binary data are pointers into the original file, not\n * copies, so the original file should not be overwritten after reading.\n *\n * @param data Bytes of KTX 2.0 file, as Uint8Array or Buffer.\n */\n\nfunction read(data) {\n ///////////////////////////////////////////////////\n // KTX 2.0 Identifier.\n ///////////////////////////////////////////////////\n const id = new Uint8Array(data.buffer, data.byteOffset, KTX2_ID.length)\n\n if (\n id[0] !== KTX2_ID[0] || // '´'\n id[1] !== KTX2_ID[1] || // 'K'\n id[2] !== KTX2_ID[2] || // 'T'\n id[3] !== KTX2_ID[3] || // 'X'\n id[4] !== KTX2_ID[4] || // ' '\n id[5] !== KTX2_ID[5] || // '2'\n id[6] !== KTX2_ID[6] || // '0'\n id[7] !== KTX2_ID[7] || // 'ª'\n id[8] !== KTX2_ID[8] || // '\\r'\n id[9] !== KTX2_ID[9] || // '\\n'\n id[10] !== KTX2_ID[10] || // '\\x1A'\n id[11] !== KTX2_ID[11] // '\\n'\n ) {\n throw new Error('Missing KTX 2.0 identifier.')\n }\n\n const container = new KTX2Container() ///////////////////////////////////////////////////\n // Header.\n ///////////////////////////////////////////////////\n\n const headerByteLength = 17 * Uint32Array.BYTES_PER_ELEMENT\n const headerReader = new BufferReader(data, KTX2_ID.length, headerByteLength, true)\n container.vkFormat = headerReader._nextUint32()\n container.typeSize = headerReader._nextUint32()\n container.pixelWidth = headerReader._nextUint32()\n container.pixelHeight = headerReader._nextUint32()\n container.pixelDepth = headerReader._nextUint32()\n container.layerCount = headerReader._nextUint32()\n container.faceCount = headerReader._nextUint32()\n\n const levelCount = headerReader._nextUint32()\n\n container.supercompressionScheme = headerReader._nextUint32()\n\n const dfdByteOffset = headerReader._nextUint32()\n\n const dfdByteLength = headerReader._nextUint32()\n\n const kvdByteOffset = headerReader._nextUint32()\n\n const kvdByteLength = headerReader._nextUint32()\n\n const sgdByteOffset = headerReader._nextUint64()\n\n const sgdByteLength = headerReader._nextUint64() ///////////////////////////////////////////////////\n // Level Index.\n ///////////////////////////////////////////////////\n\n const levelByteLength = levelCount * 3 * 8\n const levelReader = new BufferReader(data, KTX2_ID.length + headerByteLength, levelByteLength, true)\n\n for (let i = 0; i < levelCount; i++) {\n container.levels.push({\n levelData: new Uint8Array(data.buffer, data.byteOffset + levelReader._nextUint64(), levelReader._nextUint64()),\n uncompressedByteLength: levelReader._nextUint64(),\n })\n } ///////////////////////////////////////////////////\n // Data Format Descriptor (DFD).\n ///////////////////////////////////////////////////\n\n const dfdReader = new BufferReader(data, dfdByteOffset, dfdByteLength, true)\n const dfd = {\n vendorId: dfdReader\n ._skip(\n 4,\n /* totalSize */\n )\n ._nextUint16(),\n descriptorType: dfdReader._nextUint16(),\n versionNumber: dfdReader._nextUint16(),\n descriptorBlockSize: dfdReader._nextUint16(),\n colorModel: dfdReader._nextUint8(),\n colorPrimaries: dfdReader._nextUint8(),\n transferFunction: dfdReader._nextUint8(),\n flags: dfdReader._nextUint8(),\n texelBlockDimension: [\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n ],\n bytesPlane: [\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n dfdReader._nextUint8(),\n ],\n samples: [],\n }\n const sampleStart = 6\n const sampleWords = 4\n const numSamples = (dfd.descriptorBlockSize / 4 - sampleStart) / sampleWords\n\n for (let i = 0; i < numSamples; i++) {\n const sample = {\n bitOffset: dfdReader._nextUint16(),\n bitLength: dfdReader._nextUint8(),\n channelType: dfdReader._nextUint8(),\n samplePosition: [dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8()],\n sampleLower: -Infinity,\n sampleUpper: Infinity,\n }\n\n if (sample.channelType & KHR_DF_SAMPLE_DATATYPE_SIGNED) {\n sample.sampleLower = dfdReader._nextInt32()\n sample.sampleUpper = dfdReader._nextInt32()\n } else {\n sample.sampleLower = dfdReader._nextUint32()\n sample.sampleUpper = dfdReader._nextUint32()\n }\n\n dfd.samples[i] = sample\n }\n\n container.dataFormatDescriptor.length = 0\n container.dataFormatDescriptor.push(dfd) ///////////////////////////////////////////////////\n // Key/Value Data (KVD).\n ///////////////////////////////////////////////////\n\n const kvdReader = new BufferReader(data, kvdByteOffset, kvdByteLength, true)\n\n while (kvdReader._offset < kvdByteLength) {\n const keyValueByteLength = kvdReader._nextUint32()\n\n const keyData = kvdReader._scan(keyValueByteLength)\n\n const key = decodeText(keyData)\n container.keyValue[key] = kvdReader._nextUint8Array(keyValueByteLength - keyData.byteLength - 1)\n\n if (key.match(/^ktx/i)) {\n const text = decodeText(container.keyValue[key])\n container.keyValue[key] = text.substring(0, text.lastIndexOf('\\x00'))\n }\n\n const kvPadding = keyValueByteLength % 4 ? 4 - (keyValueByteLength % 4) : 0 // align(4)\n // 4-byte alignment.\n\n kvdReader._skip(kvPadding)\n } ///////////////////////////////////////////////////\n // Supercompression Global Data (SGD).\n ///////////////////////////////////////////////////\n\n if (sgdByteLength <= 0) return container\n const sgdReader = new BufferReader(data, sgdByteOffset, sgdByteLength, true)\n\n const endpointCount = sgdReader._nextUint16()\n\n const selectorCount = sgdReader._nextUint16()\n\n const endpointsByteLength = sgdReader._nextUint32()\n\n const selectorsByteLength = sgdReader._nextUint32()\n\n const tablesByteLength = sgdReader._nextUint32()\n\n const extendedByteLength = sgdReader._nextUint32()\n\n const imageDescs = []\n\n for (let i = 0; i < levelCount; i++) {\n imageDescs.push({\n imageFlags: sgdReader._nextUint32(),\n rgbSliceByteOffset: sgdReader._nextUint32(),\n rgbSliceByteLength: sgdReader._nextUint32(),\n alphaSliceByteOffset: sgdReader._nextUint32(),\n alphaSliceByteLength: sgdReader._nextUint32(),\n })\n }\n\n const endpointsByteOffset = sgdByteOffset + sgdReader._offset\n const selectorsByteOffset = endpointsByteOffset + endpointsByteLength\n const tablesByteOffset = selectorsByteOffset + selectorsByteLength\n const extendedByteOffset = tablesByteOffset + tablesByteLength\n const endpointsData = new Uint8Array(data.buffer, data.byteOffset + endpointsByteOffset, endpointsByteLength)\n const selectorsData = new Uint8Array(data.buffer, data.byteOffset + selectorsByteOffset, selectorsByteLength)\n const tablesData = new Uint8Array(data.buffer, data.byteOffset + tablesByteOffset, tablesByteLength)\n const extendedData = new Uint8Array(data.buffer, data.byteOffset + extendedByteOffset, extendedByteLength)\n container.globalData = {\n endpointCount,\n selectorCount,\n imageDescs,\n endpointsData,\n selectorsData,\n tablesData,\n extendedData,\n }\n return container\n}\n\nconst DEFAULT_OPTIONS = {\n keepWriter: false,\n}\n/**\n * Serializes a {@link KTX2Container} instance to a KTX 2.0 file. Mip levels and other binary data\n * are copied into the resulting Uint8Array, so the original container can safely be edited or\n * destroyed after it is serialized.\n *\n * Options:\n * - keepWriter: If true, 'KTXWriter' key/value field is written as provided by the container.\n * \t\tOtherwise, a string for the current ktx-parse version is generated. Default: false.\n *\n * @param container\n * @param options\n */\n\nfunction write(container, options) {\n if (options === void 0) {\n options = {}\n }\n\n options = { ...DEFAULT_OPTIONS, ...options } ///////////////////////////////////////////////////\n // Supercompression Global Data (SGD).\n ///////////////////////////////////////////////////\n\n let sgdBuffer = new ArrayBuffer(0)\n\n if (container.globalData) {\n const sgdHeaderBuffer = new ArrayBuffer(20 + container.globalData.imageDescs.length * 5 * 4)\n const sgdHeaderView = new DataView(sgdHeaderBuffer)\n sgdHeaderView.setUint16(0, container.globalData.endpointCount, true)\n sgdHeaderView.setUint16(2, container.globalData.selectorCount, true)\n sgdHeaderView.setUint32(4, container.globalData.endpointsData.byteLength, true)\n sgdHeaderView.setUint32(8, container.globalData.selectorsData.byteLength, true)\n sgdHeaderView.setUint32(12, container.globalData.tablesData.byteLength, true)\n sgdHeaderView.setUint32(16, container.globalData.extendedData.byteLength, true)\n\n for (let i = 0; i < container.globalData.imageDescs.length; i++) {\n const imageDesc = container.globalData.imageDescs[i]\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 0, imageDesc.imageFlags, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 4, imageDesc.rgbSliceByteOffset, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 8, imageDesc.rgbSliceByteLength, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 12, imageDesc.alphaSliceByteOffset, true)\n sgdHeaderView.setUint32(20 + i * 5 * 4 + 16, imageDesc.alphaSliceByteLength, true)\n }\n\n sgdBuffer = concat([\n sgdHeaderBuffer,\n container.globalData.endpointsData,\n container.globalData.selectorsData,\n container.globalData.tablesData,\n container.globalData.extendedData,\n ])\n } ///////////////////////////////////////////////////\n // Key/Value Data (KVD).\n ///////////////////////////////////////////////////\n\n const keyValueData = []\n let keyValue = container.keyValue\n\n if (!options.keepWriter) {\n keyValue = { ...container.keyValue, KTXwriter: KTX_WRITER }\n }\n\n for (const key in keyValue) {\n const value = keyValue[key]\n const keyData = encodeText(key)\n const valueData = typeof value === 'string' ? concat([encodeText(value), NUL]) : value\n const kvByteLength = keyData.byteLength + 1 + valueData.byteLength\n const kvPadding = kvByteLength % 4 ? 4 - (kvByteLength % 4) : 0 // align(4)\n\n keyValueData.push(\n concat([\n new Uint32Array([kvByteLength]),\n keyData,\n NUL,\n valueData,\n new Uint8Array(kvPadding).fill(0x00), // align(4)\n ]),\n )\n }\n\n const kvdBuffer = concat(keyValueData) ///////////////////////////////////////////////////\n // Data Format Descriptor (DFD).\n ///////////////////////////////////////////////////\n\n if (\n container.dataFormatDescriptor.length !== 1 ||\n container.dataFormatDescriptor[0].descriptorType !== KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT\n ) {\n throw new Error('Only BASICFORMAT Data Format Descriptor output supported.')\n }\n\n const dfd = container.dataFormatDescriptor[0]\n const dfdBuffer = new ArrayBuffer(28 + dfd.samples.length * 16)\n const dfdView = new DataView(dfdBuffer)\n const descriptorBlockSize = 24 + dfd.samples.length * 16\n dfdView.setUint32(0, dfdBuffer.byteLength, true)\n dfdView.setUint16(4, dfd.vendorId, true)\n dfdView.setUint16(6, dfd.descriptorType, true)\n dfdView.setUint16(8, dfd.versionNumber, true)\n dfdView.setUint16(10, descriptorBlockSize, true)\n dfdView.setUint8(12, dfd.colorModel)\n dfdView.setUint8(13, dfd.colorPrimaries)\n dfdView.setUint8(14, dfd.transferFunction)\n dfdView.setUint8(15, dfd.flags)\n\n if (!Array.isArray(dfd.texelBlockDimension)) {\n throw new Error('texelBlockDimension is now an array. For dimensionality `d`, set `d - 1`.')\n }\n\n dfdView.setUint8(16, dfd.texelBlockDimension[0])\n dfdView.setUint8(17, dfd.texelBlockDimension[1])\n dfdView.setUint8(18, dfd.texelBlockDimension[2])\n dfdView.setUint8(19, dfd.texelBlockDimension[3])\n\n for (let i = 0; i < 8; i++) dfdView.setUint8(20 + i, dfd.bytesPlane[i])\n\n for (let i = 0; i < dfd.samples.length; i++) {\n const sample = dfd.samples[i]\n const sampleByteOffset = 28 + i * 16\n\n if (sample.channelID) {\n throw new Error('channelID has been renamed to channelType.')\n }\n\n dfdView.setUint16(sampleByteOffset + 0, sample.bitOffset, true)\n dfdView.setUint8(sampleByteOffset + 2, sample.bitLength)\n dfdView.setUint8(sampleByteOffset + 3, sample.channelType)\n dfdView.setUint8(sampleByteOffset + 4, sample.samplePosition[0])\n dfdView.setUint8(sampleByteOffset + 5, sample.samplePosition[1])\n dfdView.setUint8(sampleByteOffset + 6, sample.samplePosition[2])\n dfdView.setUint8(sampleByteOffset + 7, sample.samplePosition[3])\n\n if (sample.channelType & KHR_DF_SAMPLE_DATATYPE_SIGNED) {\n dfdView.setInt32(sampleByteOffset + 8, sample.sampleLower, true)\n dfdView.setInt32(sampleByteOffset + 12, sample.sampleUpper, true)\n } else {\n dfdView.setUint32(sampleByteOffset + 8, sample.sampleLower, true)\n dfdView.setUint32(sampleByteOffset + 12, sample.sampleUpper, true)\n }\n } ///////////////////////////////////////////////////\n // Data alignment.\n ///////////////////////////////////////////////////\n\n const dfdByteOffset = KTX2_ID.length + HEADER_BYTE_LENGTH + container.levels.length * 3 * 8\n const kvdByteOffset = dfdByteOffset + dfdBuffer.byteLength\n let sgdByteOffset = sgdBuffer.byteLength > 0 ? kvdByteOffset + kvdBuffer.byteLength : 0\n if (sgdByteOffset % 8) sgdByteOffset += 8 - (sgdByteOffset % 8) // align(8)\n ///////////////////////////////////////////////////\n // Level Index.\n ///////////////////////////////////////////////////\n\n const levelData = []\n const levelIndex = new DataView(new ArrayBuffer(container.levels.length * 3 * 8))\n let levelDataByteOffset = (sgdByteOffset || kvdByteOffset + kvdBuffer.byteLength) + sgdBuffer.byteLength\n\n for (let i = 0; i < container.levels.length; i++) {\n const level = container.levels[i]\n levelData.push(level.levelData)\n levelIndex.setBigUint64(i * 24 + 0, BigInt(levelDataByteOffset), true)\n levelIndex.setBigUint64(i * 24 + 8, BigInt(level.levelData.byteLength), true)\n levelIndex.setBigUint64(i * 24 + 16, BigInt(level.uncompressedByteLength), true)\n levelDataByteOffset += level.levelData.byteLength\n } ///////////////////////////////////////////////////\n // Header.\n ///////////////////////////////////////////////////\n\n const headerBuffer = new ArrayBuffer(HEADER_BYTE_LENGTH)\n const headerView = new DataView(headerBuffer)\n headerView.setUint32(0, container.vkFormat, true)\n headerView.setUint32(4, container.typeSize, true)\n headerView.setUint32(8, container.pixelWidth, true)\n headerView.setUint32(12, container.pixelHeight, true)\n headerView.setUint32(16, container.pixelDepth, true)\n headerView.setUint32(20, container.layerCount, true)\n headerView.setUint32(24, container.faceCount, true)\n headerView.setUint32(28, container.levels.length, true)\n headerView.setUint32(32, container.supercompressionScheme, true)\n headerView.setUint32(36, dfdByteOffset, true)\n headerView.setUint32(40, dfdBuffer.byteLength, true)\n headerView.setUint32(44, kvdByteOffset, true)\n headerView.setUint32(48, kvdBuffer.byteLength, true)\n headerView.setBigUint64(52, BigInt(sgdBuffer.byteLength > 0 ? sgdByteOffset : 0), true)\n headerView.setBigUint64(60, BigInt(sgdBuffer.byteLength), true) ///////////////////////////////////////////////////\n // Compose.\n ///////////////////////////////////////////////////\n\n return new Uint8Array(\n concat([\n new Uint8Array(KTX2_ID).buffer,\n headerBuffer,\n levelIndex.buffer,\n dfdBuffer,\n kvdBuffer,\n sgdByteOffset > 0\n ? new ArrayBuffer(sgdByteOffset - (kvdByteOffset + kvdBuffer.byteLength)) // align(8)\n : new ArrayBuffer(0),\n sgdBuffer,\n ...levelData,\n ]),\n )\n}\n\nexport {\n KHR_DF_CHANNEL_RGBSDA_ALPHA,\n KHR_DF_CHANNEL_RGBSDA_BLUE,\n KHR_DF_CHANNEL_RGBSDA_DEPTH,\n KHR_DF_CHANNEL_RGBSDA_GREEN,\n KHR_DF_CHANNEL_RGBSDA_RED,\n KHR_DF_CHANNEL_RGBSDA_STENCIL,\n KHR_DF_FLAG_ALPHA_PREMULTIPLIED,\n KHR_DF_FLAG_ALPHA_STRAIGHT,\n KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,\n KHR_DF_MODEL_ASTC,\n KHR_DF_MODEL_ETC1,\n KHR_DF_MODEL_ETC1S,\n KHR_DF_MODEL_ETC2,\n KHR_DF_MODEL_RGBSDA,\n KHR_DF_MODEL_UASTC,\n KHR_DF_MODEL_UNSPECIFIED,\n KHR_DF_PRIMARIES_ACES,\n KHR_DF_PRIMARIES_ACESCC,\n KHR_DF_PRIMARIES_ADOBERGB,\n KHR_DF_PRIMARIES_BT2020,\n KHR_DF_PRIMARIES_BT601_EBU,\n KHR_DF_PRIMARIES_BT601_SMPTE,\n KHR_DF_PRIMARIES_BT709,\n KHR_DF_PRIMARIES_CIEXYZ,\n KHR_DF_PRIMARIES_DISPLAYP3,\n KHR_DF_PRIMARIES_NTSC1953,\n KHR_DF_PRIMARIES_PAL525,\n KHR_DF_PRIMARIES_UNSPECIFIED,\n KHR_DF_SAMPLE_DATATYPE_EXPONENT,\n KHR_DF_SAMPLE_DATATYPE_FLOAT,\n KHR_DF_SAMPLE_DATATYPE_LINEAR,\n KHR_DF_SAMPLE_DATATYPE_SIGNED,\n KHR_DF_TRANSFER_ACESCC,\n KHR_DF_TRANSFER_ACESCCT,\n KHR_DF_TRANSFER_ADOBERGB,\n KHR_DF_TRANSFER_BT1886,\n KHR_DF_TRANSFER_DCIP3,\n KHR_DF_TRANSFER_HLG_EOTF,\n KHR_DF_TRANSFER_HLG_OETF,\n KHR_DF_TRANSFER_ITU,\n KHR_DF_TRANSFER_LINEAR,\n KHR_DF_TRANSFER_NTSC,\n KHR_DF_TRANSFER_PAL625_EOTF,\n KHR_DF_TRANSFER_PAL_OETF,\n KHR_DF_TRANSFER_PQ_EOTF,\n KHR_DF_TRANSFER_PQ_OETF,\n KHR_DF_TRANSFER_SLOG,\n KHR_DF_TRANSFER_SLOG2,\n KHR_DF_TRANSFER_SRGB,\n KHR_DF_TRANSFER_ST240,\n KHR_DF_TRANSFER_UNSPECIFIED,\n KHR_DF_VENDORID_KHRONOS,\n KHR_DF_VERSION,\n KHR_SUPERCOMPRESSION_BASISLZ,\n KHR_SUPERCOMPRESSION_NONE,\n KHR_SUPERCOMPRESSION_ZLIB,\n KHR_SUPERCOMPRESSION_ZSTD,\n KTX2Container,\n VK_FORMAT_A1R5G5B5_UNORM_PACK16,\n VK_FORMAT_A2B10G10R10_SINT_PACK32,\n VK_FORMAT_A2B10G10R10_SNORM_PACK32,\n VK_FORMAT_A2B10G10R10_UINT_PACK32,\n VK_FORMAT_A2B10G10R10_UNORM_PACK32,\n VK_FORMAT_A2R10G10B10_SINT_PACK32,\n VK_FORMAT_A2R10G10B10_SNORM_PACK32,\n VK_FORMAT_A2R10G10B10_UINT_PACK32,\n VK_FORMAT_A2R10G10B10_UNORM_PACK32,\n VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT,\n VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT,\n VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x10_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x10_UNORM_BLOCK,\n VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x6_UNORM_BLOCK,\n VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_10x8_SRGB_BLOCK,\n VK_FORMAT_ASTC_10x8_UNORM_BLOCK,\n VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_12x10_SRGB_BLOCK,\n VK_FORMAT_ASTC_12x10_UNORM_BLOCK,\n VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_12x12_SRGB_BLOCK,\n VK_FORMAT_ASTC_12x12_UNORM_BLOCK,\n VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_4x4_SRGB_BLOCK,\n VK_FORMAT_ASTC_4x4_UNORM_BLOCK,\n VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_5x4_SRGB_BLOCK,\n VK_FORMAT_ASTC_5x4_UNORM_BLOCK,\n VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_5x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_5x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_6x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_6x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_6x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_6x6_UNORM_BLOCK,\n VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_8x5_SRGB_BLOCK,\n VK_FORMAT_ASTC_8x5_UNORM_BLOCK,\n VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_8x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_8x6_UNORM_BLOCK,\n VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT,\n VK_FORMAT_ASTC_8x8_SRGB_BLOCK,\n VK_FORMAT_ASTC_8x8_UNORM_BLOCK,\n VK_FORMAT_B10G11R11_UFLOAT_PACK32,\n VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16,\n VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16,\n VK_FORMAT_B4G4R4A4_UNORM_PACK16,\n VK_FORMAT_B5G5R5A1_UNORM_PACK16,\n VK_FORMAT_B5G6R5_UNORM_PACK16,\n VK_FORMAT_B8G8R8A8_SINT,\n VK_FORMAT_B8G8R8A8_SNORM,\n VK_FORMAT_B8G8R8A8_SRGB,\n VK_FORMAT_B8G8R8A8_UINT,\n VK_FORMAT_B8G8R8A8_UNORM,\n VK_FORMAT_B8G8R8_SINT,\n VK_FORMAT_B8G8R8_SNORM,\n VK_FORMAT_B8G8R8_SRGB,\n VK_FORMAT_B8G8R8_UINT,\n VK_FORMAT_B8G8R8_UNORM,\n VK_FORMAT_BC1_RGBA_SRGB_BLOCK,\n VK_FORMAT_BC1_RGBA_UNORM_BLOCK,\n VK_FORMAT_BC1_RGB_SRGB_BLOCK,\n VK_FORMAT_BC1_RGB_UNORM_BLOCK,\n VK_FORMAT_BC2_SRGB_BLOCK,\n VK_FORMAT_BC2_UNORM_BLOCK,\n VK_FORMAT_BC3_SRGB_BLOCK,\n VK_FORMAT_BC3_UNORM_BLOCK,\n VK_FORMAT_BC4_SNORM_BLOCK,\n VK_FORMAT_BC4_UNORM_BLOCK,\n VK_FORMAT_BC5_SNORM_BLOCK,\n VK_FORMAT_BC5_UNORM_BLOCK,\n VK_FORMAT_BC6H_SFLOAT_BLOCK,\n VK_FORMAT_BC6H_UFLOAT_BLOCK,\n VK_FORMAT_BC7_SRGB_BLOCK,\n VK_FORMAT_BC7_UNORM_BLOCK,\n VK_FORMAT_D16_UNORM,\n VK_FORMAT_D16_UNORM_S8_UINT,\n VK_FORMAT_D24_UNORM_S8_UINT,\n VK_FORMAT_D32_SFLOAT,\n VK_FORMAT_D32_SFLOAT_S8_UINT,\n VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,\n VK_FORMAT_EAC_R11G11_SNORM_BLOCK,\n VK_FORMAT_EAC_R11G11_UNORM_BLOCK,\n VK_FORMAT_EAC_R11_SNORM_BLOCK,\n VK_FORMAT_EAC_R11_UNORM_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,\n VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,\n VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,\n VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,\n VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16,\n VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16,\n VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG,\n VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG,\n VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16,\n VK_FORMAT_R10X6G10X6_UNORM_2PACK16,\n VK_FORMAT_R10X6_UNORM_PACK16,\n VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16,\n VK_FORMAT_R12X4G12X4_UNORM_2PACK16,\n VK_FORMAT_R12X4_UNORM_PACK16,\n VK_FORMAT_R16G16B16A16_SFLOAT,\n VK_FORMAT_R16G16B16A16_SINT,\n VK_FORMAT_R16G16B16A16_SNORM,\n VK_FORMAT_R16G16B16A16_UINT,\n VK_FORMAT_R16G16B16A16_UNORM,\n VK_FORMAT_R16G16B16_SFLOAT,\n VK_FORMAT_R16G16B16_SINT,\n VK_FORMAT_R16G16B16_SNORM,\n VK_FORMAT_R16G16B16_UINT,\n VK_FORMAT_R16G16B16_UNORM,\n VK_FORMAT_R16G16_SFLOAT,\n VK_FORMAT_R16G16_SINT,\n VK_FORMAT_R16G16_SNORM,\n VK_FORMAT_R16G16_UINT,\n VK_FORMAT_R16G16_UNORM,\n VK_FORMAT_R16_SFLOAT,\n VK_FORMAT_R16_SINT,\n VK_FORMAT_R16_SNORM,\n VK_FORMAT_R16_UINT,\n VK_FORMAT_R16_UNORM,\n VK_FORMAT_R32G32B32A32_SFLOAT,\n VK_FORMAT_R32G32B32A32_SINT,\n VK_FORMAT_R32G32B32A32_UINT,\n VK_FORMAT_R32G32B32_SFLOAT,\n VK_FORMAT_R32G32B32_SINT,\n VK_FORMAT_R32G32B32_UINT,\n VK_FORMAT_R32G32_SFLOAT,\n VK_FORMAT_R32G32_SINT,\n VK_FORMAT_R32G32_UINT,\n VK_FORMAT_R32_SFLOAT,\n VK_FORMAT_R32_SINT,\n VK_FORMAT_R32_UINT,\n VK_FORMAT_R4G4B4A4_UNORM_PACK16,\n VK_FORMAT_R4G4_UNORM_PACK8,\n VK_FORMAT_R5G5B5A1_UNORM_PACK16,\n VK_FORMAT_R5G6B5_UNORM_PACK16,\n VK_FORMAT_R64G64B64A64_SFLOAT,\n VK_FORMAT_R64G64B64A64_SINT,\n VK_FORMAT_R64G64B64A64_UINT,\n VK_FORMAT_R64G64B64_SFLOAT,\n VK_FORMAT_R64G64B64_SINT,\n VK_FORMAT_R64G64B64_UINT,\n VK_FORMAT_R64G64_SFLOAT,\n VK_FORMAT_R64G64_SINT,\n VK_FORMAT_R64G64_UINT,\n VK_FORMAT_R64_SFLOAT,\n VK_FORMAT_R64_SINT,\n VK_FORMAT_R64_UINT,\n VK_FORMAT_R8G8B8A8_SINT,\n VK_FORMAT_R8G8B8A8_SNORM,\n VK_FORMAT_R8G8B8A8_SRGB,\n VK_FORMAT_R8G8B8A8_UINT,\n VK_FORMAT_R8G8B8A8_UNORM,\n VK_FORMAT_R8G8B8_SINT,\n VK_FORMAT_R8G8B8_SNORM,\n VK_FORMAT_R8G8B8_SRGB,\n VK_FORMAT_R8G8B8_UINT,\n VK_FORMAT_R8G8B8_UNORM,\n VK_FORMAT_R8G8_SINT,\n VK_FORMAT_R8G8_SNORM,\n VK_FORMAT_R8G8_SRGB,\n VK_FORMAT_R8G8_UINT,\n VK_FORMAT_R8G8_UNORM,\n VK_FORMAT_R8_SINT,\n VK_FORMAT_R8_SNORM,\n VK_FORMAT_R8_SRGB,\n VK_FORMAT_R8_UINT,\n VK_FORMAT_R8_UNORM,\n VK_FORMAT_S8_UINT,\n VK_FORMAT_UNDEFINED,\n VK_FORMAT_X8_D24_UNORM_PACK32,\n read,\n write,\n}\n//# sourceMappingURL=ktx-parse.esm.js.map\n", "interface DecoderExports {\n memory: Uint8Array\n\n ZSTD_findDecompressedSize: (compressedPtr: number, compressedSize: number) => BigInt\n ZSTD_decompress: (\n uncompressedPtr: number,\n uncompressedSize: number,\n compressedPtr: number,\n compressedSize: number,\n ) => number\n malloc: (ptr: number) => number\n free: (ptr: number) => void\n}\n\nlet init: Promise\nlet instance: { exports: DecoderExports }\nlet heap: Uint8Array\n\nconst IMPORT_OBJECT = {\n env: {\n emscripten_notify_memory_growth: function (index: number): void {\n heap = new Uint8Array(instance.exports.memory.buffer)\n },\n },\n}\n\n/**\n * ZSTD (Zstandard) decoder.\n */\nexport class ZSTDDecoder {\n init(): Promise {\n if (init) return init\n\n if (typeof fetch !== 'undefined') {\n // Web.\n\n init = fetch('data:application/wasm;base64,' + wasm)\n .then((response) => response.arrayBuffer())\n .then((arrayBuffer) => WebAssembly.instantiate(arrayBuffer, IMPORT_OBJECT))\n .then(this._init)\n } else {\n // Node.js.\n\n init = WebAssembly.instantiate(Buffer.from(wasm, 'base64'), IMPORT_OBJECT).then(this._init)\n }\n\n return init\n }\n\n _init(result: WebAssembly.WebAssemblyInstantiatedSource): void {\n instance = (result.instance as unknown) as { exports: DecoderExports }\n\n IMPORT_OBJECT.env.emscripten_notify_memory_growth(0) // initialize heap.\n }\n\n decode(array: Uint8Array, uncompressedSize = 0): Uint8Array {\n if (!instance) throw new Error(`ZSTDDecoder: Await .init() before decoding.`)\n\n // Write compressed data into WASM memory.\n const compressedSize = array.byteLength\n const compressedPtr = instance.exports.malloc(compressedSize)\n heap.set(array, compressedPtr)\n\n // Decompress into WASM memory.\n uncompressedSize =\n uncompressedSize || Number(instance.exports.ZSTD_findDecompressedSize(compressedPtr, compressedSize))\n const uncompressedPtr = instance.exports.malloc(uncompressedSize)\n const actualSize = instance.exports.ZSTD_decompress(\n uncompressedPtr,\n uncompressedSize,\n compressedPtr,\n compressedSize,\n )\n\n // Read decompressed data and free WASM memory.\n const dec = heap.slice(uncompressedPtr, uncompressedPtr + actualSize)\n instance.exports.free(compressedPtr)\n instance.exports.free(uncompressedPtr)\n\n return dec\n }\n}\n\n/**\n * BSD License\n *\n * For Zstandard software\n *\n * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * * Neither the name Facebook nor the names of its contributors may be used to\n * endorse or promote products derived from this software without specific\n * prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n// wasm:begin\nconst wasm =\n 'AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABg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aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBB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IAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIh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gACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZA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8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ'\n// wasm:end\n", "import { CompressedTexture, CubeReflectionMapping } from 'three'\n\nclass CompressedCubeTexture extends CompressedTexture {\n constructor(images, format, type) {\n super(undefined, images[0].width, images[0].height, format, type, CubeReflectionMapping)\n\n this.isCompressedCubeTexture = true\n this.isCubeTexture = true\n\n this.image = images\n }\n}\n\nexport { CompressedCubeTexture }\n", "import { CompressedTexture, ClampToEdgeWrapping } from 'three'\n\nclass CompressedArrayTexture extends CompressedTexture {\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 = ClampToEdgeWrapping\n }\n}\n\nexport { CompressedArrayTexture }\n", "/**\n * Loader for KTX 2.0 GPU Texture containers.\n *\n * KTX 2.0 is a container format for various GPU texture formats. The loader\n * supports Basis Universal GPU textures, which can be quickly transcoded to\n * a wide variety of GPU texture compression formats, as well as some\n * uncompressed DataTexture and Data3DTexture formats.\n *\n * References:\n * - KTX: http://github.khronos.org/KTX-Specification/\n * - DFD: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor\n */\n\nimport {\n CompressedTexture,\n DataTexture,\n FileLoader,\n FloatType,\n HalfFloatType,\n LinearFilter,\n LinearMipmapLinearFilter,\n Loader,\n RedFormat,\n RGB_ETC1_Format,\n RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format,\n RGBA_ASTC_4x4_Format,\n RGBA_ASTC_6x6_Format,\n RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format,\n RGBAFormat,\n RGFormat,\n UnsignedByteType,\n} from 'three'\nimport { WorkerPool } from '../utils/WorkerPool'\nimport {\n read,\n KHR_DF_FLAG_ALPHA_PREMULTIPLIED,\n KHR_DF_TRANSFER_SRGB,\n KHR_SUPERCOMPRESSION_NONE,\n KHR_SUPERCOMPRESSION_ZSTD,\n VK_FORMAT_UNDEFINED,\n VK_FORMAT_R16_SFLOAT,\n VK_FORMAT_R16G16_SFLOAT,\n VK_FORMAT_R16G16B16A16_SFLOAT,\n VK_FORMAT_R32_SFLOAT,\n VK_FORMAT_R32G32_SFLOAT,\n VK_FORMAT_R32G32B32A32_SFLOAT,\n VK_FORMAT_R8_SRGB,\n VK_FORMAT_R8_UNORM,\n VK_FORMAT_R8G8_SRGB,\n VK_FORMAT_R8G8_UNORM,\n VK_FORMAT_R8G8B8A8_SRGB,\n VK_FORMAT_R8G8B8A8_UNORM,\n VK_FORMAT_ASTC_6x6_SRGB_BLOCK,\n VK_FORMAT_ASTC_6x6_UNORM_BLOCK,\n KHR_DF_PRIMARIES_UNSPECIFIED,\n KHR_DF_PRIMARIES_BT709,\n KHR_DF_PRIMARIES_DISPLAYP3,\n} from '../libs/ktx-parse'\nimport { ZSTDDecoder } from '../libs/zstddec'\nimport { CompressedCubeTexture } from '../_polyfill/CompressedCubeTexture'\nimport { CompressedArrayTexture } from '../_polyfill/CompressedArrayTexture'\nimport { Data3DTexture } from '../_polyfill/Data3DTexture'\n\nconst LinearEncoding = 3000\nconst sRGBEncoding = 3001\n\nconst NoColorSpace = ''\nconst DisplayP3ColorSpace = 'display-p3'\nconst LinearDisplayP3ColorSpace = 'display-p3-linear'\nconst LinearSRGBColorSpace = 'srgb-linear'\nconst SRGBColorSpace = 'srgb'\n\nconst _taskCache = new WeakMap()\n\nlet _activeLoaders = 0\n\nlet _zstd\n\nclass KTX2Loader extends Loader {\n /* CONSTANTS */\n\n static BasisFormat = {\n ETC1S: 0,\n UASTC_4x4: 1,\n }\n\n static TranscoderFormat = {\n ETC1: 0,\n ETC2: 1,\n BC1: 2,\n BC3: 3,\n BC4: 4,\n BC5: 5,\n BC7_M6_OPAQUE_ONLY: 6,\n BC7_M5: 7,\n PVRTC1_4_RGB: 8,\n PVRTC1_4_RGBA: 9,\n ASTC_4x4: 10,\n ATC_RGB: 11,\n ATC_RGBA_INTERPOLATED_ALPHA: 12,\n RGBA32: 13,\n RGB565: 14,\n BGR565: 15,\n RGBA4444: 16,\n }\n\n static EngineFormat = {\n RGBAFormat: RGBAFormat,\n RGBA_ASTC_4x4_Format: RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format: RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format: RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format: RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format: RGBA_S3TC_DXT5_Format,\n RGB_ETC1_Format: RGB_ETC1_Format,\n RGB_ETC2_Format: RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format: RGB_S3TC_DXT1_Format,\n }\n\n /* WEB WORKER */\n\n static BasisWorker = function () {\n let config\n let transcoderPending\n let BasisModule\n\n /** @type KTX2Loader.EngineFormat */\n const EngineFormat = _EngineFormat\n /** @type KTX2Loader.TranscoderFormat */\n const TranscoderFormat = _TranscoderFormat\n /** @type KTX2Loader.BasisFormat */\n const BasisFormat = _BasisFormat\n\n self.addEventListener('message', function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'init':\n config = message.config\n init(message.transcoderBinary)\n break\n\n case 'transcode':\n transcoderPending.then(() => {\n try {\n const { faces, buffers, width, height, hasAlpha, format, dfdFlags } = transcode(message.buffer)\n\n self.postMessage(\n { type: 'transcode', id: message.id, faces, width, height, hasAlpha, format, dfdFlags },\n buffers,\n )\n } catch (error) {\n console.error(error)\n\n self.postMessage({ type: 'error', id: message.id, error: error.message })\n }\n })\n break\n }\n })\n\n function init(wasmBinary) {\n transcoderPending = new Promise((resolve) => {\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve }\n BASIS(BasisModule)\n }).then(() => {\n BasisModule.initializeBasis()\n\n if (BasisModule.KTX2File === undefined) {\n console.warn('THREE.KTX2Loader: Please update Basis Universal transcoder.')\n }\n })\n }\n\n function transcode(buffer) {\n const ktx2File = new BasisModule.KTX2File(new Uint8Array(buffer))\n\n function cleanup() {\n ktx2File.close()\n ktx2File.delete()\n }\n\n if (!ktx2File.isValid()) {\n cleanup()\n throw new Error('THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file')\n }\n\n const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S\n const width = ktx2File.getWidth()\n const height = ktx2File.getHeight()\n const layerCount = ktx2File.getLayers() || 1\n const levelCount = ktx2File.getLevels()\n const faceCount = ktx2File.getFaces()\n const hasAlpha = ktx2File.getHasAlpha()\n const dfdFlags = ktx2File.getDFDFlags()\n\n const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha)\n\n if (!width || !height || !levelCount) {\n cleanup()\n throw new Error('THREE.KTX2Loader:\tInvalid texture')\n }\n\n if (!ktx2File.startTranscoding()) {\n cleanup()\n throw new Error('THREE.KTX2Loader: .startTranscoding failed')\n }\n\n const faces = []\n const buffers = []\n\n for (let face = 0; face < faceCount; face++) {\n const mipmaps = []\n\n for (let mip = 0; mip < levelCount; mip++) {\n const layerMips = []\n\n let mipWidth, mipHeight\n\n for (let layer = 0; layer < layerCount; layer++) {\n const levelInfo = ktx2File.getImageLevelInfo(mip, layer, face)\n\n if (\n face === 0 &&\n mip === 0 &&\n layer === 0 &&\n (levelInfo.origWidth % 4 !== 0 || levelInfo.origHeight % 4 !== 0)\n ) {\n console.warn('THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions.')\n }\n\n if (levelCount > 1) {\n mipWidth = levelInfo.origWidth\n mipHeight = levelInfo.origHeight\n } else {\n // Handles non-multiple-of-four dimensions in textures without mipmaps. Textures with\n // mipmaps must use multiple-of-four dimensions, for some texture formats and APIs.\n // See mrdoob/three.js#25908.\n mipWidth = levelInfo.width\n mipHeight = levelInfo.height\n }\n\n const dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, transcoderFormat))\n const status = ktx2File.transcodeImage(dst, mip, layer, face, transcoderFormat, 0, -1, -1)\n\n if (!status) {\n cleanup()\n throw new Error('THREE.KTX2Loader: .transcodeImage failed.')\n }\n\n layerMips.push(dst)\n }\n\n const mipData = concat(layerMips)\n\n mipmaps.push({ data: mipData, width: mipWidth, height: mipHeight })\n buffers.push(mipData.buffer)\n }\n\n faces.push({ mipmaps, width, height, format: engineFormat })\n }\n\n cleanup()\n\n return { faces, buffers, width, height, hasAlpha, format: engineFormat, dfdFlags }\n }\n\n //\n\n // Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC),\n // device capabilities, and texture dimensions. The list below ranks the formats separately\n // for ETC1S and UASTC.\n //\n // In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at\n // significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently\n // chooses RGBA32 only as a last resort and does not expose that option to the caller.\n const FORMAT_OPTIONS = [\n {\n if: 'astcSupported',\n basisFormat: [BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],\n engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],\n priorityETC1S: Infinity,\n priorityUASTC: 1,\n needsPowerOfTwo: false,\n },\n {\n if: 'bptcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],\n engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],\n priorityETC1S: 3,\n priorityUASTC: 2,\n needsPowerOfTwo: false,\n },\n {\n if: 'dxtSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],\n engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],\n priorityETC1S: 4,\n priorityUASTC: 5,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc2Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],\n engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],\n priorityETC1S: 1,\n priorityUASTC: 3,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc1Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1],\n engineFormat: [EngineFormat.RGB_ETC1_Format],\n priorityETC1S: 2,\n priorityUASTC: 4,\n needsPowerOfTwo: false,\n },\n {\n if: 'pvrtcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],\n engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],\n priorityETC1S: 5,\n priorityUASTC: 6,\n needsPowerOfTwo: true,\n },\n ]\n\n const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityETC1S - b.priorityETC1S\n })\n const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityUASTC - b.priorityUASTC\n })\n\n function getTranscoderFormat(basisFormat, width, height, hasAlpha) {\n let transcoderFormat\n let engineFormat\n\n const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS\n\n for (let i = 0; i < options.length; i++) {\n const opt = options[i]\n\n if (!config[opt.if]) continue\n if (!opt.basisFormat.includes(basisFormat)) continue\n if (hasAlpha && opt.transcoderFormat.length < 2) continue\n if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height))) continue\n\n transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0]\n engineFormat = opt.engineFormat[hasAlpha ? 1 : 0]\n\n return { transcoderFormat, engineFormat }\n }\n\n console.warn('THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32.')\n\n transcoderFormat = TranscoderFormat.RGBA32\n engineFormat = EngineFormat.RGBAFormat\n\n return { transcoderFormat, engineFormat }\n }\n\n function isPowerOfTwo(value) {\n if (value <= 2) return true\n\n return (value & (value - 1)) === 0 && value !== 0\n }\n\n /** Concatenates N byte arrays. */\n function concat(arrays) {\n if (arrays.length === 1) return arrays[0]\n\n let totalByteLength = 0\n\n for (let i = 0; i < arrays.length; i++) {\n const array = arrays[i]\n totalByteLength += array.byteLength\n }\n\n const result = new Uint8Array(totalByteLength)\n\n let byteOffset = 0\n\n for (let i = 0; i < arrays.length; i++) {\n const array = arrays[i]\n result.set(array, byteOffset)\n\n byteOffset += array.byteLength\n }\n\n return result\n }\n }\n\n constructor(manager) {\n super(manager)\n\n this.transcoderPath = ''\n this.transcoderBinary = null\n this.transcoderPending = null\n\n this.workerPool = new WorkerPool()\n this.workerSourceURL = ''\n this.workerConfig = null\n\n if (typeof MSC_TRANSCODER !== 'undefined') {\n console.warn(\n 'THREE.KTX2Loader: Please update to latest \"basis_transcoder\".' +\n ' \"msc_basis_transcoder\" is no longer supported in three.js r125+.',\n )\n }\n }\n\n setTranscoderPath(path) {\n this.transcoderPath = path\n\n return this\n }\n\n setWorkerLimit(num) {\n this.workerPool.setWorkerLimit(num)\n\n return this\n }\n\n detectSupport(renderer) {\n this.workerConfig = {\n astcSupported: renderer.extensions.has('WEBGL_compressed_texture_astc'),\n etc1Supported: renderer.extensions.has('WEBGL_compressed_texture_etc1'),\n etc2Supported: renderer.extensions.has('WEBGL_compressed_texture_etc'),\n dxtSupported: renderer.extensions.has('WEBGL_compressed_texture_s3tc'),\n bptcSupported: renderer.extensions.has('EXT_texture_compression_bptc'),\n pvrtcSupported:\n renderer.extensions.has('WEBGL_compressed_texture_pvrtc') ||\n renderer.extensions.has('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n }\n\n if (renderer.capabilities.isWebGL2) {\n // https://github.com/mrdoob/three.js/pull/22928\n this.workerConfig.etc1Supported = false\n }\n\n return this\n }\n\n init() {\n if (!this.transcoderPending) {\n // Load transcoder wrapper.\n const jsLoader = new FileLoader(this.manager)\n jsLoader.setPath(this.transcoderPath)\n jsLoader.setWithCredentials(this.withCredentials)\n const jsContent = jsLoader.loadAsync('basis_transcoder.js')\n\n // Load transcoder WASM binary.\n const binaryLoader = new FileLoader(this.manager)\n binaryLoader.setPath(this.transcoderPath)\n binaryLoader.setResponseType('arraybuffer')\n binaryLoader.setWithCredentials(this.withCredentials)\n const binaryContent = binaryLoader.loadAsync('basis_transcoder.wasm')\n\n this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent, binaryContent]) => {\n const fn = KTX2Loader.BasisWorker.toString()\n\n const body = [\n '/* constants */',\n 'let _EngineFormat = ' + JSON.stringify(KTX2Loader.EngineFormat),\n 'let _TranscoderFormat = ' + JSON.stringify(KTX2Loader.TranscoderFormat),\n 'let _BasisFormat = ' + JSON.stringify(KTX2Loader.BasisFormat),\n '/* basis_transcoder.js */',\n jsContent,\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}')),\n ].join('\\n')\n\n this.workerSourceURL = URL.createObjectURL(new Blob([body]))\n this.transcoderBinary = binaryContent\n\n this.workerPool.setWorkerCreator(() => {\n const worker = new Worker(this.workerSourceURL)\n const transcoderBinary = this.transcoderBinary.slice(0)\n\n worker.postMessage({ type: 'init', config: this.workerConfig, transcoderBinary }, [transcoderBinary])\n\n return worker\n })\n })\n\n if (_activeLoaders > 0) {\n // Each instance loads a transcoder and allocates workers, increasing network and memory cost.\n\n console.warn(\n 'THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues.' +\n ' Use a single KTX2Loader instance, or call .dispose() on old instances.',\n )\n }\n\n _activeLoaders++\n }\n\n return this.transcoderPending\n }\n\n load(url, onLoad, onProgress, onError) {\n if (this.workerConfig === null) {\n throw new Error('THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.')\n }\n\n const loader = new FileLoader(this.manager)\n\n loader.setResponseType('arraybuffer')\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n (buffer) => {\n // Check for an existing task using this buffer. A transferred buffer cannot be transferred\n // again from this thread.\n if (_taskCache.has(buffer)) {\n const cachedTask = _taskCache.get(buffer)\n\n return cachedTask.promise.then(onLoad).catch(onError)\n }\n\n this._createTexture(buffer)\n .then((texture) => (onLoad ? onLoad(texture) : null))\n .catch(onError)\n },\n onProgress,\n onError,\n )\n }\n\n _createTextureFrom(transcodeResult, container) {\n const { faces, width, height, format, type, error, dfdFlags } = transcodeResult\n\n if (type === 'error') return Promise.reject(error)\n\n let texture\n\n if (container.faceCount === 6) {\n texture = new CompressedCubeTexture(faces, format, UnsignedByteType)\n } else {\n const mipmaps = faces[0].mipmaps\n\n texture =\n container.layerCount > 1\n ? new CompressedArrayTexture(mipmaps, width, height, container.layerCount, format, UnsignedByteType)\n : new CompressedTexture(mipmaps, width, height, format, UnsignedByteType)\n }\n\n texture.minFilter = faces[0].mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter\n texture.magFilter = LinearFilter\n texture.generateMipmaps = false\n texture.needsUpdate = true\n\n const colorSpace = parseColorSpace(container)\n if ('colorSpace' in texture) texture.colorSpace = colorSpace\n else texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding\n\n texture.premultiplyAlpha = !!(dfdFlags & KHR_DF_FLAG_ALPHA_PREMULTIPLIED)\n\n return texture\n }\n\n /**\n * @param {ArrayBuffer} buffer\n * @param {object?} config\n * @return {Promise}\n */\n async _createTexture(buffer, config = {}) {\n const container = read(new Uint8Array(buffer))\n\n if (container.vkFormat !== VK_FORMAT_UNDEFINED) {\n return createRawTexture(container)\n }\n\n //\n\n const taskConfig = config\n const texturePending = this.init()\n .then(() => {\n return this.workerPool.postMessage({ type: 'transcode', buffer, taskConfig: taskConfig }, [buffer])\n })\n .then((e) => this._createTextureFrom(e.data, container))\n\n // Cache the task result.\n _taskCache.set(buffer, { promise: texturePending })\n\n return texturePending\n }\n\n dispose() {\n this.workerPool.dispose()\n if (this.workerSourceURL) URL.revokeObjectURL(this.workerSourceURL)\n\n _activeLoaders--\n\n return this\n }\n}\n\n//\n// Parsing for non-Basis textures. These textures are may have supercompression\n// like Zstd, but they do not require transcoding.\n\nconst UNCOMPRESSED_FORMATS = new Set([RGBAFormat, RGFormat, RedFormat])\n\nconst FORMAT_MAP = {\n [VK_FORMAT_R32G32B32A32_SFLOAT]: RGBAFormat,\n [VK_FORMAT_R16G16B16A16_SFLOAT]: RGBAFormat,\n [VK_FORMAT_R8G8B8A8_UNORM]: RGBAFormat,\n [VK_FORMAT_R8G8B8A8_SRGB]: RGBAFormat,\n\n [VK_FORMAT_R32G32_SFLOAT]: RGFormat,\n [VK_FORMAT_R16G16_SFLOAT]: RGFormat,\n [VK_FORMAT_R8G8_UNORM]: RGFormat,\n [VK_FORMAT_R8G8_SRGB]: RGFormat,\n\n [VK_FORMAT_R32_SFLOAT]: RedFormat,\n [VK_FORMAT_R16_SFLOAT]: RedFormat,\n [VK_FORMAT_R8_SRGB]: RedFormat,\n [VK_FORMAT_R8_UNORM]: RedFormat,\n\n [VK_FORMAT_ASTC_6x6_SRGB_BLOCK]: RGBA_ASTC_6x6_Format,\n [VK_FORMAT_ASTC_6x6_UNORM_BLOCK]: RGBA_ASTC_6x6_Format,\n}\n\nconst TYPE_MAP = {\n [VK_FORMAT_R32G32B32A32_SFLOAT]: FloatType,\n [VK_FORMAT_R16G16B16A16_SFLOAT]: HalfFloatType,\n [VK_FORMAT_R8G8B8A8_UNORM]: UnsignedByteType,\n [VK_FORMAT_R8G8B8A8_SRGB]: UnsignedByteType,\n\n [VK_FORMAT_R32G32_SFLOAT]: FloatType,\n [VK_FORMAT_R16G16_SFLOAT]: HalfFloatType,\n [VK_FORMAT_R8G8_UNORM]: UnsignedByteType,\n [VK_FORMAT_R8G8_SRGB]: UnsignedByteType,\n\n [VK_FORMAT_R32_SFLOAT]: FloatType,\n [VK_FORMAT_R16_SFLOAT]: HalfFloatType,\n [VK_FORMAT_R8_SRGB]: UnsignedByteType,\n [VK_FORMAT_R8_UNORM]: UnsignedByteType,\n\n [VK_FORMAT_ASTC_6x6_SRGB_BLOCK]: UnsignedByteType,\n [VK_FORMAT_ASTC_6x6_UNORM_BLOCK]: UnsignedByteType,\n}\n\nasync function createRawTexture(container) {\n const { vkFormat } = container\n\n if (FORMAT_MAP[vkFormat] === undefined) {\n throw new Error('THREE.KTX2Loader: Unsupported vkFormat.')\n }\n\n //\n\n let zstd\n\n if (container.supercompressionScheme === KHR_SUPERCOMPRESSION_ZSTD) {\n if (!_zstd) {\n _zstd = new Promise(async (resolve) => {\n const zstd = new ZSTDDecoder()\n await zstd.init()\n resolve(zstd)\n })\n }\n\n zstd = await _zstd\n }\n\n //\n\n const mipmaps = []\n\n for (let levelIndex = 0; levelIndex < container.levels.length; levelIndex++) {\n const levelWidth = Math.max(1, container.pixelWidth >> levelIndex)\n const levelHeight = Math.max(1, container.pixelHeight >> levelIndex)\n const levelDepth = container.pixelDepth ? Math.max(1, container.pixelDepth >> levelIndex) : 0\n\n const level = container.levels[levelIndex]\n\n let levelData\n\n if (container.supercompressionScheme === KHR_SUPERCOMPRESSION_NONE) {\n levelData = level.levelData\n } else if (container.supercompressionScheme === KHR_SUPERCOMPRESSION_ZSTD) {\n levelData = zstd.decode(level.levelData, level.uncompressedByteLength)\n } else {\n throw new Error('THREE.KTX2Loader: Unsupported supercompressionScheme.')\n }\n\n let data\n\n if (TYPE_MAP[vkFormat] === FloatType) {\n data = new Float32Array(\n levelData.buffer,\n levelData.byteOffset,\n levelData.byteLength / Float32Array.BYTES_PER_ELEMENT,\n )\n } else if (TYPE_MAP[vkFormat] === HalfFloatType) {\n data = new Uint16Array(\n levelData.buffer,\n levelData.byteOffset,\n levelData.byteLength / Uint16Array.BYTES_PER_ELEMENT,\n )\n } else {\n data = levelData\n }\n\n mipmaps.push({\n data: data,\n width: levelWidth,\n height: levelHeight,\n depth: levelDepth,\n })\n }\n\n let texture\n\n if (UNCOMPRESSED_FORMATS.has(FORMAT_MAP[vkFormat])) {\n texture =\n container.pixelDepth === 0\n ? new DataTexture(mipmaps[0].data, container.pixelWidth, container.pixelHeight)\n : new Data3DTexture(mipmaps[0].data, container.pixelWidth, container.pixelHeight, container.pixelDepth)\n } else {\n if (container.pixelDepth > 0) throw new Error('THREE.KTX2Loader: Unsupported pixelDepth.')\n\n texture = new CompressedTexture(mipmaps, container.pixelWidth, container.pixelHeight)\n }\n\n texture.mipmaps = mipmaps\n\n texture.type = TYPE_MAP[vkFormat]\n texture.format = FORMAT_MAP[vkFormat]\n texture.needsUpdate = true\n\n const colorSpace = parseColorSpace(container)\n if ('colorSpace' in texture) texture.colorSpace = colorSpace\n else texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding\n\n //\n\n return Promise.resolve(texture)\n}\n\nfunction parseColorSpace(container) {\n const dfd = container.dataFormatDescriptor[0]\n\n if (dfd.colorPrimaries === KHR_DF_PRIMARIES_BT709) {\n return dfd.transferFunction === KHR_DF_TRANSFER_SRGB ? SRGBColorSpace : LinearSRGBColorSpace\n } else if (dfd.colorPrimaries === KHR_DF_PRIMARIES_DISPLAYP3) {\n return dfd.transferFunction === KHR_DF_TRANSFER_SRGB ? DisplayP3ColorSpace : LinearDisplayP3ColorSpace\n } else if (dfd.colorPrimaries === KHR_DF_PRIMARIES_UNSPECIFIED) {\n return NoColorSpace\n } else {\n console.warn(`THREE.KTX2Loader: Unsupported color primaries, \"${dfd.colorPrimaries}\"`)\n return NoColorSpace\n }\n}\n\nexport { KTX2Loader }\n", "const lottie = (() => {\n if (typeof navigator === 'undefined' || typeof document === 'undefined') return {}\n\n const svgNS = 'http://www.w3.org/2000/svg'\n\n let locationHref = ''\n let _useWebWorker = false\n\n const initialDefaultFrame = -999999\n\n const setWebWorker = (flag) => {\n _useWebWorker = !!flag\n }\n const getWebWorker = () => _useWebWorker\n\n const setLocationHref = (value) => {\n locationHref = value\n }\n const getLocationHref = () => locationHref\n\n function createTag(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElement(type)\n }\n\n function extendPrototype(sources, destination) {\n var i\n var len = sources.length\n var sourcePrototype\n for (i = 0; i < len; i += 1) {\n sourcePrototype = sources[i].prototype\n for (var attr in sourcePrototype) {\n if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr))\n destination.prototype[attr] = sourcePrototype[attr]\n }\n }\n }\n\n function getDescriptor(object, prop) {\n return Object.getOwnPropertyDescriptor(object, prop)\n }\n\n function createProxyFunction(prototype) {\n function ProxyFunction() {}\n ProxyFunction.prototype = prototype\n return ProxyFunction\n }\n\n // import Howl from '../../3rd_party/howler';\n\n const audioControllerFactory = (function () {\n function AudioController(audioFactory) {\n this.audios = []\n this.audioFactory = audioFactory\n this._volume = 1\n this._isMuted = false\n }\n\n AudioController.prototype = {\n addAudio: function (audio) {\n this.audios.push(audio)\n },\n pause: function () {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].pause()\n }\n },\n resume: function () {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].resume()\n }\n },\n setRate: function (rateValue) {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].setRate(rateValue)\n }\n },\n createAudio: function (assetPath) {\n if (this.audioFactory) {\n return this.audioFactory(assetPath)\n }\n if (window.Howl) {\n return new window.Howl({\n src: [assetPath],\n })\n }\n return {\n isPlaying: false,\n play: function () {\n this.isPlaying = true\n },\n seek: function () {\n this.isPlaying = false\n },\n playing: function () {},\n rate: function () {},\n setVolume: function () {},\n }\n },\n setAudioFactory: function (audioFactory) {\n this.audioFactory = audioFactory\n },\n setVolume: function (value) {\n this._volume = value\n this._updateVolume()\n },\n mute: function () {\n this._isMuted = true\n this._updateVolume()\n },\n unmute: function () {\n this._isMuted = false\n this._updateVolume()\n },\n getVolume: function () {\n return this._volume\n },\n _updateVolume: function () {\n var i\n var len = this.audios.length\n for (i = 0; i < len; i += 1) {\n this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1))\n }\n },\n }\n\n return function () {\n return new AudioController()\n }\n })()\n\n const createTypedArray = (function () {\n function createRegularArray(type, len) {\n var i = 0\n var arr = []\n var value\n switch (type) {\n case 'int16':\n case 'uint8c':\n value = 1\n break\n default:\n value = 1.1\n break\n }\n for (i = 0; i < len; i += 1) {\n arr.push(value)\n }\n return arr\n }\n function createTypedArrayFactory(type, len) {\n if (type === 'float32') {\n return new Float32Array(len)\n }\n if (type === 'int16') {\n return new Int16Array(len)\n }\n if (type === 'uint8c') {\n return new Uint8ClampedArray(len)\n }\n return createRegularArray(type, len)\n }\n if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {\n return createTypedArrayFactory\n }\n return createRegularArray\n })()\n\n function createSizedArray(len) {\n return Array.apply(null, { length: len })\n }\n\n let subframeEnabled = true\n let expressionsPlugin = null\n let idPrefix$1 = ''\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)\n let _shouldRoundValues = false\n const bmPow = Math.pow\n const bmSqrt = Math.sqrt\n const bmFloor = Math.floor\n const bmMax = Math.max\n const bmMin = Math.min\n\n const BMMath = {}\n ;(function () {\n var propertyNames = [\n 'abs',\n 'acos',\n 'acosh',\n 'asin',\n 'asinh',\n 'atan',\n 'atanh',\n 'atan2',\n 'ceil',\n 'cbrt',\n 'expm1',\n 'clz32',\n 'cos',\n 'cosh',\n 'exp',\n 'floor',\n 'fround',\n 'hypot',\n 'imul',\n 'log',\n 'log1p',\n 'log2',\n 'log10',\n 'max',\n 'min',\n 'pow',\n 'random',\n 'round',\n 'sign',\n 'sin',\n 'sinh',\n 'sqrt',\n 'tan',\n 'tanh',\n 'trunc',\n 'E',\n 'LN10',\n 'LN2',\n 'LOG10E',\n 'LOG2E',\n 'PI',\n 'SQRT1_2',\n 'SQRT2',\n ]\n var i\n var len = propertyNames.length\n for (i = 0; i < len; i += 1) {\n BMMath[propertyNames[i]] = Math[propertyNames[i]]\n }\n })()\n\n function ProjectInterface$1() {\n return {}\n }\n BMMath.random = Math.random\n BMMath.abs = function (val) {\n var tOfVal = typeof val\n if (tOfVal === 'object' && val.length) {\n var absArr = createSizedArray(val.length)\n var i\n var len = val.length\n for (i = 0; i < len; i += 1) {\n absArr[i] = Math.abs(val[i])\n }\n return absArr\n }\n return Math.abs(val)\n }\n let defaultCurveSegments = 150\n const degToRads = Math.PI / 180\n const roundCorner = 0.5519\n\n function roundValues(flag) {\n _shouldRoundValues = !!flag\n }\n\n function bmRnd(value) {\n if (_shouldRoundValues) {\n return Math.round(value)\n }\n return value\n }\n\n function styleDiv(element) {\n element.style.position = 'absolute'\n element.style.top = 0\n element.style.left = 0\n element.style.display = 'block'\n element.style.transformOrigin = '0 0'\n element.style.webkitTransformOrigin = '0 0'\n element.style.backfaceVisibility = 'visible'\n element.style.webkitBackfaceVisibility = 'visible'\n element.style.transformStyle = 'preserve-3d'\n element.style.webkitTransformStyle = 'preserve-3d'\n element.style.mozTransformStyle = 'preserve-3d'\n }\n\n function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {\n this.type = type\n this.currentTime = currentTime\n this.totalTime = totalTime\n this.direction = frameMultiplier < 0 ? -1 : 1\n }\n\n function BMCompleteEvent(type, frameMultiplier) {\n this.type = type\n this.direction = frameMultiplier < 0 ? -1 : 1\n }\n\n function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {\n this.type = type\n this.currentLoop = currentLoop\n this.totalLoops = totalLoops\n this.direction = frameMultiplier < 0 ? -1 : 1\n }\n\n function BMSegmentStartEvent(type, firstFrame, totalFrames) {\n this.type = type\n this.firstFrame = firstFrame\n this.totalFrames = totalFrames\n }\n\n function BMDestroyEvent(type, target) {\n this.type = type\n this.target = target\n }\n\n function BMRenderFrameErrorEvent(nativeError, currentTime) {\n this.type = 'renderFrameError'\n this.nativeError = nativeError\n this.currentTime = currentTime\n }\n\n function BMConfigErrorEvent(nativeError) {\n this.type = 'configError'\n this.nativeError = nativeError\n }\n\n function BMAnimationConfigErrorEvent(type, nativeError) {\n this.type = type\n this.nativeError = nativeError\n }\n\n const createElementID = (function () {\n var _count = 0\n return function createID() {\n _count += 1\n return idPrefix$1 + '__lottie_element_' + _count\n }\n })()\n\n function HSVtoRGB(h, s, v) {\n var r\n var g\n var b\n var i\n var f\n var p\n var q\n var t\n i = Math.floor(h * 6)\n f = h * 6 - i\n p = v * (1 - s)\n q = v * (1 - f * s)\n t = v * (1 - (1 - f) * s)\n switch (i % 6) {\n case 0:\n r = v\n g = t\n b = p\n break\n case 1:\n r = q\n g = v\n b = p\n break\n case 2:\n r = p\n g = v\n b = t\n break\n case 3:\n r = p\n g = q\n b = v\n break\n case 4:\n r = t\n g = p\n b = v\n break\n case 5:\n r = v\n g = p\n b = q\n break\n default:\n break\n }\n return [r, g, b]\n }\n\n function RGBtoHSV(r, g, b) {\n var max = Math.max(r, g, b)\n var min = Math.min(r, g, b)\n var d = max - min\n var h\n var s = max === 0 ? 0 : d / max\n var v = max / 255\n\n switch (max) {\n case min:\n h = 0\n break\n case r:\n h = g - b + d * (g < b ? 6 : 0)\n h /= 6 * d\n break\n case g:\n h = b - r + d * 2\n h /= 6 * d\n break\n case b:\n h = r - g + d * 4\n h /= 6 * d\n break\n default:\n break\n }\n\n return [h, s, v]\n }\n\n function addSaturationToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255)\n hsv[1] += offset\n if (hsv[1] > 1) {\n hsv[1] = 1\n } else if (hsv[1] <= 0) {\n hsv[1] = 0\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2])\n }\n\n function addBrightnessToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255)\n hsv[2] += offset\n if (hsv[2] > 1) {\n hsv[2] = 1\n } else if (hsv[2] < 0) {\n hsv[2] = 0\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2])\n }\n\n function addHueToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255)\n hsv[0] += offset / 360\n if (hsv[0] > 1) {\n hsv[0] -= 1\n } else if (hsv[0] < 0) {\n hsv[0] += 1\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2])\n }\n\n const rgbToHex = (function () {\n var colorMap = []\n var i\n var hex\n for (i = 0; i < 256; i += 1) {\n hex = i.toString(16)\n colorMap[i] = hex.length === 1 ? '0' + hex : hex\n }\n\n return function (r, g, b) {\n if (r < 0) {\n r = 0\n }\n if (g < 0) {\n g = 0\n }\n if (b < 0) {\n b = 0\n }\n return '#' + colorMap[r] + colorMap[g] + colorMap[b]\n }\n })()\n\n const setSubframeEnabled = (flag) => {\n subframeEnabled = !!flag\n }\n const getSubframeEnabled = () => subframeEnabled\n const setExpressionsPlugin = (value) => {\n expressionsPlugin = value\n }\n const getExpressionsPlugin = () => expressionsPlugin\n const setDefaultCurveSegments = (value) => {\n defaultCurveSegments = value\n }\n const getDefaultCurveSegments = () => defaultCurveSegments\n const setIdPrefix = (value) => {\n idPrefix$1 = value\n }\n const getIdPrefix = () => idPrefix$1\n\n function createNS(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElementNS(svgNS, type)\n }\n\n const dataManager = (function () {\n var _counterId = 1\n var processes = []\n var workerFn\n var workerInstance\n var workerProxy = {\n onmessage: function () {},\n postMessage: function (path) {\n workerFn({\n data: path,\n })\n },\n }\n var _workerSelf = {\n postMessage: function (data) {\n workerProxy.onmessage({\n data: data,\n })\n },\n }\n function createWorker(fn) {\n if (window.Worker && window.Blob && getWebWorker()) {\n var blob = new Blob(['var _workerSelf = self; self.onmessage = ', fn.toString()], { type: 'text/javascript' })\n // var blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' });\n var url = URL.createObjectURL(blob)\n return new Worker(url)\n }\n workerFn = fn\n return workerProxy\n }\n\n function setupWorker() {\n if (!workerInstance) {\n workerInstance = createWorker(function workerStart(e) {\n function dataFunctionManager() {\n function completeLayers(layers, comps) {\n var layerData\n var i\n var len = layers.length\n var j\n var jLen\n var k\n var kLen\n for (i = 0; i < len; i += 1) {\n layerData = layers[i]\n if ('ks' in layerData && !layerData.completed) {\n layerData.completed = true\n if (layerData.tt) {\n layers[i - 1].td = layerData.tt\n }\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties\n jLen = maskProps.length\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k)\n } else {\n kLen = maskProps[j].pt.k.length\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0])\n }\n if (maskProps[j].pt.k[k].e) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0])\n }\n }\n }\n }\n }\n if (layerData.ty === 0) {\n layerData.layers = findCompLayers(layerData.refId, comps)\n completeLayers(layerData.layers, comps)\n } else if (layerData.ty === 4) {\n completeShapes(layerData.shapes)\n } else if (layerData.ty === 5) {\n completeText(layerData)\n }\n }\n }\n }\n\n function completeChars(chars, assets) {\n if (chars) {\n var i = 0\n var len = chars.length\n for (i = 0; i < len; i += 1) {\n if (chars[i].t === 1) {\n // var compData = findComp(chars[i].data.refId, assets);\n chars[i].data.layers = findCompLayers(chars[i].data.refId, assets)\n // chars[i].data.ip = 0;\n // chars[i].data.op = 99999;\n // chars[i].data.st = 0;\n // chars[i].data.sr = 1;\n // chars[i].w = compData.w;\n // chars[i].data.ks = {\n // a: { k: [0, 0, 0], a: 0 },\n // p: { k: [0, -compData.h, 0], a: 0 },\n // r: { k: 0, a: 0 },\n // s: { k: [100, 100], a: 0 },\n // o: { k: 100, a: 0 },\n // };\n completeLayers(chars[i].data.layers, assets)\n }\n }\n }\n }\n\n function findComp(id, comps) {\n var i = 0\n var len = comps.length\n while (i < len) {\n if (comps[i].id === id) {\n return comps[i]\n }\n i += 1\n }\n return null\n }\n\n function findCompLayers(id, comps) {\n var comp = findComp(id, comps)\n if (comp) {\n if (!comp.layers.__used) {\n comp.layers.__used = true\n return comp.layers\n }\n return JSON.parse(JSON.stringify(comp.layers))\n }\n return null\n }\n\n function completeShapes(arr) {\n var i\n var len = arr.length\n var j\n var jLen\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n convertPathsToAbsoluteValues(arr[i].ks.k)\n } else {\n jLen = arr[i].ks.k.length\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0])\n }\n if (arr[i].ks.k[j].e) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0])\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeShapes(arr[i].it)\n }\n }\n }\n\n function convertPathsToAbsoluteValues(path) {\n var i\n var len = path.i.length\n for (i = 0; i < len; i += 1) {\n path.i[i][0] += path.v[i][0]\n path.i[i][1] += path.v[i][1]\n path.o[i][0] += path.v[i][0]\n path.o[i][1] += path.v[i][1]\n }\n }\n\n function checkVersion(minimum, animVersionString) {\n var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100]\n if (minimum[0] > animVersion[0]) {\n return true\n }\n if (animVersion[0] > minimum[0]) {\n return false\n }\n if (minimum[1] > animVersion[1]) {\n return true\n }\n if (animVersion[1] > minimum[1]) {\n return false\n }\n if (minimum[2] > animVersion[2]) {\n return true\n }\n if (animVersion[2] > minimum[2]) {\n return false\n }\n return null\n }\n\n var checkText = (function () {\n var minimumVersion = [4, 4, 14]\n\n function updateTextLayer(textLayer) {\n var documentData = textLayer.t.d\n textLayer.t.d = {\n k: [\n {\n s: documentData,\n t: 0,\n },\n ],\n }\n }\n\n function iterateLayers(layers) {\n var i\n var len = layers.length\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i])\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n var checkChars = (function () {\n var minimumVersion = [4, 7, 99]\n return function (animationData) {\n if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {\n var i\n var len = animationData.chars.length\n for (i = 0; i < len; i += 1) {\n var charData = animationData.chars[i]\n if (charData.data && charData.data.shapes) {\n completeShapes(charData.data.shapes)\n charData.data.ip = 0\n charData.data.op = 99999\n charData.data.st = 0\n charData.data.sr = 1\n charData.data.ks = {\n p: { k: [0, 0], a: 0 },\n s: { k: [100, 100], a: 0 },\n a: { k: [0, 0], a: 0 },\n r: { k: 0, a: 0 },\n o: { k: 100, a: 0 },\n }\n if (!animationData.chars[i].t) {\n charData.data.shapes.push({\n ty: 'no',\n })\n charData.data.shapes[0].it.push({\n p: { k: [0, 0], a: 0 },\n s: { k: [100, 100], a: 0 },\n a: { k: [0, 0], a: 0 },\n r: { k: 0, a: 0 },\n o: { k: 100, a: 0 },\n sk: { k: 0, a: 0 },\n sa: { k: 0, a: 0 },\n ty: 'tr',\n })\n }\n }\n }\n }\n }\n })()\n\n var checkPathProperties = (function () {\n var minimumVersion = [5, 7, 15]\n\n function updateTextLayer(textLayer) {\n var pathData = textLayer.t.p\n if (typeof pathData.a === 'number') {\n pathData.a = {\n a: 0,\n k: pathData.a,\n }\n }\n if (typeof pathData.p === 'number') {\n pathData.p = {\n a: 0,\n k: pathData.p,\n }\n }\n if (typeof pathData.r === 'number') {\n pathData.r = {\n a: 0,\n k: pathData.r,\n }\n }\n }\n\n function iterateLayers(layers) {\n var i\n var len = layers.length\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i])\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n var checkColors = (function () {\n var minimumVersion = [4, 1, 9]\n\n function iterateShapes(shapes) {\n var i\n var len = shapes.length\n var j\n var jLen\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n iterateShapes(shapes[i].it)\n } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {\n if (shapes[i].c.k && shapes[i].c.k[0].i) {\n jLen = shapes[i].c.k.length\n for (j = 0; j < jLen; j += 1) {\n if (shapes[i].c.k[j].s) {\n shapes[i].c.k[j].s[0] /= 255\n shapes[i].c.k[j].s[1] /= 255\n shapes[i].c.k[j].s[2] /= 255\n shapes[i].c.k[j].s[3] /= 255\n }\n if (shapes[i].c.k[j].e) {\n shapes[i].c.k[j].e[0] /= 255\n shapes[i].c.k[j].e[1] /= 255\n shapes[i].c.k[j].e[2] /= 255\n shapes[i].c.k[j].e[3] /= 255\n }\n }\n } else {\n shapes[i].c.k[0] /= 255\n shapes[i].c.k[1] /= 255\n shapes[i].c.k[2] /= 255\n shapes[i].c.k[3] /= 255\n }\n }\n }\n }\n\n function iterateLayers(layers) {\n var i\n var len = layers.length\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 4) {\n iterateShapes(layers[i].shapes)\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n var checkShapes = (function () {\n var minimumVersion = [4, 4, 18]\n\n function completeClosingShapes(arr) {\n var i\n var len = arr.length\n var j\n var jLen\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n arr[i].ks.k.c = arr[i].closed\n } else {\n jLen = arr[i].ks.k.length\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n arr[i].ks.k[j].s[0].c = arr[i].closed\n }\n if (arr[i].ks.k[j].e) {\n arr[i].ks.k[j].e[0].c = arr[i].closed\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeClosingShapes(arr[i].it)\n }\n }\n }\n\n function iterateLayers(layers) {\n var layerData\n var i\n var len = layers.length\n var j\n var jLen\n var k\n var kLen\n for (i = 0; i < len; i += 1) {\n layerData = layers[i]\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties\n jLen = maskProps.length\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n maskProps[j].pt.k.c = maskProps[j].cl\n } else {\n kLen = maskProps[j].pt.k.length\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n maskProps[j].pt.k[k].s[0].c = maskProps[j].cl\n }\n if (maskProps[j].pt.k[k].e) {\n maskProps[j].pt.k[k].e[0].c = maskProps[j].cl\n }\n }\n }\n }\n }\n if (layerData.ty === 4) {\n completeClosingShapes(layerData.shapes)\n }\n }\n }\n\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers)\n if (animationData.assets) {\n var i\n var len = animationData.assets.length\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers)\n }\n }\n }\n }\n }\n })()\n\n function completeData(animationData) {\n if (animationData.__complete) {\n return\n }\n checkColors(animationData)\n checkText(animationData)\n checkChars(animationData)\n checkPathProperties(animationData)\n checkShapes(animationData)\n completeLayers(animationData.layers, animationData.assets)\n completeChars(animationData.chars, animationData.assets)\n animationData.__complete = true\n }\n\n function completeText(data) {\n if (data.t.a.length === 0 && !('m' in data.t.p)) {\n // data.singleShape = true;\n }\n }\n\n var moduleOb = {}\n moduleOb.completeData = completeData\n moduleOb.checkColors = checkColors\n moduleOb.checkChars = checkChars\n moduleOb.checkPathProperties = checkPathProperties\n moduleOb.checkShapes = checkShapes\n moduleOb.completeLayers = completeLayers\n\n return moduleOb\n }\n if (!_workerSelf.dataManager) {\n _workerSelf.dataManager = dataFunctionManager()\n }\n\n if (!_workerSelf.assetLoader) {\n _workerSelf.assetLoader = (function () {\n function formatResponse(xhr) {\n // using typeof doubles the time of execution of this method,\n // so if available, it's better to use the header to validate the type\n var contentTypeHeader = xhr.getResponseHeader('content-type')\n if (contentTypeHeader && xhr.responseType === 'json' && contentTypeHeader.indexOf('json') !== -1) {\n return xhr.response\n }\n if (xhr.response && typeof xhr.response === 'object') {\n return xhr.response\n }\n if (xhr.response && typeof xhr.response === 'string') {\n return JSON.parse(xhr.response)\n }\n if (xhr.responseText) {\n return JSON.parse(xhr.responseText)\n }\n return null\n }\n\n function loadAsset(path, fullPath, callback, errorCallback) {\n var response\n var xhr = new XMLHttpRequest()\n // set responseType after calling open or IE will break.\n try {\n // This crashes on Android WebView prior to KitKat\n xhr.responseType = 'json'\n } catch (err) {} // eslint-disable-line no-empty\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n response = formatResponse(xhr)\n callback(response)\n } else {\n try {\n response = formatResponse(xhr)\n callback(response)\n } catch (err) {\n if (errorCallback) {\n errorCallback(err)\n }\n }\n }\n }\n }\n try {\n xhr.open('GET', path, true)\n } catch (error) {\n xhr.open('GET', fullPath + '/' + path, true)\n }\n xhr.send()\n }\n return {\n load: loadAsset,\n }\n })()\n }\n\n if (e.data.type === 'loadAnimation') {\n _workerSelf.assetLoader.load(\n e.data.path,\n e.data.fullPath,\n function (data) {\n _workerSelf.dataManager.completeData(data)\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success',\n })\n },\n function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error',\n })\n },\n )\n } else if (e.data.type === 'complete') {\n var animation = e.data.animation\n _workerSelf.dataManager.completeData(animation)\n _workerSelf.postMessage({\n id: e.data.id,\n payload: animation,\n status: 'success',\n })\n } else if (e.data.type === 'loadData') {\n _workerSelf.assetLoader.load(\n e.data.path,\n e.data.fullPath,\n function (data) {\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success',\n })\n },\n function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error',\n })\n },\n )\n }\n })\n\n workerInstance.onmessage = function (event) {\n var data = event.data\n var id = data.id\n var process = processes[id]\n processes[id] = null\n if (data.status === 'success') {\n process.onComplete(data.payload)\n } else if (process.onError) {\n process.onError()\n }\n }\n }\n }\n\n function createProcess(onComplete, onError) {\n _counterId += 1\n var id = 'processId_' + _counterId\n processes[id] = {\n onComplete: onComplete,\n onError: onError,\n }\n return id\n }\n\n function loadAnimation(path, onComplete, onError) {\n setupWorker()\n var processId = createProcess(onComplete, onError)\n workerInstance.postMessage({\n type: 'loadAnimation',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId,\n })\n }\n\n function loadData(path, onComplete, onError) {\n setupWorker()\n var processId = createProcess(onComplete, onError)\n workerInstance.postMessage({\n type: 'loadData',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId,\n })\n }\n\n function completeAnimation(anim, onComplete, onError) {\n setupWorker()\n var processId = createProcess(onComplete, onError)\n workerInstance.postMessage({\n type: 'complete',\n animation: anim,\n id: processId,\n })\n }\n\n return {\n loadAnimation: loadAnimation,\n loadData: loadData,\n completeAnimation: completeAnimation,\n }\n })()\n\n const ImagePreloader = (function () {\n var proxyImage = (function () {\n var canvas = createTag('canvas')\n canvas.width = 1\n canvas.height = 1\n var ctx = canvas.getContext('2d')\n ctx.fillStyle = 'rgba(0,0,0,0)'\n ctx.fillRect(0, 0, 1, 1)\n return canvas\n })()\n\n function imageLoaded() {\n this.loadedAssets += 1\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null)\n }\n }\n }\n function footageLoaded() {\n this.loadedFootagesCount += 1\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null)\n }\n }\n }\n\n function getAssetsPath(assetData, assetsPath, originalPath) {\n var path = ''\n if (assetData.e) {\n path = assetData.p\n } else if (assetsPath) {\n var imagePath = assetData.p\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1]\n }\n path = assetsPath + imagePath\n } else {\n path = originalPath\n path += assetData.u ? assetData.u : ''\n path += assetData.p\n }\n return path\n }\n\n function testImageLoaded(img) {\n var _count = 0\n var intervalId = setInterval(\n function () {\n var box = img.getBBox()\n if (box.width || _count > 500) {\n this._imageLoaded()\n clearInterval(intervalId)\n }\n _count += 1\n }.bind(this),\n 50,\n )\n }\n\n function createImageData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path)\n var img = createNS('image')\n if (isSafari) {\n this.testImageLoaded(img)\n } else {\n img.addEventListener('load', this._imageLoaded, false)\n }\n img.addEventListener(\n 'error',\n function () {\n ob.img = proxyImage\n this._imageLoaded()\n }.bind(this),\n false,\n )\n img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path)\n if (this._elementHelper.append) {\n this._elementHelper.append(img)\n } else {\n this._elementHelper.appendChild(img)\n }\n var ob = {\n img: img,\n assetData: assetData,\n }\n return ob\n }\n\n function createImgData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path)\n var img = createTag('img')\n img.crossOrigin = 'anonymous'\n img.addEventListener('load', this._imageLoaded, false)\n img.addEventListener(\n 'error',\n function () {\n ob.img = proxyImage\n this._imageLoaded()\n }.bind(this),\n false,\n )\n img.src = path\n var ob = {\n img: img,\n assetData: assetData,\n }\n return ob\n }\n\n function createFootageData(data) {\n var ob = {\n assetData: data,\n }\n var path = getAssetsPath(data, this.assetsPath, this.path)\n dataManager.loadData(\n path,\n function (footageData) {\n ob.img = footageData\n this._footageLoaded()\n }.bind(this),\n function () {\n ob.img = {}\n this._footageLoaded()\n }.bind(this),\n )\n return ob\n }\n\n function loadAssets(assets, cb) {\n this.imagesLoadedCb = cb\n var i\n var len = assets.length\n for (i = 0; i < len; i += 1) {\n if (!assets[i].layers) {\n if (!assets[i].t || assets[i].t === 'seq') {\n this.totalImages += 1\n this.images.push(this._createImageData(assets[i]))\n } else if (assets[i].t === 3) {\n this.totalFootages += 1\n this.images.push(this.createFootageData(assets[i]))\n }\n }\n }\n }\n\n function setPath(path) {\n this.path = path || ''\n }\n\n function setAssetsPath(path) {\n this.assetsPath = path || ''\n }\n\n function getAsset(assetData) {\n var i = 0\n var len = this.images.length\n while (i < len) {\n if (this.images[i].assetData === assetData) {\n return this.images[i].img\n }\n i += 1\n }\n return null\n }\n\n function destroy() {\n this.imagesLoadedCb = null\n this.images.length = 0\n }\n\n function loadedImages() {\n return this.totalImages === this.loadedAssets\n }\n\n function loadedFootages() {\n return this.totalFootages === this.loadedFootagesCount\n }\n\n function setCacheType(type, elementHelper) {\n if (type === 'svg') {\n this._elementHelper = elementHelper\n this._createImageData = this.createImageData.bind(this)\n } else {\n this._createImageData = this.createImgData.bind(this)\n }\n }\n\n function ImagePreloaderFactory() {\n this._imageLoaded = imageLoaded.bind(this)\n this._footageLoaded = footageLoaded.bind(this)\n this.testImageLoaded = testImageLoaded.bind(this)\n this.createFootageData = createFootageData.bind(this)\n this.assetsPath = ''\n this.path = ''\n this.totalImages = 0\n this.totalFootages = 0\n this.loadedAssets = 0\n this.loadedFootagesCount = 0\n this.imagesLoadedCb = null\n this.images = []\n }\n\n ImagePreloaderFactory.prototype = {\n loadAssets: loadAssets,\n setAssetsPath: setAssetsPath,\n setPath: setPath,\n loadedImages: loadedImages,\n loadedFootages: loadedFootages,\n destroy: destroy,\n getAsset: getAsset,\n createImgData: createImgData,\n createImageData: createImageData,\n imageLoaded: imageLoaded,\n footageLoaded: footageLoaded,\n setCacheType: setCacheType,\n }\n\n return ImagePreloaderFactory\n })()\n\n function BaseEvent() {}\n BaseEvent.prototype = {\n triggerEvent: function (eventName, args) {\n if (this._cbs[eventName]) {\n var callbacks = this._cbs[eventName]\n for (var i = 0; i < callbacks.length; i += 1) {\n callbacks[i](args)\n }\n }\n },\n addEventListener: function (eventName, callback) {\n if (!this._cbs[eventName]) {\n this._cbs[eventName] = []\n }\n this._cbs[eventName].push(callback)\n\n return function () {\n this.removeEventListener(eventName, callback)\n }.bind(this)\n },\n removeEventListener: function (eventName, callback) {\n if (!callback) {\n this._cbs[eventName] = null\n } else if (this._cbs[eventName]) {\n var i = 0\n var len = this._cbs[eventName].length\n while (i < len) {\n if (this._cbs[eventName][i] === callback) {\n this._cbs[eventName].splice(i, 1)\n i -= 1\n len -= 1\n }\n i += 1\n }\n if (!this._cbs[eventName].length) {\n this._cbs[eventName] = null\n }\n }\n },\n }\n\n const markerParser = (function () {\n function parsePayloadLines(payload) {\n var lines = payload.split('\\r\\n')\n var keys = {}\n var line\n var keysCount = 0\n for (var i = 0; i < lines.length; i += 1) {\n line = lines[i].split(':')\n if (line.length === 2) {\n keys[line[0]] = line[1].trim()\n keysCount += 1\n }\n }\n if (keysCount === 0) {\n throw new Error()\n }\n return keys\n }\n\n return function (_markers) {\n var markers = []\n for (var i = 0; i < _markers.length; i += 1) {\n var _marker = _markers[i]\n var markerData = {\n time: _marker.tm,\n duration: _marker.dr,\n }\n try {\n markerData.payload = JSON.parse(_markers[i].cm)\n } catch (_) {\n try {\n markerData.payload = parsePayloadLines(_markers[i].cm)\n } catch (__) {\n markerData.payload = {\n name: _markers[i].cm,\n }\n }\n }\n markers.push(markerData)\n }\n return markers\n }\n })()\n\n const ProjectInterface = (function () {\n function registerComposition(comp) {\n this.compositions.push(comp)\n }\n\n return function () {\n function _thisProjectFunction(name) {\n var i = 0\n var len = this.compositions.length\n while (i < len) {\n if (this.compositions[i].data && this.compositions[i].data.nm === name) {\n if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {\n this.compositions[i].prepareFrame(this.currentFrame)\n }\n return this.compositions[i].compInterface\n }\n i += 1\n }\n return null\n }\n\n _thisProjectFunction.compositions = []\n _thisProjectFunction.currentFrame = 0\n\n _thisProjectFunction.registerComposition = registerComposition\n\n return _thisProjectFunction\n }\n })()\n\n const renderers = {}\n\n const registerRenderer = (key, value) => {\n renderers[key] = value\n }\n\n function getRenderer(key) {\n return renderers[key]\n }\n\n const AnimationItem = function () {\n this._cbs = []\n this.name = ''\n this.path = ''\n this.isLoaded = false\n this.currentFrame = 0\n this.currentRawFrame = 0\n this.firstFrame = 0\n this.totalFrames = 0\n this.frameRate = 0\n this.frameMult = 0\n this.playSpeed = 1\n this.playDirection = 1\n this.playCount = 0\n this.animationData = {}\n this.assets = []\n this.isPaused = true\n this.autoplay = false\n this.loop = true\n this.renderer = null\n this.animationID = createElementID()\n this.assetsPath = ''\n this.timeCompleted = 0\n this.segmentPos = 0\n this.isSubframeEnabled = getSubframeEnabled()\n this.segments = []\n this._idle = true\n this._completedLoop = false\n this.projectInterface = ProjectInterface()\n this.imagePreloader = new ImagePreloader()\n this.audioController = audioControllerFactory()\n this.markers = []\n this.configAnimation = this.configAnimation.bind(this)\n this.onSetupError = this.onSetupError.bind(this)\n this.onSegmentComplete = this.onSegmentComplete.bind(this)\n this.drawnFrameEvent = new BMEnterFrameEvent('drawnFrame', 0, 0, 0)\n }\n\n extendPrototype([BaseEvent], AnimationItem)\n\n AnimationItem.prototype.setParams = function (params) {\n if (params.wrapper || params.container) {\n this.wrapper = params.wrapper || params.container\n }\n var animType = 'svg'\n if (params.animType) {\n animType = params.animType\n } else if (params.renderer) {\n animType = params.renderer\n }\n const RendererClass = getRenderer(animType)\n this.renderer = new RendererClass(this, params.rendererSettings)\n this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs)\n this.renderer.setProjectInterface(this.projectInterface)\n this.animType = animType\n if (params.loop === '' || params.loop === null || params.loop === undefined || params.loop === true) {\n this.loop = true\n } else if (params.loop === false) {\n this.loop = false\n } else {\n this.loop = parseInt(params.loop, 10)\n }\n this.autoplay = 'autoplay' in params ? params.autoplay : true\n this.name = params.name ? params.name : ''\n this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments')\n ? params.autoloadSegments\n : true\n this.assetsPath = params.assetsPath\n this.initialSegment = params.initialSegment\n if (params.audioFactory) {\n this.audioController.setAudioFactory(params.audioFactory)\n }\n if (params.animationData) {\n this.setupAnimation(params.animationData)\n } else if (params.path) {\n if (params.path.lastIndexOf('\\\\') !== -1) {\n this.path = params.path.substr(0, params.path.lastIndexOf('\\\\') + 1)\n } else {\n this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1)\n }\n this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1)\n this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'))\n dataManager.loadAnimation(params.path, this.configAnimation, this.onSetupError)\n }\n }\n\n AnimationItem.prototype.onSetupError = function () {\n this.trigger('data_failed')\n }\n\n AnimationItem.prototype.setupAnimation = function (data) {\n dataManager.completeAnimation(data, this.configAnimation)\n }\n\n AnimationItem.prototype.setData = function (wrapper, animationData) {\n if (animationData) {\n if (typeof animationData !== 'object') {\n animationData = JSON.parse(animationData)\n }\n }\n var params = {\n wrapper: wrapper,\n animationData: animationData,\n }\n var wrapperAttributes = wrapper.attributes\n\n params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-animation-path').value\n : wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-path').value\n : wrapperAttributes.getNamedItem('bm-path')\n ? wrapperAttributes.getNamedItem('bm-path').value\n : ''\n params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-type').value\n : wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-type').value\n : wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('bm-type').value\n : wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-renderer').value\n : wrapperAttributes.getNamedItem('bm-renderer')\n ? wrapperAttributes.getNamedItem('bm-renderer').value\n : 'canvas'\n\n var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-loop').value\n : wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-loop').value\n : wrapperAttributes.getNamedItem('bm-loop')\n ? wrapperAttributes.getNamedItem('bm-loop').value\n : ''\n if (loop === 'false') {\n params.loop = false\n } else if (loop === 'true') {\n params.loop = true\n } else if (loop !== '') {\n params.loop = parseInt(loop, 10)\n }\n var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-autoplay').value\n : wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-autoplay').value\n : wrapperAttributes.getNamedItem('bm-autoplay')\n ? wrapperAttributes.getNamedItem('bm-autoplay').value\n : true\n params.autoplay = autoplay !== 'false'\n\n params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-name').value\n : wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-name').value\n : wrapperAttributes.getNamedItem('bm-name')\n ? wrapperAttributes.getNamedItem('bm-name').value\n : ''\n var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-prerender').value\n : wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-prerender').value\n : wrapperAttributes.getNamedItem('bm-prerender')\n ? wrapperAttributes.getNamedItem('bm-prerender').value\n : ''\n\n if (prerender === 'false') {\n params.prerender = false\n }\n this.setParams(params)\n }\n\n AnimationItem.prototype.includeLayers = function (data) {\n if (data.op > this.animationData.op) {\n this.animationData.op = data.op\n this.totalFrames = Math.floor(data.op - this.animationData.ip)\n }\n var layers = this.animationData.layers\n var i\n var len = layers.length\n var newLayers = data.layers\n var j\n var jLen = newLayers.length\n for (j = 0; j < jLen; j += 1) {\n i = 0\n while (i < len) {\n if (layers[i].id === newLayers[j].id) {\n layers[i] = newLayers[j]\n break\n }\n i += 1\n }\n }\n if (data.chars || data.fonts) {\n this.renderer.globalData.fontManager.addChars(data.chars)\n this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs)\n }\n if (data.assets) {\n len = data.assets.length\n for (i = 0; i < len; i += 1) {\n this.animationData.assets.push(data.assets[i])\n }\n }\n this.animationData.__complete = false\n dataManager.completeAnimation(this.animationData, this.onSegmentComplete)\n }\n\n AnimationItem.prototype.onSegmentComplete = function (data) {\n this.animationData = data\n var expressionsPlugin = getExpressionsPlugin()\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this)\n }\n this.loadNextSegment()\n }\n\n AnimationItem.prototype.loadNextSegment = function () {\n var segments = this.animationData.segments\n if (!segments || segments.length === 0 || !this.autoloadSegments) {\n this.trigger('data_ready')\n this.timeCompleted = this.totalFrames\n return\n }\n var segment = segments.shift()\n this.timeCompleted = segment.time * this.frameRate\n var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json'\n this.segmentPos += 1\n dataManager.loadData(\n segmentPath,\n this.includeLayers.bind(this),\n function () {\n this.trigger('data_failed')\n }.bind(this),\n )\n }\n\n AnimationItem.prototype.loadSegments = function () {\n var segments = this.animationData.segments\n if (!segments) {\n this.timeCompleted = this.totalFrames\n }\n this.loadNextSegment()\n }\n\n AnimationItem.prototype.imagesLoaded = function () {\n this.trigger('loaded_images')\n this.checkLoaded()\n }\n\n AnimationItem.prototype.preloadImages = function () {\n this.imagePreloader.setAssetsPath(this.assetsPath)\n this.imagePreloader.setPath(this.path)\n this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this))\n }\n\n AnimationItem.prototype.configAnimation = function (animData) {\n if (!this.renderer) {\n return\n }\n try {\n this.animationData = animData\n if (this.initialSegment) {\n this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0])\n this.firstFrame = Math.round(this.initialSegment[0])\n } else {\n this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip)\n this.firstFrame = Math.round(this.animationData.ip)\n }\n this.renderer.configAnimation(animData)\n if (!animData.assets) {\n animData.assets = []\n }\n\n this.assets = this.animationData.assets\n this.frameRate = this.animationData.fr\n this.frameMult = this.animationData.fr / 1000\n this.renderer.searchExtraCompositions(animData.assets)\n this.markers = markerParser(animData.markers || [])\n this.trigger('config_ready')\n this.preloadImages()\n this.loadSegments()\n this.updaFrameModifier()\n this.waitForFontsLoaded()\n if (this.isPaused) {\n this.audioController.pause()\n }\n } catch (error) {\n this.triggerConfigError(error)\n }\n }\n\n AnimationItem.prototype.waitForFontsLoaded = function () {\n if (!this.renderer) {\n return\n }\n if (this.renderer.globalData.fontManager.isLoaded) {\n this.checkLoaded()\n } else {\n setTimeout(this.waitForFontsLoaded.bind(this), 20)\n }\n }\n\n AnimationItem.prototype.checkLoaded = function () {\n if (\n !this.isLoaded &&\n this.renderer.globalData.fontManager.isLoaded &&\n (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas') &&\n this.imagePreloader.loadedFootages()\n ) {\n this.isLoaded = true\n var expressionsPlugin = getExpressionsPlugin()\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this)\n }\n this.renderer.initItems()\n setTimeout(\n function () {\n this.trigger('DOMLoaded')\n }.bind(this),\n 0,\n )\n this.gotoFrame()\n if (this.autoplay) {\n this.play()\n }\n }\n }\n\n AnimationItem.prototype.resize = function () {\n this.renderer.updateContainerSize()\n }\n\n AnimationItem.prototype.setSubframe = function (flag) {\n this.isSubframeEnabled = !!flag\n }\n\n AnimationItem.prototype.gotoFrame = function () {\n this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame // eslint-disable-line no-bitwise\n\n if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {\n this.currentFrame = this.timeCompleted\n }\n this.trigger('enterFrame')\n this.renderFrame()\n this.trigger('drawnFrame')\n }\n\n AnimationItem.prototype.renderFrame = function () {\n if (this.isLoaded === false || !this.renderer) {\n return\n }\n try {\n this.renderer.renderFrame(this.currentFrame + this.firstFrame)\n } catch (error) {\n this.triggerRenderFrameError(error)\n }\n }\n\n AnimationItem.prototype.play = function (name) {\n if (name && this.name !== name) {\n return\n }\n if (this.isPaused === true) {\n this.isPaused = false\n this.trigger('_pause')\n this.audioController.resume()\n if (this._idle) {\n this._idle = false\n this.trigger('_active')\n }\n }\n }\n\n AnimationItem.prototype.pause = function (name) {\n if (name && this.name !== name) {\n return\n }\n if (this.isPaused === false) {\n this.isPaused = true\n this.trigger('_play')\n this._idle = true\n this.trigger('_idle')\n this.audioController.pause()\n }\n }\n\n AnimationItem.prototype.togglePause = function (name) {\n if (name && this.name !== name) {\n return\n }\n if (this.isPaused === true) {\n this.play()\n } else {\n this.pause()\n }\n }\n\n AnimationItem.prototype.stop = function (name) {\n if (name && this.name !== name) {\n return\n }\n this.pause()\n this.playCount = 0\n this._completedLoop = false\n this.setCurrentRawFrameValue(0)\n }\n\n AnimationItem.prototype.getMarkerData = function (markerName) {\n var marker\n for (var i = 0; i < this.markers.length; i += 1) {\n marker = this.markers[i]\n if (marker.payload && marker.payload.name === markerName) {\n return marker\n }\n }\n return null\n }\n\n AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return\n }\n var numValue = Number(value)\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value)\n if (marker) {\n this.goToAndStop(marker.time, true)\n }\n } else if (isFrame) {\n this.setCurrentRawFrameValue(value)\n } else {\n this.setCurrentRawFrameValue(value * this.frameModifier)\n }\n this.pause()\n }\n\n AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return\n }\n var numValue = Number(value)\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value)\n if (marker) {\n if (!marker.duration) {\n this.goToAndStop(marker.time, true)\n } else {\n this.playSegments([marker.time, marker.time + marker.duration], true)\n }\n }\n } else {\n this.goToAndStop(numValue, isFrame, name)\n }\n this.play()\n }\n\n AnimationItem.prototype.advanceTime = function (value) {\n if (this.isPaused === true || this.isLoaded === false) {\n return\n }\n var nextValue = this.currentRawFrame + value * this.frameModifier\n var _isComplete = false\n // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.\n // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.\n if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {\n if (!this.loop || this.playCount === this.loop) {\n if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {\n _isComplete = true\n nextValue = this.totalFrames - 1\n }\n } else if (nextValue >= this.totalFrames) {\n this.playCount += 1\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n this.setCurrentRawFrameValue(nextValue % this.totalFrames)\n this._completedLoop = true\n this.trigger('loopComplete')\n }\n } else {\n this.setCurrentRawFrameValue(nextValue)\n }\n } else if (nextValue < 0) {\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {\n // eslint-disable-line no-plusplus\n this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames))\n if (!this._completedLoop) {\n this._completedLoop = true\n } else {\n this.trigger('loopComplete')\n }\n } else {\n _isComplete = true\n nextValue = 0\n }\n }\n } else {\n this.setCurrentRawFrameValue(nextValue)\n }\n if (_isComplete) {\n this.setCurrentRawFrameValue(nextValue)\n this.pause()\n this.trigger('complete')\n }\n }\n\n AnimationItem.prototype.adjustSegment = function (arr, offset) {\n this.playCount = 0\n if (arr[1] < arr[0]) {\n if (this.frameModifier > 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed)\n } else {\n this.setDirection(-1)\n }\n }\n this.totalFrames = arr[0] - arr[1]\n this.timeCompleted = this.totalFrames\n this.firstFrame = arr[1]\n this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset)\n } else if (arr[1] > arr[0]) {\n if (this.frameModifier < 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed)\n } else {\n this.setDirection(1)\n }\n }\n this.totalFrames = arr[1] - arr[0]\n this.timeCompleted = this.totalFrames\n this.firstFrame = arr[0]\n this.setCurrentRawFrameValue(0.001 + offset)\n }\n this.trigger('segmentStart')\n }\n AnimationItem.prototype.setSegment = function (init, end) {\n var pendingFrame = -1\n if (this.isPaused) {\n if (this.currentRawFrame + this.firstFrame < init) {\n pendingFrame = init\n } else if (this.currentRawFrame + this.firstFrame > end) {\n pendingFrame = end - init\n }\n }\n\n this.firstFrame = init\n this.totalFrames = end - init\n this.timeCompleted = this.totalFrames\n if (pendingFrame !== -1) {\n this.goToAndStop(pendingFrame, true)\n }\n }\n\n AnimationItem.prototype.playSegments = function (arr, forceFlag) {\n if (forceFlag) {\n this.segments.length = 0\n }\n if (typeof arr[0] === 'object') {\n var i\n var len = arr.length\n for (i = 0; i < len; i += 1) {\n this.segments.push(arr[i])\n }\n } else {\n this.segments.push(arr)\n }\n if (this.segments.length && forceFlag) {\n this.adjustSegment(this.segments.shift(), 0)\n }\n if (this.isPaused) {\n this.play()\n }\n }\n\n AnimationItem.prototype.resetSegments = function (forceFlag) {\n this.segments.length = 0\n this.segments.push([this.animationData.ip, this.animationData.op])\n if (forceFlag) {\n this.checkSegments(0)\n }\n }\n AnimationItem.prototype.checkSegments = function (offset) {\n if (this.segments.length) {\n this.adjustSegment(this.segments.shift(), offset)\n return true\n }\n return false\n }\n\n AnimationItem.prototype.destroy = function (name) {\n if ((name && this.name !== name) || !this.renderer) {\n return\n }\n this.renderer.destroy()\n this.imagePreloader.destroy()\n this.trigger('destroy')\n this._cbs = null\n this.onEnterFrame = null\n this.onLoopComplete = null\n this.onComplete = null\n this.onSegmentStart = null\n this.onDestroy = null\n this.renderer = null\n this.renderer = null\n this.imagePreloader = null\n this.projectInterface = null\n }\n\n AnimationItem.prototype.setCurrentRawFrameValue = function (value) {\n this.currentRawFrame = value\n this.gotoFrame()\n }\n\n AnimationItem.prototype.setSpeed = function (val) {\n this.playSpeed = val\n this.updaFrameModifier()\n }\n\n AnimationItem.prototype.setDirection = function (val) {\n this.playDirection = val < 0 ? -1 : 1\n this.updaFrameModifier()\n }\n\n AnimationItem.prototype.setVolume = function (val, name) {\n if (name && this.name !== name) {\n return\n }\n this.audioController.setVolume(val)\n }\n\n AnimationItem.prototype.getVolume = function () {\n return this.audioController.getVolume()\n }\n\n AnimationItem.prototype.mute = function (name) {\n if (name && this.name !== name) {\n return\n }\n this.audioController.mute()\n }\n\n AnimationItem.prototype.unmute = function (name) {\n if (name && this.name !== name) {\n return\n }\n this.audioController.unmute()\n }\n\n AnimationItem.prototype.updaFrameModifier = function () {\n this.frameModifier = this.frameMult * this.playSpeed * this.playDirection\n this.audioController.setRate(this.playSpeed * this.playDirection)\n }\n\n AnimationItem.prototype.getPath = function () {\n return this.path\n }\n\n AnimationItem.prototype.getAssetsPath = function (assetData) {\n var path = ''\n if (assetData.e) {\n path = assetData.p\n } else if (this.assetsPath) {\n var imagePath = assetData.p\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1]\n }\n path = this.assetsPath + imagePath\n } else {\n path = this.path\n path += assetData.u ? assetData.u : ''\n path += assetData.p\n }\n return path\n }\n\n AnimationItem.prototype.getAssetData = function (id) {\n var i = 0\n var len = this.assets.length\n while (i < len) {\n if (id === this.assets[i].id) {\n return this.assets[i]\n }\n i += 1\n }\n return null\n }\n\n AnimationItem.prototype.hide = function () {\n this.renderer.hide()\n }\n\n AnimationItem.prototype.show = function () {\n this.renderer.show()\n }\n\n AnimationItem.prototype.getDuration = function (isFrame) {\n return isFrame ? this.totalFrames : this.totalFrames / this.frameRate\n }\n\n AnimationItem.prototype.updateDocumentData = function (path, documentData, index) {\n try {\n var element = this.renderer.getElementByPath(path)\n element.updateDocumentData(documentData, index)\n } catch (error) {\n // TODO: decide how to handle catch case\n }\n }\n\n AnimationItem.prototype.trigger = function (name) {\n if (this._cbs && this._cbs[name]) {\n switch (name) {\n case 'enterFrame':\n this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier))\n break\n case 'drawnFrame':\n this.drawnFrameEvent.currentTime = this.currentFrame\n this.drawnFrameEvent.totalTime = this.totalFrames\n this.drawnFrameEvent.direction = this.frameModifier\n this.triggerEvent(name, this.drawnFrameEvent)\n break\n case 'loopComplete':\n this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult))\n break\n case 'complete':\n this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult))\n break\n case 'segmentStart':\n this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames))\n break\n case 'destroy':\n this.triggerEvent(name, new BMDestroyEvent(name, this))\n break\n default:\n this.triggerEvent(name)\n }\n }\n if (name === 'enterFrame' && this.onEnterFrame) {\n this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult))\n }\n if (name === 'loopComplete' && this.onLoopComplete) {\n this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult))\n }\n if (name === 'complete' && this.onComplete) {\n this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult))\n }\n if (name === 'segmentStart' && this.onSegmentStart) {\n this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames))\n }\n if (name === 'destroy' && this.onDestroy) {\n this.onDestroy.call(this, new BMDestroyEvent(name, this))\n }\n }\n\n AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {\n var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame)\n this.triggerEvent('error', error)\n\n if (this.onError) {\n this.onError.call(this, error)\n }\n }\n\n AnimationItem.prototype.triggerConfigError = function (nativeError) {\n var error = new BMConfigErrorEvent(nativeError, this.currentFrame)\n this.triggerEvent('error', error)\n\n if (this.onError) {\n this.onError.call(this, error)\n }\n }\n\n const animationManager = (function () {\n var moduleOb = {}\n var registeredAnimations = []\n var initTime = 0\n var len = 0\n var playingAnimationsNum = 0\n var _stopped = true\n var _isFrozen = false\n\n function removeElement(ev) {\n var i = 0\n var animItem = ev.target\n while (i < len) {\n if (registeredAnimations[i].animation === animItem) {\n registeredAnimations.splice(i, 1)\n i -= 1\n len -= 1\n if (!animItem.isPaused) {\n subtractPlayingCount()\n }\n }\n i += 1\n }\n }\n\n function registerAnimation(element, animationData) {\n if (!element) {\n return null\n }\n var i = 0\n while (i < len) {\n if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) {\n return registeredAnimations[i].animation\n }\n i += 1\n }\n var animItem = new AnimationItem()\n setupAnimation(animItem, element)\n animItem.setData(element, animationData)\n return animItem\n }\n\n function getRegisteredAnimations() {\n var i\n var lenAnims = registeredAnimations.length\n var animations = []\n for (i = 0; i < lenAnims; i += 1) {\n animations.push(registeredAnimations[i].animation)\n }\n return animations\n }\n\n function addPlayingCount() {\n playingAnimationsNum += 1\n activate()\n }\n\n function subtractPlayingCount() {\n playingAnimationsNum -= 1\n }\n\n function setupAnimation(animItem, element) {\n animItem.addEventListener('destroy', removeElement)\n animItem.addEventListener('_active', addPlayingCount)\n animItem.addEventListener('_idle', subtractPlayingCount)\n registeredAnimations.push({ elem: element, animation: animItem })\n len += 1\n }\n\n function loadAnimation(params) {\n var animItem = new AnimationItem()\n setupAnimation(animItem, null)\n animItem.setParams(params)\n return animItem\n }\n\n function setSpeed(val, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setSpeed(val, animation)\n }\n }\n\n function setDirection(val, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setDirection(val, animation)\n }\n }\n\n function play(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.play(animation)\n }\n }\n function resume(nowTime) {\n var elapsedTime = nowTime - initTime\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.advanceTime(elapsedTime)\n }\n initTime = nowTime\n if (playingAnimationsNum && !_isFrozen) {\n window.requestAnimationFrame(resume)\n } else {\n _stopped = true\n }\n }\n\n function first(nowTime) {\n initTime = nowTime\n window.requestAnimationFrame(resume)\n }\n\n function pause(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.pause(animation)\n }\n }\n\n function goToAndStop(value, isFrame, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.goToAndStop(value, isFrame, animation)\n }\n }\n\n function stop(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.stop(animation)\n }\n }\n\n function togglePause(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.togglePause(animation)\n }\n }\n\n function destroy(animation) {\n var i\n for (i = len - 1; i >= 0; i -= 1) {\n registeredAnimations[i].animation.destroy(animation)\n }\n }\n\n function searchAnimations(animationData, standalone, renderer) {\n var animElements = [].concat(\n [].slice.call(document.getElementsByClassName('lottie')),\n [].slice.call(document.getElementsByClassName('bodymovin')),\n )\n var i\n var lenAnims = animElements.length\n for (i = 0; i < lenAnims; i += 1) {\n if (renderer) {\n animElements[i].setAttribute('data-bm-type', renderer)\n }\n registerAnimation(animElements[i], animationData)\n }\n if (standalone && lenAnims === 0) {\n if (!renderer) {\n renderer = 'svg'\n }\n var body = document.getElementsByTagName('body')[0]\n body.innerText = ''\n var div = createTag('div')\n div.style.width = '100%'\n div.style.height = '100%'\n div.setAttribute('data-bm-type', renderer)\n body.appendChild(div)\n registerAnimation(div, animationData)\n }\n }\n\n function resize() {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.resize()\n }\n }\n\n function activate() {\n if (!_isFrozen && playingAnimationsNum) {\n if (_stopped) {\n window.requestAnimationFrame(first)\n _stopped = false\n }\n }\n }\n\n function freeze() {\n _isFrozen = true\n }\n\n function unfreeze() {\n _isFrozen = false\n activate()\n }\n\n function setVolume(val, animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setVolume(val, animation)\n }\n }\n\n function mute(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.mute(animation)\n }\n }\n\n function unmute(animation) {\n var i\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.unmute(animation)\n }\n }\n\n moduleOb.registerAnimation = registerAnimation\n moduleOb.loadAnimation = loadAnimation\n moduleOb.setSpeed = setSpeed\n moduleOb.setDirection = setDirection\n moduleOb.play = play\n moduleOb.pause = pause\n moduleOb.stop = stop\n moduleOb.togglePause = togglePause\n moduleOb.searchAnimations = searchAnimations\n moduleOb.resize = resize\n // moduleOb.start = start;\n moduleOb.goToAndStop = goToAndStop\n moduleOb.destroy = destroy\n moduleOb.freeze = freeze\n moduleOb.unfreeze = unfreeze\n moduleOb.setVolume = setVolume\n moduleOb.mute = mute\n moduleOb.unmute = unmute\n moduleOb.getRegisteredAnimations = getRegisteredAnimations\n return moduleOb\n })()\n\n /* eslint-disable */\n const BezierFactory = (function () {\n /**\n * BezierEasing - use bezier curve for transition easing function\n * by Gaëtan Renaudeau 2014 - 2015 – MIT License\n *\n * Credits: is based on Firefox's nsSMILKeySpline.cpp\n * Usage:\n * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])\n * spline.get(x) => returns the easing value | x must be in [0, 1] range\n *\n */\n\n var ob = {}\n ob.getBezierEasing = getBezierEasing\n var beziers = {}\n\n function getBezierEasing(a, b, c, d, nm) {\n var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\\./g, 'p')\n if (beziers[str]) {\n return beziers[str]\n }\n var bezEasing = new BezierEasing([a, b, c, d])\n beziers[str] = bezEasing\n return bezEasing\n }\n\n // These values are established by empiricism with tests (tradeoff: performance VS precision)\n var NEWTON_ITERATIONS = 4\n var NEWTON_MIN_SLOPE = 0.001\n var SUBDIVISION_PRECISION = 0.0000001\n var SUBDIVISION_MAX_ITERATIONS = 10\n\n var kSplineTableSize = 11\n var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0)\n\n var float32ArraySupported = typeof Float32Array === 'function'\n\n function A(aA1, aA2) {\n return 1.0 - 3.0 * aA2 + 3.0 * aA1\n }\n function B(aA1, aA2) {\n return 3.0 * aA2 - 6.0 * aA1\n }\n function C(aA1) {\n return 3.0 * aA1\n }\n\n // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\n function calcBezier(aT, aA1, aA2) {\n return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT\n }\n\n // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\n function getSlope(aT, aA1, aA2) {\n return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1)\n }\n\n function binarySubdivide(aX, aA, aB, mX1, mX2) {\n var currentX,\n currentT,\n i = 0\n do {\n currentT = aA + (aB - aA) / 2.0\n currentX = calcBezier(currentT, mX1, mX2) - aX\n if (currentX > 0.0) {\n aB = currentT\n } else {\n aA = currentT\n }\n } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS)\n return currentT\n }\n\n function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\n for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\n var currentSlope = getSlope(aGuessT, mX1, mX2)\n if (currentSlope === 0.0) return aGuessT\n var currentX = calcBezier(aGuessT, mX1, mX2) - aX\n aGuessT -= currentX / currentSlope\n }\n return aGuessT\n }\n\n /**\n * points is an array of [ mX1, mY1, mX2, mY2 ]\n */\n function BezierEasing(points) {\n this._p = points\n this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize)\n this._precomputed = false\n\n this.get = this.get.bind(this)\n }\n\n BezierEasing.prototype = {\n get: function (x) {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3]\n if (!this._precomputed) this._precompute()\n if (mX1 === mY1 && mX2 === mY2) return x // linear\n // Because JavaScript number are imprecise, we should guarantee the extremes are right.\n if (x === 0) return 0\n if (x === 1) return 1\n return calcBezier(this._getTForX(x), mY1, mY2)\n },\n\n // Private part\n\n _precompute: function () {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3]\n this._precomputed = true\n if (mX1 !== mY1 || mX2 !== mY2) {\n this._calcSampleValues()\n }\n },\n\n _calcSampleValues: function () {\n var mX1 = this._p[0],\n mX2 = this._p[2]\n for (var i = 0; i < kSplineTableSize; ++i) {\n this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2)\n }\n },\n\n /**\n * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.\n */\n _getTForX: function (aX) {\n var mX1 = this._p[0],\n mX2 = this._p[2],\n mSampleValues = this._mSampleValues\n\n var intervalStart = 0.0\n var currentSample = 1\n var lastSample = kSplineTableSize - 1\n\n for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {\n intervalStart += kSampleStepSize\n }\n --currentSample\n\n // Interpolate to provide an initial guess for t\n var dist =\n (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample])\n var guessForT = intervalStart + dist * kSampleStepSize\n\n var initialSlope = getSlope(guessForT, mX1, mX2)\n if (initialSlope >= NEWTON_MIN_SLOPE) {\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2)\n }\n if (initialSlope === 0.0) {\n return guessForT\n }\n return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2)\n },\n }\n\n return ob\n })()\n\n const pooling = (function () {\n function double(arr) {\n return arr.concat(createSizedArray(arr.length))\n }\n\n return {\n double: double,\n }\n })()\n\n const poolFactory = (function () {\n return function (initialLength, _create, _release) {\n var _length = 0\n var _maxLength = initialLength\n var pool = createSizedArray(_maxLength)\n\n var ob = {\n newElement: newElement,\n release: release,\n }\n\n function newElement() {\n var element\n if (_length) {\n _length -= 1\n element = pool[_length]\n } else {\n element = _create()\n }\n return element\n }\n\n function release(element) {\n if (_length === _maxLength) {\n pool = pooling.double(pool)\n _maxLength *= 2\n }\n if (_release) {\n _release(element)\n }\n pool[_length] = element\n _length += 1\n }\n\n return ob\n }\n })()\n\n const bezierLengthPool = (function () {\n function create() {\n return {\n addedLength: 0,\n percents: createTypedArray('float32', getDefaultCurveSegments()),\n lengths: createTypedArray('float32', getDefaultCurveSegments()),\n }\n }\n return poolFactory(8, create)\n })()\n\n const segmentsLengthPool = (function () {\n function create() {\n return {\n lengths: [],\n totalLength: 0,\n }\n }\n\n function release(element) {\n var i\n var len = element.lengths.length\n for (i = 0; i < len; i += 1) {\n bezierLengthPool.release(element.lengths[i])\n }\n element.lengths.length = 0\n }\n\n return poolFactory(8, create, release)\n })()\n\n function bezFunction() {\n var math = Math\n\n function pointOnLine2D(x1, y1, x2, y2, x3, y3) {\n var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1\n return det1 > -0.001 && det1 < 0.001\n }\n\n function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {\n if (z1 === 0 && z2 === 0 && z3 === 0) {\n return pointOnLine2D(x1, y1, x2, y2, x3, y3)\n }\n var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2))\n var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2))\n var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2))\n var diffDist\n if (dist1 > dist2) {\n if (dist1 > dist3) {\n diffDist = dist1 - dist2 - dist3\n } else {\n diffDist = dist3 - dist2 - dist1\n }\n } else if (dist3 > dist2) {\n diffDist = dist3 - dist2 - dist1\n } else {\n diffDist = dist2 - dist1 - dist3\n }\n return diffDist > -0.0001 && diffDist < 0.0001\n }\n\n var getBezierLength = (function () {\n return function (pt1, pt2, pt3, pt4) {\n var curveSegments = getDefaultCurveSegments()\n var k\n var i\n var len\n var ptCoord\n var perc\n var addedLength = 0\n var ptDistance\n var point = []\n var lastPoint = []\n var lengthData = bezierLengthPool.newElement()\n len = pt3.length\n for (k = 0; k < curveSegments; k += 1) {\n perc = k / (curveSegments - 1)\n ptDistance = 0\n for (i = 0; i < len; i += 1) {\n ptCoord =\n bmPow(1 - perc, 3) * pt1[i] +\n 3 * bmPow(1 - perc, 2) * perc * pt3[i] +\n 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] +\n bmPow(perc, 3) * pt2[i]\n point[i] = ptCoord\n if (lastPoint[i] !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2)\n }\n lastPoint[i] = point[i]\n }\n if (ptDistance) {\n ptDistance = bmSqrt(ptDistance)\n addedLength += ptDistance\n }\n lengthData.percents[k] = perc\n lengthData.lengths[k] = addedLength\n }\n lengthData.addedLength = addedLength\n return lengthData\n }\n })()\n\n function getSegmentsLength(shapeData) {\n var segmentsLength = segmentsLengthPool.newElement()\n var closed = shapeData.c\n var pathV = shapeData.v\n var pathO = shapeData.o\n var pathI = shapeData.i\n var i\n var len = shapeData._length\n var lengths = segmentsLength.lengths\n var totalLength = 0\n for (i = 0; i < len - 1; i += 1) {\n lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1])\n totalLength += lengths[i].addedLength\n }\n if (closed && len) {\n lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0])\n totalLength += lengths[i].addedLength\n }\n segmentsLength.totalLength = totalLength\n return segmentsLength\n }\n\n function BezierData(length) {\n this.segmentLength = 0\n this.points = new Array(length)\n }\n\n function PointData(partial, point) {\n this.partialLength = partial\n this.point = point\n }\n\n var buildBezierData = (function () {\n var storedData = {}\n\n return function (pt1, pt2, pt3, pt4) {\n var bezierName = (\n pt1[0] +\n '_' +\n pt1[1] +\n '_' +\n pt2[0] +\n '_' +\n pt2[1] +\n '_' +\n pt3[0] +\n '_' +\n pt3[1] +\n '_' +\n pt4[0] +\n '_' +\n pt4[1]\n ).replace(/\\./g, 'p')\n if (!storedData[bezierName]) {\n var curveSegments = getDefaultCurveSegments()\n var k\n var i\n var len\n var ptCoord\n var perc\n var addedLength = 0\n var ptDistance\n var point\n var lastPoint = null\n if (\n pt1.length === 2 &&\n (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) &&\n pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) &&\n pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])\n ) {\n curveSegments = 2\n }\n var bezierData = new BezierData(curveSegments)\n len = pt3.length\n for (k = 0; k < curveSegments; k += 1) {\n point = createSizedArray(len)\n perc = k / (curveSegments - 1)\n ptDistance = 0\n for (i = 0; i < len; i += 1) {\n ptCoord =\n bmPow(1 - perc, 3) * pt1[i] +\n 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) +\n 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) +\n bmPow(perc, 3) * pt2[i]\n point[i] = ptCoord\n if (lastPoint !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2)\n }\n }\n ptDistance = bmSqrt(ptDistance)\n addedLength += ptDistance\n bezierData.points[k] = new PointData(ptDistance, point)\n lastPoint = point\n }\n bezierData.segmentLength = addedLength\n storedData[bezierName] = bezierData\n }\n return storedData[bezierName]\n }\n })()\n\n function getDistancePerc(perc, bezierData) {\n var percents = bezierData.percents\n var lengths = bezierData.lengths\n var len = percents.length\n var initPos = bmFloor((len - 1) * perc)\n var lengthPos = perc * bezierData.addedLength\n var lPerc = 0\n if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {\n return percents[initPos]\n }\n var dir = lengths[initPos] > lengthPos ? -1 : 1\n var flag = true\n while (flag) {\n if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {\n lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos])\n flag = false\n } else {\n initPos += dir\n }\n if (initPos < 0 || initPos >= len - 1) {\n // FIX for TypedArrays that don't store floating point values with enough accuracy\n if (initPos === len - 1) {\n return percents[initPos]\n }\n flag = false\n }\n }\n return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc\n }\n\n function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {\n var t1 = getDistancePerc(percent, bezierData)\n var u1 = 1 - t1\n var ptX =\n math.round(\n (u1 * u1 * u1 * pt1[0] +\n (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] +\n (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] +\n t1 * t1 * t1 * pt2[0]) *\n 1000,\n ) / 1000\n var ptY =\n math.round(\n (u1 * u1 * u1 * pt1[1] +\n (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] +\n (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] +\n t1 * t1 * t1 * pt2[1]) *\n 1000,\n ) / 1000\n return [ptX, ptY]\n }\n\n var bezierSegmentPoints = createTypedArray('float32', 8)\n\n function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {\n if (startPerc < 0) {\n startPerc = 0\n } else if (startPerc > 1) {\n startPerc = 1\n }\n var t0 = getDistancePerc(startPerc, bezierData)\n endPerc = endPerc > 1 ? 1 : endPerc\n var t1 = getDistancePerc(endPerc, bezierData)\n var i\n var len = pt1.length\n var u0 = 1 - t0\n var u1 = 1 - t1\n var u0u0u0 = u0 * u0 * u0\n var t0u0u0_3 = t0 * u0 * u0 * 3 // eslint-disable-line camelcase\n var t0t0u0_3 = t0 * t0 * u0 * 3 // eslint-disable-line camelcase\n var t0t0t0 = t0 * t0 * t0\n //\n var u0u0u1 = u0 * u0 * u1\n var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1 // eslint-disable-line camelcase\n var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1 // eslint-disable-line camelcase\n var t0t0t1 = t0 * t0 * t1\n //\n var u0u1u1 = u0 * u1 * u1\n var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1 // eslint-disable-line camelcase\n var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1 // eslint-disable-line camelcase\n var t0t1t1 = t0 * t1 * t1\n //\n var u1u1u1 = u1 * u1 * u1\n var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1 // eslint-disable-line camelcase\n var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1 // eslint-disable-line camelcase\n var t1t1t1 = t1 * t1 * t1\n for (i = 0; i < len; i += 1) {\n bezierSegmentPoints[i * 4] =\n math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 1] =\n math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 2] =\n math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n bezierSegmentPoints[i * 4 + 3] =\n math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000 // eslint-disable-line camelcase\n }\n\n return bezierSegmentPoints\n }\n\n return {\n getSegmentsLength: getSegmentsLength,\n getNewSegment: getNewSegment,\n getPointInSegment: getPointInSegment,\n buildBezierData: buildBezierData,\n pointOnLine2D: pointOnLine2D,\n pointOnLine3D: pointOnLine3D,\n }\n }\n\n const bez = bezFunction()\n\n const PropertyFactory = (function () {\n var initFrame = initialDefaultFrame\n var mathAbs = Math.abs\n\n function interpolateValue(frameNum, caching) {\n var offsetTime = this.offsetTime\n var newValue\n if (this.propType === 'multidimensional') {\n newValue = createTypedArray('float32', this.pv.length)\n }\n var iterationIndex = caching.lastIndex\n var i = iterationIndex\n var len = this.keyframes.length - 1\n var flag = true\n var keyData\n var nextKeyData\n var keyframeMetadata\n\n while (flag) {\n keyData = this.keyframes[i]\n nextKeyData = this.keyframes[i + 1]\n if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {\n if (keyData.h) {\n keyData = nextKeyData\n }\n iterationIndex = 0\n break\n }\n if (nextKeyData.t - offsetTime > frameNum) {\n iterationIndex = i\n break\n }\n if (i < len - 1) {\n i += 1\n } else {\n iterationIndex = 0\n flag = false\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {}\n\n var k\n var kLen\n var perc\n var jLen\n var j\n var fnc\n var nextKeyTime = nextKeyData.t - offsetTime\n var keyTime = keyData.t - offsetTime\n var endValue\n if (keyData.to) {\n if (!keyframeMetadata.bezierData) {\n keyframeMetadata.bezierData = bez.buildBezierData(\n keyData.s,\n nextKeyData.s || keyData.e,\n keyData.to,\n keyData.ti,\n )\n }\n var bezierData = keyframeMetadata.bezierData\n if (frameNum >= nextKeyTime || frameNum < keyTime) {\n var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0\n kLen = bezierData.points[ind].point.length\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[ind].point[k]\n }\n // caching._lastKeyframeIndex = -1;\n } else {\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get\n keyframeMetadata.__fnct = fnc\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime))\n var distanceInLine = bezierData.segmentLength * perc\n\n var segmentPerc\n var addedLength =\n caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastAddedLength : 0\n j = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastPoint : 0\n flag = true\n jLen = bezierData.points.length\n while (flag) {\n addedLength += bezierData.points[j].partialLength\n if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {\n kLen = bezierData.points[j].point.length\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[j].point[k]\n }\n break\n } else if (\n distanceInLine >= addedLength &&\n distanceInLine < addedLength + bezierData.points[j + 1].partialLength\n ) {\n segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength\n kLen = bezierData.points[j].point.length\n for (k = 0; k < kLen; k += 1) {\n newValue[k] =\n bezierData.points[j].point[k] +\n (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc\n }\n break\n }\n if (j < jLen - 1) {\n j += 1\n } else {\n flag = false\n }\n }\n caching._lastPoint = j\n caching._lastAddedLength = addedLength - bezierData.points[j].partialLength\n caching._lastKeyframeIndex = i\n }\n } else {\n var outX\n var outY\n var inX\n var inY\n var keyValue\n len = keyData.s.length\n endValue = nextKeyData.s || keyData.e\n if (this.sh && keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n newValue[0] = endValue[0]\n newValue[1] = endValue[1]\n newValue[2] = endValue[2]\n } else if (frameNum <= keyTime) {\n newValue[0] = keyData.s[0]\n newValue[1] = keyData.s[1]\n newValue[2] = keyData.s[2]\n } else {\n var quatStart = createQuaternion(keyData.s)\n var quatEnd = createQuaternion(endValue)\n var time = (frameNum - keyTime) / (nextKeyTime - keyTime)\n quaternionToEuler(newValue, slerp(quatStart, quatEnd, time))\n }\n } else {\n for (i = 0; i < len; i += 1) {\n if (keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n perc = 1\n } else if (frameNum < keyTime) {\n perc = 0\n } else {\n if (keyData.o.x.constructor === Array) {\n if (!keyframeMetadata.__fnct) {\n keyframeMetadata.__fnct = []\n }\n if (!keyframeMetadata.__fnct[i]) {\n outX = keyData.o.x[i] === undefined ? keyData.o.x[0] : keyData.o.x[i]\n outY = keyData.o.y[i] === undefined ? keyData.o.y[0] : keyData.o.y[i]\n inX = keyData.i.x[i] === undefined ? keyData.i.x[0] : keyData.i.x[i]\n inY = keyData.i.y[i] === undefined ? keyData.i.y[0] : keyData.i.y[i]\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get\n keyframeMetadata.__fnct[i] = fnc\n } else {\n fnc = keyframeMetadata.__fnct[i]\n }\n } else if (!keyframeMetadata.__fnct) {\n outX = keyData.o.x\n outY = keyData.o.y\n inX = keyData.i.x\n inY = keyData.i.y\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get\n keyData.keyframeMetadata = fnc\n } else {\n fnc = keyframeMetadata.__fnct\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime))\n }\n }\n\n endValue = nextKeyData.s || keyData.e\n keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc\n\n if (this.propType === 'multidimensional') {\n newValue[i] = keyValue\n } else {\n newValue = keyValue\n }\n }\n }\n }\n caching.lastIndex = iterationIndex\n return newValue\n }\n\n // based on @Toji's https://github.com/toji/gl-matrix/\n function slerp(a, b, t) {\n var out = []\n var ax = a[0]\n var ay = a[1]\n var az = a[2]\n var aw = a[3]\n var bx = b[0]\n var by = b[1]\n var bz = b[2]\n var bw = b[3]\n\n var omega\n var cosom\n var sinom\n var scale0\n var scale1\n\n cosom = ax * bx + ay * by + az * bz + aw * bw\n if (cosom < 0.0) {\n cosom = -cosom\n bx = -bx\n by = -by\n bz = -bz\n bw = -bw\n }\n if (1.0 - cosom > 0.000001) {\n omega = Math.acos(cosom)\n sinom = Math.sin(omega)\n scale0 = Math.sin((1.0 - t) * omega) / sinom\n scale1 = Math.sin(t * omega) / sinom\n } else {\n scale0 = 1.0 - t\n scale1 = t\n }\n out[0] = scale0 * ax + scale1 * bx\n out[1] = scale0 * ay + scale1 * by\n out[2] = scale0 * az + scale1 * bz\n out[3] = scale0 * aw + scale1 * bw\n\n return out\n }\n\n function quaternionToEuler(out, quat) {\n var qx = quat[0]\n var qy = quat[1]\n var qz = quat[2]\n var qw = quat[3]\n var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz)\n var attitude = Math.asin(2 * qx * qy + 2 * qz * qw)\n var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz)\n out[0] = heading / degToRads\n out[1] = attitude / degToRads\n out[2] = bank / degToRads\n }\n\n function createQuaternion(values) {\n var heading = values[0] * degToRads\n var attitude = values[1] * degToRads\n var bank = values[2] * degToRads\n var c1 = Math.cos(heading / 2)\n var c2 = Math.cos(attitude / 2)\n var c3 = Math.cos(bank / 2)\n var s1 = Math.sin(heading / 2)\n var s2 = Math.sin(attitude / 2)\n var s3 = Math.sin(bank / 2)\n var w = c1 * c2 * c3 - s1 * s2 * s3\n var x = s1 * s2 * c3 + c1 * c2 * s3\n var y = s1 * c2 * c3 + c1 * s2 * s3\n var z = c1 * s2 * c3 - s1 * c2 * s3\n\n return [x, y, z, w]\n }\n\n function getValueAtCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime\n var initTime = this.keyframes[0].t - this.offsetTime\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime\n if (\n !(\n frameNum === this._caching.lastFrame ||\n (this._caching.lastFrame !== initFrame &&\n ((this._caching.lastFrame >= endTime && frameNum >= endTime) ||\n (this._caching.lastFrame < initTime && frameNum < initTime)))\n )\n ) {\n if (this._caching.lastFrame >= frameNum) {\n this._caching._lastKeyframeIndex = -1\n this._caching.lastIndex = 0\n }\n\n var renderResult = this.interpolateValue(frameNum, this._caching)\n this.pv = renderResult\n }\n this._caching.lastFrame = frameNum\n return this.pv\n }\n\n function setVValue(val) {\n var multipliedValue\n if (this.propType === 'unidimensional') {\n multipliedValue = val * this.mult\n if (mathAbs(this.v - multipliedValue) > 0.00001) {\n this.v = multipliedValue\n this._mdf = true\n }\n } else {\n var i = 0\n var len = this.v.length\n while (i < len) {\n multipliedValue = val[i] * this.mult\n if (mathAbs(this.v[i] - multipliedValue) > 0.00001) {\n this.v[i] = multipliedValue\n this._mdf = true\n }\n i += 1\n }\n }\n }\n\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {\n return\n }\n if (this.lock) {\n this.setVValue(this.pv)\n return\n }\n this.lock = true\n this._mdf = this._isFirstFrame\n var i\n var len = this.effectsSequence.length\n var finalValue = this.kf ? this.pv : this.data.k\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue)\n }\n this.setVValue(finalValue)\n this._isFirstFrame = false\n this.lock = false\n this.frameId = this.elem.globalData.frameId\n }\n\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction)\n this.container.addDynamicProperty(this)\n }\n\n function ValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional'\n this.mult = mult || 1\n this.data = data\n this.v = mult ? data.k * mult : data.k\n this.pv = data.k\n this._mdf = false\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.k = false\n this.kf = false\n this.vel = 0\n this.effectsSequence = []\n this._isFirstFrame = true\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.addEffect = addEffect\n }\n\n function MultiDimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional'\n this.mult = mult || 1\n this.data = data\n this._mdf = false\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.k = false\n this.kf = false\n this.frameId = -1\n var i\n var len = data.k.length\n this.v = createTypedArray('float32', len)\n this.pv = createTypedArray('float32', len)\n this.vel = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n this.v[i] = data.k[i] * this.mult\n this.pv[i] = data.k[i]\n }\n this._isFirstFrame = true\n this.effectsSequence = []\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.addEffect = addEffect\n }\n\n function KeyframedValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional'\n this.keyframes = data.k\n this.keyframesMetadata = []\n this.offsetTime = elem.data.st\n this.frameId = -1\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0,\n value: 0,\n _lastKeyframeIndex: -1,\n }\n this.k = true\n this.kf = true\n this.data = data\n this.mult = mult || 1\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.v = initFrame\n this.pv = initFrame\n this._isFirstFrame = true\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.interpolateValue = interpolateValue\n this.effectsSequence = [getValueAtCurrentTime.bind(this)]\n this.addEffect = addEffect\n }\n\n function KeyframedMultidimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional'\n var i\n var len = data.k.length\n var s\n var e\n var to\n var ti\n for (i = 0; i < len - 1; i += 1) {\n if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {\n s = data.k[i].s\n e = data.k[i + 1].s\n to = data.k[i].to\n ti = data.k[i].ti\n if (\n (s.length === 2 &&\n !(s[0] === e[0] && s[1] === e[1]) &&\n bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) &&\n bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1])) ||\n (s.length === 3 &&\n !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) &&\n bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) &&\n bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2]))\n ) {\n data.k[i].to = null\n data.k[i].ti = null\n }\n if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {\n if (s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {\n data.k[i].to = null\n data.k[i].ti = null\n }\n }\n }\n }\n this.effectsSequence = [getValueAtCurrentTime.bind(this)]\n this.data = data\n this.keyframes = data.k\n this.keyframesMetadata = []\n this.offsetTime = elem.data.st\n this.k = true\n this.kf = true\n this._isFirstFrame = true\n this.mult = mult || 1\n this.elem = elem\n this.container = container\n this.comp = elem.comp\n this.getValue = processEffectsSequence\n this.setVValue = setVValue\n this.interpolateValue = interpolateValue\n this.frameId = -1\n var arrLen = data.k[0].s.length\n this.v = createTypedArray('float32', arrLen)\n this.pv = createTypedArray('float32', arrLen)\n for (i = 0; i < arrLen; i += 1) {\n this.v[i] = initFrame\n this.pv[i] = initFrame\n }\n this._caching = { lastFrame: initFrame, lastIndex: 0, value: createTypedArray('float32', arrLen) }\n this.addEffect = addEffect\n }\n\n function getProp(elem, data, type, mult, container) {\n var p\n if (!data.k.length) {\n p = new ValueProperty(elem, data, mult, container)\n } else if (typeof data.k[0] === 'number') {\n p = new MultiDimensionalProperty(elem, data, mult, container)\n } else {\n switch (type) {\n case 0:\n p = new KeyframedValueProperty(elem, data, mult, container)\n break\n case 1:\n p = new KeyframedMultidimensionalProperty(elem, data, mult, container)\n break\n default:\n break\n }\n }\n if (p.effectsSequence.length) {\n container.addDynamicProperty(p)\n }\n return p\n }\n\n var ob = {\n getProp: getProp,\n }\n return ob\n })()\n\n function DynamicPropertyContainer() {}\n DynamicPropertyContainer.prototype = {\n addDynamicProperty: function (prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop)\n this.container.addDynamicProperty(this)\n this._isAnimated = true\n }\n },\n iterateDynamicProperties: function () {\n this._mdf = false\n var i\n var len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue()\n if (this.dynamicProperties[i]._mdf) {\n this._mdf = true\n }\n }\n },\n initDynamicPropertyContainer: function (container) {\n this.container = container\n this.dynamicProperties = []\n this._mdf = false\n this._isAnimated = false\n },\n }\n\n const pointPool = (function () {\n function create() {\n return createTypedArray('float32', 2)\n }\n return poolFactory(8, create)\n })()\n\n function ShapePath() {\n this.c = false\n this._length = 0\n this._maxLength = 8\n this.v = createSizedArray(this._maxLength)\n this.o = createSizedArray(this._maxLength)\n this.i = createSizedArray(this._maxLength)\n }\n\n ShapePath.prototype.setPathData = function (closed, len) {\n this.c = closed\n this.setLength(len)\n var i = 0\n while (i < len) {\n this.v[i] = pointPool.newElement()\n this.o[i] = pointPool.newElement()\n this.i[i] = pointPool.newElement()\n i += 1\n }\n }\n\n ShapePath.prototype.setLength = function (len) {\n while (this._maxLength < len) {\n this.doubleArrayLength()\n }\n this._length = len\n }\n\n ShapePath.prototype.doubleArrayLength = function () {\n this.v = this.v.concat(createSizedArray(this._maxLength))\n this.i = this.i.concat(createSizedArray(this._maxLength))\n this.o = this.o.concat(createSizedArray(this._maxLength))\n this._maxLength *= 2\n }\n\n ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {\n var arr\n this._length = Math.max(this._length, pos + 1)\n if (this._length >= this._maxLength) {\n this.doubleArrayLength()\n }\n switch (type) {\n case 'v':\n arr = this.v\n break\n case 'i':\n arr = this.i\n break\n case 'o':\n arr = this.o\n break\n default:\n arr = []\n break\n }\n if (!arr[pos] || (arr[pos] && !replace)) {\n arr[pos] = pointPool.newElement()\n }\n arr[pos][0] = x\n arr[pos][1] = y\n }\n\n ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {\n this.setXYAt(vX, vY, 'v', pos, replace)\n this.setXYAt(oX, oY, 'o', pos, replace)\n this.setXYAt(iX, iY, 'i', pos, replace)\n }\n\n ShapePath.prototype.reverse = function () {\n var newPath = new ShapePath()\n newPath.setPathData(this.c, this._length)\n var vertices = this.v\n var outPoints = this.o\n var inPoints = this.i\n var init = 0\n if (this.c) {\n newPath.setTripleAt(\n vertices[0][0],\n vertices[0][1],\n inPoints[0][0],\n inPoints[0][1],\n outPoints[0][0],\n outPoints[0][1],\n 0,\n false,\n )\n init = 1\n }\n var cnt = this._length - 1\n var len = this._length\n\n var i\n for (i = init; i < len; i += 1) {\n newPath.setTripleAt(\n vertices[cnt][0],\n vertices[cnt][1],\n inPoints[cnt][0],\n inPoints[cnt][1],\n outPoints[cnt][0],\n outPoints[cnt][1],\n i,\n false,\n )\n cnt -= 1\n }\n return newPath\n }\n\n const shapePool = (function () {\n function create() {\n return new ShapePath()\n }\n\n function release(shapePath) {\n var len = shapePath._length\n var i\n for (i = 0; i < len; i += 1) {\n pointPool.release(shapePath.v[i])\n pointPool.release(shapePath.i[i])\n pointPool.release(shapePath.o[i])\n shapePath.v[i] = null\n shapePath.i[i] = null\n shapePath.o[i] = null\n }\n shapePath._length = 0\n shapePath.c = false\n }\n\n function clone(shape) {\n var cloned = factory.newElement()\n var i\n var len = shape._length === undefined ? shape.v.length : shape._length\n cloned.setLength(len)\n cloned.c = shape.c\n\n for (i = 0; i < len; i += 1) {\n cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i)\n }\n return cloned\n }\n\n var factory = poolFactory(4, create, release)\n factory.clone = clone\n\n return factory\n })()\n\n function ShapeCollection() {\n this._length = 0\n this._maxLength = 4\n this.shapes = createSizedArray(this._maxLength)\n }\n\n ShapeCollection.prototype.addShape = function (shapeData) {\n if (this._length === this._maxLength) {\n this.shapes = this.shapes.concat(createSizedArray(this._maxLength))\n this._maxLength *= 2\n }\n this.shapes[this._length] = shapeData\n this._length += 1\n }\n\n ShapeCollection.prototype.releaseShapes = function () {\n var i\n for (i = 0; i < this._length; i += 1) {\n shapePool.release(this.shapes[i])\n }\n this._length = 0\n }\n\n const shapeCollectionPool = (function () {\n var ob = {\n newShapeCollection: newShapeCollection,\n release: release,\n }\n\n var _length = 0\n var _maxLength = 4\n var pool = createSizedArray(_maxLength)\n\n function newShapeCollection() {\n var shapeCollection\n if (_length) {\n _length -= 1\n shapeCollection = pool[_length]\n } else {\n shapeCollection = new ShapeCollection()\n }\n return shapeCollection\n }\n\n function release(shapeCollection) {\n var i\n var len = shapeCollection._length\n for (i = 0; i < len; i += 1) {\n shapePool.release(shapeCollection.shapes[i])\n }\n shapeCollection._length = 0\n\n if (_length === _maxLength) {\n pool = pooling.double(pool)\n _maxLength *= 2\n }\n pool[_length] = shapeCollection\n _length += 1\n }\n\n return ob\n })()\n\n const ShapePropertyFactory = (function () {\n var initFrame = -999999\n\n function interpolateShape(frameNum, previousValue, caching) {\n var iterationIndex = caching.lastIndex\n var keyPropS\n var keyPropE\n var isHold\n var j\n var k\n var jLen\n var kLen\n var perc\n var vertexValue\n var kf = this.keyframes\n if (frameNum < kf[0].t - this.offsetTime) {\n keyPropS = kf[0].s[0]\n isHold = true\n iterationIndex = 0\n } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {\n keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0]\n /* if(kf[kf.length - 1].s){\n keyPropS = kf[kf.length - 1].s[0];\n }else{\n keyPropS = kf[kf.length - 2].e[0];\n } */\n isHold = true\n } else {\n var i = iterationIndex\n var len = kf.length - 1\n var flag = true\n var keyData\n var nextKeyData\n var keyframeMetadata\n while (flag) {\n keyData = kf[i]\n nextKeyData = kf[i + 1]\n if (nextKeyData.t - this.offsetTime > frameNum) {\n break\n }\n if (i < len - 1) {\n i += 1\n } else {\n flag = false\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {}\n isHold = keyData.h === 1\n iterationIndex = i\n if (!isHold) {\n if (frameNum >= nextKeyData.t - this.offsetTime) {\n perc = 1\n } else if (frameNum < keyData.t - this.offsetTime) {\n perc = 0\n } else {\n var fnc\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get\n keyframeMetadata.__fnct = fnc\n }\n perc = fnc(\n (frameNum - (keyData.t - this.offsetTime)) /\n (nextKeyData.t - this.offsetTime - (keyData.t - this.offsetTime)),\n )\n }\n keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0]\n }\n keyPropS = keyData.s[0]\n }\n jLen = previousValue._length\n kLen = keyPropS.i[0].length\n caching.lastIndex = iterationIndex\n\n for (j = 0; j < jLen; j += 1) {\n for (k = 0; k < kLen; k += 1) {\n vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc\n previousValue.i[j][k] = vertexValue\n vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc\n previousValue.o[j][k] = vertexValue\n vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc\n previousValue.v[j][k] = vertexValue\n }\n }\n }\n\n function interpolateShapeCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime\n var initTime = this.keyframes[0].t - this.offsetTime\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime\n var lastFrame = this._caching.lastFrame\n if (\n !(\n lastFrame !== initFrame &&\n ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime))\n )\n ) {\n /// /\n this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0\n this.interpolateShape(frameNum, this.pv, this._caching)\n /// /\n }\n this._caching.lastFrame = frameNum\n return this.pv\n }\n\n function resetShape() {\n this.paths = this.localShapeCollection\n }\n\n function shapesEqual(shape1, shape2) {\n if (shape1._length !== shape2._length || shape1.c !== shape2.c) {\n return false\n }\n var i\n var len = shape1._length\n for (i = 0; i < len; i += 1) {\n if (\n shape1.v[i][0] !== shape2.v[i][0] ||\n shape1.v[i][1] !== shape2.v[i][1] ||\n shape1.o[i][0] !== shape2.o[i][0] ||\n shape1.o[i][1] !== shape2.o[i][1] ||\n shape1.i[i][0] !== shape2.i[i][0] ||\n shape1.i[i][1] !== shape2.i[i][1]\n ) {\n return false\n }\n }\n return true\n }\n\n function setVValue(newPath) {\n if (!shapesEqual(this.v, newPath)) {\n this.v = shapePool.clone(newPath)\n this.localShapeCollection.releaseShapes()\n this.localShapeCollection.addShape(this.v)\n this._mdf = true\n this.paths = this.localShapeCollection\n }\n }\n\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n if (!this.effectsSequence.length) {\n this._mdf = false\n return\n }\n if (this.lock) {\n this.setVValue(this.pv)\n return\n }\n this.lock = true\n this._mdf = false\n var finalValue\n if (this.kf) {\n finalValue = this.pv\n } else if (this.data.ks) {\n finalValue = this.data.ks.k\n } else {\n finalValue = this.data.pt.k\n }\n var i\n var len = this.effectsSequence.length\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue)\n }\n this.setVValue(finalValue)\n this.lock = false\n this.frameId = this.elem.globalData.frameId\n }\n\n function ShapeProperty(elem, data, type) {\n this.propType = 'shape'\n this.comp = elem.comp\n this.container = elem\n this.elem = elem\n this.data = data\n this.k = false\n this.kf = false\n this._mdf = false\n var pathData = type === 3 ? data.pt.k : data.ks.k\n this.v = shapePool.clone(pathData)\n this.pv = shapePool.clone(this.v)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.paths = this.localShapeCollection\n this.paths.addShape(this.v)\n this.reset = resetShape\n this.effectsSequence = []\n }\n\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction)\n this.container.addDynamicProperty(this)\n }\n\n ShapeProperty.prototype.interpolateShape = interpolateShape\n ShapeProperty.prototype.getValue = processEffectsSequence\n ShapeProperty.prototype.setVValue = setVValue\n ShapeProperty.prototype.addEffect = addEffect\n\n function KeyframedShapeProperty(elem, data, type) {\n this.propType = 'shape'\n this.comp = elem.comp\n this.elem = elem\n this.container = elem\n this.offsetTime = elem.data.st\n this.keyframes = type === 3 ? data.pt.k : data.ks.k\n this.keyframesMetadata = []\n this.k = true\n this.kf = true\n var len = this.keyframes[0].s[0].i.length\n this.v = shapePool.newElement()\n this.v.setPathData(this.keyframes[0].s[0].c, len)\n this.pv = shapePool.clone(this.v)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.paths = this.localShapeCollection\n this.paths.addShape(this.v)\n this.lastFrame = initFrame\n this.reset = resetShape\n this._caching = { lastFrame: initFrame, lastIndex: 0 }\n this.effectsSequence = [interpolateShapeCurrentTime.bind(this)]\n }\n KeyframedShapeProperty.prototype.getValue = processEffectsSequence\n KeyframedShapeProperty.prototype.interpolateShape = interpolateShape\n KeyframedShapeProperty.prototype.setVValue = setVValue\n KeyframedShapeProperty.prototype.addEffect = addEffect\n\n var EllShapeProperty = (function () {\n var cPoint = roundCorner\n\n function EllShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement()\n this.v.setPathData(true, 4)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.paths = this.localShapeCollection\n this.localShapeCollection.addShape(this.v)\n this.d = data.d\n this.elem = elem\n this.comp = elem.comp\n this.frameId = -1\n this.initDynamicPropertyContainer(elem)\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this)\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this)\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.k = false\n this.convertEllToPath()\n }\n }\n\n EllShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n\n if (this._mdf) {\n this.convertEllToPath()\n }\n },\n convertEllToPath: function () {\n var p0 = this.p.v[0]\n var p1 = this.p.v[1]\n var s0 = this.s.v[0] / 2\n var s1 = this.s.v[1] / 2\n var _cw = this.d !== 3\n var _v = this.v\n _v.v[0][0] = p0\n _v.v[0][1] = p1 - s1\n _v.v[1][0] = _cw ? p0 + s0 : p0 - s0\n _v.v[1][1] = p1\n _v.v[2][0] = p0\n _v.v[2][1] = p1 + s1\n _v.v[3][0] = _cw ? p0 - s0 : p0 + s0\n _v.v[3][1] = p1\n _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint\n _v.i[0][1] = p1 - s1\n _v.i[1][0] = _cw ? p0 + s0 : p0 - s0\n _v.i[1][1] = p1 - s1 * cPoint\n _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint\n _v.i[2][1] = p1 + s1\n _v.i[3][0] = _cw ? p0 - s0 : p0 + s0\n _v.i[3][1] = p1 + s1 * cPoint\n _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint\n _v.o[0][1] = p1 - s1\n _v.o[1][0] = _cw ? p0 + s0 : p0 - s0\n _v.o[1][1] = p1 + s1 * cPoint\n _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint\n _v.o[2][1] = p1 + s1\n _v.o[3][0] = _cw ? p0 - s0 : p0 + s0\n _v.o[3][1] = p1 - s1 * cPoint\n },\n }\n\n extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory)\n\n return EllShapePropertyFactory\n })()\n\n var StarShapeProperty = (function () {\n function StarShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement()\n this.v.setPathData(true, 0)\n this.elem = elem\n this.comp = elem.comp\n this.data = data\n this.frameId = -1\n this.d = data.d\n this.initDynamicPropertyContainer(elem)\n if (data.sy === 1) {\n this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this)\n this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this)\n this.convertToPath = this.convertStarToPath\n } else {\n this.convertToPath = this.convertPolygonToPath\n }\n this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this)\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this)\n this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this)\n this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this)\n this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this)\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.localShapeCollection.addShape(this.v)\n this.paths = this.localShapeCollection\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.k = false\n this.convertToPath()\n }\n }\n\n StarShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n if (this._mdf) {\n this.convertToPath()\n }\n },\n convertStarToPath: function () {\n var numPts = Math.floor(this.pt.v) * 2\n var angle = (Math.PI * 2) / numPts\n /* this.v.v.length = numPts;\n this.v.i.length = numPts;\n this.v.o.length = numPts; */\n var longFlag = true\n var longRad = this.or.v\n var shortRad = this.ir.v\n var longRound = this.os.v\n var shortRound = this.is.v\n var longPerimSegment = (2 * Math.PI * longRad) / (numPts * 2)\n var shortPerimSegment = (2 * Math.PI * shortRad) / (numPts * 2)\n var i\n var rad\n var roundness\n var perimSegment\n var currentAng = -Math.PI / 2\n currentAng += this.r.v\n var dir = this.data.d === 3 ? -1 : 1\n this.v._length = 0\n for (i = 0; i < numPts; i += 1) {\n rad = longFlag ? longRad : shortRad\n roundness = longFlag ? longRound : shortRound\n perimSegment = longFlag ? longPerimSegment : shortPerimSegment\n var x = rad * Math.cos(currentAng)\n var y = rad * Math.sin(currentAng)\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y)\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y)\n x += +this.p.v[0]\n y += +this.p.v[1]\n this.v.setTripleAt(\n x,\n y,\n x - ox * perimSegment * roundness * dir,\n y - oy * perimSegment * roundness * dir,\n x + ox * perimSegment * roundness * dir,\n y + oy * perimSegment * roundness * dir,\n i,\n true,\n )\n\n /* this.v.v[i] = [x,y];\n this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];\n this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];\n this.v._length = numPts; */\n longFlag = !longFlag\n currentAng += angle * dir\n }\n },\n convertPolygonToPath: function () {\n var numPts = Math.floor(this.pt.v)\n var angle = (Math.PI * 2) / numPts\n var rad = this.or.v\n var roundness = this.os.v\n var perimSegment = (2 * Math.PI * rad) / (numPts * 4)\n var i\n var currentAng = -Math.PI * 0.5\n var dir = this.data.d === 3 ? -1 : 1\n currentAng += this.r.v\n this.v._length = 0\n for (i = 0; i < numPts; i += 1) {\n var x = rad * Math.cos(currentAng)\n var y = rad * Math.sin(currentAng)\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y)\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y)\n x += +this.p.v[0]\n y += +this.p.v[1]\n this.v.setTripleAt(\n x,\n y,\n x - ox * perimSegment * roundness * dir,\n y - oy * perimSegment * roundness * dir,\n x + ox * perimSegment * roundness * dir,\n y + oy * perimSegment * roundness * dir,\n i,\n true,\n )\n currentAng += angle * dir\n }\n this.paths.length = 0\n this.paths[0] = this.v\n },\n }\n extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory)\n\n return StarShapePropertyFactory\n })()\n\n var RectShapeProperty = (function () {\n function RectShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement()\n this.v.c = true\n this.localShapeCollection = shapeCollectionPool.newShapeCollection()\n this.localShapeCollection.addShape(this.v)\n this.paths = this.localShapeCollection\n this.elem = elem\n this.comp = elem.comp\n this.frameId = -1\n this.d = data.d\n this.initDynamicPropertyContainer(elem)\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this)\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this)\n this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this)\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.k = false\n this.convertRectToPath()\n }\n }\n\n RectShapePropertyFactory.prototype = {\n convertRectToPath: function () {\n var p0 = this.p.v[0]\n var p1 = this.p.v[1]\n var v0 = this.s.v[0] / 2\n var v1 = this.s.v[1] / 2\n var round = bmMin(v0, v1, this.r.v)\n var cPoint = round * (1 - roundCorner)\n this.v._length = 0\n\n if (this.d === 2 || this.d === 1) {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true)\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true)\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true)\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true)\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true)\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true)\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true)\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true)\n } else {\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2)\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3)\n }\n } else {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true)\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true)\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true)\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true)\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true)\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true)\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true)\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true)\n } else {\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true)\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true)\n this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true)\n }\n }\n },\n getValue: function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n if (this._mdf) {\n this.convertRectToPath()\n }\n },\n reset: resetShape,\n }\n extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory)\n\n return RectShapePropertyFactory\n })()\n\n function getShapeProp(elem, data, type) {\n var prop\n if (type === 3 || type === 4) {\n var dataProp = type === 3 ? data.pt : data.ks\n var keys = dataProp.k\n if (keys.length) {\n prop = new KeyframedShapeProperty(elem, data, type)\n } else {\n prop = new ShapeProperty(elem, data, type)\n }\n } else if (type === 5) {\n prop = new RectShapeProperty(elem, data)\n } else if (type === 6) {\n prop = new EllShapeProperty(elem, data)\n } else if (type === 7) {\n prop = new StarShapeProperty(elem, data)\n }\n if (prop.k) {\n elem.addDynamicProperty(prop)\n }\n return prop\n }\n\n function getConstructorFunction() {\n return ShapeProperty\n }\n\n function getKeyframedConstructorFunction() {\n return KeyframedShapeProperty\n }\n\n var ob = {}\n ob.getShapeProp = getShapeProp\n ob.getConstructorFunction = getConstructorFunction\n ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction\n return ob\n })()\n\n /*!\n Transformation Matrix v2.0\n (c) Epistemex 2014-2015\n www.epistemex.com\n By Ken Fyrstenberg\n Contributions by leeoniya.\n License: MIT, header required.\n */\n\n /**\n * 2D transformation matrix object initialized with identity matrix.\n *\n * The matrix can synchronize a canvas context by supplying the context\n * as an argument, or later apply current absolute transform to an\n * existing context.\n *\n * All values are handled as floating point values.\n *\n * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix\n * @prop {number} a - scale x\n * @prop {number} b - shear y\n * @prop {number} c - shear x\n * @prop {number} d - scale y\n * @prop {number} e - translate x\n * @prop {number} f - translate y\n * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context\n * @constructor\n */\n\n const Matrix = (function () {\n var _cos = Math.cos\n var _sin = Math.sin\n var _tan = Math.tan\n var _rnd = Math.round\n\n function reset() {\n this.props[0] = 1\n this.props[1] = 0\n this.props[2] = 0\n this.props[3] = 0\n this.props[4] = 0\n this.props[5] = 1\n this.props[6] = 0\n this.props[7] = 0\n this.props[8] = 0\n this.props[9] = 0\n this.props[10] = 1\n this.props[11] = 0\n this.props[12] = 0\n this.props[13] = 0\n this.props[14] = 0\n this.props[15] = 1\n return this\n }\n\n function rotate(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n }\n\n function rotateX(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1)\n }\n\n function rotateY(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1)\n }\n\n function rotateZ(angle) {\n if (angle === 0) {\n return this\n }\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n }\n\n function shear(sx, sy) {\n return this._t(1, sy, sx, 1, 0, 0)\n }\n\n function skew(ax, ay) {\n return this.shear(_tan(ax), _tan(ay))\n }\n\n function skewFromAxis(ax, angle) {\n var mCos = _cos(angle)\n var mSin = _sin(angle)\n return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)\n // return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);\n }\n\n function scale(sx, sy, sz) {\n if (!sz && sz !== 0) {\n sz = 1\n }\n if (sx === 1 && sy === 1 && sz === 1) {\n return this\n }\n return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1)\n }\n\n function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {\n this.props[0] = a\n this.props[1] = b\n this.props[2] = c\n this.props[3] = d\n this.props[4] = e\n this.props[5] = f\n this.props[6] = g\n this.props[7] = h\n this.props[8] = i\n this.props[9] = j\n this.props[10] = k\n this.props[11] = l\n this.props[12] = m\n this.props[13] = n\n this.props[14] = o\n this.props[15] = p\n return this\n }\n\n function translate(tx, ty, tz) {\n tz = tz || 0\n if (tx !== 0 || ty !== 0 || tz !== 0) {\n return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1)\n }\n return this\n }\n\n function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {\n var _p = this.props\n\n if (\n a2 === 1 &&\n b2 === 0 &&\n c2 === 0 &&\n d2 === 0 &&\n e2 === 0 &&\n f2 === 1 &&\n g2 === 0 &&\n h2 === 0 &&\n i2 === 0 &&\n j2 === 0 &&\n k2 === 1 &&\n l2 === 0\n ) {\n // NOTE: commenting this condition because TurboFan deoptimizes code when present\n // if(m2 !== 0 || n2 !== 0 || o2 !== 0){\n _p[12] = _p[12] * a2 + _p[15] * m2\n _p[13] = _p[13] * f2 + _p[15] * n2\n _p[14] = _p[14] * k2 + _p[15] * o2\n _p[15] *= p2\n // }\n this._identityCalculated = false\n return this\n }\n\n var a1 = _p[0]\n var b1 = _p[1]\n var c1 = _p[2]\n var d1 = _p[3]\n var e1 = _p[4]\n var f1 = _p[5]\n var g1 = _p[6]\n var h1 = _p[7]\n var i1 = _p[8]\n var j1 = _p[9]\n var k1 = _p[10]\n var l1 = _p[11]\n var m1 = _p[12]\n var n1 = _p[13]\n var o1 = _p[14]\n var p1 = _p[15]\n\n /* matrix order (canvas compatible):\n * ace\n * bdf\n * 001\n */\n _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2\n _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2\n _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2\n _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2\n\n _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2\n _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2\n _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2\n _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2\n\n _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2\n _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2\n _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2\n _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2\n\n _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2\n _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2\n _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2\n _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2\n\n this._identityCalculated = false\n return this\n }\n\n function isIdentity() {\n if (!this._identityCalculated) {\n this._identity = !(\n this.props[0] !== 1 ||\n this.props[1] !== 0 ||\n this.props[2] !== 0 ||\n this.props[3] !== 0 ||\n this.props[4] !== 0 ||\n this.props[5] !== 1 ||\n this.props[6] !== 0 ||\n this.props[7] !== 0 ||\n this.props[8] !== 0 ||\n this.props[9] !== 0 ||\n this.props[10] !== 1 ||\n this.props[11] !== 0 ||\n this.props[12] !== 0 ||\n this.props[13] !== 0 ||\n this.props[14] !== 0 ||\n this.props[15] !== 1\n )\n this._identityCalculated = true\n }\n return this._identity\n }\n\n function equals(matr) {\n var i = 0\n while (i < 16) {\n if (matr.props[i] !== this.props[i]) {\n return false\n }\n i += 1\n }\n return true\n }\n\n function clone(matr) {\n var i\n for (i = 0; i < 16; i += 1) {\n matr.props[i] = this.props[i]\n }\n return matr\n }\n\n function cloneFromProps(props) {\n var i\n for (i = 0; i < 16; i += 1) {\n this.props[i] = props[i]\n }\n }\n\n function applyToPoint(x, y, z) {\n return {\n x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\n y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\n z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],\n }\n /* return {\n x: x * me.a + y * me.c + me.e,\n y: x * me.b + y * me.d + me.f\n }; */\n }\n function applyToX(x, y, z) {\n return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12]\n }\n function applyToY(x, y, z) {\n return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13]\n }\n function applyToZ(x, y, z) {\n return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]\n }\n\n function getInverseMatrix() {\n var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4]\n var a = this.props[5] / determinant\n var b = -this.props[1] / determinant\n var c = -this.props[4] / determinant\n var d = this.props[0] / determinant\n var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant\n var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant\n var inverseMatrix = new Matrix()\n inverseMatrix.props[0] = a\n inverseMatrix.props[1] = b\n inverseMatrix.props[4] = c\n inverseMatrix.props[5] = d\n inverseMatrix.props[12] = e\n inverseMatrix.props[13] = f\n return inverseMatrix\n }\n\n function inversePoint(pt) {\n var inverseMatrix = this.getInverseMatrix()\n return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0)\n }\n\n function inversePoints(pts) {\n var i\n var len = pts.length\n var retPts = []\n for (i = 0; i < len; i += 1) {\n retPts[i] = inversePoint(pts[i])\n }\n return retPts\n }\n\n function applyToTriplePoints(pt1, pt2, pt3) {\n var arr = createTypedArray('float32', 6)\n if (this.isIdentity()) {\n arr[0] = pt1[0]\n arr[1] = pt1[1]\n arr[2] = pt2[0]\n arr[3] = pt2[1]\n arr[4] = pt3[0]\n arr[5] = pt3[1]\n } else {\n var p0 = this.props[0]\n var p1 = this.props[1]\n var p4 = this.props[4]\n var p5 = this.props[5]\n var p12 = this.props[12]\n var p13 = this.props[13]\n arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12\n arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13\n arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12\n arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13\n arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12\n arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13\n }\n return arr\n }\n\n function applyToPointArray(x, y, z) {\n var arr\n if (this.isIdentity()) {\n arr = [x, y, z]\n } else {\n arr = [\n x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\n x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\n x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14],\n ]\n }\n return arr\n }\n\n function applyToPointStringified(x, y) {\n if (this.isIdentity()) {\n return x + ',' + y\n }\n var _p = this.props\n return (\n Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 +\n ',' +\n Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100\n )\n }\n\n function toCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n /* if(this.isIdentity()) {\n return '';\n } */\n var i = 0\n var props = this.props\n var cssValue = 'matrix3d('\n var v = 10000\n while (i < 16) {\n cssValue += _rnd(props[i] * v) / v\n cssValue += i === 15 ? ')' : ','\n i += 1\n }\n return cssValue\n }\n\n function roundMatrixProperty(val) {\n var v = 10000\n if ((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {\n return _rnd(val * v) / v\n }\n return val\n }\n\n function to2dCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n /* if(this.isIdentity()) {\n return '';\n } */\n var props = this.props\n var _a = roundMatrixProperty(props[0])\n var _b = roundMatrixProperty(props[1])\n var _c = roundMatrixProperty(props[4])\n var _d = roundMatrixProperty(props[5])\n var _e = roundMatrixProperty(props[12])\n var _f = roundMatrixProperty(props[13])\n return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')'\n }\n\n return function () {\n this.reset = reset\n this.rotate = rotate\n this.rotateX = rotateX\n this.rotateY = rotateY\n this.rotateZ = rotateZ\n this.skew = skew\n this.skewFromAxis = skewFromAxis\n this.shear = shear\n this.scale = scale\n this.setTransform = setTransform\n this.translate = translate\n this.transform = transform\n this.applyToPoint = applyToPoint\n this.applyToX = applyToX\n this.applyToY = applyToY\n this.applyToZ = applyToZ\n this.applyToPointArray = applyToPointArray\n this.applyToTriplePoints = applyToTriplePoints\n this.applyToPointStringified = applyToPointStringified\n this.toCSS = toCSS\n this.to2dCSS = to2dCSS\n this.clone = clone\n this.cloneFromProps = cloneFromProps\n this.equals = equals\n this.inversePoints = inversePoints\n this.inversePoint = inversePoint\n this.getInverseMatrix = getInverseMatrix\n this._t = this.transform\n this.isIdentity = isIdentity\n this._identity = true\n this._identityCalculated = false\n\n this.props = createTypedArray('float32', 16)\n this.reset()\n }\n })()\n\n const lottie = {}\n var standalone = '__[STANDALONE]__'\n var animationData = '__[ANIMATIONDATA]__'\n var renderer = ''\n\n function setLocation(href) {\n setLocationHref(href)\n }\n\n function searchAnimations() {\n if (standalone === true) {\n animationManager.searchAnimations(animationData, standalone, renderer)\n } else {\n animationManager.searchAnimations()\n }\n }\n\n function setSubframeRendering(flag) {\n setSubframeEnabled(flag)\n }\n\n function setPrefix(prefix) {\n setIdPrefix(prefix)\n }\n\n function loadAnimation(params) {\n if (standalone === true) {\n params.animationData = JSON.parse(animationData)\n }\n return animationManager.loadAnimation(params)\n }\n\n function setQuality(value) {\n if (typeof value === 'string') {\n switch (value) {\n case 'high':\n setDefaultCurveSegments(200)\n break\n default:\n case 'medium':\n setDefaultCurveSegments(50)\n break\n case 'low':\n setDefaultCurveSegments(10)\n break\n }\n } else if (!isNaN(value) && value > 1) {\n setDefaultCurveSegments(value)\n }\n if (getDefaultCurveSegments() >= 50) {\n roundValues(false)\n } else {\n roundValues(true)\n }\n }\n\n function inBrowser() {\n return typeof navigator !== 'undefined'\n }\n\n function installPlugin(type, plugin) {\n if (type === 'expressions') {\n setExpressionsPlugin(plugin)\n }\n }\n\n function getFactory(name) {\n switch (name) {\n case 'propertyFactory':\n return PropertyFactory\n case 'shapePropertyFactory':\n return ShapePropertyFactory\n case 'matrix':\n return Matrix\n default:\n return null\n }\n }\n\n lottie.play = animationManager.play\n lottie.pause = animationManager.pause\n lottie.setLocationHref = setLocation\n lottie.togglePause = animationManager.togglePause\n lottie.setSpeed = animationManager.setSpeed\n lottie.setDirection = animationManager.setDirection\n lottie.stop = animationManager.stop\n lottie.searchAnimations = searchAnimations\n lottie.registerAnimation = animationManager.registerAnimation\n lottie.loadAnimation = loadAnimation\n lottie.setSubframeRendering = setSubframeRendering\n lottie.resize = animationManager.resize\n // lottie.start = start;\n lottie.goToAndStop = animationManager.goToAndStop\n lottie.destroy = animationManager.destroy\n lottie.setQuality = setQuality\n lottie.inBrowser = inBrowser\n lottie.installPlugin = installPlugin\n lottie.freeze = animationManager.freeze\n lottie.unfreeze = animationManager.unfreeze\n lottie.setVolume = animationManager.setVolume\n lottie.mute = animationManager.mute\n lottie.unmute = animationManager.unmute\n lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations\n lottie.useWebWorker = setWebWorker\n lottie.setIDPrefix = setPrefix\n lottie.__getFactory = getFactory\n lottie.version = '[[BM_VERSION]]'\n\n function checkReady() {\n if (document.readyState === 'complete') {\n clearInterval(readyStateCheckInterval)\n searchAnimations()\n }\n }\n\n function getQueryVariable(variable) {\n var vars = queryString.split('&')\n for (var i = 0; i < vars.length; i += 1) {\n var pair = vars[i].split('=')\n if (decodeURIComponent(pair[0]) == variable) {\n // eslint-disable-line eqeqeq\n return decodeURIComponent(pair[1])\n }\n }\n return null\n }\n var queryString = ''\n if (standalone) {\n var scripts = document.getElementsByTagName('script')\n var index = scripts.length - 1\n var myScript = scripts[index] || {\n src: '',\n }\n queryString = myScript.src ? myScript.src.replace(/^[^\\?]+\\??/, '') : '' // eslint-disable-line no-useless-escape\n renderer = getQueryVariable('renderer')\n }\n var readyStateCheckInterval = setInterval(checkReady, 100)\n\n // this adds bodymovin to the window object for backwards compatibility\n try {\n if (\n !(typeof exports === 'object' && typeof module !== 'undefined') &&\n !(typeof define === 'function' && define.amd) // eslint-disable-line no-undef\n ) {\n window.bodymovin = lottie\n }\n } catch (err) {\n //\n }\n\n const ShapeModifiers = (function () {\n var ob = {}\n var modifiers = {}\n ob.registerModifier = registerModifier\n ob.getModifier = getModifier\n\n function registerModifier(nm, factory) {\n if (!modifiers[nm]) {\n modifiers[nm] = factory\n }\n }\n\n function getModifier(nm, elem, data) {\n return new modifiers[nm](elem, data)\n }\n\n return ob\n })()\n\n function ShapeModifier() {}\n ShapeModifier.prototype.initModifierProperties = function () {}\n ShapeModifier.prototype.addShapeToModifier = function () {}\n ShapeModifier.prototype.addShape = function (data) {\n if (!this.closed) {\n // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.\n data.sh.container.addDynamicProperty(data.sh)\n var shapeData = { shape: data.sh, data: data, localShapeCollection: shapeCollectionPool.newShapeCollection() }\n this.shapes.push(shapeData)\n this.addShapeToModifier(shapeData)\n if (this._isAnimated) {\n data.setAsAnimated()\n }\n }\n }\n ShapeModifier.prototype.init = function (elem, data) {\n this.shapes = []\n this.elem = elem\n this.initDynamicPropertyContainer(elem)\n this.initModifierProperties(elem, data)\n this.frameId = initialDefaultFrame\n this.closed = false\n this.k = false\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.getValue(true)\n }\n }\n ShapeModifier.prototype.processKeys = function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n }\n\n extendPrototype([DynamicPropertyContainer], ShapeModifier)\n\n function TrimModifier() {}\n extendPrototype([ShapeModifier], TrimModifier)\n TrimModifier.prototype.initModifierProperties = function (elem, data) {\n this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this)\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this)\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this)\n this.sValue = 0\n this.eValue = 0\n this.getValue = this.processKeys\n this.m = data.m\n this._isAnimated =\n !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length\n }\n\n TrimModifier.prototype.addShapeToModifier = function (shapeData) {\n shapeData.pathsData = []\n }\n\n TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {\n var segments = []\n if (e <= 1) {\n segments.push({\n s: s,\n e: e,\n })\n } else if (s >= 1) {\n segments.push({\n s: s - 1,\n e: e - 1,\n })\n } else {\n segments.push({\n s: s,\n e: 1,\n })\n segments.push({\n s: 0,\n e: e - 1,\n })\n }\n var shapeSegments = []\n var i\n var len = segments.length\n var segmentOb\n for (i = 0; i < len; i += 1) {\n segmentOb = segments[i]\n if (\n !(\n segmentOb.e * totalModifierLength < addedLength ||\n segmentOb.s * totalModifierLength > addedLength + shapeLength\n )\n ) {\n var shapeS\n var shapeE\n if (segmentOb.s * totalModifierLength <= addedLength) {\n shapeS = 0\n } else {\n shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength\n }\n if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {\n shapeE = 1\n } else {\n shapeE = (segmentOb.e * totalModifierLength - addedLength) / shapeLength\n }\n shapeSegments.push([shapeS, shapeE])\n }\n }\n if (!shapeSegments.length) {\n shapeSegments.push([0, 0])\n }\n return shapeSegments\n }\n\n TrimModifier.prototype.releasePathsData = function (pathsData) {\n var i\n var len = pathsData.length\n for (i = 0; i < len; i += 1) {\n segmentsLengthPool.release(pathsData[i])\n }\n pathsData.length = 0\n return pathsData\n }\n\n TrimModifier.prototype.processShapes = function (_isFirstFrame) {\n var s\n var e\n if (this._mdf || _isFirstFrame) {\n var o = (this.o.v % 360) / 360\n if (o < 0) {\n o += 1\n }\n if (this.s.v > 1) {\n s = 1 + o\n } else if (this.s.v < 0) {\n s = 0 + o\n } else {\n s = this.s.v + o\n }\n if (this.e.v > 1) {\n e = 1 + o\n } else if (this.e.v < 0) {\n e = 0 + o\n } else {\n e = this.e.v + o\n }\n\n if (s > e) {\n var _s = s\n s = e\n e = _s\n }\n s = Math.round(s * 10000) * 0.0001\n e = Math.round(e * 10000) * 0.0001\n this.sValue = s\n this.eValue = e\n } else {\n s = this.sValue\n e = this.eValue\n }\n var shapePaths\n var i\n var len = this.shapes.length\n var j\n var jLen\n var pathsData\n var pathData\n var totalShapeLength\n var totalModifierLength = 0\n\n if (e === s) {\n for (i = 0; i < len; i += 1) {\n this.shapes[i].localShapeCollection.releaseShapes()\n this.shapes[i].shape._mdf = true\n this.shapes[i].shape.paths = this.shapes[i].localShapeCollection\n if (this._mdf) {\n this.shapes[i].pathsData.length = 0\n }\n }\n } else if (!((e === 1 && s === 0) || (e === 0 && s === 1))) {\n var segments = []\n var shapeData\n var localShapeCollection\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i]\n // if shape hasn't changed and trim properties haven't changed, cached previous path can be used\n if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {\n shapeData.shape.paths = shapeData.localShapeCollection\n } else {\n shapePaths = shapeData.shape.paths\n jLen = shapePaths._length\n totalShapeLength = 0\n if (!shapeData.shape._mdf && shapeData.pathsData.length) {\n totalShapeLength = shapeData.totalShapeLength\n } else {\n pathsData = this.releasePathsData(shapeData.pathsData)\n for (j = 0; j < jLen; j += 1) {\n pathData = bez.getSegmentsLength(shapePaths.shapes[j])\n pathsData.push(pathData)\n totalShapeLength += pathData.totalLength\n }\n shapeData.totalShapeLength = totalShapeLength\n shapeData.pathsData = pathsData\n }\n\n totalModifierLength += totalShapeLength\n shapeData.shape._mdf = true\n }\n }\n var shapeS = s\n var shapeE = e\n var addedLength = 0\n var edges\n for (i = len - 1; i >= 0; i -= 1) {\n shapeData = this.shapes[i]\n if (shapeData.shape._mdf) {\n localShapeCollection = shapeData.localShapeCollection\n localShapeCollection.releaseShapes()\n // if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group\n if (this.m === 2 && len > 1) {\n edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength)\n addedLength += shapeData.totalShapeLength\n } else {\n edges = [[shapeS, shapeE]]\n }\n jLen = edges.length\n for (j = 0; j < jLen; j += 1) {\n shapeS = edges[j][0]\n shapeE = edges[j][1]\n segments.length = 0\n if (shapeE <= 1) {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength * shapeE,\n })\n } else if (shapeS >= 1) {\n segments.push({\n s: shapeData.totalShapeLength * (shapeS - 1),\n e: shapeData.totalShapeLength * (shapeE - 1),\n })\n } else {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength,\n })\n segments.push({\n s: 0,\n e: shapeData.totalShapeLength * (shapeE - 1),\n })\n }\n var newShapesData = this.addShapes(shapeData, segments[0])\n if (segments[0].s !== segments[0].e) {\n if (segments.length > 1) {\n var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1]\n if (lastShapeInCollection.c) {\n var lastShape = newShapesData.pop()\n this.addPaths(newShapesData, localShapeCollection)\n newShapesData = this.addShapes(shapeData, segments[1], lastShape)\n } else {\n this.addPaths(newShapesData, localShapeCollection)\n newShapesData = this.addShapes(shapeData, segments[1])\n }\n }\n this.addPaths(newShapesData, localShapeCollection)\n }\n }\n shapeData.shape.paths = localShapeCollection\n }\n }\n } else if (this._mdf) {\n for (i = 0; i < len; i += 1) {\n // Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.\n // Don't remove this even if it's losing cached info.\n this.shapes[i].pathsData.length = 0\n this.shapes[i].shape._mdf = true\n }\n }\n }\n\n TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {\n var i\n var len = newPaths.length\n for (i = 0; i < len; i += 1) {\n localShapeCollection.addShape(newPaths[i])\n }\n }\n\n TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {\n shapePath.setXYAt(pt2[0], pt2[1], 'o', pos)\n shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1)\n if (newShape) {\n shapePath.setXYAt(pt1[0], pt1[1], 'v', pos)\n }\n shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1)\n }\n\n TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {\n shapePath.setXYAt(points[1], points[5], 'o', pos)\n shapePath.setXYAt(points[2], points[6], 'i', pos + 1)\n if (newShape) {\n shapePath.setXYAt(points[0], points[4], 'v', pos)\n }\n shapePath.setXYAt(points[3], points[7], 'v', pos + 1)\n }\n\n TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {\n var pathsData = shapeData.pathsData\n var shapePaths = shapeData.shape.paths.shapes\n var i\n var len = shapeData.shape.paths._length\n var j\n var jLen\n var addedLength = 0\n var currentLengthData\n var segmentCount\n var lengths\n var segment\n var shapes = []\n var initPos\n var newShape = true\n if (!shapePath) {\n shapePath = shapePool.newElement()\n segmentCount = 0\n initPos = 0\n } else {\n segmentCount = shapePath._length\n initPos = shapePath._length\n }\n shapes.push(shapePath)\n for (i = 0; i < len; i += 1) {\n lengths = pathsData[i].lengths\n shapePath.c = shapePaths[i].c\n jLen = shapePaths[i].c ? lengths.length : lengths.length + 1\n for (j = 1; j < jLen; j += 1) {\n currentLengthData = lengths[j - 1]\n if (addedLength + currentLengthData.addedLength < shapeSegment.s) {\n addedLength += currentLengthData.addedLength\n shapePath.c = false\n } else if (addedLength > shapeSegment.e) {\n shapePath.c = false\n break\n } else {\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {\n this.addSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[j],\n shapePaths[i].v[j],\n shapePath,\n segmentCount,\n newShape,\n )\n newShape = false\n } else {\n segment = bez.getNewSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].v[j],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[j],\n (shapeSegment.s - addedLength) / currentLengthData.addedLength,\n (shapeSegment.e - addedLength) / currentLengthData.addedLength,\n lengths[j - 1],\n )\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape)\n // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n newShape = false\n shapePath.c = false\n }\n addedLength += currentLengthData.addedLength\n segmentCount += 1\n }\n }\n if (shapePaths[i].c && lengths.length) {\n currentLengthData = lengths[j - 1]\n if (addedLength <= shapeSegment.e) {\n var segmentLength = lengths[j - 1].addedLength\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {\n this.addSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[0],\n shapePaths[i].v[0],\n shapePath,\n segmentCount,\n newShape,\n )\n newShape = false\n } else {\n segment = bez.getNewSegment(\n shapePaths[i].v[j - 1],\n shapePaths[i].v[0],\n shapePaths[i].o[j - 1],\n shapePaths[i].i[0],\n (shapeSegment.s - addedLength) / segmentLength,\n (shapeSegment.e - addedLength) / segmentLength,\n lengths[j - 1],\n )\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape)\n // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n newShape = false\n shapePath.c = false\n }\n } else {\n shapePath.c = false\n }\n addedLength += currentLengthData.addedLength\n segmentCount += 1\n }\n if (shapePath._length) {\n shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos)\n shapePath.setXYAt(\n shapePath.v[shapePath._length - 1][0],\n shapePath.v[shapePath._length - 1][1],\n 'o',\n shapePath._length - 1,\n )\n }\n if (addedLength > shapeSegment.e) {\n break\n }\n if (i < len - 1) {\n shapePath = shapePool.newElement()\n newShape = true\n shapes.push(shapePath)\n segmentCount = 0\n }\n }\n return shapes\n }\n\n function PuckerAndBloatModifier() {}\n extendPrototype([ShapeModifier], PuckerAndBloatModifier)\n PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this)\n this._isAnimated = !!this.amount.effectsSequence.length\n }\n\n PuckerAndBloatModifier.prototype.processPath = function (path, amount) {\n var percent = amount / 100\n var centerPoint = [0, 0]\n var pathLength = path._length\n var i = 0\n for (i = 0; i < pathLength; i += 1) {\n centerPoint[0] += path.v[i][0]\n centerPoint[1] += path.v[i][1]\n }\n centerPoint[0] /= pathLength\n centerPoint[1] /= pathLength\n var clonedPath = shapePool.newElement()\n clonedPath.c = path.c\n var vX\n var vY\n var oX\n var oY\n var iX\n var iY\n for (i = 0; i < pathLength; i += 1) {\n vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent\n vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent\n oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent\n oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent\n iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent\n iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i)\n }\n return clonedPath\n }\n\n PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths\n var i\n var len = this.shapes.length\n var j\n var jLen\n var amount = this.amount.v\n\n if (amount !== 0) {\n var shapeData\n var localShapeCollection\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i]\n localShapeCollection = shapeData.localShapeCollection\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes()\n shapeData.shape._mdf = true\n shapePaths = shapeData.shape.paths.shapes\n jLen = shapeData.shape.paths._length\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount))\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false\n }\n }\n\n const TransformPropertyFactory = (function () {\n var defaultVector = [0, 0]\n\n function applyToMatrix(mat) {\n var _mdf = this._mdf\n this.iterateDynamicProperties()\n this._mdf = this._mdf || _mdf\n if (this.a) {\n mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2])\n }\n if (this.s) {\n mat.scale(this.s.v[0], this.s.v[1], this.s.v[2])\n }\n if (this.sk) {\n mat.skewFromAxis(-this.sk.v, this.sa.v)\n }\n if (this.r) {\n mat.rotate(-this.r.v)\n } else {\n mat\n .rotateZ(-this.rz.v)\n .rotateY(this.ry.v)\n .rotateX(this.rx.v)\n .rotateZ(-this.or.v[2])\n .rotateY(this.or.v[1])\n .rotateX(this.or.v[0])\n }\n if (this.data.p.s) {\n if (this.data.p.z) {\n mat.translate(this.px.v, this.py.v, -this.pz.v)\n } else {\n mat.translate(this.px.v, this.py.v, 0)\n }\n } else {\n mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2])\n }\n }\n function processKeys(forceRender) {\n if (this.elem.globalData.frameId === this.frameId) {\n return\n }\n if (this._isDirty) {\n this.precalculateMatrix()\n this._isDirty = false\n }\n\n this.iterateDynamicProperties()\n\n if (this._mdf || forceRender) {\n var frameRate\n this.v.cloneFromProps(this.pre.props)\n if (this.appliedTransformations < 1) {\n this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2])\n }\n if (this.appliedTransformations < 2) {\n this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2])\n }\n if (this.sk && this.appliedTransformations < 3) {\n this.v.skewFromAxis(-this.sk.v, this.sa.v)\n }\n if (this.r && this.appliedTransformations < 4) {\n this.v.rotate(-this.r.v)\n } else if (!this.r && this.appliedTransformations < 4) {\n this.v\n .rotateZ(-this.rz.v)\n .rotateY(this.ry.v)\n .rotateX(this.rx.v)\n .rotateZ(-this.or.v[2])\n .rotateY(this.or.v[1])\n .rotateX(this.or.v[0])\n }\n if (this.autoOriented) {\n var v1\n var v2\n frameRate = this.elem.globalData.frameRate\n if (this.p && this.p.keyframes && this.p.getValueAtTime) {\n if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {\n v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0)\n v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0)\n } else if (\n this.p._caching.lastFrame + this.p.offsetTime >=\n this.p.keyframes[this.p.keyframes.length - 1].t\n ) {\n v1 = this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length - 1].t / frameRate, 0)\n v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0)\n } else {\n v1 = this.p.pv\n v2 = this.p.getValueAtTime(\n (this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate,\n this.p.offsetTime,\n )\n }\n } else if (\n this.px &&\n this.px.keyframes &&\n this.py.keyframes &&\n this.px.getValueAtTime &&\n this.py.getValueAtTime\n ) {\n v1 = []\n v2 = []\n var px = this.px\n var py = this.py\n if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {\n v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0)\n v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0)\n v2[0] = px.getValueAtTime(px.keyframes[0].t / frameRate, 0)\n v2[1] = py.getValueAtTime(py.keyframes[0].t / frameRate, 0)\n } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {\n v1[0] = px.getValueAtTime(px.keyframes[px.keyframes.length - 1].t / frameRate, 0)\n v1[1] = py.getValueAtTime(py.keyframes[py.keyframes.length - 1].t / frameRate, 0)\n v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0)\n v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0)\n } else {\n v1 = [px.pv, py.pv]\n v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime)\n v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime)\n }\n } else {\n v2 = defaultVector\n v1 = v2\n }\n this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]))\n }\n if (this.data.p && this.data.p.s) {\n if (this.data.p.z) {\n this.v.translate(this.px.v, this.py.v, -this.pz.v)\n } else {\n this.v.translate(this.px.v, this.py.v, 0)\n }\n } else {\n this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2])\n }\n }\n this.frameId = this.elem.globalData.frameId\n }\n\n function precalculateMatrix() {\n if (!this.a.k) {\n this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2])\n this.appliedTransformations = 1\n } else {\n return\n }\n if (!this.s.effectsSequence.length) {\n this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2])\n this.appliedTransformations = 2\n } else {\n return\n }\n if (this.sk) {\n if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {\n this.pre.skewFromAxis(-this.sk.v, this.sa.v)\n this.appliedTransformations = 3\n } else {\n return\n }\n }\n if (this.r) {\n if (!this.r.effectsSequence.length) {\n this.pre.rotate(-this.r.v)\n this.appliedTransformations = 4\n }\n } else if (\n !this.rz.effectsSequence.length &&\n !this.ry.effectsSequence.length &&\n !this.rx.effectsSequence.length &&\n !this.or.effectsSequence.length\n ) {\n this.pre\n .rotateZ(-this.rz.v)\n .rotateY(this.ry.v)\n .rotateX(this.rx.v)\n .rotateZ(-this.or.v[2])\n .rotateY(this.or.v[1])\n .rotateX(this.or.v[0])\n this.appliedTransformations = 4\n }\n }\n\n function autoOrient() {\n //\n // var prevP = this.getValueAtTime();\n }\n\n function addDynamicProperty(prop) {\n this._addDynamicProperty(prop)\n this.elem.addDynamicProperty(prop)\n this._isDirty = true\n }\n\n function TransformProperty(elem, data, container) {\n this.elem = elem\n this.frameId = -1\n this.propType = 'transform'\n this.data = data\n this.v = new Matrix()\n // Precalculated matrix with non animated properties\n this.pre = new Matrix()\n this.appliedTransformations = 0\n this.initDynamicPropertyContainer(container || elem)\n if (data.p && data.p.s) {\n this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this)\n this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this)\n if (data.p.z) {\n this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this)\n }\n } else {\n this.p = PropertyFactory.getProp(elem, data.p || { k: [0, 0, 0] }, 1, 0, this)\n }\n if (data.rx) {\n this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this)\n this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this)\n this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this)\n if (data.or.k[0].ti) {\n var i\n var len = data.or.k.length\n for (i = 0; i < len; i += 1) {\n data.or.k[i].to = null\n data.or.k[i].ti = null\n }\n }\n this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this)\n // sh Indicates it needs to be capped between -180 and 180\n this.or.sh = true\n } else {\n this.r = PropertyFactory.getProp(elem, data.r || { k: 0 }, 0, degToRads, this)\n }\n if (data.sk) {\n this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this)\n this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this)\n }\n this.a = PropertyFactory.getProp(elem, data.a || { k: [0, 0, 0] }, 1, 0, this)\n this.s = PropertyFactory.getProp(elem, data.s || { k: [100, 100, 100] }, 1, 0.01, this)\n // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.\n if (data.o) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem)\n } else {\n this.o = { _mdf: false, v: 1 }\n }\n this._isDirty = true\n if (!this.dynamicProperties.length) {\n this.getValue(true)\n }\n }\n\n TransformProperty.prototype = {\n applyToMatrix: applyToMatrix,\n getValue: processKeys,\n precalculateMatrix: precalculateMatrix,\n autoOrient: autoOrient,\n }\n\n extendPrototype([DynamicPropertyContainer], TransformProperty)\n TransformProperty.prototype.addDynamicProperty = addDynamicProperty\n TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty\n\n function getTransformProperty(elem, data, container) {\n return new TransformProperty(elem, data, container)\n }\n\n return {\n getTransformProperty: getTransformProperty,\n }\n })()\n\n function RepeaterModifier() {}\n extendPrototype([ShapeModifier], RepeaterModifier)\n\n RepeaterModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys\n this.c = PropertyFactory.getProp(elem, data.c, 0, null, this)\n this.o = PropertyFactory.getProp(elem, data.o, 0, null, this)\n this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this)\n this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this)\n this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this)\n this.data = data\n if (!this.dynamicProperties.length) {\n this.getValue(true)\n }\n this._isAnimated = !!this.dynamicProperties.length\n this.pMatrix = new Matrix()\n this.rMatrix = new Matrix()\n this.sMatrix = new Matrix()\n this.tMatrix = new Matrix()\n this.matrix = new Matrix()\n }\n\n RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {\n var dir = inv ? -1 : 1\n var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc)\n var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc)\n pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2])\n rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2])\n rMatrix.rotate(-transform.r.v * dir * perc)\n rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2])\n sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2])\n sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY)\n sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2])\n }\n\n RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {\n this.elem = elem\n this.arr = arr\n this.pos = pos\n this.elemsData = elemsData\n this._currentCopies = 0\n this._elements = []\n this._groups = []\n this.frameId = -1\n this.initDynamicPropertyContainer(elem)\n this.initModifierProperties(elem, arr[pos])\n while (pos > 0) {\n pos -= 1\n // this._elements.unshift(arr.splice(pos,1)[0]);\n this._elements.unshift(arr[pos])\n }\n if (this.dynamicProperties.length) {\n this.k = true\n } else {\n this.getValue(true)\n }\n }\n\n RepeaterModifier.prototype.resetElements = function (elements) {\n var i\n var len = elements.length\n for (i = 0; i < len; i += 1) {\n elements[i]._processed = false\n if (elements[i].ty === 'gr') {\n this.resetElements(elements[i].it)\n }\n }\n }\n\n RepeaterModifier.prototype.cloneElements = function (elements) {\n var newElements = JSON.parse(JSON.stringify(elements))\n this.resetElements(newElements)\n return newElements\n }\n\n RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {\n var i\n var len = elements.length\n for (i = 0; i < len; i += 1) {\n elements[i]._render = renderFlag\n if (elements[i].ty === 'gr') {\n this.changeGroupRender(elements[i].it, renderFlag)\n }\n }\n }\n\n RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {\n var items\n var itemsTransform\n var i\n var dir\n var cont\n var hasReloaded = false\n if (this._mdf || _isFirstFrame) {\n var copies = Math.ceil(this.c.v)\n if (this._groups.length < copies) {\n while (this._groups.length < copies) {\n var group = {\n it: this.cloneElements(this._elements),\n ty: 'gr',\n }\n group.it.push({\n a: { a: 0, ix: 1, k: [0, 0] },\n nm: 'Transform',\n o: { a: 0, ix: 7, k: 100 },\n p: { a: 0, ix: 2, k: [0, 0] },\n r: {\n a: 1,\n ix: 6,\n k: [\n { s: 0, e: 0, t: 0 },\n { s: 0, e: 0, t: 1 },\n ],\n },\n s: { a: 0, ix: 3, k: [100, 100] },\n sa: { a: 0, ix: 5, k: 0 },\n sk: { a: 0, ix: 4, k: 0 },\n ty: 'tr',\n })\n\n this.arr.splice(0, 0, group)\n this._groups.splice(0, 0, group)\n this._currentCopies += 1\n }\n this.elem.reloadShapes()\n hasReloaded = true\n }\n cont = 0\n var renderFlag\n for (i = 0; i <= this._groups.length - 1; i += 1) {\n renderFlag = cont < copies\n this._groups[i]._render = renderFlag\n this.changeGroupRender(this._groups[i].it, renderFlag)\n if (!renderFlag) {\n var elems = this.elemsData[i].it\n var transformData = elems[elems.length - 1]\n if (transformData.transform.op.v !== 0) {\n transformData.transform.op._mdf = true\n transformData.transform.op.v = 0\n } else {\n transformData.transform.op._mdf = false\n }\n }\n cont += 1\n }\n\n this._currentCopies = copies\n /// /\n\n var offset = this.o.v\n var offsetModulo = offset % 1\n var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset)\n var pProps = this.pMatrix.props\n var rProps = this.rMatrix.props\n var sProps = this.sMatrix.props\n this.pMatrix.reset()\n this.rMatrix.reset()\n this.sMatrix.reset()\n this.tMatrix.reset()\n this.matrix.reset()\n var iteration = 0\n\n if (offset > 0) {\n while (iteration < roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false)\n iteration += 1\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false)\n iteration += offsetModulo\n }\n } else if (offset < 0) {\n while (iteration > roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true)\n iteration -= 1\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true)\n iteration -= offsetModulo\n }\n }\n i = this.data.m === 1 ? 0 : this._currentCopies - 1\n dir = this.data.m === 1 ? 1 : -1\n cont = this._currentCopies\n var j\n var jLen\n while (cont) {\n items = this.elemsData[i].it\n itemsTransform = items[items.length - 1].transform.mProps.v.props\n jLen = itemsTransform.length\n items[items.length - 1].transform.mProps._mdf = true\n items[items.length - 1].transform.op._mdf = true\n items[items.length - 1].transform.op.v =\n this._currentCopies === 1 ? this.so.v : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1))\n\n if (iteration !== 0) {\n if ((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false)\n }\n this.matrix.transform(\n rProps[0],\n rProps[1],\n rProps[2],\n rProps[3],\n rProps[4],\n rProps[5],\n rProps[6],\n rProps[7],\n rProps[8],\n rProps[9],\n rProps[10],\n rProps[11],\n rProps[12],\n rProps[13],\n rProps[14],\n rProps[15],\n )\n this.matrix.transform(\n sProps[0],\n sProps[1],\n sProps[2],\n sProps[3],\n sProps[4],\n sProps[5],\n sProps[6],\n sProps[7],\n sProps[8],\n sProps[9],\n sProps[10],\n sProps[11],\n sProps[12],\n sProps[13],\n sProps[14],\n sProps[15],\n )\n this.matrix.transform(\n pProps[0],\n pProps[1],\n pProps[2],\n pProps[3],\n pProps[4],\n pProps[5],\n pProps[6],\n pProps[7],\n pProps[8],\n pProps[9],\n pProps[10],\n pProps[11],\n pProps[12],\n pProps[13],\n pProps[14],\n pProps[15],\n )\n\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j]\n }\n this.matrix.reset()\n } else {\n this.matrix.reset()\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j]\n }\n }\n iteration += 1\n cont -= 1\n i += dir\n }\n } else {\n cont = this._currentCopies\n i = 0\n dir = 1\n while (cont) {\n items = this.elemsData[i].it\n itemsTransform = items[items.length - 1].transform.mProps.v.props\n items[items.length - 1].transform.mProps._mdf = false\n items[items.length - 1].transform.op._mdf = false\n cont -= 1\n i += dir\n }\n }\n return hasReloaded\n }\n\n RepeaterModifier.prototype.addShape = function () {}\n\n function RoundCornersModifier() {}\n extendPrototype([ShapeModifier], RoundCornersModifier)\n RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys\n this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this)\n this._isAnimated = !!this.rd.effectsSequence.length\n }\n\n RoundCornersModifier.prototype.processPath = function (path, round) {\n var clonedPath = shapePool.newElement()\n clonedPath.c = path.c\n var i\n var len = path._length\n var currentV\n var currentI\n var currentO\n var closerV\n var distance\n var newPosPerc\n var index = 0\n var vX\n var vY\n var oX\n var oY\n var iX\n var iY\n for (i = 0; i < len; i += 1) {\n currentV = path.v[i]\n currentO = path.o[i]\n currentI = path.i[i]\n if (\n currentV[0] === currentO[0] &&\n currentV[1] === currentO[1] &&\n currentV[0] === currentI[0] &&\n currentV[1] === currentI[1]\n ) {\n if ((i === 0 || i === len - 1) && !path.c) {\n clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index)\n /* clonedPath.v[index] = currentV;\n clonedPath.o[index] = currentO;\n clonedPath.i[index] = currentI; */\n index += 1\n } else {\n if (i === 0) {\n closerV = path.v[len - 1]\n } else {\n closerV = path.v[i - 1]\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2))\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0\n iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc\n vX = iX\n iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc\n vY = iY\n oX = vX - (vX - currentV[0]) * roundCorner\n oY = vY - (vY - currentV[1]) * roundCorner\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index)\n index += 1\n\n if (i === len - 1) {\n closerV = path.v[0]\n } else {\n closerV = path.v[i + 1]\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2))\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0\n oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc\n vX = oX\n oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc\n vY = oY\n iX = vX - (vX - currentV[0]) * roundCorner\n iY = vY - (vY - currentV[1]) * roundCorner\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index)\n index += 1\n }\n } else {\n clonedPath.setTripleAt(\n path.v[i][0],\n path.v[i][1],\n path.o[i][0],\n path.o[i][1],\n path.i[i][0],\n path.i[i][1],\n index,\n )\n index += 1\n }\n }\n return clonedPath\n }\n\n RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths\n var i\n var len = this.shapes.length\n var j\n var jLen\n var rd = this.rd.v\n\n if (rd !== 0) {\n var shapeData\n var localShapeCollection\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i]\n localShapeCollection = shapeData.localShapeCollection\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes()\n shapeData.shape._mdf = true\n shapePaths = shapeData.shape.paths.shapes\n jLen = shapeData.shape.paths._length\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], rd))\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false\n }\n }\n\n function getFontProperties(fontData) {\n var styles = fontData.fStyle ? fontData.fStyle.split(' ') : []\n\n var fWeight = 'normal'\n var fStyle = 'normal'\n var len = styles.length\n var styleName\n for (var i = 0; i < len; i += 1) {\n styleName = styles[i].toLowerCase()\n switch (styleName) {\n case 'italic':\n fStyle = 'italic'\n break\n case 'bold':\n fWeight = '700'\n break\n case 'black':\n fWeight = '900'\n break\n case 'medium':\n fWeight = '500'\n break\n case 'regular':\n case 'normal':\n fWeight = '400'\n break\n case 'light':\n case 'thin':\n fWeight = '200'\n break\n default:\n break\n }\n }\n\n return {\n style: fStyle,\n weight: fontData.fWeight || fWeight,\n }\n }\n\n const FontManager = (function () {\n var maxWaitingTime = 5000\n var emptyChar = {\n w: 0,\n size: 0,\n shapes: [],\n data: {\n shapes: [],\n },\n }\n var combinedCharacters = []\n // Hindi characters\n combinedCharacters = combinedCharacters.concat([\n 2304,\n 2305,\n 2306,\n 2307,\n 2362,\n 2363,\n 2364,\n 2364,\n 2366,\n 2367,\n 2368,\n 2369,\n 2370,\n 2371,\n 2372,\n 2373,\n 2374,\n 2375,\n 2376,\n 2377,\n 2378,\n 2379,\n 2380,\n 2381,\n 2382,\n 2383,\n 2387,\n 2388,\n 2389,\n 2390,\n 2391,\n 2402,\n 2403,\n ])\n\n var surrogateModifiers = ['d83cdffb', 'd83cdffc', 'd83cdffd', 'd83cdffe', 'd83cdfff']\n\n var zeroWidthJoiner = [65039, 8205]\n\n function trimFontOptions(font) {\n var familyArray = font.split(',')\n var i\n var len = familyArray.length\n var enabledFamilies = []\n for (i = 0; i < len; i += 1) {\n if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {\n enabledFamilies.push(familyArray[i])\n }\n }\n return enabledFamilies.join(',')\n }\n\n function setUpNode(font, family) {\n var parentNode = createTag('span')\n // Node is invisible to screen readers.\n parentNode.setAttribute('aria-hidden', true)\n parentNode.style.fontFamily = family\n var node = createTag('span')\n // Characters that vary significantly among different fonts\n node.innerText = 'giItT1WQy@!-/#'\n // Visible - so we can measure it - but not on the screen\n parentNode.style.position = 'absolute'\n parentNode.style.left = '-10000px'\n parentNode.style.top = '-10000px'\n // Large font size makes even subtle changes obvious\n parentNode.style.fontSize = '300px'\n // Reset any font properties\n parentNode.style.fontVariant = 'normal'\n parentNode.style.fontStyle = 'normal'\n parentNode.style.fontWeight = 'normal'\n parentNode.style.letterSpacing = '0'\n parentNode.appendChild(node)\n document.body.appendChild(parentNode)\n\n // Remember width with no applied web font\n var width = node.offsetWidth\n node.style.fontFamily = trimFontOptions(font) + ', ' + family\n return { node: node, w: width, parent: parentNode }\n }\n\n function checkLoadedFonts() {\n var i\n var len = this.fonts.length\n var node\n var w\n var loadedCount = len\n for (i = 0; i < len; i += 1) {\n if (this.fonts[i].loaded) {\n loadedCount -= 1\n } else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {\n this.fonts[i].loaded = true\n } else {\n node = this.fonts[i].monoCase.node\n w = this.fonts[i].monoCase.w\n if (node.offsetWidth !== w) {\n loadedCount -= 1\n this.fonts[i].loaded = true\n } else {\n node = this.fonts[i].sansCase.node\n w = this.fonts[i].sansCase.w\n if (node.offsetWidth !== w) {\n loadedCount -= 1\n this.fonts[i].loaded = true\n }\n }\n if (this.fonts[i].loaded) {\n this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent)\n this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent)\n }\n }\n }\n\n if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {\n setTimeout(this.checkLoadedFontsBinded, 20)\n } else {\n setTimeout(this.setIsLoadedBinded, 10)\n }\n }\n\n function createHelper(fontData, def) {\n var engine = document.body && def ? 'svg' : 'canvas'\n var helper\n var fontProps = getFontProperties(fontData)\n if (engine === 'svg') {\n var tHelper = createNS('text')\n tHelper.style.fontSize = '100px'\n // tHelper.style.fontFamily = fontData.fFamily;\n tHelper.setAttribute('font-family', fontData.fFamily)\n tHelper.setAttribute('font-style', fontProps.style)\n tHelper.setAttribute('font-weight', fontProps.weight)\n tHelper.textContent = '1'\n if (fontData.fClass) {\n tHelper.style.fontFamily = 'inherit'\n tHelper.setAttribute('class', fontData.fClass)\n } else {\n tHelper.style.fontFamily = fontData.fFamily\n }\n def.appendChild(tHelper)\n helper = tHelper\n } else {\n var tCanvasHelper = new OffscreenCanvas(500, 500).getContext('2d')\n tCanvasHelper.font = fontProps.style + ' ' + fontProps.weight + ' 100px ' + fontData.fFamily\n helper = tCanvasHelper\n }\n function measure(text) {\n if (engine === 'svg') {\n helper.textContent = text\n return helper.getComputedTextLength()\n }\n return helper.measureText(text).width\n }\n return {\n measureText: measure,\n }\n }\n\n function addFonts(fontData, defs) {\n if (!fontData) {\n this.isLoaded = true\n return\n }\n if (this.chars) {\n this.isLoaded = true\n this.fonts = fontData.list\n return\n }\n if (!document.body) {\n this.isLoaded = true\n fontData.list.forEach((data) => {\n data.helper = createHelper(data)\n data.cache = {}\n })\n this.fonts = fontData.list\n return\n }\n\n var fontArr = fontData.list\n var i\n var len = fontArr.length\n var _pendingFonts = len\n for (i = 0; i < len; i += 1) {\n var shouldLoadFont = true\n var loadedSelector\n var j\n fontArr[i].loaded = false\n fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace')\n fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif')\n if (!fontArr[i].fPath) {\n fontArr[i].loaded = true\n _pendingFonts -= 1\n } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {\n loadedSelector = document.querySelectorAll(\n 'style[f-forigin=\"p\"][f-family=\"' +\n fontArr[i].fFamily +\n '\"], style[f-origin=\"3\"][f-family=\"' +\n fontArr[i].fFamily +\n '\"]',\n )\n\n if (loadedSelector.length > 0) {\n shouldLoadFont = false\n }\n\n if (shouldLoadFont) {\n var s = createTag('style')\n s.setAttribute('f-forigin', fontArr[i].fOrigin)\n s.setAttribute('f-origin', fontArr[i].origin)\n s.setAttribute('f-family', fontArr[i].fFamily)\n s.type = 'text/css'\n s.innerText =\n '@font-face {font-family: ' +\n fontArr[i].fFamily +\n \"; font-style: normal; src: url('\" +\n fontArr[i].fPath +\n \"');}\"\n defs.appendChild(s)\n }\n } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {\n loadedSelector = document.querySelectorAll('link[f-forigin=\"g\"], link[f-origin=\"1\"]')\n\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {\n // Font is already loaded\n shouldLoadFont = false\n }\n }\n\n if (shouldLoadFont) {\n var l = createTag('link')\n l.setAttribute('f-forigin', fontArr[i].fOrigin)\n l.setAttribute('f-origin', fontArr[i].origin)\n l.type = 'text/css'\n l.rel = 'stylesheet'\n l.href = fontArr[i].fPath\n document.body.appendChild(l)\n }\n } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {\n loadedSelector = document.querySelectorAll('script[f-forigin=\"t\"], script[f-origin=\"2\"]')\n\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (fontArr[i].fPath === loadedSelector[j].src) {\n // Font is already loaded\n shouldLoadFont = false\n }\n }\n\n if (shouldLoadFont) {\n var sc = createTag('link')\n sc.setAttribute('f-forigin', fontArr[i].fOrigin)\n sc.setAttribute('f-origin', fontArr[i].origin)\n sc.setAttribute('rel', 'stylesheet')\n sc.setAttribute('href', fontArr[i].fPath)\n defs.appendChild(sc)\n }\n }\n fontArr[i].helper = createHelper(fontArr[i], defs)\n fontArr[i].cache = {}\n this.fonts.push(fontArr[i])\n }\n if (_pendingFonts === 0) {\n this.isLoaded = true\n } else {\n // On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.\n // Adding this timeout seems to fix it\n setTimeout(this.checkLoadedFonts.bind(this), 100)\n }\n }\n\n function addChars(chars) {\n if (!chars) {\n return\n }\n if (!this.chars) {\n this.chars = []\n }\n var i\n var len = chars.length\n var j\n var jLen = this.chars.length\n var found\n for (i = 0; i < len; i += 1) {\n j = 0\n found = false\n while (j < jLen) {\n if (\n this.chars[j].style === chars[i].style &&\n this.chars[j].fFamily === chars[i].fFamily &&\n this.chars[j].ch === chars[i].ch\n ) {\n found = true\n }\n j += 1\n }\n if (!found) {\n this.chars.push(chars[i])\n jLen += 1\n }\n }\n }\n\n function getCharData(char, style, font) {\n var i = 0\n var len = this.chars.length\n while (i < len) {\n if (this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font) {\n return this.chars[i]\n }\n i += 1\n }\n if (\n ((typeof char === 'string' && char.charCodeAt(0) !== 13) || !char) &&\n console &&\n console.warn && // eslint-disable-line no-console\n !this._warned\n ) {\n this._warned = true\n console.warn('Missing character from exported characters list: ', char, style, font) // eslint-disable-line no-console\n }\n return emptyChar\n }\n\n function measureText(char, fontName, size) {\n var fontData = this.getFontByName(fontName)\n var index = char.charCodeAt(0)\n if (!fontData.cache[index + 1]) {\n var tHelper = fontData.helper\n if (char === ' ') {\n var doubleSize = tHelper.measureText('|' + char + '|')\n var singleSize = tHelper.measureText('||')\n fontData.cache[index + 1] = (doubleSize - singleSize) / 100\n } else {\n fontData.cache[index + 1] = tHelper.measureText(char) / 100\n }\n }\n return fontData.cache[index + 1] * size\n }\n\n function getFontByName(name) {\n var i = 0\n var len = this.fonts.length\n while (i < len) {\n if (this.fonts[i].fName === name) {\n return this.fonts[i]\n }\n i += 1\n }\n return this.fonts[0]\n }\n\n function isModifier(firstCharCode, secondCharCode) {\n var sum = firstCharCode.toString(16) + secondCharCode.toString(16)\n return surrogateModifiers.indexOf(sum) !== -1\n }\n\n function isZeroWidthJoiner(firstCharCode, secondCharCode) {\n if (!secondCharCode) {\n return firstCharCode === zeroWidthJoiner[1]\n }\n return firstCharCode === zeroWidthJoiner[0] && secondCharCode === zeroWidthJoiner[1]\n }\n\n function isCombinedCharacter(char) {\n return combinedCharacters.indexOf(char) !== -1\n }\n\n function setIsLoaded() {\n this.isLoaded = true\n }\n\n var Font = function () {\n this.fonts = []\n this.chars = null\n this.typekitLoaded = 0\n this.isLoaded = false\n this._warned = false\n this.initTime = Date.now()\n this.setIsLoadedBinded = this.setIsLoaded.bind(this)\n this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this)\n }\n Font.isModifier = isModifier\n Font.isZeroWidthJoiner = isZeroWidthJoiner\n Font.isCombinedCharacter = isCombinedCharacter\n\n var fontPrototype = {\n addChars: addChars,\n addFonts: addFonts,\n getCharData: getCharData,\n getFontByName: getFontByName,\n measureText: measureText,\n checkLoadedFonts: checkLoadedFonts,\n setIsLoaded: setIsLoaded,\n }\n\n Font.prototype = fontPrototype\n\n return Font\n })()\n\n function RenderableElement() {}\n\n RenderableElement.prototype = {\n initRenderable: function () {\n // layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange\n this.isInRange = false\n // layer's display state\n this.hidden = false\n // If layer's transparency equals 0, it can be hidden\n this.isTransparent = false\n // list of animated components\n this.renderableComponents = []\n },\n addRenderableComponent: function (component) {\n if (this.renderableComponents.indexOf(component) === -1) {\n this.renderableComponents.push(component)\n }\n },\n removeRenderableComponent: function (component) {\n if (this.renderableComponents.indexOf(component) !== -1) {\n this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1)\n }\n },\n prepareRenderableFrame: function (num) {\n this.checkLayerLimits(num)\n },\n checkTransparency: function () {\n if (this.finalTransform.mProp.o.v <= 0) {\n if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {\n this.isTransparent = true\n this.hide()\n }\n } else if (this.isTransparent) {\n this.isTransparent = false\n this.show()\n }\n },\n /**\n * @function\n * Initializes frame related properties.\n *\n * @param {number} num\n * current frame number in Layer's time\n *\n */\n checkLayerLimits: function (num) {\n if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {\n if (this.isInRange !== true) {\n this.globalData._mdf = true\n this._mdf = true\n this.isInRange = true\n this.show()\n }\n } else if (this.isInRange !== false) {\n this.globalData._mdf = true\n this.isInRange = false\n this.hide()\n }\n },\n renderRenderable: function () {\n var i\n var len = this.renderableComponents.length\n for (i = 0; i < len; i += 1) {\n this.renderableComponents[i].renderFrame(this._isFirstFrame)\n }\n /* this.maskManager.renderFrame(this.finalTransform.mat);\n this.renderableEffectsManager.renderFrame(this._isFirstFrame); */\n },\n sourceRectAtTime: function () {\n return {\n top: 0,\n left: 0,\n width: 100,\n height: 100,\n }\n },\n getLayerSize: function () {\n if (this.data.ty === 5) {\n return { w: this.data.textData.width, h: this.data.textData.height }\n }\n return { w: this.data.width, h: this.data.height }\n },\n }\n\n const MaskManagerInterface = (function () {\n function MaskInterface(mask, data) {\n this._mask = mask\n this._data = data\n }\n Object.defineProperty(MaskInterface.prototype, 'maskPath', {\n get: function () {\n if (this._mask.prop.k) {\n this._mask.prop.getValue()\n }\n return this._mask.prop\n },\n })\n Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {\n get: function () {\n if (this._mask.op.k) {\n this._mask.op.getValue()\n }\n return this._mask.op.v * 100\n },\n })\n\n var MaskManager = function (maskManager) {\n var _masksInterfaces = createSizedArray(maskManager.viewData.length)\n var i\n var len = maskManager.viewData.length\n for (i = 0; i < len; i += 1) {\n _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i])\n }\n\n var maskFunction = function (name) {\n i = 0\n while (i < len) {\n if (maskManager.masksProperties[i].nm === name) {\n return _masksInterfaces[i]\n }\n i += 1\n }\n return null\n }\n return maskFunction\n }\n return MaskManager\n })()\n\n const ExpressionPropertyInterface = (function () {\n var defaultUnidimensionalValue = { pv: 0, v: 0, mult: 1 }\n var defaultMultidimensionalValue = { pv: [0, 0, 0], v: [0, 0, 0], mult: 1 }\n\n function completeProperty(expressionValue, property, type) {\n Object.defineProperty(expressionValue, 'velocity', {\n get: function () {\n return property.getVelocityAtTime(property.comp.currentFrame)\n },\n })\n expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0\n expressionValue.key = function (pos) {\n if (!expressionValue.numKeys) {\n return 0\n }\n var value = ''\n if ('s' in property.keyframes[pos - 1]) {\n value = property.keyframes[pos - 1].s\n } else if ('e' in property.keyframes[pos - 2]) {\n value = property.keyframes[pos - 2].e\n } else {\n value = property.keyframes[pos - 2].s\n }\n var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value) // eslint-disable-line no-new-wrappers\n valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate\n valueProp.value = type === 'unidimensional' ? value[0] : value\n return valueProp\n }\n expressionValue.valueAtTime = property.getValueAtTime\n expressionValue.speedAtTime = property.getSpeedAtTime\n expressionValue.velocityAtTime = property.getVelocityAtTime\n expressionValue.propertyGroup = property.propertyGroup\n }\n\n function UnidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultUnidimensionalValue\n }\n var mult = 1 / property.mult\n var val = property.pv * mult\n var expressionValue = new Number(val) // eslint-disable-line no-new-wrappers\n expressionValue.value = val\n completeProperty(expressionValue, property, 'unidimensional')\n\n return function () {\n if (property.k) {\n property.getValue()\n }\n val = property.v * mult\n if (expressionValue.value !== val) {\n expressionValue = new Number(val) // eslint-disable-line no-new-wrappers\n expressionValue.value = val\n completeProperty(expressionValue, property, 'unidimensional')\n }\n return expressionValue\n }\n }\n\n function MultidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultMultidimensionalValue\n }\n var mult = 1 / property.mult\n var len = (property.data && property.data.l) || property.pv.length\n var expressionValue = createTypedArray('float32', len)\n var arrValue = createTypedArray('float32', len)\n expressionValue.value = arrValue\n completeProperty(expressionValue, property, 'multidimensional')\n\n return function () {\n if (property.k) {\n property.getValue()\n }\n for (var i = 0; i < len; i += 1) {\n arrValue[i] = property.v[i] * mult\n expressionValue[i] = arrValue[i]\n }\n return expressionValue\n }\n }\n\n // TODO: try to avoid using this getter\n function defaultGetter() {\n return defaultUnidimensionalValue\n }\n\n return function (property) {\n if (!property) {\n return defaultGetter\n }\n if (property.propType === 'unidimensional') {\n return UnidimensionalPropertyInterface(property)\n }\n return MultidimensionalPropertyInterface(property)\n }\n })()\n\n const TransformExpressionInterface = (function () {\n return function (transform) {\n function _thisFunction(name) {\n switch (name) {\n case 'scale':\n case 'Scale':\n case 'ADBE Scale':\n case 6:\n return _thisFunction.scale\n case 'rotation':\n case 'Rotation':\n case 'ADBE Rotation':\n case 'ADBE Rotate Z':\n case 10:\n return _thisFunction.rotation\n case 'ADBE Rotate X':\n return _thisFunction.xRotation\n case 'ADBE Rotate Y':\n return _thisFunction.yRotation\n case 'position':\n case 'Position':\n case 'ADBE Position':\n case 2:\n return _thisFunction.position\n case 'ADBE Position_0':\n return _thisFunction.xPosition\n case 'ADBE Position_1':\n return _thisFunction.yPosition\n case 'ADBE Position_2':\n return _thisFunction.zPosition\n case 'anchorPoint':\n case 'AnchorPoint':\n case 'Anchor Point':\n case 'ADBE AnchorPoint':\n case 1:\n return _thisFunction.anchorPoint\n case 'opacity':\n case 'Opacity':\n case 11:\n return _thisFunction.opacity\n default:\n return null\n }\n }\n Object.defineProperty(_thisFunction, 'rotation', {\n get: ExpressionPropertyInterface(transform.r || transform.rz),\n })\n\n Object.defineProperty(_thisFunction, 'zRotation', {\n get: ExpressionPropertyInterface(transform.rz || transform.r),\n })\n\n Object.defineProperty(_thisFunction, 'xRotation', {\n get: ExpressionPropertyInterface(transform.rx),\n })\n\n Object.defineProperty(_thisFunction, 'yRotation', {\n get: ExpressionPropertyInterface(transform.ry),\n })\n Object.defineProperty(_thisFunction, 'scale', {\n get: ExpressionPropertyInterface(transform.s),\n })\n var _px\n var _py\n var _pz\n var _transformFactory\n if (transform.p) {\n _transformFactory = ExpressionPropertyInterface(transform.p)\n } else {\n _px = ExpressionPropertyInterface(transform.px)\n _py = ExpressionPropertyInterface(transform.py)\n if (transform.pz) {\n _pz = ExpressionPropertyInterface(transform.pz)\n }\n }\n Object.defineProperty(_thisFunction, 'position', {\n get: function () {\n if (transform.p) {\n return _transformFactory()\n }\n return [_px(), _py(), _pz ? _pz() : 0]\n },\n })\n\n Object.defineProperty(_thisFunction, 'xPosition', {\n get: ExpressionPropertyInterface(transform.px),\n })\n\n Object.defineProperty(_thisFunction, 'yPosition', {\n get: ExpressionPropertyInterface(transform.py),\n })\n\n Object.defineProperty(_thisFunction, 'zPosition', {\n get: ExpressionPropertyInterface(transform.pz),\n })\n\n Object.defineProperty(_thisFunction, 'anchorPoint', {\n get: ExpressionPropertyInterface(transform.a),\n })\n\n Object.defineProperty(_thisFunction, 'opacity', {\n get: ExpressionPropertyInterface(transform.o),\n })\n\n Object.defineProperty(_thisFunction, 'skew', {\n get: ExpressionPropertyInterface(transform.sk),\n })\n\n Object.defineProperty(_thisFunction, 'skewAxis', {\n get: ExpressionPropertyInterface(transform.sa),\n })\n\n Object.defineProperty(_thisFunction, 'orientation', {\n get: ExpressionPropertyInterface(transform.or),\n })\n\n return _thisFunction\n }\n })()\n\n const LayerExpressionInterface = (function () {\n function getMatrix(time) {\n var toWorldMat = new Matrix()\n if (time !== undefined) {\n var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time)\n propMatrix.clone(toWorldMat)\n } else {\n var transformMat = this._elem.finalTransform.mProp\n transformMat.applyToMatrix(toWorldMat)\n }\n return toWorldMat\n }\n\n function toWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time)\n toWorldMat.props[12] = 0\n toWorldMat.props[13] = 0\n toWorldMat.props[14] = 0\n return this.applyPoint(toWorldMat, arr)\n }\n\n function toWorld(arr, time) {\n var toWorldMat = this.getMatrix(time)\n return this.applyPoint(toWorldMat, arr)\n }\n\n function fromWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time)\n toWorldMat.props[12] = 0\n toWorldMat.props[13] = 0\n toWorldMat.props[14] = 0\n return this.invertPoint(toWorldMat, arr)\n }\n\n function fromWorld(arr, time) {\n var toWorldMat = this.getMatrix(time)\n return this.invertPoint(toWorldMat, arr)\n }\n\n function applyPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i\n var len = this._elem.hierarchy.length\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix)\n }\n }\n return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0)\n }\n\n function invertPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i\n var len = this._elem.hierarchy.length\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix)\n }\n }\n return matrix.inversePoint(arr)\n }\n\n function fromComp(arr) {\n var toWorldMat = new Matrix()\n toWorldMat.reset()\n this._elem.finalTransform.mProp.applyToMatrix(toWorldMat)\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i\n var len = this._elem.hierarchy.length\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat)\n }\n return toWorldMat.inversePoint(arr)\n }\n return toWorldMat.inversePoint(arr)\n }\n\n function sampleImage() {\n return [1, 1, 1, 1]\n }\n\n return function (elem) {\n var transformInterface\n\n function _registerMaskInterface(maskManager) {\n _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem)\n }\n function _registerEffectsInterface(effects) {\n _thisLayerFunction.effect = effects\n }\n\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Root Vectors Group':\n case 'Contents':\n case 2:\n return _thisLayerFunction.shapeInterface\n case 1:\n case 6:\n case 'Transform':\n case 'transform':\n case 'ADBE Transform Group':\n return transformInterface\n case 4:\n case 'ADBE Effect Parade':\n case 'effects':\n case 'Effects':\n return _thisLayerFunction.effect\n case 'ADBE Text Properties':\n return _thisLayerFunction.textInterface\n default:\n return null\n }\n }\n _thisLayerFunction.getMatrix = getMatrix\n _thisLayerFunction.invertPoint = invertPoint\n _thisLayerFunction.applyPoint = applyPoint\n _thisLayerFunction.toWorld = toWorld\n _thisLayerFunction.toWorldVec = toWorldVec\n _thisLayerFunction.fromWorld = fromWorld\n _thisLayerFunction.fromWorldVec = fromWorldVec\n _thisLayerFunction.toComp = toWorld\n _thisLayerFunction.fromComp = fromComp\n _thisLayerFunction.sampleImage = sampleImage\n _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem)\n _thisLayerFunction._elem = elem\n transformInterface = TransformExpressionInterface(elem.finalTransform.mProp)\n var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint')\n Object.defineProperties(_thisLayerFunction, {\n hasParent: {\n get: function () {\n return elem.hierarchy.length\n },\n },\n parent: {\n get: function () {\n return elem.hierarchy[0].layerInterface\n },\n },\n rotation: getDescriptor(transformInterface, 'rotation'),\n scale: getDescriptor(transformInterface, 'scale'),\n position: getDescriptor(transformInterface, 'position'),\n opacity: getDescriptor(transformInterface, 'opacity'),\n anchorPoint: anchorPointDescriptor,\n anchor_point: anchorPointDescriptor,\n transform: {\n get: function () {\n return transformInterface\n },\n },\n active: {\n get: function () {\n return elem.isInRange\n },\n },\n })\n\n _thisLayerFunction.startTime = elem.data.st\n _thisLayerFunction.index = elem.data.ind\n _thisLayerFunction.source = elem.data.refId\n _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100\n _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100\n _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate\n _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate\n _thisLayerFunction._name = elem.data.nm\n\n _thisLayerFunction.registerMaskInterface = _registerMaskInterface\n _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface\n return _thisLayerFunction\n }\n })()\n\n const propertyGroupFactory = (function () {\n return function (interfaceFunction, parentPropertyGroup) {\n return function (val) {\n val = val === undefined ? 1 : val\n if (val <= 0) {\n return interfaceFunction\n }\n return parentPropertyGroup(val - 1)\n }\n }\n })()\n\n const PropertyInterface = (function () {\n return function (propertyName, propertyGroup) {\n var interfaceFunction = {\n _name: propertyName,\n }\n\n function _propertyGroup(val) {\n val = val === undefined ? 1 : val\n if (val <= 0) {\n return interfaceFunction\n }\n return propertyGroup(val - 1)\n }\n\n return _propertyGroup\n }\n })()\n\n const EffectsExpressionInterface = (function () {\n var ob = {\n createEffectsInterface: createEffectsInterface,\n }\n\n function createEffectsInterface(elem, propertyGroup) {\n if (elem.effectsManager) {\n var effectElements = []\n var effectsData = elem.data.ef\n var i\n var len = elem.effectsManager.effectElements.length\n for (i = 0; i < len; i += 1) {\n effectElements.push(\n createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem),\n )\n }\n\n var effects = elem.data.ef || []\n var groupInterface = function (name) {\n i = 0\n len = effects.length\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n return effectElements[i]\n }\n i += 1\n }\n return null\n }\n Object.defineProperty(groupInterface, 'numProperties', {\n get: function () {\n return effects.length\n },\n })\n return groupInterface\n }\n return null\n }\n\n function createGroupInterface(data, elements, propertyGroup, elem) {\n function groupInterface(name) {\n var effects = data.ef\n var i = 0\n var len = effects.length\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n if (effects[i].ty === 5) {\n return effectElements[i]\n }\n return effectElements[i]()\n }\n i += 1\n }\n throw new Error()\n }\n var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup)\n\n var effectElements = []\n var i\n var len = data.ef.length\n for (i = 0; i < len; i += 1) {\n if (data.ef[i].ty === 5) {\n effectElements.push(\n createGroupInterface(\n data.ef[i],\n elements.effectElements[i],\n elements.effectElements[i].propertyGroup,\n elem,\n ),\n )\n } else {\n effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup))\n }\n }\n\n if (data.mn === 'ADBE Color Control') {\n Object.defineProperty(groupInterface, 'color', {\n get: function () {\n return effectElements[0]()\n },\n })\n }\n Object.defineProperties(groupInterface, {\n numProperties: {\n get: function () {\n return data.np\n },\n },\n _name: { value: data.nm },\n propertyGroup: { value: _propertyGroup },\n })\n groupInterface.enabled = data.en !== 0\n groupInterface.active = groupInterface.enabled\n return groupInterface\n }\n\n function createValueInterface(element, type, elem, propertyGroup) {\n var expressionProperty = ExpressionPropertyInterface(element.p)\n function interfaceFunction() {\n if (type === 10) {\n return elem.comp.compInterface(element.p.v)\n }\n return expressionProperty()\n }\n\n if (element.p.setGroupProperty) {\n element.p.setGroupProperty(PropertyInterface('', propertyGroup))\n }\n\n return interfaceFunction\n }\n\n return ob\n })()\n\n const CompExpressionInterface = (function () {\n return function (comp) {\n function _thisLayerFunction(name) {\n var i = 0\n var len = comp.layers.length\n while (i < len) {\n if (comp.layers[i].nm === name || comp.layers[i].ind === name) {\n return comp.elements[i].layerInterface\n }\n i += 1\n }\n return null\n // return {active:false};\n }\n Object.defineProperty(_thisLayerFunction, '_name', { value: comp.data.nm })\n _thisLayerFunction.layer = _thisLayerFunction\n _thisLayerFunction.pixelAspect = 1\n _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h\n _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w\n _thisLayerFunction.pixelAspect = 1\n _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate\n _thisLayerFunction.displayStartTime = 0\n _thisLayerFunction.numLayers = comp.layers.length\n return _thisLayerFunction\n }\n })()\n\n const ShapePathInterface = (function () {\n return function pathInterfaceFactory(shape, view, propertyGroup) {\n var prop = view.sh\n\n function interfaceFunction(val) {\n if (\n val === 'Shape' ||\n val === 'shape' ||\n val === 'Path' ||\n val === 'path' ||\n val === 'ADBE Vector Shape' ||\n val === 2\n ) {\n return interfaceFunction.path\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n prop.setGroupProperty(PropertyInterface('Path', _propertyGroup))\n Object.defineProperties(interfaceFunction, {\n path: {\n get: function () {\n if (prop.k) {\n prop.getValue()\n }\n return prop\n },\n },\n shape: {\n get: function () {\n if (prop.k) {\n prop.getValue()\n }\n return prop\n },\n },\n _name: { value: shape.nm },\n ix: { value: shape.ix },\n propertyIndex: { value: shape.ix },\n mn: { value: shape.mn },\n propertyGroup: { value: propertyGroup },\n })\n return interfaceFunction\n }\n })()\n\n const ShapeExpressionInterface = (function () {\n function iterateElements(shapes, view, propertyGroup) {\n var arr = []\n var i\n var len = shapes ? shapes.length : 0\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'fl') {\n arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'st') {\n arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'tm') {\n arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'tr') {\n // arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));\n } else if (shapes[i].ty === 'el') {\n arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'sr') {\n arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'sh') {\n arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'rc') {\n arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'rd') {\n arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'rp') {\n arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else if (shapes[i].ty === 'gf') {\n arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup))\n } else {\n arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup))\n }\n }\n return arr\n }\n\n function contentsInterfaceFactory(shape, view, propertyGroup) {\n var interfaces\n var interfaceFunction = function _interfaceFunction(value) {\n var i = 0\n var len = interfaces.length\n while (i < len) {\n if (\n interfaces[i]._name === value ||\n interfaces[i].mn === value ||\n interfaces[i].propertyIndex === value ||\n interfaces[i].ix === value ||\n interfaces[i].ind === value\n ) {\n return interfaces[i]\n }\n i += 1\n }\n if (typeof value === 'number') {\n return interfaces[value - 1]\n }\n return null\n }\n\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup)\n interfaceFunction.numProperties = interfaces.length\n var transformInterface = transformInterfaceFactory(\n shape.it[shape.it.length - 1],\n view.it[view.it.length - 1],\n interfaceFunction.propertyGroup,\n )\n interfaceFunction.transform = transformInterface\n interfaceFunction.propertyIndex = shape.cix\n interfaceFunction._name = shape.nm\n\n return interfaceFunction\n }\n\n function groupInterfaceFactory(shape, view, propertyGroup) {\n var interfaceFunction = function _interfaceFunction(value) {\n switch (value) {\n case 'ADBE Vectors Group':\n case 'Contents':\n case 2:\n return interfaceFunction.content\n // Not necessary for now. Keeping them here in case a new case appears\n // case 'ADBE Vector Transform Group':\n // case 3:\n default:\n return interfaceFunction.transform\n }\n }\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup)\n var transformInterface = transformInterfaceFactory(\n shape.it[shape.it.length - 1],\n view.it[view.it.length - 1],\n interfaceFunction.propertyGroup,\n )\n interfaceFunction.content = content\n interfaceFunction.transform = transformInterface\n Object.defineProperty(interfaceFunction, '_name', {\n get: function () {\n return shape.nm\n },\n })\n // interfaceFunction.content = interfaceFunction;\n interfaceFunction.numProperties = shape.np\n interfaceFunction.propertyIndex = shape.ix\n interfaceFunction.nm = shape.nm\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function fillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity\n }\n return null\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c),\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o),\n },\n _name: { value: shape.nm },\n mn: { value: shape.mn },\n })\n\n view.c.setGroupProperty(PropertyInterface('Color', propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup))\n return interfaceFunction\n }\n\n function gradientFillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Start Point' || val === 'start point') {\n return interfaceFunction.startPoint\n }\n if (val === 'End Point' || val === 'end point') {\n return interfaceFunction.endPoint\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity\n }\n return null\n }\n Object.defineProperties(interfaceFunction, {\n startPoint: {\n get: ExpressionPropertyInterface(view.s),\n },\n endPoint: {\n get: ExpressionPropertyInterface(view.e),\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o),\n },\n type: {\n get: function () {\n return 'a'\n },\n },\n _name: { value: shape.nm },\n mn: { value: shape.mn },\n })\n\n view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup))\n view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup))\n return interfaceFunction\n }\n function defaultInterfaceFactory() {\n function interfaceFunction() {\n return null\n }\n return interfaceFunction\n }\n\n function strokeInterfaceFactory(shape, view, propertyGroup) {\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup)\n function addPropertyToDashOb(i) {\n Object.defineProperty(dashOb, shape.d[i].nm, {\n get: ExpressionPropertyInterface(view.d.dataProps[i].p),\n })\n }\n var i\n var len = shape.d ? shape.d.length : 0\n var dashOb = {}\n for (i = 0; i < len; i += 1) {\n addPropertyToDashOb(i)\n view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup)\n }\n\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity\n }\n if (val === 'Stroke Width' || val === 'stroke width') {\n return interfaceFunction.strokeWidth\n }\n return null\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c),\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o),\n },\n strokeWidth: {\n get: ExpressionPropertyInterface(view.w),\n },\n dash: {\n get: function () {\n return dashOb\n },\n },\n _name: { value: shape.nm },\n mn: { value: shape.mn },\n })\n\n view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup))\n view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup))\n return interfaceFunction\n }\n\n function trimInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === shape.e.ix || val === 'End' || val === 'end') {\n return interfaceFunction.end\n }\n if (val === shape.s.ix) {\n return interfaceFunction.start\n }\n if (val === shape.o.ix) {\n return interfaceFunction.offset\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n interfaceFunction.propertyIndex = shape.ix\n\n view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup))\n view.e.setGroupProperty(PropertyInterface('End', _propertyGroup))\n view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup))\n interfaceFunction.propertyIndex = shape.ix\n interfaceFunction.propertyGroup = propertyGroup\n\n Object.defineProperties(interfaceFunction, {\n start: {\n get: ExpressionPropertyInterface(view.s),\n },\n end: {\n get: ExpressionPropertyInterface(view.e),\n },\n offset: {\n get: ExpressionPropertyInterface(view.o),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function transformInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.a.ix === value || value === 'Anchor Point') {\n return interfaceFunction.anchorPoint\n }\n if (shape.o.ix === value || value === 'Opacity') {\n return interfaceFunction.opacity\n }\n if (shape.p.ix === value || value === 'Position') {\n return interfaceFunction.position\n }\n if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {\n return interfaceFunction.rotation\n }\n if (shape.s.ix === value || value === 'Scale') {\n return interfaceFunction.scale\n }\n if ((shape.sk && shape.sk.ix === value) || value === 'Skew') {\n return interfaceFunction.skew\n }\n if ((shape.sa && shape.sa.ix === value) || value === 'Skew Axis') {\n return interfaceFunction.skewAxis\n }\n return null\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup))\n view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup))\n view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup))\n view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup))\n if (view.transform.mProps.sk) {\n view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup))\n view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup))\n }\n view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup))\n Object.defineProperties(interfaceFunction, {\n opacity: {\n get: ExpressionPropertyInterface(view.transform.mProps.o),\n },\n position: {\n get: ExpressionPropertyInterface(view.transform.mProps.p),\n },\n anchorPoint: {\n get: ExpressionPropertyInterface(view.transform.mProps.a),\n },\n scale: {\n get: ExpressionPropertyInterface(view.transform.mProps.s),\n },\n rotation: {\n get: ExpressionPropertyInterface(view.transform.mProps.r),\n },\n skew: {\n get: ExpressionPropertyInterface(view.transform.mProps.sk),\n },\n skewAxis: {\n get: ExpressionPropertyInterface(view.transform.mProps.sa),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.ty = 'tr'\n interfaceFunction.mn = shape.mn\n interfaceFunction.propertyGroup = propertyGroup\n return interfaceFunction\n }\n\n function ellipseInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position\n }\n if (shape.s.ix === value) {\n return interfaceFunction.size\n }\n return null\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n interfaceFunction.propertyIndex = shape.ix\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup))\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n\n Object.defineProperties(interfaceFunction, {\n size: {\n get: ExpressionPropertyInterface(prop.s),\n },\n position: {\n get: ExpressionPropertyInterface(prop.p),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function starInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position\n }\n if (shape.r.ix === value) {\n return interfaceFunction.rotation\n }\n if (shape.pt.ix === value) {\n return interfaceFunction.points\n }\n if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') {\n return interfaceFunction.outerRadius\n }\n if (shape.os.ix === value) {\n return interfaceFunction.outerRoundness\n }\n if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) {\n return interfaceFunction.innerRadius\n }\n if (shape.is && shape.is.ix === value) {\n return interfaceFunction.innerRoundness\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh\n interfaceFunction.propertyIndex = shape.ix\n prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup))\n prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup))\n prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup))\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup))\n if (shape.ir) {\n prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup))\n prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup))\n }\n\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p),\n },\n rotation: {\n get: ExpressionPropertyInterface(prop.r),\n },\n points: {\n get: ExpressionPropertyInterface(prop.pt),\n },\n outerRadius: {\n get: ExpressionPropertyInterface(prop.or),\n },\n outerRoundness: {\n get: ExpressionPropertyInterface(prop.os),\n },\n innerRadius: {\n get: ExpressionPropertyInterface(prop.ir),\n },\n innerRoundness: {\n get: ExpressionPropertyInterface(prop.is),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function rectInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position\n }\n if (shape.r.ix === value) {\n return interfaceFunction.roundness\n }\n if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {\n return interfaceFunction.size\n }\n return null\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh\n interfaceFunction.propertyIndex = shape.ix\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup))\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup))\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup))\n\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p),\n },\n roundness: {\n get: ExpressionPropertyInterface(prop.r),\n },\n size: {\n get: ExpressionPropertyInterface(prop.s),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function roundedInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.r.ix === value || value === 'Round Corners 1') {\n return interfaceFunction.radius\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var prop = view\n interfaceFunction.propertyIndex = shape.ix\n prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup))\n\n Object.defineProperties(interfaceFunction, {\n radius: {\n get: ExpressionPropertyInterface(prop.rd),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n function repeaterInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.c.ix === value || value === 'Copies') {\n return interfaceFunction.copies\n }\n if (shape.o.ix === value || value === 'Offset') {\n return interfaceFunction.offset\n }\n return null\n }\n\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup)\n var prop = view\n interfaceFunction.propertyIndex = shape.ix\n prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup))\n prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup))\n Object.defineProperties(interfaceFunction, {\n copies: {\n get: ExpressionPropertyInterface(prop.c),\n },\n offset: {\n get: ExpressionPropertyInterface(prop.o),\n },\n _name: { value: shape.nm },\n })\n interfaceFunction.mn = shape.mn\n return interfaceFunction\n }\n\n return function (shapes, view, propertyGroup) {\n var interfaces\n function _interfaceFunction(value) {\n if (typeof value === 'number') {\n value = value === undefined ? 1 : value\n if (value === 0) {\n return propertyGroup\n }\n return interfaces[value - 1]\n }\n var i = 0\n var len = interfaces.length\n while (i < len) {\n if (interfaces[i]._name === value) {\n return interfaces[i]\n }\n i += 1\n }\n return null\n }\n function parentGroupWrapper() {\n return propertyGroup\n }\n _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper)\n interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup)\n _interfaceFunction.numProperties = interfaces.length\n _interfaceFunction._name = 'Contents'\n return _interfaceFunction\n }\n })()\n\n const TextExpressionInterface = (function () {\n return function (elem) {\n var _prevValue\n var _sourceText\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Text Document':\n return _thisLayerFunction.sourceText\n default:\n return null\n }\n }\n Object.defineProperty(_thisLayerFunction, 'sourceText', {\n get: function () {\n elem.textProperty.getValue()\n var stringValue = elem.textProperty.currentData.t\n if (stringValue !== _prevValue) {\n elem.textProperty.currentData.t = _prevValue\n _sourceText = new String(stringValue) // eslint-disable-line no-new-wrappers\n // If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive\n _sourceText.value = stringValue || new String(stringValue) // eslint-disable-line no-new-wrappers\n }\n return _sourceText\n },\n })\n return _thisLayerFunction\n }\n })()\n\n const getBlendMode = (function () {\n var blendModeEnums = {\n 0: 'source-over',\n 1: 'multiply',\n 2: 'screen',\n 3: 'overlay',\n 4: 'darken',\n 5: 'lighten',\n 6: 'color-dodge',\n 7: 'color-burn',\n 8: 'hard-light',\n 9: 'soft-light',\n 10: 'difference',\n 11: 'exclusion',\n 12: 'hue',\n 13: 'saturation',\n 14: 'color',\n 15: 'luminosity',\n }\n\n return function (mode) {\n return blendModeEnums[mode] || ''\n }\n })()\n\n function SliderEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function AngleEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function ColorEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container)\n }\n function PointEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container)\n }\n function LayerIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function MaskIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function CheckboxEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container)\n }\n function NoValueEffect() {\n this.p = {}\n }\n\n function EffectsManager(data, element) {\n var effects = data.ef || []\n this.effectElements = []\n var i\n var len = effects.length\n var effectItem\n for (i = 0; i < len; i += 1) {\n effectItem = new GroupEffect(effects[i], element)\n this.effectElements.push(effectItem)\n }\n }\n\n function GroupEffect(data, element) {\n this.init(data, element)\n }\n\n extendPrototype([DynamicPropertyContainer], GroupEffect)\n\n GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties\n\n GroupEffect.prototype.init = function (data, element) {\n this.data = data\n this.effectElements = []\n this.initDynamicPropertyContainer(element)\n var i\n var len = this.data.ef.length\n var eff\n var effects = this.data.ef\n for (i = 0; i < len; i += 1) {\n eff = null\n switch (effects[i].ty) {\n case 0:\n eff = new SliderEffect(effects[i], element, this)\n break\n case 1:\n eff = new AngleEffect(effects[i], element, this)\n break\n case 2:\n eff = new ColorEffect(effects[i], element, this)\n break\n case 3:\n eff = new PointEffect(effects[i], element, this)\n break\n case 4:\n case 7:\n eff = new CheckboxEffect(effects[i], element, this)\n break\n case 10:\n eff = new LayerIndexEffect(effects[i], element, this)\n break\n case 11:\n eff = new MaskIndexEffect(effects[i], element, this)\n break\n case 5:\n eff = new EffectsManager(effects[i], element, this)\n break\n // case 6:\n default:\n eff = new NoValueEffect(effects[i], element, this)\n break\n }\n if (eff) {\n this.effectElements.push(eff)\n }\n }\n }\n\n function BaseElement() {}\n\n BaseElement.prototype = {\n checkMasks: function () {\n if (!this.data.hasMask) {\n return false\n }\n var i = 0\n var len = this.data.masksProperties.length\n while (i < len) {\n if (this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false) {\n return true\n }\n i += 1\n }\n return false\n },\n initExpressions: function () {\n this.layerInterface = LayerExpressionInterface(this)\n if (this.data.hasMask && this.maskManager) {\n this.layerInterface.registerMaskInterface(this.maskManager)\n }\n var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface)\n this.layerInterface.registerEffectsInterface(effectsInterface)\n\n if (this.data.ty === 0 || this.data.xt) {\n this.compInterface = CompExpressionInterface(this)\n } else if (this.data.ty === 4) {\n this.layerInterface.shapeInterface = ShapeExpressionInterface(\n this.shapesData,\n this.itemsData,\n this.layerInterface,\n )\n this.layerInterface.content = this.layerInterface.shapeInterface\n } else if (this.data.ty === 5) {\n this.layerInterface.textInterface = TextExpressionInterface(this)\n this.layerInterface.text = this.layerInterface.textInterface\n }\n },\n setBlendMode: function () {\n var blendModeValue = getBlendMode(this.data.bm)\n var elem = this.baseElement || this.layerElement\n\n elem.style['mix-blend-mode'] = blendModeValue\n },\n initBaseData: function (data, globalData, comp) {\n this.globalData = globalData\n this.comp = comp\n this.data = data\n this.layerId = createElementID()\n\n // Stretch factor for old animations missing this property.\n if (!this.data.sr) {\n this.data.sr = 1\n }\n // effects manager\n this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties)\n },\n getType: function () {\n return this.type\n },\n sourceRectAtTime: function () {},\n }\n\n /**\n * @file\n * Handles element's layer frame update.\n * Checks layer in point and out point\n *\n */\n\n function FrameElement() {}\n\n FrameElement.prototype = {\n /**\n * @function\n * Initializes frame related properties.\n *\n */\n initFrame: function () {\n // set to true when inpoint is rendered\n this._isFirstFrame = false\n // list of animated properties\n this.dynamicProperties = []\n // If layer has been modified in current tick this will be true\n this._mdf = false\n },\n /**\n * @function\n * Calculates all dynamic values\n *\n * @param {number} num\n * current frame number in Layer's time\n * @param {boolean} isVisible\n * if layers is currently in range\n *\n */\n prepareProperties: function (num, isVisible) {\n var i\n var len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {\n this.dynamicProperties[i].getValue()\n if (this.dynamicProperties[i]._mdf) {\n this.globalData._mdf = true\n this._mdf = true\n }\n }\n }\n },\n addDynamicProperty: function (prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop)\n }\n },\n }\n\n const FootageInterface = (function () {\n var outlineInterfaceFactory = function (elem) {\n var currentPropertyName = ''\n var currentProperty = elem.getFootageData()\n function init() {\n currentPropertyName = ''\n currentProperty = elem.getFootageData()\n return searchProperty\n }\n function searchProperty(value) {\n if (currentProperty[value]) {\n currentPropertyName = value\n currentProperty = currentProperty[value]\n if (typeof currentProperty === 'object') {\n return searchProperty\n }\n return currentProperty\n }\n var propertyNameIndex = value.indexOf(currentPropertyName)\n if (propertyNameIndex !== -1) {\n var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10)\n currentProperty = currentProperty[index]\n if (typeof currentProperty === 'object') {\n return searchProperty\n }\n return currentProperty\n }\n return ''\n }\n return init\n }\n\n var dataInterfaceFactory = function (elem) {\n function interfaceFunction(value) {\n if (value === 'Outline') {\n return interfaceFunction.outlineInterface()\n }\n return null\n }\n\n interfaceFunction._name = 'Outline'\n interfaceFunction.outlineInterface = outlineInterfaceFactory(elem)\n return interfaceFunction\n }\n\n return function (elem) {\n function _interfaceFunction(value) {\n if (value === 'Data') {\n return _interfaceFunction.dataInterface\n }\n return null\n }\n\n _interfaceFunction._name = 'Data'\n _interfaceFunction.dataInterface = dataInterfaceFactory(elem)\n return _interfaceFunction\n }\n })()\n\n function FootageElement(data, globalData, comp) {\n this.initFrame()\n this.initRenderable()\n this.assetData = globalData.getAssetData(data.refId)\n this.footageData = globalData.imageLoader.getAsset(this.assetData)\n this.initBaseData(data, globalData, comp)\n }\n\n FootageElement.prototype.prepareFrame = function () {}\n\n extendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement)\n\n FootageElement.prototype.getBaseElement = function () {\n return null\n }\n\n FootageElement.prototype.renderFrame = function () {}\n\n FootageElement.prototype.destroy = function () {}\n\n FootageElement.prototype.initExpressions = function () {\n this.layerInterface = FootageInterface(this)\n }\n\n FootageElement.prototype.getFootageData = function () {\n return this.footageData\n }\n\n function AudioElement(data, globalData, comp) {\n this.initFrame()\n this.initRenderable()\n this.assetData = globalData.getAssetData(data.refId)\n this.initBaseData(data, globalData, comp)\n this._isPlaying = false\n this._canPlay = false\n var assetPath = this.globalData.getAssetsPath(this.assetData)\n this.audio = this.globalData.audioController.createAudio(assetPath)\n this._currentTime = 0\n this.globalData.audioController.addAudio(this)\n this._volumeMultiplier = 1\n this._volume = 1\n this._previousVolume = null\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }\n this.lv = PropertyFactory.getProp(this, data.au && data.au.lv ? data.au.lv : { k: [100] }, 1, 0.01, this)\n }\n\n AudioElement.prototype.prepareFrame = function (num) {\n this.prepareRenderableFrame(num, true)\n this.prepareProperties(num, true)\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v\n this._currentTime = timeRemapped\n } else {\n this._currentTime = num / this.data.sr\n }\n this._volume = this.lv.v[0]\n var totalVolume = this._volume * this._volumeMultiplier\n if (this._previousVolume !== totalVolume) {\n this._previousVolume = totalVolume\n this.audio.volume(totalVolume)\n }\n }\n\n extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement)\n\n AudioElement.prototype.renderFrame = function () {\n if (this.isInRange && this._canPlay) {\n if (!this._isPlaying) {\n this.audio.play()\n this.audio.seek(this._currentTime / this.globalData.frameRate)\n this._isPlaying = true\n } else if (\n !this.audio.playing() ||\n Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1\n ) {\n this.audio.seek(this._currentTime / this.globalData.frameRate)\n }\n }\n }\n\n AudioElement.prototype.show = function () {\n // this.audio.play()\n }\n\n AudioElement.prototype.hide = function () {\n this.audio.pause()\n this._isPlaying = false\n }\n\n AudioElement.prototype.pause = function () {\n this.audio.pause()\n this._isPlaying = false\n this._canPlay = false\n }\n\n AudioElement.prototype.resume = function () {\n this._canPlay = true\n }\n\n AudioElement.prototype.setRate = function (rateValue) {\n this.audio.rate(rateValue)\n }\n\n AudioElement.prototype.volume = function (volumeValue) {\n this._volumeMultiplier = volumeValue\n this._previousVolume = volumeValue * this._volume\n this.audio.volume(this._previousVolume)\n }\n\n AudioElement.prototype.getBaseElement = function () {\n return null\n }\n\n AudioElement.prototype.destroy = function () {}\n\n AudioElement.prototype.sourceRectAtTime = function () {}\n\n AudioElement.prototype.initExpressions = function () {}\n\n function BaseRenderer() {}\n BaseRenderer.prototype.checkLayers = function (num) {\n var i\n var len = this.layers.length\n var data\n this.completeLayers = true\n for (i = len - 1; i >= 0; i -= 1) {\n if (!this.elements[i]) {\n data = this.layers[i]\n if (data.ip - data.st <= num - this.layers[i].st && data.op - data.st > num - this.layers[i].st) {\n this.buildItem(i)\n }\n }\n this.completeLayers = this.elements[i] ? this.completeLayers : false\n }\n this.checkPendingElements()\n }\n\n BaseRenderer.prototype.createItem = function (layer) {\n switch (layer.ty) {\n case 2:\n return this.createImage(layer)\n case 0:\n return this.createComp(layer)\n case 1:\n return this.createSolid(layer)\n case 3:\n return this.createNull(layer)\n case 4:\n return this.createShape(layer)\n case 5:\n return this.createText(layer)\n case 6:\n return this.createAudio(layer)\n case 13:\n return this.createCamera(layer)\n case 15:\n return this.createFootage(layer)\n default:\n return this.createNull(layer)\n }\n }\n\n BaseRenderer.prototype.createCamera = function () {\n throw new Error(\"You're using a 3d camera. Try the html renderer.\")\n }\n\n BaseRenderer.prototype.createAudio = function (data) {\n return new AudioElement(data, this.globalData, this)\n }\n\n BaseRenderer.prototype.createFootage = function (data) {\n return new FootageElement(data, this.globalData, this)\n }\n\n BaseRenderer.prototype.buildAllItems = function () {\n var i\n var len = this.layers.length\n for (i = 0; i < len; i += 1) {\n this.buildItem(i)\n }\n this.checkPendingElements()\n }\n\n BaseRenderer.prototype.includeLayers = function (newLayers) {\n this.completeLayers = false\n var i\n var len = newLayers.length\n var j\n var jLen = this.layers.length\n for (i = 0; i < len; i += 1) {\n j = 0\n while (j < jLen) {\n if (this.layers[j].id === newLayers[i].id) {\n this.layers[j] = newLayers[i]\n break\n }\n j += 1\n }\n }\n }\n\n BaseRenderer.prototype.setProjectInterface = function (pInterface) {\n this.globalData.projectInterface = pInterface\n }\n\n BaseRenderer.prototype.initItems = function () {\n if (!this.globalData.progressiveLoad) {\n this.buildAllItems()\n }\n }\n BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {\n var elements = this.elements\n var layers = this.layers\n var i = 0\n var len = layers.length\n while (i < len) {\n if (layers[i].ind == parentName) {\n // eslint-disable-line eqeqeq\n if (!elements[i] || elements[i] === true) {\n this.buildItem(i)\n this.addPendingElement(element)\n } else {\n hierarchy.push(elements[i])\n elements[i].setAsParent()\n if (layers[i].parent !== undefined) {\n this.buildElementParenting(element, layers[i].parent, hierarchy)\n } else {\n element.setHierarchy(hierarchy)\n }\n }\n }\n i += 1\n }\n }\n\n BaseRenderer.prototype.addPendingElement = function (element) {\n this.pendingElements.push(element)\n }\n\n BaseRenderer.prototype.searchExtraCompositions = function (assets) {\n var i\n var len = assets.length\n for (i = 0; i < len; i += 1) {\n if (assets[i].xt) {\n var comp = this.createComp(assets[i])\n comp.initExpressions()\n this.globalData.projectInterface.registerComposition(comp)\n }\n }\n }\n\n BaseRenderer.prototype.getElementByPath = function (path) {\n var pathValue = path.shift()\n var element\n if (typeof pathValue === 'number') {\n element = this.elements[pathValue]\n } else {\n var i\n var len = this.elements.length\n for (i = 0; i < len; i += 1) {\n if (this.elements[i].data.nm === pathValue) {\n element = this.elements[i]\n break\n }\n }\n }\n if (path.length === 0) {\n return element\n }\n return element.getElementByPath(path)\n }\n\n BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {\n this.globalData.fontManager = new FontManager()\n this.globalData.fontManager.addChars(animData.chars)\n this.globalData.fontManager.addFonts(animData.fonts, fontsContainer)\n this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem)\n this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem)\n this.globalData.imageLoader = this.animationItem.imagePreloader\n this.globalData.audioController = this.animationItem.audioController\n this.globalData.frameId = 0\n this.globalData.frameRate = animData.fr\n this.globalData.nm = animData.nm\n this.globalData.compSize = {\n w: animData.w,\n h: animData.h,\n }\n }\n\n function TransformElement() {}\n\n TransformElement.prototype = {\n initTransform: function () {\n this.finalTransform = {\n mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { o: 0 },\n _matMdf: false,\n _opMdf: false,\n mat: new Matrix(),\n }\n if (this.data.ao) {\n this.finalTransform.mProp.autoOriented = true\n }\n\n // TODO: check TYPE 11: Guided elements\n if (this.data.ty !== 11) {\n // this.createElements();\n }\n },\n renderTransform: function () {\n this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame\n this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame\n\n if (this.hierarchy) {\n var mat\n var finalMat = this.finalTransform.mat\n var i = 0\n var len = this.hierarchy.length\n // Checking if any of the transformation matrices in the hierarchy chain has changed.\n if (!this.finalTransform._matMdf) {\n while (i < len) {\n if (this.hierarchy[i].finalTransform.mProp._mdf) {\n this.finalTransform._matMdf = true\n break\n }\n i += 1\n }\n }\n\n if (this.finalTransform._matMdf) {\n mat = this.finalTransform.mProp.v.props\n finalMat.cloneFromProps(mat)\n for (i = 0; i < len; i += 1) {\n mat = this.hierarchy[i].finalTransform.mProp.v.props\n finalMat.transform(\n mat[0],\n mat[1],\n mat[2],\n mat[3],\n mat[4],\n mat[5],\n mat[6],\n mat[7],\n mat[8],\n mat[9],\n mat[10],\n mat[11],\n mat[12],\n mat[13],\n mat[14],\n mat[15],\n )\n }\n }\n }\n },\n globalToLocal: function (pt) {\n var transforms = []\n transforms.push(this.finalTransform)\n var flag = true\n var comp = this.comp\n while (flag) {\n if (comp.finalTransform) {\n if (comp.data.hasMask) {\n transforms.splice(0, 0, comp.finalTransform)\n }\n comp = comp.comp\n } else {\n flag = false\n }\n }\n var i\n var len = transforms.length\n var ptNew\n for (i = 0; i < len; i += 1) {\n ptNew = transforms[i].mat.applyToPointArray(0, 0, 0)\n // ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);\n pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0]\n }\n return pt\n },\n mHelper: new Matrix(),\n }\n\n function MaskElement(data, element, globalData) {\n this.data = data\n this.element = element\n this.globalData = globalData\n this.storedData = []\n this.masksProperties = this.data.masksProperties || []\n this.maskElement = null\n var defs = this.globalData.defs\n var i\n var len = this.masksProperties ? this.masksProperties.length : 0\n this.viewData = createSizedArray(len)\n this.solidPath = ''\n\n var path\n var properties = this.masksProperties\n var count = 0\n var currentMasks = []\n var j\n var jLen\n var layerId = createElementID()\n var rect\n var expansor\n var feMorph\n var x\n var maskType = 'clipPath'\n var maskRef = 'clip-path'\n for (i = 0; i < len; i += 1) {\n if (\n (properties[i].mode !== 'a' && properties[i].mode !== 'n') ||\n properties[i].inv ||\n properties[i].o.k !== 100 ||\n properties[i].o.x\n ) {\n maskType = 'mask'\n maskRef = 'mask'\n }\n\n if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) {\n rect = createNS('rect')\n rect.setAttribute('fill', '#ffffff')\n rect.setAttribute('width', this.element.comp.data.w || 0)\n rect.setAttribute('height', this.element.comp.data.h || 0)\n currentMasks.push(rect)\n } else {\n rect = null\n }\n\n path = createNS('path')\n if (properties[i].mode === 'n') {\n // TODO move this to a factory or to a constructor\n this.viewData[i] = {\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n elem: path,\n lastPath: '',\n }\n defs.appendChild(path)\n } else {\n count += 1\n\n path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff')\n path.setAttribute('clip-rule', 'nonzero')\n var filterID\n\n if (properties[i].x.k !== 0) {\n maskType = 'mask'\n maskRef = 'mask'\n x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element)\n filterID = createElementID()\n expansor = createNS('filter')\n expansor.setAttribute('id', filterID)\n feMorph = createNS('feMorphology')\n feMorph.setAttribute('operator', 'erode')\n feMorph.setAttribute('in', 'SourceGraphic')\n feMorph.setAttribute('radius', '0')\n expansor.appendChild(feMorph)\n defs.appendChild(expansor)\n path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff')\n } else {\n feMorph = null\n x = null\n }\n\n // TODO move this to a factory or to a constructor\n this.storedData[i] = {\n elem: path,\n x: x,\n expan: feMorph,\n lastPath: '',\n lastOperator: '',\n filterId: filterID,\n lastRadius: 0,\n }\n if (properties[i].mode === 'i') {\n jLen = currentMasks.length\n var g = createNS('g')\n for (j = 0; j < jLen; j += 1) {\n g.appendChild(currentMasks[j])\n }\n var mask = createNS('mask')\n mask.setAttribute('mask-type', 'alpha')\n mask.setAttribute('id', layerId + '_' + count)\n mask.appendChild(path)\n defs.appendChild(mask)\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + layerId + '_' + count + ')')\n\n currentMasks.length = 0\n currentMasks.push(g)\n } else {\n currentMasks.push(path)\n }\n if (properties[i].inv && !this.solidPath) {\n this.solidPath = this.createLayerSolidPath()\n }\n // TODO move this to a factory or to a constructor\n this.viewData[i] = {\n elem: path,\n lastPath: '',\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n invRect: rect,\n }\n if (!this.viewData[i].prop.k) {\n this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i])\n }\n }\n }\n\n this.maskElement = createNS(maskType)\n\n len = currentMasks.length\n for (i = 0; i < len; i += 1) {\n this.maskElement.appendChild(currentMasks[i])\n }\n\n if (count > 0) {\n this.maskElement.setAttribute('id', layerId)\n this.element.maskedElement.setAttribute(maskRef, 'url(' + getLocationHref() + '#' + layerId + ')')\n defs.appendChild(this.maskElement)\n }\n if (this.viewData.length) {\n this.element.addRenderableComponent(this)\n }\n }\n\n MaskElement.prototype.getMaskProperty = function (pos) {\n return this.viewData[pos].prop\n }\n\n MaskElement.prototype.renderFrame = function (isFirstFrame) {\n var finalMat = this.element.finalTransform.mat\n var i\n var len = this.masksProperties.length\n for (i = 0; i < len; i += 1) {\n if (this.viewData[i].prop._mdf || isFirstFrame) {\n this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i])\n }\n if (this.viewData[i].op._mdf || isFirstFrame) {\n this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v)\n }\n if (this.masksProperties[i].mode !== 'n') {\n if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {\n this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS())\n }\n if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {\n var feMorph = this.storedData[i].expan\n if (this.storedData[i].x.v < 0) {\n if (this.storedData[i].lastOperator !== 'erode') {\n this.storedData[i].lastOperator = 'erode'\n this.storedData[i].elem.setAttribute(\n 'filter',\n 'url(' + getLocationHref() + '#' + this.storedData[i].filterId + ')',\n )\n }\n feMorph.setAttribute('radius', -this.storedData[i].x.v)\n } else {\n if (this.storedData[i].lastOperator !== 'dilate') {\n this.storedData[i].lastOperator = 'dilate'\n this.storedData[i].elem.setAttribute('filter', null)\n }\n this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2)\n }\n }\n }\n }\n }\n\n MaskElement.prototype.getMaskelement = function () {\n return this.maskElement\n }\n\n MaskElement.prototype.createLayerSolidPath = function () {\n var path = 'M0,0 '\n path += ' h' + this.globalData.compSize.w\n path += ' v' + this.globalData.compSize.h\n path += ' h-' + this.globalData.compSize.w\n path += ' v-' + this.globalData.compSize.h + ' '\n return path\n }\n\n MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {\n var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1]\n var i\n var len\n len = pathNodes._length\n for (i = 1; i < len; i += 1) {\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[i][0]+','+pathNodes.i[i][1] + \" \"+pathNodes.v[i][0]+','+pathNodes.v[i][1];\n pathString +=\n ' C' +\n pathNodes.o[i - 1][0] +\n ',' +\n pathNodes.o[i - 1][1] +\n ' ' +\n pathNodes.i[i][0] +\n ',' +\n pathNodes.i[i][1] +\n ' ' +\n pathNodes.v[i][0] +\n ',' +\n pathNodes.v[i][1]\n }\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[0][0]+','+pathNodes.i[0][1] + \" \"+pathNodes.v[0][0]+','+pathNodes.v[0][1];\n if (pathNodes.c && len > 1) {\n pathString +=\n ' C' +\n pathNodes.o[i - 1][0] +\n ',' +\n pathNodes.o[i - 1][1] +\n ' ' +\n pathNodes.i[0][0] +\n ',' +\n pathNodes.i[0][1] +\n ' ' +\n pathNodes.v[0][0] +\n ',' +\n pathNodes.v[0][1]\n }\n // pathNodes.__renderedString = pathString;\n\n if (viewData.lastPath !== pathString) {\n var pathShapeValue = ''\n if (viewData.elem) {\n if (pathNodes.c) {\n pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString\n }\n viewData.elem.setAttribute('d', pathShapeValue)\n }\n viewData.lastPath = pathString\n }\n }\n\n MaskElement.prototype.destroy = function () {\n this.element = null\n this.globalData = null\n this.maskElement = null\n this.data = null\n this.masksProperties = null\n }\n\n const filtersFactory = (function () {\n var ob = {}\n ob.createFilter = createFilter\n ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter\n\n function createFilter(filId, skipCoordinates) {\n var fil = createNS('filter')\n fil.setAttribute('id', filId)\n if (skipCoordinates !== true) {\n fil.setAttribute('filterUnits', 'objectBoundingBox')\n fil.setAttribute('x', '0%')\n fil.setAttribute('y', '0%')\n fil.setAttribute('width', '100%')\n fil.setAttribute('height', '100%')\n }\n return fil\n }\n\n function createAlphaToLuminanceFilter() {\n var feColorMatrix = createNS('feColorMatrix')\n feColorMatrix.setAttribute('type', 'matrix')\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB')\n feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1')\n return feColorMatrix\n }\n\n return ob\n })()\n\n const featureSupport = (function () {\n var ob = {\n maskType: true,\n }\n if (\n /MSIE 10/i.test(navigator.userAgent) ||\n /MSIE 9/i.test(navigator.userAgent) ||\n /rv:11.0/i.test(navigator.userAgent) ||\n /Edge\\/\\d./i.test(navigator.userAgent)\n ) {\n ob.maskType = false\n }\n return ob\n })()\n\n var registeredEffects = {}\n var idPrefix = 'filter_result_'\n\n function SVGEffects(elem) {\n var i\n var source = 'SourceGraphic'\n var len = elem.data.ef ? elem.data.ef.length : 0\n var filId = createElementID()\n var fil = filtersFactory.createFilter(filId, true)\n var count = 0\n this.filters = []\n var filterManager\n for (i = 0; i < len; i += 1) {\n filterManager = null\n var type = elem.data.ef[i].ty\n if (registeredEffects[type]) {\n var Effect = registeredEffects[type].effect\n filterManager = new Effect(fil, elem.effectsManager.effectElements[i], elem, idPrefix + count, source)\n source = idPrefix + count\n if (registeredEffects[type].countsAsEffect) {\n count += 1\n }\n }\n if (filterManager) {\n this.filters.push(filterManager)\n }\n }\n if (count) {\n elem.globalData.defs.appendChild(fil)\n elem.layerElement.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')')\n }\n if (this.filters.length) {\n elem.addRenderableComponent(this)\n }\n }\n\n SVGEffects.prototype.renderFrame = function (_isFirstFrame) {\n var i\n var len = this.filters.length\n for (i = 0; i < len; i += 1) {\n this.filters[i].renderFrame(_isFirstFrame)\n }\n }\n\n function registerEffect(id, effect, countsAsEffect) {\n registeredEffects[id] = {\n effect,\n countsAsEffect,\n }\n }\n\n function SVGBaseElement() {}\n\n SVGBaseElement.prototype = {\n initRendererElement: function () {\n this.layerElement = createNS('g')\n },\n createContainerElements: function () {\n this.matteElement = createNS('g')\n this.transformedElement = this.layerElement\n this.maskedElement = this.layerElement\n this._sizeChanged = false\n var layerElementParent = null\n // If this layer acts as a mask for the following layer\n var filId\n var fil\n var gg\n if (this.data.td) {\n if (this.data.td == 3 || this.data.td == 1) {\n // eslint-disable-line eqeqeq\n var masker = createNS('mask')\n masker.setAttribute('id', this.layerId)\n masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha') // eslint-disable-line eqeqeq\n masker.appendChild(this.layerElement)\n layerElementParent = masker\n this.globalData.defs.appendChild(masker)\n // This is only for IE and Edge when mask if of type alpha\n if (!featureSupport.maskType && this.data.td == 1) {\n // eslint-disable-line eqeqeq\n masker.setAttribute('mask-type', 'luminance')\n filId = createElementID()\n fil = filtersFactory.createFilter(filId)\n this.globalData.defs.appendChild(fil)\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter())\n gg = createNS('g')\n gg.appendChild(this.layerElement)\n layerElementParent = gg\n masker.appendChild(gg)\n gg.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')')\n }\n } else if (this.data.td == 2) {\n // eslint-disable-line eqeqeq\n var maskGroup = createNS('mask')\n maskGroup.setAttribute('id', this.layerId)\n maskGroup.setAttribute('mask-type', 'alpha')\n var maskGrouper = createNS('g')\n maskGroup.appendChild(maskGrouper)\n filId = createElementID()\n fil = filtersFactory.createFilter(filId)\n /// /\n\n // This solution doesn't work on Android when meta tag with viewport attribute is set\n /* var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');\n fil.appendChild(feColorMatrix); */\n /// /\n var feCTr = createNS('feComponentTransfer')\n feCTr.setAttribute('in', 'SourceGraphic')\n fil.appendChild(feCTr)\n var feFunc = createNS('feFuncA')\n feFunc.setAttribute('type', 'table')\n feFunc.setAttribute('tableValues', '1.0 0.0')\n feCTr.appendChild(feFunc)\n /// /\n this.globalData.defs.appendChild(fil)\n var alphaRect = createNS('rect')\n alphaRect.setAttribute('width', this.comp.data.w)\n alphaRect.setAttribute('height', this.comp.data.h)\n alphaRect.setAttribute('x', '0')\n alphaRect.setAttribute('y', '0')\n alphaRect.setAttribute('fill', '#ffffff')\n alphaRect.setAttribute('opacity', '0')\n maskGrouper.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')')\n maskGrouper.appendChild(alphaRect)\n maskGrouper.appendChild(this.layerElement)\n layerElementParent = maskGrouper\n if (!featureSupport.maskType) {\n maskGroup.setAttribute('mask-type', 'luminance')\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter())\n gg = createNS('g')\n maskGrouper.appendChild(alphaRect)\n gg.appendChild(this.layerElement)\n layerElementParent = gg\n maskGrouper.appendChild(gg)\n }\n this.globalData.defs.appendChild(maskGroup)\n }\n } else if (this.data.tt) {\n this.matteElement.appendChild(this.layerElement)\n layerElementParent = this.matteElement\n this.baseElement = this.matteElement\n } else {\n this.baseElement = this.layerElement\n }\n if (this.data.ln) {\n this.layerElement.setAttribute('id', this.data.ln)\n }\n if (this.data.cl) {\n this.layerElement.setAttribute('class', this.data.cl)\n }\n // Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped\n if (this.data.ty === 0 && !this.data.hd) {\n var cp = createNS('clipPath')\n var pt = createNS('path')\n pt.setAttribute(\n 'd',\n 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z',\n )\n var clipId = createElementID()\n cp.setAttribute('id', clipId)\n cp.appendChild(pt)\n this.globalData.defs.appendChild(cp)\n\n if (this.checkMasks()) {\n var cpGroup = createNS('g')\n cpGroup.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')')\n cpGroup.appendChild(this.layerElement)\n this.transformedElement = cpGroup\n if (layerElementParent) {\n layerElementParent.appendChild(this.transformedElement)\n } else {\n this.baseElement = this.transformedElement\n }\n } else {\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')')\n }\n }\n if (this.data.bm !== 0) {\n this.setBlendMode()\n }\n },\n renderElement: function () {\n if (this.finalTransform._matMdf) {\n this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS())\n }\n if (this.finalTransform._opMdf) {\n this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v)\n }\n },\n destroyBaseElement: function () {\n this.layerElement = null\n this.matteElement = null\n this.maskManager.destroy()\n },\n getBaseElement: function () {\n if (this.data.hd) {\n return null\n }\n return this.baseElement\n },\n createRenderableComponents: function () {\n this.maskManager = new MaskElement(this.data, this, this.globalData)\n this.renderableEffectsManager = new SVGEffects(this)\n },\n setMatte: function (id) {\n if (!this.matteElement) {\n return\n }\n this.matteElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')')\n },\n }\n\n /**\n * @file\n * Handles AE's layer parenting property.\n *\n */\n\n function HierarchyElement() {}\n\n HierarchyElement.prototype = {\n /**\n * @function\n * Initializes hierarchy properties\n *\n */\n initHierarchy: function () {\n // element's parent list\n this.hierarchy = []\n // if element is parent of another layer _isParent will be true\n this._isParent = false\n this.checkParenting()\n },\n /**\n * @function\n * Sets layer's hierarchy.\n * @param {array} hierarch\n * layer's parent list\n *\n */\n setHierarchy: function (hierarchy) {\n this.hierarchy = hierarchy\n },\n /**\n * @function\n * Sets layer as parent.\n *\n */\n setAsParent: function () {\n this._isParent = true\n },\n /**\n * @function\n * Searches layer's parenting chain\n *\n */\n checkParenting: function () {\n if (this.data.parent !== undefined) {\n this.comp.buildElementParenting(this, this.data.parent, [])\n }\n },\n }\n\n function RenderableDOMElement() {}\n\n ;(function () {\n var _prototype = {\n initElement: function (data, globalData, comp) {\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.initTransform(data, globalData, comp)\n this.initHierarchy()\n this.initRenderable()\n this.initRendererElement()\n this.createContainerElements()\n this.createRenderableComponents()\n this.createContent()\n this.hide()\n },\n hide: function () {\n // console.log('HIDE', this);\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n var elem = this.baseElement || this.layerElement\n elem.style.display = 'none'\n this.hidden = true\n }\n },\n show: function () {\n // console.log('SHOW', this);\n if (this.isInRange && !this.isTransparent) {\n if (!this.data.hd) {\n var elem = this.baseElement || this.layerElement\n elem.style.display = 'block'\n }\n this.hidden = false\n this._isFirstFrame = true\n }\n },\n renderFrame: function () {\n // If it is exported as hidden (data.hd === true) no need to render\n // If it is not visible no need to render\n if (this.data.hd || this.hidden) {\n return\n }\n this.renderTransform()\n this.renderRenderable()\n this.renderElement()\n this.renderInnerContent()\n if (this._isFirstFrame) {\n this._isFirstFrame = false\n }\n },\n renderInnerContent: function () {},\n prepareFrame: function (num) {\n this._mdf = false\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n this.checkTransparency()\n },\n destroy: function () {\n this.innerElem = null\n this.destroyBaseElement()\n },\n }\n extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement)\n })()\n\n function IImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId)\n this.initElement(data, globalData, comp)\n this.sourceRect = {\n top: 0,\n left: 0,\n width: this.assetData.w,\n height: this.assetData.h,\n }\n }\n\n extendPrototype(\n [BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement],\n IImageElement,\n )\n\n IImageElement.prototype.createContent = function () {\n var assetPath = this.globalData.getAssetsPath(this.assetData)\n\n this.innerElem = createNS('image')\n this.innerElem.setAttribute('width', this.assetData.w + 'px')\n this.innerElem.setAttribute('height', this.assetData.h + 'px')\n this.innerElem.setAttribute(\n 'preserveAspectRatio',\n this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio,\n )\n this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath)\n\n this.layerElement.appendChild(this.innerElem)\n }\n\n IImageElement.prototype.sourceRectAtTime = function () {\n return this.sourceRect\n }\n\n function ProcessedElement(element, position) {\n this.elem = element\n this.pos = position\n }\n\n function IShapeElement() {}\n\n IShapeElement.prototype = {\n addShapeToModifiers: function (data) {\n var i\n var len = this.shapeModifiers.length\n for (i = 0; i < len; i += 1) {\n this.shapeModifiers[i].addShape(data)\n }\n },\n isShapeInAnimatedModifiers: function (data) {\n var i = 0\n var len = this.shapeModifiers.length\n while (i < len) {\n if (this.shapeModifiers[i].isAnimatedWithShape(data)) {\n return true\n }\n }\n return false\n },\n renderModifiers: function () {\n if (!this.shapeModifiers.length) {\n return\n }\n var i\n var len = this.shapes.length\n for (i = 0; i < len; i += 1) {\n this.shapes[i].sh.reset()\n }\n\n len = this.shapeModifiers.length\n var shouldBreakProcess\n for (i = len - 1; i >= 0; i -= 1) {\n shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame)\n // workaround to fix cases where a repeater resets the shape so the following processes get called twice\n // TODO: find a better solution for this\n if (shouldBreakProcess) {\n break\n }\n }\n },\n\n searchProcessedElement: function (elem) {\n var elements = this.processedElements\n var i = 0\n var len = elements.length\n while (i < len) {\n if (elements[i].elem === elem) {\n return elements[i].pos\n }\n i += 1\n }\n return 0\n },\n addProcessedElement: function (elem, pos) {\n var elements = this.processedElements\n var i = elements.length\n while (i) {\n i -= 1\n if (elements[i].elem === elem) {\n elements[i].pos = pos\n return\n }\n }\n elements.push(new ProcessedElement(elem, pos))\n },\n prepareFrame: function (num) {\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n },\n }\n\n const lineCapEnum = {\n 1: 'butt',\n 2: 'round',\n 3: 'square',\n }\n\n const lineJoinEnum = {\n 1: 'miter',\n 2: 'round',\n 3: 'bevel',\n }\n\n function SVGShapeData(transformers, level, shape) {\n this.caches = []\n this.styles = []\n this.transformers = transformers\n this.lStr = ''\n this.sh = shape\n this.lvl = level\n // TODO find if there are some cases where _isAnimated can be false.\n // For now, since shapes add up with other shapes. They have to be calculated every time.\n // One way of finding out is checking if all styles associated to this shape depend only of this shape\n this._isAnimated = !!shape.k\n // TODO: commenting this for now since all shapes are animated\n var i = 0\n var len = transformers.length\n while (i < len) {\n if (transformers[i].mProps.dynamicProperties.length) {\n this._isAnimated = true\n break\n }\n i += 1\n }\n }\n\n SVGShapeData.prototype.setAsAnimated = function () {\n this._isAnimated = true\n }\n\n function SVGStyleData(data, level) {\n this.data = data\n this.type = data.ty\n this.d = ''\n this.lvl = level\n this._mdf = false\n this.closed = data.hd === true\n this.pElem = createNS('path')\n this.msElem = null\n }\n\n SVGStyleData.prototype.reset = function () {\n this.d = ''\n this._mdf = false\n }\n\n function DashProperty(elem, data, renderer, container) {\n this.elem = elem\n this.frameId = -1\n this.dataProps = createSizedArray(data.length)\n this.renderer = renderer\n this.k = false\n this.dashStr = ''\n this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0)\n this.dashoffset = createTypedArray('float32', 1)\n this.initDynamicPropertyContainer(container)\n var i\n var len = data.length || 0\n var prop\n for (i = 0; i < len; i += 1) {\n prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this)\n this.k = prop.k || this.k\n this.dataProps[i] = { n: data[i].n, p: prop }\n }\n if (!this.k) {\n this.getValue(true)\n }\n this._isAnimated = this.k\n }\n\n DashProperty.prototype.getValue = function (forceRender) {\n if (this.elem.globalData.frameId === this.frameId && !forceRender) {\n return\n }\n this.frameId = this.elem.globalData.frameId\n this.iterateDynamicProperties()\n this._mdf = this._mdf || forceRender\n if (this._mdf) {\n var i = 0\n var len = this.dataProps.length\n if (this.renderer === 'svg') {\n this.dashStr = ''\n }\n for (i = 0; i < len; i += 1) {\n if (this.dataProps[i].n !== 'o') {\n if (this.renderer === 'svg') {\n this.dashStr += ' ' + this.dataProps[i].p.v\n } else {\n this.dashArray[i] = this.dataProps[i].p.v\n }\n } else {\n this.dashoffset[0] = this.dataProps[i].p.v\n }\n }\n }\n }\n extendPrototype([DynamicPropertyContainer], DashProperty)\n\n function SVGStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this)\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this)\n this.d = new DashProperty(elem, data.d || {}, 'svg', this)\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this)\n this.style = styleOb\n this._isAnimated = !!this._isAnimated\n }\n\n extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData)\n\n function SVGFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this)\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this)\n this.style = styleOb\n }\n\n extendPrototype([DynamicPropertyContainer], SVGFillStyleData)\n\n function SVGNoStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.style = styleOb\n }\n\n extendPrototype([DynamicPropertyContainer], SVGNoStyleData)\n\n function GradientProperty(elem, data, container) {\n this.data = data\n this.c = createTypedArray('uint8c', data.p * 4)\n var cLength = data.k.k[0].s ? data.k.k[0].s.length - data.p * 4 : data.k.k.length - data.p * 4\n this.o = createTypedArray('float32', cLength)\n this._cmdf = false\n this._omdf = false\n this._collapsable = this.checkCollapsable()\n this._hasOpacity = cLength\n this.initDynamicPropertyContainer(container)\n this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this)\n this.k = this.prop.k\n this.getValue(true)\n }\n\n GradientProperty.prototype.comparePoints = function (values, points) {\n var i = 0\n var len = this.o.length / 2\n var diff\n while (i < len) {\n diff = Math.abs(values[i * 4] - values[points * 4 + i * 2])\n if (diff > 0.01) {\n return false\n }\n i += 1\n }\n return true\n }\n\n GradientProperty.prototype.checkCollapsable = function () {\n if (this.o.length / 2 !== this.c.length / 4) {\n return false\n }\n if (this.data.k.k[0].s) {\n var i = 0\n var len = this.data.k.k.length\n while (i < len) {\n if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {\n return false\n }\n i += 1\n }\n } else if (!this.comparePoints(this.data.k.k, this.data.p)) {\n return false\n }\n return true\n }\n\n GradientProperty.prototype.getValue = function (forceRender) {\n this.prop.getValue()\n this._mdf = false\n this._cmdf = false\n this._omdf = false\n if (this.prop._mdf || forceRender) {\n var i\n var len = this.data.p * 4\n var mult\n var val\n for (i = 0; i < len; i += 1) {\n mult = i % 4 === 0 ? 100 : 255\n val = Math.round(this.prop.v[i] * mult)\n if (this.c[i] !== val) {\n this.c[i] = val\n this._cmdf = !forceRender\n }\n }\n if (this.o.length) {\n len = this.prop.v.length\n for (i = this.data.p * 4; i < len; i += 1) {\n mult = i % 2 === 0 ? 100 : 1\n val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i]\n if (this.o[i - this.data.p * 4] !== val) {\n this.o[i - this.data.p * 4] = val\n this._omdf = !forceRender\n }\n }\n }\n this._mdf = !forceRender\n }\n }\n\n extendPrototype([DynamicPropertyContainer], GradientProperty)\n\n function SVGGradientFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.initGradientData(elem, data, styleOb)\n }\n\n SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this)\n this.s = PropertyFactory.getProp(elem, data.s, 1, null, this)\n this.e = PropertyFactory.getProp(elem, data.e, 1, null, this)\n this.h = PropertyFactory.getProp(elem, data.h || { k: 0 }, 0, 0.01, this)\n this.a = PropertyFactory.getProp(elem, data.a || { k: 0 }, 0, degToRads, this)\n this.g = new GradientProperty(elem, data.g, this)\n this.style = styleOb\n this.stops = []\n this.setGradientData(styleOb.pElem, data)\n this.setGradientOpacity(data, styleOb)\n this._isAnimated = !!this._isAnimated\n }\n\n SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {\n var gradientId = createElementID()\n var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient')\n gfill.setAttribute('id', gradientId)\n gfill.setAttribute('spreadMethod', 'pad')\n gfill.setAttribute('gradientUnits', 'userSpaceOnUse')\n var stops = []\n var stop\n var j\n var jLen\n jLen = data.g.p * 4\n for (j = 0; j < jLen; j += 4) {\n stop = createNS('stop')\n gfill.appendChild(stop)\n stops.push(stop)\n }\n pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + gradientId + ')')\n this.gf = gfill\n this.cst = stops\n }\n\n SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {\n if (this.g._hasOpacity && !this.g._collapsable) {\n var stop\n var j\n var jLen\n var mask = createNS('mask')\n var maskElement = createNS('path')\n mask.appendChild(maskElement)\n var opacityId = createElementID()\n var maskId = createElementID()\n mask.setAttribute('id', maskId)\n var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient')\n opFill.setAttribute('id', opacityId)\n opFill.setAttribute('spreadMethod', 'pad')\n opFill.setAttribute('gradientUnits', 'userSpaceOnUse')\n jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length\n var stops = this.stops\n for (j = data.g.p * 4; j < jLen; j += 2) {\n stop = createNS('stop')\n stop.setAttribute('stop-color', 'rgb(255,255,255)')\n opFill.appendChild(stop)\n stops.push(stop)\n }\n maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + opacityId + ')')\n if (data.ty === 'gs') {\n maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2])\n maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2])\n if (data.lj === 1) {\n maskElement.setAttribute('stroke-miterlimit', data.ml)\n }\n }\n this.of = opFill\n this.ms = mask\n this.ost = stops\n this.maskId = maskId\n styleOb.msElem = maskElement\n }\n }\n\n extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData)\n\n function SVGGradientStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem)\n this.getValue = this.iterateDynamicProperties\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this)\n this.d = new DashProperty(elem, data.d || {}, 'svg', this)\n this.initGradientData(elem, data, styleOb)\n this._isAnimated = !!this._isAnimated\n }\n\n extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData)\n\n function ShapeGroupData() {\n this.it = []\n this.prevViewData = []\n this.gr = createNS('g')\n }\n\n function SVGTransformData(mProps, op, container) {\n this.transform = {\n mProps: mProps,\n op: op,\n container: container,\n }\n this.elements = []\n this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length\n }\n\n const buildShapeString = function (pathNodes, length, closed, mat) {\n if (length === 0) {\n return ''\n }\n var _o = pathNodes.o\n var _i = pathNodes.i\n var _v = pathNodes.v\n var i\n var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1])\n for (i = 1; i < length; i += 1) {\n shapeString +=\n ' C' +\n mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) +\n ' ' +\n mat.applyToPointStringified(_i[i][0], _i[i][1]) +\n ' ' +\n mat.applyToPointStringified(_v[i][0], _v[i][1])\n }\n if (closed && length) {\n shapeString +=\n ' C' +\n mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) +\n ' ' +\n mat.applyToPointStringified(_i[0][0], _i[0][1]) +\n ' ' +\n mat.applyToPointStringified(_v[0][0], _v[0][1])\n shapeString += 'z'\n }\n return shapeString\n }\n\n const SVGElementsRenderer = (function () {\n var _identityMatrix = new Matrix()\n var _matrixHelper = new Matrix()\n\n var ob = {\n createRenderFunction: createRenderFunction,\n }\n\n function createRenderFunction(data) {\n switch (data.ty) {\n case 'fl':\n return renderFill\n case 'gf':\n return renderGradient\n case 'gs':\n return renderGradientStroke\n case 'st':\n return renderStroke\n case 'sh':\n case 'el':\n case 'rc':\n case 'sr':\n return renderPath\n case 'tr':\n return renderContentTransform\n case 'no':\n return renderNoop\n default:\n return null\n }\n }\n\n function renderContentTransform(styleData, itemData, isFirstFrame) {\n if (isFirstFrame || itemData.transform.op._mdf) {\n itemData.transform.container.setAttribute('opacity', itemData.transform.op.v)\n }\n if (isFirstFrame || itemData.transform.mProps._mdf) {\n itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS())\n }\n }\n\n function renderNoop() {}\n\n function renderPath(styleData, itemData, isFirstFrame) {\n var j\n var jLen\n var pathStringTransformed\n var redraw\n var pathNodes\n var l\n var lLen = itemData.styles.length\n var lvl = itemData.lvl\n var paths\n var mat\n var props\n var iterations\n var k\n for (l = 0; l < lLen; l += 1) {\n redraw = itemData.sh._mdf || isFirstFrame\n if (itemData.styles[l].lvl < lvl) {\n mat = _matrixHelper.reset()\n iterations = lvl - itemData.styles[l].lvl\n k = itemData.transformers.length - 1\n while (!redraw && iterations > 0) {\n redraw = itemData.transformers[k].mProps._mdf || redraw\n iterations -= 1\n k -= 1\n }\n if (redraw) {\n iterations = lvl - itemData.styles[l].lvl\n k = itemData.transformers.length - 1\n while (iterations > 0) {\n props = itemData.transformers[k].mProps.v.props\n mat.transform(\n props[0],\n props[1],\n props[2],\n props[3],\n props[4],\n props[5],\n props[6],\n props[7],\n props[8],\n props[9],\n props[10],\n props[11],\n props[12],\n props[13],\n props[14],\n props[15],\n )\n iterations -= 1\n k -= 1\n }\n }\n } else {\n mat = _identityMatrix\n }\n paths = itemData.sh.paths\n jLen = paths._length\n if (redraw) {\n pathStringTransformed = ''\n for (j = 0; j < jLen; j += 1) {\n pathNodes = paths.shapes[j]\n if (pathNodes && pathNodes._length) {\n pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat)\n }\n }\n itemData.caches[l] = pathStringTransformed\n } else {\n pathStringTransformed = itemData.caches[l]\n }\n itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed\n itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf\n }\n }\n\n function renderFill(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style\n\n if (itemData.c._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute(\n 'fill',\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')',\n )\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('fill-opacity', itemData.o.v)\n }\n }\n\n function renderGradientStroke(styleData, itemData, isFirstFrame) {\n renderGradient(styleData, itemData, isFirstFrame)\n renderStroke(styleData, itemData, isFirstFrame)\n }\n\n function renderGradient(styleData, itemData, isFirstFrame) {\n var gfill = itemData.gf\n var hasOpacity = itemData.g._hasOpacity\n var pt1 = itemData.s.v\n var pt2 = itemData.e.v\n\n if (itemData.o._mdf || isFirstFrame) {\n var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity'\n itemData.style.pElem.setAttribute(attr, itemData.o.v)\n }\n if (itemData.s._mdf || isFirstFrame) {\n var attr1 = styleData.t === 1 ? 'x1' : 'cx'\n var attr2 = attr1 === 'x1' ? 'y1' : 'cy'\n gfill.setAttribute(attr1, pt1[0])\n gfill.setAttribute(attr2, pt1[1])\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute(attr1, pt1[0])\n itemData.of.setAttribute(attr2, pt1[1])\n }\n }\n var stops\n var i\n var len\n var stop\n if (itemData.g._cmdf || isFirstFrame) {\n stops = itemData.cst\n var cValues = itemData.g.c\n len = stops.length\n for (i = 0; i < len; i += 1) {\n stop = stops[i]\n stop.setAttribute('offset', cValues[i * 4] + '%')\n stop.setAttribute(\n 'stop-color',\n 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')',\n )\n }\n }\n if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {\n var oValues = itemData.g.o\n if (itemData.g._collapsable) {\n stops = itemData.cst\n } else {\n stops = itemData.ost\n }\n len = stops.length\n for (i = 0; i < len; i += 1) {\n stop = stops[i]\n if (!itemData.g._collapsable) {\n stop.setAttribute('offset', oValues[i * 2] + '%')\n }\n stop.setAttribute('stop-opacity', oValues[i * 2 + 1])\n }\n }\n if (styleData.t === 1) {\n if (itemData.e._mdf || isFirstFrame) {\n gfill.setAttribute('x2', pt2[0])\n gfill.setAttribute('y2', pt2[1])\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('x2', pt2[0])\n itemData.of.setAttribute('y2', pt2[1])\n }\n }\n } else {\n var rad\n if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2))\n gfill.setAttribute('r', rad)\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('r', rad)\n }\n }\n if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {\n if (!rad) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2))\n }\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0])\n\n var percent = itemData.h.v\n if (percent >= 1) {\n percent = 0.99\n } else if (percent <= -1) {\n percent = -0.99\n }\n var dist = rad * percent\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]\n gfill.setAttribute('fx', x)\n gfill.setAttribute('fy', y)\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('fx', x)\n itemData.of.setAttribute('fy', y)\n }\n }\n // gfill.setAttribute('fy','200');\n }\n }\n\n function renderStroke(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style\n var d = itemData.d\n if (d && (d._mdf || isFirstFrame) && d.dashStr) {\n styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr)\n styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0])\n }\n if (itemData.c && (itemData.c._mdf || isFirstFrame)) {\n styleElem.pElem.setAttribute(\n 'stroke',\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')',\n )\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v)\n }\n if (itemData.w._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-width', itemData.w.v)\n if (styleElem.msElem) {\n styleElem.msElem.setAttribute('stroke-width', itemData.w.v)\n }\n }\n }\n\n return ob\n })()\n\n function SVGShapeElement(data, globalData, comp) {\n // List of drawable elements\n this.shapes = []\n // Full shape data\n this.shapesData = data.shapes\n // List of styles that will be applied to shapes\n this.stylesList = []\n // List of modifiers that will be applied to shapes\n this.shapeModifiers = []\n // List of items in shape tree\n this.itemsData = []\n // List of items in previous shape tree\n this.processedElements = []\n // List of animated components\n this.animatedContents = []\n this.initElement(data, globalData, comp)\n // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n // List of elements that have been created\n this.prevViewData = []\n // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n }\n\n extendPrototype(\n [\n BaseElement,\n TransformElement,\n SVGBaseElement,\n IShapeElement,\n HierarchyElement,\n FrameElement,\n RenderableDOMElement,\n ],\n SVGShapeElement,\n )\n\n SVGShapeElement.prototype.initSecondaryElement = function () {}\n\n SVGShapeElement.prototype.identityMatrix = new Matrix()\n\n SVGShapeElement.prototype.buildExpressionInterface = function () {}\n\n SVGShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true)\n this.filterUniqueShapes()\n }\n\n /*\nThis method searches for multiple shapes that affect a single element and one of them is animated\n*/\n SVGShapeElement.prototype.filterUniqueShapes = function () {\n var i\n var len = this.shapes.length\n var shape\n var j\n var jLen = this.stylesList.length\n var style\n var tempShapes = []\n var areAnimated = false\n for (j = 0; j < jLen; j += 1) {\n style = this.stylesList[j]\n areAnimated = false\n tempShapes.length = 0\n for (i = 0; i < len; i += 1) {\n shape = this.shapes[i]\n if (shape.styles.indexOf(style) !== -1) {\n tempShapes.push(shape)\n areAnimated = shape._isAnimated || areAnimated\n }\n }\n if (tempShapes.length > 1 && areAnimated) {\n this.setShapesAsAnimated(tempShapes)\n }\n }\n }\n\n SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {\n var i\n var len = shapes.length\n for (i = 0; i < len; i += 1) {\n shapes[i].setAsAnimated()\n }\n }\n\n SVGShapeElement.prototype.createStyleElement = function (data, level) {\n // TODO: prevent drawing of hidden styles\n var elementData\n var styleOb = new SVGStyleData(data, level)\n\n var pathElement = styleOb.pElem\n if (data.ty === 'st') {\n elementData = new SVGStrokeStyleData(this, data, styleOb)\n } else if (data.ty === 'fl') {\n elementData = new SVGFillStyleData(this, data, styleOb)\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData\n elementData = new GradientConstructor(this, data, styleOb)\n this.globalData.defs.appendChild(elementData.gf)\n if (elementData.maskId) {\n this.globalData.defs.appendChild(elementData.ms)\n this.globalData.defs.appendChild(elementData.of)\n pathElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + elementData.maskId + ')')\n }\n } else if (data.ty === 'no') {\n elementData = new SVGNoStyleData(this, data, styleOb)\n }\n\n if (data.ty === 'st' || data.ty === 'gs') {\n pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2])\n pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2])\n pathElement.setAttribute('fill-opacity', '0')\n if (data.lj === 1) {\n pathElement.setAttribute('stroke-miterlimit', data.ml)\n }\n }\n\n if (data.r === 2) {\n pathElement.setAttribute('fill-rule', 'evenodd')\n }\n\n if (data.ln) {\n pathElement.setAttribute('id', data.ln)\n }\n if (data.cl) {\n pathElement.setAttribute('class', data.cl)\n }\n if (data.bm) {\n pathElement.style['mix-blend-mode'] = getBlendMode(data.bm)\n }\n this.stylesList.push(styleOb)\n this.addToAnimatedContents(data, elementData)\n return elementData\n }\n\n SVGShapeElement.prototype.createGroupElement = function (data) {\n var elementData = new ShapeGroupData()\n if (data.ln) {\n elementData.gr.setAttribute('id', data.ln)\n }\n if (data.cl) {\n elementData.gr.setAttribute('class', data.cl)\n }\n if (data.bm) {\n elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm)\n }\n return elementData\n }\n\n SVGShapeElement.prototype.createTransformElement = function (data, container) {\n var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this)\n var elementData = new SVGTransformData(transformProperty, transformProperty.o, container)\n this.addToAnimatedContents(data, elementData)\n return elementData\n }\n\n SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {\n var ty = 4\n if (data.ty === 'rc') {\n ty = 5\n } else if (data.ty === 'el') {\n ty = 6\n } else if (data.ty === 'sr') {\n ty = 7\n }\n var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this)\n var elementData = new SVGShapeData(ownTransformers, level, shapeProperty)\n this.shapes.push(elementData)\n this.addShapeToModifiers(elementData)\n this.addToAnimatedContents(data, elementData)\n return elementData\n }\n\n SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {\n var i = 0\n var len = this.animatedContents.length\n while (i < len) {\n if (this.animatedContents[i].element === element) {\n return\n }\n i += 1\n }\n this.animatedContents.push({\n fn: SVGElementsRenderer.createRenderFunction(data),\n element: element,\n data: data,\n })\n }\n\n SVGShapeElement.prototype.setElementStyles = function (elementData) {\n var arr = elementData.styles\n var j\n var jLen = this.stylesList.length\n for (j = 0; j < jLen; j += 1) {\n if (!this.stylesList[j].closed) {\n arr.push(this.stylesList[j])\n }\n }\n }\n\n SVGShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true\n var i\n var len = this.itemsData.length\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i]\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true)\n this.filterUniqueShapes()\n len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue()\n }\n this.renderModifiers()\n }\n\n SVGShapeElement.prototype.searchShapes = function (\n arr,\n itemsData,\n prevViewData,\n container,\n level,\n transformers,\n render,\n ) {\n var ownTransformers = [].concat(transformers)\n var i\n var len = arr.length - 1\n var j\n var jLen\n var ownStyles = []\n var ownModifiers = []\n var currentTransform\n var modifier\n var processedPos\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i])\n if (!processedPos) {\n arr[i]._render = render\n } else {\n itemsData[i] = prevViewData[processedPos - 1]\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs' || arr[i].ty === 'no') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], level)\n } else {\n itemsData[i].style.closed = false\n }\n if (arr[i]._render) {\n if (itemsData[i].style.pElem.parentNode !== container) {\n container.appendChild(itemsData[i].style.pElem)\n }\n }\n ownStyles.push(itemsData[i].style)\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i])\n } else {\n jLen = itemsData[i].it.length\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j]\n }\n }\n this.searchShapes(\n arr[i].it,\n itemsData[i].it,\n itemsData[i].prevViewData,\n itemsData[i].gr,\n level + 1,\n ownTransformers,\n render,\n )\n if (arr[i]._render) {\n if (itemsData[i].gr.parentNode !== container) {\n container.appendChild(itemsData[i].gr)\n }\n }\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n itemsData[i] = this.createTransformElement(arr[i], container)\n }\n currentTransform = itemsData[i].transform\n ownTransformers.push(currentTransform)\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level)\n }\n this.setElementStyles(itemsData[i])\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n modifier.init(this, arr[i])\n itemsData[i] = modifier\n this.shapeModifiers.push(modifier)\n } else {\n modifier = itemsData[i]\n modifier.closed = false\n }\n ownModifiers.push(modifier)\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n itemsData[i] = modifier\n modifier.init(this, arr, i, itemsData)\n this.shapeModifiers.push(modifier)\n render = false\n } else {\n modifier = itemsData[i]\n modifier.closed = true\n }\n ownModifiers.push(modifier)\n }\n this.addProcessedElement(arr[i], i + 1)\n }\n len = ownStyles.length\n for (i = 0; i < len; i += 1) {\n ownStyles[i].closed = true\n }\n len = ownModifiers.length\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true\n }\n }\n\n SVGShapeElement.prototype.renderInnerContent = function () {\n this.renderModifiers()\n var i\n var len = this.stylesList.length\n for (i = 0; i < len; i += 1) {\n this.stylesList[i].reset()\n }\n this.renderShape()\n for (i = 0; i < len; i += 1) {\n if (this.stylesList[i]._mdf || this._isFirstFrame) {\n if (this.stylesList[i].msElem) {\n this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d)\n // Adding M0 0 fixes same mask bug on all browsers\n this.stylesList[i].d = 'M0 0' + this.stylesList[i].d\n }\n this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0')\n }\n }\n }\n\n SVGShapeElement.prototype.renderShape = function () {\n var i\n var len = this.animatedContents.length\n var animatedContent\n for (i = 0; i < len; i += 1) {\n animatedContent = this.animatedContents[i]\n if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {\n animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame)\n }\n }\n }\n\n SVGShapeElement.prototype.destroy = function () {\n this.destroyBaseElement()\n this.shapesData = null\n this.itemsData = null\n }\n\n function LetterProps(o, sw, sc, fc, m, p) {\n this.o = o\n this.sw = sw\n this.sc = sc\n this.fc = fc\n this.m = m\n this.p = p\n this._mdf = {\n o: true,\n sw: !!sw,\n sc: !!sc,\n fc: !!fc,\n m: true,\n p: true,\n }\n }\n\n LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {\n this._mdf.o = false\n this._mdf.sw = false\n this._mdf.sc = false\n this._mdf.fc = false\n this._mdf.m = false\n this._mdf.p = false\n var updated = false\n\n if (this.o !== o) {\n this.o = o\n this._mdf.o = true\n updated = true\n }\n if (this.sw !== sw) {\n this.sw = sw\n this._mdf.sw = true\n updated = true\n }\n if (this.sc !== sc) {\n this.sc = sc\n this._mdf.sc = true\n updated = true\n }\n if (this.fc !== fc) {\n this.fc = fc\n this._mdf.fc = true\n updated = true\n }\n if (this.m !== m) {\n this.m = m\n this._mdf.m = true\n updated = true\n }\n if (\n p.length &&\n (this.p[0] !== p[0] ||\n this.p[1] !== p[1] ||\n this.p[4] !== p[4] ||\n this.p[5] !== p[5] ||\n this.p[12] !== p[12] ||\n this.p[13] !== p[13])\n ) {\n this.p = p\n this._mdf.p = true\n updated = true\n }\n return updated\n }\n\n function TextProperty(elem, data) {\n this._frameId = initialDefaultFrame\n this.pv = ''\n this.v = ''\n this.kf = false\n this._isFirstFrame = true\n this._mdf = false\n this.data = data\n this.elem = elem\n this.comp = this.elem.comp\n this.keysIndex = 0\n this.canResize = false\n this.minimumFontSize = 1\n this.effectsSequence = []\n this.currentData = {\n ascent: 0,\n boxWidth: this.defaultBoxWidth,\n f: '',\n fStyle: '',\n fWeight: '',\n fc: '',\n j: '',\n justifyOffset: '',\n l: [],\n lh: 0,\n lineWidths: [],\n ls: '',\n of: '',\n s: '',\n sc: '',\n sw: 0,\n t: 0,\n tr: 0,\n sz: 0,\n ps: null,\n fillColorAnim: false,\n strokeColorAnim: false,\n strokeWidthAnim: false,\n yOffset: 0,\n finalSize: 0,\n finalText: [],\n finalLineHeight: 0,\n __complete: false,\n }\n this.copyData(this.currentData, this.data.d.k[0].s)\n\n if (!this.searchProperty()) {\n this.completeTextData(this.currentData)\n }\n }\n\n TextProperty.prototype.defaultBoxWidth = [0, 0]\n\n TextProperty.prototype.copyData = function (obj, data) {\n for (var s in data) {\n if (Object.prototype.hasOwnProperty.call(data, s)) {\n obj[s] = data[s]\n }\n }\n return obj\n }\n\n TextProperty.prototype.setCurrentData = function (data) {\n if (!data.__complete) {\n this.completeTextData(data)\n }\n this.currentData = data\n this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth\n this._mdf = true\n }\n\n TextProperty.prototype.searchProperty = function () {\n return this.searchKeyframes()\n }\n\n TextProperty.prototype.searchKeyframes = function () {\n this.kf = this.data.d.k.length > 1\n if (this.kf) {\n this.addEffect(this.getKeyframeValue.bind(this))\n }\n return this.kf\n }\n\n TextProperty.prototype.addEffect = function (effectFunction) {\n this.effectsSequence.push(effectFunction)\n this.elem.addDynamicProperty(this)\n }\n\n TextProperty.prototype.getValue = function (_finalValue) {\n if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {\n return\n }\n this.currentData.t = this.data.d.k[this.keysIndex].s.t\n var currentValue = this.currentData\n var currentIndex = this.keysIndex\n if (this.lock) {\n this.setCurrentData(this.currentData)\n return\n }\n this.lock = true\n this._mdf = false\n var i\n var len = this.effectsSequence.length\n var finalValue = _finalValue || this.data.d.k[this.keysIndex].s\n for (i = 0; i < len; i += 1) {\n // Checking if index changed to prevent creating a new object every time the expression updates.\n if (currentIndex !== this.keysIndex) {\n finalValue = this.effectsSequence[i](finalValue, finalValue.t)\n } else {\n finalValue = this.effectsSequence[i](this.currentData, finalValue.t)\n }\n }\n if (currentValue !== finalValue) {\n this.setCurrentData(finalValue)\n }\n this.v = this.currentData\n this.pv = this.v\n this.lock = false\n this.frameId = this.elem.globalData.frameId\n }\n\n TextProperty.prototype.getKeyframeValue = function () {\n var textKeys = this.data.d.k\n var frameNum = this.elem.comp.renderedFrame\n var i = 0\n var len = textKeys.length\n while (i <= len - 1) {\n if (i === len - 1 || textKeys[i + 1].t > frameNum) {\n break\n }\n i += 1\n }\n if (this.keysIndex !== i) {\n this.keysIndex = i\n }\n return this.data.d.k[this.keysIndex].s\n }\n\n TextProperty.prototype.buildFinalText = function (text) {\n var charactersArray = []\n var i = 0\n var len = text.length\n var charCode\n var secondCharCode\n var shouldCombine = false\n while (i < len) {\n charCode = text.charCodeAt(i)\n if (FontManager.isCombinedCharacter(charCode)) {\n charactersArray[charactersArray.length - 1] += text.charAt(i)\n } else if (charCode >= 0xd800 && charCode <= 0xdbff) {\n secondCharCode = text.charCodeAt(i + 1)\n if (secondCharCode >= 0xdc00 && secondCharCode <= 0xdfff) {\n if (shouldCombine || FontManager.isModifier(charCode, secondCharCode)) {\n charactersArray[charactersArray.length - 1] += text.substr(i, 2)\n shouldCombine = false\n } else {\n charactersArray.push(text.substr(i, 2))\n }\n i += 1\n } else {\n charactersArray.push(text.charAt(i))\n }\n } else if (charCode > 0xdbff) {\n secondCharCode = text.charCodeAt(i + 1)\n if (FontManager.isZeroWidthJoiner(charCode, secondCharCode)) {\n shouldCombine = true\n charactersArray[charactersArray.length - 1] += text.substr(i, 2)\n i += 1\n } else {\n charactersArray.push(text.charAt(i))\n }\n } else if (FontManager.isZeroWidthJoiner(charCode)) {\n charactersArray[charactersArray.length - 1] += text.charAt(i)\n shouldCombine = true\n } else {\n charactersArray.push(text.charAt(i))\n }\n i += 1\n }\n return charactersArray\n }\n\n TextProperty.prototype.completeTextData = function (documentData) {\n documentData.__complete = true\n var fontManager = this.elem.globalData.fontManager\n var data = this.data\n var letters = []\n var i\n var len\n var newLineFlag\n var index = 0\n var val\n var anchorGrouping = data.m.g\n var currentSize = 0\n var currentPos = 0\n var currentLine = 0\n var lineWidths = []\n var lineWidth = 0\n var maxLineWidth = 0\n var j\n var jLen\n var fontData = fontManager.getFontByName(documentData.f)\n var charData\n var cLength = 0\n\n var fontProps = getFontProperties(fontData)\n documentData.fWeight = fontProps.weight\n documentData.fStyle = fontProps.style\n documentData.finalSize = documentData.s\n documentData.finalText = this.buildFinalText(documentData.t)\n len = documentData.finalText.length\n documentData.finalLineHeight = documentData.lh\n var trackingOffset = (documentData.tr / 1000) * documentData.finalSize\n var charCode\n if (documentData.sz) {\n var flag = true\n var boxWidth = documentData.sz[0]\n var boxHeight = documentData.sz[1]\n var currentHeight\n var finalText\n while (flag) {\n finalText = this.buildFinalText(documentData.t)\n currentHeight = 0\n lineWidth = 0\n len = finalText.length\n trackingOffset = (documentData.tr / 1000) * documentData.finalSize\n var lastSpaceIndex = -1\n for (i = 0; i < len; i += 1) {\n charCode = finalText[i].charCodeAt(0)\n newLineFlag = false\n if (finalText[i] === ' ') {\n lastSpaceIndex = i\n } else if (charCode === 13 || charCode === 3) {\n lineWidth = 0\n newLineFlag = true\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily)\n cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100\n } else {\n // tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;\n cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize)\n }\n if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {\n if (lastSpaceIndex === -1) {\n len += 1\n } else {\n i = lastSpaceIndex\n }\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2\n finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\\r')\n // finalText = finalText.substr(0,i) + \"\\r\" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);\n lastSpaceIndex = -1\n lineWidth = 0\n } else {\n lineWidth += cLength\n lineWidth += trackingOffset\n }\n }\n currentHeight += (fontData.ascent * documentData.finalSize) / 100\n if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {\n documentData.finalSize -= 1\n documentData.finalLineHeight = (documentData.finalSize * documentData.lh) / documentData.s\n } else {\n documentData.finalText = finalText\n len = documentData.finalText.length\n flag = false\n }\n }\n }\n lineWidth = -trackingOffset\n cLength = 0\n var uncollapsedSpaces = 0\n var currentChar\n for (i = 0; i < len; i += 1) {\n newLineFlag = false\n currentChar = documentData.finalText[i]\n charCode = currentChar.charCodeAt(0)\n if (charCode === 13 || charCode === 3) {\n uncollapsedSpaces = 0\n lineWidths.push(lineWidth)\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth\n lineWidth = -2 * trackingOffset\n val = ''\n newLineFlag = true\n currentLine += 1\n } else {\n val = currentChar\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(\n currentChar,\n fontData.fStyle,\n fontManager.getFontByName(documentData.f).fFamily,\n )\n cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100\n } else {\n // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);\n // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;\n cLength = fontManager.measureText(val, documentData.f, documentData.finalSize)\n }\n\n //\n if (currentChar === ' ') {\n uncollapsedSpaces += cLength + trackingOffset\n } else {\n lineWidth += cLength + trackingOffset + uncollapsedSpaces\n uncollapsedSpaces = 0\n }\n letters.push({\n l: cLength,\n an: cLength,\n add: currentSize,\n n: newLineFlag,\n anIndexes: [],\n val: val,\n line: currentLine,\n animatorJustifyOffset: 0,\n })\n if (anchorGrouping == 2) {\n // eslint-disable-line eqeqeq\n currentSize += cLength\n if (val === '' || val === ' ' || i === len - 1) {\n if (val === '' || val === ' ') {\n currentSize -= cLength\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize\n letters[currentPos].ind = index\n letters[currentPos].extra = cLength\n currentPos += 1\n }\n index += 1\n currentSize = 0\n }\n } else if (anchorGrouping == 3) {\n // eslint-disable-line eqeqeq\n currentSize += cLength\n if (val === '' || i === len - 1) {\n if (val === '') {\n currentSize -= cLength\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize\n letters[currentPos].ind = index\n letters[currentPos].extra = cLength\n currentPos += 1\n }\n currentSize = 0\n index += 1\n }\n } else {\n letters[index].ind = index\n letters[index].extra = 0\n index += 1\n }\n }\n documentData.l = letters\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth\n lineWidths.push(lineWidth)\n if (documentData.sz) {\n documentData.boxWidth = documentData.sz[0]\n documentData.justifyOffset = 0\n } else {\n documentData.boxWidth = maxLineWidth\n switch (documentData.j) {\n case 1:\n documentData.justifyOffset = -documentData.boxWidth\n break\n case 2:\n documentData.justifyOffset = -documentData.boxWidth / 2\n break\n default:\n documentData.justifyOffset = 0\n }\n }\n documentData.lineWidths = lineWidths\n\n var animators = data.a\n var animatorData\n var letterData\n jLen = animators.length\n var based\n var ind\n var indexes = []\n for (j = 0; j < jLen; j += 1) {\n animatorData = animators[j]\n if (animatorData.a.sc) {\n documentData.strokeColorAnim = true\n }\n if (animatorData.a.sw) {\n documentData.strokeWidthAnim = true\n }\n if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {\n documentData.fillColorAnim = true\n }\n ind = 0\n based = animatorData.s.b\n for (i = 0; i < len; i += 1) {\n letterData = letters[i]\n letterData.anIndexes[j] = ind\n if (\n (based == 1 && letterData.val !== '') ||\n (based == 2 && letterData.val !== '' && letterData.val !== ' ') ||\n (based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1)) ||\n (based == 4 && (letterData.n || i == len - 1))\n ) {\n // eslint-disable-line eqeqeq\n if (animatorData.s.rn === 1) {\n indexes.push(ind)\n }\n ind += 1\n }\n }\n data.a[j].s.totalChars = ind\n var currentInd = -1\n var newInd\n if (animatorData.s.rn === 1) {\n for (i = 0; i < len; i += 1) {\n letterData = letters[i]\n if (currentInd != letterData.anIndexes[j]) {\n // eslint-disable-line eqeqeq\n currentInd = letterData.anIndexes[j]\n newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0]\n }\n letterData.anIndexes[j] = newInd\n }\n }\n }\n documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2\n documentData.ls = documentData.ls || 0\n documentData.ascent = (fontData.ascent * documentData.finalSize) / 100\n }\n\n TextProperty.prototype.updateDocumentData = function (newData, index) {\n index = index === undefined ? this.keysIndex : index\n var dData = this.copyData({}, this.data.d.k[index].s)\n dData = this.copyData(dData, newData)\n this.data.d.k[index].s = dData\n this.recalculate(index)\n this.elem.addDynamicProperty(this)\n }\n\n TextProperty.prototype.recalculate = function (index) {\n var dData = this.data.d.k[index].s\n dData.__complete = false\n this.keysIndex = 0\n this._isFirstFrame = true\n this.getValue(dData)\n }\n\n TextProperty.prototype.canResizeFont = function (_canResize) {\n this.canResize = _canResize\n this.recalculate(this.keysIndex)\n this.elem.addDynamicProperty(this)\n }\n\n TextProperty.prototype.setMinimumFontSize = function (_fontValue) {\n this.minimumFontSize = Math.floor(_fontValue) || 1\n this.recalculate(this.keysIndex)\n this.elem.addDynamicProperty(this)\n }\n\n const TextSelectorProp = (function () {\n var max = Math.max\n var min = Math.min\n var floor = Math.floor\n\n function TextSelectorPropFactory(elem, data) {\n this._currentTextLength = -1\n this.k = false\n this.data = data\n this.elem = elem\n this.comp = elem.comp\n this.finalS = 0\n this.finalE = 0\n this.initDynamicPropertyContainer(elem)\n this.s = PropertyFactory.getProp(elem, data.s || { k: 0 }, 0, 0, this)\n if ('e' in data) {\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this)\n } else {\n this.e = { v: 100 }\n }\n this.o = PropertyFactory.getProp(elem, data.o || { k: 0 }, 0, 0, this)\n this.xe = PropertyFactory.getProp(elem, data.xe || { k: 0 }, 0, 0, this)\n this.ne = PropertyFactory.getProp(elem, data.ne || { k: 0 }, 0, 0, this)\n this.sm = PropertyFactory.getProp(elem, data.sm || { k: 100 }, 0, 0, this)\n this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this)\n if (!this.dynamicProperties.length) {\n this.getValue()\n }\n }\n\n TextSelectorPropFactory.prototype = {\n getMult: function (ind) {\n if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {\n this.getValue()\n }\n var x1 = 0\n var y1 = 0\n var x2 = 1\n var y2 = 1\n if (this.ne.v > 0) {\n x1 = this.ne.v / 100.0\n } else {\n y1 = -this.ne.v / 100.0\n }\n if (this.xe.v > 0) {\n x2 = 1.0 - this.xe.v / 100.0\n } else {\n y2 = 1.0 + this.xe.v / 100.0\n }\n var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get\n\n var mult = 0\n var s = this.finalS\n var e = this.finalE\n var type = this.data.sh\n if (type === 2) {\n if (e === s) {\n mult = ind >= e ? 1 : 0\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1))\n }\n mult = easer(mult)\n } else if (type === 3) {\n if (e === s) {\n mult = ind >= e ? 0 : 1\n } else {\n mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1))\n }\n\n mult = easer(mult)\n } else if (type === 4) {\n if (e === s) {\n mult = 0\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1))\n if (mult < 0.5) {\n mult *= 2\n } else {\n mult = 1 - 2 * (mult - 0.5)\n }\n }\n mult = easer(mult)\n } else if (type === 5) {\n if (e === s) {\n mult = 0\n } else {\n var tot = e - s\n /* ind += 0.5;\n mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */\n ind = min(max(0, ind + 0.5 - s), e - s)\n var x = -tot / 2 + ind\n var a = tot / 2\n mult = Math.sqrt(1 - (x * x) / (a * a))\n }\n mult = easer(mult)\n } else if (type === 6) {\n if (e === s) {\n mult = 0\n } else {\n ind = min(max(0, ind + 0.5 - s), e - s)\n mult = (1 + Math.cos(Math.PI + (Math.PI * 2 * ind) / (e - s))) / 2 // eslint-disable-line\n }\n mult = easer(mult)\n } else {\n if (ind >= floor(s)) {\n if (ind - s < 0) {\n mult = max(0, min(min(e, 1) - (s - ind), 1))\n } else {\n mult = max(0, min(e - ind, 1))\n }\n }\n mult = easer(mult)\n }\n // Smoothness implementation.\n // The smoothness represents a reduced range of the original [0; 1] range.\n // if smoothness is 25%, the new range will be [0.375; 0.625]\n // Steps are:\n // - find the lower value of the new range (threshold)\n // - if multiplier is smaller than that value, floor it to 0\n // - if it is larger,\n // - subtract the threshold\n // - divide it by the smoothness (this will return the range to [0; 1])\n // Note: If it doesn't work on some scenarios, consider applying it before the easer.\n if (this.sm.v !== 100) {\n var smoothness = this.sm.v * 0.01\n if (smoothness === 0) {\n smoothness = 0.00000001\n }\n var threshold = 0.5 - smoothness * 0.5\n if (mult < threshold) {\n mult = 0\n } else {\n mult = (mult - threshold) / smoothness\n if (mult > 1) {\n mult = 1\n }\n }\n }\n return mult * this.a.v\n },\n getValue: function (newCharsFlag) {\n this.iterateDynamicProperties()\n this._mdf = newCharsFlag || this._mdf\n this._currentTextLength = this.elem.textProperty.currentData.l.length || 0\n if (newCharsFlag && this.data.r === 2) {\n this.e.v = this._currentTextLength\n }\n var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars\n var o = this.o.v / divisor\n var s = this.s.v / divisor + o\n var e = this.e.v / divisor + o\n if (s > e) {\n var _s = s\n s = e\n e = _s\n }\n this.finalS = s\n this.finalE = e\n },\n }\n extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory)\n\n function getTextSelectorProp(elem, data, arr) {\n return new TextSelectorPropFactory(elem, data, arr)\n }\n\n return {\n getTextSelectorProp: getTextSelectorProp,\n }\n })()\n\n function TextAnimatorDataProperty(elem, animatorProps, container) {\n var defaultData = { propType: false }\n var getProp = PropertyFactory.getProp\n var textAnimatorAnimatables = animatorProps.a\n this.a = {\n r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData,\n rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData,\n ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData,\n sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData,\n sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData,\n s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData,\n a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData,\n o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData,\n p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData,\n sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData,\n sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData,\n fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData,\n fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData,\n fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData,\n fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData,\n t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData,\n }\n\n this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container)\n this.s.t = animatorProps.s.t\n }\n\n function TextAnimatorProperty(textData, renderType, elem) {\n this._isFirstFrame = true\n this._hasMaskedPath = false\n this._frameId = -1\n this._textData = textData\n this._renderType = renderType\n this._elem = elem\n this._animatorsData = createSizedArray(this._textData.a.length)\n this._pathData = {}\n this._moreOptions = {\n alignment: {},\n }\n this.renderedLetters = []\n this.lettersChangedFlag = false\n this.initDynamicPropertyContainer(elem)\n }\n\n TextAnimatorProperty.prototype.searchProperties = function () {\n var i\n var len = this._textData.a.length\n var animatorProps\n var getProp = PropertyFactory.getProp\n for (i = 0; i < len; i += 1) {\n animatorProps = this._textData.a[i]\n this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this)\n }\n if (this._textData.p && 'm' in this._textData.p) {\n this._pathData = {\n a: getProp(this._elem, this._textData.p.a, 0, 0, this),\n f: getProp(this._elem, this._textData.p.f, 0, 0, this),\n l: getProp(this._elem, this._textData.p.l, 0, 0, this),\n r: getProp(this._elem, this._textData.p.r, 0, 0, this),\n p: getProp(this._elem, this._textData.p.p, 0, 0, this),\n m: this._elem.maskManager.getMaskProperty(this._textData.p.m),\n }\n this._hasMaskedPath = true\n } else {\n this._hasMaskedPath = false\n }\n this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this)\n }\n\n TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {\n this.lettersChangedFlag = lettersChangedFlag\n if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {\n return\n }\n this._isFirstFrame = false\n var alignment = this._moreOptions.alignment.v\n var animators = this._animatorsData\n var textData = this._textData\n var matrixHelper = this.mHelper\n var renderType = this._renderType\n var renderedLettersCount = this.renderedLetters.length\n var xPos\n var yPos\n var i\n var len\n var letters = documentData.l\n var pathInfo\n var currentLength\n var currentPoint\n var segmentLength\n var flag\n var pointInd\n var segmentInd\n var prevPoint\n var points\n var segments\n var partialLength\n var totalLength\n var perc\n var tanAngle\n var mask\n if (this._hasMaskedPath) {\n mask = this._pathData.m\n if (!this._pathData.n || this._pathData._mdf) {\n var paths = mask.v\n if (this._pathData.r.v) {\n paths = paths.reverse()\n }\n // TODO: release bezier data cached from previous pathInfo: this._pathData.pi\n pathInfo = {\n tLength: 0,\n segments: [],\n }\n len = paths._length - 1\n var bezierData\n totalLength = 0\n for (i = 0; i < len; i += 1) {\n bezierData = bez.buildBezierData(\n paths.v[i],\n paths.v[i + 1],\n [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],\n [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]],\n )\n pathInfo.tLength += bezierData.segmentLength\n pathInfo.segments.push(bezierData)\n totalLength += bezierData.segmentLength\n }\n i = len\n if (mask.v.c) {\n bezierData = bez.buildBezierData(\n paths.v[i],\n paths.v[0],\n [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]],\n [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]],\n )\n pathInfo.tLength += bezierData.segmentLength\n pathInfo.segments.push(bezierData)\n totalLength += bezierData.segmentLength\n }\n this._pathData.pi = pathInfo\n }\n pathInfo = this._pathData.pi\n\n currentLength = this._pathData.f.v\n segmentInd = 0\n pointInd = 1\n segmentLength = 0\n flag = true\n segments = pathInfo.segments\n if (currentLength < 0 && mask.v.c) {\n if (pathInfo.tLength < Math.abs(currentLength)) {\n currentLength = -Math.abs(currentLength) % pathInfo.tLength\n }\n segmentInd = segments.length - 1\n points = segments[segmentInd].points\n pointInd = points.length - 1\n while (currentLength < 0) {\n currentLength += points[pointInd].partialLength\n pointInd -= 1\n if (pointInd < 0) {\n segmentInd -= 1\n points = segments[segmentInd].points\n pointInd = points.length - 1\n }\n }\n }\n points = segments[segmentInd].points\n prevPoint = points[pointInd - 1]\n currentPoint = points[pointInd]\n partialLength = currentPoint.partialLength\n }\n\n len = letters.length\n xPos = 0\n yPos = 0\n var yOff = documentData.finalSize * 1.2 * 0.714\n var firstLine = true\n var animatorProps\n var animatorSelector\n var j\n var jLen\n var letterValue\n\n jLen = animators.length\n\n var mult\n var ind = -1\n var offf\n var xPathPos\n var yPathPos\n var initPathPos = currentLength\n var initSegmentInd = segmentInd\n var initPointInd = pointInd\n var currentLine = -1\n var elemOpacity\n var sc\n var sw\n var fc\n var k\n var letterSw\n var letterSc\n var letterFc\n var letterM = ''\n var letterP = this.defaultPropsArray\n var letterO\n\n //\n if (documentData.j === 2 || documentData.j === 1) {\n var animatorJustifyOffset = 0\n var animatorFirstCharOffset = 0\n var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1\n var lastIndex = 0\n var isNewLine = true\n\n for (i = 0; i < len; i += 1) {\n if (letters[i].n) {\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset\n lastIndex += 1\n }\n animatorJustifyOffset = 0\n isNewLine = true\n } else {\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.t.propType) {\n if (isNewLine && documentData.j === 2) {\n animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult\n }\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult\n } else {\n animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult\n }\n }\n }\n isNewLine = false\n }\n }\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset\n lastIndex += 1\n }\n }\n //\n\n for (i = 0; i < len; i += 1) {\n matrixHelper.reset()\n elemOpacity = 1\n if (letters[i].n) {\n xPos = 0\n yPos += documentData.yOffset\n yPos += firstLine ? 1 : 0\n currentLength = initPathPos\n firstLine = false\n if (this._hasMaskedPath) {\n segmentInd = initSegmentInd\n pointInd = initPointInd\n points = segments[segmentInd].points\n prevPoint = points[pointInd - 1]\n currentPoint = points[pointInd]\n partialLength = currentPoint.partialLength\n segmentLength = 0\n }\n letterM = ''\n letterFc = ''\n letterSw = ''\n letterO = ''\n letterP = this.defaultPropsArray\n } else {\n if (this._hasMaskedPath) {\n if (currentLine !== letters[i].line) {\n switch (documentData.j) {\n case 1:\n currentLength += totalLength - documentData.lineWidths[letters[i].line]\n break\n case 2:\n currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2\n break\n default:\n break\n }\n currentLine = letters[i].line\n }\n if (ind !== letters[i].ind) {\n if (letters[ind]) {\n currentLength += letters[ind].extra\n }\n currentLength += letters[i].an / 2\n ind = letters[i].ind\n }\n currentLength += alignment[0] * letters[i].an * 0.005\n var animatorOffset = 0\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n animatorOffset += animatorProps.p.v[0] * mult[0]\n } else {\n animatorOffset += animatorProps.p.v[0] * mult\n }\n }\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n animatorOffset += animatorProps.a.v[0] * mult[0]\n } else {\n animatorOffset += animatorProps.a.v[0] * mult\n }\n }\n }\n flag = true\n // Force alignment only works with a single line for now\n if (this._pathData.a.v) {\n currentLength =\n letters[0].an * 0.5 +\n ((totalLength - this._pathData.f.v - letters[0].an * 0.5 - letters[letters.length - 1].an * 0.5) * ind) /\n (len - 1)\n currentLength += this._pathData.f.v\n }\n while (flag) {\n if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {\n perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength\n xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc\n yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -(alignment[1] * yOff) * 0.01)\n flag = false\n } else if (points) {\n segmentLength += currentPoint.partialLength\n pointInd += 1\n if (pointInd >= points.length) {\n pointInd = 0\n segmentInd += 1\n if (!segments[segmentInd]) {\n if (mask.v.c) {\n pointInd = 0\n segmentInd = 0\n points = segments[segmentInd].points\n } else {\n segmentLength -= currentPoint.partialLength\n points = null\n }\n } else {\n points = segments[segmentInd].points\n }\n }\n if (points) {\n prevPoint = currentPoint\n currentPoint = points[pointInd]\n partialLength = currentPoint.partialLength\n }\n }\n }\n offf = letters[i].an / 2 - letters[i].add\n matrixHelper.translate(-offf, 0, 0)\n } else {\n offf = letters[i].an / 2 - letters[i].add\n matrixHelper.translate(-offf, 0, 0)\n\n // Grouping alignment\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -alignment[1] * yOff * 0.01, 0)\n }\n\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.t.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n // This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean \"isNewLine\"\n if (xPos !== 0 || documentData.j !== 0) {\n if (this._hasMaskedPath) {\n if (mult.length) {\n currentLength += animatorProps.t.v * mult[0]\n } else {\n currentLength += animatorProps.t.v * mult\n }\n } else if (mult.length) {\n xPos += animatorProps.t.v * mult[0]\n } else {\n xPos += animatorProps.t.v * mult\n }\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n sw = documentData.sw || 0\n }\n if (documentData.strokeColorAnim) {\n if (documentData.sc) {\n sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]]\n } else {\n sc = [0, 0, 0]\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]]\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n\n if (mult.length) {\n matrixHelper.translate(\n -animatorProps.a.v[0] * mult[0],\n -animatorProps.a.v[1] * mult[1],\n animatorProps.a.v[2] * mult[2],\n )\n } else {\n matrixHelper.translate(\n -animatorProps.a.v[0] * mult,\n -animatorProps.a.v[1] * mult,\n animatorProps.a.v[2] * mult,\n )\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n if (animatorProps.s.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (mult.length) {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult[0], 1 + (animatorProps.s.v[1] - 1) * mult[1], 1)\n } else {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult, 1 + (animatorProps.s.v[1] - 1) * mult, 1)\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (animatorProps.sk.propType) {\n if (mult.length) {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1])\n } else {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult)\n }\n }\n if (animatorProps.r.propType) {\n if (mult.length) {\n matrixHelper.rotateZ(-animatorProps.r.v * mult[2])\n } else {\n matrixHelper.rotateZ(-animatorProps.r.v * mult)\n }\n }\n if (animatorProps.ry.propType) {\n if (mult.length) {\n matrixHelper.rotateY(animatorProps.ry.v * mult[1])\n } else {\n matrixHelper.rotateY(animatorProps.ry.v * mult)\n }\n }\n if (animatorProps.rx.propType) {\n if (mult.length) {\n matrixHelper.rotateX(animatorProps.rx.v * mult[0])\n } else {\n matrixHelper.rotateX(animatorProps.rx.v * mult)\n }\n }\n if (animatorProps.o.propType) {\n if (mult.length) {\n elemOpacity += (animatorProps.o.v * mult[0] - elemOpacity) * mult[0]\n } else {\n elemOpacity += (animatorProps.o.v * mult - elemOpacity) * mult\n }\n }\n if (documentData.strokeWidthAnim && animatorProps.sw.propType) {\n if (mult.length) {\n sw += animatorProps.sw.v * mult[0]\n } else {\n sw += animatorProps.sw.v * mult\n }\n }\n if (documentData.strokeColorAnim && animatorProps.sc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0]\n } else {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult\n }\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n if (animatorProps.fc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0]\n } else {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult\n }\n }\n }\n if (animatorProps.fh.propType) {\n if (mult.length) {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult[0])\n } else {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult)\n }\n }\n if (animatorProps.fs.propType) {\n if (mult.length) {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0])\n } else {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult)\n }\n }\n if (animatorProps.fb.propType) {\n if (mult.length) {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0])\n } else {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult)\n }\n }\n }\n }\n\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a\n\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars)\n if (this._hasMaskedPath) {\n if (mult.length) {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1])\n } else {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult)\n }\n } else if (mult.length) {\n matrixHelper.translate(\n animatorProps.p.v[0] * mult[0],\n animatorProps.p.v[1] * mult[1],\n -animatorProps.p.v[2] * mult[2],\n )\n } else {\n matrixHelper.translate(\n animatorProps.p.v[0] * mult,\n animatorProps.p.v[1] * mult,\n -animatorProps.p.v[2] * mult,\n )\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n letterSw = sw < 0 ? 0 : sw\n }\n if (documentData.strokeColorAnim) {\n letterSc =\n 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')'\n }\n if (documentData.fillColorAnim && documentData.fc) {\n letterFc =\n 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')'\n }\n\n if (this._hasMaskedPath) {\n matrixHelper.translate(0, -documentData.ls)\n\n matrixHelper.translate(0, alignment[1] * yOff * 0.01 + yPos, 0)\n if (this._pathData.p.v) {\n tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0])\n var rot = (Math.atan(tanAngle) * 180) / Math.PI\n if (currentPoint.point[0] < prevPoint.point[0]) {\n rot += 180\n }\n matrixHelper.rotate((-rot * Math.PI) / 180)\n }\n matrixHelper.translate(xPathPos, yPathPos, 0)\n currentLength -= alignment[0] * letters[i].an * 0.005\n if (letters[i + 1] && ind !== letters[i + 1].ind) {\n currentLength += letters[i].an / 2\n currentLength += documentData.tr * 0.001 * documentData.finalSize\n }\n } else {\n matrixHelper.translate(xPos, yPos, 0)\n\n if (documentData.ps) {\n // matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0)\n }\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(\n letters[i].animatorJustifyOffset +\n documentData.justifyOffset +\n (documentData.boxWidth - documentData.lineWidths[letters[i].line]),\n 0,\n 0,\n )\n break\n case 2:\n matrixHelper.translate(\n letters[i].animatorJustifyOffset +\n documentData.justifyOffset +\n (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2,\n 0,\n 0,\n )\n break\n default:\n break\n }\n matrixHelper.translate(0, -documentData.ls)\n matrixHelper.translate(offf, 0, 0)\n matrixHelper.translate(alignment[0] * letters[i].an * 0.005, alignment[1] * yOff * 0.01, 0)\n xPos += letters[i].l + documentData.tr * 0.001 * documentData.finalSize\n }\n if (renderType === 'html') {\n letterM = matrixHelper.toCSS()\n } else if (renderType === 'svg') {\n letterM = matrixHelper.to2dCSS()\n } else {\n letterP = [\n matrixHelper.props[0],\n matrixHelper.props[1],\n matrixHelper.props[2],\n matrixHelper.props[3],\n matrixHelper.props[4],\n matrixHelper.props[5],\n matrixHelper.props[6],\n matrixHelper.props[7],\n matrixHelper.props[8],\n matrixHelper.props[9],\n matrixHelper.props[10],\n matrixHelper.props[11],\n matrixHelper.props[12],\n matrixHelper.props[13],\n matrixHelper.props[14],\n matrixHelper.props[15],\n ]\n }\n letterO = elemOpacity\n }\n\n if (renderedLettersCount <= i) {\n letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP)\n this.renderedLetters.push(letterValue)\n renderedLettersCount += 1\n this.lettersChangedFlag = true\n } else {\n letterValue = this.renderedLetters[i]\n this.lettersChangedFlag =\n letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag\n }\n }\n }\n\n TextAnimatorProperty.prototype.getValue = function () {\n if (this._elem.globalData.frameId === this._frameId) {\n return\n }\n this._frameId = this._elem.globalData.frameId\n this.iterateDynamicProperties()\n }\n\n TextAnimatorProperty.prototype.mHelper = new Matrix()\n TextAnimatorProperty.prototype.defaultPropsArray = []\n extendPrototype([DynamicPropertyContainer], TextAnimatorProperty)\n\n function ITextElement() {}\n\n ITextElement.prototype.initElement = function (data, globalData, comp) {\n this.lettersChangedFlag = true\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.textProperty = new TextProperty(this, data.t, this.dynamicProperties)\n this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this)\n this.initTransform(data, globalData, comp)\n this.initHierarchy()\n this.initRenderable()\n this.initRendererElement()\n this.createContainerElements()\n this.createRenderableComponents()\n this.createContent()\n this.hide()\n this.textAnimator.searchProperties(this.dynamicProperties)\n }\n\n ITextElement.prototype.prepareFrame = function (num) {\n this._mdf = false\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n if (this.textProperty._mdf || this.textProperty._isFirstFrame) {\n this.buildNewText()\n this.textProperty._isFirstFrame = false\n this.textProperty._mdf = false\n }\n }\n\n ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {\n var j\n var jLen = shapes.length\n var pathNodes\n var shapeStr = ''\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n pathNodes = shapes[j].ks.k\n shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper)\n }\n }\n return shapeStr\n }\n\n ITextElement.prototype.updateDocumentData = function (newData, index) {\n this.textProperty.updateDocumentData(newData, index)\n }\n\n ITextElement.prototype.canResizeFont = function (_canResize) {\n this.textProperty.canResizeFont(_canResize)\n }\n\n ITextElement.prototype.setMinimumFontSize = function (_fontSize) {\n this.textProperty.setMinimumFontSize(_fontSize)\n }\n\n ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {\n if (documentData.ps) {\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0)\n }\n matrixHelper.translate(0, -documentData.ls, 0)\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(\n documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]),\n 0,\n 0,\n )\n break\n case 2:\n matrixHelper.translate(\n documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2,\n 0,\n 0,\n )\n break\n default:\n break\n }\n matrixHelper.translate(xPos, yPos, 0)\n }\n\n ITextElement.prototype.buildColor = function (colorData) {\n return (\n 'rgb(' +\n Math.round(colorData[0] * 255) +\n ',' +\n Math.round(colorData[1] * 255) +\n ',' +\n Math.round(colorData[2] * 255) +\n ')'\n )\n }\n\n ITextElement.prototype.emptyProp = new LetterProps()\n\n ITextElement.prototype.destroy = function () {}\n\n var emptyShapeData = {\n shapes: [],\n }\n\n function SVGTextLottieElement(data, globalData, comp) {\n this.textSpans = []\n this.renderType = 'svg'\n this.initElement(data, globalData, comp)\n }\n\n extendPrototype(\n [BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement],\n SVGTextLottieElement,\n )\n\n SVGTextLottieElement.prototype.createContent = function () {\n if (this.data.singleShape && !this.globalData.fontManager.chars) {\n this.textContainer = createNS('text')\n }\n }\n\n SVGTextLottieElement.prototype.buildTextContents = function (textArray) {\n var i = 0\n var len = textArray.length\n var textContents = []\n var currentTextContent = ''\n while (i < len) {\n if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {\n textContents.push(currentTextContent)\n currentTextContent = ''\n } else {\n currentTextContent += textArray[i]\n }\n i += 1\n }\n textContents.push(currentTextContent)\n return textContents\n }\n\n SVGTextLottieElement.prototype.buildShapeData = function (data, scale) {\n // data should probably be cloned to apply scale separately to each instance of a text on different layers\n // but since text internal content gets only rendered once and then it's never rerendered,\n // it's probably safe not to clone data and reuse always the same instance even if the object is mutated.\n // Avoiding cloning is preferred since cloning each character shape data is expensive\n if (data.shapes && data.shapes.length) {\n var shape = data.shapes[0]\n if (shape.it) {\n var shapeItem = shape.it[shape.it.length - 1]\n if (shapeItem.s) {\n shapeItem.s.k[0] = scale\n shapeItem.s.k[1] = scale\n }\n }\n }\n return data\n }\n\n SVGTextLottieElement.prototype.buildNewText = function () {\n this.addDynamicProperty(this)\n var i\n var len\n\n var documentData = this.textProperty.currentData\n this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0)\n if (documentData.fc) {\n this.layerElement.setAttribute('fill', this.buildColor(documentData.fc))\n } else {\n this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)')\n }\n if (documentData.sc) {\n this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc))\n this.layerElement.setAttribute('stroke-width', documentData.sw)\n }\n this.layerElement.setAttribute('font-size', documentData.finalSize)\n var fontData = this.globalData.fontManager.getFontByName(documentData.f)\n if (fontData.fClass) {\n this.layerElement.setAttribute('class', fontData.fClass)\n } else {\n this.layerElement.setAttribute('font-family', fontData.fFamily)\n var fWeight = documentData.fWeight\n var fStyle = documentData.fStyle\n this.layerElement.setAttribute('font-style', fStyle)\n this.layerElement.setAttribute('font-weight', fWeight)\n }\n this.layerElement.setAttribute('aria-label', documentData.t)\n\n var letters = documentData.l || []\n var usesGlyphs = !!this.globalData.fontManager.chars\n len = letters.length\n\n var tSpan\n var matrixHelper = this.mHelper\n var shapeStr = ''\n var singleShape = this.data.singleShape\n var xPos = 0\n var yPos = 0\n var firstLine = true\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize\n if (singleShape && !usesGlyphs && !documentData.sz) {\n var tElement = this.textContainer\n var justify = 'start'\n switch (documentData.j) {\n case 1:\n justify = 'end'\n break\n case 2:\n justify = 'middle'\n break\n default:\n justify = 'start'\n break\n }\n tElement.setAttribute('text-anchor', justify)\n tElement.setAttribute('letter-spacing', trackingOffset)\n var textContent = this.buildTextContents(documentData.finalText)\n len = textContent.length\n yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0\n for (i = 0; i < len; i += 1) {\n tSpan = this.textSpans[i].span || createNS('tspan')\n tSpan.textContent = textContent[i]\n tSpan.setAttribute('x', 0)\n tSpan.setAttribute('y', yPos)\n tSpan.style.display = 'inherit'\n tElement.appendChild(tSpan)\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n glyph: null,\n }\n }\n this.textSpans[i].span = tSpan\n yPos += documentData.finalLineHeight\n }\n\n this.layerElement.appendChild(tElement)\n } else {\n var cachedSpansLength = this.textSpans.length\n var charData\n for (i = 0; i < len; i += 1) {\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n childSpan: null,\n glyph: null,\n }\n }\n if (!usesGlyphs || !singleShape || i === 0) {\n tSpan = cachedSpansLength > i ? this.textSpans[i].span : createNS(usesGlyphs ? 'g' : 'text')\n if (cachedSpansLength <= i) {\n tSpan.setAttribute('stroke-linecap', 'butt')\n tSpan.setAttribute('stroke-linejoin', 'round')\n tSpan.setAttribute('stroke-miterlimit', '4')\n this.textSpans[i].span = tSpan\n if (usesGlyphs) {\n var childSpan = createNS('g')\n tSpan.appendChild(childSpan)\n this.textSpans[i].childSpan = childSpan\n }\n this.textSpans[i].span = tSpan\n this.layerElement.appendChild(tSpan)\n }\n tSpan.style.display = 'inherit'\n }\n\n matrixHelper.reset()\n if (singleShape) {\n if (letters[i].n) {\n xPos = -trackingOffset\n yPos += documentData.yOffset\n yPos += firstLine ? 1 : 0\n firstLine = false\n }\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos)\n xPos += letters[i].l || 0\n // xPos += letters[i].val === ' ' ? 0 : trackingOffset;\n xPos += trackingOffset\n }\n if (usesGlyphs) {\n charData = this.globalData.fontManager.getCharData(\n documentData.finalText[i],\n fontData.fStyle,\n this.globalData.fontManager.getFontByName(documentData.f).fFamily,\n )\n var glyphElement\n // t === 1 means the character has been replaced with an animated shaped\n if (charData.t === 1) {\n glyphElement = new SVGCompElement(charData.data, this.globalData, this)\n } else {\n var data = emptyShapeData\n if (charData.data && charData.data.shapes) {\n data = this.buildShapeData(charData.data, documentData.finalSize)\n }\n glyphElement = new SVGShapeElement(data, this.globalData, this)\n }\n if (this.textSpans[i].glyph) {\n var glyph = this.textSpans[i].glyph\n this.textSpans[i].childSpan.removeChild(glyph.layerElement)\n glyph.destroy()\n }\n this.textSpans[i].glyph = glyphElement\n glyphElement._debug = true\n glyphElement.prepareFrame(0)\n glyphElement.renderFrame()\n this.textSpans[i].childSpan.appendChild(glyphElement.layerElement)\n // when using animated shapes, the layer will be scaled instead of replacing the internal scale\n // this might have issues with strokes and might need a different solution\n if (charData.t === 1) {\n this.textSpans[i].childSpan.setAttribute(\n 'transform',\n 'scale(' + documentData.finalSize / 100 + ',' + documentData.finalSize / 100 + ')',\n )\n }\n } else {\n if (singleShape) {\n tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')')\n }\n tSpan.textContent = letters[i].val\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve')\n }\n //\n }\n if (singleShape && tSpan) {\n tSpan.setAttribute('d', shapeStr)\n }\n }\n while (i < this.textSpans.length) {\n this.textSpans[i].span.style.display = 'none'\n i += 1\n }\n\n this._sizeChanged = true\n }\n\n SVGTextLottieElement.prototype.sourceRectAtTime = function () {\n this.prepareFrame(this.comp.renderedFrame - this.data.st)\n this.renderInnerContent()\n if (this._sizeChanged) {\n this._sizeChanged = false\n var textBox = this.layerElement.getBBox()\n this.bbox = {\n top: textBox.y,\n left: textBox.x,\n width: textBox.width,\n height: textBox.height,\n }\n }\n return this.bbox\n }\n\n SVGTextLottieElement.prototype.getValue = function () {\n var i\n var len = this.textSpans.length\n var glyphElement\n this.renderedFrame = this.comp.renderedFrame\n for (i = 0; i < len; i += 1) {\n glyphElement = this.textSpans[i].glyph\n if (glyphElement) {\n glyphElement.prepareFrame(this.comp.renderedFrame - this.data.st)\n if (glyphElement._mdf) {\n this._mdf = true\n }\n }\n }\n }\n\n SVGTextLottieElement.prototype.renderInnerContent = function () {\n if (!this.data.singleShape || this._mdf) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag)\n if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {\n this._sizeChanged = true\n var i\n var len\n var renderedLetters = this.textAnimator.renderedLetters\n\n var letters = this.textProperty.currentData.l\n\n len = letters.length\n var renderedLetter\n var textSpan\n var glyphElement\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i]\n textSpan = this.textSpans[i].span\n glyphElement = this.textSpans[i].glyph\n if (glyphElement) {\n glyphElement.renderFrame()\n }\n if (renderedLetter._mdf.m) {\n textSpan.setAttribute('transform', renderedLetter.m)\n }\n if (renderedLetter._mdf.o) {\n textSpan.setAttribute('opacity', renderedLetter.o)\n }\n if (renderedLetter._mdf.sw) {\n textSpan.setAttribute('stroke-width', renderedLetter.sw)\n }\n if (renderedLetter._mdf.sc) {\n textSpan.setAttribute('stroke', renderedLetter.sc)\n }\n if (renderedLetter._mdf.fc) {\n textSpan.setAttribute('fill', renderedLetter.fc)\n }\n }\n }\n }\n }\n }\n\n function ISolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp)\n }\n extendPrototype([IImageElement], ISolidElement)\n\n ISolidElement.prototype.createContent = function () {\n var rect = createNS('rect')\n /// /rect.style.width = this.data.sw;\n /// /rect.style.height = this.data.sh;\n /// /rect.style.fill = this.data.sc;\n rect.setAttribute('width', this.data.sw)\n rect.setAttribute('height', this.data.sh)\n rect.setAttribute('fill', this.data.sc)\n this.layerElement.appendChild(rect)\n }\n\n function NullElement(data, globalData, comp) {\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.initFrame()\n this.initTransform(data, globalData, comp)\n this.initHierarchy()\n }\n\n NullElement.prototype.prepareFrame = function (num) {\n this.prepareProperties(num, true)\n }\n\n NullElement.prototype.renderFrame = function () {}\n\n NullElement.prototype.getBaseElement = function () {\n return null\n }\n\n NullElement.prototype.destroy = function () {}\n\n NullElement.prototype.sourceRectAtTime = function () {}\n\n NullElement.prototype.hide = function () {}\n\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement)\n\n function SVGRendererBase() {}\n\n extendPrototype([BaseRenderer], SVGRendererBase)\n\n SVGRendererBase.prototype.createNull = function (data) {\n return new NullElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createShape = function (data) {\n return new SVGShapeElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createText = function (data) {\n return new SVGTextLottieElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createImage = function (data) {\n return new IImageElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.createSolid = function (data) {\n return new ISolidElement(data, this.globalData, this)\n }\n\n SVGRendererBase.prototype.configAnimation = function (animData) {\n this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n if (this.renderConfig.viewBoxSize) {\n this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize)\n } else {\n this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h)\n }\n\n if (!this.renderConfig.viewBoxOnly) {\n this.svgElement.setAttribute('width', animData.w)\n this.svgElement.setAttribute('height', animData.h)\n this.svgElement.style.width = '100%'\n this.svgElement.style.height = '100%'\n this.svgElement.style.transform = 'translate3d(0,0,0)'\n this.svgElement.style.contentVisibility = this.renderConfig.contentVisibility\n }\n if (this.renderConfig.width) {\n this.svgElement.setAttribute('width', this.renderConfig.width)\n }\n if (this.renderConfig.height) {\n this.svgElement.setAttribute('height', this.renderConfig.height)\n }\n if (this.renderConfig.className) {\n this.svgElement.setAttribute('class', this.renderConfig.className)\n }\n if (this.renderConfig.id) {\n this.svgElement.setAttribute('id', this.renderConfig.id)\n }\n if (this.renderConfig.focusable !== undefined) {\n this.svgElement.setAttribute('focusable', this.renderConfig.focusable)\n }\n this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio)\n // this.layerElement.style.transform = 'translate3d(0,0,0)';\n // this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = \"0px 0px 0px\";\n this.animationItem.wrapper.appendChild(this.svgElement)\n // Mask animation\n var defs = this.globalData.defs\n\n this.setupGlobalData(animData, defs)\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad\n this.data = animData\n\n var maskElement = createNS('clipPath')\n var rect = createNS('rect')\n rect.setAttribute('width', animData.w)\n rect.setAttribute('height', animData.h)\n rect.setAttribute('x', 0)\n rect.setAttribute('y', 0)\n var maskId = createElementID()\n maskElement.setAttribute('id', maskId)\n maskElement.appendChild(rect)\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + maskId + ')')\n\n defs.appendChild(maskElement)\n this.layers = animData.layers\n this.elements = createSizedArray(animData.layers.length)\n }\n\n SVGRendererBase.prototype.destroy = function () {\n if (this.animationItem.wrapper) {\n this.animationItem.wrapper.innerText = ''\n }\n this.layerElement = null\n this.globalData.defs = null\n var i\n var len = this.layers ? this.layers.length : 0\n for (i = 0; i < len; i += 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n this.elements.length = 0\n this.destroyed = true\n this.animationItem = null\n }\n\n SVGRendererBase.prototype.updateContainerSize = function () {}\n\n SVGRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements\n if (elements[pos] || this.layers[pos].ty === 99) {\n return\n }\n elements[pos] = true\n var element = this.createItem(this.layers[pos])\n\n elements[pos] = element\n if (getExpressionsPlugin()) {\n if (this.layers[pos].ty === 0) {\n this.globalData.projectInterface.registerComposition(element)\n }\n element.initExpressions()\n }\n this.appendElementInPos(element, pos)\n if (this.layers[pos].tt) {\n if (!this.elements[pos - 1] || this.elements[pos - 1] === true) {\n this.buildItem(pos - 1)\n this.addPendingElement(element)\n } else {\n element.setMatte(elements[pos - 1].layerId)\n }\n }\n }\n\n SVGRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop()\n element.checkParenting()\n if (element.data.tt) {\n var i = 0\n var len = this.elements.length\n while (i < len) {\n if (this.elements[i] === element) {\n element.setMatte(this.elements[i - 1].layerId)\n break\n }\n i += 1\n }\n }\n }\n }\n\n SVGRendererBase.prototype.renderFrame = function (num) {\n if (this.renderedFrame === num || this.destroyed) {\n return\n }\n if (num === null) {\n num = this.renderedFrame\n } else {\n this.renderedFrame = num\n }\n // console.log('-------');\n // console.log('FRAME ',num);\n this.globalData.frameNum = num\n this.globalData.frameId += 1\n this.globalData.projectInterface.currentFrame = num\n this.globalData._mdf = false\n var i\n var len = this.layers.length\n if (!this.completeLayers) {\n this.checkLayers(num)\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st)\n }\n }\n if (this.globalData._mdf) {\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n }\n }\n\n SVGRendererBase.prototype.appendElementInPos = function (element, pos) {\n var newElement = element.getBaseElement()\n if (!newElement) {\n return\n }\n var i = 0\n var nextElement\n while (i < pos) {\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {\n nextElement = this.elements[i].getBaseElement()\n }\n i += 1\n }\n if (nextElement) {\n this.layerElement.insertBefore(newElement, nextElement)\n } else {\n this.layerElement.appendChild(newElement)\n }\n }\n\n SVGRendererBase.prototype.hide = function () {\n this.layerElement.style.display = 'none'\n }\n\n SVGRendererBase.prototype.show = function () {\n this.layerElement.style.display = 'block'\n }\n\n function ICompElement() {}\n\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement)\n\n ICompElement.prototype.initElement = function (data, globalData, comp) {\n this.initFrame()\n this.initBaseData(data, globalData, comp)\n this.initTransform(data, globalData, comp)\n this.initRenderable()\n this.initHierarchy()\n this.initRendererElement()\n this.createContainerElements()\n this.createRenderableComponents()\n if (this.data.xt || !globalData.progressiveLoad) {\n this.buildAllItems()\n }\n this.hide()\n }\n\n /* ICompElement.prototype.hide = function(){\n if(!this.hidden){\n this.hideElement();\n var i,len = this.elements.length;\n for( i = 0; i < len; i+=1 ){\n if(this.elements[i]){\n this.elements[i].hide();\n }\n }\n }\n}; */\n\n ICompElement.prototype.prepareFrame = function (num) {\n this._mdf = false\n this.prepareRenderableFrame(num)\n this.prepareProperties(num, this.isInRange)\n if (!this.isInRange && !this.data.xt) {\n return\n }\n\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v\n if (timeRemapped === this.data.op) {\n timeRemapped = this.data.op - 1\n }\n this.renderedFrame = timeRemapped\n } else {\n this.renderedFrame = num / this.data.sr\n }\n var i\n var len = this.elements.length\n if (!this.completeLayers) {\n this.checkLayers(this.renderedFrame)\n }\n // This iteration needs to be backwards because of how expressions connect between each other\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st)\n if (this.elements[i]._mdf) {\n this._mdf = true\n }\n }\n }\n }\n\n ICompElement.prototype.renderInnerContent = function () {\n var i\n var len = this.layers.length\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n }\n\n ICompElement.prototype.setElements = function (elems) {\n this.elements = elems\n }\n\n ICompElement.prototype.getElements = function () {\n return this.elements\n }\n\n ICompElement.prototype.destroyElements = function () {\n var i\n var len = this.layers.length\n for (i = 0; i < len; i += 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n }\n\n ICompElement.prototype.destroy = function () {\n this.destroyElements()\n this.destroyBaseElement()\n }\n\n function SVGCompElement(data, globalData, comp) {\n this.layers = data.layers\n this.supports3d = true\n this.completeLayers = false\n this.pendingElements = []\n this.elements = this.layers ? createSizedArray(this.layers.length) : []\n this.initElement(data, globalData, comp)\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }\n }\n\n extendPrototype([SVGRendererBase, ICompElement, SVGBaseElement], SVGCompElement)\n\n SVGCompElement.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this)\n }\n\n function SVGRenderer(animationItem, config) {\n this.animationItem = animationItem\n this.layers = null\n this.renderedFrame = -1\n this.svgElement = createNS('svg')\n var ariaLabel = ''\n if (config && config.title) {\n var titleElement = createNS('title')\n var titleId = createElementID()\n titleElement.setAttribute('id', titleId)\n titleElement.textContent = config.title\n this.svgElement.appendChild(titleElement)\n ariaLabel += titleId\n }\n if (config && config.description) {\n var descElement = createNS('desc')\n var descId = createElementID()\n descElement.setAttribute('id', descId)\n descElement.textContent = config.description\n this.svgElement.appendChild(descElement)\n ariaLabel += ' ' + descId\n }\n if (ariaLabel) {\n this.svgElement.setAttribute('aria-labelledby', ariaLabel)\n }\n var defs = createNS('defs')\n this.svgElement.appendChild(defs)\n var maskElement = createNS('g')\n this.svgElement.appendChild(maskElement)\n this.layerElement = maskElement\n this.renderConfig = {\n preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\n imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\n contentVisibility: (config && config.contentVisibility) || 'visible',\n progressiveLoad: (config && config.progressiveLoad) || false,\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n viewBoxOnly: (config && config.viewBoxOnly) || false,\n viewBoxSize: (config && config.viewBoxSize) || false,\n className: (config && config.className) || '',\n id: (config && config.id) || '',\n focusable: config && config.focusable,\n filterSize: {\n width: (config && config.filterSize && config.filterSize.width) || '100%',\n height: (config && config.filterSize && config.filterSize.height) || '100%',\n x: (config && config.filterSize && config.filterSize.x) || '0%',\n y: (config && config.filterSize && config.filterSize.y) || '0%',\n },\n width: config && config.width,\n height: config && config.height,\n }\n\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n defs: defs,\n renderConfig: this.renderConfig,\n }\n this.elements = []\n this.pendingElements = []\n this.destroyed = false\n this.rendererType = 'svg'\n }\n\n extendPrototype([SVGRendererBase], SVGRenderer)\n\n SVGRenderer.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this)\n }\n\n function CVContextData() {\n this.saved = []\n this.cArrPos = 0\n this.cTr = new Matrix()\n this.cO = 1\n var i\n var len = 15\n this.savedOp = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n this.saved[i] = createTypedArray('float32', 16)\n }\n this._length = len\n }\n\n CVContextData.prototype.duplicate = function () {\n var newLength = this._length * 2\n var currentSavedOp = this.savedOp\n this.savedOp = createTypedArray('float32', newLength)\n this.savedOp.set(currentSavedOp)\n var i = 0\n for (i = this._length; i < newLength; i += 1) {\n this.saved[i] = createTypedArray('float32', 16)\n }\n this._length = newLength\n }\n\n CVContextData.prototype.reset = function () {\n this.cArrPos = 0\n this.cTr.reset()\n this.cO = 1\n }\n\n function ShapeTransformManager() {\n this.sequences = {}\n this.sequenceList = []\n this.transform_key_count = 0\n }\n\n ShapeTransformManager.prototype = {\n addTransformSequence: function (transforms) {\n var i\n var len = transforms.length\n var key = '_'\n for (i = 0; i < len; i += 1) {\n key += transforms[i].transform.key + '_'\n }\n var sequence = this.sequences[key]\n if (!sequence) {\n sequence = {\n transforms: [].concat(transforms),\n finalTransform: new Matrix(),\n _mdf: false,\n }\n this.sequences[key] = sequence\n this.sequenceList.push(sequence)\n }\n return sequence\n },\n processSequence: function (sequence, isFirstFrame) {\n var i = 0\n var len = sequence.transforms.length\n var _mdf = isFirstFrame\n while (i < len && !isFirstFrame) {\n if (sequence.transforms[i].transform.mProps._mdf) {\n _mdf = true\n break\n }\n i += 1\n }\n if (_mdf) {\n var props\n sequence.finalTransform.reset()\n for (i = len - 1; i >= 0; i -= 1) {\n props = sequence.transforms[i].transform.mProps.v.props\n sequence.finalTransform.transform(\n props[0],\n props[1],\n props[2],\n props[3],\n props[4],\n props[5],\n props[6],\n props[7],\n props[8],\n props[9],\n props[10],\n props[11],\n props[12],\n props[13],\n props[14],\n props[15],\n )\n }\n }\n sequence._mdf = _mdf\n },\n processSequences: function (isFirstFrame) {\n var i\n var len = this.sequenceList.length\n for (i = 0; i < len; i += 1) {\n this.processSequence(this.sequenceList[i], isFirstFrame)\n }\n },\n getNewKey: function () {\n this.transform_key_count += 1\n return '_' + this.transform_key_count\n },\n }\n\n function CVEffects() {}\n CVEffects.prototype.renderFrame = function () {}\n\n function CVMaskElement(data, element) {\n this.data = data\n this.element = element\n this.masksProperties = this.data.masksProperties || []\n this.viewData = createSizedArray(this.masksProperties.length)\n var i\n var len = this.masksProperties.length\n var hasMasks = false\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n hasMasks = true\n }\n this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3)\n }\n this.hasMasks = hasMasks\n if (hasMasks) {\n this.element.addRenderableComponent(this)\n }\n }\n\n CVMaskElement.prototype.renderFrame = function () {\n if (!this.hasMasks) {\n return\n }\n var transform = this.element.finalTransform.mat\n var ctx = this.element.canvasContext\n var i\n var len = this.masksProperties.length\n var pt\n var pts\n var data\n ctx.beginPath()\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n if (this.masksProperties[i].inv) {\n ctx.moveTo(0, 0)\n ctx.lineTo(this.element.globalData.compSize.w, 0)\n ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h)\n ctx.lineTo(0, this.element.globalData.compSize.h)\n ctx.lineTo(0, 0)\n }\n data = this.viewData[i].v\n pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0)\n ctx.moveTo(pt[0], pt[1])\n var j\n var jLen = data._length\n for (j = 1; j < jLen; j += 1) {\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j])\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5])\n }\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0])\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5])\n }\n }\n this.element.globalData.renderer.save(true)\n ctx.clip()\n }\n\n CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty\n\n CVMaskElement.prototype.destroy = function () {\n this.element = null\n }\n\n function CVBaseElement() {}\n\n CVBaseElement.prototype = {\n createElements: function () {},\n initRendererElement: function () {},\n createContainerElements: function () {\n this.canvasContext = this.globalData.canvasContext\n this.renderableEffectsManager = new CVEffects(this)\n },\n createContent: function () {},\n setBlendMode: function () {\n var globalData = this.globalData\n if (globalData.blendMode !== this.data.bm) {\n globalData.blendMode = this.data.bm\n var blendModeValue = getBlendMode(this.data.bm)\n globalData.canvasContext.globalCompositeOperation = blendModeValue\n }\n },\n createRenderableComponents: function () {\n this.maskManager = new CVMaskElement(this.data, this)\n },\n hideElement: function () {\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n this.hidden = true\n }\n },\n showElement: function () {\n if (this.isInRange && !this.isTransparent) {\n this.hidden = false\n this._isFirstFrame = true\n this.maskManager._isFirstFrame = true\n }\n },\n renderFrame: function () {\n if (this.hidden || this.data.hd) {\n return\n }\n this.renderTransform()\n this.renderRenderable()\n this.setBlendMode()\n var forceRealStack = this.data.ty === 0\n this.globalData.renderer.save(forceRealStack)\n this.globalData.renderer.ctxTransform(this.finalTransform.mat.props)\n this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v)\n this.renderInnerContent()\n this.globalData.renderer.restore(forceRealStack)\n if (this.maskManager.hasMasks) {\n this.globalData.renderer.restore(true)\n }\n if (this._isFirstFrame) {\n this._isFirstFrame = false\n }\n },\n destroy: function () {\n this.canvasContext = null\n this.data = null\n this.globalData = null\n this.maskManager.destroy()\n },\n mHelper: new Matrix(),\n }\n CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement\n CVBaseElement.prototype.show = CVBaseElement.prototype.showElement\n\n function CVShapeData(element, data, styles, transformsManager) {\n this.styledShapes = []\n this.tr = [0, 0, 0, 0, 0, 0]\n var ty = 4\n if (data.ty === 'rc') {\n ty = 5\n } else if (data.ty === 'el') {\n ty = 6\n } else if (data.ty === 'sr') {\n ty = 7\n }\n this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element)\n var i\n var len = styles.length\n var styledShape\n for (i = 0; i < len; i += 1) {\n if (!styles[i].closed) {\n styledShape = {\n transforms: transformsManager.addTransformSequence(styles[i].transforms),\n trNodes: [],\n }\n this.styledShapes.push(styledShape)\n styles[i].elements.push(styledShape)\n }\n }\n }\n\n CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated\n\n function CVShapeElement(data, globalData, comp) {\n this.shapes = []\n this.shapesData = data.shapes\n this.stylesList = []\n this.itemsData = []\n this.prevViewData = []\n this.shapeModifiers = []\n this.processedElements = []\n this.transformsManager = new ShapeTransformManager()\n this.initElement(data, globalData, comp)\n }\n\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement],\n CVShapeElement,\n )\n\n CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement\n\n CVShapeElement.prototype.transformHelper = { opacity: 1, _opMdf: false }\n\n CVShapeElement.prototype.dashResetter = []\n\n CVShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, [])\n }\n\n CVShapeElement.prototype.createStyleElement = function (data, transforms) {\n var styleElem = {\n data: data,\n type: data.ty,\n preTransforms: this.transformsManager.addTransformSequence(transforms),\n transforms: [],\n elements: [],\n closed: data.hd === true,\n }\n var elementData = {}\n if (data.ty === 'fl' || data.ty === 'st') {\n elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this)\n if (!elementData.c.k) {\n styleElem.co =\n 'rgb(' +\n bmFloor(elementData.c.v[0]) +\n ',' +\n bmFloor(elementData.c.v[1]) +\n ',' +\n bmFloor(elementData.c.v[2]) +\n ')'\n }\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this)\n elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this)\n elementData.h = PropertyFactory.getProp(this, data.h || { k: 0 }, 0, 0.01, this)\n elementData.a = PropertyFactory.getProp(this, data.a || { k: 0 }, 0, degToRads, this)\n elementData.g = new GradientProperty(this, data.g, this)\n }\n elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this)\n if (data.ty === 'st' || data.ty === 'gs') {\n styleElem.lc = lineCapEnum[data.lc || 2]\n styleElem.lj = lineJoinEnum[data.lj || 2]\n if (data.lj == 1) {\n // eslint-disable-line eqeqeq\n styleElem.ml = data.ml\n }\n elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this)\n if (!elementData.w.k) {\n styleElem.wi = elementData.w.v\n }\n if (data.d) {\n var d = new DashProperty(this, data.d, 'canvas', this)\n elementData.d = d\n if (!elementData.d.k) {\n styleElem.da = elementData.d.dashArray\n styleElem.do = elementData.d.dashoffset[0]\n }\n }\n } else {\n styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero'\n }\n this.stylesList.push(styleElem)\n elementData.style = styleElem\n return elementData\n }\n\n CVShapeElement.prototype.createGroupElement = function () {\n var elementData = {\n it: [],\n prevViewData: [],\n }\n return elementData\n }\n\n CVShapeElement.prototype.createTransformElement = function (data) {\n var elementData = {\n transform: {\n opacity: 1,\n _opMdf: false,\n key: this.transformsManager.getNewKey(),\n op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),\n mProps: TransformPropertyFactory.getTransformProperty(this, data, this),\n },\n }\n return elementData\n }\n\n CVShapeElement.prototype.createShapeElement = function (data) {\n var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager)\n\n this.shapes.push(elementData)\n this.addShapeToModifiers(elementData)\n return elementData\n }\n\n CVShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true\n var i\n var len = this.itemsData.length\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i]\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, [])\n len = this.dynamicProperties.length\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue()\n }\n this.renderModifiers()\n this.transformsManager.processSequences(this._isFirstFrame)\n }\n\n CVShapeElement.prototype.addTransformToStyleList = function (transform) {\n var i\n var len = this.stylesList.length\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.push(transform)\n }\n }\n }\n\n CVShapeElement.prototype.removeTransformFromStyleList = function () {\n var i\n var len = this.stylesList.length\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.pop()\n }\n }\n }\n\n CVShapeElement.prototype.closeStyles = function (styles) {\n var i\n var len = styles.length\n for (i = 0; i < len; i += 1) {\n styles[i].closed = true\n }\n }\n\n CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {\n var i\n var len = arr.length - 1\n var j\n var jLen\n var ownStyles = []\n var ownModifiers = []\n var processedPos\n var modifier\n var currentTransform\n var ownTransforms = [].concat(transforms)\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i])\n if (!processedPos) {\n arr[i]._shouldRender = shouldRender\n } else {\n itemsData[i] = prevViewData[processedPos - 1]\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], ownTransforms)\n } else {\n itemsData[i].style.closed = false\n }\n\n ownStyles.push(itemsData[i].style)\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i])\n } else {\n jLen = itemsData[i].it.length\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j]\n }\n }\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms)\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n currentTransform = this.createTransformElement(arr[i])\n itemsData[i] = currentTransform\n }\n ownTransforms.push(itemsData[i])\n this.addTransformToStyleList(itemsData[i])\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i])\n }\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n modifier.init(this, arr[i])\n itemsData[i] = modifier\n this.shapeModifiers.push(modifier)\n } else {\n modifier = itemsData[i]\n modifier.closed = false\n }\n ownModifiers.push(modifier)\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty)\n itemsData[i] = modifier\n modifier.init(this, arr, i, itemsData)\n this.shapeModifiers.push(modifier)\n shouldRender = false\n } else {\n modifier = itemsData[i]\n modifier.closed = true\n }\n ownModifiers.push(modifier)\n }\n this.addProcessedElement(arr[i], i + 1)\n }\n this.removeTransformFromStyleList()\n this.closeStyles(ownStyles)\n len = ownModifiers.length\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true\n }\n }\n\n CVShapeElement.prototype.renderInnerContent = function () {\n this.transformHelper.opacity = 1\n this.transformHelper._opMdf = false\n this.renderModifiers()\n this.transformsManager.processSequences(this._isFirstFrame)\n this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true)\n }\n\n CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {\n if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {\n groupTransform.opacity = parentTransform.opacity\n groupTransform.opacity *= groupTransform.op.v\n groupTransform._opMdf = true\n }\n }\n\n CVShapeElement.prototype.drawLayer = function () {\n var i\n var len = this.stylesList.length\n var j\n var jLen\n var k\n var kLen\n var elems\n var nodes\n var renderer = this.globalData.renderer\n var ctx = this.globalData.canvasContext\n var type\n var currentStyle\n for (i = 0; i < len; i += 1) {\n currentStyle = this.stylesList[i]\n type = currentStyle.type\n\n // Skipping style when\n // Stroke width equals 0\n // style should not be rendered (extra unused repeaters)\n // current opacity equals 0\n // global opacity equals 0\n if (\n !(\n ((type === 'st' || type === 'gs') && currentStyle.wi === 0) ||\n !currentStyle.data._shouldRender ||\n currentStyle.coOp === 0 ||\n this.globalData.currentGlobalAlpha === 0\n )\n ) {\n renderer.save()\n elems = currentStyle.elements\n if (type === 'st' || type === 'gs') {\n ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd\n ctx.lineWidth = currentStyle.wi\n ctx.lineCap = currentStyle.lc\n ctx.lineJoin = currentStyle.lj\n ctx.miterLimit = currentStyle.ml || 0\n } else {\n ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd\n }\n renderer.ctxOpacity(currentStyle.coOp)\n if (type !== 'st' && type !== 'gs') {\n ctx.beginPath()\n }\n renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props)\n jLen = elems.length\n for (j = 0; j < jLen; j += 1) {\n if (type === 'st' || type === 'gs') {\n ctx.beginPath()\n if (currentStyle.da) {\n ctx.setLineDash(currentStyle.da)\n ctx.lineDashOffset = currentStyle.do\n }\n }\n nodes = elems[j].trNodes\n kLen = nodes.length\n\n for (k = 0; k < kLen; k += 1) {\n if (nodes[k].t === 'm') {\n ctx.moveTo(nodes[k].p[0], nodes[k].p[1])\n } else if (nodes[k].t === 'c') {\n ctx.bezierCurveTo(\n nodes[k].pts[0],\n nodes[k].pts[1],\n nodes[k].pts[2],\n nodes[k].pts[3],\n nodes[k].pts[4],\n nodes[k].pts[5],\n )\n } else {\n ctx.closePath()\n }\n }\n if (type === 'st' || type === 'gs') {\n ctx.stroke()\n if (currentStyle.da) {\n ctx.setLineDash(this.dashResetter)\n }\n }\n }\n if (type !== 'st' && type !== 'gs') {\n ctx.fill(currentStyle.r)\n }\n renderer.restore()\n }\n }\n }\n\n CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {\n var i\n var len = items.length - 1\n var groupTransform\n groupTransform = parentTransform\n for (i = len; i >= 0; i -= 1) {\n if (items[i].ty === 'tr') {\n groupTransform = data[i].transform\n this.renderShapeTransform(parentTransform, groupTransform)\n } else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') {\n this.renderPath(items[i], data[i])\n } else if (items[i].ty === 'fl') {\n this.renderFill(items[i], data[i], groupTransform)\n } else if (items[i].ty === 'st') {\n this.renderStroke(items[i], data[i], groupTransform)\n } else if (items[i].ty === 'gf' || items[i].ty === 'gs') {\n this.renderGradientFill(items[i], data[i], groupTransform)\n } else if (items[i].ty === 'gr') {\n this.renderShape(groupTransform, items[i].it, data[i].it)\n } else if (items[i].ty === 'tm') {\n //\n }\n }\n if (isMain) {\n this.drawLayer()\n }\n }\n\n CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {\n if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {\n var shapeNodes = styledShape.trNodes\n var paths = shape.paths\n var i\n var len\n var j\n var jLen = paths._length\n shapeNodes.length = 0\n var groupTransformMat = styledShape.transforms.finalTransform\n for (j = 0; j < jLen; j += 1) {\n var pathNodes = paths.shapes[j]\n if (pathNodes && pathNodes.v) {\n len = pathNodes._length\n for (i = 1; i < len; i += 1) {\n if (i === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n })\n }\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i]),\n })\n }\n if (len === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n })\n }\n if (pathNodes.c && len) {\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0]),\n })\n shapeNodes.push({\n t: 'z',\n })\n }\n }\n }\n styledShape.trNodes = shapeNodes\n }\n }\n\n CVShapeElement.prototype.renderPath = function (pathData, itemData) {\n if (pathData.hd !== true && pathData._shouldRender) {\n var i\n var len = itemData.styledShapes.length\n for (i = 0; i < len; i += 1) {\n this.renderStyledShape(itemData.styledShapes[i], itemData.sh)\n }\n }\n }\n\n CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style\n\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co =\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity\n }\n }\n\n CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style\n var grd\n if (\n !styleElem.grd ||\n itemData.g._mdf ||\n itemData.s._mdf ||\n itemData.e._mdf ||\n (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))\n ) {\n var ctx = this.globalData.canvasContext\n var pt1 = itemData.s.v\n var pt2 = itemData.e.v\n if (styleData.t === 1) {\n grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1])\n } else {\n var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2))\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0])\n\n var percent = itemData.h.v\n if (percent >= 1) {\n percent = 0.99\n } else if (percent <= -1) {\n percent = -0.99\n }\n var dist = rad * percent\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]\n grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad)\n }\n\n var i\n var len = styleData.g.p\n var cValues = itemData.g.c\n var opacity = 1\n\n for (i = 0; i < len; i += 1) {\n if (itemData.g._hasOpacity && itemData.g._collapsable) {\n opacity = itemData.g.o[i * 2 + 1]\n }\n grd.addColorStop(\n cValues[i * 4] / 100,\n 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')',\n )\n }\n styleElem.grd = grd\n }\n styleElem.coOp = itemData.o.v * groupTransform.opacity\n }\n\n CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style\n var d = itemData.d\n if (d && (d._mdf || this._isFirstFrame)) {\n styleElem.da = d.dashArray\n styleElem.do = d.dashoffset[0]\n }\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co =\n 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity\n }\n if (itemData.w._mdf || this._isFirstFrame) {\n styleElem.wi = itemData.w.v\n }\n }\n\n CVShapeElement.prototype.destroy = function () {\n this.shapesData = null\n this.globalData = null\n this.canvasContext = null\n this.stylesList.length = 0\n this.itemsData.length = 0\n }\n\n function CVTextElement(data, globalData, comp) {\n this.textSpans = []\n this.yOffset = 0\n this.fillColorAnim = false\n this.strokeColorAnim = false\n this.strokeWidthAnim = false\n this.stroke = false\n this.fill = false\n this.justifyOffset = 0\n this.currentRender = null\n this.renderType = 'canvas'\n this.values = {\n fill: 'rgba(0,0,0,0)',\n stroke: 'rgba(0,0,0,0)',\n sWidth: 0,\n fValue: '',\n }\n this.initElement(data, globalData, comp)\n }\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement],\n CVTextElement,\n )\n\n CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d')\n\n CVTextElement.prototype.buildNewText = function () {\n var documentData = this.textProperty.currentData\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0)\n\n var hasFill = false\n if (documentData.fc) {\n hasFill = true\n this.values.fill = this.buildColor(documentData.fc)\n } else {\n this.values.fill = 'rgba(0,0,0,0)'\n }\n this.fill = hasFill\n var hasStroke = false\n if (documentData.sc) {\n hasStroke = true\n this.values.stroke = this.buildColor(documentData.sc)\n this.values.sWidth = documentData.sw\n }\n var fontData = this.globalData.fontManager.getFontByName(documentData.f)\n var i\n var len\n var letters = documentData.l\n var matrixHelper = this.mHelper\n this.stroke = hasStroke\n this.values.fValue =\n documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily\n len = documentData.finalText.length\n // this.tHelper.font = this.values.fValue;\n var charData\n var shapeData\n var k\n var kLen\n var shapes\n var j\n var jLen\n var pathNodes\n var commands\n var pathArr\n var singleShape = this.data.singleShape\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize\n var xPos = 0\n var yPos = 0\n var firstLine = true\n var cnt = 0\n for (i = 0; i < len; i += 1) {\n charData = this.globalData.fontManager.getCharData(\n documentData.finalText[i],\n fontData.fStyle,\n this.globalData.fontManager.getFontByName(documentData.f).fFamily,\n )\n shapeData = (charData && charData.data) || {}\n matrixHelper.reset()\n if (singleShape && letters[i].n) {\n xPos = -trackingOffset\n yPos += documentData.yOffset\n yPos += firstLine ? 1 : 0\n firstLine = false\n }\n shapes = shapeData.shapes ? shapeData.shapes[0].it : []\n jLen = shapes.length\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100)\n if (singleShape) {\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos)\n }\n commands = createSizedArray(jLen - 1)\n var commandsCounter = 0\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n kLen = shapes[j].ks.k.i.length\n pathNodes = shapes[j].ks.k\n pathArr = []\n for (k = 1; k < kLen; k += 1) {\n if (k === 1) {\n pathArr.push(\n matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n )\n }\n pathArr.push(\n matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0),\n matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0),\n matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0),\n matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0),\n )\n }\n pathArr.push(\n matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0),\n matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0),\n matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0),\n matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0),\n )\n commands[commandsCounter] = pathArr\n commandsCounter += 1\n }\n }\n if (singleShape) {\n xPos += letters[i].l\n xPos += trackingOffset\n }\n if (this.textSpans[cnt]) {\n this.textSpans[cnt].elem = commands\n } else {\n this.textSpans[cnt] = { elem: commands }\n }\n cnt += 1\n }\n }\n\n CVTextElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext\n ctx.font = this.values.fValue\n ctx.lineCap = 'butt'\n ctx.lineJoin = 'miter'\n ctx.miterLimit = 4\n\n if (!this.data.singleShape) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag)\n }\n\n var i\n var len\n var j\n var jLen\n var k\n var kLen\n var renderedLetters = this.textAnimator.renderedLetters\n\n var letters = this.textProperty.currentData.l\n\n len = letters.length\n var renderedLetter\n var lastFill = null\n var lastStroke = null\n var lastStrokeW = null\n var commands\n var pathArr\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i]\n if (renderedLetter) {\n this.globalData.renderer.save()\n this.globalData.renderer.ctxTransform(renderedLetter.p)\n this.globalData.renderer.ctxOpacity(renderedLetter.o)\n }\n if (this.fill) {\n if (renderedLetter && renderedLetter.fc) {\n if (lastFill !== renderedLetter.fc) {\n lastFill = renderedLetter.fc\n ctx.fillStyle = renderedLetter.fc\n }\n } else if (lastFill !== this.values.fill) {\n lastFill = this.values.fill\n ctx.fillStyle = this.values.fill\n }\n commands = this.textSpans[i].elem\n jLen = commands.length\n this.globalData.canvasContext.beginPath()\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j]\n kLen = pathArr.length\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1])\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(\n pathArr[k],\n pathArr[k + 1],\n pathArr[k + 2],\n pathArr[k + 3],\n pathArr[k + 4],\n pathArr[k + 5],\n )\n }\n }\n this.globalData.canvasContext.closePath()\n this.globalData.canvasContext.fill()\n /// ctx.fillText(this.textSpans[i].val,0,0);\n }\n if (this.stroke) {\n if (renderedLetter && renderedLetter.sw) {\n if (lastStrokeW !== renderedLetter.sw) {\n lastStrokeW = renderedLetter.sw\n ctx.lineWidth = renderedLetter.sw\n }\n } else if (lastStrokeW !== this.values.sWidth) {\n lastStrokeW = this.values.sWidth\n ctx.lineWidth = this.values.sWidth\n }\n if (renderedLetter && renderedLetter.sc) {\n if (lastStroke !== renderedLetter.sc) {\n lastStroke = renderedLetter.sc\n ctx.strokeStyle = renderedLetter.sc\n }\n } else if (lastStroke !== this.values.stroke) {\n lastStroke = this.values.stroke\n ctx.strokeStyle = this.values.stroke\n }\n commands = this.textSpans[i].elem\n jLen = commands.length\n this.globalData.canvasContext.beginPath()\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j]\n kLen = pathArr.length\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1])\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(\n pathArr[k],\n pathArr[k + 1],\n pathArr[k + 2],\n pathArr[k + 3],\n pathArr[k + 4],\n pathArr[k + 5],\n )\n }\n }\n this.globalData.canvasContext.closePath()\n this.globalData.canvasContext.stroke()\n /// ctx.strokeText(letters[i].val,0,0);\n }\n if (renderedLetter) {\n this.globalData.renderer.restore()\n }\n }\n }\n }\n\n function CVImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId)\n this.img = globalData.imageLoader.getAsset(this.assetData)\n this.initElement(data, globalData, comp)\n }\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement],\n CVImageElement,\n )\n\n CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement\n CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame\n\n CVImageElement.prototype.createContent = function () {\n if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {\n var canvas = createTag('canvas')\n canvas.width = this.assetData.w\n canvas.height = this.assetData.h\n var ctx = canvas.getContext('2d')\n\n var imgW = this.img.width\n var imgH = this.img.height\n var imgRel = imgW / imgH\n var canvasRel = this.assetData.w / this.assetData.h\n var widthCrop\n var heightCrop\n var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio\n if ((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {\n heightCrop = imgH\n widthCrop = heightCrop * canvasRel\n } else {\n widthCrop = imgW\n heightCrop = widthCrop / canvasRel\n }\n ctx.drawImage(\n this.img,\n (imgW - widthCrop) / 2,\n (imgH - heightCrop) / 2,\n widthCrop,\n heightCrop,\n 0,\n 0,\n this.assetData.w,\n this.assetData.h,\n )\n this.img = canvas\n }\n }\n\n CVImageElement.prototype.renderInnerContent = function () {\n this.canvasContext.drawImage(this.img, 0, 0)\n }\n\n CVImageElement.prototype.destroy = function () {\n this.img = null\n }\n\n function CVSolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp)\n }\n extendPrototype(\n [BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement],\n CVSolidElement,\n )\n\n CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement\n CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame\n\n CVSolidElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext\n ctx.fillStyle = this.data.sc\n ctx.fillRect(0, 0, this.data.sw, this.data.sh)\n //\n }\n\n function CanvasRendererBase(animationItem, config) {\n this.animationItem = animationItem\n this.renderConfig = {\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\n context: (config && config.context) || null,\n progressiveLoad: (config && config.progressiveLoad) || false,\n preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\n imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\n contentVisibility: (config && config.contentVisibility) || 'visible',\n className: (config && config.className) || '',\n id: (config && config.id) || '',\n }\n this.renderConfig.dpr = (config && config.dpr) || 1\n if (this.animationItem.wrapper) {\n this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1\n }\n this.renderedFrame = -1\n this.globalData = {\n frameNum: -1,\n _mdf: false,\n renderConfig: this.renderConfig,\n currentGlobalAlpha: -1,\n }\n this.contextData = new CVContextData()\n this.elements = []\n this.pendingElements = []\n this.transformMat = new Matrix()\n this.completeLayers = false\n this.rendererType = 'canvas'\n }\n extendPrototype([BaseRenderer], CanvasRendererBase)\n\n CanvasRendererBase.prototype.createShape = function (data) {\n return new CVShapeElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createText = function (data) {\n return new CVTextElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createImage = function (data) {\n return new CVImageElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createSolid = function (data) {\n return new CVSolidElement(data, this.globalData, this)\n }\n\n CanvasRendererBase.prototype.createNull = SVGRenderer.prototype.createNull\n\n CanvasRendererBase.prototype.ctxTransform = function (props) {\n if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {\n return\n }\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13])\n return\n }\n this.transformMat.cloneFromProps(props)\n var cProps = this.contextData.cTr.props\n this.transformMat.transform(\n cProps[0],\n cProps[1],\n cProps[2],\n cProps[3],\n cProps[4],\n cProps[5],\n cProps[6],\n cProps[7],\n cProps[8],\n cProps[9],\n cProps[10],\n cProps[11],\n cProps[12],\n cProps[13],\n cProps[14],\n cProps[15],\n )\n // this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);\n this.contextData.cTr.cloneFromProps(this.transformMat.props)\n var trProps = this.contextData.cTr.props\n this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13])\n }\n\n CanvasRendererBase.prototype.ctxOpacity = function (op) {\n /* if(op === 1){\n return;\n } */\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.globalAlpha *= op < 0 ? 0 : op\n this.globalData.currentGlobalAlpha = this.contextData.cO\n return\n }\n this.contextData.cO *= op < 0 ? 0 : op\n if (this.globalData.currentGlobalAlpha !== this.contextData.cO) {\n this.canvasContext.globalAlpha = this.contextData.cO\n this.globalData.currentGlobalAlpha = this.contextData.cO\n }\n }\n\n CanvasRendererBase.prototype.reset = function () {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore()\n return\n }\n this.contextData.reset()\n }\n\n CanvasRendererBase.prototype.save = function (actionFlag) {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.save()\n return\n }\n if (actionFlag) {\n this.canvasContext.save()\n }\n var props = this.contextData.cTr.props\n if (this.contextData._length <= this.contextData.cArrPos) {\n this.contextData.duplicate()\n }\n var i\n var arr = this.contextData.saved[this.contextData.cArrPos]\n for (i = 0; i < 16; i += 1) {\n arr[i] = props[i]\n }\n this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO\n this.contextData.cArrPos += 1\n }\n\n CanvasRendererBase.prototype.restore = function (actionFlag) {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore()\n return\n }\n if (actionFlag) {\n this.canvasContext.restore()\n this.globalData.blendMode = 'source-over'\n }\n this.contextData.cArrPos -= 1\n var popped = this.contextData.saved[this.contextData.cArrPos]\n var i\n var arr = this.contextData.cTr.props\n for (i = 0; i < 16; i += 1) {\n arr[i] = popped[i]\n }\n this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13])\n popped = this.contextData.savedOp[this.contextData.cArrPos]\n this.contextData.cO = popped\n if (this.globalData.currentGlobalAlpha !== popped) {\n this.canvasContext.globalAlpha = popped\n this.globalData.currentGlobalAlpha = popped\n }\n }\n\n CanvasRendererBase.prototype.configAnimation = function (animData) {\n if (this.animationItem.wrapper) {\n this.animationItem.container = createTag('canvas')\n var containerStyle = this.animationItem.container.style\n containerStyle.width = '100%'\n containerStyle.height = '100%'\n var origin = '0px 0px 0px'\n containerStyle.transformOrigin = origin\n containerStyle.mozTransformOrigin = origin\n containerStyle.webkitTransformOrigin = origin\n containerStyle['-webkit-transform'] = origin\n containerStyle.contentVisibility = this.renderConfig.contentVisibility\n this.animationItem.wrapper.appendChild(this.animationItem.container)\n this.canvasContext = this.animationItem.container.getContext('2d')\n if (this.renderConfig.className) {\n this.animationItem.container.setAttribute('class', this.renderConfig.className)\n }\n if (this.renderConfig.id) {\n this.animationItem.container.setAttribute('id', this.renderConfig.id)\n }\n } else {\n this.canvasContext = this.renderConfig.context\n }\n this.data = animData\n this.layers = animData.layers\n this.transformCanvas = {\n w: animData.w,\n h: animData.h,\n sx: 0,\n sy: 0,\n tx: 0,\n ty: 0,\n }\n this.setupGlobalData(animData, document.body)\n this.globalData.canvasContext = this.canvasContext\n this.globalData.renderer = this\n this.globalData.isDashed = false\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad\n this.globalData.transformCanvas = this.transformCanvas\n this.elements = createSizedArray(animData.layers.length)\n\n this.updateContainerSize()\n }\n\n CanvasRendererBase.prototype.updateContainerSize = function () {\n this.reset()\n var elementWidth\n var elementHeight\n if (this.animationItem.wrapper && this.animationItem.container) {\n elementWidth = this.animationItem.wrapper.offsetWidth\n elementHeight = this.animationItem.wrapper.offsetHeight\n this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr)\n this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr)\n } else {\n elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr\n elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr\n }\n var elementRel\n var animationRel\n if (\n this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 ||\n this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1\n ) {\n var par = this.renderConfig.preserveAspectRatio.split(' ')\n var fillType = par[1] || 'meet'\n var pos = par[0] || 'xMidYMid'\n var xPos = pos.substr(0, 4)\n var yPos = pos.substr(4)\n elementRel = elementWidth / elementHeight\n animationRel = this.transformCanvas.w / this.transformCanvas.h\n if ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice')) {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr)\n this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr)\n } else {\n this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr)\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr)\n }\n\n if (\n xPos === 'xMid' &&\n ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.tx =\n ((elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2) *\n this.renderConfig.dpr\n } else if (\n xPos === 'xMax' &&\n ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.tx =\n (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr\n } else {\n this.transformCanvas.tx = 0\n }\n if (\n yPos === 'YMid' &&\n ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.ty =\n ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2) *\n this.renderConfig.dpr\n } else if (\n yPos === 'YMax' &&\n ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))\n ) {\n this.transformCanvas.ty =\n (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) * this.renderConfig.dpr\n } else {\n this.transformCanvas.ty = 0\n }\n } else if (this.renderConfig.preserveAspectRatio === 'none') {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr)\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr)\n this.transformCanvas.tx = 0\n this.transformCanvas.ty = 0\n } else {\n this.transformCanvas.sx = this.renderConfig.dpr\n this.transformCanvas.sy = this.renderConfig.dpr\n this.transformCanvas.tx = 0\n this.transformCanvas.ty = 0\n }\n this.transformCanvas.props = [\n this.transformCanvas.sx,\n 0,\n 0,\n 0,\n 0,\n this.transformCanvas.sy,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n this.transformCanvas.tx,\n this.transformCanvas.ty,\n 0,\n 1,\n ]\n /* var i, len = this.elements.length;\n for(i=0;i= 0; i -= 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n this.elements.length = 0\n this.globalData.canvasContext = null\n this.animationItem.container = null\n this.destroyed = true\n }\n\n CanvasRendererBase.prototype.renderFrame = function (num, forceRender) {\n if (\n (this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) ||\n this.destroyed ||\n num === -1\n ) {\n return\n }\n this.renderedFrame = num\n this.globalData.frameNum = num - this.animationItem._isFirstFrame\n this.globalData.frameId += 1\n this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender\n this.globalData.projectInterface.currentFrame = num\n\n // console.log('--------');\n // console.log('NEW: ',num);\n var i\n var len = this.layers.length\n if (!this.completeLayers) {\n this.checkLayers(num)\n }\n\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st)\n }\n }\n if (this.globalData._mdf) {\n if (this.renderConfig.clearCanvas === true) {\n this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h)\n } else {\n this.save()\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n if (this.renderConfig.clearCanvas !== true) {\n this.restore()\n }\n }\n }\n\n CanvasRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements\n if (elements[pos] || this.layers[pos].ty === 99) {\n return\n }\n var element = this.createItem(this.layers[pos], this, this.globalData)\n elements[pos] = element\n element.initExpressions()\n /* if(this.layers[pos].ty === 0){\n element.resize(this.globalData.transformCanvas);\n } */\n }\n\n CanvasRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop()\n element.checkParenting()\n }\n }\n\n CanvasRendererBase.prototype.hide = function () {\n this.animationItem.container.style.display = 'none'\n }\n\n CanvasRendererBase.prototype.show = function () {\n this.animationItem.container.style.display = 'block'\n }\n\n function CVCompElement(data, globalData, comp) {\n this.completeLayers = false\n this.layers = data.layers\n this.pendingElements = []\n this.elements = createSizedArray(this.layers.length)\n this.initElement(data, globalData, comp)\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }\n }\n\n extendPrototype([CanvasRendererBase, ICompElement, CVBaseElement], CVCompElement)\n\n CVCompElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext\n ctx.beginPath()\n ctx.moveTo(0, 0)\n ctx.lineTo(this.data.w, 0)\n ctx.lineTo(this.data.w, this.data.h)\n ctx.lineTo(0, this.data.h)\n ctx.lineTo(0, 0)\n ctx.clip()\n var i\n var len = this.layers.length\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame()\n }\n }\n }\n\n CVCompElement.prototype.destroy = function () {\n var i\n var len = this.layers.length\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.elements[i]) {\n this.elements[i].destroy()\n }\n }\n this.layers = null\n this.elements = null\n }\n\n CVCompElement.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this)\n }\n\n function CanvasRenderer(animationItem, config) {\n this.animationItem = animationItem\n this.renderConfig = {\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\n context: (config && config.context) || null,\n progressiveLoad: (config && config.progressiveLoad) || false,\n preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',\n imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',\n contentVisibility: (config && config.contentVisibility) || 'visible',\n className: (config && config.className) || '',\n id: (config && config.id) || '',\n }\n this.renderConfig.dpr = (config && config.dpr) || 1\n if (this.animationItem.wrapper) {\n this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1\n }\n this.renderedFrame = -1\n this.globalData = {\n frameNum: -1,\n _mdf: false,\n renderConfig: this.renderConfig,\n currentGlobalAlpha: -1,\n }\n this.contextData = new CVContextData()\n this.elements = []\n this.pendingElements = []\n this.transformMat = new Matrix()\n this.completeLayers = false\n this.rendererType = 'canvas'\n }\n extendPrototype([CanvasRendererBase], CanvasRenderer)\n\n CanvasRenderer.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this)\n }\n\n // Registering renderers\n registerRenderer('canvas', CanvasRenderer)\n\n // Registering shape modifiers\n ShapeModifiers.registerModifier('tm', TrimModifier)\n ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier)\n ShapeModifiers.registerModifier('rp', RepeaterModifier)\n ShapeModifiers.registerModifier('rd', RoundCornersModifier)\n\n const Expressions = (function () {\n var ob = {}\n ob.initExpressions = initExpressions\n\n function initExpressions(animation) {\n var stackCount = 0\n var registers = []\n\n function pushExpression() {\n stackCount += 1\n }\n\n function popExpression() {\n stackCount -= 1\n if (stackCount === 0) {\n releaseInstances()\n }\n }\n\n function registerExpressionProperty(expression) {\n if (registers.indexOf(expression) === -1) {\n registers.push(expression)\n }\n }\n\n function releaseInstances() {\n var i\n var len = registers.length\n for (i = 0; i < len; i += 1) {\n registers[i].release()\n }\n registers.length = 0\n }\n\n animation.renderer.compInterface = CompExpressionInterface(animation.renderer)\n animation.renderer.globalData.projectInterface.registerComposition(animation.renderer)\n animation.renderer.globalData.pushExpression = pushExpression\n animation.renderer.globalData.popExpression = popExpression\n animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty\n }\n return ob\n })()\n\n /* eslint-disable */\n /*\n Copyright 2014 David Bau.\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n */\n\n function seedRandom(pool, math) {\n //\n // The following constants are related to IEEE 754 limits.\n //\n var global = this,\n width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto // node.js crypto module, initialized at the bottom.\n\n //\n // seedrandom()\n // This is the seedrandom function described above.\n //\n function seedrandom(seed, options, callback) {\n var key = []\n options = options === true ? { entropy: true } : options || {}\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(\n flatten(options.entropy ? [seed, tostring(pool)] : seed === null ? autoseed() : seed, 3),\n key,\n )\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key)\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function () {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0 // and no 'extra last byte'.\n while (n < significance) {\n // Fill up all significant digits by\n n = (n + x) * width // shifting numerator and\n d *= width // denominator and generating a\n x = arc4.g(1) // new least-significant-byte.\n }\n while (n >= overflow) {\n // To avoid rounding up, before adding\n n /= 2 // last byte, shift everything\n d /= 2 // right using integer math until\n x >>>= 1 // we have exactly the desired bits.\n }\n return (n + x) / d // Form the number within [0, 1).\n }\n\n prng.int32 = function () {\n return arc4.g(4) | 0\n }\n prng.quick = function () {\n return arc4.g(4) / 0x100000000\n }\n prng.double = prng\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool)\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (\n options.pass ||\n callback ||\n function (prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) {\n copy(state, arc4)\n }\n // Only provide the .state method if requested via options.state.\n prng.state = function () {\n return copy(arc4, {})\n }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) {\n math[rngname] = prng\n return seed\n }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng\n }\n )(prng, shortseed, 'global' in options ? options.global : this == math, options.state)\n }\n math['seed' + rngname] = seedrandom\n\n //\n // ARC4\n //\n // An ARC4 implementation. The constructor takes a key in the form of\n // an array of at most (width) integers that should be 0 <= x < (width).\n //\n // The g(count) method returns a pseudorandom integer that concatenates\n // the next (count) outputs from ARC4. Its return value is a number x\n // that is in the range 0 <= x < (width ^ count).\n //\n function ARC4(key) {\n var t,\n keylen = key.length,\n me = this,\n i = 0,\n j = (me.i = me.j = 0),\n s = (me.S = [])\n\n // The empty key [] is treated as [0].\n if (!keylen) {\n key = [keylen++]\n }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++\n }\n for (i = 0; i < width; i++) {\n s[i] = s[(j = mask & (j + key[i % keylen] + (t = s[i])))]\n s[j] = t\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n me.g = function (count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t,\n r = 0,\n i = me.i,\n j = me.j,\n s = me.S\n while (count--) {\n t = s[(i = mask & (i + 1))]\n r = r * width + s[mask & ((s[i] = s[(j = mask & (j + t))]) + (s[j] = t))]\n }\n me.i = i\n me.j = j\n return r\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n }\n }\n\n //\n // copy()\n // Copies internal state of ARC4 to or from a plain object.\n //\n function copy(f, t) {\n t.i = f.i\n t.j = f.j\n t.S = f.S.slice()\n return t\n }\n\n //\n // flatten()\n // Converts an object tree to nested arrays of strings.\n //\n function flatten(obj, depth) {\n var result = [],\n typ = typeof obj,\n prop\n if (depth && typ == 'object') {\n for (prop in obj) {\n try {\n result.push(flatten(obj[prop], depth - 1))\n } catch (e) {}\n }\n }\n return result.length ? result : typ == 'string' ? obj : obj + '\\0'\n }\n\n //\n // mixkey()\n // Mixes a string seed into a key that is an array of integers, and\n // returns a shortened string seed that is equivalent to the result key.\n //\n function mixkey(seed, key) {\n var stringseed = seed + '',\n smear,\n j = 0\n while (j < stringseed.length) {\n key[mask & j] = mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++))\n }\n return tostring(key)\n }\n\n //\n // autoseed()\n // Returns an object for autoseeding, using window.crypto and Node crypto\n // module if available.\n //\n function autoseed() {\n try {\n if (nodecrypto) {\n return tostring(nodecrypto.randomBytes(width))\n }\n var out = new Uint8Array(width)\n ;(global.crypto || global.msCrypto).getRandomValues(out)\n return tostring(out)\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins\n return [+new Date(), global, plugins, global.screen, tostring(pool)]\n }\n }\n\n //\n // tostring()\n // Converts an array of charcodes to a string\n //\n function tostring(a) {\n return String.fromCharCode.apply(0, a)\n }\n\n //\n // When seedrandom.js is loaded, we immediately mix a few bits\n // from the built-in RNG into the entropy pool. Because we do\n // not want to interfere with deterministic PRNG state later,\n // seedrandom will not call math.random on its own again after\n // initialization.\n //\n mixkey(math.random(), pool)\n\n //\n // Nodejs and AMD support: export the implementation as a module using\n // either convention.\n //\n\n // End anonymous scope, and pass initial values.\n }\n\n function initialize$2(BMMath) {\n seedRandom([], BMMath)\n }\n\n var propTypes = {\n SHAPE: 'shape',\n }\n\n /* eslint-disable camelcase */\n\n const ExpressionManager = (function () {\n 'use strict'\n\n var ob = {}\n var Math = BMMath\n var window = null\n var document = null\n var XMLHttpRequest = null\n var fetch = null\n var frames = null\n initialize$2(BMMath)\n\n function $bm_isInstanceOfArray(arr) {\n return arr.constructor === Array || arr.constructor === Float32Array\n }\n\n function isNumerable(tOfV, v) {\n return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number\n }\n\n function $bm_neg(a) {\n var tOfA = typeof a\n if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) {\n return -a\n }\n if ($bm_isInstanceOfArray(a)) {\n var i\n var lenA = a.length\n var retArr = []\n for (i = 0; i < lenA; i += 1) {\n retArr[i] = -a[i]\n }\n return retArr\n }\n if (a.propType) {\n return a.v\n }\n return -a\n }\n\n var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get\n var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get\n var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get\n\n function sum(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n if (tOfA === 'string' || tOfB === 'string') {\n return a + b\n }\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a + b\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0)\n a[0] += b\n return a\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0)\n b[0] = a + b[0]\n return b\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0\n var lenA = a.length\n var lenB = b.length\n var retArr = []\n while (i < lenA || i < lenB) {\n if (\n (typeof a[i] === 'number' || a[i] instanceof Number) &&\n (typeof b[i] === 'number' || b[i] instanceof Number)\n ) {\n retArr[i] = a[i] + b[i]\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i]\n }\n i += 1\n }\n return retArr\n }\n return 0\n }\n var add = sum\n\n function sub(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n if (tOfA === 'string') {\n a = parseInt(a, 10)\n }\n if (tOfB === 'string') {\n b = parseInt(b, 10)\n }\n return a - b\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0)\n a[0] -= b\n return a\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0)\n b[0] = a - b[0]\n return b\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0\n var lenA = a.length\n var lenB = b.length\n var retArr = []\n while (i < lenA || i < lenB) {\n if (\n (typeof a[i] === 'number' || a[i] instanceof Number) &&\n (typeof b[i] === 'number' || b[i] instanceof Number)\n ) {\n retArr[i] = a[i] - b[i]\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i]\n }\n i += 1\n }\n return retArr\n }\n return 0\n }\n\n function mul(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n var arr\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a * b\n }\n\n var i\n var len\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] * b\n }\n return arr\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a * b[i]\n }\n return arr\n }\n return 0\n }\n\n function div(a, b) {\n var tOfA = typeof a\n var tOfB = typeof b\n var arr\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a / b\n }\n var i\n var len\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] / b\n }\n return arr\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length\n arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = a / b[i]\n }\n return arr\n }\n return 0\n }\n function mod(a, b) {\n if (typeof a === 'string') {\n a = parseInt(a, 10)\n }\n if (typeof b === 'string') {\n b = parseInt(b, 10)\n }\n return a % b\n }\n var $bm_sum = sum\n var $bm_sub = sub\n var $bm_mul = mul\n var $bm_div = div\n var $bm_mod = mod\n\n function clamp(num, min, max) {\n if (min > max) {\n var mm = max\n max = min\n min = mm\n }\n return Math.min(Math.max(num, min), max)\n }\n\n function radiansToDegrees(val) {\n return val / degToRads\n }\n var radians_to_degrees = radiansToDegrees\n\n function degreesToRadians(val) {\n return val * degToRads\n }\n var degrees_to_radians = radiansToDegrees\n\n var helperLengthArray = [0, 0, 0, 0, 0, 0]\n\n function length(arr1, arr2) {\n if (typeof arr1 === 'number' || arr1 instanceof Number) {\n arr2 = arr2 || 0\n return Math.abs(arr1 - arr2)\n }\n if (!arr2) {\n arr2 = helperLengthArray\n }\n var i\n var len = Math.min(arr1.length, arr2.length)\n var addedLength = 0\n for (i = 0; i < len; i += 1) {\n addedLength += Math.pow(arr2[i] - arr1[i], 2)\n }\n return Math.sqrt(addedLength)\n }\n\n function normalize(vec) {\n return div(vec, length(vec))\n }\n\n function rgbToHsl(val) {\n var r = val[0]\n var g = val[1]\n var b = val[2]\n var max = Math.max(r, g, b)\n var min = Math.min(r, g, b)\n var h\n var s\n var l = (max + min) / 2\n\n if (max === min) {\n h = 0 // achromatic\n s = 0 // achromatic\n } else {\n var d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0)\n break\n case g:\n h = (b - r) / d + 2\n break\n case b:\n h = (r - g) / d + 4\n break\n default:\n break\n }\n h /= 6\n }\n\n return [h, s, l, val[3]]\n }\n\n function 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 < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n }\n\n function hslToRgb(val) {\n var h = val[0]\n var s = val[1]\n var l = val[2]\n\n var r\n var g\n var b\n\n if (s === 0) {\n r = l // achromatic\n b = l // achromatic\n g = l // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s\n var p = 2 * l - q\n r = hue2rgb(p, q, h + 1 / 3)\n g = hue2rgb(p, q, h)\n b = hue2rgb(p, q, h - 1 / 3)\n }\n\n return [r, g, b, val[3]]\n }\n\n function linear(t, tMin, tMax, value1, value2) {\n if (value1 === undefined || value2 === undefined) {\n value1 = tMin\n value2 = tMax\n tMin = 0\n tMax = 1\n }\n if (tMax < tMin) {\n var _tMin = tMax\n tMax = tMin\n tMin = _tMin\n }\n if (t <= tMin) {\n return value1\n }\n if (t >= tMax) {\n return value2\n }\n var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin)\n if (!value1.length) {\n return value1 + (value2 - value1) * perc\n }\n var i\n var len = value1.length\n var arr = createTypedArray('float32', len)\n for (i = 0; i < len; i += 1) {\n arr[i] = value1[i] + (value2[i] - value1[i]) * perc\n }\n return arr\n }\n function random(min, max) {\n if (max === undefined) {\n if (min === undefined) {\n min = 0\n max = 1\n } else {\n max = min\n min = undefined\n }\n }\n if (max.length) {\n var i\n var len = max.length\n if (!min) {\n min = createTypedArray('float32', len)\n }\n var arr = createTypedArray('float32', len)\n var rnd = BMMath.random()\n for (i = 0; i < len; i += 1) {\n arr[i] = min[i] + rnd * (max[i] - min[i])\n }\n return arr\n }\n if (min === undefined) {\n min = 0\n }\n var rndm = BMMath.random()\n return min + rndm * (max - min)\n }\n\n function createPath(points, inTangents, outTangents, closed) {\n var i\n var len = points.length\n var path = shapePool.newElement()\n path.setPathData(!!closed, len)\n var arrPlaceholder = [0, 0]\n var inVertexPoint\n var outVertexPoint\n for (i = 0; i < len; i += 1) {\n inVertexPoint = inTangents && inTangents[i] ? inTangents[i] : arrPlaceholder\n outVertexPoint = outTangents && outTangents[i] ? outTangents[i] : arrPlaceholder\n path.setTripleAt(\n points[i][0],\n points[i][1],\n outVertexPoint[0] + points[i][0],\n outVertexPoint[1] + points[i][1],\n inVertexPoint[0] + points[i][0],\n inVertexPoint[1] + points[i][1],\n i,\n true,\n )\n }\n return path\n }\n\n function initiateExpression(elem, data, property) {\n var val = data.x\n var needsVelocity = /velocity(?![\\w\\d])/.test(val)\n var _needsRandom = val.indexOf('random') !== -1\n var elemType = elem.data.ty\n var transform\n var $bm_transform\n var content\n var effect\n var thisProperty = property\n thisProperty.valueAtTime = thisProperty.getValueAtTime\n Object.defineProperty(thisProperty, 'value', {\n get: function () {\n return thisProperty.v\n },\n })\n elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate\n elem.comp.displayStartTime = 0\n var inPoint = elem.data.ip / elem.comp.globalData.frameRate\n var outPoint = elem.data.op / elem.comp.globalData.frameRate\n var width = elem.data.sw ? elem.data.sw : 0\n var height = elem.data.sh ? elem.data.sh : 0\n var name = elem.data.nm\n var loopIn\n var loop_in\n var loopOut\n var loop_out\n var smooth\n var toWorld\n var fromWorld\n var fromComp\n var toComp\n var fromCompToSurface\n var position\n var rotation\n var anchorPoint\n var scale\n var thisLayer\n var thisComp\n var mask\n var valueAtTime\n var velocityAtTime\n\n var scoped_bm_rt\n // val = val.replace(/(\\\\?\"|')((http)(s)?(:\\/))?\\/.*?(\\\\?\"|')/g, \"\\\"\\\"\"); // deter potential network calls\n var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0] // eslint-disable-line no-eval\n var numKeys = property.kf ? data.k.length : 0\n\n var active = !this.data || this.data.hd !== true\n\n var wiggle = function wiggle(freq, amp) {\n var iWiggle\n var j\n var lenWiggle = this.pv.length ? this.pv.length : 1\n var addedAmps = createTypedArray('float32', lenWiggle)\n freq = 5\n var iterations = Math.floor(time * freq)\n iWiggle = 0\n j = 0\n while (iWiggle < iterations) {\n // var rnd = BMMath.random();\n for (j = 0; j < lenWiggle; j += 1) {\n addedAmps[j] += -amp + amp * 2 * BMMath.random()\n // addedAmps[j] += -amp + amp*2*rnd;\n }\n iWiggle += 1\n }\n // var rnd2 = BMMath.random();\n var periods = time * freq\n var perc = periods - Math.floor(periods)\n var arr = createTypedArray('float32', lenWiggle)\n if (lenWiggle > 1) {\n for (j = 0; j < lenWiggle; j += 1) {\n arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc\n // arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;\n // arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);\n }\n return arr\n }\n return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc\n }.bind(this)\n\n if (thisProperty.loopIn) {\n loopIn = thisProperty.loopIn.bind(thisProperty)\n loop_in = loopIn\n }\n\n if (thisProperty.loopOut) {\n loopOut = thisProperty.loopOut.bind(thisProperty)\n loop_out = loopOut\n }\n\n if (thisProperty.smooth) {\n smooth = thisProperty.smooth.bind(thisProperty)\n }\n\n function loopInDuration(type, duration) {\n return loopIn(type, duration, true)\n }\n\n function loopOutDuration(type, duration) {\n return loopOut(type, duration, true)\n }\n\n if (this.getValueAtTime) {\n valueAtTime = this.getValueAtTime.bind(this)\n }\n\n if (this.getVelocityAtTime) {\n velocityAtTime = this.getVelocityAtTime.bind(this)\n }\n\n var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface)\n\n function lookAt(elem1, elem2) {\n var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]]\n var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads\n var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads\n return [yaw, pitch, 0]\n }\n\n function easeOut(t, tMin, tMax, val1, val2) {\n return applyEase(easeOutBez, t, tMin, tMax, val1, val2)\n }\n\n function easeIn(t, tMin, tMax, val1, val2) {\n return applyEase(easeInBez, t, tMin, tMax, val1, val2)\n }\n\n function ease(t, tMin, tMax, val1, val2) {\n return applyEase(easeInOutBez, t, tMin, tMax, val1, val2)\n }\n\n function applyEase(fn, t, tMin, tMax, val1, val2) {\n if (val1 === undefined) {\n val1 = tMin\n val2 = tMax\n } else {\n t = (t - tMin) / (tMax - tMin)\n }\n if (t > 1) {\n t = 1\n } else if (t < 0) {\n t = 0\n }\n var mult = fn(t)\n if ($bm_isInstanceOfArray(val1)) {\n var iKey\n var lenKey = val1.length\n var arr = createTypedArray('float32', lenKey)\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey]\n }\n return arr\n }\n return (val2 - val1) * mult + val1\n }\n\n function nearestKey(time) {\n var iKey\n var lenKey = data.k.length\n var index\n var keyTime\n if (!data.k.length || typeof data.k[0] === 'number') {\n index = 0\n keyTime = 0\n } else {\n index = -1\n time *= elem.comp.globalData.frameRate\n if (time < data.k[0].t) {\n index = 1\n keyTime = data.k[0].t\n } else {\n for (iKey = 0; iKey < lenKey - 1; iKey += 1) {\n if (time === data.k[iKey].t) {\n index = iKey + 1\n keyTime = data.k[iKey].t\n break\n } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) {\n if (time - data.k[iKey].t > data.k[iKey + 1].t - time) {\n index = iKey + 2\n keyTime = data.k[iKey + 1].t\n } else {\n index = iKey + 1\n keyTime = data.k[iKey].t\n }\n break\n }\n }\n if (index === -1) {\n index = iKey + 1\n keyTime = data.k[iKey].t\n }\n }\n }\n var obKey = {}\n obKey.index = index\n obKey.time = keyTime / elem.comp.globalData.frameRate\n return obKey\n }\n\n function key(ind) {\n var obKey\n var iKey\n var lenKey\n if (!data.k.length || typeof data.k[0] === 'number') {\n throw new Error('The property has no keyframe at index ' + ind)\n }\n ind -= 1\n obKey = {\n time: data.k[ind].t / elem.comp.globalData.frameRate,\n value: [],\n }\n var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e\n\n lenKey = arr.length\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n obKey[iKey] = arr[iKey]\n obKey.value[iKey] = arr[iKey]\n }\n return obKey\n }\n\n function framesToTime(fr, fps) {\n if (!fps) {\n fps = elem.comp.globalData.frameRate\n }\n return fr / fps\n }\n\n function timeToFrames(t, fps) {\n if (!t && t !== 0) {\n t = time\n }\n if (!fps) {\n fps = elem.comp.globalData.frameRate\n }\n return t * fps\n }\n\n function seedRandom(seed) {\n BMMath.seedrandom(randSeed + seed)\n }\n\n function sourceRectAtTime() {\n return elem.sourceRectAtTime()\n }\n\n function substring(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substring(init)\n }\n return value.substring(init, end)\n }\n return ''\n }\n\n function substr(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substr(init)\n }\n return value.substr(init, end)\n }\n return ''\n }\n\n function posterizeTime(framesPerSecond) {\n time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond\n value = valueAtTime(time)\n }\n\n var time\n var velocity\n var value\n var text\n var textIndex\n var textTotal\n var selectorValue\n var index = elem.data.ind\n var hasParent = !!(elem.hierarchy && elem.hierarchy.length)\n var parent\n var randSeed = Math.floor(Math.random() * 1000000)\n var globalData = elem.globalData\n function executeExpression(_value) {\n // globalData.pushExpression();\n value = _value\n if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {\n return value\n }\n if (this.propType === 'textSelector') {\n textIndex = this.textIndex\n textTotal = this.textTotal\n selectorValue = this.selectorValue\n }\n if (!thisLayer) {\n text = elem.layerInterface.text\n thisLayer = elem.layerInterface\n thisComp = elem.comp.compInterface\n toWorld = thisLayer.toWorld.bind(thisLayer)\n fromWorld = thisLayer.fromWorld.bind(thisLayer)\n fromComp = thisLayer.fromComp.bind(thisLayer)\n toComp = thisLayer.toComp.bind(thisLayer)\n mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null\n fromCompToSurface = fromComp\n }\n if (!transform) {\n transform = elem.layerInterface('ADBE Transform Group')\n $bm_transform = transform\n if (transform) {\n anchorPoint = transform.anchorPoint\n /* position = transform.position;\n rotation = transform.rotation;\n scale = transform.scale; */\n }\n }\n\n if (elemType === 4 && !content) {\n content = thisLayer('ADBE Root Vectors Group')\n }\n if (!effect) {\n effect = thisLayer(4)\n }\n hasParent = !!(elem.hierarchy && elem.hierarchy.length)\n if (hasParent && !parent) {\n parent = elem.hierarchy[0].layerInterface\n }\n time = this.comp.renderedFrame / this.comp.globalData.frameRate\n if (_needsRandom) {\n seedRandom(randSeed + time)\n }\n if (needsVelocity) {\n velocity = velocityAtTime(time)\n }\n expression_function()\n this.frameExpressionId = elem.globalData.frameId\n\n // TODO: Check if it's possible to return on ShapeInterface the .v value\n // Changed this to a ternary operation because Rollup failed compiling it correctly\n scoped_bm_rt = scoped_bm_rt.propType === propTypes.SHAPE ? scoped_bm_rt.v : scoped_bm_rt\n return scoped_bm_rt\n }\n // Bundlers will see these as dead code and unless we reference them\n executeExpression.__preventDeadCodeRemoval = [\n $bm_transform,\n anchorPoint,\n time,\n velocity,\n inPoint,\n outPoint,\n width,\n height,\n name,\n loop_in,\n loop_out,\n smooth,\n toComp,\n fromCompToSurface,\n toWorld,\n fromWorld,\n mask,\n position,\n rotation,\n scale,\n thisComp,\n numKeys,\n active,\n wiggle,\n loopInDuration,\n loopOutDuration,\n comp,\n lookAt,\n easeOut,\n easeIn,\n ease,\n nearestKey,\n key,\n text,\n textIndex,\n textTotal,\n selectorValue,\n framesToTime,\n timeToFrames,\n sourceRectAtTime,\n substring,\n substr,\n posterizeTime,\n index,\n globalData,\n ]\n return executeExpression\n }\n\n ob.initiateExpression = initiateExpression\n ob.__preventDeadCodeRemoval = [\n window,\n document,\n XMLHttpRequest,\n fetch,\n frames,\n $bm_neg,\n add,\n $bm_sum,\n $bm_sub,\n $bm_mul,\n $bm_div,\n $bm_mod,\n clamp,\n radians_to_degrees,\n degreesToRadians,\n degrees_to_radians,\n normalize,\n rgbToHsl,\n hslToRgb,\n linear,\n random,\n createPath,\n ]\n return ob\n })()\n\n const expressionHelpers = (function () {\n function searchExpressions(elem, data, prop) {\n if (data.x) {\n prop.k = true\n prop.x = true\n prop.initiateExpression = ExpressionManager.initiateExpression\n prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop))\n }\n }\n\n function getValueAtTime(frameNum) {\n frameNum *= this.elem.globalData.frameRate\n frameNum -= this.offsetTime\n if (frameNum !== this._cachingAtTime.lastFrame) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0\n this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime)\n this._cachingAtTime.lastFrame = frameNum\n }\n return this._cachingAtTime.value\n }\n\n function getSpeedAtTime(frameNum) {\n var delta = -0.01\n var v1 = this.getValueAtTime(frameNum)\n var v2 = this.getValueAtTime(frameNum + delta)\n var speed = 0\n if (v1.length) {\n var i\n for (i = 0; i < v1.length; i += 1) {\n speed += Math.pow(v2[i] - v1[i], 2)\n }\n speed = Math.sqrt(speed) * 100\n } else {\n speed = 0\n }\n return speed\n }\n\n function getVelocityAtTime(frameNum) {\n if (this.vel !== undefined) {\n return this.vel\n }\n var delta = -0.001\n // frameNum += this.elem.data.st;\n var v1 = this.getValueAtTime(frameNum)\n var v2 = this.getValueAtTime(frameNum + delta)\n var velocity\n if (v1.length) {\n velocity = createTypedArray('float32', v1.length)\n var i\n for (i = 0; i < v1.length; i += 1) {\n // removing frameRate\n // if needed, don't add it here\n // velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);\n velocity[i] = (v2[i] - v1[i]) / delta\n }\n } else {\n velocity = (v2 - v1) / delta\n }\n return velocity\n }\n\n function getStaticValueAtTime() {\n return this.pv\n }\n\n function setGroupProperty(propertyGroup) {\n this.propertyGroup = propertyGroup\n }\n\n return {\n searchExpressions: searchExpressions,\n getSpeedAtTime: getSpeedAtTime,\n getVelocityAtTime: getVelocityAtTime,\n getValueAtTime: getValueAtTime,\n getStaticValueAtTime: getStaticValueAtTime,\n setGroupProperty: setGroupProperty,\n }\n })()\n\n function addPropertyDecorator() {\n function loopOut(type, duration, durationFlag) {\n if (!this.k || !this.keyframes) {\n return this.pv\n }\n type = type ? type.toLowerCase() : ''\n var currentFrame = this.comp.renderedFrame\n var keyframes = this.keyframes\n var lastKeyFrame = keyframes[keyframes.length - 1].t\n if (currentFrame <= lastKeyFrame) {\n return this.pv\n }\n var cycleDuration\n var firstKeyFrame\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1\n }\n firstKeyFrame = keyframes[keyframes.length - 1 - duration].t\n cycleDuration = lastKeyFrame - firstKeyFrame\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip)\n } else {\n cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration)\n }\n firstKeyFrame = lastKeyFrame - cycleDuration\n }\n var i\n var len\n var ret\n if (type === 'pingpong') {\n var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration)\n if (iterations % 2 !== 0) {\n return this.getValueAtTime(\n (cycleDuration - ((currentFrame - firstKeyFrame) % cycleDuration) + firstKeyFrame) /\n this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0)\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0)\n var current = this.getValueAtTime(\n (((currentFrame - firstKeyFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration)\n if (this.pv.length) {\n ret = new Array(initV.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] = (endV[i] - initV[i]) * repeats + current[i]\n }\n return ret\n }\n return (endV - initV) * repeats + current\n } else if (type === 'continue') {\n var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0)\n var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0)\n if (this.pv.length) {\n ret = new Array(lastValue.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] =\n lastValue[i] +\n ((lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate)) /\n 0.0005 // eslint-disable-line\n }\n return ret\n }\n return lastValue + (lastValue - nextLastValue) * ((currentFrame - lastKeyFrame) / 0.001)\n }\n return this.getValueAtTime(\n (((currentFrame - firstKeyFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n\n function loopIn(type, duration, durationFlag) {\n if (!this.k) {\n return this.pv\n }\n type = type ? type.toLowerCase() : ''\n var currentFrame = this.comp.renderedFrame\n var keyframes = this.keyframes\n var firstKeyFrame = keyframes[0].t\n if (currentFrame >= firstKeyFrame) {\n return this.pv\n }\n var cycleDuration\n var lastKeyFrame\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1\n }\n lastKeyFrame = keyframes[duration].t\n cycleDuration = lastKeyFrame - firstKeyFrame\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame)\n } else {\n cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration)\n }\n lastKeyFrame = firstKeyFrame + cycleDuration\n }\n var i\n var len\n var ret\n if (type === 'pingpong') {\n var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration)\n if (iterations % 2 === 0) {\n return this.getValueAtTime(\n (((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0)\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0)\n var current = this.getValueAtTime(\n (cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame) /\n this.comp.globalData.frameRate,\n 0,\n )\n var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1\n if (this.pv.length) {\n ret = new Array(initV.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] = current[i] - (endV[i] - initV[i]) * repeats\n }\n return ret\n }\n return current - (endV - initV) * repeats\n } else if (type === 'continue') {\n var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0)\n var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0)\n if (this.pv.length) {\n ret = new Array(firstValue.length)\n len = ret.length\n for (i = 0; i < len; i += 1) {\n ret[i] = firstValue[i] + ((firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame)) / 0.001\n }\n return ret\n }\n return firstValue + ((firstValue - nextFirstValue) * (firstKeyFrame - currentFrame)) / 0.001\n }\n return this.getValueAtTime(\n (cycleDuration - (((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame)) /\n this.comp.globalData.frameRate,\n 0,\n ) // eslint-disable-line\n }\n\n function smooth(width, samples) {\n if (!this.k) {\n return this.pv\n }\n width = (width || 0.4) * 0.5\n samples = Math.floor(samples || 5)\n if (samples <= 1) {\n return this.pv\n }\n var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate\n var initFrame = currentTime - width\n var endFrame = currentTime + width\n var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1\n var i = 0\n var j = 0\n var value\n if (this.pv.length) {\n value = createTypedArray('float32', this.pv.length)\n } else {\n value = 0\n }\n var sampleValue\n while (i < samples) {\n sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency)\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] += sampleValue[j]\n }\n } else {\n value += sampleValue\n }\n i += 1\n }\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] /= samples\n }\n } else {\n value /= samples\n }\n return value\n }\n\n function getTransformValueAtTime(time) {\n if (!this._transformCachingAtTime) {\n this._transformCachingAtTime = {\n v: new Matrix(),\n }\n }\n /// /\n var matrix = this._transformCachingAtTime.v\n matrix.cloneFromProps(this.pre.props)\n if (this.appliedTransformations < 1) {\n var anchor = this.a.getValueAtTime(time)\n matrix.translate(-anchor[0] * this.a.mult, -anchor[1] * this.a.mult, anchor[2] * this.a.mult)\n }\n if (this.appliedTransformations < 2) {\n var scale = this.s.getValueAtTime(time)\n matrix.scale(scale[0] * this.s.mult, scale[1] * this.s.mult, scale[2] * this.s.mult)\n }\n if (this.sk && this.appliedTransformations < 3) {\n var skew = this.sk.getValueAtTime(time)\n var skewAxis = this.sa.getValueAtTime(time)\n matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult)\n }\n if (this.r && this.appliedTransformations < 4) {\n var rotation = this.r.getValueAtTime(time)\n matrix.rotate(-rotation * this.r.mult)\n } else if (!this.r && this.appliedTransformations < 4) {\n var rotationZ = this.rz.getValueAtTime(time)\n var rotationY = this.ry.getValueAtTime(time)\n var rotationX = this.rx.getValueAtTime(time)\n var orientation = this.or.getValueAtTime(time)\n matrix\n .rotateZ(-rotationZ * this.rz.mult)\n .rotateY(rotationY * this.ry.mult)\n .rotateX(rotationX * this.rx.mult)\n .rotateZ(-orientation[2] * this.or.mult)\n .rotateY(orientation[1] * this.or.mult)\n .rotateX(orientation[0] * this.or.mult)\n }\n if (this.data.p && this.data.p.s) {\n var positionX = this.px.getValueAtTime(time)\n var positionY = this.py.getValueAtTime(time)\n if (this.data.p.z) {\n var positionZ = this.pz.getValueAtTime(time)\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, -positionZ * this.pz.mult)\n } else {\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0)\n }\n } else {\n var position = this.p.getValueAtTime(time)\n matrix.translate(position[0] * this.p.mult, position[1] * this.p.mult, -position[2] * this.p.mult)\n }\n return matrix\n /// /\n }\n\n function getTransformStaticValueAtTime() {\n return this.v.clone(new Matrix())\n }\n\n var getTransformProperty = TransformPropertyFactory.getTransformProperty\n TransformPropertyFactory.getTransformProperty = function (elem, data, container) {\n var prop = getTransformProperty(elem, data, container)\n if (prop.dynamicProperties.length) {\n prop.getValueAtTime = getTransformValueAtTime.bind(prop)\n } else {\n prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop)\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty\n return prop\n }\n\n var propertyGetProp = PropertyFactory.getProp\n PropertyFactory.getProp = function (elem, data, type, mult, container) {\n var prop = propertyGetProp(elem, data, type, mult, container)\n // prop.getVelocityAtTime = getVelocityAtTime;\n // prop.loopOut = loopOut;\n // prop.loopIn = loopIn;\n if (prop.kf) {\n prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop)\n } else {\n prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop)\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty\n prop.loopOut = loopOut\n prop.loopIn = loopIn\n prop.smooth = smooth\n prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop)\n prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop)\n prop.numKeys = data.a === 1 ? data.k.length : 0\n prop.propertyIndex = data.ix\n var value = 0\n if (type !== 0) {\n value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length)\n }\n prop._cachingAtTime = {\n lastFrame: initialDefaultFrame,\n lastIndex: 0,\n value: value,\n }\n expressionHelpers.searchExpressions(elem, data, prop)\n if (prop.k) {\n container.addDynamicProperty(prop)\n }\n\n return prop\n }\n\n function getShapeValueAtTime(frameNum) {\n // For now this caching object is created only when needed instead of creating it when the shape is initialized.\n if (!this._cachingAtTime) {\n this._cachingAtTime = {\n shapeValue: shapePool.clone(this.pv),\n lastIndex: 0,\n lastTime: initialDefaultFrame,\n }\n }\n\n frameNum *= this.elem.globalData.frameRate\n frameNum -= this.offsetTime\n if (frameNum !== this._cachingAtTime.lastTime) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0\n this._cachingAtTime.lastTime = frameNum\n this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime)\n }\n return this._cachingAtTime.shapeValue\n }\n\n var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction()\n var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction()\n\n function ShapeExpressions() {}\n ShapeExpressions.prototype = {\n vertices: function (prop, time) {\n if (this.k) {\n this.getValue()\n }\n var shapePath = this.v\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0)\n }\n var i\n var len = shapePath._length\n var vertices = shapePath[prop]\n var points = shapePath.v\n var arr = createSizedArray(len)\n for (i = 0; i < len; i += 1) {\n if (prop === 'i' || prop === 'o') {\n arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]]\n } else {\n arr[i] = [vertices[i][0], vertices[i][1]]\n }\n }\n return arr\n },\n points: function (time) {\n return this.vertices('v', time)\n },\n inTangents: function (time) {\n return this.vertices('i', time)\n },\n outTangents: function (time) {\n return this.vertices('o', time)\n },\n isClosed: function () {\n return this.v.c\n },\n pointOnPath: function (perc, time) {\n var shapePath = this.v\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0)\n }\n if (!this._segmentsLength) {\n this._segmentsLength = bez.getSegmentsLength(shapePath)\n }\n\n var segmentsLength = this._segmentsLength\n var lengths = segmentsLength.lengths\n var lengthPos = segmentsLength.totalLength * perc\n var i = 0\n var len = lengths.length\n var accumulatedLength = 0\n var pt\n while (i < len) {\n if (accumulatedLength + lengths[i].addedLength > lengthPos) {\n var initIndex = i\n var endIndex = shapePath.c && i === len - 1 ? 0 : i + 1\n var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength\n pt = bez.getPointInSegment(\n shapePath.v[initIndex],\n shapePath.v[endIndex],\n shapePath.o[initIndex],\n shapePath.i[endIndex],\n segmentPerc,\n lengths[i],\n )\n break\n } else {\n accumulatedLength += lengths[i].addedLength\n }\n i += 1\n }\n if (!pt) {\n pt = shapePath.c\n ? [shapePath.v[0][0], shapePath.v[0][1]]\n : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]]\n }\n return pt\n },\n vectorOnPath: function (perc, time, vectorType) {\n // perc doesn't use triple equality because it can be a Number object as well as a primitive.\n if (perc == 1) {\n // eslint-disable-line eqeqeq\n perc = this.v.c\n } else if (perc == 0) {\n // eslint-disable-line eqeqeq\n perc = 0.999\n }\n var pt1 = this.pointOnPath(perc, time)\n var pt2 = this.pointOnPath(perc + 0.001, time)\n var xLength = pt2[0] - pt1[0]\n var yLength = pt2[1] - pt1[1]\n var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2))\n if (magnitude === 0) {\n return [0, 0]\n }\n var unitVector =\n vectorType === 'tangent'\n ? [xLength / magnitude, yLength / magnitude]\n : [-yLength / magnitude, xLength / magnitude]\n return unitVector\n },\n tangentOnPath: function (perc, time) {\n return this.vectorOnPath(perc, time, 'tangent')\n },\n normalOnPath: function (perc, time) {\n return this.vectorOnPath(perc, time, 'normal')\n },\n setGroupProperty: expressionHelpers.setGroupProperty,\n getValueAtTime: expressionHelpers.getStaticValueAtTime,\n }\n extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction)\n extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction)\n KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime\n KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression\n\n var propertyGetShapeProp = ShapePropertyFactory.getShapeProp\n ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {\n var prop = propertyGetShapeProp(elem, data, type, arr, trims)\n prop.propertyIndex = data.ix\n prop.lock = false\n if (type === 3) {\n expressionHelpers.searchExpressions(elem, data.pt, prop)\n } else if (type === 4) {\n expressionHelpers.searchExpressions(elem, data.ks, prop)\n }\n if (prop.k) {\n elem.addDynamicProperty(prop)\n }\n return prop\n }\n }\n\n function initialize$1() {\n addPropertyDecorator()\n }\n\n function addDecorator() {\n function searchExpressions() {\n if (this.data.d.x) {\n this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this)\n this.addEffect(this.getExpressionValue.bind(this))\n return true\n }\n return null\n }\n\n TextProperty.prototype.getExpressionValue = function (currentValue, text) {\n var newValue = this.calculateExpression(text)\n if (currentValue.t !== newValue) {\n var newData = {}\n this.copyData(newData, currentValue)\n newData.t = newValue.toString()\n newData.__complete = false\n return newData\n }\n return currentValue\n }\n\n TextProperty.prototype.searchProperty = function () {\n var isKeyframed = this.searchKeyframes()\n var hasExpressions = this.searchExpressions()\n this.kf = isKeyframed || hasExpressions\n return this.kf\n }\n\n TextProperty.prototype.searchExpressions = searchExpressions\n }\n\n function initialize() {\n addDecorator()\n }\n\n // Registering expression plugin\n setExpressionsPlugin(Expressions)\n initialize$1()\n initialize()\n\n return lottie\n})()\n\nexport { lottie as default }\n", "const { parseBuffer } = (() => {\n /**\n * https://opentype.js.org v1.3.4 | (c) Frederik De Bleser and other contributors | MIT License | Uses tiny-inflate by Devon Govett and string.prototype.codepointat polyfill by Mathias Bynens\n */\n\n var TINF_OK = 0\n var TINF_DATA_ERROR = -3\n\n function Tree() {\n this.table = new Uint16Array(16) /* table of code length counts */\n this.trans = new Uint16Array(288) /* code -> symbol translation table */\n }\n\n function Data(source, dest) {\n this.source = source\n this.sourceIndex = 0\n this.tag = 0\n this.bitcount = 0\n\n this.dest = dest\n this.destLen = 0\n\n this.ltree = new Tree() /* dynamic length/symbol tree */\n this.dtree = new Tree() /* dynamic distance tree */\n }\n\n /* --------------------------------------------------- *\n * -- uninitialized global data (static structures) -- *\n * --------------------------------------------------- */\n\n var sltree = new Tree()\n var sdtree = new Tree()\n\n /* extra bits and base tables for length codes */\n var length_bits = new Uint8Array(30)\n var length_base = new Uint16Array(30)\n\n /* extra bits and base tables for distance codes */\n var dist_bits = new Uint8Array(30)\n var dist_base = new Uint16Array(30)\n\n /* special ordering of code length codes */\n var clcidx = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])\n\n /* used by tinf_decode_trees, avoids allocations every call */\n var code_tree = new Tree()\n var lengths = new Uint8Array(288 + 32)\n\n /* ----------------------- *\n * -- utility functions -- *\n * ----------------------- */\n\n /* build extra bits and base tables */\n function tinf_build_bits_base(bits, base, delta, first) {\n var i, sum\n\n /* build bits table */\n for (i = 0; i < delta; ++i) {\n bits[i] = 0\n }\n for (i = 0; i < 30 - delta; ++i) {\n bits[i + delta] = (i / delta) | 0\n }\n\n /* build base table */\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum\n sum += 1 << bits[i]\n }\n }\n\n /* build the fixed huffman trees */\n function tinf_build_fixed_trees(lt, dt) {\n var i\n\n /* build fixed length tree */\n for (i = 0; i < 7; ++i) {\n lt.table[i] = 0\n }\n\n lt.table[7] = 24\n lt.table[8] = 152\n lt.table[9] = 112\n\n for (i = 0; i < 24; ++i) {\n lt.trans[i] = 256 + i\n }\n for (i = 0; i < 144; ++i) {\n lt.trans[24 + i] = i\n }\n for (i = 0; i < 8; ++i) {\n lt.trans[24 + 144 + i] = 280 + i\n }\n for (i = 0; i < 112; ++i) {\n lt.trans[24 + 144 + 8 + i] = 144 + i\n }\n\n /* build fixed distance tree */\n for (i = 0; i < 5; ++i) {\n dt.table[i] = 0\n }\n\n dt.table[5] = 32\n\n for (i = 0; i < 32; ++i) {\n dt.trans[i] = i\n }\n }\n\n /* given an array of code lengths, build a tree */\n var offs = new Uint16Array(16)\n\n function tinf_build_tree(t, lengths, off, num) {\n var i, sum\n\n /* clear code length count table */\n for (i = 0; i < 16; ++i) {\n t.table[i] = 0\n }\n\n /* scan symbol lengths, and sum code length counts */\n for (i = 0; i < num; ++i) {\n t.table[lengths[off + i]]++\n }\n\n t.table[0] = 0\n\n /* compute offset table for distribution sort */\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum\n sum += t.table[i]\n }\n\n /* create code->symbol translation table (symbols sorted by code) */\n for (i = 0; i < num; ++i) {\n if (lengths[off + i]) {\n t.trans[offs[lengths[off + i]]++] = i\n }\n }\n }\n\n /* ---------------------- *\n * -- decode functions -- *\n * ---------------------- */\n\n /* get one bit from source stream */\n function tinf_getbit(d) {\n /* check if tag is empty */\n if (!d.bitcount--) {\n /* load next tag */\n d.tag = d.source[d.sourceIndex++]\n d.bitcount = 7\n }\n\n /* shift bit out of tag */\n var bit = d.tag & 1\n d.tag >>>= 1\n\n return bit\n }\n\n /* read a num bit value from a stream and add base */\n function tinf_read_bits(d, num, base) {\n if (!num) {\n return base\n }\n\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount\n d.bitcount += 8\n }\n\n var val = d.tag & (0xffff >>> (16 - num))\n d.tag >>>= num\n d.bitcount -= num\n return val + base\n }\n\n /* given a data stream and a tree, decode a symbol */\n function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount\n d.bitcount += 8\n }\n\n var sum = 0,\n cur = 0,\n len = 0\n var tag = d.tag\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1)\n tag >>>= 1\n ++len\n\n sum += t.table[len]\n cur -= t.table[len]\n } while (cur >= 0)\n\n d.tag = tag\n d.bitcount -= len\n\n return t.trans[sum + cur]\n }\n\n /* given a data stream, decode dynamic trees from it */\n function tinf_decode_trees(d, lt, dt) {\n var hlit, hdist, hclen\n var i, num, length\n\n /* get 5 bits HLIT (257-286) */\n hlit = tinf_read_bits(d, 5, 257)\n\n /* get 5 bits HDIST (1-32) */\n hdist = tinf_read_bits(d, 5, 1)\n\n /* get 4 bits HCLEN (4-19) */\n hclen = tinf_read_bits(d, 4, 4)\n\n for (i = 0; i < 19; ++i) {\n lengths[i] = 0\n }\n\n /* read code lengths for code length alphabet */\n for (i = 0; i < hclen; ++i) {\n /* get 3 bits code length (0-7) */\n var clen = tinf_read_bits(d, 3, 0)\n lengths[clcidx[i]] = clen\n }\n\n /* build code length tree */\n tinf_build_tree(code_tree, lengths, 0, 19)\n\n /* decode code lengths for the dynamic trees */\n for (num = 0; num < hlit + hdist; ) {\n var sym = tinf_decode_symbol(d, code_tree)\n\n switch (sym) {\n case 16:\n /* copy previous code length 3-6 times (read 2 bits) */\n var prev = lengths[num - 1]\n for (length = tinf_read_bits(d, 2, 3); length; --length) {\n lengths[num++] = prev\n }\n break\n case 17:\n /* repeat code length 0 for 3-10 times (read 3 bits) */\n for (length = tinf_read_bits(d, 3, 3); length; --length) {\n lengths[num++] = 0\n }\n break\n case 18:\n /* repeat code length 0 for 11-138 times (read 7 bits) */\n for (length = tinf_read_bits(d, 7, 11); length; --length) {\n lengths[num++] = 0\n }\n break\n default:\n /* values 0-15 represent the actual code lengths */\n lengths[num++] = sym\n break\n }\n }\n\n /* build dynamic trees */\n tinf_build_tree(lt, lengths, 0, hlit)\n tinf_build_tree(dt, lengths, hlit, hdist)\n }\n\n /* ----------------------------- *\n * -- block inflate functions -- *\n * ----------------------------- */\n\n /* given a stream and two trees, inflate a block of data */\n function tinf_inflate_block_data(d, lt, dt) {\n while (1) {\n var sym = tinf_decode_symbol(d, lt)\n\n /* check for end of block */\n if (sym === 256) {\n return TINF_OK\n }\n\n if (sym < 256) {\n d.dest[d.destLen++] = sym\n } else {\n var length, dist, offs\n var i\n\n sym -= 257\n\n /* possibly get more bits from length code */\n length = tinf_read_bits(d, length_bits[sym], length_base[sym])\n\n dist = tinf_decode_symbol(d, dt)\n\n /* possibly get more bits from distance code */\n offs = d.destLen - tinf_read_bits(d, dist_bits[dist], dist_base[dist])\n\n /* copy match */\n for (i = offs; i < offs + length; ++i) {\n d.dest[d.destLen++] = d.dest[i]\n }\n }\n }\n }\n\n /* inflate an uncompressed block of data */\n function tinf_inflate_uncompressed_block(d) {\n var length, invlength\n var i\n\n /* unread from bitbuffer */\n while (d.bitcount > 8) {\n d.sourceIndex--\n d.bitcount -= 8\n }\n\n /* get length */\n length = d.source[d.sourceIndex + 1]\n length = 256 * length + d.source[d.sourceIndex]\n\n /* get one's complement of length */\n invlength = d.source[d.sourceIndex + 3]\n invlength = 256 * invlength + d.source[d.sourceIndex + 2]\n\n /* check length */\n if (length !== (~invlength & 0x0000ffff)) {\n return TINF_DATA_ERROR\n }\n\n d.sourceIndex += 4\n\n /* copy block */\n for (i = length; i; --i) {\n d.dest[d.destLen++] = d.source[d.sourceIndex++]\n }\n\n /* make sure we start next block on a byte boundary */\n d.bitcount = 0\n\n return TINF_OK\n }\n\n /* inflate stream from source to dest */\n function tinf_uncompress(source, dest) {\n var d = new Data(source, dest)\n var bfinal, btype, res\n\n do {\n /* read final block flag */\n bfinal = tinf_getbit(d)\n\n /* read block type (2 bits) */\n btype = tinf_read_bits(d, 2, 0)\n\n /* decompress block */\n switch (btype) {\n case 0:\n /* decompress uncompressed block */\n res = tinf_inflate_uncompressed_block(d)\n break\n case 1:\n /* decompress block with fixed huffman trees */\n res = tinf_inflate_block_data(d, sltree, sdtree)\n break\n case 2:\n /* decompress block with dynamic huffman trees */\n tinf_decode_trees(d, d.ltree, d.dtree)\n res = tinf_inflate_block_data(d, d.ltree, d.dtree)\n break\n default:\n res = TINF_DATA_ERROR\n }\n\n if (res !== TINF_OK) {\n throw new Error('Data error')\n }\n } while (!bfinal)\n\n if (d.destLen < d.dest.length) {\n if (typeof d.dest.slice === 'function') {\n return d.dest.slice(0, d.destLen)\n } else {\n return d.dest.subarray(0, d.destLen)\n }\n }\n\n return d.dest\n }\n\n /* -------------------- *\n * -- initialization -- *\n * -------------------- */\n\n /* build fixed huffman trees */\n tinf_build_fixed_trees(sltree, sdtree)\n\n /* build extra bits and base tables */\n tinf_build_bits_base(length_bits, length_base, 4, 3)\n tinf_build_bits_base(dist_bits, dist_base, 2, 1)\n\n /* fix a special case */\n length_bits[28] = 0\n length_base[28] = 258\n\n var tinyInflate = tinf_uncompress\n\n // The Bounding Box object\n\n function derive(v0, v1, v2, v3, t) {\n return (\n Math.pow(1 - t, 3) * v0 +\n 3 * Math.pow(1 - t, 2) * t * v1 +\n 3 * (1 - t) * Math.pow(t, 2) * v2 +\n Math.pow(t, 3) * v3\n )\n }\n /**\n * A bounding box is an enclosing box that describes the smallest measure within which all the points lie.\n * It is used to calculate the bounding box of a glyph or text path.\n *\n * On initialization, x1/y1/x2/y2 will be NaN. Check if the bounding box is empty using `isEmpty()`.\n *\n * @exports opentype.BoundingBox\n * @class\n * @constructor\n */\n function BoundingBox() {\n this.x1 = Number.NaN\n this.y1 = Number.NaN\n this.x2 = Number.NaN\n this.y2 = Number.NaN\n }\n\n /**\n * Returns true if the bounding box is empty, that is, no points have been added to the box yet.\n */\n BoundingBox.prototype.isEmpty = function () {\n return isNaN(this.x1) || isNaN(this.y1) || isNaN(this.x2) || isNaN(this.y2)\n }\n\n /**\n * Add the point to the bounding box.\n * The x1/y1/x2/y2 coordinates of the bounding box will now encompass the given point.\n * @param {number} x - The X coordinate of the point.\n * @param {number} y - The Y coordinate of the point.\n */\n BoundingBox.prototype.addPoint = function (x, y) {\n if (typeof x === 'number') {\n if (isNaN(this.x1) || isNaN(this.x2)) {\n this.x1 = x\n this.x2 = x\n }\n if (x < this.x1) {\n this.x1 = x\n }\n if (x > this.x2) {\n this.x2 = x\n }\n }\n if (typeof y === 'number') {\n if (isNaN(this.y1) || isNaN(this.y2)) {\n this.y1 = y\n this.y2 = y\n }\n if (y < this.y1) {\n this.y1 = y\n }\n if (y > this.y2) {\n this.y2 = y\n }\n }\n }\n\n /**\n * Add a X coordinate to the bounding box.\n * This extends the bounding box to include the X coordinate.\n * This function is used internally inside of addBezier.\n * @param {number} x - The X coordinate of the point.\n */\n BoundingBox.prototype.addX = function (x) {\n this.addPoint(x, null)\n }\n\n /**\n * Add a Y coordinate to the bounding box.\n * This extends the bounding box to include the Y coordinate.\n * This function is used internally inside of addBezier.\n * @param {number} y - The Y coordinate of the point.\n */\n BoundingBox.prototype.addY = function (y) {\n this.addPoint(null, y)\n }\n\n /**\n * Add a Bézier curve to the bounding box.\n * This extends the bounding box to include the entire Bézier.\n * @param {number} x0 - The starting X coordinate.\n * @param {number} y0 - The starting Y coordinate.\n * @param {number} x1 - The X coordinate of the first control point.\n * @param {number} y1 - The Y coordinate of the first control point.\n * @param {number} x2 - The X coordinate of the second control point.\n * @param {number} y2 - The Y coordinate of the second control point.\n * @param {number} x - The ending X coordinate.\n * @param {number} y - The ending Y coordinate.\n */\n BoundingBox.prototype.addBezier = function (x0, y0, x1, y1, x2, y2, x, y) {\n // This code is based on http://nishiohirokazu.blogspot.com/2009/06/how-to-calculate-bezier-curves-bounding.html\n // and https://github.com/icons8/svg-path-bounding-box\n\n var p0 = [x0, y0]\n var p1 = [x1, y1]\n var p2 = [x2, y2]\n var p3 = [x, y]\n\n this.addPoint(x0, y0)\n this.addPoint(x, y)\n\n for (var i = 0; i <= 1; i++) {\n var b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i]\n var a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i]\n var c = 3 * p1[i] - 3 * p0[i]\n\n if (a === 0) {\n if (b === 0) {\n continue\n }\n var t = -c / b\n if (0 < t && t < 1) {\n if (i === 0) {\n this.addX(derive(p0[i], p1[i], p2[i], p3[i], t))\n }\n if (i === 1) {\n this.addY(derive(p0[i], p1[i], p2[i], p3[i], t))\n }\n }\n continue\n }\n\n var b2ac = Math.pow(b, 2) - 4 * c * a\n if (b2ac < 0) {\n continue\n }\n var t1 = (-b + Math.sqrt(b2ac)) / (2 * a)\n if (0 < t1 && t1 < 1) {\n if (i === 0) {\n this.addX(derive(p0[i], p1[i], p2[i], p3[i], t1))\n }\n if (i === 1) {\n this.addY(derive(p0[i], p1[i], p2[i], p3[i], t1))\n }\n }\n var t2 = (-b - Math.sqrt(b2ac)) / (2 * a)\n if (0 < t2 && t2 < 1) {\n if (i === 0) {\n this.addX(derive(p0[i], p1[i], p2[i], p3[i], t2))\n }\n if (i === 1) {\n this.addY(derive(p0[i], p1[i], p2[i], p3[i], t2))\n }\n }\n }\n }\n\n /**\n * Add a quadratic curve to the bounding box.\n * This extends the bounding box to include the entire quadratic curve.\n * @param {number} x0 - The starting X coordinate.\n * @param {number} y0 - The starting Y coordinate.\n * @param {number} x1 - The X coordinate of the control point.\n * @param {number} y1 - The Y coordinate of the control point.\n * @param {number} x - The ending X coordinate.\n * @param {number} y - The ending Y coordinate.\n */\n BoundingBox.prototype.addQuad = function (x0, y0, x1, y1, x, y) {\n var cp1x = x0 + (2 / 3) * (x1 - x0)\n var cp1y = y0 + (2 / 3) * (y1 - y0)\n var cp2x = cp1x + (1 / 3) * (x - x0)\n var cp2y = cp1y + (1 / 3) * (y - y0)\n this.addBezier(x0, y0, cp1x, cp1y, cp2x, cp2y, x, y)\n }\n\n // Geometric objects\n\n /**\n * A bézier path containing a set of path commands similar to a SVG path.\n * Paths can be drawn on a context using `draw`.\n * @exports opentype.Path\n * @class\n * @constructor\n */\n function Path() {\n this.commands = []\n this.fill = 'black'\n this.stroke = null\n this.strokeWidth = 1\n }\n\n /**\n * @param {number} x\n * @param {number} y\n */\n Path.prototype.moveTo = function (x, y) {\n this.commands.push({\n type: 'M',\n x: x,\n y: y,\n })\n }\n\n /**\n * @param {number} x\n * @param {number} y\n */\n Path.prototype.lineTo = function (x, y) {\n this.commands.push({\n type: 'L',\n x: x,\n y: y,\n })\n }\n\n /**\n * Draws cubic curve\n * @function\n * curveTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control 1\n * @param {number} y1 - y of control 1\n * @param {number} x2 - x of control 2\n * @param {number} y2 - y of control 2\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n */\n\n /**\n * Draws cubic curve\n * @function\n * bezierCurveTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control 1\n * @param {number} y1 - y of control 1\n * @param {number} x2 - x of control 2\n * @param {number} y2 - y of control 2\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n * @see curveTo\n */\n Path.prototype.curveTo = Path.prototype.bezierCurveTo = function (x1, y1, x2, y2, x, y) {\n this.commands.push({\n type: 'C',\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2,\n x: x,\n y: y,\n })\n }\n\n /**\n * Draws quadratic curve\n * @function\n * quadraticCurveTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control\n * @param {number} y1 - y of control\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n */\n\n /**\n * Draws quadratic curve\n * @function\n * quadTo\n * @memberof opentype.Path.prototype\n * @param {number} x1 - x of control\n * @param {number} y1 - y of control\n * @param {number} x - x of path point\n * @param {number} y - y of path point\n */\n Path.prototype.quadTo = Path.prototype.quadraticCurveTo = function (x1, y1, x, y) {\n this.commands.push({\n type: 'Q',\n x1: x1,\n y1: y1,\n x: x,\n y: y,\n })\n }\n\n /**\n * Closes the path\n * @function closePath\n * @memberof opentype.Path.prototype\n */\n\n /**\n * Close the path\n * @function close\n * @memberof opentype.Path.prototype\n */\n Path.prototype.close = Path.prototype.closePath = function () {\n this.commands.push({\n type: 'Z',\n })\n }\n\n /**\n * Add the given path or list of commands to the commands of this path.\n * @param {Array} pathOrCommands - another opentype.Path, an opentype.BoundingBox, or an array of commands.\n */\n Path.prototype.extend = function (pathOrCommands) {\n if (pathOrCommands.commands) {\n pathOrCommands = pathOrCommands.commands\n } else if (pathOrCommands instanceof BoundingBox) {\n var box = pathOrCommands\n this.moveTo(box.x1, box.y1)\n this.lineTo(box.x2, box.y1)\n this.lineTo(box.x2, box.y2)\n this.lineTo(box.x1, box.y2)\n this.close()\n return\n }\n\n Array.prototype.push.apply(this.commands, pathOrCommands)\n }\n\n /**\n * Calculate the bounding box of the path.\n * @returns {opentype.BoundingBox}\n */\n Path.prototype.getBoundingBox = function () {\n var box = new BoundingBox()\n\n var startX = 0\n var startY = 0\n var prevX = 0\n var prevY = 0\n for (var i = 0; i < this.commands.length; i++) {\n var cmd = this.commands[i]\n switch (cmd.type) {\n case 'M':\n box.addPoint(cmd.x, cmd.y)\n startX = prevX = cmd.x\n startY = prevY = cmd.y\n break\n case 'L':\n box.addPoint(cmd.x, cmd.y)\n prevX = cmd.x\n prevY = cmd.y\n break\n case 'Q':\n box.addQuad(prevX, prevY, cmd.x1, cmd.y1, cmd.x, cmd.y)\n prevX = cmd.x\n prevY = cmd.y\n break\n case 'C':\n box.addBezier(prevX, prevY, cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y)\n prevX = cmd.x\n prevY = cmd.y\n break\n case 'Z':\n prevX = startX\n prevY = startY\n break\n default:\n throw new Error('Unexpected path command ' + cmd.type)\n }\n }\n if (box.isEmpty()) {\n box.addPoint(0, 0)\n }\n return box\n }\n\n /**\n * Draw the path to a 2D context.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context.\n */\n Path.prototype.draw = function (ctx) {\n ctx.beginPath()\n for (var i = 0; i < this.commands.length; i += 1) {\n var cmd = this.commands[i]\n if (cmd.type === 'M') {\n ctx.moveTo(cmd.x, cmd.y)\n } else if (cmd.type === 'L') {\n ctx.lineTo(cmd.x, cmd.y)\n } else if (cmd.type === 'C') {\n ctx.bezierCurveTo(cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y)\n } else if (cmd.type === 'Q') {\n ctx.quadraticCurveTo(cmd.x1, cmd.y1, cmd.x, cmd.y)\n } else if (cmd.type === 'Z') {\n ctx.closePath()\n }\n }\n\n if (this.fill) {\n ctx.fillStyle = this.fill\n ctx.fill()\n }\n\n if (this.stroke) {\n ctx.strokeStyle = this.stroke\n ctx.lineWidth = this.strokeWidth\n ctx.stroke()\n }\n }\n\n /**\n * Convert the Path to a string of path data instructions\n * See http://www.w3.org/TR/SVG/paths.html#PathData\n * @param {number} [decimalPlaces=2] - The amount of decimal places for floating-point values\n * @return {string}\n */\n Path.prototype.toPathData = function (decimalPlaces) {\n decimalPlaces = decimalPlaces !== undefined ? decimalPlaces : 2\n\n function floatToString(v) {\n if (Math.round(v) === v) {\n return '' + Math.round(v)\n } else {\n return v.toFixed(decimalPlaces)\n }\n }\n\n function packValues() {\n var arguments$1 = arguments\n\n var s = ''\n for (var i = 0; i < arguments.length; i += 1) {\n var v = arguments$1[i]\n if (v >= 0 && i > 0) {\n s += ' '\n }\n\n s += floatToString(v)\n }\n\n return s\n }\n\n var d = ''\n for (var i = 0; i < this.commands.length; i += 1) {\n var cmd = this.commands[i]\n if (cmd.type === 'M') {\n d += 'M' + packValues(cmd.x, cmd.y)\n } else if (cmd.type === 'L') {\n d += 'L' + packValues(cmd.x, cmd.y)\n } else if (cmd.type === 'C') {\n d += 'C' + packValues(cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y)\n } else if (cmd.type === 'Q') {\n d += 'Q' + packValues(cmd.x1, cmd.y1, cmd.x, cmd.y)\n } else if (cmd.type === 'Z') {\n d += 'Z'\n }\n }\n\n return d\n }\n\n /**\n * Convert the path to an SVG element, as a string.\n * @param {number} [decimalPlaces=2] - The amount of decimal places for floating-point values\n * @return {string}\n */\n Path.prototype.toSVG = function (decimalPlaces) {\n var svg = '= 0 && v <= 255, 'Byte value should be between 0 and 255.')\n return [v]\n }\n /**\n * @constant\n * @type {number}\n */\n sizeOf.BYTE = constant(1)\n\n /**\n * Convert a 8-bit signed integer to a list of 1 byte.\n * @param {string}\n * @returns {Array}\n */\n encode.CHAR = function (v) {\n return [v.charCodeAt(0)]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.CHAR = constant(1)\n\n /**\n * Convert an ASCII string to a list of bytes.\n * @param {string}\n * @returns {Array}\n */\n encode.CHARARRAY = function (v) {\n if (typeof v === 'undefined') {\n v = ''\n console.warn(\n 'Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name.',\n )\n }\n var b = []\n for (var i = 0; i < v.length; i += 1) {\n b[i] = v.charCodeAt(i)\n }\n\n return b\n }\n\n /**\n * @param {Array}\n * @returns {number}\n */\n sizeOf.CHARARRAY = function (v) {\n if (typeof v === 'undefined') {\n return 0\n }\n return v.length\n }\n\n /**\n * Convert a 16-bit unsigned integer to a list of 2 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.USHORT = function (v) {\n return [(v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.USHORT = constant(2)\n\n /**\n * Convert a 16-bit signed integer to a list of 2 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.SHORT = function (v) {\n // Two's complement\n if (v >= LIMIT16) {\n v = -(2 * LIMIT16 - v)\n }\n\n return [(v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.SHORT = constant(2)\n\n /**\n * Convert a 24-bit unsigned integer to a list of 3 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.UINT24 = function (v) {\n return [(v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.UINT24 = constant(3)\n\n /**\n * Convert a 32-bit unsigned integer to a list of 4 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.ULONG = function (v) {\n return [(v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.ULONG = constant(4)\n\n /**\n * Convert a 32-bit unsigned integer to a list of 4 bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.LONG = function (v) {\n // Two's complement\n if (v >= LIMIT32) {\n v = -(2 * LIMIT32 - v)\n }\n\n return [(v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.LONG = constant(4)\n\n encode.FIXED = encode.ULONG\n sizeOf.FIXED = sizeOf.ULONG\n\n encode.FWORD = encode.SHORT\n sizeOf.FWORD = sizeOf.SHORT\n\n encode.UFWORD = encode.USHORT\n sizeOf.UFWORD = sizeOf.USHORT\n\n /**\n * Convert a 32-bit Apple Mac timestamp integer to a list of 8 bytes, 64-bit timestamp.\n * @param {number}\n * @returns {Array}\n */\n encode.LONGDATETIME = function (v) {\n return [0, 0, 0, 0, (v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.LONGDATETIME = constant(8)\n\n /**\n * Convert a 4-char tag to a list of 4 bytes.\n * @param {string}\n * @returns {Array}\n */\n encode.TAG = function (v) {\n check.argument(v.length === 4, 'Tag should be exactly 4 ASCII characters.')\n return [v.charCodeAt(0), v.charCodeAt(1), v.charCodeAt(2), v.charCodeAt(3)]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.TAG = constant(4)\n\n // CFF data types ///////////////////////////////////////////////////////////\n\n encode.Card8 = encode.BYTE\n sizeOf.Card8 = sizeOf.BYTE\n\n encode.Card16 = encode.USHORT\n sizeOf.Card16 = sizeOf.USHORT\n\n encode.OffSize = encode.BYTE\n sizeOf.OffSize = sizeOf.BYTE\n\n encode.SID = encode.USHORT\n sizeOf.SID = sizeOf.USHORT\n\n // Convert a numeric operand or charstring number to a variable-size list of bytes.\n /**\n * Convert a numeric operand or charstring number to a variable-size list of bytes.\n * @param {number}\n * @returns {Array}\n */\n encode.NUMBER = function (v) {\n if (v >= -107 && v <= 107) {\n return [v + 139]\n } else if (v >= 108 && v <= 1131) {\n v = v - 108\n return [(v >> 8) + 247, v & 0xff]\n } else if (v >= -1131 && v <= -108) {\n v = -v - 108\n return [(v >> 8) + 251, v & 0xff]\n } else if (v >= -32768 && v <= 32767) {\n return encode.NUMBER16(v)\n } else {\n return encode.NUMBER32(v)\n }\n }\n\n /**\n * @param {number}\n * @returns {number}\n */\n sizeOf.NUMBER = function (v) {\n return encode.NUMBER(v).length\n }\n\n /**\n * Convert a signed number between -32768 and +32767 to a three-byte value.\n * This ensures we always use three bytes, but is not the most compact format.\n * @param {number}\n * @returns {Array}\n */\n encode.NUMBER16 = function (v) {\n return [28, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.NUMBER16 = constant(3)\n\n /**\n * Convert a signed number between -(2^31) and +(2^31-1) to a five-byte value.\n * This is useful if you want to be sure you always use four bytes,\n * at the expense of wasting a few bytes for smaller numbers.\n * @param {number}\n * @returns {Array}\n */\n encode.NUMBER32 = function (v) {\n return [29, (v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n\n /**\n * @constant\n * @type {number}\n */\n sizeOf.NUMBER32 = constant(5)\n\n /**\n * @param {number}\n * @returns {Array}\n */\n encode.REAL = function (v) {\n var value = v.toString()\n\n // Some numbers use an epsilon to encode the value. (e.g. JavaScript will store 0.0000001 as 1e-7)\n // This code converts it back to a number without the epsilon.\n var m = /\\.(\\d*?)(?:9{5,20}|0{5,20})\\d{0,2}(?:e(.+)|$)/.exec(value)\n if (m) {\n var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length))\n value = (Math.round(v * epsilon) / epsilon).toString()\n }\n\n var nibbles = ''\n for (var i = 0, ii = value.length; i < ii; i += 1) {\n var c = value[i]\n if (c === 'e') {\n nibbles += value[++i] === '-' ? 'c' : 'b'\n } else if (c === '.') {\n nibbles += 'a'\n } else if (c === '-') {\n nibbles += 'e'\n } else {\n nibbles += c\n }\n }\n\n nibbles += nibbles.length & 1 ? 'f' : 'ff'\n var out = [30]\n for (var i$1 = 0, ii$1 = nibbles.length; i$1 < ii$1; i$1 += 2) {\n out.push(parseInt(nibbles.substr(i$1, 2), 16))\n }\n\n return out\n }\n\n /**\n * @param {number}\n * @returns {number}\n */\n sizeOf.REAL = function (v) {\n return encode.REAL(v).length\n }\n\n encode.NAME = encode.CHARARRAY\n sizeOf.NAME = sizeOf.CHARARRAY\n\n encode.STRING = encode.CHARARRAY\n sizeOf.STRING = sizeOf.CHARARRAY\n\n /**\n * @param {DataView} data\n * @param {number} offset\n * @param {number} numBytes\n * @returns {string}\n */\n decode.UTF8 = function (data, offset, numBytes) {\n var codePoints = []\n var numChars = numBytes\n for (var j = 0; j < numChars; j++, offset += 1) {\n codePoints[j] = data.getUint8(offset)\n }\n\n return String.fromCharCode.apply(null, codePoints)\n }\n\n /**\n * @param {DataView} data\n * @param {number} offset\n * @param {number} numBytes\n * @returns {string}\n */\n decode.UTF16 = function (data, offset, numBytes) {\n var codePoints = []\n var numChars = numBytes / 2\n for (var j = 0; j < numChars; j++, offset += 2) {\n codePoints[j] = data.getUint16(offset)\n }\n\n return String.fromCharCode.apply(null, codePoints)\n }\n\n /**\n * Convert a JavaScript string to UTF16-BE.\n * @param {string}\n * @returns {Array}\n */\n encode.UTF16 = function (v) {\n var b = []\n for (var i = 0; i < v.length; i += 1) {\n var codepoint = v.charCodeAt(i)\n b[b.length] = (codepoint >> 8) & 0xff\n b[b.length] = codepoint & 0xff\n }\n\n return b\n }\n\n /**\n * @param {string}\n * @returns {number}\n */\n sizeOf.UTF16 = function (v) {\n return v.length * 2\n }\n\n // Data for converting old eight-bit Macintosh encodings to Unicode.\n // This representation is optimized for decoding; encoding is slower\n // and needs more memory. The assumption is that all opentype.js users\n // want to open fonts, but saving a font will be comparatively rare\n // so it can be more expensive. Keyed by IANA character set name.\n //\n // Python script for generating these strings:\n //\n // s = u''.join([chr(c).decode('mac_greek') for c in range(128, 256)])\n // print(s.encode('utf-8'))\n /**\n * @private\n */\n var eightBitMacEncodings = {\n // Python: 'mac_croatian'\n 'x-mac-croatian':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø' +\n '¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ',\n // Python: 'mac_cyrillic'\n 'x-mac-cyrillic':\n 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњ' +\n 'јЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю',\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/GAELIC.TXT\n 'x-mac-gaelic':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæø' +\n 'ṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ',\n // Python: 'mac_greek'\n 'x-mac-greek':\n 'Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩ' +\n 'άΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ\\u00AD',\n // Python: 'mac_iceland'\n 'x-mac-icelandic':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/INUIT.TXT\n 'x-mac-inuit':\n 'ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗ' +\n 'ᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł',\n // Python: 'mac_latin2'\n 'x-mac-ce':\n 'ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅ' +\n 'ņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ',\n // Python: 'mac_roman'\n macintosh:\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',\n // Python: 'mac_romanian'\n 'x-mac-romanian':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',\n // Python: 'mac_turkish'\n 'x-mac-turkish':\n 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' +\n '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ',\n }\n\n /**\n * Decodes an old-style Macintosh string. Returns either a Unicode JavaScript\n * string, or 'undefined' if the encoding is unsupported. For example, we do\n * not support Chinese, Japanese or Korean because these would need large\n * mapping tables.\n * @param {DataView} dataView\n * @param {number} offset\n * @param {number} dataLength\n * @param {string} encoding\n * @returns {string}\n */\n decode.MACSTRING = function (dataView, offset, dataLength, encoding) {\n var table = eightBitMacEncodings[encoding]\n if (table === undefined) {\n return undefined\n }\n\n var result = ''\n for (var i = 0; i < dataLength; i++) {\n var c = dataView.getUint8(offset + i)\n // In all eight-bit Mac encodings, the characters 0x00..0x7F are\n // mapped to U+0000..U+007F; we only need to look up the others.\n if (c <= 0x7f) {\n result += String.fromCharCode(c)\n } else {\n result += table[c & 0x7f]\n }\n }\n\n return result\n }\n\n // Helper function for encode.MACSTRING. Returns a dictionary for mapping\n // Unicode character codes to their 8-bit MacOS equivalent. This table\n // is not exactly a super cheap data structure, but we do not care because\n // encoding Macintosh strings is only rarely needed in typical applications.\n var macEncodingTableCache = typeof WeakMap === 'function' && new WeakMap()\n var macEncodingCacheKeys\n var getMacEncodingTable = function (encoding) {\n // Since we use encoding as a cache key for WeakMap, it has to be\n // a String object and not a literal. And at least on NodeJS 2.10.1,\n // WeakMap requires that the same String instance is passed for cache hits.\n if (!macEncodingCacheKeys) {\n macEncodingCacheKeys = {}\n for (var e in eightBitMacEncodings) {\n /*jshint -W053 */ // Suppress \"Do not use String as a constructor.\"\n macEncodingCacheKeys[e] = new String(e)\n }\n }\n\n var cacheKey = macEncodingCacheKeys[encoding]\n if (cacheKey === undefined) {\n return undefined\n }\n\n // We can't do \"if (cache.has(key)) {return cache.get(key)}\" here:\n // since garbage collection may run at any time, it could also kick in\n // between the calls to cache.has() and cache.get(). In that case,\n // we would return 'undefined' even though we do support the encoding.\n if (macEncodingTableCache) {\n var cachedTable = macEncodingTableCache.get(cacheKey)\n if (cachedTable !== undefined) {\n return cachedTable\n }\n }\n\n var decodingTable = eightBitMacEncodings[encoding]\n if (decodingTable === undefined) {\n return undefined\n }\n\n var encodingTable = {}\n for (var i = 0; i < decodingTable.length; i++) {\n encodingTable[decodingTable.charCodeAt(i)] = i + 0x80\n }\n\n if (macEncodingTableCache) {\n macEncodingTableCache.set(cacheKey, encodingTable)\n }\n\n return encodingTable\n }\n\n /**\n * Encodes an old-style Macintosh string. Returns a byte array upon success.\n * If the requested encoding is unsupported, or if the input string contains\n * a character that cannot be expressed in the encoding, the function returns\n * 'undefined'.\n * @param {string} str\n * @param {string} encoding\n * @returns {Array}\n */\n encode.MACSTRING = function (str, encoding) {\n var table = getMacEncodingTable(encoding)\n if (table === undefined) {\n return undefined\n }\n\n var result = []\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i)\n\n // In all eight-bit Mac encodings, the characters 0x00..0x7F are\n // mapped to U+0000..U+007F; we only need to look up the others.\n if (c >= 0x80) {\n c = table[c]\n if (c === undefined) {\n // str contains a Unicode character that cannot be encoded\n // in the requested encoding.\n return undefined\n }\n }\n result[i] = c\n // result.push(c);\n }\n\n return result\n }\n\n /**\n * @param {string} str\n * @param {string} encoding\n * @returns {number}\n */\n sizeOf.MACSTRING = function (str, encoding) {\n var b = encode.MACSTRING(str, encoding)\n if (b !== undefined) {\n return b.length\n } else {\n return 0\n }\n }\n\n // Helper for encode.VARDELTAS\n function isByteEncodable(value) {\n return value >= -128 && value <= 127\n }\n\n // Helper for encode.VARDELTAS\n function encodeVarDeltaRunAsZeroes(deltas, pos, result) {\n var runLength = 0\n var numDeltas = deltas.length\n while (pos < numDeltas && runLength < 64 && deltas[pos] === 0) {\n ++pos\n ++runLength\n }\n result.push(0x80 | (runLength - 1))\n return pos\n }\n\n // Helper for encode.VARDELTAS\n function encodeVarDeltaRunAsBytes(deltas, offset, result) {\n var runLength = 0\n var numDeltas = deltas.length\n var pos = offset\n while (pos < numDeltas && runLength < 64) {\n var value = deltas[pos]\n if (!isByteEncodable(value)) {\n break\n }\n\n // Within a byte-encoded run of deltas, a single zero is best\n // stored literally as 0x00 value. However, if we have two or\n // more zeroes in a sequence, it is better to start a new run.\n // Fore example, the sequence of deltas [15, 15, 0, 15, 15]\n // becomes 6 bytes (04 0F 0F 00 0F 0F) when storing the zero\n // within the current run, but 7 bytes (01 0F 0F 80 01 0F 0F)\n // when starting a new run.\n if (value === 0 && pos + 1 < numDeltas && deltas[pos + 1] === 0) {\n break\n }\n\n ++pos\n ++runLength\n }\n result.push(runLength - 1)\n for (var i = offset; i < pos; ++i) {\n result.push((deltas[i] + 256) & 0xff)\n }\n return pos\n }\n\n // Helper for encode.VARDELTAS\n function encodeVarDeltaRunAsWords(deltas, offset, result) {\n var runLength = 0\n var numDeltas = deltas.length\n var pos = offset\n while (pos < numDeltas && runLength < 64) {\n var value = deltas[pos]\n\n // Within a word-encoded run of deltas, it is easiest to start\n // a new run (with a different encoding) whenever we encounter\n // a zero value. For example, the sequence [0x6666, 0, 0x7777]\n // needs 7 bytes when storing the zero inside the current run\n // (42 66 66 00 00 77 77), and equally 7 bytes when starting a\n // new run (40 66 66 80 40 77 77).\n if (value === 0) {\n break\n }\n\n // Within a word-encoded run of deltas, a single value in the\n // range (-128..127) should be encoded within the current run\n // because it is more compact. For example, the sequence\n // [0x6666, 2, 0x7777] becomes 7 bytes when storing the value\n // literally (42 66 66 00 02 77 77), but 8 bytes when starting\n // a new run (40 66 66 00 02 40 77 77).\n if (isByteEncodable(value) && pos + 1 < numDeltas && isByteEncodable(deltas[pos + 1])) {\n break\n }\n\n ++pos\n ++runLength\n }\n result.push(0x40 | (runLength - 1))\n for (var i = offset; i < pos; ++i) {\n var val = deltas[i]\n result.push(((val + 0x10000) >> 8) & 0xff, (val + 0x100) & 0xff)\n }\n return pos\n }\n\n /**\n * Encode a list of variation adjustment deltas.\n *\n * Variation adjustment deltas are used in ‘gvar’ and ‘cvar’ tables.\n * They indicate how points (in ‘gvar’) or values (in ‘cvar’) get adjusted\n * when generating instances of variation fonts.\n *\n * @see https://www.microsoft.com/typography/otspec/gvar.htm\n * @see https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gvar.html\n * @param {Array}\n * @return {Array}\n */\n encode.VARDELTAS = function (deltas) {\n var pos = 0\n var result = []\n while (pos < deltas.length) {\n var value = deltas[pos]\n if (value === 0) {\n pos = encodeVarDeltaRunAsZeroes(deltas, pos, result)\n } else if (value >= -128 && value <= 127) {\n pos = encodeVarDeltaRunAsBytes(deltas, pos, result)\n } else {\n pos = encodeVarDeltaRunAsWords(deltas, pos, result)\n }\n }\n return result\n }\n\n // Convert a list of values to a CFF INDEX structure.\n // The values should be objects containing name / type / value.\n /**\n * @param {Array} l\n * @returns {Array}\n */\n encode.INDEX = function (l) {\n //var offset, offsets, offsetEncoder, encodedOffsets, encodedOffset, data,\n // i, v;\n // Because we have to know which data type to use to encode the offsets,\n // we have to go through the values twice: once to encode the data and\n // calculate the offsets, then again to encode the offsets using the fitting data type.\n var offset = 1 // First offset is always 1.\n var offsets = [offset]\n var data = []\n for (var i = 0; i < l.length; i += 1) {\n var v = encode.OBJECT(l[i])\n Array.prototype.push.apply(data, v)\n offset += v.length\n offsets.push(offset)\n }\n\n if (data.length === 0) {\n return [0, 0]\n }\n\n var encodedOffsets = []\n var offSize = (1 + Math.floor(Math.log(offset) / Math.log(2)) / 8) | 0\n var offsetEncoder = [undefined, encode.BYTE, encode.USHORT, encode.UINT24, encode.ULONG][offSize]\n for (var i$1 = 0; i$1 < offsets.length; i$1 += 1) {\n var encodedOffset = offsetEncoder(offsets[i$1])\n Array.prototype.push.apply(encodedOffsets, encodedOffset)\n }\n\n return Array.prototype.concat(encode.Card16(l.length), encode.OffSize(offSize), encodedOffsets, data)\n }\n\n /**\n * @param {Array}\n * @returns {number}\n */\n sizeOf.INDEX = function (v) {\n return encode.INDEX(v).length\n }\n\n /**\n * Convert an object to a CFF DICT structure.\n * The keys should be numeric.\n * The values should be objects containing name / type / value.\n * @param {Object} m\n * @returns {Array}\n */\n encode.DICT = function (m) {\n var d = []\n var keys = Object.keys(m)\n var length = keys.length\n\n for (var i = 0; i < length; i += 1) {\n // Object.keys() return string keys, but our keys are always numeric.\n var k = parseInt(keys[i], 0)\n var v = m[k]\n // Value comes before the key.\n d = d.concat(encode.OPERAND(v.value, v.type))\n d = d.concat(encode.OPERATOR(k))\n }\n\n return d\n }\n\n /**\n * @param {Object}\n * @returns {number}\n */\n sizeOf.DICT = function (m) {\n return encode.DICT(m).length\n }\n\n /**\n * @param {number}\n * @returns {Array}\n */\n encode.OPERATOR = function (v) {\n if (v < 1200) {\n return [v]\n } else {\n return [12, v - 1200]\n }\n }\n\n /**\n * @param {Array} v\n * @param {string}\n * @returns {Array}\n */\n encode.OPERAND = function (v, type) {\n var d = []\n if (Array.isArray(type)) {\n for (var i = 0; i < type.length; i += 1) {\n check.argument(v.length === type.length, 'Not enough arguments given for type' + type)\n d = d.concat(encode.OPERAND(v[i], type[i]))\n }\n } else {\n if (type === 'SID') {\n d = d.concat(encode.NUMBER(v))\n } else if (type === 'offset') {\n // We make it easy for ourselves and always encode offsets as\n // 4 bytes. This makes offset calculation for the top dict easier.\n d = d.concat(encode.NUMBER32(v))\n } else if (type === 'number') {\n d = d.concat(encode.NUMBER(v))\n } else if (type === 'real') {\n d = d.concat(encode.REAL(v))\n } else {\n throw new Error('Unknown operand type ' + type)\n // FIXME Add support for booleans\n }\n }\n\n return d\n }\n\n encode.OP = encode.BYTE\n sizeOf.OP = sizeOf.BYTE\n\n // memoize charstring encoding using WeakMap if available\n var wmm = typeof WeakMap === 'function' && new WeakMap()\n\n /**\n * Convert a list of CharString operations to bytes.\n * @param {Array}\n * @returns {Array}\n */\n encode.CHARSTRING = function (ops) {\n // See encode.MACSTRING for why we don't do \"if (wmm && wmm.has(ops))\".\n if (wmm) {\n var cachedValue = wmm.get(ops)\n if (cachedValue !== undefined) {\n return cachedValue\n }\n }\n\n var d = []\n var length = ops.length\n\n for (var i = 0; i < length; i += 1) {\n var op = ops[i]\n d = d.concat(encode[op.type](op.value))\n }\n\n if (wmm) {\n wmm.set(ops, d)\n }\n\n return d\n }\n\n /**\n * @param {Array}\n * @returns {number}\n */\n sizeOf.CHARSTRING = function (ops) {\n return encode.CHARSTRING(ops).length\n }\n\n // Utility functions ////////////////////////////////////////////////////////\n\n /**\n * Convert an object containing name / type / value to bytes.\n * @param {Object}\n * @returns {Array}\n */\n encode.OBJECT = function (v) {\n var encodingFunction = encode[v.type]\n check.argument(encodingFunction !== undefined, 'No encoding function for type ' + v.type)\n return encodingFunction(v.value)\n }\n\n /**\n * @param {Object}\n * @returns {number}\n */\n sizeOf.OBJECT = function (v) {\n var sizeOfFunction = sizeOf[v.type]\n check.argument(sizeOfFunction !== undefined, 'No sizeOf function for type ' + v.type)\n return sizeOfFunction(v.value)\n }\n\n /**\n * Convert a table object to bytes.\n * A table contains a list of fields containing the metadata (name, type and default value).\n * The table itself has the field values set as attributes.\n * @param {opentype.Table}\n * @returns {Array}\n */\n encode.TABLE = function (table) {\n var d = []\n var length = table.fields.length\n var subtables = []\n var subtableOffsets = []\n\n for (var i = 0; i < length; i += 1) {\n var field = table.fields[i]\n var encodingFunction = encode[field.type]\n check.argument(\n encodingFunction !== undefined,\n 'No encoding function for field type ' + field.type + ' (' + field.name + ')',\n )\n var value = table[field.name]\n if (value === undefined) {\n value = field.value\n }\n\n var bytes = encodingFunction(value)\n\n if (field.type === 'TABLE') {\n subtableOffsets.push(d.length)\n d = d.concat([0, 0])\n subtables.push(bytes)\n } else {\n d = d.concat(bytes)\n }\n }\n\n for (var i$1 = 0; i$1 < subtables.length; i$1 += 1) {\n var o = subtableOffsets[i$1]\n var offset = d.length\n check.argument(offset < 65536, 'Table ' + table.tableName + ' too big.')\n d[o] = offset >> 8\n d[o + 1] = offset & 0xff\n d = d.concat(subtables[i$1])\n }\n\n return d\n }\n\n /**\n * @param {opentype.Table}\n * @returns {number}\n */\n sizeOf.TABLE = function (table) {\n var numBytes = 0\n var length = table.fields.length\n\n for (var i = 0; i < length; i += 1) {\n var field = table.fields[i]\n var sizeOfFunction = sizeOf[field.type]\n check.argument(\n sizeOfFunction !== undefined,\n 'No sizeOf function for field type ' + field.type + ' (' + field.name + ')',\n )\n var value = table[field.name]\n if (value === undefined) {\n value = field.value\n }\n\n numBytes += sizeOfFunction(value)\n\n // Subtables take 2 more bytes for offsets.\n if (field.type === 'TABLE') {\n numBytes += 2\n }\n }\n\n return numBytes\n }\n\n encode.RECORD = encode.TABLE\n sizeOf.RECORD = sizeOf.TABLE\n\n // Merge in a list of bytes.\n encode.LITERAL = function (v) {\n return v\n }\n\n sizeOf.LITERAL = function (v) {\n return v.length\n }\n\n // Table metadata\n\n /**\n * @exports opentype.Table\n * @class\n * @param {string} tableName\n * @param {Array} fields\n * @param {Object} options\n * @constructor\n */\n function Table(tableName, fields, options) {\n // For coverage tables with coverage format 2, we do not want to add the coverage data directly to the table object,\n // as this will result in wrong encoding order of the coverage data on serialization to bytes.\n // The fallback of using the field values directly when not present on the table is handled in types.encode.TABLE() already.\n if (fields.length && (fields[0].name !== 'coverageFormat' || fields[0].value === 1)) {\n for (var i = 0; i < fields.length; i += 1) {\n var field = fields[i]\n this[field.name] = field.value\n }\n }\n\n this.tableName = tableName\n this.fields = fields\n if (options) {\n var optionKeys = Object.keys(options)\n for (var i$1 = 0; i$1 < optionKeys.length; i$1 += 1) {\n var k = optionKeys[i$1]\n var v = options[k]\n if (this[k] !== undefined) {\n this[k] = v\n }\n }\n }\n }\n\n /**\n * Encodes the table and returns an array of bytes\n * @return {Array}\n */\n Table.prototype.encode = function () {\n return encode.TABLE(this)\n }\n\n /**\n * Get the size of the table.\n * @return {number}\n */\n Table.prototype.sizeOf = function () {\n return sizeOf.TABLE(this)\n }\n\n /**\n * @private\n */\n function ushortList(itemName, list, count) {\n if (count === undefined) {\n count = list.length\n }\n var fields = new Array(list.length + 1)\n fields[0] = { name: itemName + 'Count', type: 'USHORT', value: count }\n for (var i = 0; i < list.length; i++) {\n fields[i + 1] = { name: itemName + i, type: 'USHORT', value: list[i] }\n }\n return fields\n }\n\n /**\n * @private\n */\n function tableList(itemName, records, itemCallback) {\n var count = records.length\n var fields = new Array(count + 1)\n fields[0] = { name: itemName + 'Count', type: 'USHORT', value: count }\n for (var i = 0; i < count; i++) {\n fields[i + 1] = { name: itemName + i, type: 'TABLE', value: itemCallback(records[i], i) }\n }\n return fields\n }\n\n /**\n * @private\n */\n function recordList(itemName, records, itemCallback) {\n var count = records.length\n var fields = []\n fields[0] = { name: itemName + 'Count', type: 'USHORT', value: count }\n for (var i = 0; i < count; i++) {\n fields = fields.concat(itemCallback(records[i], i))\n }\n return fields\n }\n\n // Common Layout Tables\n\n /**\n * @exports opentype.Coverage\n * @class\n * @param {opentype.Table}\n * @constructor\n * @extends opentype.Table\n */\n function Coverage(coverageTable) {\n if (coverageTable.format === 1) {\n Table.call(\n this,\n 'coverageTable',\n [{ name: 'coverageFormat', type: 'USHORT', value: 1 }].concat(ushortList('glyph', coverageTable.glyphs)),\n )\n } else if (coverageTable.format === 2) {\n Table.call(\n this,\n 'coverageTable',\n [{ name: 'coverageFormat', type: 'USHORT', value: 2 }].concat(\n recordList('rangeRecord', coverageTable.ranges, function (RangeRecord) {\n return [\n { name: 'startGlyphID', type: 'USHORT', value: RangeRecord.start },\n { name: 'endGlyphID', type: 'USHORT', value: RangeRecord.end },\n { name: 'startCoverageIndex', type: 'USHORT', value: RangeRecord.index },\n ]\n }),\n ),\n )\n } else {\n check.assert(false, 'Coverage format must be 1 or 2.')\n }\n }\n Coverage.prototype = Object.create(Table.prototype)\n Coverage.prototype.constructor = Coverage\n\n function ScriptList(scriptListTable) {\n Table.call(\n this,\n 'scriptListTable',\n recordList('scriptRecord', scriptListTable, function (scriptRecord, i) {\n var script = scriptRecord.script\n var defaultLangSys = script.defaultLangSys\n check.assert(\n !!defaultLangSys,\n 'Unable to write GSUB: script ' + scriptRecord.tag + ' has no default language system.',\n )\n return [\n { name: 'scriptTag' + i, type: 'TAG', value: scriptRecord.tag },\n {\n name: 'script' + i,\n type: 'TABLE',\n value: new Table(\n 'scriptTable',\n [\n {\n name: 'defaultLangSys',\n type: 'TABLE',\n value: new Table(\n 'defaultLangSys',\n [\n { name: 'lookupOrder', type: 'USHORT', value: 0 },\n { name: 'reqFeatureIndex', type: 'USHORT', value: defaultLangSys.reqFeatureIndex },\n ].concat(ushortList('featureIndex', defaultLangSys.featureIndexes)),\n ),\n },\n ].concat(\n recordList('langSys', script.langSysRecords, function (langSysRecord, i) {\n var langSys = langSysRecord.langSys\n return [\n { name: 'langSysTag' + i, type: 'TAG', value: langSysRecord.tag },\n {\n name: 'langSys' + i,\n type: 'TABLE',\n value: new Table(\n 'langSys',\n [\n { name: 'lookupOrder', type: 'USHORT', value: 0 },\n { name: 'reqFeatureIndex', type: 'USHORT', value: langSys.reqFeatureIndex },\n ].concat(ushortList('featureIndex', langSys.featureIndexes)),\n ),\n },\n ]\n }),\n ),\n ),\n },\n ]\n }),\n )\n }\n ScriptList.prototype = Object.create(Table.prototype)\n ScriptList.prototype.constructor = ScriptList\n\n /**\n * @exports opentype.FeatureList\n * @class\n * @param {opentype.Table}\n * @constructor\n * @extends opentype.Table\n */\n function FeatureList(featureListTable) {\n Table.call(\n this,\n 'featureListTable',\n recordList('featureRecord', featureListTable, function (featureRecord, i) {\n var feature = featureRecord.feature\n return [\n { name: 'featureTag' + i, type: 'TAG', value: featureRecord.tag },\n {\n name: 'feature' + i,\n type: 'TABLE',\n value: new Table(\n 'featureTable',\n [{ name: 'featureParams', type: 'USHORT', value: feature.featureParams }].concat(\n ushortList('lookupListIndex', feature.lookupListIndexes),\n ),\n ),\n },\n ]\n }),\n )\n }\n FeatureList.prototype = Object.create(Table.prototype)\n FeatureList.prototype.constructor = FeatureList\n\n /**\n * @exports opentype.LookupList\n * @class\n * @param {opentype.Table}\n * @param {Object}\n * @constructor\n * @extends opentype.Table\n */\n function LookupList(lookupListTable, subtableMakers) {\n Table.call(\n this,\n 'lookupListTable',\n tableList('lookup', lookupListTable, function (lookupTable) {\n var subtableCallback = subtableMakers[lookupTable.lookupType]\n check.assert(!!subtableCallback, 'Unable to write GSUB lookup type ' + lookupTable.lookupType + ' tables.')\n return new Table(\n 'lookupTable',\n [\n { name: 'lookupType', type: 'USHORT', value: lookupTable.lookupType },\n { name: 'lookupFlag', type: 'USHORT', value: lookupTable.lookupFlag },\n ].concat(tableList('subtable', lookupTable.subtables, subtableCallback)),\n )\n }),\n )\n }\n LookupList.prototype = Object.create(Table.prototype)\n LookupList.prototype.constructor = LookupList\n\n // Record = same as Table, but inlined (a Table has an offset and its data is further in the stream)\n // Don't use offsets inside Records (probable bug), only in Tables.\n var table = {\n Table: Table,\n Record: Table,\n Coverage: Coverage,\n ScriptList: ScriptList,\n FeatureList: FeatureList,\n LookupList: LookupList,\n ushortList: ushortList,\n tableList: tableList,\n recordList: recordList,\n }\n\n // Parsing utility functions\n\n // Retrieve an unsigned byte from the DataView.\n function getByte(dataView, offset) {\n return dataView.getUint8(offset)\n }\n\n // Retrieve an unsigned 16-bit short from the DataView.\n // The value is stored in big endian.\n function getUShort(dataView, offset) {\n return dataView.getUint16(offset, false)\n }\n\n // Retrieve a signed 16-bit short from the DataView.\n // The value is stored in big endian.\n function getShort(dataView, offset) {\n return dataView.getInt16(offset, false)\n }\n\n // Retrieve an unsigned 32-bit long from the DataView.\n // The value is stored in big endian.\n function getULong(dataView, offset) {\n return dataView.getUint32(offset, false)\n }\n\n // Retrieve a 32-bit signed fixed-point number (16.16) from the DataView.\n // The value is stored in big endian.\n function getFixed(dataView, offset) {\n var decimal = dataView.getInt16(offset, false)\n var fraction = dataView.getUint16(offset + 2, false)\n return decimal + fraction / 65535\n }\n\n // Retrieve a 4-character tag from the DataView.\n // Tags are used to identify tables.\n function getTag(dataView, offset) {\n var tag = ''\n for (var i = offset; i < offset + 4; i += 1) {\n tag += String.fromCharCode(dataView.getInt8(i))\n }\n\n return tag\n }\n\n // Retrieve an offset from the DataView.\n // Offsets are 1 to 4 bytes in length, depending on the offSize argument.\n function getOffset(dataView, offset, offSize) {\n var v = 0\n for (var i = 0; i < offSize; i += 1) {\n v <<= 8\n v += dataView.getUint8(offset + i)\n }\n\n return v\n }\n\n // Retrieve a number of bytes from start offset to the end offset from the DataView.\n function getBytes(dataView, startOffset, endOffset) {\n var bytes = []\n for (var i = startOffset; i < endOffset; i += 1) {\n bytes.push(dataView.getUint8(i))\n }\n\n return bytes\n }\n\n // Convert the list of bytes to a string.\n function bytesToString(bytes) {\n var s = ''\n for (var i = 0; i < bytes.length; i += 1) {\n s += String.fromCharCode(bytes[i])\n }\n\n return s\n }\n\n var typeOffsets = {\n byte: 1,\n uShort: 2,\n short: 2,\n uLong: 4,\n fixed: 4,\n longDateTime: 8,\n tag: 4,\n }\n\n // A stateful parser that changes the offset whenever a value is retrieved.\n // The data is a DataView.\n function Parser(data, offset) {\n this.data = data\n this.offset = offset\n this.relativeOffset = 0\n }\n\n Parser.prototype.parseByte = function () {\n var v = this.data.getUint8(this.offset + this.relativeOffset)\n this.relativeOffset += 1\n return v\n }\n\n Parser.prototype.parseChar = function () {\n var v = this.data.getInt8(this.offset + this.relativeOffset)\n this.relativeOffset += 1\n return v\n }\n\n Parser.prototype.parseCard8 = Parser.prototype.parseByte\n\n Parser.prototype.parseUShort = function () {\n var v = this.data.getUint16(this.offset + this.relativeOffset)\n this.relativeOffset += 2\n return v\n }\n\n Parser.prototype.parseCard16 = Parser.prototype.parseUShort\n Parser.prototype.parseSID = Parser.prototype.parseUShort\n Parser.prototype.parseOffset16 = Parser.prototype.parseUShort\n\n Parser.prototype.parseShort = function () {\n var v = this.data.getInt16(this.offset + this.relativeOffset)\n this.relativeOffset += 2\n return v\n }\n\n Parser.prototype.parseF2Dot14 = function () {\n var v = this.data.getInt16(this.offset + this.relativeOffset) / 16384\n this.relativeOffset += 2\n return v\n }\n\n Parser.prototype.parseULong = function () {\n var v = getULong(this.data, this.offset + this.relativeOffset)\n this.relativeOffset += 4\n return v\n }\n\n Parser.prototype.parseOffset32 = Parser.prototype.parseULong\n\n Parser.prototype.parseFixed = function () {\n var v = getFixed(this.data, this.offset + this.relativeOffset)\n this.relativeOffset += 4\n return v\n }\n\n Parser.prototype.parseString = function (length) {\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n var string = ''\n this.relativeOffset += length\n for (var i = 0; i < length; i++) {\n string += String.fromCharCode(dataView.getUint8(offset + i))\n }\n\n return string\n }\n\n Parser.prototype.parseTag = function () {\n return this.parseString(4)\n }\n\n // LONGDATETIME is a 64-bit integer.\n // JavaScript and unix timestamps traditionally use 32 bits, so we\n // only take the last 32 bits.\n // + Since until 2038 those bits will be filled by zeros we can ignore them.\n Parser.prototype.parseLongDateTime = function () {\n var v = getULong(this.data, this.offset + this.relativeOffset + 4)\n // Subtract seconds between 01/01/1904 and 01/01/1970\n // to convert Apple Mac timestamp to Standard Unix timestamp\n v -= 2082844800\n this.relativeOffset += 8\n return v\n }\n\n Parser.prototype.parseVersion = function (minorBase) {\n var major = getUShort(this.data, this.offset + this.relativeOffset)\n\n // How to interpret the minor version is very vague in the spec. 0x5000 is 5, 0x1000 is 1\n // Default returns the correct number if minor = 0xN000 where N is 0-9\n // Set minorBase to 1 for tables that use minor = N where N is 0-9\n var minor = getUShort(this.data, this.offset + this.relativeOffset + 2)\n this.relativeOffset += 4\n if (minorBase === undefined) {\n minorBase = 0x1000\n }\n return major + minor / minorBase / 10\n }\n\n Parser.prototype.skip = function (type, amount) {\n if (amount === undefined) {\n amount = 1\n }\n\n this.relativeOffset += typeOffsets[type] * amount\n }\n\n ///// Parsing lists and records ///////////////////////////////\n\n // Parse a list of 32 bit unsigned integers.\n Parser.prototype.parseULongList = function (count) {\n if (count === undefined) {\n count = this.parseULong()\n }\n var offsets = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n offsets[i] = dataView.getUint32(offset)\n offset += 4\n }\n\n this.relativeOffset += count * 4\n return offsets\n }\n\n // Parse a list of 16 bit unsigned integers. The length of the list can be read on the stream\n // or provided as an argument.\n Parser.prototype.parseOffset16List = Parser.prototype.parseUShortList = function (count) {\n if (count === undefined) {\n count = this.parseUShort()\n }\n var offsets = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n offsets[i] = dataView.getUint16(offset)\n offset += 2\n }\n\n this.relativeOffset += count * 2\n return offsets\n }\n\n // Parses a list of 16 bit signed integers.\n Parser.prototype.parseShortList = function (count) {\n var list = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n list[i] = dataView.getInt16(offset)\n offset += 2\n }\n\n this.relativeOffset += count * 2\n return list\n }\n\n // Parses a list of bytes.\n Parser.prototype.parseByteList = function (count) {\n var list = new Array(count)\n var dataView = this.data\n var offset = this.offset + this.relativeOffset\n for (var i = 0; i < count; i++) {\n list[i] = dataView.getUint8(offset++)\n }\n\n this.relativeOffset += count\n return list\n }\n\n /**\n * Parse a list of items.\n * Record count is optional, if omitted it is read from the stream.\n * itemCallback is one of the Parser methods.\n */\n Parser.prototype.parseList = function (count, itemCallback) {\n if (!itemCallback) {\n itemCallback = count\n count = this.parseUShort()\n }\n var list = new Array(count)\n for (var i = 0; i < count; i++) {\n list[i] = itemCallback.call(this)\n }\n return list\n }\n\n Parser.prototype.parseList32 = function (count, itemCallback) {\n if (!itemCallback) {\n itemCallback = count\n count = this.parseULong()\n }\n var list = new Array(count)\n for (var i = 0; i < count; i++) {\n list[i] = itemCallback.call(this)\n }\n return list\n }\n\n /**\n * Parse a list of records.\n * Record count is optional, if omitted it is read from the stream.\n * Example of recordDescription: { sequenceIndex: Parser.uShort, lookupListIndex: Parser.uShort }\n */\n Parser.prototype.parseRecordList = function (count, recordDescription) {\n // If the count argument is absent, read it in the stream.\n if (!recordDescription) {\n recordDescription = count\n count = this.parseUShort()\n }\n var records = new Array(count)\n var fields = Object.keys(recordDescription)\n for (var i = 0; i < count; i++) {\n var rec = {}\n for (var j = 0; j < fields.length; j++) {\n var fieldName = fields[j]\n var fieldType = recordDescription[fieldName]\n rec[fieldName] = fieldType.call(this)\n }\n records[i] = rec\n }\n return records\n }\n\n Parser.prototype.parseRecordList32 = function (count, recordDescription) {\n // If the count argument is absent, read it in the stream.\n if (!recordDescription) {\n recordDescription = count\n count = this.parseULong()\n }\n var records = new Array(count)\n var fields = Object.keys(recordDescription)\n for (var i = 0; i < count; i++) {\n var rec = {}\n for (var j = 0; j < fields.length; j++) {\n var fieldName = fields[j]\n var fieldType = recordDescription[fieldName]\n rec[fieldName] = fieldType.call(this)\n }\n records[i] = rec\n }\n return records\n }\n\n // Parse a data structure into an object\n // Example of description: { sequenceIndex: Parser.uShort, lookupListIndex: Parser.uShort }\n Parser.prototype.parseStruct = function (description) {\n if (typeof description === 'function') {\n return description.call(this)\n } else {\n var fields = Object.keys(description)\n var struct = {}\n for (var j = 0; j < fields.length; j++) {\n var fieldName = fields[j]\n var fieldType = description[fieldName]\n struct[fieldName] = fieldType.call(this)\n }\n return struct\n }\n }\n\n /**\n * Parse a GPOS valueRecord\n * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#value-record\n * valueFormat is optional, if omitted it is read from the stream.\n */\n Parser.prototype.parseValueRecord = function (valueFormat) {\n if (valueFormat === undefined) {\n valueFormat = this.parseUShort()\n }\n if (valueFormat === 0) {\n // valueFormat2 in kerning pairs is most often 0\n // in this case return undefined instead of an empty object, to save space\n return\n }\n var valueRecord = {}\n\n if (valueFormat & 0x0001) {\n valueRecord.xPlacement = this.parseShort()\n }\n if (valueFormat & 0x0002) {\n valueRecord.yPlacement = this.parseShort()\n }\n if (valueFormat & 0x0004) {\n valueRecord.xAdvance = this.parseShort()\n }\n if (valueFormat & 0x0008) {\n valueRecord.yAdvance = this.parseShort()\n }\n\n // Device table (non-variable font) / VariationIndex table (variable font) not supported\n // https://docs.microsoft.com/fr-fr/typography/opentype/spec/chapter2#devVarIdxTbls\n if (valueFormat & 0x0010) {\n valueRecord.xPlaDevice = undefined\n this.parseShort()\n }\n if (valueFormat & 0x0020) {\n valueRecord.yPlaDevice = undefined\n this.parseShort()\n }\n if (valueFormat & 0x0040) {\n valueRecord.xAdvDevice = undefined\n this.parseShort()\n }\n if (valueFormat & 0x0080) {\n valueRecord.yAdvDevice = undefined\n this.parseShort()\n }\n\n return valueRecord\n }\n\n /**\n * Parse a list of GPOS valueRecords\n * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#value-record\n * valueFormat and valueCount are read from the stream.\n */\n Parser.prototype.parseValueRecordList = function () {\n var valueFormat = this.parseUShort()\n var valueCount = this.parseUShort()\n var values = new Array(valueCount)\n for (var i = 0; i < valueCount; i++) {\n values[i] = this.parseValueRecord(valueFormat)\n }\n return values\n }\n\n Parser.prototype.parsePointer = function (description) {\n var structOffset = this.parseOffset16()\n if (structOffset > 0) {\n // NULL offset => return undefined\n return new Parser(this.data, this.offset + structOffset).parseStruct(description)\n }\n return undefined\n }\n\n Parser.prototype.parsePointer32 = function (description) {\n var structOffset = this.parseOffset32()\n if (structOffset > 0) {\n // NULL offset => return undefined\n return new Parser(this.data, this.offset + structOffset).parseStruct(description)\n }\n return undefined\n }\n\n /**\n * Parse a list of offsets to lists of 16-bit integers,\n * or a list of offsets to lists of offsets to any kind of items.\n * If itemCallback is not provided, a list of list of UShort is assumed.\n * If provided, itemCallback is called on each item and must parse the item.\n * See examples in tables/gsub.js\n */\n Parser.prototype.parseListOfLists = function (itemCallback) {\n var offsets = this.parseOffset16List()\n var count = offsets.length\n var relativeOffset = this.relativeOffset\n var list = new Array(count)\n for (var i = 0; i < count; i++) {\n var start = offsets[i]\n if (start === 0) {\n // NULL offset\n // Add i as owned property to list. Convenient with assert.\n list[i] = undefined\n continue\n }\n this.relativeOffset = start\n if (itemCallback) {\n var subOffsets = this.parseOffset16List()\n var subList = new Array(subOffsets.length)\n for (var j = 0; j < subOffsets.length; j++) {\n this.relativeOffset = start + subOffsets[j]\n subList[j] = itemCallback.call(this)\n }\n list[i] = subList\n } else {\n list[i] = this.parseUShortList()\n }\n }\n this.relativeOffset = relativeOffset\n return list\n }\n\n ///// Complex tables parsing //////////////////////////////////\n\n // Parse a coverage table in a GSUB, GPOS or GDEF table.\n // https://www.microsoft.com/typography/OTSPEC/chapter2.htm\n // parser.offset must point to the start of the table containing the coverage.\n Parser.prototype.parseCoverage = function () {\n var startOffset = this.offset + this.relativeOffset\n var format = this.parseUShort()\n var count = this.parseUShort()\n if (format === 1) {\n return {\n format: 1,\n glyphs: this.parseUShortList(count),\n }\n } else if (format === 2) {\n var ranges = new Array(count)\n for (var i = 0; i < count; i++) {\n ranges[i] = {\n start: this.parseUShort(),\n end: this.parseUShort(),\n index: this.parseUShort(),\n }\n }\n return {\n format: 2,\n ranges: ranges,\n }\n }\n throw new Error('0x' + startOffset.toString(16) + ': Coverage format must be 1 or 2.')\n }\n\n // Parse a Class Definition Table in a GSUB, GPOS or GDEF table.\n // https://www.microsoft.com/typography/OTSPEC/chapter2.htm\n Parser.prototype.parseClassDef = function () {\n var startOffset = this.offset + this.relativeOffset\n var format = this.parseUShort()\n if (format === 1) {\n return {\n format: 1,\n startGlyph: this.parseUShort(),\n classes: this.parseUShortList(),\n }\n } else if (format === 2) {\n return {\n format: 2,\n ranges: this.parseRecordList({\n start: Parser.uShort,\n end: Parser.uShort,\n classId: Parser.uShort,\n }),\n }\n }\n throw new Error('0x' + startOffset.toString(16) + ': ClassDef format must be 1 or 2.')\n }\n\n ///// Static methods ///////////////////////////////////\n // These convenience methods can be used as callbacks and should be called with \"this\" context set to a Parser instance.\n\n Parser.list = function (count, itemCallback) {\n return function () {\n return this.parseList(count, itemCallback)\n }\n }\n\n Parser.list32 = function (count, itemCallback) {\n return function () {\n return this.parseList32(count, itemCallback)\n }\n }\n\n Parser.recordList = function (count, recordDescription) {\n return function () {\n return this.parseRecordList(count, recordDescription)\n }\n }\n\n Parser.recordList32 = function (count, recordDescription) {\n return function () {\n return this.parseRecordList32(count, recordDescription)\n }\n }\n\n Parser.pointer = function (description) {\n return function () {\n return this.parsePointer(description)\n }\n }\n\n Parser.pointer32 = function (description) {\n return function () {\n return this.parsePointer32(description)\n }\n }\n\n Parser.tag = Parser.prototype.parseTag\n Parser.byte = Parser.prototype.parseByte\n Parser.uShort = Parser.offset16 = Parser.prototype.parseUShort\n Parser.uShortList = Parser.prototype.parseUShortList\n Parser.uLong = Parser.offset32 = Parser.prototype.parseULong\n Parser.uLongList = Parser.prototype.parseULongList\n Parser.struct = Parser.prototype.parseStruct\n Parser.coverage = Parser.prototype.parseCoverage\n Parser.classDef = Parser.prototype.parseClassDef\n\n ///// Script, Feature, Lookup lists ///////////////////////////////////////////////\n // https://www.microsoft.com/typography/OTSPEC/chapter2.htm\n\n var langSysTable = {\n reserved: Parser.uShort,\n reqFeatureIndex: Parser.uShort,\n featureIndexes: Parser.uShortList,\n }\n\n Parser.prototype.parseScriptList = function () {\n return (\n this.parsePointer(\n Parser.recordList({\n tag: Parser.tag,\n script: Parser.pointer({\n defaultLangSys: Parser.pointer(langSysTable),\n langSysRecords: Parser.recordList({\n tag: Parser.tag,\n langSys: Parser.pointer(langSysTable),\n }),\n }),\n }),\n ) || []\n )\n }\n\n Parser.prototype.parseFeatureList = function () {\n return (\n this.parsePointer(\n Parser.recordList({\n tag: Parser.tag,\n feature: Parser.pointer({\n featureParams: Parser.offset16,\n lookupListIndexes: Parser.uShortList,\n }),\n }),\n ) || []\n )\n }\n\n Parser.prototype.parseLookupList = function (lookupTableParsers) {\n return (\n this.parsePointer(\n Parser.list(\n Parser.pointer(function () {\n var lookupType = this.parseUShort()\n check.argument(1 <= lookupType && lookupType <= 9, 'GPOS/GSUB lookup type ' + lookupType + ' unknown.')\n var lookupFlag = this.parseUShort()\n var useMarkFilteringSet = lookupFlag & 0x10\n return {\n lookupType: lookupType,\n lookupFlag: lookupFlag,\n subtables: this.parseList(Parser.pointer(lookupTableParsers[lookupType])),\n markFilteringSet: useMarkFilteringSet ? this.parseUShort() : undefined,\n }\n }),\n ),\n ) || []\n )\n }\n\n Parser.prototype.parseFeatureVariationsList = function () {\n return (\n this.parsePointer32(function () {\n var majorVersion = this.parseUShort()\n var minorVersion = this.parseUShort()\n check.argument(majorVersion === 1 && minorVersion < 1, 'GPOS/GSUB feature variations table unknown.')\n var featureVariations = this.parseRecordList32({\n conditionSetOffset: Parser.offset32,\n featureTableSubstitutionOffset: Parser.offset32,\n })\n return featureVariations\n }) || []\n )\n }\n\n var parse = {\n getByte: getByte,\n getCard8: getByte,\n getUShort: getUShort,\n getCard16: getUShort,\n getShort: getShort,\n getULong: getULong,\n getFixed: getFixed,\n getTag: getTag,\n getOffset: getOffset,\n getBytes: getBytes,\n bytesToString: bytesToString,\n Parser: Parser,\n }\n\n // The `cmap` table stores the mappings from characters to glyphs.\n\n function parseCmapTableFormat12(cmap, p) {\n //Skip reserved.\n p.parseUShort()\n\n // Length in bytes of the sub-tables.\n cmap.length = p.parseULong()\n cmap.language = p.parseULong()\n\n var groupCount\n cmap.groupCount = groupCount = p.parseULong()\n cmap.glyphIndexMap = {}\n\n for (var i = 0; i < groupCount; i += 1) {\n var startCharCode = p.parseULong()\n var endCharCode = p.parseULong()\n var startGlyphId = p.parseULong()\n\n for (var c = startCharCode; c <= endCharCode; c += 1) {\n cmap.glyphIndexMap[c] = startGlyphId\n startGlyphId++\n }\n }\n }\n\n function parseCmapTableFormat4(cmap, p, data, start, offset) {\n // Length in bytes of the sub-tables.\n cmap.length = p.parseUShort()\n cmap.language = p.parseUShort()\n\n // segCount is stored x 2.\n var segCount\n cmap.segCount = segCount = p.parseUShort() >> 1\n\n // Skip searchRange, entrySelector, rangeShift.\n p.skip('uShort', 3)\n\n // The \"unrolled\" mapping from character codes to glyph indices.\n cmap.glyphIndexMap = {}\n var endCountParser = new parse.Parser(data, start + offset + 14)\n var startCountParser = new parse.Parser(data, start + offset + 16 + segCount * 2)\n var idDeltaParser = new parse.Parser(data, start + offset + 16 + segCount * 4)\n var idRangeOffsetParser = new parse.Parser(data, start + offset + 16 + segCount * 6)\n var glyphIndexOffset = start + offset + 16 + segCount * 8\n for (var i = 0; i < segCount - 1; i += 1) {\n var glyphIndex = void 0\n var endCount = endCountParser.parseUShort()\n var startCount = startCountParser.parseUShort()\n var idDelta = idDeltaParser.parseShort()\n var idRangeOffset = idRangeOffsetParser.parseUShort()\n for (var c = startCount; c <= endCount; c += 1) {\n if (idRangeOffset !== 0) {\n // The idRangeOffset is relative to the current position in the idRangeOffset array.\n // Take the current offset in the idRangeOffset array.\n glyphIndexOffset = idRangeOffsetParser.offset + idRangeOffsetParser.relativeOffset - 2\n\n // Add the value of the idRangeOffset, which will move us into the glyphIndex array.\n glyphIndexOffset += idRangeOffset\n\n // Then add the character index of the current segment, multiplied by 2 for USHORTs.\n glyphIndexOffset += (c - startCount) * 2\n glyphIndex = parse.getUShort(data, glyphIndexOffset)\n if (glyphIndex !== 0) {\n glyphIndex = (glyphIndex + idDelta) & 0xffff\n }\n } else {\n glyphIndex = (c + idDelta) & 0xffff\n }\n\n cmap.glyphIndexMap[c] = glyphIndex\n }\n }\n }\n\n // Parse the `cmap` table. This table stores the mappings from characters to glyphs.\n // There are many available formats, but we only support the Windows format 4 and 12.\n // This function returns a `CmapEncoding` object or null if no supported format could be found.\n function parseCmapTable(data, start) {\n var cmap = {}\n cmap.version = parse.getUShort(data, start)\n check.argument(cmap.version === 0, 'cmap table version should be 0.')\n\n // The cmap table can contain many sub-tables, each with their own format.\n // We're only interested in a \"platform 0\" (Unicode format) and \"platform 3\" (Windows format) table.\n cmap.numTables = parse.getUShort(data, start + 2)\n var offset = -1\n for (var i = cmap.numTables - 1; i >= 0; i -= 1) {\n var platformId = parse.getUShort(data, start + 4 + i * 8)\n var encodingId = parse.getUShort(data, start + 4 + i * 8 + 2)\n if (\n (platformId === 3 && (encodingId === 0 || encodingId === 1 || encodingId === 10)) ||\n (platformId === 0 &&\n (encodingId === 0 || encodingId === 1 || encodingId === 2 || encodingId === 3 || encodingId === 4))\n ) {\n offset = parse.getULong(data, start + 4 + i * 8 + 4)\n break\n }\n }\n\n if (offset === -1) {\n // There is no cmap table in the font that we support.\n throw new Error('No valid cmap sub-tables found.')\n }\n\n var p = new parse.Parser(data, start + offset)\n cmap.format = p.parseUShort()\n\n if (cmap.format === 12) {\n parseCmapTableFormat12(cmap, p)\n } else if (cmap.format === 4) {\n parseCmapTableFormat4(cmap, p, data, start, offset)\n } else {\n throw new Error('Only format 4 and 12 cmap tables are supported (found format ' + cmap.format + ').')\n }\n\n return cmap\n }\n\n function addSegment(t, code, glyphIndex) {\n t.segments.push({\n end: code,\n start: code,\n delta: -(code - glyphIndex),\n offset: 0,\n glyphIndex: glyphIndex,\n })\n }\n\n function addTerminatorSegment(t) {\n t.segments.push({\n end: 0xffff,\n start: 0xffff,\n delta: 1,\n offset: 0,\n })\n }\n\n // Make cmap table, format 4 by default, 12 if needed only\n function makeCmapTable(glyphs) {\n // Plan 0 is the base Unicode Plan but emojis, for example are on another plan, and needs cmap 12 format (with 32bit)\n var isPlan0Only = true\n var i\n\n // Check if we need to add cmap format 12 or if format 4 only is fine\n for (i = glyphs.length - 1; i > 0; i -= 1) {\n var g = glyphs.get(i)\n if (g.unicode > 65535) {\n console.log('Adding CMAP format 12 (needed!)')\n isPlan0Only = false\n break\n }\n }\n\n var cmapTable = [\n { name: 'version', type: 'USHORT', value: 0 },\n { name: 'numTables', type: 'USHORT', value: isPlan0Only ? 1 : 2 },\n\n // CMAP 4 header\n { name: 'platformID', type: 'USHORT', value: 3 },\n { name: 'encodingID', type: 'USHORT', value: 1 },\n { name: 'offset', type: 'ULONG', value: isPlan0Only ? 12 : 12 + 8 },\n ]\n\n if (!isPlan0Only) {\n cmapTable = cmapTable.concat([\n // CMAP 12 header\n { name: 'cmap12PlatformID', type: 'USHORT', value: 3 }, // We encode only for PlatformID = 3 (Windows) because it is supported everywhere\n { name: 'cmap12EncodingID', type: 'USHORT', value: 10 },\n { name: 'cmap12Offset', type: 'ULONG', value: 0 },\n ])\n }\n\n cmapTable = cmapTable.concat([\n // CMAP 4 Subtable\n { name: 'format', type: 'USHORT', value: 4 },\n { name: 'cmap4Length', type: 'USHORT', value: 0 },\n { name: 'language', type: 'USHORT', value: 0 },\n { name: 'segCountX2', type: 'USHORT', value: 0 },\n { name: 'searchRange', type: 'USHORT', value: 0 },\n { name: 'entrySelector', type: 'USHORT', value: 0 },\n { name: 'rangeShift', type: 'USHORT', value: 0 },\n ])\n\n var t = new table.Table('cmap', cmapTable)\n\n t.segments = []\n for (i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n for (var j = 0; j < glyph.unicodes.length; j += 1) {\n addSegment(t, glyph.unicodes[j], i)\n }\n\n t.segments = t.segments.sort(function (a, b) {\n return a.start - b.start\n })\n }\n\n addTerminatorSegment(t)\n\n var segCount = t.segments.length\n var segCountToRemove = 0\n\n // CMAP 4\n // Set up parallel segment arrays.\n var endCounts = []\n var startCounts = []\n var idDeltas = []\n var idRangeOffsets = []\n var glyphIds = []\n\n // CMAP 12\n var cmap12Groups = []\n\n // Reminder this loop is not following the specification at 100%\n // The specification -> find suites of characters and make a group\n // Here we're doing one group for each letter\n // Doing as the spec can save 8 times (or more) space\n for (i = 0; i < segCount; i += 1) {\n var segment = t.segments[i]\n\n // CMAP 4\n if (segment.end <= 65535 && segment.start <= 65535) {\n endCounts = endCounts.concat({ name: 'end_' + i, type: 'USHORT', value: segment.end })\n startCounts = startCounts.concat({ name: 'start_' + i, type: 'USHORT', value: segment.start })\n idDeltas = idDeltas.concat({ name: 'idDelta_' + i, type: 'SHORT', value: segment.delta })\n idRangeOffsets = idRangeOffsets.concat({ name: 'idRangeOffset_' + i, type: 'USHORT', value: segment.offset })\n if (segment.glyphId !== undefined) {\n glyphIds = glyphIds.concat({ name: 'glyph_' + i, type: 'USHORT', value: segment.glyphId })\n }\n } else {\n // Skip Unicode > 65535 (16bit unsigned max) for CMAP 4, will be added in CMAP 12\n segCountToRemove += 1\n }\n\n // CMAP 12\n // Skip Terminator Segment\n if (!isPlan0Only && segment.glyphIndex !== undefined) {\n cmap12Groups = cmap12Groups.concat({ name: 'cmap12Start_' + i, type: 'ULONG', value: segment.start })\n cmap12Groups = cmap12Groups.concat({ name: 'cmap12End_' + i, type: 'ULONG', value: segment.end })\n cmap12Groups = cmap12Groups.concat({ name: 'cmap12Glyph_' + i, type: 'ULONG', value: segment.glyphIndex })\n }\n }\n\n // CMAP 4 Subtable\n t.segCountX2 = (segCount - segCountToRemove) * 2\n t.searchRange = Math.pow(2, Math.floor(Math.log(segCount - segCountToRemove) / Math.log(2))) * 2\n t.entrySelector = Math.log(t.searchRange / 2) / Math.log(2)\n t.rangeShift = t.segCountX2 - t.searchRange\n\n t.fields = t.fields.concat(endCounts)\n t.fields.push({ name: 'reservedPad', type: 'USHORT', value: 0 })\n t.fields = t.fields.concat(startCounts)\n t.fields = t.fields.concat(idDeltas)\n t.fields = t.fields.concat(idRangeOffsets)\n t.fields = t.fields.concat(glyphIds)\n\n t.cmap4Length =\n 14 + // Subtable header\n endCounts.length * 2 +\n 2 + // reservedPad\n startCounts.length * 2 +\n idDeltas.length * 2 +\n idRangeOffsets.length * 2 +\n glyphIds.length * 2\n\n if (!isPlan0Only) {\n // CMAP 12 Subtable\n var cmap12Length =\n 16 + // Subtable header\n cmap12Groups.length * 4\n\n t.cmap12Offset = 12 + 2 * 2 + 4 + t.cmap4Length\n t.fields = t.fields.concat([\n { name: 'cmap12Format', type: 'USHORT', value: 12 },\n { name: 'cmap12Reserved', type: 'USHORT', value: 0 },\n { name: 'cmap12Length', type: 'ULONG', value: cmap12Length },\n { name: 'cmap12Language', type: 'ULONG', value: 0 },\n { name: 'cmap12nGroups', type: 'ULONG', value: cmap12Groups.length / 3 },\n ])\n\n t.fields = t.fields.concat(cmap12Groups)\n }\n\n return t\n }\n\n var cmap = { parse: parseCmapTable, make: makeCmapTable }\n\n // Glyph encoding\n\n var cffStandardStrings = [\n '.notdef',\n 'space',\n 'exclam',\n 'quotedbl',\n 'numbersign',\n 'dollar',\n 'percent',\n 'ampersand',\n 'quoteright',\n 'parenleft',\n 'parenright',\n 'asterisk',\n 'plus',\n 'comma',\n 'hyphen',\n 'period',\n 'slash',\n 'zero',\n 'one',\n 'two',\n 'three',\n 'four',\n 'five',\n 'six',\n 'seven',\n 'eight',\n 'nine',\n 'colon',\n 'semicolon',\n 'less',\n 'equal',\n 'greater',\n 'question',\n 'at',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'R',\n 'S',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'bracketleft',\n 'backslash',\n 'bracketright',\n 'asciicircum',\n 'underscore',\n 'quoteleft',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n 'braceleft',\n 'bar',\n 'braceright',\n 'asciitilde',\n 'exclamdown',\n 'cent',\n 'sterling',\n 'fraction',\n 'yen',\n 'florin',\n 'section',\n 'currency',\n 'quotesingle',\n 'quotedblleft',\n 'guillemotleft',\n 'guilsinglleft',\n 'guilsinglright',\n 'fi',\n 'fl',\n 'endash',\n 'dagger',\n 'daggerdbl',\n 'periodcentered',\n 'paragraph',\n 'bullet',\n 'quotesinglbase',\n 'quotedblbase',\n 'quotedblright',\n 'guillemotright',\n 'ellipsis',\n 'perthousand',\n 'questiondown',\n 'grave',\n 'acute',\n 'circumflex',\n 'tilde',\n 'macron',\n 'breve',\n 'dotaccent',\n 'dieresis',\n 'ring',\n 'cedilla',\n 'hungarumlaut',\n 'ogonek',\n 'caron',\n 'emdash',\n 'AE',\n 'ordfeminine',\n 'Lslash',\n 'Oslash',\n 'OE',\n 'ordmasculine',\n 'ae',\n 'dotlessi',\n 'lslash',\n 'oslash',\n 'oe',\n 'germandbls',\n 'onesuperior',\n 'logicalnot',\n 'mu',\n 'trademark',\n 'Eth',\n 'onehalf',\n 'plusminus',\n 'Thorn',\n 'onequarter',\n 'divide',\n 'brokenbar',\n 'degree',\n 'thorn',\n 'threequarters',\n 'twosuperior',\n 'registered',\n 'minus',\n 'eth',\n 'multiply',\n 'threesuperior',\n 'copyright',\n 'Aacute',\n 'Acircumflex',\n 'Adieresis',\n 'Agrave',\n 'Aring',\n 'Atilde',\n 'Ccedilla',\n 'Eacute',\n 'Ecircumflex',\n 'Edieresis',\n 'Egrave',\n 'Iacute',\n 'Icircumflex',\n 'Idieresis',\n 'Igrave',\n 'Ntilde',\n 'Oacute',\n 'Ocircumflex',\n 'Odieresis',\n 'Ograve',\n 'Otilde',\n 'Scaron',\n 'Uacute',\n 'Ucircumflex',\n 'Udieresis',\n 'Ugrave',\n 'Yacute',\n 'Ydieresis',\n 'Zcaron',\n 'aacute',\n 'acircumflex',\n 'adieresis',\n 'agrave',\n 'aring',\n 'atilde',\n 'ccedilla',\n 'eacute',\n 'ecircumflex',\n 'edieresis',\n 'egrave',\n 'iacute',\n 'icircumflex',\n 'idieresis',\n 'igrave',\n 'ntilde',\n 'oacute',\n 'ocircumflex',\n 'odieresis',\n 'ograve',\n 'otilde',\n 'scaron',\n 'uacute',\n 'ucircumflex',\n 'udieresis',\n 'ugrave',\n 'yacute',\n 'ydieresis',\n 'zcaron',\n 'exclamsmall',\n 'Hungarumlautsmall',\n 'dollaroldstyle',\n 'dollarsuperior',\n 'ampersandsmall',\n 'Acutesmall',\n 'parenleftsuperior',\n 'parenrightsuperior',\n '266 ff',\n 'onedotenleader',\n 'zerooldstyle',\n 'oneoldstyle',\n 'twooldstyle',\n 'threeoldstyle',\n 'fouroldstyle',\n 'fiveoldstyle',\n 'sixoldstyle',\n 'sevenoldstyle',\n 'eightoldstyle',\n 'nineoldstyle',\n 'commasuperior',\n 'threequartersemdash',\n 'periodsuperior',\n 'questionsmall',\n 'asuperior',\n 'bsuperior',\n 'centsuperior',\n 'dsuperior',\n 'esuperior',\n 'isuperior',\n 'lsuperior',\n 'msuperior',\n 'nsuperior',\n 'osuperior',\n 'rsuperior',\n 'ssuperior',\n 'tsuperior',\n 'ff',\n 'ffi',\n 'ffl',\n 'parenleftinferior',\n 'parenrightinferior',\n 'Circumflexsmall',\n 'hyphensuperior',\n 'Gravesmall',\n 'Asmall',\n 'Bsmall',\n 'Csmall',\n 'Dsmall',\n 'Esmall',\n 'Fsmall',\n 'Gsmall',\n 'Hsmall',\n 'Ismall',\n 'Jsmall',\n 'Ksmall',\n 'Lsmall',\n 'Msmall',\n 'Nsmall',\n 'Osmall',\n 'Psmall',\n 'Qsmall',\n 'Rsmall',\n 'Ssmall',\n 'Tsmall',\n 'Usmall',\n 'Vsmall',\n 'Wsmall',\n 'Xsmall',\n 'Ysmall',\n 'Zsmall',\n 'colonmonetary',\n 'onefitted',\n 'rupiah',\n 'Tildesmall',\n 'exclamdownsmall',\n 'centoldstyle',\n 'Lslashsmall',\n 'Scaronsmall',\n 'Zcaronsmall',\n 'Dieresissmall',\n 'Brevesmall',\n 'Caronsmall',\n 'Dotaccentsmall',\n 'Macronsmall',\n 'figuredash',\n 'hypheninferior',\n 'Ogoneksmall',\n 'Ringsmall',\n 'Cedillasmall',\n 'questiondownsmall',\n 'oneeighth',\n 'threeeighths',\n 'fiveeighths',\n 'seveneighths',\n 'onethird',\n 'twothirds',\n 'zerosuperior',\n 'foursuperior',\n 'fivesuperior',\n 'sixsuperior',\n 'sevensuperior',\n 'eightsuperior',\n 'ninesuperior',\n 'zeroinferior',\n 'oneinferior',\n 'twoinferior',\n 'threeinferior',\n 'fourinferior',\n 'fiveinferior',\n 'sixinferior',\n 'seveninferior',\n 'eightinferior',\n 'nineinferior',\n 'centinferior',\n 'dollarinferior',\n 'periodinferior',\n 'commainferior',\n 'Agravesmall',\n 'Aacutesmall',\n 'Acircumflexsmall',\n 'Atildesmall',\n 'Adieresissmall',\n 'Aringsmall',\n 'AEsmall',\n 'Ccedillasmall',\n 'Egravesmall',\n 'Eacutesmall',\n 'Ecircumflexsmall',\n 'Edieresissmall',\n 'Igravesmall',\n 'Iacutesmall',\n 'Icircumflexsmall',\n 'Idieresissmall',\n 'Ethsmall',\n 'Ntildesmall',\n 'Ogravesmall',\n 'Oacutesmall',\n 'Ocircumflexsmall',\n 'Otildesmall',\n 'Odieresissmall',\n 'OEsmall',\n 'Oslashsmall',\n 'Ugravesmall',\n 'Uacutesmall',\n 'Ucircumflexsmall',\n 'Udieresissmall',\n 'Yacutesmall',\n 'Thornsmall',\n 'Ydieresissmall',\n '001.000',\n '001.001',\n '001.002',\n '001.003',\n 'Black',\n 'Bold',\n 'Book',\n 'Light',\n 'Medium',\n 'Regular',\n 'Roman',\n 'Semibold',\n ]\n\n var cffStandardEncoding = [\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'space',\n 'exclam',\n 'quotedbl',\n 'numbersign',\n 'dollar',\n 'percent',\n 'ampersand',\n 'quoteright',\n 'parenleft',\n 'parenright',\n 'asterisk',\n 'plus',\n 'comma',\n 'hyphen',\n 'period',\n 'slash',\n 'zero',\n 'one',\n 'two',\n 'three',\n 'four',\n 'five',\n 'six',\n 'seven',\n 'eight',\n 'nine',\n 'colon',\n 'semicolon',\n 'less',\n 'equal',\n 'greater',\n 'question',\n 'at',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'R',\n 'S',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'bracketleft',\n 'backslash',\n 'bracketright',\n 'asciicircum',\n 'underscore',\n 'quoteleft',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n 'braceleft',\n 'bar',\n 'braceright',\n 'asciitilde',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'exclamdown',\n 'cent',\n 'sterling',\n 'fraction',\n 'yen',\n 'florin',\n 'section',\n 'currency',\n 'quotesingle',\n 'quotedblleft',\n 'guillemotleft',\n 'guilsinglleft',\n 'guilsinglright',\n 'fi',\n 'fl',\n '',\n 'endash',\n 'dagger',\n 'daggerdbl',\n 'periodcentered',\n '',\n 'paragraph',\n 'bullet',\n 'quotesinglbase',\n 'quotedblbase',\n 'quotedblright',\n 'guillemotright',\n 'ellipsis',\n 'perthousand',\n '',\n 'questiondown',\n '',\n 'grave',\n 'acute',\n 'circumflex',\n 'tilde',\n 'macron',\n 'breve',\n 'dotaccent',\n 'dieresis',\n '',\n 'ring',\n 'cedilla',\n '',\n 'hungarumlaut',\n 'ogonek',\n 'caron',\n 'emdash',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'AE',\n '',\n 'ordfeminine',\n '',\n '',\n '',\n '',\n 'Lslash',\n 'Oslash',\n 'OE',\n 'ordmasculine',\n '',\n '',\n '',\n '',\n '',\n 'ae',\n '',\n '',\n '',\n 'dotlessi',\n '',\n '',\n 'lslash',\n 'oslash',\n 'oe',\n 'germandbls',\n ]\n\n var cffExpertEncoding = [\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'space',\n 'exclamsmall',\n 'Hungarumlautsmall',\n '',\n 'dollaroldstyle',\n 'dollarsuperior',\n 'ampersandsmall',\n 'Acutesmall',\n 'parenleftsuperior',\n 'parenrightsuperior',\n 'twodotenleader',\n 'onedotenleader',\n 'comma',\n 'hyphen',\n 'period',\n 'fraction',\n 'zerooldstyle',\n 'oneoldstyle',\n 'twooldstyle',\n 'threeoldstyle',\n 'fouroldstyle',\n 'fiveoldstyle',\n 'sixoldstyle',\n 'sevenoldstyle',\n 'eightoldstyle',\n 'nineoldstyle',\n 'colon',\n 'semicolon',\n 'commasuperior',\n 'threequartersemdash',\n 'periodsuperior',\n 'questionsmall',\n '',\n 'asuperior',\n 'bsuperior',\n 'centsuperior',\n 'dsuperior',\n 'esuperior',\n '',\n '',\n 'isuperior',\n '',\n '',\n 'lsuperior',\n 'msuperior',\n 'nsuperior',\n 'osuperior',\n '',\n '',\n 'rsuperior',\n 'ssuperior',\n 'tsuperior',\n '',\n 'ff',\n 'fi',\n 'fl',\n 'ffi',\n 'ffl',\n 'parenleftinferior',\n '',\n 'parenrightinferior',\n 'Circumflexsmall',\n 'hyphensuperior',\n 'Gravesmall',\n 'Asmall',\n 'Bsmall',\n 'Csmall',\n 'Dsmall',\n 'Esmall',\n 'Fsmall',\n 'Gsmall',\n 'Hsmall',\n 'Ismall',\n 'Jsmall',\n 'Ksmall',\n 'Lsmall',\n 'Msmall',\n 'Nsmall',\n 'Osmall',\n 'Psmall',\n 'Qsmall',\n 'Rsmall',\n 'Ssmall',\n 'Tsmall',\n 'Usmall',\n 'Vsmall',\n 'Wsmall',\n 'Xsmall',\n 'Ysmall',\n 'Zsmall',\n 'colonmonetary',\n 'onefitted',\n 'rupiah',\n 'Tildesmall',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n 'exclamdownsmall',\n 'centoldstyle',\n 'Lslashsmall',\n '',\n '',\n 'Scaronsmall',\n 'Zcaronsmall',\n 'Dieresissmall',\n 'Brevesmall',\n 'Caronsmall',\n '',\n 'Dotaccentsmall',\n '',\n '',\n 'Macronsmall',\n '',\n '',\n 'figuredash',\n 'hypheninferior',\n '',\n '',\n 'Ogoneksmall',\n 'Ringsmall',\n 'Cedillasmall',\n '',\n '',\n '',\n 'onequarter',\n 'onehalf',\n 'threequarters',\n 'questiondownsmall',\n 'oneeighth',\n 'threeeighths',\n 'fiveeighths',\n 'seveneighths',\n 'onethird',\n 'twothirds',\n '',\n '',\n 'zerosuperior',\n 'onesuperior',\n 'twosuperior',\n 'threesuperior',\n 'foursuperior',\n 'fivesuperior',\n 'sixsuperior',\n 'sevensuperior',\n 'eightsuperior',\n 'ninesuperior',\n 'zeroinferior',\n 'oneinferior',\n 'twoinferior',\n 'threeinferior',\n 'fourinferior',\n 'fiveinferior',\n 'sixinferior',\n 'seveninferior',\n 'eightinferior',\n 'nineinferior',\n 'centinferior',\n 'dollarinferior',\n 'periodinferior',\n 'commainferior',\n 'Agravesmall',\n 'Aacutesmall',\n 'Acircumflexsmall',\n 'Atildesmall',\n 'Adieresissmall',\n 'Aringsmall',\n 'AEsmall',\n 'Ccedillasmall',\n 'Egravesmall',\n 'Eacutesmall',\n 'Ecircumflexsmall',\n 'Edieresissmall',\n 'Igravesmall',\n 'Iacutesmall',\n 'Icircumflexsmall',\n 'Idieresissmall',\n 'Ethsmall',\n 'Ntildesmall',\n 'Ogravesmall',\n 'Oacutesmall',\n 'Ocircumflexsmall',\n 'Otildesmall',\n 'Odieresissmall',\n 'OEsmall',\n 'Oslashsmall',\n 'Ugravesmall',\n 'Uacutesmall',\n 'Ucircumflexsmall',\n 'Udieresissmall',\n 'Yacutesmall',\n 'Thornsmall',\n 'Ydieresissmall',\n ]\n\n var standardNames = [\n '.notdef',\n '.null',\n 'nonmarkingreturn',\n 'space',\n 'exclam',\n 'quotedbl',\n 'numbersign',\n 'dollar',\n 'percent',\n 'ampersand',\n 'quotesingle',\n 'parenleft',\n 'parenright',\n 'asterisk',\n 'plus',\n 'comma',\n 'hyphen',\n 'period',\n 'slash',\n 'zero',\n 'one',\n 'two',\n 'three',\n 'four',\n 'five',\n 'six',\n 'seven',\n 'eight',\n 'nine',\n 'colon',\n 'semicolon',\n 'less',\n 'equal',\n 'greater',\n 'question',\n 'at',\n 'A',\n 'B',\n 'C',\n 'D',\n 'E',\n 'F',\n 'G',\n 'H',\n 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n 'N',\n 'O',\n 'P',\n 'Q',\n 'R',\n 'S',\n 'T',\n 'U',\n 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n 'bracketleft',\n 'backslash',\n 'bracketright',\n 'asciicircum',\n 'underscore',\n 'grave',\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n 'braceleft',\n 'bar',\n 'braceright',\n 'asciitilde',\n 'Adieresis',\n 'Aring',\n 'Ccedilla',\n 'Eacute',\n 'Ntilde',\n 'Odieresis',\n 'Udieresis',\n 'aacute',\n 'agrave',\n 'acircumflex',\n 'adieresis',\n 'atilde',\n 'aring',\n 'ccedilla',\n 'eacute',\n 'egrave',\n 'ecircumflex',\n 'edieresis',\n 'iacute',\n 'igrave',\n 'icircumflex',\n 'idieresis',\n 'ntilde',\n 'oacute',\n 'ograve',\n 'ocircumflex',\n 'odieresis',\n 'otilde',\n 'uacute',\n 'ugrave',\n 'ucircumflex',\n 'udieresis',\n 'dagger',\n 'degree',\n 'cent',\n 'sterling',\n 'section',\n 'bullet',\n 'paragraph',\n 'germandbls',\n 'registered',\n 'copyright',\n 'trademark',\n 'acute',\n 'dieresis',\n 'notequal',\n 'AE',\n 'Oslash',\n 'infinity',\n 'plusminus',\n 'lessequal',\n 'greaterequal',\n 'yen',\n 'mu',\n 'partialdiff',\n 'summation',\n 'product',\n 'pi',\n 'integral',\n 'ordfeminine',\n 'ordmasculine',\n 'Omega',\n 'ae',\n 'oslash',\n 'questiondown',\n 'exclamdown',\n 'logicalnot',\n 'radical',\n 'florin',\n 'approxequal',\n 'Delta',\n 'guillemotleft',\n 'guillemotright',\n 'ellipsis',\n 'nonbreakingspace',\n 'Agrave',\n 'Atilde',\n 'Otilde',\n 'OE',\n 'oe',\n 'endash',\n 'emdash',\n 'quotedblleft',\n 'quotedblright',\n 'quoteleft',\n 'quoteright',\n 'divide',\n 'lozenge',\n 'ydieresis',\n 'Ydieresis',\n 'fraction',\n 'currency',\n 'guilsinglleft',\n 'guilsinglright',\n 'fi',\n 'fl',\n 'daggerdbl',\n 'periodcentered',\n 'quotesinglbase',\n 'quotedblbase',\n 'perthousand',\n 'Acircumflex',\n 'Ecircumflex',\n 'Aacute',\n 'Edieresis',\n 'Egrave',\n 'Iacute',\n 'Icircumflex',\n 'Idieresis',\n 'Igrave',\n 'Oacute',\n 'Ocircumflex',\n 'apple',\n 'Ograve',\n 'Uacute',\n 'Ucircumflex',\n 'Ugrave',\n 'dotlessi',\n 'circumflex',\n 'tilde',\n 'macron',\n 'breve',\n 'dotaccent',\n 'ring',\n 'cedilla',\n 'hungarumlaut',\n 'ogonek',\n 'caron',\n 'Lslash',\n 'lslash',\n 'Scaron',\n 'scaron',\n 'Zcaron',\n 'zcaron',\n 'brokenbar',\n 'Eth',\n 'eth',\n 'Yacute',\n 'yacute',\n 'Thorn',\n 'thorn',\n 'minus',\n 'multiply',\n 'onesuperior',\n 'twosuperior',\n 'threesuperior',\n 'onehalf',\n 'onequarter',\n 'threequarters',\n 'franc',\n 'Gbreve',\n 'gbreve',\n 'Idotaccent',\n 'Scedilla',\n 'scedilla',\n 'Cacute',\n 'cacute',\n 'Ccaron',\n 'ccaron',\n 'dcroat',\n ]\n\n /**\n * This is the encoding used for fonts created from scratch.\n * It loops through all glyphs and finds the appropriate unicode value.\n * Since it's linear time, other encodings will be faster.\n * @exports opentype.DefaultEncoding\n * @class\n * @constructor\n * @param {opentype.Font}\n */\n function DefaultEncoding(font) {\n this.font = font\n }\n\n DefaultEncoding.prototype.charToGlyphIndex = function (c) {\n var code = c.codePointAt(0)\n var glyphs = this.font.glyphs\n if (glyphs) {\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n for (var j = 0; j < glyph.unicodes.length; j += 1) {\n if (glyph.unicodes[j] === code) {\n return i\n }\n }\n }\n }\n return null\n }\n\n /**\n * @exports opentype.CmapEncoding\n * @class\n * @constructor\n * @param {Object} cmap - a object with the cmap encoded data\n */\n function CmapEncoding(cmap) {\n this.cmap = cmap\n }\n\n /**\n * @param {string} c - the character\n * @return {number} The glyph index.\n */\n CmapEncoding.prototype.charToGlyphIndex = function (c) {\n return this.cmap.glyphIndexMap[c.codePointAt(0)] || 0\n }\n\n /**\n * @exports opentype.CffEncoding\n * @class\n * @constructor\n * @param {string} encoding - The encoding\n * @param {Array} charset - The character set.\n */\n function CffEncoding(encoding, charset) {\n this.encoding = encoding\n this.charset = charset\n }\n\n /**\n * @param {string} s - The character\n * @return {number} The index.\n */\n CffEncoding.prototype.charToGlyphIndex = function (s) {\n var code = s.codePointAt(0)\n var charName = this.encoding[code]\n return this.charset.indexOf(charName)\n }\n\n /**\n * @exports opentype.GlyphNames\n * @class\n * @constructor\n * @param {Object} post\n */\n function GlyphNames(post) {\n switch (post.version) {\n case 1:\n this.names = standardNames.slice()\n break\n case 2:\n this.names = new Array(post.numberOfGlyphs)\n for (var i = 0; i < post.numberOfGlyphs; i++) {\n if (post.glyphNameIndex[i] < standardNames.length) {\n this.names[i] = standardNames[post.glyphNameIndex[i]]\n } else {\n this.names[i] = post.names[post.glyphNameIndex[i] - standardNames.length]\n }\n }\n\n break\n case 2.5:\n this.names = new Array(post.numberOfGlyphs)\n for (var i$1 = 0; i$1 < post.numberOfGlyphs; i$1++) {\n this.names[i$1] = standardNames[i$1 + post.glyphNameIndex[i$1]]\n }\n\n break\n case 3:\n this.names = []\n break\n default:\n this.names = []\n break\n }\n }\n\n /**\n * Gets the index of a glyph by name.\n * @param {string} name - The glyph name\n * @return {number} The index\n */\n GlyphNames.prototype.nameToGlyphIndex = function (name) {\n return this.names.indexOf(name)\n }\n\n /**\n * @param {number} gid\n * @return {string}\n */\n GlyphNames.prototype.glyphIndexToName = function (gid) {\n return this.names[gid]\n }\n\n function addGlyphNamesAll(font) {\n var glyph\n var glyphIndexMap = font.tables.cmap.glyphIndexMap\n var charCodes = Object.keys(glyphIndexMap)\n\n for (var i = 0; i < charCodes.length; i += 1) {\n var c = charCodes[i]\n var glyphIndex = glyphIndexMap[c]\n glyph = font.glyphs.get(glyphIndex)\n glyph.addUnicode(parseInt(c))\n }\n\n for (var i$1 = 0; i$1 < font.glyphs.length; i$1 += 1) {\n glyph = font.glyphs.get(i$1)\n if (font.cffEncoding) {\n if (font.isCIDFont) {\n glyph.name = 'gid' + i$1\n } else {\n glyph.name = font.cffEncoding.charset[i$1]\n }\n } else if (font.glyphNames.names) {\n glyph.name = font.glyphNames.glyphIndexToName(i$1)\n }\n }\n }\n\n function addGlyphNamesToUnicodeMap(font) {\n font._IndexToUnicodeMap = {}\n\n var glyphIndexMap = font.tables.cmap.glyphIndexMap\n var charCodes = Object.keys(glyphIndexMap)\n\n for (var i = 0; i < charCodes.length; i += 1) {\n var c = charCodes[i]\n var glyphIndex = glyphIndexMap[c]\n if (font._IndexToUnicodeMap[glyphIndex] === undefined) {\n font._IndexToUnicodeMap[glyphIndex] = {\n unicodes: [parseInt(c)],\n }\n } else {\n font._IndexToUnicodeMap[glyphIndex].unicodes.push(parseInt(c))\n }\n }\n }\n\n /**\n * @alias opentype.addGlyphNames\n * @param {opentype.Font}\n * @param {Object}\n */\n function addGlyphNames(font, opt) {\n if (opt.lowMemory) {\n addGlyphNamesToUnicodeMap(font)\n } else {\n addGlyphNamesAll(font)\n }\n }\n\n // Drawing utility functions.\n\n // Draw a line on the given context from point `x1,y1` to point `x2,y2`.\n function line(ctx, x1, y1, x2, y2) {\n ctx.beginPath()\n ctx.moveTo(x1, y1)\n ctx.lineTo(x2, y2)\n ctx.stroke()\n }\n\n var draw = { line: line }\n\n // The Glyph object\n // import glyf from './tables/glyf' Can't be imported here, because it's a circular dependency\n\n function getPathDefinition(glyph, path) {\n var _path = path || new Path()\n return {\n configurable: true,\n\n get: function () {\n if (typeof _path === 'function') {\n _path = _path()\n }\n\n return _path\n },\n\n set: function (p) {\n _path = p\n },\n }\n }\n /**\n * @typedef GlyphOptions\n * @type Object\n * @property {string} [name] - The glyph name\n * @property {number} [unicode]\n * @property {Array} [unicodes]\n * @property {number} [xMin]\n * @property {number} [yMin]\n * @property {number} [xMax]\n * @property {number} [yMax]\n * @property {number} [advanceWidth]\n */\n\n // A Glyph is an individual mark that often corresponds to a character.\n // Some glyphs, such as ligatures, are a combination of many characters.\n // Glyphs are the basic building blocks of a font.\n //\n // The `Glyph` class contains utility methods for drawing the path and its points.\n /**\n * @exports opentype.Glyph\n * @class\n * @param {GlyphOptions}\n * @constructor\n */\n function Glyph(options) {\n // By putting all the code on a prototype function (which is only declared once)\n // we reduce the memory requirements for larger fonts by some 2%\n this.bindConstructorValues(options)\n }\n\n /**\n * @param {GlyphOptions}\n */\n Glyph.prototype.bindConstructorValues = function (options) {\n this.index = options.index || 0\n\n // These three values cannot be deferred for memory optimization:\n this.name = options.name || null\n this.unicode = options.unicode || undefined\n this.unicodes = options.unicodes || options.unicode !== undefined ? [options.unicode] : []\n\n // But by binding these values only when necessary, we reduce can\n // the memory requirements by almost 3% for larger fonts.\n if ('xMin' in options) {\n this.xMin = options.xMin\n }\n\n if ('yMin' in options) {\n this.yMin = options.yMin\n }\n\n if ('xMax' in options) {\n this.xMax = options.xMax\n }\n\n if ('yMax' in options) {\n this.yMax = options.yMax\n }\n\n if ('advanceWidth' in options) {\n this.advanceWidth = options.advanceWidth\n }\n\n // The path for a glyph is the most memory intensive, and is bound as a value\n // with a getter/setter to ensure we actually do path parsing only once the\n // path is actually needed by anything.\n Object.defineProperty(this, 'path', getPathDefinition(this, options.path))\n }\n\n /**\n * @param {number}\n */\n Glyph.prototype.addUnicode = function (unicode) {\n if (this.unicodes.length === 0) {\n this.unicode = unicode\n }\n\n this.unicodes.push(unicode)\n }\n\n /**\n * Calculate the minimum bounding box for this glyph.\n * @return {opentype.BoundingBox}\n */\n Glyph.prototype.getBoundingBox = function () {\n return this.path.getBoundingBox()\n }\n\n /**\n * Convert the glyph to a Path we can draw on a drawing context.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {Object=} options - xScale, yScale to stretch the glyph.\n * @param {opentype.Font} if hinting is to be used, the font\n * @return {opentype.Path}\n */\n Glyph.prototype.getPath = function (x, y, fontSize, options, font) {\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 72\n var commands\n var hPoints\n if (!options) {\n options = {}\n }\n var xScale = options.xScale\n var yScale = options.yScale\n\n if (options.hinting && font && font.hinting) {\n // in case of hinting, the hinting engine takes care\n // of scaling the points (not the path) before hinting.\n hPoints = this.path && font.hinting.exec(this, fontSize)\n // in case the hinting engine failed hPoints is undefined\n // and thus reverts to plain rending\n }\n\n if (hPoints) {\n // Call font.hinting.getCommands instead of `glyf.getPath(hPoints).commands` to avoid a circular dependency\n commands = font.hinting.getCommands(hPoints)\n x = Math.round(x)\n y = Math.round(y)\n // TODO in case of hinting xyScaling is not yet supported\n xScale = yScale = 1\n } else {\n commands = this.path.commands\n var scale = (1 / (this.path.unitsPerEm || 1000)) * fontSize\n if (xScale === undefined) {\n xScale = scale\n }\n if (yScale === undefined) {\n yScale = scale\n }\n }\n\n var p = new Path()\n for (var i = 0; i < commands.length; i += 1) {\n var cmd = commands[i]\n if (cmd.type === 'M') {\n p.moveTo(x + cmd.x * xScale, y + -cmd.y * yScale)\n } else if (cmd.type === 'L') {\n p.lineTo(x + cmd.x * xScale, y + -cmd.y * yScale)\n } else if (cmd.type === 'Q') {\n p.quadraticCurveTo(x + cmd.x1 * xScale, y + -cmd.y1 * yScale, x + cmd.x * xScale, y + -cmd.y * yScale)\n } else if (cmd.type === 'C') {\n p.curveTo(\n x + cmd.x1 * xScale,\n y + -cmd.y1 * yScale,\n x + cmd.x2 * xScale,\n y + -cmd.y2 * yScale,\n x + cmd.x * xScale,\n y + -cmd.y * yScale,\n )\n } else if (cmd.type === 'Z') {\n p.closePath()\n }\n }\n\n return p\n }\n\n /**\n * Split the glyph into contours.\n * This function is here for backwards compatibility, and to\n * provide raw access to the TrueType glyph outlines.\n * @return {Array}\n */\n Glyph.prototype.getContours = function () {\n if (this.points === undefined) {\n return []\n }\n\n var contours = []\n var currentContour = []\n for (var i = 0; i < this.points.length; i += 1) {\n var pt = this.points[i]\n currentContour.push(pt)\n if (pt.lastPointOfContour) {\n contours.push(currentContour)\n currentContour = []\n }\n }\n\n check.argument(currentContour.length === 0, 'There are still points left in the current contour.')\n return contours\n }\n\n /**\n * Calculate the xMin/yMin/xMax/yMax/lsb/rsb for a Glyph.\n * @return {Object}\n */\n Glyph.prototype.getMetrics = function () {\n var commands = this.path.commands\n var xCoords = []\n var yCoords = []\n for (var i = 0; i < commands.length; i += 1) {\n var cmd = commands[i]\n if (cmd.type !== 'Z') {\n xCoords.push(cmd.x)\n yCoords.push(cmd.y)\n }\n\n if (cmd.type === 'Q' || cmd.type === 'C') {\n xCoords.push(cmd.x1)\n yCoords.push(cmd.y1)\n }\n\n if (cmd.type === 'C') {\n xCoords.push(cmd.x2)\n yCoords.push(cmd.y2)\n }\n }\n\n var metrics = {\n xMin: Math.min.apply(null, xCoords),\n yMin: Math.min.apply(null, yCoords),\n xMax: Math.max.apply(null, xCoords),\n yMax: Math.max.apply(null, yCoords),\n leftSideBearing: this.leftSideBearing,\n }\n\n if (!isFinite(metrics.xMin)) {\n metrics.xMin = 0\n }\n\n if (!isFinite(metrics.xMax)) {\n metrics.xMax = this.advanceWidth\n }\n\n if (!isFinite(metrics.yMin)) {\n metrics.yMin = 0\n }\n\n if (!isFinite(metrics.yMax)) {\n metrics.yMax = 0\n }\n\n metrics.rightSideBearing = this.advanceWidth - metrics.leftSideBearing - (metrics.xMax - metrics.xMin)\n return metrics\n }\n\n /**\n * Draw the glyph on the given context.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {Object=} options - xScale, yScale to stretch the glyph.\n */\n Glyph.prototype.draw = function (ctx, x, y, fontSize, options) {\n this.getPath(x, y, fontSize, options).draw(ctx)\n }\n\n /**\n * Draw the points of the glyph.\n * On-curve points will be drawn in blue, off-curve points will be drawn in red.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n */\n Glyph.prototype.drawPoints = function (ctx, x, y, fontSize) {\n function drawCircles(l, x, y, scale) {\n ctx.beginPath()\n for (var j = 0; j < l.length; j += 1) {\n ctx.moveTo(x + l[j].x * scale, y + l[j].y * scale)\n ctx.arc(x + l[j].x * scale, y + l[j].y * scale, 2, 0, Math.PI * 2, false)\n }\n\n ctx.closePath()\n ctx.fill()\n }\n\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 24\n var scale = (1 / this.path.unitsPerEm) * fontSize\n\n var blueCircles = []\n var redCircles = []\n var path = this.path\n for (var i = 0; i < path.commands.length; i += 1) {\n var cmd = path.commands[i]\n if (cmd.x !== undefined) {\n blueCircles.push({ x: cmd.x, y: -cmd.y })\n }\n\n if (cmd.x1 !== undefined) {\n redCircles.push({ x: cmd.x1, y: -cmd.y1 })\n }\n\n if (cmd.x2 !== undefined) {\n redCircles.push({ x: cmd.x2, y: -cmd.y2 })\n }\n }\n\n ctx.fillStyle = 'blue'\n drawCircles(blueCircles, x, y, scale)\n ctx.fillStyle = 'red'\n drawCircles(redCircles, x, y, scale)\n }\n\n /**\n * Draw lines indicating important font measurements.\n * Black lines indicate the origin of the coordinate system (point 0,0).\n * Blue lines indicate the glyph bounding box.\n * Green line indicates the advance width of the glyph.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n */\n Glyph.prototype.drawMetrics = function (ctx, x, y, fontSize) {\n var scale\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 24\n scale = (1 / this.path.unitsPerEm) * fontSize\n ctx.lineWidth = 1\n\n // Draw the origin\n ctx.strokeStyle = 'black'\n draw.line(ctx, x, -10000, x, 10000)\n draw.line(ctx, -10000, y, 10000, y)\n\n // This code is here due to memory optimization: by not using\n // defaults in the constructor, we save a notable amount of memory.\n var xMin = this.xMin || 0\n var yMin = this.yMin || 0\n var xMax = this.xMax || 0\n var yMax = this.yMax || 0\n var advanceWidth = this.advanceWidth || 0\n\n // Draw the glyph box\n ctx.strokeStyle = 'blue'\n draw.line(ctx, x + xMin * scale, -10000, x + xMin * scale, 10000)\n draw.line(ctx, x + xMax * scale, -10000, x + xMax * scale, 10000)\n draw.line(ctx, -10000, y + -yMin * scale, 10000, y + -yMin * scale)\n draw.line(ctx, -10000, y + -yMax * scale, 10000, y + -yMax * scale)\n\n // Draw the advance width\n ctx.strokeStyle = 'green'\n draw.line(ctx, x + advanceWidth * scale, -10000, x + advanceWidth * scale, 10000)\n }\n\n // The GlyphSet object\n\n // Define a property on the glyph that depends on the path being loaded.\n function defineDependentProperty(glyph, externalName, internalName) {\n Object.defineProperty(glyph, externalName, {\n get: function () {\n // Request the path property to make sure the path is loaded.\n glyph.path // jshint ignore:line\n return glyph[internalName]\n },\n set: function (newValue) {\n glyph[internalName] = newValue\n },\n enumerable: true,\n configurable: true,\n })\n }\n\n /**\n * A GlyphSet represents all glyphs available in the font, but modelled using\n * a deferred glyph loader, for retrieving glyphs only once they are absolutely\n * necessary, to keep the memory footprint down.\n * @exports opentype.GlyphSet\n * @class\n * @param {opentype.Font}\n * @param {Array}\n */\n function GlyphSet(font, glyphs) {\n this.font = font\n this.glyphs = {}\n if (Array.isArray(glyphs)) {\n for (var i = 0; i < glyphs.length; i++) {\n var glyph = glyphs[i]\n glyph.path.unitsPerEm = font.unitsPerEm\n this.glyphs[i] = glyph\n }\n }\n\n this.length = (glyphs && glyphs.length) || 0\n }\n\n /**\n * @param {number} index\n * @return {opentype.Glyph}\n */\n GlyphSet.prototype.get = function (index) {\n // this.glyphs[index] is 'undefined' when low memory mode is on. glyph is pushed on request only.\n if (this.glyphs[index] === undefined) {\n this.font._push(index)\n if (typeof this.glyphs[index] === 'function') {\n this.glyphs[index] = this.glyphs[index]()\n }\n\n var glyph = this.glyphs[index]\n var unicodeObj = this.font._IndexToUnicodeMap[index]\n\n if (unicodeObj) {\n for (var j = 0; j < unicodeObj.unicodes.length; j++) {\n glyph.addUnicode(unicodeObj.unicodes[j])\n }\n }\n\n if (this.font.cffEncoding) {\n if (this.font.isCIDFont) {\n glyph.name = 'gid' + index\n } else {\n glyph.name = this.font.cffEncoding.charset[index]\n }\n } else if (this.font.glyphNames.names) {\n glyph.name = this.font.glyphNames.glyphIndexToName(index)\n }\n\n this.glyphs[index].advanceWidth = this.font._hmtxTableData[index].advanceWidth\n this.glyphs[index].leftSideBearing = this.font._hmtxTableData[index].leftSideBearing\n } else {\n if (typeof this.glyphs[index] === 'function') {\n this.glyphs[index] = this.glyphs[index]()\n }\n }\n\n return this.glyphs[index]\n }\n\n /**\n * @param {number} index\n * @param {Object}\n */\n GlyphSet.prototype.push = function (index, loader) {\n this.glyphs[index] = loader\n this.length++\n }\n\n /**\n * @alias opentype.glyphLoader\n * @param {opentype.Font} font\n * @param {number} index\n * @return {opentype.Glyph}\n */\n function glyphLoader(font, index) {\n return new Glyph({ index: index, font: font })\n }\n\n /**\n * Generate a stub glyph that can be filled with all metadata *except*\n * the \"points\" and \"path\" properties, which must be loaded only once\n * the glyph's path is actually requested for text shaping.\n * @alias opentype.ttfGlyphLoader\n * @param {opentype.Font} font\n * @param {number} index\n * @param {Function} parseGlyph\n * @param {Object} data\n * @param {number} position\n * @param {Function} buildPath\n * @return {opentype.Glyph}\n */\n function ttfGlyphLoader(font, index, parseGlyph, data, position, buildPath) {\n return function () {\n var glyph = new Glyph({ index: index, font: font })\n\n glyph.path = function () {\n parseGlyph(glyph, data, position)\n var path = buildPath(font.glyphs, glyph)\n path.unitsPerEm = font.unitsPerEm\n return path\n }\n\n defineDependentProperty(glyph, 'xMin', '_xMin')\n defineDependentProperty(glyph, 'xMax', '_xMax')\n defineDependentProperty(glyph, 'yMin', '_yMin')\n defineDependentProperty(glyph, 'yMax', '_yMax')\n\n return glyph\n }\n }\n /**\n * @alias opentype.cffGlyphLoader\n * @param {opentype.Font} font\n * @param {number} index\n * @param {Function} parseCFFCharstring\n * @param {string} charstring\n * @return {opentype.Glyph}\n */\n function cffGlyphLoader(font, index, parseCFFCharstring, charstring) {\n return function () {\n var glyph = new Glyph({ index: index, font: font })\n\n glyph.path = function () {\n var path = parseCFFCharstring(font, glyph, charstring)\n path.unitsPerEm = font.unitsPerEm\n return path\n }\n\n return glyph\n }\n }\n\n var glyphset = {\n GlyphSet: GlyphSet,\n glyphLoader: glyphLoader,\n ttfGlyphLoader: ttfGlyphLoader,\n cffGlyphLoader: cffGlyphLoader,\n }\n\n // The `CFF` table contains the glyph outlines in PostScript format.\n\n // Custom equals function that can also check lists.\n function equals(a, b) {\n if (a === b) {\n return true\n } else if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return false\n }\n\n for (var i = 0; i < a.length; i += 1) {\n if (!equals(a[i], b[i])) {\n return false\n }\n }\n\n return true\n } else {\n return false\n }\n }\n\n // Subroutines are encoded using the negative half of the number space.\n // See type 2 chapter 4.7 \"Subroutine operators\".\n function calcCFFSubroutineBias(subrs) {\n var bias\n if (subrs.length < 1240) {\n bias = 107\n } else if (subrs.length < 33900) {\n bias = 1131\n } else {\n bias = 32768\n }\n\n return bias\n }\n\n // Parse a `CFF` INDEX array.\n // An index array consists of a list of offsets, then a list of objects at those offsets.\n function parseCFFIndex(data, start, conversionFn) {\n var offsets = []\n var objects = []\n var count = parse.getCard16(data, start)\n var objectOffset\n var endOffset\n if (count !== 0) {\n var offsetSize = parse.getByte(data, start + 2)\n objectOffset = start + (count + 1) * offsetSize + 2\n var pos = start + 3\n for (var i = 0; i < count + 1; i += 1) {\n offsets.push(parse.getOffset(data, pos, offsetSize))\n pos += offsetSize\n }\n\n // The total size of the index array is 4 header bytes + the value of the last offset.\n endOffset = objectOffset + offsets[count]\n } else {\n endOffset = start + 2\n }\n\n for (var i$1 = 0; i$1 < offsets.length - 1; i$1 += 1) {\n var value = parse.getBytes(data, objectOffset + offsets[i$1], objectOffset + offsets[i$1 + 1])\n if (conversionFn) {\n value = conversionFn(value)\n }\n\n objects.push(value)\n }\n\n return { objects: objects, startOffset: start, endOffset: endOffset }\n }\n\n function parseCFFIndexLowMemory(data, start) {\n var offsets = []\n var count = parse.getCard16(data, start)\n var objectOffset\n var endOffset\n if (count !== 0) {\n var offsetSize = parse.getByte(data, start + 2)\n objectOffset = start + (count + 1) * offsetSize + 2\n var pos = start + 3\n for (var i = 0; i < count + 1; i += 1) {\n offsets.push(parse.getOffset(data, pos, offsetSize))\n pos += offsetSize\n }\n\n // The total size of the index array is 4 header bytes + the value of the last offset.\n endOffset = objectOffset + offsets[count]\n } else {\n endOffset = start + 2\n }\n\n return { offsets: offsets, startOffset: start, endOffset: endOffset }\n }\n function getCffIndexObject(i, offsets, data, start, conversionFn) {\n var count = parse.getCard16(data, start)\n var objectOffset = 0\n if (count !== 0) {\n var offsetSize = parse.getByte(data, start + 2)\n objectOffset = start + (count + 1) * offsetSize + 2\n }\n\n var value = parse.getBytes(data, objectOffset + offsets[i], objectOffset + offsets[i + 1])\n if (conversionFn) {\n value = conversionFn(value)\n }\n return value\n }\n\n // Parse a `CFF` DICT real value.\n function parseFloatOperand(parser) {\n var s = ''\n var eof = 15\n var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-']\n while (true) {\n var b = parser.parseByte()\n var n1 = b >> 4\n var n2 = b & 15\n\n if (n1 === eof) {\n break\n }\n\n s += lookup[n1]\n\n if (n2 === eof) {\n break\n }\n\n s += lookup[n2]\n }\n\n return parseFloat(s)\n }\n\n // Parse a `CFF` DICT operand.\n function parseOperand(parser, b0) {\n var b1\n var b2\n var b3\n var b4\n if (b0 === 28) {\n b1 = parser.parseByte()\n b2 = parser.parseByte()\n return (b1 << 8) | b2\n }\n\n if (b0 === 29) {\n b1 = parser.parseByte()\n b2 = parser.parseByte()\n b3 = parser.parseByte()\n b4 = parser.parseByte()\n return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4\n }\n\n if (b0 === 30) {\n return parseFloatOperand(parser)\n }\n\n if (b0 >= 32 && b0 <= 246) {\n return b0 - 139\n }\n\n if (b0 >= 247 && b0 <= 250) {\n b1 = parser.parseByte()\n return (b0 - 247) * 256 + b1 + 108\n }\n\n if (b0 >= 251 && b0 <= 254) {\n b1 = parser.parseByte()\n return -(b0 - 251) * 256 - b1 - 108\n }\n\n throw new Error('Invalid b0 ' + b0)\n }\n\n // Convert the entries returned by `parseDict` to a proper dictionary.\n // If a value is a list of one, it is unpacked.\n function entriesToObject(entries) {\n var o = {}\n for (var i = 0; i < entries.length; i += 1) {\n var key = entries[i][0]\n var values = entries[i][1]\n var value = void 0\n if (values.length === 1) {\n value = values[0]\n } else {\n value = values\n }\n\n if (o.hasOwnProperty(key) && !isNaN(o[key])) {\n throw new Error('Object ' + o + ' already has key ' + key)\n }\n\n o[key] = value\n }\n\n return o\n }\n\n // Parse a `CFF` DICT object.\n // A dictionary contains key-value pairs in a compact tokenized format.\n function parseCFFDict(data, start, size) {\n start = start !== undefined ? start : 0\n var parser = new parse.Parser(data, start)\n var entries = []\n var operands = []\n size = size !== undefined ? size : data.length\n\n while (parser.relativeOffset < size) {\n var op = parser.parseByte()\n\n // The first byte for each dict item distinguishes between operator (key) and operand (value).\n // Values <= 21 are operators.\n if (op <= 21) {\n // Two-byte operators have an initial escape byte of 12.\n if (op === 12) {\n op = 1200 + parser.parseByte()\n }\n\n entries.push([op, operands])\n operands = []\n } else {\n // Since the operands (values) come before the operators (keys), we store all operands in a list\n // until we encounter an operator.\n operands.push(parseOperand(parser, op))\n }\n }\n\n return entriesToObject(entries)\n }\n\n // Given a String Index (SID), return the value of the string.\n // Strings below index 392 are standard CFF strings and are not encoded in the font.\n function getCFFString(strings, index) {\n if (index <= 390) {\n index = cffStandardStrings[index]\n } else {\n index = strings[index - 391]\n }\n\n return index\n }\n\n // Interpret a dictionary and return a new dictionary with readable keys and values for missing entries.\n // This function takes `meta` which is a list of objects containing `operand`, `name` and `default`.\n function interpretDict(dict, meta, strings) {\n var newDict = {}\n var value\n\n // Because we also want to include missing values, we start out from the meta list\n // and lookup values in the dict.\n for (var i = 0; i < meta.length; i += 1) {\n var m = meta[i]\n\n if (Array.isArray(m.type)) {\n var values = []\n values.length = m.type.length\n for (var j = 0; j < m.type.length; j++) {\n value = dict[m.op] !== undefined ? dict[m.op][j] : undefined\n if (value === undefined) {\n value = m.value !== undefined && m.value[j] !== undefined ? m.value[j] : null\n }\n if (m.type[j] === 'SID') {\n value = getCFFString(strings, value)\n }\n values[j] = value\n }\n newDict[m.name] = values\n } else {\n value = dict[m.op]\n if (value === undefined) {\n value = m.value !== undefined ? m.value : null\n }\n\n if (m.type === 'SID') {\n value = getCFFString(strings, value)\n }\n newDict[m.name] = value\n }\n }\n\n return newDict\n }\n\n // Parse the CFF header.\n function parseCFFHeader(data, start) {\n var header = {}\n header.formatMajor = parse.getCard8(data, start)\n header.formatMinor = parse.getCard8(data, start + 1)\n header.size = parse.getCard8(data, start + 2)\n header.offsetSize = parse.getCard8(data, start + 3)\n header.startOffset = start\n header.endOffset = start + 4\n return header\n }\n\n var TOP_DICT_META = [\n { name: 'version', op: 0, type: 'SID' },\n { name: 'notice', op: 1, type: 'SID' },\n { name: 'copyright', op: 1200, type: 'SID' },\n { name: 'fullName', op: 2, type: 'SID' },\n { name: 'familyName', op: 3, type: 'SID' },\n { name: 'weight', op: 4, type: 'SID' },\n { name: 'isFixedPitch', op: 1201, type: 'number', value: 0 },\n { name: 'italicAngle', op: 1202, type: 'number', value: 0 },\n { name: 'underlinePosition', op: 1203, type: 'number', value: -100 },\n { name: 'underlineThickness', op: 1204, type: 'number', value: 50 },\n { name: 'paintType', op: 1205, type: 'number', value: 0 },\n { name: 'charstringType', op: 1206, type: 'number', value: 2 },\n {\n name: 'fontMatrix',\n op: 1207,\n type: ['real', 'real', 'real', 'real', 'real', 'real'],\n value: [0.001, 0, 0, 0.001, 0, 0],\n },\n { name: 'uniqueId', op: 13, type: 'number' },\n { name: 'fontBBox', op: 5, type: ['number', 'number', 'number', 'number'], value: [0, 0, 0, 0] },\n { name: 'strokeWidth', op: 1208, type: 'number', value: 0 },\n { name: 'xuid', op: 14, type: [], value: null },\n { name: 'charset', op: 15, type: 'offset', value: 0 },\n { name: 'encoding', op: 16, type: 'offset', value: 0 },\n { name: 'charStrings', op: 17, type: 'offset', value: 0 },\n { name: 'private', op: 18, type: ['number', 'offset'], value: [0, 0] },\n { name: 'ros', op: 1230, type: ['SID', 'SID', 'number'] },\n { name: 'cidFontVersion', op: 1231, type: 'number', value: 0 },\n { name: 'cidFontRevision', op: 1232, type: 'number', value: 0 },\n { name: 'cidFontType', op: 1233, type: 'number', value: 0 },\n { name: 'cidCount', op: 1234, type: 'number', value: 8720 },\n { name: 'uidBase', op: 1235, type: 'number' },\n { name: 'fdArray', op: 1236, type: 'offset' },\n { name: 'fdSelect', op: 1237, type: 'offset' },\n { name: 'fontName', op: 1238, type: 'SID' },\n ]\n\n var PRIVATE_DICT_META = [\n { name: 'subrs', op: 19, type: 'offset', value: 0 },\n { name: 'defaultWidthX', op: 20, type: 'number', value: 0 },\n { name: 'nominalWidthX', op: 21, type: 'number', value: 0 },\n ]\n\n // Parse the CFF top dictionary. A CFF table can contain multiple fonts, each with their own top dictionary.\n // The top dictionary contains the essential metadata for the font, together with the private dictionary.\n function parseCFFTopDict(data, strings) {\n var dict = parseCFFDict(data, 0, data.byteLength)\n return interpretDict(dict, TOP_DICT_META, strings)\n }\n\n // Parse the CFF private dictionary. We don't fully parse out all the values, only the ones we need.\n function parseCFFPrivateDict(data, start, size, strings) {\n var dict = parseCFFDict(data, start, size)\n return interpretDict(dict, PRIVATE_DICT_META, strings)\n }\n\n // Returns a list of \"Top DICT\"s found using an INDEX list.\n // Used to read both the usual high-level Top DICTs and also the FDArray\n // discovered inside CID-keyed fonts. When a Top DICT has a reference to\n // a Private DICT that is read and saved into the Top DICT.\n //\n // In addition to the expected/optional values as outlined in TOP_DICT_META\n // the following values might be saved into the Top DICT.\n //\n // _subrs [] array of local CFF subroutines from Private DICT\n // _subrsBias bias value computed from number of subroutines\n // (see calcCFFSubroutineBias() and parseCFFCharstring())\n // _defaultWidthX default widths for CFF characters\n // _nominalWidthX bias added to width embedded within glyph description\n //\n // _privateDict saved copy of parsed Private DICT from Top DICT\n function gatherCFFTopDicts(data, start, cffIndex, strings) {\n var topDictArray = []\n for (var iTopDict = 0; iTopDict < cffIndex.length; iTopDict += 1) {\n var topDictData = new DataView(new Uint8Array(cffIndex[iTopDict]).buffer)\n var topDict = parseCFFTopDict(topDictData, strings)\n topDict._subrs = []\n topDict._subrsBias = 0\n topDict._defaultWidthX = 0\n topDict._nominalWidthX = 0\n var privateSize = topDict.private[0]\n var privateOffset = topDict.private[1]\n if (privateSize !== 0 && privateOffset !== 0) {\n var privateDict = parseCFFPrivateDict(data, privateOffset + start, privateSize, strings)\n topDict._defaultWidthX = privateDict.defaultWidthX\n topDict._nominalWidthX = privateDict.nominalWidthX\n if (privateDict.subrs !== 0) {\n var subrOffset = privateOffset + privateDict.subrs\n var subrIndex = parseCFFIndex(data, subrOffset + start)\n topDict._subrs = subrIndex.objects\n topDict._subrsBias = calcCFFSubroutineBias(topDict._subrs)\n }\n topDict._privateDict = privateDict\n }\n topDictArray.push(topDict)\n }\n return topDictArray\n }\n\n // Parse the CFF charset table, which contains internal names for all the glyphs.\n // This function will return a list of glyph names.\n // See Adobe TN #5176 chapter 13, \"Charsets\".\n function parseCFFCharset(data, start, nGlyphs, strings) {\n var sid\n var count\n var parser = new parse.Parser(data, start)\n\n // The .notdef glyph is not included, so subtract 1.\n nGlyphs -= 1\n var charset = ['.notdef']\n\n var format = parser.parseCard8()\n if (format === 0) {\n for (var i = 0; i < nGlyphs; i += 1) {\n sid = parser.parseSID()\n charset.push(getCFFString(strings, sid))\n }\n } else if (format === 1) {\n while (charset.length <= nGlyphs) {\n sid = parser.parseSID()\n count = parser.parseCard8()\n for (var i$1 = 0; i$1 <= count; i$1 += 1) {\n charset.push(getCFFString(strings, sid))\n sid += 1\n }\n }\n } else if (format === 2) {\n while (charset.length <= nGlyphs) {\n sid = parser.parseSID()\n count = parser.parseCard16()\n for (var i$2 = 0; i$2 <= count; i$2 += 1) {\n charset.push(getCFFString(strings, sid))\n sid += 1\n }\n }\n } else {\n throw new Error('Unknown charset format ' + format)\n }\n\n return charset\n }\n\n // Parse the CFF encoding data. Only one encoding can be specified per font.\n // See Adobe TN #5176 chapter 12, \"Encodings\".\n function parseCFFEncoding(data, start, charset) {\n var code\n var enc = {}\n var parser = new parse.Parser(data, start)\n var format = parser.parseCard8()\n if (format === 0) {\n var nCodes = parser.parseCard8()\n for (var i = 0; i < nCodes; i += 1) {\n code = parser.parseCard8()\n enc[code] = i\n }\n } else if (format === 1) {\n var nRanges = parser.parseCard8()\n code = 1\n for (var i$1 = 0; i$1 < nRanges; i$1 += 1) {\n var first = parser.parseCard8()\n var nLeft = parser.parseCard8()\n for (var j = first; j <= first + nLeft; j += 1) {\n enc[j] = code\n code += 1\n }\n }\n } else {\n throw new Error('Unknown encoding format ' + format)\n }\n\n return new CffEncoding(enc, charset)\n }\n\n // Take in charstring code and return a Glyph object.\n // The encoding is described in the Type 2 Charstring Format\n // https://www.microsoft.com/typography/OTSPEC/charstr2.htm\n function parseCFFCharstring(font, glyph, code) {\n var c1x\n var c1y\n var c2x\n var c2y\n var p = new Path()\n var stack = []\n var nStems = 0\n var haveWidth = false\n var open = false\n var x = 0\n var y = 0\n var subrs\n var subrsBias\n var defaultWidthX\n var nominalWidthX\n if (font.isCIDFont) {\n var fdIndex = font.tables.cff.topDict._fdSelect[glyph.index]\n var fdDict = font.tables.cff.topDict._fdArray[fdIndex]\n subrs = fdDict._subrs\n subrsBias = fdDict._subrsBias\n defaultWidthX = fdDict._defaultWidthX\n nominalWidthX = fdDict._nominalWidthX\n } else {\n subrs = font.tables.cff.topDict._subrs\n subrsBias = font.tables.cff.topDict._subrsBias\n defaultWidthX = font.tables.cff.topDict._defaultWidthX\n nominalWidthX = font.tables.cff.topDict._nominalWidthX\n }\n var width = defaultWidthX\n\n function newContour(x, y) {\n if (open) {\n p.closePath()\n }\n\n p.moveTo(x, y)\n open = true\n }\n\n function parseStems() {\n var hasWidthArg\n\n // The number of stem operators on the stack is always even.\n // If the value is uneven, that means a width is specified.\n hasWidthArg = stack.length % 2 !== 0\n if (hasWidthArg && !haveWidth) {\n width = stack.shift() + nominalWidthX\n }\n\n nStems += stack.length >> 1\n stack.length = 0\n haveWidth = true\n }\n\n function parse(code) {\n var b1\n var b2\n var b3\n var b4\n var codeIndex\n var subrCode\n var jpx\n var jpy\n var c3x\n var c3y\n var c4x\n var c4y\n\n var i = 0\n while (i < code.length) {\n var v = code[i]\n i += 1\n switch (v) {\n case 1: // hstem\n parseStems()\n break\n case 3: // vstem\n parseStems()\n break\n case 4: // vmoveto\n if (stack.length > 1 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n y += stack.pop()\n newContour(x, y)\n break\n case 5: // rlineto\n while (stack.length > 0) {\n x += stack.shift()\n y += stack.shift()\n p.lineTo(x, y)\n }\n\n break\n case 6: // hlineto\n while (stack.length > 0) {\n x += stack.shift()\n p.lineTo(x, y)\n if (stack.length === 0) {\n break\n }\n\n y += stack.shift()\n p.lineTo(x, y)\n }\n\n break\n case 7: // vlineto\n while (stack.length > 0) {\n y += stack.shift()\n p.lineTo(x, y)\n if (stack.length === 0) {\n break\n }\n\n x += stack.shift()\n p.lineTo(x, y)\n }\n\n break\n case 8: // rrcurveto\n while (stack.length > 0) {\n c1x = x + stack.shift()\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 10: // callsubr\n codeIndex = stack.pop() + subrsBias\n subrCode = subrs[codeIndex]\n if (subrCode) {\n parse(subrCode)\n }\n\n break\n case 11: // return\n return\n case 12: // flex operators\n v = code[i]\n i += 1\n switch (v) {\n case 35: // flex\n // |- dx1 dy1 dx2 dy2 dx3 dy3 dx4 dy4 dx5 dy5 dx6 dy6 fd flex (12 35) |-\n c1x = x + stack.shift() // dx1\n c1y = y + stack.shift() // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y + stack.shift() // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = jpy + stack.shift() // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = c3y + stack.shift() // dy5\n x = c4x + stack.shift() // dx6\n y = c4y + stack.shift() // dy6\n stack.shift() // flex depth\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n case 34: // hflex\n // |- dx1 dx2 dy2 dx3 dx4 dx5 dx6 hflex (12 34) |-\n c1x = x + stack.shift() // dx1\n c1y = y // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = c2y // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = y // dy5\n x = c4x + stack.shift() // dx6\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n case 36: // hflex1\n // |- dx1 dy1 dx2 dy2 dx3 dx4 dx5 dy5 dx6 hflex1 (12 36) |-\n c1x = x + stack.shift() // dx1\n c1y = y + stack.shift() // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = c2y // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = c3y + stack.shift() // dy5\n x = c4x + stack.shift() // dx6\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n case 37: // flex1\n // |- dx1 dy1 dx2 dy2 dx3 dy3 dx4 dy4 dx5 dy5 d6 flex1 (12 37) |-\n c1x = x + stack.shift() // dx1\n c1y = y + stack.shift() // dy1\n c2x = c1x + stack.shift() // dx2\n c2y = c1y + stack.shift() // dy2\n jpx = c2x + stack.shift() // dx3\n jpy = c2y + stack.shift() // dy3\n c3x = jpx + stack.shift() // dx4\n c3y = jpy + stack.shift() // dy4\n c4x = c3x + stack.shift() // dx5\n c4y = c3y + stack.shift() // dy5\n if (Math.abs(c4x - x) > Math.abs(c4y - y)) {\n x = c4x + stack.shift()\n } else {\n y = c4y + stack.shift()\n }\n\n p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy)\n p.curveTo(c3x, c3y, c4x, c4y, x, y)\n break\n default:\n console.log('Glyph ' + glyph.index + ': unknown operator ' + 1200 + v)\n stack.length = 0\n }\n break\n case 14: // endchar\n if (stack.length > 0 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n if (open) {\n p.closePath()\n open = false\n }\n\n break\n case 18: // hstemhm\n parseStems()\n break\n case 19: // hintmask\n case 20: // cntrmask\n parseStems()\n i += (nStems + 7) >> 3\n break\n case 21: // rmoveto\n if (stack.length > 2 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n y += stack.pop()\n x += stack.pop()\n newContour(x, y)\n break\n case 22: // hmoveto\n if (stack.length > 1 && !haveWidth) {\n width = stack.shift() + nominalWidthX\n haveWidth = true\n }\n\n x += stack.pop()\n newContour(x, y)\n break\n case 23: // vstemhm\n parseStems()\n break\n case 24: // rcurveline\n while (stack.length > 2) {\n c1x = x + stack.shift()\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n x += stack.shift()\n y += stack.shift()\n p.lineTo(x, y)\n break\n case 25: // rlinecurve\n while (stack.length > 6) {\n x += stack.shift()\n y += stack.shift()\n p.lineTo(x, y)\n }\n\n c1x = x + stack.shift()\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n break\n case 26: // vvcurveto\n if (stack.length % 2) {\n x += stack.shift()\n }\n\n while (stack.length > 0) {\n c1x = x\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x\n y = c2y + stack.shift()\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 27: // hhcurveto\n if (stack.length % 2) {\n y += stack.shift()\n }\n\n while (stack.length > 0) {\n c1x = x + stack.shift()\n c1y = y\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 28: // shortint\n b1 = code[i]\n b2 = code[i + 1]\n stack.push(((b1 << 24) | (b2 << 16)) >> 16)\n i += 2\n break\n case 29: // callgsubr\n codeIndex = stack.pop() + font.gsubrsBias\n subrCode = font.gsubrs[codeIndex]\n if (subrCode) {\n parse(subrCode)\n }\n\n break\n case 30: // vhcurveto\n while (stack.length > 0) {\n c1x = x\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n if (stack.length === 0) {\n break\n }\n\n c1x = x + stack.shift()\n c1y = y\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n y = c2y + stack.shift()\n x = c2x + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n case 31: // hvcurveto\n while (stack.length > 0) {\n c1x = x + stack.shift()\n c1y = y\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n y = c2y + stack.shift()\n x = c2x + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n if (stack.length === 0) {\n break\n }\n\n c1x = x\n c1y = y + stack.shift()\n c2x = c1x + stack.shift()\n c2y = c1y + stack.shift()\n x = c2x + stack.shift()\n y = c2y + (stack.length === 1 ? stack.shift() : 0)\n p.curveTo(c1x, c1y, c2x, c2y, x, y)\n }\n\n break\n default:\n if (v < 32) {\n console.log('Glyph ' + glyph.index + ': unknown operator ' + v)\n } else if (v < 247) {\n stack.push(v - 139)\n } else if (v < 251) {\n b1 = code[i]\n i += 1\n stack.push((v - 247) * 256 + b1 + 108)\n } else if (v < 255) {\n b1 = code[i]\n i += 1\n stack.push(-(v - 251) * 256 - b1 - 108)\n } else {\n b1 = code[i]\n b2 = code[i + 1]\n b3 = code[i + 2]\n b4 = code[i + 3]\n i += 4\n stack.push(((b1 << 24) | (b2 << 16) | (b3 << 8) | b4) / 65536)\n }\n }\n }\n }\n\n parse(code)\n\n glyph.advanceWidth = width\n return p\n }\n\n function parseCFFFDSelect(data, start, nGlyphs, fdArrayCount) {\n var fdSelect = []\n var fdIndex\n var parser = new parse.Parser(data, start)\n var format = parser.parseCard8()\n if (format === 0) {\n // Simple list of nGlyphs elements\n for (var iGid = 0; iGid < nGlyphs; iGid++) {\n fdIndex = parser.parseCard8()\n if (fdIndex >= fdArrayCount) {\n throw new Error(\n 'CFF table CID Font FDSelect has bad FD index value ' + fdIndex + ' (FD count ' + fdArrayCount + ')',\n )\n }\n fdSelect.push(fdIndex)\n }\n } else if (format === 3) {\n // Ranges\n var nRanges = parser.parseCard16()\n var first = parser.parseCard16()\n if (first !== 0) {\n throw new Error('CFF Table CID Font FDSelect format 3 range has bad initial GID ' + first)\n }\n var next\n for (var iRange = 0; iRange < nRanges; iRange++) {\n fdIndex = parser.parseCard8()\n next = parser.parseCard16()\n if (fdIndex >= fdArrayCount) {\n throw new Error(\n 'CFF table CID Font FDSelect has bad FD index value ' + fdIndex + ' (FD count ' + fdArrayCount + ')',\n )\n }\n if (next > nGlyphs) {\n throw new Error('CFF Table CID Font FDSelect format 3 range has bad GID ' + next)\n }\n for (; first < next; first++) {\n fdSelect.push(fdIndex)\n }\n first = next\n }\n if (next !== nGlyphs) {\n throw new Error('CFF Table CID Font FDSelect format 3 range has bad final GID ' + next)\n }\n } else {\n throw new Error('CFF Table CID Font FDSelect table has unsupported format ' + format)\n }\n return fdSelect\n }\n\n // Parse the `CFF` table, which contains the glyph outlines in PostScript format.\n function parseCFFTable(data, start, font, opt) {\n font.tables.cff = {}\n var header = parseCFFHeader(data, start)\n var nameIndex = parseCFFIndex(data, header.endOffset, parse.bytesToString)\n var topDictIndex = parseCFFIndex(data, nameIndex.endOffset)\n var stringIndex = parseCFFIndex(data, topDictIndex.endOffset, parse.bytesToString)\n var globalSubrIndex = parseCFFIndex(data, stringIndex.endOffset)\n font.gsubrs = globalSubrIndex.objects\n font.gsubrsBias = calcCFFSubroutineBias(font.gsubrs)\n\n var topDictArray = gatherCFFTopDicts(data, start, topDictIndex.objects, stringIndex.objects)\n if (topDictArray.length !== 1) {\n throw new Error(\n \"CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = \" + topDictArray.length,\n )\n }\n\n var topDict = topDictArray[0]\n font.tables.cff.topDict = topDict\n\n if (topDict._privateDict) {\n font.defaultWidthX = topDict._privateDict.defaultWidthX\n font.nominalWidthX = topDict._privateDict.nominalWidthX\n }\n\n if (topDict.ros[0] !== undefined && topDict.ros[1] !== undefined) {\n font.isCIDFont = true\n }\n\n if (font.isCIDFont) {\n var fdArrayOffset = topDict.fdArray\n var fdSelectOffset = topDict.fdSelect\n if (fdArrayOffset === 0 || fdSelectOffset === 0) {\n throw new Error('Font is marked as a CID font, but FDArray and/or FDSelect information is missing')\n }\n fdArrayOffset += start\n var fdArrayIndex = parseCFFIndex(data, fdArrayOffset)\n var fdArray = gatherCFFTopDicts(data, start, fdArrayIndex.objects, stringIndex.objects)\n topDict._fdArray = fdArray\n fdSelectOffset += start\n topDict._fdSelect = parseCFFFDSelect(data, fdSelectOffset, font.numGlyphs, fdArray.length)\n }\n\n var privateDictOffset = start + topDict.private[1]\n var privateDict = parseCFFPrivateDict(data, privateDictOffset, topDict.private[0], stringIndex.objects)\n font.defaultWidthX = privateDict.defaultWidthX\n font.nominalWidthX = privateDict.nominalWidthX\n\n if (privateDict.subrs !== 0) {\n var subrOffset = privateDictOffset + privateDict.subrs\n var subrIndex = parseCFFIndex(data, subrOffset)\n font.subrs = subrIndex.objects\n font.subrsBias = calcCFFSubroutineBias(font.subrs)\n } else {\n font.subrs = []\n font.subrsBias = 0\n }\n\n // Offsets in the top dict are relative to the beginning of the CFF data, so add the CFF start offset.\n var charStringsIndex\n if (opt.lowMemory) {\n charStringsIndex = parseCFFIndexLowMemory(data, start + topDict.charStrings)\n font.nGlyphs = charStringsIndex.offsets.length\n } else {\n charStringsIndex = parseCFFIndex(data, start + topDict.charStrings)\n font.nGlyphs = charStringsIndex.objects.length\n }\n\n var charset = parseCFFCharset(data, start + topDict.charset, font.nGlyphs, stringIndex.objects)\n if (topDict.encoding === 0) {\n // Standard encoding\n font.cffEncoding = new CffEncoding(cffStandardEncoding, charset)\n } else if (topDict.encoding === 1) {\n // Expert encoding\n font.cffEncoding = new CffEncoding(cffExpertEncoding, charset)\n } else {\n font.cffEncoding = parseCFFEncoding(data, start + topDict.encoding, charset)\n }\n\n // Prefer the CMAP encoding to the CFF encoding.\n font.encoding = font.encoding || font.cffEncoding\n\n font.glyphs = new glyphset.GlyphSet(font)\n if (opt.lowMemory) {\n font._push = function (i) {\n var charString = getCffIndexObject(i, charStringsIndex.offsets, data, start + topDict.charStrings)\n font.glyphs.push(i, glyphset.cffGlyphLoader(font, i, parseCFFCharstring, charString))\n }\n } else {\n for (var i = 0; i < font.nGlyphs; i += 1) {\n var charString = charStringsIndex.objects[i]\n font.glyphs.push(i, glyphset.cffGlyphLoader(font, i, parseCFFCharstring, charString))\n }\n }\n }\n\n // Convert a string to a String ID (SID).\n // The list of strings is modified in place.\n function encodeString(s, strings) {\n var sid\n\n // Is the string in the CFF standard strings?\n var i = cffStandardStrings.indexOf(s)\n if (i >= 0) {\n sid = i\n }\n\n // Is the string already in the string index?\n i = strings.indexOf(s)\n if (i >= 0) {\n sid = i + cffStandardStrings.length\n } else {\n sid = cffStandardStrings.length + strings.length\n strings.push(s)\n }\n\n return sid\n }\n\n function makeHeader() {\n return new table.Record('Header', [\n { name: 'major', type: 'Card8', value: 1 },\n { name: 'minor', type: 'Card8', value: 0 },\n { name: 'hdrSize', type: 'Card8', value: 4 },\n { name: 'major', type: 'Card8', value: 1 },\n ])\n }\n\n function makeNameIndex(fontNames) {\n var t = new table.Record('Name INDEX', [{ name: 'names', type: 'INDEX', value: [] }])\n t.names = []\n for (var i = 0; i < fontNames.length; i += 1) {\n t.names.push({ name: 'name_' + i, type: 'NAME', value: fontNames[i] })\n }\n\n return t\n }\n\n // Given a dictionary's metadata, create a DICT structure.\n function makeDict(meta, attrs, strings) {\n var m = {}\n for (var i = 0; i < meta.length; i += 1) {\n var entry = meta[i]\n var value = attrs[entry.name]\n if (value !== undefined && !equals(value, entry.value)) {\n if (entry.type === 'SID') {\n value = encodeString(value, strings)\n }\n\n m[entry.op] = { name: entry.name, type: entry.type, value: value }\n }\n }\n\n return m\n }\n\n // The Top DICT houses the global font attributes.\n function makeTopDict(attrs, strings) {\n var t = new table.Record('Top DICT', [{ name: 'dict', type: 'DICT', value: {} }])\n t.dict = makeDict(TOP_DICT_META, attrs, strings)\n return t\n }\n\n function makeTopDictIndex(topDict) {\n var t = new table.Record('Top DICT INDEX', [{ name: 'topDicts', type: 'INDEX', value: [] }])\n t.topDicts = [{ name: 'topDict_0', type: 'TABLE', value: topDict }]\n return t\n }\n\n function makeStringIndex(strings) {\n var t = new table.Record('String INDEX', [{ name: 'strings', type: 'INDEX', value: [] }])\n t.strings = []\n for (var i = 0; i < strings.length; i += 1) {\n t.strings.push({ name: 'string_' + i, type: 'STRING', value: strings[i] })\n }\n\n return t\n }\n\n function makeGlobalSubrIndex() {\n // Currently we don't use subroutines.\n return new table.Record('Global Subr INDEX', [{ name: 'subrs', type: 'INDEX', value: [] }])\n }\n\n function makeCharsets(glyphNames, strings) {\n var t = new table.Record('Charsets', [{ name: 'format', type: 'Card8', value: 0 }])\n for (var i = 0; i < glyphNames.length; i += 1) {\n var glyphName = glyphNames[i]\n var glyphSID = encodeString(glyphName, strings)\n t.fields.push({ name: 'glyph_' + i, type: 'SID', value: glyphSID })\n }\n\n return t\n }\n\n function glyphToOps(glyph) {\n var ops = []\n var path = glyph.path\n ops.push({ name: 'width', type: 'NUMBER', value: glyph.advanceWidth })\n var x = 0\n var y = 0\n for (var i = 0; i < path.commands.length; i += 1) {\n var dx = void 0\n var dy = void 0\n var cmd = path.commands[i]\n if (cmd.type === 'Q') {\n // CFF only supports bézier curves, so convert the quad to a bézier.\n var _13 = 1 / 3\n var _23 = 2 / 3\n\n // We're going to create a new command so we don't change the original path.\n // Since all coordinates are relative, we round() them ASAP to avoid propagating errors.\n cmd = {\n type: 'C',\n x: cmd.x,\n y: cmd.y,\n x1: Math.round(_13 * x + _23 * cmd.x1),\n y1: Math.round(_13 * y + _23 * cmd.y1),\n x2: Math.round(_13 * cmd.x + _23 * cmd.x1),\n y2: Math.round(_13 * cmd.y + _23 * cmd.y1),\n }\n }\n\n if (cmd.type === 'M') {\n dx = Math.round(cmd.x - x)\n dy = Math.round(cmd.y - y)\n ops.push({ name: 'dx', type: 'NUMBER', value: dx })\n ops.push({ name: 'dy', type: 'NUMBER', value: dy })\n ops.push({ name: 'rmoveto', type: 'OP', value: 21 })\n x = Math.round(cmd.x)\n y = Math.round(cmd.y)\n } else if (cmd.type === 'L') {\n dx = Math.round(cmd.x - x)\n dy = Math.round(cmd.y - y)\n ops.push({ name: 'dx', type: 'NUMBER', value: dx })\n ops.push({ name: 'dy', type: 'NUMBER', value: dy })\n ops.push({ name: 'rlineto', type: 'OP', value: 5 })\n x = Math.round(cmd.x)\n y = Math.round(cmd.y)\n } else if (cmd.type === 'C') {\n var dx1 = Math.round(cmd.x1 - x)\n var dy1 = Math.round(cmd.y1 - y)\n var dx2 = Math.round(cmd.x2 - cmd.x1)\n var dy2 = Math.round(cmd.y2 - cmd.y1)\n dx = Math.round(cmd.x - cmd.x2)\n dy = Math.round(cmd.y - cmd.y2)\n ops.push({ name: 'dx1', type: 'NUMBER', value: dx1 })\n ops.push({ name: 'dy1', type: 'NUMBER', value: dy1 })\n ops.push({ name: 'dx2', type: 'NUMBER', value: dx2 })\n ops.push({ name: 'dy2', type: 'NUMBER', value: dy2 })\n ops.push({ name: 'dx', type: 'NUMBER', value: dx })\n ops.push({ name: 'dy', type: 'NUMBER', value: dy })\n ops.push({ name: 'rrcurveto', type: 'OP', value: 8 })\n x = Math.round(cmd.x)\n y = Math.round(cmd.y)\n }\n\n // Contours are closed automatically.\n }\n\n ops.push({ name: 'endchar', type: 'OP', value: 14 })\n return ops\n }\n\n function makeCharStringsIndex(glyphs) {\n var t = new table.Record('CharStrings INDEX', [{ name: 'charStrings', type: 'INDEX', value: [] }])\n\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n var ops = glyphToOps(glyph)\n t.charStrings.push({ name: glyph.name, type: 'CHARSTRING', value: ops })\n }\n\n return t\n }\n\n function makePrivateDict(attrs, strings) {\n var t = new table.Record('Private DICT', [{ name: 'dict', type: 'DICT', value: {} }])\n t.dict = makeDict(PRIVATE_DICT_META, attrs, strings)\n return t\n }\n\n function makeCFFTable(glyphs, options) {\n var t = new table.Table('CFF ', [\n { name: 'header', type: 'RECORD' },\n { name: 'nameIndex', type: 'RECORD' },\n { name: 'topDictIndex', type: 'RECORD' },\n { name: 'stringIndex', type: 'RECORD' },\n { name: 'globalSubrIndex', type: 'RECORD' },\n { name: 'charsets', type: 'RECORD' },\n { name: 'charStringsIndex', type: 'RECORD' },\n { name: 'privateDict', type: 'RECORD' },\n ])\n\n var fontScale = 1 / options.unitsPerEm\n // We use non-zero values for the offsets so that the DICT encodes them.\n // This is important because the size of the Top DICT plays a role in offset calculation,\n // and the size shouldn't change after we've written correct offsets.\n var attrs = {\n version: options.version,\n fullName: options.fullName,\n familyName: options.familyName,\n weight: options.weightName,\n fontBBox: options.fontBBox || [0, 0, 0, 0],\n fontMatrix: [fontScale, 0, 0, fontScale, 0, 0],\n charset: 999,\n encoding: 0,\n charStrings: 999,\n private: [0, 999],\n }\n\n var privateAttrs = {}\n\n var glyphNames = []\n var glyph\n\n // Skip first glyph (.notdef)\n for (var i = 1; i < glyphs.length; i += 1) {\n glyph = glyphs.get(i)\n glyphNames.push(glyph.name)\n }\n\n var strings = []\n\n t.header = makeHeader()\n t.nameIndex = makeNameIndex([options.postScriptName])\n var topDict = makeTopDict(attrs, strings)\n t.topDictIndex = makeTopDictIndex(topDict)\n t.globalSubrIndex = makeGlobalSubrIndex()\n t.charsets = makeCharsets(glyphNames, strings)\n t.charStringsIndex = makeCharStringsIndex(glyphs)\n t.privateDict = makePrivateDict(privateAttrs, strings)\n\n // Needs to come at the end, to encode all custom strings used in the font.\n t.stringIndex = makeStringIndex(strings)\n\n var startOffset =\n t.header.sizeOf() +\n t.nameIndex.sizeOf() +\n t.topDictIndex.sizeOf() +\n t.stringIndex.sizeOf() +\n t.globalSubrIndex.sizeOf()\n attrs.charset = startOffset\n\n // We use the CFF standard encoding; proper encoding will be handled in cmap.\n attrs.encoding = 0\n attrs.charStrings = attrs.charset + t.charsets.sizeOf()\n attrs.private[1] = attrs.charStrings + t.charStringsIndex.sizeOf()\n\n // Recreate the Top DICT INDEX with the correct offsets.\n topDict = makeTopDict(attrs, strings)\n t.topDictIndex = makeTopDictIndex(topDict)\n\n return t\n }\n\n var cff = { parse: parseCFFTable, make: makeCFFTable }\n\n // The `head` table contains global information about the font.\n\n // Parse the header `head` table\n function parseHeadTable(data, start) {\n var head = {}\n var p = new parse.Parser(data, start)\n head.version = p.parseVersion()\n head.fontRevision = Math.round(p.parseFixed() * 1000) / 1000\n head.checkSumAdjustment = p.parseULong()\n head.magicNumber = p.parseULong()\n check.argument(head.magicNumber === 0x5f0f3cf5, 'Font header has wrong magic number.')\n head.flags = p.parseUShort()\n head.unitsPerEm = p.parseUShort()\n head.created = p.parseLongDateTime()\n head.modified = p.parseLongDateTime()\n head.xMin = p.parseShort()\n head.yMin = p.parseShort()\n head.xMax = p.parseShort()\n head.yMax = p.parseShort()\n head.macStyle = p.parseUShort()\n head.lowestRecPPEM = p.parseUShort()\n head.fontDirectionHint = p.parseShort()\n head.indexToLocFormat = p.parseShort()\n head.glyphDataFormat = p.parseShort()\n return head\n }\n\n function makeHeadTable(options) {\n // Apple Mac timestamp epoch is 01/01/1904 not 01/01/1970\n var timestamp = Math.round(new Date().getTime() / 1000) + 2082844800\n var createdTimestamp = timestamp\n\n if (options.createdTimestamp) {\n createdTimestamp = options.createdTimestamp + 2082844800\n }\n\n return new table.Table(\n 'head',\n [\n { name: 'version', type: 'FIXED', value: 0x00010000 },\n { name: 'fontRevision', type: 'FIXED', value: 0x00010000 },\n { name: 'checkSumAdjustment', type: 'ULONG', value: 0 },\n { name: 'magicNumber', type: 'ULONG', value: 0x5f0f3cf5 },\n { name: 'flags', type: 'USHORT', value: 0 },\n { name: 'unitsPerEm', type: 'USHORT', value: 1000 },\n { name: 'created', type: 'LONGDATETIME', value: createdTimestamp },\n { name: 'modified', type: 'LONGDATETIME', value: timestamp },\n { name: 'xMin', type: 'SHORT', value: 0 },\n { name: 'yMin', type: 'SHORT', value: 0 },\n { name: 'xMax', type: 'SHORT', value: 0 },\n { name: 'yMax', type: 'SHORT', value: 0 },\n { name: 'macStyle', type: 'USHORT', value: 0 },\n { name: 'lowestRecPPEM', type: 'USHORT', value: 0 },\n { name: 'fontDirectionHint', type: 'SHORT', value: 2 },\n { name: 'indexToLocFormat', type: 'SHORT', value: 0 },\n { name: 'glyphDataFormat', type: 'SHORT', value: 0 },\n ],\n options,\n )\n }\n\n var head = { parse: parseHeadTable, make: makeHeadTable }\n\n // The `hhea` table contains information for horizontal layout.\n\n // Parse the horizontal header `hhea` table\n function parseHheaTable(data, start) {\n var hhea = {}\n var p = new parse.Parser(data, start)\n hhea.version = p.parseVersion()\n hhea.ascender = p.parseShort()\n hhea.descender = p.parseShort()\n hhea.lineGap = p.parseShort()\n hhea.advanceWidthMax = p.parseUShort()\n hhea.minLeftSideBearing = p.parseShort()\n hhea.minRightSideBearing = p.parseShort()\n hhea.xMaxExtent = p.parseShort()\n hhea.caretSlopeRise = p.parseShort()\n hhea.caretSlopeRun = p.parseShort()\n hhea.caretOffset = p.parseShort()\n p.relativeOffset += 8\n hhea.metricDataFormat = p.parseShort()\n hhea.numberOfHMetrics = p.parseUShort()\n return hhea\n }\n\n function makeHheaTable(options) {\n return new table.Table(\n 'hhea',\n [\n { name: 'version', type: 'FIXED', value: 0x00010000 },\n { name: 'ascender', type: 'FWORD', value: 0 },\n { name: 'descender', type: 'FWORD', value: 0 },\n { name: 'lineGap', type: 'FWORD', value: 0 },\n { name: 'advanceWidthMax', type: 'UFWORD', value: 0 },\n { name: 'minLeftSideBearing', type: 'FWORD', value: 0 },\n { name: 'minRightSideBearing', type: 'FWORD', value: 0 },\n { name: 'xMaxExtent', type: 'FWORD', value: 0 },\n { name: 'caretSlopeRise', type: 'SHORT', value: 1 },\n { name: 'caretSlopeRun', type: 'SHORT', value: 0 },\n { name: 'caretOffset', type: 'SHORT', value: 0 },\n { name: 'reserved1', type: 'SHORT', value: 0 },\n { name: 'reserved2', type: 'SHORT', value: 0 },\n { name: 'reserved3', type: 'SHORT', value: 0 },\n { name: 'reserved4', type: 'SHORT', value: 0 },\n { name: 'metricDataFormat', type: 'SHORT', value: 0 },\n { name: 'numberOfHMetrics', type: 'USHORT', value: 0 },\n ],\n options,\n )\n }\n\n var hhea = { parse: parseHheaTable, make: makeHheaTable }\n\n // The `hmtx` table contains the horizontal metrics for all glyphs.\n\n function parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs) {\n var advanceWidth\n var leftSideBearing\n var p = new parse.Parser(data, start)\n for (var i = 0; i < numGlyphs; i += 1) {\n // If the font is monospaced, only one entry is needed. This last entry applies to all subsequent glyphs.\n if (i < numMetrics) {\n advanceWidth = p.parseUShort()\n leftSideBearing = p.parseShort()\n }\n\n var glyph = glyphs.get(i)\n glyph.advanceWidth = advanceWidth\n glyph.leftSideBearing = leftSideBearing\n }\n }\n\n function parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs) {\n font._hmtxTableData = {}\n\n var advanceWidth\n var leftSideBearing\n var p = new parse.Parser(data, start)\n for (var i = 0; i < numGlyphs; i += 1) {\n // If the font is monospaced, only one entry is needed. This last entry applies to all subsequent glyphs.\n if (i < numMetrics) {\n advanceWidth = p.parseUShort()\n leftSideBearing = p.parseShort()\n }\n\n font._hmtxTableData[i] = {\n advanceWidth: advanceWidth,\n leftSideBearing: leftSideBearing,\n }\n }\n }\n\n // Parse the `hmtx` table, which contains the horizontal metrics for all glyphs.\n // This function augments the glyph array, adding the advanceWidth and leftSideBearing to each glyph.\n function parseHmtxTable(font, data, start, numMetrics, numGlyphs, glyphs, opt) {\n if (opt.lowMemory) {\n parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs)\n } else {\n parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs)\n }\n }\n\n function makeHmtxTable(glyphs) {\n var t = new table.Table('hmtx', [])\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs.get(i)\n var advanceWidth = glyph.advanceWidth || 0\n var leftSideBearing = glyph.leftSideBearing || 0\n t.fields.push({ name: 'advanceWidth_' + i, type: 'USHORT', value: advanceWidth })\n t.fields.push({ name: 'leftSideBearing_' + i, type: 'SHORT', value: leftSideBearing })\n }\n\n return t\n }\n\n var hmtx = { parse: parseHmtxTable, make: makeHmtxTable }\n\n // The `ltag` table stores IETF BCP-47 language tags. It allows supporting\n\n function makeLtagTable(tags) {\n var result = new table.Table('ltag', [\n { name: 'version', type: 'ULONG', value: 1 },\n { name: 'flags', type: 'ULONG', value: 0 },\n { name: 'numTags', type: 'ULONG', value: tags.length },\n ])\n\n var stringPool = ''\n var stringPoolOffset = 12 + tags.length * 4\n for (var i = 0; i < tags.length; ++i) {\n var pos = stringPool.indexOf(tags[i])\n if (pos < 0) {\n pos = stringPool.length\n stringPool += tags[i]\n }\n\n result.fields.push({ name: 'offset ' + i, type: 'USHORT', value: stringPoolOffset + pos })\n result.fields.push({ name: 'length ' + i, type: 'USHORT', value: tags[i].length })\n }\n\n result.fields.push({ name: 'stringPool', type: 'CHARARRAY', value: stringPool })\n return result\n }\n\n function parseLtagTable(data, start) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseULong()\n check.argument(tableVersion === 1, 'Unsupported ltag table version.')\n // The 'ltag' specification does not define any flags; skip the field.\n p.skip('uLong', 1)\n var numTags = p.parseULong()\n\n var tags = []\n for (var i = 0; i < numTags; i++) {\n var tag = ''\n var offset = start + p.parseUShort()\n var length = p.parseUShort()\n for (var j = offset; j < offset + length; ++j) {\n tag += String.fromCharCode(data.getInt8(j))\n }\n\n tags.push(tag)\n }\n\n return tags\n }\n\n var ltag = { make: makeLtagTable, parse: parseLtagTable }\n\n // The `maxp` table establishes the memory requirements for the font.\n\n // Parse the maximum profile `maxp` table.\n function parseMaxpTable(data, start) {\n var maxp = {}\n var p = new parse.Parser(data, start)\n maxp.version = p.parseVersion()\n maxp.numGlyphs = p.parseUShort()\n if (maxp.version === 1.0) {\n maxp.maxPoints = p.parseUShort()\n maxp.maxContours = p.parseUShort()\n maxp.maxCompositePoints = p.parseUShort()\n maxp.maxCompositeContours = p.parseUShort()\n maxp.maxZones = p.parseUShort()\n maxp.maxTwilightPoints = p.parseUShort()\n maxp.maxStorage = p.parseUShort()\n maxp.maxFunctionDefs = p.parseUShort()\n maxp.maxInstructionDefs = p.parseUShort()\n maxp.maxStackElements = p.parseUShort()\n maxp.maxSizeOfInstructions = p.parseUShort()\n maxp.maxComponentElements = p.parseUShort()\n maxp.maxComponentDepth = p.parseUShort()\n }\n\n return maxp\n }\n\n function makeMaxpTable(numGlyphs) {\n return new table.Table('maxp', [\n { name: 'version', type: 'FIXED', value: 0x00005000 },\n { name: 'numGlyphs', type: 'USHORT', value: numGlyphs },\n ])\n }\n\n var maxp = { parse: parseMaxpTable, make: makeMaxpTable }\n\n // The `name` naming table.\n\n // NameIDs for the name table.\n var nameTableNames = [\n 'copyright', // 0\n 'fontFamily', // 1\n 'fontSubfamily', // 2\n 'uniqueID', // 3\n 'fullName', // 4\n 'version', // 5\n 'postScriptName', // 6\n 'trademark', // 7\n 'manufacturer', // 8\n 'designer', // 9\n 'description', // 10\n 'manufacturerURL', // 11\n 'designerURL', // 12\n 'license', // 13\n 'licenseURL', // 14\n 'reserved', // 15\n 'preferredFamily', // 16\n 'preferredSubfamily', // 17\n 'compatibleFullName', // 18\n 'sampleText', // 19\n 'postScriptFindFontName', // 20\n 'wwsFamily', // 21\n 'wwsSubfamily', // 22\n ]\n\n var macLanguages = {\n 0: 'en',\n 1: 'fr',\n 2: 'de',\n 3: 'it',\n 4: 'nl',\n 5: 'sv',\n 6: 'es',\n 7: 'da',\n 8: 'pt',\n 9: 'no',\n 10: 'he',\n 11: 'ja',\n 12: 'ar',\n 13: 'fi',\n 14: 'el',\n 15: 'is',\n 16: 'mt',\n 17: 'tr',\n 18: 'hr',\n 19: 'zh-Hant',\n 20: 'ur',\n 21: 'hi',\n 22: 'th',\n 23: 'ko',\n 24: 'lt',\n 25: 'pl',\n 26: 'hu',\n 27: 'es',\n 28: 'lv',\n 29: 'se',\n 30: 'fo',\n 31: 'fa',\n 32: 'ru',\n 33: 'zh',\n 34: 'nl-BE',\n 35: 'ga',\n 36: 'sq',\n 37: 'ro',\n 38: 'cz',\n 39: 'sk',\n 40: 'si',\n 41: 'yi',\n 42: 'sr',\n 43: 'mk',\n 44: 'bg',\n 45: 'uk',\n 46: 'be',\n 47: 'uz',\n 48: 'kk',\n 49: 'az-Cyrl',\n 50: 'az-Arab',\n 51: 'hy',\n 52: 'ka',\n 53: 'mo',\n 54: 'ky',\n 55: 'tg',\n 56: 'tk',\n 57: 'mn-CN',\n 58: 'mn',\n 59: 'ps',\n 60: 'ks',\n 61: 'ku',\n 62: 'sd',\n 63: 'bo',\n 64: 'ne',\n 65: 'sa',\n 66: 'mr',\n 67: 'bn',\n 68: 'as',\n 69: 'gu',\n 70: 'pa',\n 71: 'or',\n 72: 'ml',\n 73: 'kn',\n 74: 'ta',\n 75: 'te',\n 76: 'si',\n 77: 'my',\n 78: 'km',\n 79: 'lo',\n 80: 'vi',\n 81: 'id',\n 82: 'tl',\n 83: 'ms',\n 84: 'ms-Arab',\n 85: 'am',\n 86: 'ti',\n 87: 'om',\n 88: 'so',\n 89: 'sw',\n 90: 'rw',\n 91: 'rn',\n 92: 'ny',\n 93: 'mg',\n 94: 'eo',\n 128: 'cy',\n 129: 'eu',\n 130: 'ca',\n 131: 'la',\n 132: 'qu',\n 133: 'gn',\n 134: 'ay',\n 135: 'tt',\n 136: 'ug',\n 137: 'dz',\n 138: 'jv',\n 139: 'su',\n 140: 'gl',\n 141: 'af',\n 142: 'br',\n 143: 'iu',\n 144: 'gd',\n 145: 'gv',\n 146: 'ga',\n 147: 'to',\n 148: 'el-polyton',\n 149: 'kl',\n 150: 'az',\n 151: 'nn',\n }\n\n // MacOS language ID → MacOS script ID\n //\n // Note that the script ID is not sufficient to determine what encoding\n // to use in TrueType files. For some languages, MacOS used a modification\n // of a mainstream script. For example, an Icelandic name would be stored\n // with smRoman in the TrueType naming table, but the actual encoding\n // is a special Icelandic version of the normal Macintosh Roman encoding.\n // As another example, Inuktitut uses an 8-bit encoding for Canadian Aboriginal\n // Syllables but MacOS had run out of available script codes, so this was\n // done as a (pretty radical) \"modification\" of Ethiopic.\n //\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt\n var macLanguageToScript = {\n 0: 0, // langEnglish → smRoman\n 1: 0, // langFrench → smRoman\n 2: 0, // langGerman → smRoman\n 3: 0, // langItalian → smRoman\n 4: 0, // langDutch → smRoman\n 5: 0, // langSwedish → smRoman\n 6: 0, // langSpanish → smRoman\n 7: 0, // langDanish → smRoman\n 8: 0, // langPortuguese → smRoman\n 9: 0, // langNorwegian → smRoman\n 10: 5, // langHebrew → smHebrew\n 11: 1, // langJapanese → smJapanese\n 12: 4, // langArabic → smArabic\n 13: 0, // langFinnish → smRoman\n 14: 6, // langGreek → smGreek\n 15: 0, // langIcelandic → smRoman (modified)\n 16: 0, // langMaltese → smRoman\n 17: 0, // langTurkish → smRoman (modified)\n 18: 0, // langCroatian → smRoman (modified)\n 19: 2, // langTradChinese → smTradChinese\n 20: 4, // langUrdu → smArabic\n 21: 9, // langHindi → smDevanagari\n 22: 21, // langThai → smThai\n 23: 3, // langKorean → smKorean\n 24: 29, // langLithuanian → smCentralEuroRoman\n 25: 29, // langPolish → smCentralEuroRoman\n 26: 29, // langHungarian → smCentralEuroRoman\n 27: 29, // langEstonian → smCentralEuroRoman\n 28: 29, // langLatvian → smCentralEuroRoman\n 29: 0, // langSami → smRoman\n 30: 0, // langFaroese → smRoman (modified)\n 31: 4, // langFarsi → smArabic (modified)\n 32: 7, // langRussian → smCyrillic\n 33: 25, // langSimpChinese → smSimpChinese\n 34: 0, // langFlemish → smRoman\n 35: 0, // langIrishGaelic → smRoman (modified)\n 36: 0, // langAlbanian → smRoman\n 37: 0, // langRomanian → smRoman (modified)\n 38: 29, // langCzech → smCentralEuroRoman\n 39: 29, // langSlovak → smCentralEuroRoman\n 40: 0, // langSlovenian → smRoman (modified)\n 41: 5, // langYiddish → smHebrew\n 42: 7, // langSerbian → smCyrillic\n 43: 7, // langMacedonian → smCyrillic\n 44: 7, // langBulgarian → smCyrillic\n 45: 7, // langUkrainian → smCyrillic (modified)\n 46: 7, // langByelorussian → smCyrillic\n 47: 7, // langUzbek → smCyrillic\n 48: 7, // langKazakh → smCyrillic\n 49: 7, // langAzerbaijani → smCyrillic\n 50: 4, // langAzerbaijanAr → smArabic\n 51: 24, // langArmenian → smArmenian\n 52: 23, // langGeorgian → smGeorgian\n 53: 7, // langMoldavian → smCyrillic\n 54: 7, // langKirghiz → smCyrillic\n 55: 7, // langTajiki → smCyrillic\n 56: 7, // langTurkmen → smCyrillic\n 57: 27, // langMongolian → smMongolian\n 58: 7, // langMongolianCyr → smCyrillic\n 59: 4, // langPashto → smArabic\n 60: 4, // langKurdish → smArabic\n 61: 4, // langKashmiri → smArabic\n 62: 4, // langSindhi → smArabic\n 63: 26, // langTibetan → smTibetan\n 64: 9, // langNepali → smDevanagari\n 65: 9, // langSanskrit → smDevanagari\n 66: 9, // langMarathi → smDevanagari\n 67: 13, // langBengali → smBengali\n 68: 13, // langAssamese → smBengali\n 69: 11, // langGujarati → smGujarati\n 70: 10, // langPunjabi → smGurmukhi\n 71: 12, // langOriya → smOriya\n 72: 17, // langMalayalam → smMalayalam\n 73: 16, // langKannada → smKannada\n 74: 14, // langTamil → smTamil\n 75: 15, // langTelugu → smTelugu\n 76: 18, // langSinhalese → smSinhalese\n 77: 19, // langBurmese → smBurmese\n 78: 20, // langKhmer → smKhmer\n 79: 22, // langLao → smLao\n 80: 30, // langVietnamese → smVietnamese\n 81: 0, // langIndonesian → smRoman\n 82: 0, // langTagalog → smRoman\n 83: 0, // langMalayRoman → smRoman\n 84: 4, // langMalayArabic → smArabic\n 85: 28, // langAmharic → smEthiopic\n 86: 28, // langTigrinya → smEthiopic\n 87: 28, // langOromo → smEthiopic\n 88: 0, // langSomali → smRoman\n 89: 0, // langSwahili → smRoman\n 90: 0, // langKinyarwanda → smRoman\n 91: 0, // langRundi → smRoman\n 92: 0, // langNyanja → smRoman\n 93: 0, // langMalagasy → smRoman\n 94: 0, // langEsperanto → smRoman\n 128: 0, // langWelsh → smRoman (modified)\n 129: 0, // langBasque → smRoman\n 130: 0, // langCatalan → smRoman\n 131: 0, // langLatin → smRoman\n 132: 0, // langQuechua → smRoman\n 133: 0, // langGuarani → smRoman\n 134: 0, // langAymara → smRoman\n 135: 7, // langTatar → smCyrillic\n 136: 4, // langUighur → smArabic\n 137: 26, // langDzongkha → smTibetan\n 138: 0, // langJavaneseRom → smRoman\n 139: 0, // langSundaneseRom → smRoman\n 140: 0, // langGalician → smRoman\n 141: 0, // langAfrikaans → smRoman\n 142: 0, // langBreton → smRoman (modified)\n 143: 28, // langInuktitut → smEthiopic (modified)\n 144: 0, // langScottishGaelic → smRoman (modified)\n 145: 0, // langManxGaelic → smRoman (modified)\n 146: 0, // langIrishGaelicScript → smRoman (modified)\n 147: 0, // langTongan → smRoman\n 148: 6, // langGreekAncient → smRoman\n 149: 0, // langGreenlandic → smRoman\n 150: 0, // langAzerbaijanRoman → smRoman\n 151: 0, // langNynorsk → smRoman\n }\n\n // While Microsoft indicates a region/country for all its language\n // IDs, we omit the region code if it's equal to the \"most likely\n // region subtag\" according to Unicode CLDR. For scripts, we omit\n // the subtag if it is equal to the Suppress-Script entry in the\n // IANA language subtag registry for IETF BCP 47.\n //\n // For example, Microsoft states that its language code 0x041A is\n // Croatian in Croatia. We transform this to the BCP 47 language code 'hr'\n // and not 'hr-HR' because Croatia is the default country for Croatian,\n // according to Unicode CLDR. As another example, Microsoft states\n // that 0x101A is Croatian (Latin) in Bosnia-Herzegovina. We transform\n // this to 'hr-BA' and not 'hr-Latn-BA' because Latin is the default script\n // for the Croatian language, according to IANA.\n //\n // http://www.unicode.org/cldr/charts/latest/supplemental/likely_subtags.html\n // http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry\n var windowsLanguages = {\n 0x0436: 'af',\n 0x041c: 'sq',\n 0x0484: 'gsw',\n 0x045e: 'am',\n 0x1401: 'ar-DZ',\n 0x3c01: 'ar-BH',\n 0x0c01: 'ar',\n 0x0801: 'ar-IQ',\n 0x2c01: 'ar-JO',\n 0x3401: 'ar-KW',\n 0x3001: 'ar-LB',\n 0x1001: 'ar-LY',\n 0x1801: 'ary',\n 0x2001: 'ar-OM',\n 0x4001: 'ar-QA',\n 0x0401: 'ar-SA',\n 0x2801: 'ar-SY',\n 0x1c01: 'aeb',\n 0x3801: 'ar-AE',\n 0x2401: 'ar-YE',\n 0x042b: 'hy',\n 0x044d: 'as',\n 0x082c: 'az-Cyrl',\n 0x042c: 'az',\n 0x046d: 'ba',\n 0x042d: 'eu',\n 0x0423: 'be',\n 0x0845: 'bn',\n 0x0445: 'bn-IN',\n 0x201a: 'bs-Cyrl',\n 0x141a: 'bs',\n 0x047e: 'br',\n 0x0402: 'bg',\n 0x0403: 'ca',\n 0x0c04: 'zh-HK',\n 0x1404: 'zh-MO',\n 0x0804: 'zh',\n 0x1004: 'zh-SG',\n 0x0404: 'zh-TW',\n 0x0483: 'co',\n 0x041a: 'hr',\n 0x101a: 'hr-BA',\n 0x0405: 'cs',\n 0x0406: 'da',\n 0x048c: 'prs',\n 0x0465: 'dv',\n 0x0813: 'nl-BE',\n 0x0413: 'nl',\n 0x0c09: 'en-AU',\n 0x2809: 'en-BZ',\n 0x1009: 'en-CA',\n 0x2409: 'en-029',\n 0x4009: 'en-IN',\n 0x1809: 'en-IE',\n 0x2009: 'en-JM',\n 0x4409: 'en-MY',\n 0x1409: 'en-NZ',\n 0x3409: 'en-PH',\n 0x4809: 'en-SG',\n 0x1c09: 'en-ZA',\n 0x2c09: 'en-TT',\n 0x0809: 'en-GB',\n 0x0409: 'en',\n 0x3009: 'en-ZW',\n 0x0425: 'et',\n 0x0438: 'fo',\n 0x0464: 'fil',\n 0x040b: 'fi',\n 0x080c: 'fr-BE',\n 0x0c0c: 'fr-CA',\n 0x040c: 'fr',\n 0x140c: 'fr-LU',\n 0x180c: 'fr-MC',\n 0x100c: 'fr-CH',\n 0x0462: 'fy',\n 0x0456: 'gl',\n 0x0437: 'ka',\n 0x0c07: 'de-AT',\n 0x0407: 'de',\n 0x1407: 'de-LI',\n 0x1007: 'de-LU',\n 0x0807: 'de-CH',\n 0x0408: 'el',\n 0x046f: 'kl',\n 0x0447: 'gu',\n 0x0468: 'ha',\n 0x040d: 'he',\n 0x0439: 'hi',\n 0x040e: 'hu',\n 0x040f: 'is',\n 0x0470: 'ig',\n 0x0421: 'id',\n 0x045d: 'iu',\n 0x085d: 'iu-Latn',\n 0x083c: 'ga',\n 0x0434: 'xh',\n 0x0435: 'zu',\n 0x0410: 'it',\n 0x0810: 'it-CH',\n 0x0411: 'ja',\n 0x044b: 'kn',\n 0x043f: 'kk',\n 0x0453: 'km',\n 0x0486: 'quc',\n 0x0487: 'rw',\n 0x0441: 'sw',\n 0x0457: 'kok',\n 0x0412: 'ko',\n 0x0440: 'ky',\n 0x0454: 'lo',\n 0x0426: 'lv',\n 0x0427: 'lt',\n 0x082e: 'dsb',\n 0x046e: 'lb',\n 0x042f: 'mk',\n 0x083e: 'ms-BN',\n 0x043e: 'ms',\n 0x044c: 'ml',\n 0x043a: 'mt',\n 0x0481: 'mi',\n 0x047a: 'arn',\n 0x044e: 'mr',\n 0x047c: 'moh',\n 0x0450: 'mn',\n 0x0850: 'mn-CN',\n 0x0461: 'ne',\n 0x0414: 'nb',\n 0x0814: 'nn',\n 0x0482: 'oc',\n 0x0448: 'or',\n 0x0463: 'ps',\n 0x0415: 'pl',\n 0x0416: 'pt',\n 0x0816: 'pt-PT',\n 0x0446: 'pa',\n 0x046b: 'qu-BO',\n 0x086b: 'qu-EC',\n 0x0c6b: 'qu',\n 0x0418: 'ro',\n 0x0417: 'rm',\n 0x0419: 'ru',\n 0x243b: 'smn',\n 0x103b: 'smj-NO',\n 0x143b: 'smj',\n 0x0c3b: 'se-FI',\n 0x043b: 'se',\n 0x083b: 'se-SE',\n 0x203b: 'sms',\n 0x183b: 'sma-NO',\n 0x1c3b: 'sms',\n 0x044f: 'sa',\n 0x1c1a: 'sr-Cyrl-BA',\n 0x0c1a: 'sr',\n 0x181a: 'sr-Latn-BA',\n 0x081a: 'sr-Latn',\n 0x046c: 'nso',\n 0x0432: 'tn',\n 0x045b: 'si',\n 0x041b: 'sk',\n 0x0424: 'sl',\n 0x2c0a: 'es-AR',\n 0x400a: 'es-BO',\n 0x340a: 'es-CL',\n 0x240a: 'es-CO',\n 0x140a: 'es-CR',\n 0x1c0a: 'es-DO',\n 0x300a: 'es-EC',\n 0x440a: 'es-SV',\n 0x100a: 'es-GT',\n 0x480a: 'es-HN',\n 0x080a: 'es-MX',\n 0x4c0a: 'es-NI',\n 0x180a: 'es-PA',\n 0x3c0a: 'es-PY',\n 0x280a: 'es-PE',\n 0x500a: 'es-PR',\n\n // Microsoft has defined two different language codes for\n // “Spanish with modern sorting” and “Spanish with traditional\n // sorting”. This makes sense for collation APIs, and it would be\n // possible to express this in BCP 47 language tags via Unicode\n // extensions (eg., es-u-co-trad is Spanish with traditional\n // sorting). However, for storing names in fonts, the distinction\n // does not make sense, so we give “es” in both cases.\n 0x0c0a: 'es',\n 0x040a: 'es',\n\n 0x540a: 'es-US',\n 0x380a: 'es-UY',\n 0x200a: 'es-VE',\n 0x081d: 'sv-FI',\n 0x041d: 'sv',\n 0x045a: 'syr',\n 0x0428: 'tg',\n 0x085f: 'tzm',\n 0x0449: 'ta',\n 0x0444: 'tt',\n 0x044a: 'te',\n 0x041e: 'th',\n 0x0451: 'bo',\n 0x041f: 'tr',\n 0x0442: 'tk',\n 0x0480: 'ug',\n 0x0422: 'uk',\n 0x042e: 'hsb',\n 0x0420: 'ur',\n 0x0843: 'uz-Cyrl',\n 0x0443: 'uz',\n 0x042a: 'vi',\n 0x0452: 'cy',\n 0x0488: 'wo',\n 0x0485: 'sah',\n 0x0478: 'ii',\n 0x046a: 'yo',\n }\n\n // Returns a IETF BCP 47 language code, for example 'zh-Hant'\n // for 'Chinese in the traditional script'.\n function getLanguageCode(platformID, languageID, ltag) {\n switch (platformID) {\n case 0: // Unicode\n if (languageID === 0xffff) {\n return 'und'\n } else if (ltag) {\n return ltag[languageID]\n }\n\n break\n\n case 1: // Macintosh\n return macLanguages[languageID]\n\n case 3: // Windows\n return windowsLanguages[languageID]\n }\n\n return undefined\n }\n\n var utf16 = 'utf-16'\n\n // MacOS script ID → encoding. This table stores the default case,\n // which can be overridden by macLanguageEncodings.\n var macScriptEncodings = {\n 0: 'macintosh', // smRoman\n 1: 'x-mac-japanese', // smJapanese\n 2: 'x-mac-chinesetrad', // smTradChinese\n 3: 'x-mac-korean', // smKorean\n 6: 'x-mac-greek', // smGreek\n 7: 'x-mac-cyrillic', // smCyrillic\n 9: 'x-mac-devanagai', // smDevanagari\n 10: 'x-mac-gurmukhi', // smGurmukhi\n 11: 'x-mac-gujarati', // smGujarati\n 12: 'x-mac-oriya', // smOriya\n 13: 'x-mac-bengali', // smBengali\n 14: 'x-mac-tamil', // smTamil\n 15: 'x-mac-telugu', // smTelugu\n 16: 'x-mac-kannada', // smKannada\n 17: 'x-mac-malayalam', // smMalayalam\n 18: 'x-mac-sinhalese', // smSinhalese\n 19: 'x-mac-burmese', // smBurmese\n 20: 'x-mac-khmer', // smKhmer\n 21: 'x-mac-thai', // smThai\n 22: 'x-mac-lao', // smLao\n 23: 'x-mac-georgian', // smGeorgian\n 24: 'x-mac-armenian', // smArmenian\n 25: 'x-mac-chinesesimp', // smSimpChinese\n 26: 'x-mac-tibetan', // smTibetan\n 27: 'x-mac-mongolian', // smMongolian\n 28: 'x-mac-ethiopic', // smEthiopic\n 29: 'x-mac-ce', // smCentralEuroRoman\n 30: 'x-mac-vietnamese', // smVietnamese\n 31: 'x-mac-extarabic', // smExtArabic\n }\n\n // MacOS language ID → encoding. This table stores the exceptional\n // cases, which override macScriptEncodings. For writing MacOS naming\n // tables, we need to emit a MacOS script ID. Therefore, we cannot\n // merge macScriptEncodings into macLanguageEncodings.\n //\n // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt\n var macLanguageEncodings = {\n 15: 'x-mac-icelandic', // langIcelandic\n 17: 'x-mac-turkish', // langTurkish\n 18: 'x-mac-croatian', // langCroatian\n 24: 'x-mac-ce', // langLithuanian\n 25: 'x-mac-ce', // langPolish\n 26: 'x-mac-ce', // langHungarian\n 27: 'x-mac-ce', // langEstonian\n 28: 'x-mac-ce', // langLatvian\n 30: 'x-mac-icelandic', // langFaroese\n 37: 'x-mac-romanian', // langRomanian\n 38: 'x-mac-ce', // langCzech\n 39: 'x-mac-ce', // langSlovak\n 40: 'x-mac-ce', // langSlovenian\n 143: 'x-mac-inuit', // langInuktitut\n 146: 'x-mac-gaelic', // langIrishGaelicScript\n }\n\n function getEncoding(platformID, encodingID, languageID) {\n switch (platformID) {\n case 0: // Unicode\n return utf16\n\n case 1: // Apple Macintosh\n return macLanguageEncodings[languageID] || macScriptEncodings[encodingID]\n\n case 3: // Microsoft Windows\n if (encodingID === 1 || encodingID === 10) {\n return utf16\n }\n\n break\n }\n\n return undefined\n }\n\n // Parse the naming `name` table.\n // FIXME: Format 1 additional fields are not supported yet.\n // ltag is the content of the `ltag' table, such as ['en', 'zh-Hans', 'de-CH-1904'].\n function parseNameTable(data, start, ltag) {\n var name = {}\n var p = new parse.Parser(data, start)\n var format = p.parseUShort()\n var count = p.parseUShort()\n var stringOffset = p.offset + p.parseUShort()\n for (var i = 0; i < count; i++) {\n var platformID = p.parseUShort()\n var encodingID = p.parseUShort()\n var languageID = p.parseUShort()\n var nameID = p.parseUShort()\n var property = nameTableNames[nameID] || nameID\n var byteLength = p.parseUShort()\n var offset = p.parseUShort()\n var language = getLanguageCode(platformID, languageID, ltag)\n var encoding = getEncoding(platformID, encodingID, languageID)\n if (encoding !== undefined && language !== undefined) {\n var text = void 0\n if (encoding === utf16) {\n text = decode.UTF16(data, stringOffset + offset, byteLength)\n } else {\n text = decode.MACSTRING(data, stringOffset + offset, byteLength, encoding)\n }\n\n if (text) {\n var translations = name[property]\n if (translations === undefined) {\n translations = name[property] = {}\n }\n\n translations[language] = text\n }\n }\n }\n\n var langTagCount = 0\n if (format === 1) {\n // FIXME: Also handle Microsoft's 'name' table 1.\n langTagCount = p.parseUShort()\n }\n\n return name\n }\n\n // {23: 'foo'} → {'foo': 23}\n // ['bar', 'baz'] → {'bar': 0, 'baz': 1}\n function reverseDict(dict) {\n var result = {}\n for (var key in dict) {\n result[dict[key]] = parseInt(key)\n }\n\n return result\n }\n\n function makeNameRecord(platformID, encodingID, languageID, nameID, length, offset) {\n return new table.Record('NameRecord', [\n { name: 'platformID', type: 'USHORT', value: platformID },\n { name: 'encodingID', type: 'USHORT', value: encodingID },\n { name: 'languageID', type: 'USHORT', value: languageID },\n { name: 'nameID', type: 'USHORT', value: nameID },\n { name: 'length', type: 'USHORT', value: length },\n { name: 'offset', type: 'USHORT', value: offset },\n ])\n }\n\n // Finds the position of needle in haystack, or -1 if not there.\n // Like String.indexOf(), but for arrays.\n function findSubArray(needle, haystack) {\n var needleLength = needle.length\n var limit = haystack.length - needleLength + 1\n\n loop: for (var pos = 0; pos < limit; pos++) {\n for (; pos < limit; pos++) {\n for (var k = 0; k < needleLength; k++) {\n if (haystack[pos + k] !== needle[k]) {\n continue loop\n }\n }\n\n return pos\n }\n }\n\n return -1\n }\n\n function addStringToPool(s, pool) {\n var offset = findSubArray(s, pool)\n if (offset < 0) {\n offset = pool.length\n var i = 0\n var len = s.length\n for (; i < len; ++i) {\n pool.push(s[i])\n }\n }\n\n return offset\n }\n\n function makeNameTable(names, ltag) {\n var nameID\n var nameIDs = []\n\n var namesWithNumericKeys = {}\n var nameTableIds = reverseDict(nameTableNames)\n for (var key in names) {\n var id = nameTableIds[key]\n if (id === undefined) {\n id = key\n }\n\n nameID = parseInt(id)\n\n if (isNaN(nameID)) {\n throw new Error('Name table entry \"' + key + '\" does not exist, see nameTableNames for complete list.')\n }\n\n namesWithNumericKeys[nameID] = names[key]\n nameIDs.push(nameID)\n }\n\n var macLanguageIds = reverseDict(macLanguages)\n var windowsLanguageIds = reverseDict(windowsLanguages)\n\n var nameRecords = []\n var stringPool = []\n\n for (var i = 0; i < nameIDs.length; i++) {\n nameID = nameIDs[i]\n var translations = namesWithNumericKeys[nameID]\n for (var lang in translations) {\n var text = translations[lang]\n\n // For MacOS, we try to emit the name in the form that was introduced\n // in the initial version of the TrueType spec (in the late 1980s).\n // However, this can fail for various reasons: the requested BCP 47\n // language code might not have an old-style Mac equivalent;\n // we might not have a codec for the needed character encoding;\n // or the name might contain characters that cannot be expressed\n // in the old-style Macintosh encoding. In case of failure, we emit\n // the name in a more modern fashion (Unicode encoding with BCP 47\n // language tags) that is recognized by MacOS 10.5, released in 2009.\n // If fonts were only read by operating systems, we could simply\n // emit all names in the modern form; this would be much easier.\n // However, there are many applications and libraries that read\n // 'name' tables directly, and these will usually only recognize\n // the ancient form (silently skipping the unrecognized names).\n var macPlatform = 1 // Macintosh\n var macLanguage = macLanguageIds[lang]\n var macScript = macLanguageToScript[macLanguage]\n var macEncoding = getEncoding(macPlatform, macScript, macLanguage)\n var macName = encode.MACSTRING(text, macEncoding)\n if (macName === undefined) {\n macPlatform = 0 // Unicode\n macLanguage = ltag.indexOf(lang)\n if (macLanguage < 0) {\n macLanguage = ltag.length\n ltag.push(lang)\n }\n\n macScript = 4 // Unicode 2.0 and later\n macName = encode.UTF16(text)\n }\n\n var macNameOffset = addStringToPool(macName, stringPool)\n nameRecords.push(makeNameRecord(macPlatform, macScript, macLanguage, nameID, macName.length, macNameOffset))\n\n var winLanguage = windowsLanguageIds[lang]\n if (winLanguage !== undefined) {\n var winName = encode.UTF16(text)\n var winNameOffset = addStringToPool(winName, stringPool)\n nameRecords.push(makeNameRecord(3, 1, winLanguage, nameID, winName.length, winNameOffset))\n }\n }\n }\n\n nameRecords.sort(function (a, b) {\n return (\n a.platformID - b.platformID || a.encodingID - b.encodingID || a.languageID - b.languageID || a.nameID - b.nameID\n )\n })\n\n var t = new table.Table('name', [\n { name: 'format', type: 'USHORT', value: 0 },\n { name: 'count', type: 'USHORT', value: nameRecords.length },\n { name: 'stringOffset', type: 'USHORT', value: 6 + nameRecords.length * 12 },\n ])\n\n for (var r = 0; r < nameRecords.length; r++) {\n t.fields.push({ name: 'record_' + r, type: 'RECORD', value: nameRecords[r] })\n }\n\n t.fields.push({ name: 'strings', type: 'LITERAL', value: stringPool })\n return t\n }\n\n var _name = { parse: parseNameTable, make: makeNameTable }\n\n // The `OS/2` table contains metrics required in OpenType fonts.\n\n var unicodeRanges = [\n { begin: 0x0000, end: 0x007f }, // Basic Latin\n { begin: 0x0080, end: 0x00ff }, // Latin-1 Supplement\n { begin: 0x0100, end: 0x017f }, // Latin Extended-A\n { begin: 0x0180, end: 0x024f }, // Latin Extended-B\n { begin: 0x0250, end: 0x02af }, // IPA Extensions\n { begin: 0x02b0, end: 0x02ff }, // Spacing Modifier Letters\n { begin: 0x0300, end: 0x036f }, // Combining Diacritical Marks\n { begin: 0x0370, end: 0x03ff }, // Greek and Coptic\n { begin: 0x2c80, end: 0x2cff }, // Coptic\n { begin: 0x0400, end: 0x04ff }, // Cyrillic\n { begin: 0x0530, end: 0x058f }, // Armenian\n { begin: 0x0590, end: 0x05ff }, // Hebrew\n { begin: 0xa500, end: 0xa63f }, // Vai\n { begin: 0x0600, end: 0x06ff }, // Arabic\n { begin: 0x07c0, end: 0x07ff }, // NKo\n { begin: 0x0900, end: 0x097f }, // Devanagari\n { begin: 0x0980, end: 0x09ff }, // Bengali\n { begin: 0x0a00, end: 0x0a7f }, // Gurmukhi\n { begin: 0x0a80, end: 0x0aff }, // Gujarati\n { begin: 0x0b00, end: 0x0b7f }, // Oriya\n { begin: 0x0b80, end: 0x0bff }, // Tamil\n { begin: 0x0c00, end: 0x0c7f }, // Telugu\n { begin: 0x0c80, end: 0x0cff }, // Kannada\n { begin: 0x0d00, end: 0x0d7f }, // Malayalam\n { begin: 0x0e00, end: 0x0e7f }, // Thai\n { begin: 0x0e80, end: 0x0eff }, // Lao\n { begin: 0x10a0, end: 0x10ff }, // Georgian\n { begin: 0x1b00, end: 0x1b7f }, // Balinese\n { begin: 0x1100, end: 0x11ff }, // Hangul Jamo\n { begin: 0x1e00, end: 0x1eff }, // Latin Extended Additional\n { begin: 0x1f00, end: 0x1fff }, // Greek Extended\n { begin: 0x2000, end: 0x206f }, // General Punctuation\n { begin: 0x2070, end: 0x209f }, // Superscripts And Subscripts\n { begin: 0x20a0, end: 0x20cf }, // Currency Symbol\n { begin: 0x20d0, end: 0x20ff }, // Combining Diacritical Marks For Symbols\n { begin: 0x2100, end: 0x214f }, // Letterlike Symbols\n { begin: 0x2150, end: 0x218f }, // Number Forms\n { begin: 0x2190, end: 0x21ff }, // Arrows\n { begin: 0x2200, end: 0x22ff }, // Mathematical Operators\n { begin: 0x2300, end: 0x23ff }, // Miscellaneous Technical\n { begin: 0x2400, end: 0x243f }, // Control Pictures\n { begin: 0x2440, end: 0x245f }, // Optical Character Recognition\n { begin: 0x2460, end: 0x24ff }, // Enclosed Alphanumerics\n { begin: 0x2500, end: 0x257f }, // Box Drawing\n { begin: 0x2580, end: 0x259f }, // Block Elements\n { begin: 0x25a0, end: 0x25ff }, // Geometric Shapes\n { begin: 0x2600, end: 0x26ff }, // Miscellaneous Symbols\n { begin: 0x2700, end: 0x27bf }, // Dingbats\n { begin: 0x3000, end: 0x303f }, // CJK Symbols And Punctuation\n { begin: 0x3040, end: 0x309f }, // Hiragana\n { begin: 0x30a0, end: 0x30ff }, // Katakana\n { begin: 0x3100, end: 0x312f }, // Bopomofo\n { begin: 0x3130, end: 0x318f }, // Hangul Compatibility Jamo\n { begin: 0xa840, end: 0xa87f }, // Phags-pa\n { begin: 0x3200, end: 0x32ff }, // Enclosed CJK Letters And Months\n { begin: 0x3300, end: 0x33ff }, // CJK Compatibility\n { begin: 0xac00, end: 0xd7af }, // Hangul Syllables\n { begin: 0xd800, end: 0xdfff }, // Non-Plane 0 *\n { begin: 0x10900, end: 0x1091f }, // Phoenicia\n { begin: 0x4e00, end: 0x9fff }, // CJK Unified Ideographs\n { begin: 0xe000, end: 0xf8ff }, // Private Use Area (plane 0)\n { begin: 0x31c0, end: 0x31ef }, // CJK Strokes\n { begin: 0xfb00, end: 0xfb4f }, // Alphabetic Presentation Forms\n { begin: 0xfb50, end: 0xfdff }, // Arabic Presentation Forms-A\n { begin: 0xfe20, end: 0xfe2f }, // Combining Half Marks\n { begin: 0xfe10, end: 0xfe1f }, // Vertical Forms\n { begin: 0xfe50, end: 0xfe6f }, // Small Form Variants\n { begin: 0xfe70, end: 0xfeff }, // Arabic Presentation Forms-B\n { begin: 0xff00, end: 0xffef }, // Halfwidth And Fullwidth Forms\n { begin: 0xfff0, end: 0xffff }, // Specials\n { begin: 0x0f00, end: 0x0fff }, // Tibetan\n { begin: 0x0700, end: 0x074f }, // Syriac\n { begin: 0x0780, end: 0x07bf }, // Thaana\n { begin: 0x0d80, end: 0x0dff }, // Sinhala\n { begin: 0x1000, end: 0x109f }, // Myanmar\n { begin: 0x1200, end: 0x137f }, // Ethiopic\n { begin: 0x13a0, end: 0x13ff }, // Cherokee\n { begin: 0x1400, end: 0x167f }, // Unified Canadian Aboriginal Syllabics\n { begin: 0x1680, end: 0x169f }, // Ogham\n { begin: 0x16a0, end: 0x16ff }, // Runic\n { begin: 0x1780, end: 0x17ff }, // Khmer\n { begin: 0x1800, end: 0x18af }, // Mongolian\n { begin: 0x2800, end: 0x28ff }, // Braille Patterns\n { begin: 0xa000, end: 0xa48f }, // Yi Syllables\n { begin: 0x1700, end: 0x171f }, // Tagalog\n { begin: 0x10300, end: 0x1032f }, // Old Italic\n { begin: 0x10330, end: 0x1034f }, // Gothic\n { begin: 0x10400, end: 0x1044f }, // Deseret\n { begin: 0x1d000, end: 0x1d0ff }, // Byzantine Musical Symbols\n { begin: 0x1d400, end: 0x1d7ff }, // Mathematical Alphanumeric Symbols\n { begin: 0xff000, end: 0xffffd }, // Private Use (plane 15)\n { begin: 0xfe00, end: 0xfe0f }, // Variation Selectors\n { begin: 0xe0000, end: 0xe007f }, // Tags\n { begin: 0x1900, end: 0x194f }, // Limbu\n { begin: 0x1950, end: 0x197f }, // Tai Le\n { begin: 0x1980, end: 0x19df }, // New Tai Lue\n { begin: 0x1a00, end: 0x1a1f }, // Buginese\n { begin: 0x2c00, end: 0x2c5f }, // Glagolitic\n { begin: 0x2d30, end: 0x2d7f }, // Tifinagh\n { begin: 0x4dc0, end: 0x4dff }, // Yijing Hexagram Symbols\n { begin: 0xa800, end: 0xa82f }, // Syloti Nagri\n { begin: 0x10000, end: 0x1007f }, // Linear B Syllabary\n { begin: 0x10140, end: 0x1018f }, // Ancient Greek Numbers\n { begin: 0x10380, end: 0x1039f }, // Ugaritic\n { begin: 0x103a0, end: 0x103df }, // Old Persian\n { begin: 0x10450, end: 0x1047f }, // Shavian\n { begin: 0x10480, end: 0x104af }, // Osmanya\n { begin: 0x10800, end: 0x1083f }, // Cypriot Syllabary\n { begin: 0x10a00, end: 0x10a5f }, // Kharoshthi\n { begin: 0x1d300, end: 0x1d35f }, // Tai Xuan Jing Symbols\n { begin: 0x12000, end: 0x123ff }, // Cuneiform\n { begin: 0x1d360, end: 0x1d37f }, // Counting Rod Numerals\n { begin: 0x1b80, end: 0x1bbf }, // Sundanese\n { begin: 0x1c00, end: 0x1c4f }, // Lepcha\n { begin: 0x1c50, end: 0x1c7f }, // Ol Chiki\n { begin: 0xa880, end: 0xa8df }, // Saurashtra\n { begin: 0xa900, end: 0xa92f }, // Kayah Li\n { begin: 0xa930, end: 0xa95f }, // Rejang\n { begin: 0xaa00, end: 0xaa5f }, // Cham\n { begin: 0x10190, end: 0x101cf }, // Ancient Symbols\n { begin: 0x101d0, end: 0x101ff }, // Phaistos Disc\n { begin: 0x102a0, end: 0x102df }, // Carian\n { begin: 0x1f030, end: 0x1f09f }, // Domino Tiles\n ]\n\n function getUnicodeRange(unicode) {\n for (var i = 0; i < unicodeRanges.length; i += 1) {\n var range = unicodeRanges[i]\n if (unicode >= range.begin && unicode < range.end) {\n return i\n }\n }\n\n return -1\n }\n\n // Parse the OS/2 and Windows metrics `OS/2` table\n function parseOS2Table(data, start) {\n var os2 = {}\n var p = new parse.Parser(data, start)\n os2.version = p.parseUShort()\n os2.xAvgCharWidth = p.parseShort()\n os2.usWeightClass = p.parseUShort()\n os2.usWidthClass = p.parseUShort()\n os2.fsType = p.parseUShort()\n os2.ySubscriptXSize = p.parseShort()\n os2.ySubscriptYSize = p.parseShort()\n os2.ySubscriptXOffset = p.parseShort()\n os2.ySubscriptYOffset = p.parseShort()\n os2.ySuperscriptXSize = p.parseShort()\n os2.ySuperscriptYSize = p.parseShort()\n os2.ySuperscriptXOffset = p.parseShort()\n os2.ySuperscriptYOffset = p.parseShort()\n os2.yStrikeoutSize = p.parseShort()\n os2.yStrikeoutPosition = p.parseShort()\n os2.sFamilyClass = p.parseShort()\n os2.panose = []\n for (var i = 0; i < 10; i++) {\n os2.panose[i] = p.parseByte()\n }\n\n os2.ulUnicodeRange1 = p.parseULong()\n os2.ulUnicodeRange2 = p.parseULong()\n os2.ulUnicodeRange3 = p.parseULong()\n os2.ulUnicodeRange4 = p.parseULong()\n os2.achVendID = String.fromCharCode(p.parseByte(), p.parseByte(), p.parseByte(), p.parseByte())\n os2.fsSelection = p.parseUShort()\n os2.usFirstCharIndex = p.parseUShort()\n os2.usLastCharIndex = p.parseUShort()\n os2.sTypoAscender = p.parseShort()\n os2.sTypoDescender = p.parseShort()\n os2.sTypoLineGap = p.parseShort()\n os2.usWinAscent = p.parseUShort()\n os2.usWinDescent = p.parseUShort()\n if (os2.version >= 1) {\n os2.ulCodePageRange1 = p.parseULong()\n os2.ulCodePageRange2 = p.parseULong()\n }\n\n if (os2.version >= 2) {\n os2.sxHeight = p.parseShort()\n os2.sCapHeight = p.parseShort()\n os2.usDefaultChar = p.parseUShort()\n os2.usBreakChar = p.parseUShort()\n os2.usMaxContent = p.parseUShort()\n }\n\n return os2\n }\n\n function makeOS2Table(options) {\n return new table.Table(\n 'OS/2',\n [\n { name: 'version', type: 'USHORT', value: 0x0003 },\n { name: 'xAvgCharWidth', type: 'SHORT', value: 0 },\n { name: 'usWeightClass', type: 'USHORT', value: 0 },\n { name: 'usWidthClass', type: 'USHORT', value: 0 },\n { name: 'fsType', type: 'USHORT', value: 0 },\n { name: 'ySubscriptXSize', type: 'SHORT', value: 650 },\n { name: 'ySubscriptYSize', type: 'SHORT', value: 699 },\n { name: 'ySubscriptXOffset', type: 'SHORT', value: 0 },\n { name: 'ySubscriptYOffset', type: 'SHORT', value: 140 },\n { name: 'ySuperscriptXSize', type: 'SHORT', value: 650 },\n { name: 'ySuperscriptYSize', type: 'SHORT', value: 699 },\n { name: 'ySuperscriptXOffset', type: 'SHORT', value: 0 },\n { name: 'ySuperscriptYOffset', type: 'SHORT', value: 479 },\n { name: 'yStrikeoutSize', type: 'SHORT', value: 49 },\n { name: 'yStrikeoutPosition', type: 'SHORT', value: 258 },\n { name: 'sFamilyClass', type: 'SHORT', value: 0 },\n { name: 'bFamilyType', type: 'BYTE', value: 0 },\n { name: 'bSerifStyle', type: 'BYTE', value: 0 },\n { name: 'bWeight', type: 'BYTE', value: 0 },\n { name: 'bProportion', type: 'BYTE', value: 0 },\n { name: 'bContrast', type: 'BYTE', value: 0 },\n { name: 'bStrokeVariation', type: 'BYTE', value: 0 },\n { name: 'bArmStyle', type: 'BYTE', value: 0 },\n { name: 'bLetterform', type: 'BYTE', value: 0 },\n { name: 'bMidline', type: 'BYTE', value: 0 },\n { name: 'bXHeight', type: 'BYTE', value: 0 },\n { name: 'ulUnicodeRange1', type: 'ULONG', value: 0 },\n { name: 'ulUnicodeRange2', type: 'ULONG', value: 0 },\n { name: 'ulUnicodeRange3', type: 'ULONG', value: 0 },\n { name: 'ulUnicodeRange4', type: 'ULONG', value: 0 },\n { name: 'achVendID', type: 'CHARARRAY', value: 'XXXX' },\n { name: 'fsSelection', type: 'USHORT', value: 0 },\n { name: 'usFirstCharIndex', type: 'USHORT', value: 0 },\n { name: 'usLastCharIndex', type: 'USHORT', value: 0 },\n { name: 'sTypoAscender', type: 'SHORT', value: 0 },\n { name: 'sTypoDescender', type: 'SHORT', value: 0 },\n { name: 'sTypoLineGap', type: 'SHORT', value: 0 },\n { name: 'usWinAscent', type: 'USHORT', value: 0 },\n { name: 'usWinDescent', type: 'USHORT', value: 0 },\n { name: 'ulCodePageRange1', type: 'ULONG', value: 0 },\n { name: 'ulCodePageRange2', type: 'ULONG', value: 0 },\n { name: 'sxHeight', type: 'SHORT', value: 0 },\n { name: 'sCapHeight', type: 'SHORT', value: 0 },\n { name: 'usDefaultChar', type: 'USHORT', value: 0 },\n { name: 'usBreakChar', type: 'USHORT', value: 0 },\n { name: 'usMaxContext', type: 'USHORT', value: 0 },\n ],\n options,\n )\n }\n\n var os2 = { parse: parseOS2Table, make: makeOS2Table, unicodeRanges: unicodeRanges, getUnicodeRange: getUnicodeRange }\n\n // The `post` table stores additional PostScript information, such as glyph names.\n\n // Parse the PostScript `post` table\n function parsePostTable(data, start) {\n var post = {}\n var p = new parse.Parser(data, start)\n post.version = p.parseVersion()\n post.italicAngle = p.parseFixed()\n post.underlinePosition = p.parseShort()\n post.underlineThickness = p.parseShort()\n post.isFixedPitch = p.parseULong()\n post.minMemType42 = p.parseULong()\n post.maxMemType42 = p.parseULong()\n post.minMemType1 = p.parseULong()\n post.maxMemType1 = p.parseULong()\n switch (post.version) {\n case 1:\n post.names = standardNames.slice()\n break\n case 2:\n post.numberOfGlyphs = p.parseUShort()\n post.glyphNameIndex = new Array(post.numberOfGlyphs)\n for (var i = 0; i < post.numberOfGlyphs; i++) {\n post.glyphNameIndex[i] = p.parseUShort()\n }\n\n post.names = []\n for (var i$1 = 0; i$1 < post.numberOfGlyphs; i$1++) {\n if (post.glyphNameIndex[i$1] >= standardNames.length) {\n var nameLength = p.parseChar()\n post.names.push(p.parseString(nameLength))\n }\n }\n\n break\n case 2.5:\n post.numberOfGlyphs = p.parseUShort()\n post.offset = new Array(post.numberOfGlyphs)\n for (var i$2 = 0; i$2 < post.numberOfGlyphs; i$2++) {\n post.offset[i$2] = p.parseChar()\n }\n\n break\n }\n return post\n }\n\n function makePostTable() {\n return new table.Table('post', [\n { name: 'version', type: 'FIXED', value: 0x00030000 },\n { name: 'italicAngle', type: 'FIXED', value: 0 },\n { name: 'underlinePosition', type: 'FWORD', value: 0 },\n { name: 'underlineThickness', type: 'FWORD', value: 0 },\n { name: 'isFixedPitch', type: 'ULONG', value: 0 },\n { name: 'minMemType42', type: 'ULONG', value: 0 },\n { name: 'maxMemType42', type: 'ULONG', value: 0 },\n { name: 'minMemType1', type: 'ULONG', value: 0 },\n { name: 'maxMemType1', type: 'ULONG', value: 0 },\n ])\n }\n\n var post = { parse: parsePostTable, make: makePostTable }\n\n // The `GSUB` table contains ligatures, among other things.\n\n var subtableParsers = new Array(9) // subtableParsers[0] is unused\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#SS\n subtableParsers[1] = function parseLookup1() {\n var start = this.offset + this.relativeOffset\n var substFormat = this.parseUShort()\n if (substFormat === 1) {\n return {\n substFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n deltaGlyphId: this.parseUShort(),\n }\n } else if (substFormat === 2) {\n return {\n substFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n substitute: this.parseOffset16List(),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': lookup type 1 format must be 1 or 2.')\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#MS\n subtableParsers[2] = function parseLookup2() {\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB Multiple Substitution Subtable identifier-format must be 1')\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n sequences: this.parseListOfLists(),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#AS\n subtableParsers[3] = function parseLookup3() {\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB Alternate Substitution Subtable identifier-format must be 1')\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n alternateSets: this.parseListOfLists(),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#LS\n subtableParsers[4] = function parseLookup4() {\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB ligature table identifier-format must be 1')\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n ligatureSets: this.parseListOfLists(function () {\n return {\n ligGlyph: this.parseUShort(),\n components: this.parseUShortList(this.parseUShort() - 1),\n }\n }),\n }\n }\n\n var lookupRecordDesc = {\n sequenceIndex: Parser.uShort,\n lookupListIndex: Parser.uShort,\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#CSF\n subtableParsers[5] = function parseLookup5() {\n var start = this.offset + this.relativeOffset\n var substFormat = this.parseUShort()\n\n if (substFormat === 1) {\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n ruleSets: this.parseListOfLists(function () {\n var glyphCount = this.parseUShort()\n var substCount = this.parseUShort()\n return {\n input: this.parseUShortList(glyphCount - 1),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 2) {\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n classDef: this.parsePointer(Parser.classDef),\n classSets: this.parseListOfLists(function () {\n var glyphCount = this.parseUShort()\n var substCount = this.parseUShort()\n return {\n classes: this.parseUShortList(glyphCount - 1),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 3) {\n var glyphCount = this.parseUShort()\n var substCount = this.parseUShort()\n return {\n substFormat: substFormat,\n coverages: this.parseList(glyphCount, Parser.pointer(Parser.coverage)),\n lookupRecords: this.parseRecordList(substCount, lookupRecordDesc),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': lookup type 5 format must be 1, 2 or 3.')\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#CC\n subtableParsers[6] = function parseLookup6() {\n var start = this.offset + this.relativeOffset\n var substFormat = this.parseUShort()\n if (substFormat === 1) {\n return {\n substFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n chainRuleSets: this.parseListOfLists(function () {\n return {\n backtrack: this.parseUShortList(),\n input: this.parseUShortList(this.parseShort() - 1),\n lookahead: this.parseUShortList(),\n lookupRecords: this.parseRecordList(lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 2) {\n return {\n substFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n backtrackClassDef: this.parsePointer(Parser.classDef),\n inputClassDef: this.parsePointer(Parser.classDef),\n lookaheadClassDef: this.parsePointer(Parser.classDef),\n chainClassSet: this.parseListOfLists(function () {\n return {\n backtrack: this.parseUShortList(),\n input: this.parseUShortList(this.parseShort() - 1),\n lookahead: this.parseUShortList(),\n lookupRecords: this.parseRecordList(lookupRecordDesc),\n }\n }),\n }\n } else if (substFormat === 3) {\n return {\n substFormat: 3,\n backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n inputCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookupRecords: this.parseRecordList(lookupRecordDesc),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': lookup type 6 format must be 1, 2 or 3.')\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#ES\n subtableParsers[7] = function parseLookup7() {\n // Extension Substitution subtable\n var substFormat = this.parseUShort()\n check.argument(substFormat === 1, 'GSUB Extension Substitution subtable identifier-format must be 1')\n var extensionLookupType = this.parseUShort()\n var extensionParser = new Parser(this.data, this.offset + this.parseULong())\n return {\n substFormat: 1,\n lookupType: extensionLookupType,\n extension: subtableParsers[extensionLookupType].call(extensionParser),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/GSUB.htm#RCCS\n subtableParsers[8] = function parseLookup8() {\n var substFormat = this.parseUShort()\n check.argument(\n substFormat === 1,\n 'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1',\n )\n return {\n substFormat: substFormat,\n coverage: this.parsePointer(Parser.coverage),\n backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)),\n substitutes: this.parseUShortList(),\n }\n }\n\n // https://www.microsoft.com/typography/OTSPEC/gsub.htm\n function parseGsubTable(data, start) {\n start = start || 0\n var p = new Parser(data, start)\n var tableVersion = p.parseVersion(1)\n check.argument(tableVersion === 1 || tableVersion === 1.1, 'Unsupported GSUB table version.')\n if (tableVersion === 1) {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers),\n }\n } else {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers),\n variations: p.parseFeatureVariationsList(),\n }\n }\n }\n\n // GSUB Writing //////////////////////////////////////////////\n var subtableMakers = new Array(9)\n\n subtableMakers[1] = function makeLookup1(subtable) {\n if (subtable.substFormat === 1) {\n return new table.Table('substitutionTable', [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n { name: 'deltaGlyphID', type: 'USHORT', value: subtable.deltaGlyphId },\n ])\n } else {\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 2 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(table.ushortList('substitute', subtable.substitute)),\n )\n }\n }\n\n subtableMakers[2] = function makeLookup2(subtable) {\n check.assert(subtable.substFormat === 1, 'Lookup type 2 substFormat must be 1.')\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('seqSet', subtable.sequences, function (sequenceSet) {\n return new table.Table('sequenceSetTable', table.ushortList('sequence', sequenceSet))\n }),\n ),\n )\n }\n\n subtableMakers[3] = function makeLookup3(subtable) {\n check.assert(subtable.substFormat === 1, 'Lookup type 3 substFormat must be 1.')\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('altSet', subtable.alternateSets, function (alternateSet) {\n return new table.Table('alternateSetTable', table.ushortList('alternate', alternateSet))\n }),\n ),\n )\n }\n\n subtableMakers[4] = function makeLookup4(subtable) {\n check.assert(subtable.substFormat === 1, 'Lookup type 4 substFormat must be 1.')\n return new table.Table(\n 'substitutionTable',\n [\n { name: 'substFormat', type: 'USHORT', value: 1 },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('ligSet', subtable.ligatureSets, function (ligatureSet) {\n return new table.Table(\n 'ligatureSetTable',\n table.tableList('ligature', ligatureSet, function (ligature) {\n return new table.Table(\n 'ligatureTable',\n [{ name: 'ligGlyph', type: 'USHORT', value: ligature.ligGlyph }].concat(\n table.ushortList('component', ligature.components, ligature.components.length + 1),\n ),\n )\n }),\n )\n }),\n ),\n )\n }\n\n subtableMakers[6] = function makeLookup6(subtable) {\n if (subtable.substFormat === 1) {\n var returnTable = new table.Table(\n 'chainContextTable',\n [\n { name: 'substFormat', type: 'USHORT', value: subtable.substFormat },\n { name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage) },\n ].concat(\n table.tableList('chainRuleSet', subtable.chainRuleSets, function (chainRuleSet) {\n return new table.Table(\n 'chainRuleSetTable',\n table.tableList('chainRule', chainRuleSet, function (chainRule) {\n var tableData = table\n .ushortList('backtrackGlyph', chainRule.backtrack, chainRule.backtrack.length)\n .concat(table.ushortList('inputGlyph', chainRule.input, chainRule.input.length + 1))\n .concat(table.ushortList('lookaheadGlyph', chainRule.lookahead, chainRule.lookahead.length))\n .concat(table.ushortList('substitution', [], chainRule.lookupRecords.length))\n\n chainRule.lookupRecords.forEach(function (record, i) {\n tableData = tableData\n .concat({ name: 'sequenceIndex' + i, type: 'USHORT', value: record.sequenceIndex })\n .concat({ name: 'lookupListIndex' + i, type: 'USHORT', value: record.lookupListIndex })\n })\n return new table.Table('chainRuleTable', tableData)\n }),\n )\n }),\n ),\n )\n return returnTable\n } else if (subtable.substFormat === 2) {\n check.assert(false, 'lookup type 6 format 2 is not yet supported.')\n } else if (subtable.substFormat === 3) {\n var tableData = [{ name: 'substFormat', type: 'USHORT', value: subtable.substFormat }]\n\n tableData.push({ name: 'backtrackGlyphCount', type: 'USHORT', value: subtable.backtrackCoverage.length })\n subtable.backtrackCoverage.forEach(function (coverage, i) {\n tableData.push({ name: 'backtrackCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage) })\n })\n tableData.push({ name: 'inputGlyphCount', type: 'USHORT', value: subtable.inputCoverage.length })\n subtable.inputCoverage.forEach(function (coverage, i) {\n tableData.push({ name: 'inputCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage) })\n })\n tableData.push({ name: 'lookaheadGlyphCount', type: 'USHORT', value: subtable.lookaheadCoverage.length })\n subtable.lookaheadCoverage.forEach(function (coverage, i) {\n tableData.push({ name: 'lookaheadCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage) })\n })\n\n tableData.push({ name: 'substitutionCount', type: 'USHORT', value: subtable.lookupRecords.length })\n subtable.lookupRecords.forEach(function (record, i) {\n tableData = tableData\n .concat({ name: 'sequenceIndex' + i, type: 'USHORT', value: record.sequenceIndex })\n .concat({ name: 'lookupListIndex' + i, type: 'USHORT', value: record.lookupListIndex })\n })\n\n var returnTable$1 = new table.Table('chainContextTable', tableData)\n\n return returnTable$1\n }\n\n check.assert(false, 'lookup type 6 format must be 1, 2 or 3.')\n }\n\n function makeGsubTable(gsub) {\n return new table.Table('GSUB', [\n { name: 'version', type: 'ULONG', value: 0x10000 },\n { name: 'scripts', type: 'TABLE', value: new table.ScriptList(gsub.scripts) },\n { name: 'features', type: 'TABLE', value: new table.FeatureList(gsub.features) },\n { name: 'lookups', type: 'TABLE', value: new table.LookupList(gsub.lookups, subtableMakers) },\n ])\n }\n\n var gsub = { parse: parseGsubTable, make: makeGsubTable }\n\n // The `GPOS` table contains kerning pairs, among other things.\n\n // Parse the metadata `meta` table.\n // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6meta.html\n function parseMetaTable(data, start) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseULong()\n check.argument(tableVersion === 1, 'Unsupported META table version.')\n p.parseULong() // flags - currently unused and set to 0\n p.parseULong() // tableOffset\n var numDataMaps = p.parseULong()\n\n var tags = {}\n for (var i = 0; i < numDataMaps; i++) {\n var tag = p.parseTag()\n var dataOffset = p.parseULong()\n var dataLength = p.parseULong()\n var text = decode.UTF8(data, start + dataOffset, dataLength)\n\n tags[tag] = text\n }\n return tags\n }\n\n function makeMetaTable(tags) {\n var numTags = Object.keys(tags).length\n var stringPool = ''\n var stringPoolOffset = 16 + numTags * 12\n\n var result = new table.Table('meta', [\n { name: 'version', type: 'ULONG', value: 1 },\n { name: 'flags', type: 'ULONG', value: 0 },\n { name: 'offset', type: 'ULONG', value: stringPoolOffset },\n { name: 'numTags', type: 'ULONG', value: numTags },\n ])\n\n for (var tag in tags) {\n var pos = stringPool.length\n stringPool += tags[tag]\n\n result.fields.push({ name: 'tag ' + tag, type: 'TAG', value: tag })\n result.fields.push({ name: 'offset ' + tag, type: 'ULONG', value: stringPoolOffset + pos })\n result.fields.push({ name: 'length ' + tag, type: 'ULONG', value: tags[tag].length })\n }\n\n result.fields.push({ name: 'stringPool', type: 'CHARARRAY', value: stringPool })\n\n return result\n }\n\n var meta = { parse: parseMetaTable, make: makeMetaTable }\n\n // The `sfnt` wrapper provides organization for the tables in the font.\n\n function log2(v) {\n return (Math.log(v) / Math.log(2)) | 0\n }\n\n function computeCheckSum(bytes) {\n while (bytes.length % 4 !== 0) {\n bytes.push(0)\n }\n\n var sum = 0\n for (var i = 0; i < bytes.length; i += 4) {\n sum += (bytes[i] << 24) + (bytes[i + 1] << 16) + (bytes[i + 2] << 8) + bytes[i + 3]\n }\n\n sum %= Math.pow(2, 32)\n return sum\n }\n\n function makeTableRecord(tag, checkSum, offset, length) {\n return new table.Record('Table Record', [\n { name: 'tag', type: 'TAG', value: tag !== undefined ? tag : '' },\n { name: 'checkSum', type: 'ULONG', value: checkSum !== undefined ? checkSum : 0 },\n { name: 'offset', type: 'ULONG', value: offset !== undefined ? offset : 0 },\n { name: 'length', type: 'ULONG', value: length !== undefined ? length : 0 },\n ])\n }\n\n function makeSfntTable(tables) {\n var sfnt = new table.Table('sfnt', [\n { name: 'version', type: 'TAG', value: 'OTTO' },\n { name: 'numTables', type: 'USHORT', value: 0 },\n { name: 'searchRange', type: 'USHORT', value: 0 },\n { name: 'entrySelector', type: 'USHORT', value: 0 },\n { name: 'rangeShift', type: 'USHORT', value: 0 },\n ])\n sfnt.tables = tables\n sfnt.numTables = tables.length\n var highestPowerOf2 = Math.pow(2, log2(sfnt.numTables))\n sfnt.searchRange = 16 * highestPowerOf2\n sfnt.entrySelector = log2(highestPowerOf2)\n sfnt.rangeShift = sfnt.numTables * 16 - sfnt.searchRange\n\n var recordFields = []\n var tableFields = []\n\n var offset = sfnt.sizeOf() + makeTableRecord().sizeOf() * sfnt.numTables\n while (offset % 4 !== 0) {\n offset += 1\n tableFields.push({ name: 'padding', type: 'BYTE', value: 0 })\n }\n\n for (var i = 0; i < tables.length; i += 1) {\n var t = tables[i]\n check.argument(t.tableName.length === 4, 'Table name' + t.tableName + ' is invalid.')\n var tableLength = t.sizeOf()\n var tableRecord = makeTableRecord(t.tableName, computeCheckSum(t.encode()), offset, tableLength)\n recordFields.push({ name: tableRecord.tag + ' Table Record', type: 'RECORD', value: tableRecord })\n tableFields.push({ name: t.tableName + ' table', type: 'RECORD', value: t })\n offset += tableLength\n check.argument(!isNaN(offset), 'Something went wrong calculating the offset.')\n while (offset % 4 !== 0) {\n offset += 1\n tableFields.push({ name: 'padding', type: 'BYTE', value: 0 })\n }\n }\n\n // Table records need to be sorted alphabetically.\n recordFields.sort(function (r1, r2) {\n if (r1.value.tag > r2.value.tag) {\n return 1\n } else {\n return -1\n }\n })\n\n sfnt.fields = sfnt.fields.concat(recordFields)\n sfnt.fields = sfnt.fields.concat(tableFields)\n return sfnt\n }\n\n // Get the metrics for a character. If the string has more than one character\n // this function returns metrics for the first available character.\n // You can provide optional fallback metrics if no characters are available.\n function metricsForChar(font, chars, notFoundMetrics) {\n for (var i = 0; i < chars.length; i += 1) {\n var glyphIndex = font.charToGlyphIndex(chars[i])\n if (glyphIndex > 0) {\n var glyph = font.glyphs.get(glyphIndex)\n return glyph.getMetrics()\n }\n }\n\n return notFoundMetrics\n }\n\n function average(vs) {\n var sum = 0\n for (var i = 0; i < vs.length; i += 1) {\n sum += vs[i]\n }\n\n return sum / vs.length\n }\n\n // Convert the font object to a SFNT data structure.\n // This structure contains all the necessary tables and metadata to create a binary OTF file.\n function fontToSfntTable(font) {\n var xMins = []\n var yMins = []\n var xMaxs = []\n var yMaxs = []\n var advanceWidths = []\n var leftSideBearings = []\n var rightSideBearings = []\n var firstCharIndex\n var lastCharIndex = 0\n var ulUnicodeRange1 = 0\n var ulUnicodeRange2 = 0\n var ulUnicodeRange3 = 0\n var ulUnicodeRange4 = 0\n\n for (var i = 0; i < font.glyphs.length; i += 1) {\n var glyph = font.glyphs.get(i)\n var unicode = glyph.unicode | 0\n\n if (isNaN(glyph.advanceWidth)) {\n throw new Error('Glyph ' + glyph.name + ' (' + i + '): advanceWidth is not a number.')\n }\n\n if (firstCharIndex > unicode || firstCharIndex === undefined) {\n // ignore .notdef char\n if (unicode > 0) {\n firstCharIndex = unicode\n }\n }\n\n if (lastCharIndex < unicode) {\n lastCharIndex = unicode\n }\n\n var position = os2.getUnicodeRange(unicode)\n if (position < 32) {\n ulUnicodeRange1 |= 1 << position\n } else if (position < 64) {\n ulUnicodeRange2 |= 1 << (position - 32)\n } else if (position < 96) {\n ulUnicodeRange3 |= 1 << (position - 64)\n } else if (position < 123) {\n ulUnicodeRange4 |= 1 << (position - 96)\n } else {\n throw new Error('Unicode ranges bits > 123 are reserved for internal usage')\n }\n // Skip non-important characters.\n if (glyph.name === '.notdef') {\n continue\n }\n var metrics = glyph.getMetrics()\n xMins.push(metrics.xMin)\n yMins.push(metrics.yMin)\n xMaxs.push(metrics.xMax)\n yMaxs.push(metrics.yMax)\n leftSideBearings.push(metrics.leftSideBearing)\n rightSideBearings.push(metrics.rightSideBearing)\n advanceWidths.push(glyph.advanceWidth)\n }\n\n var globals = {\n xMin: Math.min.apply(null, xMins),\n yMin: Math.min.apply(null, yMins),\n xMax: Math.max.apply(null, xMaxs),\n yMax: Math.max.apply(null, yMaxs),\n advanceWidthMax: Math.max.apply(null, advanceWidths),\n advanceWidthAvg: average(advanceWidths),\n minLeftSideBearing: Math.min.apply(null, leftSideBearings),\n maxLeftSideBearing: Math.max.apply(null, leftSideBearings),\n minRightSideBearing: Math.min.apply(null, rightSideBearings),\n }\n globals.ascender = font.ascender\n globals.descender = font.descender\n\n var headTable = head.make({\n flags: 3, // 00000011 (baseline for font at y=0; left sidebearing point at x=0)\n unitsPerEm: font.unitsPerEm,\n xMin: globals.xMin,\n yMin: globals.yMin,\n xMax: globals.xMax,\n yMax: globals.yMax,\n lowestRecPPEM: 3,\n createdTimestamp: font.createdTimestamp,\n })\n\n var hheaTable = hhea.make({\n ascender: globals.ascender,\n descender: globals.descender,\n advanceWidthMax: globals.advanceWidthMax,\n minLeftSideBearing: globals.minLeftSideBearing,\n minRightSideBearing: globals.minRightSideBearing,\n xMaxExtent: globals.maxLeftSideBearing + (globals.xMax - globals.xMin),\n numberOfHMetrics: font.glyphs.length,\n })\n\n var maxpTable = maxp.make(font.glyphs.length)\n\n var os2Table = os2.make(\n Object.assign(\n {\n xAvgCharWidth: Math.round(globals.advanceWidthAvg),\n usFirstCharIndex: firstCharIndex,\n usLastCharIndex: lastCharIndex,\n ulUnicodeRange1: ulUnicodeRange1,\n ulUnicodeRange2: ulUnicodeRange2,\n ulUnicodeRange3: ulUnicodeRange3,\n ulUnicodeRange4: ulUnicodeRange4,\n // See http://typophile.com/node/13081 for more info on vertical metrics.\n // We get metrics for typical characters (such as \"x\" for xHeight).\n // We provide some fallback characters if characters are unavailable: their\n // ordering was chosen experimentally.\n sTypoAscender: globals.ascender,\n sTypoDescender: globals.descender,\n sTypoLineGap: 0,\n usWinAscent: globals.yMax,\n usWinDescent: Math.abs(globals.yMin),\n ulCodePageRange1: 1, // FIXME: hard-code Latin 1 support for now\n sxHeight: metricsForChar(font, 'xyvw', { yMax: Math.round(globals.ascender / 2) }).yMax,\n sCapHeight: metricsForChar(font, 'HIKLEFJMNTZBDPRAGOQSUVWXY', globals).yMax,\n usDefaultChar: font.hasChar(' ') ? 32 : 0, // Use space as the default character, if available.\n usBreakChar: font.hasChar(' ') ? 32 : 0, // Use space as the break character, if available.\n },\n font.tables.os2,\n ),\n )\n\n var hmtxTable = hmtx.make(font.glyphs)\n var cmapTable = cmap.make(font.glyphs)\n\n var englishFamilyName = font.getEnglishName('fontFamily')\n var englishStyleName = font.getEnglishName('fontSubfamily')\n var englishFullName = englishFamilyName + ' ' + englishStyleName\n var postScriptName = font.getEnglishName('postScriptName')\n if (!postScriptName) {\n postScriptName = englishFamilyName.replace(/\\s/g, '') + '-' + englishStyleName\n }\n\n var names = {}\n for (var n in font.names) {\n names[n] = font.names[n]\n }\n\n if (!names.uniqueID) {\n names.uniqueID = { en: font.getEnglishName('manufacturer') + ':' + englishFullName }\n }\n\n if (!names.postScriptName) {\n names.postScriptName = { en: postScriptName }\n }\n\n if (!names.preferredFamily) {\n names.preferredFamily = font.names.fontFamily\n }\n\n if (!names.preferredSubfamily) {\n names.preferredSubfamily = font.names.fontSubfamily\n }\n\n var languageTags = []\n var nameTable = _name.make(names, languageTags)\n var ltagTable = languageTags.length > 0 ? ltag.make(languageTags) : undefined\n\n var postTable = post.make()\n var cffTable = cff.make(font.glyphs, {\n version: font.getEnglishName('version'),\n fullName: englishFullName,\n familyName: englishFamilyName,\n weightName: englishStyleName,\n postScriptName: postScriptName,\n unitsPerEm: font.unitsPerEm,\n fontBBox: [0, globals.yMin, globals.ascender, globals.advanceWidthMax],\n })\n\n var metaTable = font.metas && Object.keys(font.metas).length > 0 ? meta.make(font.metas) : undefined\n\n // The order does not matter because makeSfntTable() will sort them.\n var tables = [headTable, hheaTable, maxpTable, os2Table, nameTable, cmapTable, postTable, cffTable, hmtxTable]\n if (ltagTable) {\n tables.push(ltagTable)\n }\n // Optional tables\n if (font.tables.gsub) {\n tables.push(gsub.make(font.tables.gsub))\n }\n if (metaTable) {\n tables.push(metaTable)\n }\n\n var sfntTable = makeSfntTable(tables)\n\n // Compute the font's checkSum and store it in head.checkSumAdjustment.\n var bytes = sfntTable.encode()\n var checkSum = computeCheckSum(bytes)\n var tableFields = sfntTable.fields\n var checkSumAdjusted = false\n for (var i$1 = 0; i$1 < tableFields.length; i$1 += 1) {\n if (tableFields[i$1].name === 'head table') {\n tableFields[i$1].value.checkSumAdjustment = 0xb1b0afba - checkSum\n checkSumAdjusted = true\n break\n }\n }\n\n if (!checkSumAdjusted) {\n throw new Error('Could not find head table with checkSum to adjust.')\n }\n\n return sfntTable\n }\n\n var sfnt = { make: makeSfntTable, fontToTable: fontToSfntTable, computeCheckSum: computeCheckSum }\n\n // The Layout object is the prototype of Substitution objects, and provides\n\n function searchTag(arr, tag) {\n /* jshint bitwise: false */\n var imin = 0\n var imax = arr.length - 1\n while (imin <= imax) {\n var imid = (imin + imax) >>> 1\n var val = arr[imid].tag\n if (val === tag) {\n return imid\n } else if (val < tag) {\n imin = imid + 1\n } else {\n imax = imid - 1\n }\n }\n // Not found: return -1-insertion point\n return -imin - 1\n }\n\n function binSearch(arr, value) {\n /* jshint bitwise: false */\n var imin = 0\n var imax = arr.length - 1\n while (imin <= imax) {\n var imid = (imin + imax) >>> 1\n var val = arr[imid]\n if (val === value) {\n return imid\n } else if (val < value) {\n imin = imid + 1\n } else {\n imax = imid - 1\n }\n }\n // Not found: return -1-insertion point\n return -imin - 1\n }\n\n // binary search in a list of ranges (coverage, class definition)\n function searchRange(ranges, value) {\n // jshint bitwise: false\n var range\n var imin = 0\n var imax = ranges.length - 1\n while (imin <= imax) {\n var imid = (imin + imax) >>> 1\n range = ranges[imid]\n var start = range.start\n if (start === value) {\n return range\n } else if (start < value) {\n imin = imid + 1\n } else {\n imax = imid - 1\n }\n }\n if (imin > 0) {\n range = ranges[imin - 1]\n if (value > range.end) {\n return 0\n }\n return range\n }\n }\n\n /**\n * @exports opentype.Layout\n * @class\n */\n function Layout(font, tableName) {\n this.font = font\n this.tableName = tableName\n }\n\n Layout.prototype = {\n /**\n * Binary search an object by \"tag\" property\n * @instance\n * @function searchTag\n * @memberof opentype.Layout\n * @param {Array} arr\n * @param {string} tag\n * @return {number}\n */\n searchTag: searchTag,\n\n /**\n * Binary search in a list of numbers\n * @instance\n * @function binSearch\n * @memberof opentype.Layout\n * @param {Array} arr\n * @param {number} value\n * @return {number}\n */\n binSearch: binSearch,\n\n /**\n * Get or create the Layout table (GSUB, GPOS etc).\n * @param {boolean} create - Whether to create a new one.\n * @return {Object} The GSUB or GPOS table.\n */\n getTable: function (create) {\n var layout = this.font.tables[this.tableName]\n if (!layout && create) {\n layout = this.font.tables[this.tableName] = this.createDefaultTable()\n }\n return layout\n },\n\n /**\n * Returns all scripts in the substitution table.\n * @instance\n * @return {Array}\n */\n getScriptNames: function () {\n var layout = this.getTable()\n if (!layout) {\n return []\n }\n return layout.scripts.map(function (script) {\n return script.tag\n })\n },\n\n /**\n * Returns the best bet for a script name.\n * Returns 'DFLT' if it exists.\n * If not, returns 'latn' if it exists.\n * If neither exist, returns undefined.\n */\n getDefaultScriptName: function () {\n var layout = this.getTable()\n if (!layout) {\n return\n }\n var hasLatn = false\n for (var i = 0; i < layout.scripts.length; i++) {\n var name = layout.scripts[i].tag\n if (name === 'DFLT') {\n return name\n }\n if (name === 'latn') {\n hasLatn = true\n }\n }\n if (hasLatn) {\n return 'latn'\n }\n },\n\n /**\n * Returns all LangSysRecords in the given script.\n * @instance\n * @param {string} [script='DFLT']\n * @param {boolean} create - forces the creation of this script table if it doesn't exist.\n * @return {Object} An object with tag and script properties.\n */\n getScriptTable: function (script, create) {\n var layout = this.getTable(create)\n if (layout) {\n script = script || 'DFLT'\n var scripts = layout.scripts\n var pos = searchTag(layout.scripts, script)\n if (pos >= 0) {\n return scripts[pos].script\n } else if (create) {\n var scr = {\n tag: script,\n script: {\n defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] },\n langSysRecords: [],\n },\n }\n scripts.splice(-1 - pos, 0, scr)\n return scr.script\n }\n }\n },\n\n /**\n * Returns a language system table\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {boolean} create - forces the creation of this langSysTable if it doesn't exist.\n * @return {Object}\n */\n getLangSysTable: function (script, language, create) {\n var scriptTable = this.getScriptTable(script, create)\n if (scriptTable) {\n if (!language || language === 'dflt' || language === 'DFLT') {\n return scriptTable.defaultLangSys\n }\n var pos = searchTag(scriptTable.langSysRecords, language)\n if (pos >= 0) {\n return scriptTable.langSysRecords[pos].langSys\n } else if (create) {\n var langSysRecord = {\n tag: language,\n langSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] },\n }\n scriptTable.langSysRecords.splice(-1 - pos, 0, langSysRecord)\n return langSysRecord.langSys\n }\n }\n },\n\n /**\n * Get a specific feature table.\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {string} feature - One of the codes listed at https://www.microsoft.com/typography/OTSPEC/featurelist.htm\n * @param {boolean} create - forces the creation of the feature table if it doesn't exist.\n * @return {Object}\n */\n getFeatureTable: function (script, language, feature, create) {\n var langSysTable = this.getLangSysTable(script, language, create)\n if (langSysTable) {\n var featureRecord\n var featIndexes = langSysTable.featureIndexes\n var allFeatures = this.font.tables[this.tableName].features\n // The FeatureIndex array of indices is in arbitrary order,\n // even if allFeatures is sorted alphabetically by feature tag.\n for (var i = 0; i < featIndexes.length; i++) {\n featureRecord = allFeatures[featIndexes[i]]\n if (featureRecord.tag === feature) {\n return featureRecord.feature\n }\n }\n if (create) {\n var index = allFeatures.length\n // Automatic ordering of features would require to shift feature indexes in the script list.\n check.assert(\n index === 0 || feature >= allFeatures[index - 1].tag,\n 'Features must be added in alphabetical order.',\n )\n featureRecord = {\n tag: feature,\n feature: { params: 0, lookupListIndexes: [] },\n }\n allFeatures.push(featureRecord)\n featIndexes.push(index)\n return featureRecord.feature\n }\n }\n },\n\n /**\n * Get the lookup tables of a given type for a script/language/feature.\n * @instance\n * @param {string} [script='DFLT']\n * @param {string} [language='dlft']\n * @param {string} feature - 4-letter feature code\n * @param {number} lookupType - 1 to 9\n * @param {boolean} create - forces the creation of the lookup table if it doesn't exist, with no subtables.\n * @return {Object[]}\n */\n getLookupTables: function (script, language, feature, lookupType, create) {\n var featureTable = this.getFeatureTable(script, language, feature, create)\n var tables = []\n if (featureTable) {\n var lookupTable\n var lookupListIndexes = featureTable.lookupListIndexes\n var allLookups = this.font.tables[this.tableName].lookups\n // lookupListIndexes are in no particular order, so use naive search.\n for (var i = 0; i < lookupListIndexes.length; i++) {\n lookupTable = allLookups[lookupListIndexes[i]]\n if (lookupTable.lookupType === lookupType) {\n tables.push(lookupTable)\n }\n }\n if (tables.length === 0 && create) {\n lookupTable = {\n lookupType: lookupType,\n lookupFlag: 0,\n subtables: [],\n markFilteringSet: undefined,\n }\n var index = allLookups.length\n allLookups.push(lookupTable)\n lookupListIndexes.push(index)\n return [lookupTable]\n }\n }\n return tables\n },\n\n /**\n * Find a glyph in a class definition table\n * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#class-definition-table\n * @param {object} classDefTable - an OpenType Layout class definition table\n * @param {number} glyphIndex - the index of the glyph to find\n * @returns {number} -1 if not found\n */\n getGlyphClass: function (classDefTable, glyphIndex) {\n switch (classDefTable.format) {\n case 1:\n if (\n classDefTable.startGlyph <= glyphIndex &&\n glyphIndex < classDefTable.startGlyph + classDefTable.classes.length\n ) {\n return classDefTable.classes[glyphIndex - classDefTable.startGlyph]\n }\n return 0\n case 2:\n var range = searchRange(classDefTable.ranges, glyphIndex)\n return range ? range.classId : 0\n }\n },\n\n /**\n * Find a glyph in a coverage table\n * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#coverage-table\n * @param {object} coverageTable - an OpenType Layout coverage table\n * @param {number} glyphIndex - the index of the glyph to find\n * @returns {number} -1 if not found\n */\n getCoverageIndex: function (coverageTable, glyphIndex) {\n switch (coverageTable.format) {\n case 1:\n var index = binSearch(coverageTable.glyphs, glyphIndex)\n return index >= 0 ? index : -1\n case 2:\n var range = searchRange(coverageTable.ranges, glyphIndex)\n return range ? range.index + glyphIndex - range.start : -1\n }\n },\n\n /**\n * Returns the list of glyph indexes of a coverage table.\n * Format 1: the list is stored raw\n * Format 2: compact list as range records.\n * @instance\n * @param {Object} coverageTable\n * @return {Array}\n */\n expandCoverage: function (coverageTable) {\n if (coverageTable.format === 1) {\n return coverageTable.glyphs\n } else {\n var glyphs = []\n var ranges = coverageTable.ranges\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n var start = range.start\n var end = range.end\n for (var j = start; j <= end; j++) {\n glyphs.push(j)\n }\n }\n return glyphs\n }\n },\n }\n\n // The Position object provides utility methods to manipulate\n\n /**\n * @exports opentype.Position\n * @class\n * @extends opentype.Layout\n * @param {opentype.Font}\n * @constructor\n */\n function Position(font) {\n Layout.call(this, font, 'gpos')\n }\n\n Position.prototype = Layout.prototype\n\n /**\n * Init some data for faster and easier access later.\n */\n Position.prototype.init = function () {\n var script = this.getDefaultScriptName()\n this.defaultKerningTables = this.getKerningTables(script)\n }\n\n /**\n * Find a glyph pair in a list of lookup tables of type 2 and retrieve the xAdvance kerning value.\n *\n * @param {integer} leftIndex - left glyph index\n * @param {integer} rightIndex - right glyph index\n * @returns {integer}\n */\n Position.prototype.getKerningValue = function (kerningLookups, leftIndex, rightIndex) {\n for (var i = 0; i < kerningLookups.length; i++) {\n var subtables = kerningLookups[i].subtables\n for (var j = 0; j < subtables.length; j++) {\n var subtable = subtables[j]\n var covIndex = this.getCoverageIndex(subtable.coverage, leftIndex)\n if (covIndex < 0) {\n continue\n }\n switch (subtable.posFormat) {\n case 1:\n // Search Pair Adjustment Positioning Format 1\n var pairSet = subtable.pairSets[covIndex]\n for (var k = 0; k < pairSet.length; k++) {\n var pair = pairSet[k]\n if (pair.secondGlyph === rightIndex) {\n return (pair.value1 && pair.value1.xAdvance) || 0\n }\n }\n break // left glyph found, not right glyph - try next subtable\n case 2:\n // Search Pair Adjustment Positioning Format 2\n var class1 = this.getGlyphClass(subtable.classDef1, leftIndex)\n var class2 = this.getGlyphClass(subtable.classDef2, rightIndex)\n var pair$1 = subtable.classRecords[class1][class2]\n return (pair$1.value1 && pair$1.value1.xAdvance) || 0\n }\n }\n }\n return 0\n }\n\n /**\n * List all kerning lookup tables.\n *\n * @param {string} [script='DFLT'] - use font.position.getDefaultScriptName() for a better default value\n * @param {string} [language='dflt']\n * @return {object[]} The list of kerning lookup tables (may be empty), or undefined if there is no GPOS table (and we should use the kern table)\n */\n Position.prototype.getKerningTables = function (script, language) {\n if (this.font.tables.gpos) {\n return this.getLookupTables(script, language, 'kern', 2)\n }\n }\n\n // The Substitution object provides utility methods to manipulate\n\n /**\n * @exports opentype.Substitution\n * @class\n * @extends opentype.Layout\n * @param {opentype.Font}\n * @constructor\n */\n function Substitution(font) {\n Layout.call(this, font, 'gsub')\n }\n\n // Check if 2 arrays of primitives are equal.\n function arraysEqual(ar1, ar2) {\n var n = ar1.length\n if (n !== ar2.length) {\n return false\n }\n for (var i = 0; i < n; i++) {\n if (ar1[i] !== ar2[i]) {\n return false\n }\n }\n return true\n }\n\n // Find the first subtable of a lookup table in a particular format.\n function getSubstFormat(lookupTable, format, defaultSubtable) {\n var subtables = lookupTable.subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n if (subtable.substFormat === format) {\n return subtable\n }\n }\n if (defaultSubtable) {\n subtables.push(defaultSubtable)\n return defaultSubtable\n }\n return undefined\n }\n\n Substitution.prototype = Layout.prototype\n\n /**\n * Create a default GSUB table.\n * @return {Object} gsub - The GSUB table.\n */\n Substitution.prototype.createDefaultTable = function () {\n // Generate a default empty GSUB table with just a DFLT script and dflt lang sys.\n return {\n version: 1,\n scripts: [\n {\n tag: 'DFLT',\n script: {\n defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] },\n langSysRecords: [],\n },\n },\n ],\n features: [],\n lookups: [],\n }\n }\n\n /**\n * List all single substitutions (lookup type 1) for a given script, language, and feature.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @param {string} feature - 4-character feature name ('aalt', 'salt', 'ss01'...)\n * @return {Array} substitutions - The list of substitutions.\n */\n Substitution.prototype.getSingle = function (feature, script, language) {\n var substitutions = []\n var lookupTables = this.getLookupTables(script, language, feature, 1)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var j = void 0\n if (subtable.substFormat === 1) {\n var delta = subtable.deltaGlyphId\n for (j = 0; j < glyphs.length; j++) {\n var glyph = glyphs[j]\n substitutions.push({ sub: glyph, by: glyph + delta })\n }\n } else {\n var substitute = subtable.substitute\n for (j = 0; j < glyphs.length; j++) {\n substitutions.push({ sub: glyphs[j], by: substitute[j] })\n }\n }\n }\n }\n return substitutions\n }\n\n /**\n * List all multiple substitutions (lookup type 2) for a given script, language, and feature.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @param {string} feature - 4-character feature name ('ccmp', 'stch')\n * @return {Array} substitutions - The list of substitutions.\n */\n Substitution.prototype.getMultiple = function (feature, script, language) {\n var substitutions = []\n var lookupTables = this.getLookupTables(script, language, feature, 2)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var j = void 0\n\n for (j = 0; j < glyphs.length; j++) {\n var glyph = glyphs[j]\n var replacements = subtable.sequences[j]\n substitutions.push({ sub: glyph, by: replacements })\n }\n }\n }\n return substitutions\n }\n\n /**\n * List all alternates (lookup type 3) for a given script, language, and feature.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @param {string} feature - 4-character feature name ('aalt', 'salt'...)\n * @return {Array} alternates - The list of alternates\n */\n Substitution.prototype.getAlternates = function (feature, script, language) {\n var alternates = []\n var lookupTables = this.getLookupTables(script, language, feature, 3)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var alternateSets = subtable.alternateSets\n for (var j = 0; j < glyphs.length; j++) {\n alternates.push({ sub: glyphs[j], by: alternateSets[j] })\n }\n }\n }\n return alternates\n }\n\n /**\n * List all ligatures (lookup type 4) for a given script, language, and feature.\n * The result is an array of ligature objects like { sub: [ids], by: id }\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @return {Array} ligatures - The list of ligatures.\n */\n Substitution.prototype.getLigatures = function (feature, script, language) {\n var ligatures = []\n var lookupTables = this.getLookupTables(script, language, feature, 4)\n for (var idx = 0; idx < lookupTables.length; idx++) {\n var subtables = lookupTables[idx].subtables\n for (var i = 0; i < subtables.length; i++) {\n var subtable = subtables[i]\n var glyphs = this.expandCoverage(subtable.coverage)\n var ligatureSets = subtable.ligatureSets\n for (var j = 0; j < glyphs.length; j++) {\n var startGlyph = glyphs[j]\n var ligSet = ligatureSets[j]\n for (var k = 0; k < ligSet.length; k++) {\n var lig = ligSet[k]\n ligatures.push({\n sub: [startGlyph].concat(lig.components),\n by: lig.ligGlyph,\n })\n }\n }\n }\n }\n return ligatures\n }\n\n /**\n * Add or modify a single substitution (lookup type 1)\n * Format 2, more flexible, is always used.\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {Object} substitution - { sub: id, by: id } (format 1 is not supported)\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addSingle = function (feature, substitution, script, language) {\n var lookupTable = this.getLookupTables(script, language, feature, 1, true)[0]\n var subtable = getSubstFormat(lookupTable, 2, {\n // lookup type 1 subtable, format 2, coverage format 1\n substFormat: 2,\n coverage: { format: 1, glyphs: [] },\n substitute: [],\n })\n check.assert(\n subtable.coverage.format === 1,\n 'Single: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = substitution.sub\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos < 0) {\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.substitute.splice(pos, 0, 0)\n }\n subtable.substitute[pos] = substitution.by\n }\n\n /**\n * Add or modify a multiple substitution (lookup type 2)\n * @param {string} feature - 4-letter feature name ('ccmp', 'stch')\n * @param {Object} substitution - { sub: id, by: [id] } for format 2.\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addMultiple = function (feature, substitution, script, language) {\n check.assert(\n substitution.by instanceof Array && substitution.by.length > 1,\n 'Multiple: \"by\" must be an array of two or more ids',\n )\n var lookupTable = this.getLookupTables(script, language, feature, 2, true)[0]\n var subtable = getSubstFormat(lookupTable, 1, {\n // lookup type 2 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n sequences: [],\n })\n check.assert(\n subtable.coverage.format === 1,\n 'Multiple: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = substitution.sub\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos < 0) {\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.sequences.splice(pos, 0, 0)\n }\n subtable.sequences[pos] = substitution.by\n }\n\n /**\n * Add or modify an alternate substitution (lookup type 3)\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {Object} substitution - { sub: id, by: [ids] }\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addAlternate = function (feature, substitution, script, language) {\n var lookupTable = this.getLookupTables(script, language, feature, 3, true)[0]\n var subtable = getSubstFormat(lookupTable, 1, {\n // lookup type 3 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n alternateSets: [],\n })\n check.assert(\n subtable.coverage.format === 1,\n 'Alternate: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = substitution.sub\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos < 0) {\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.alternateSets.splice(pos, 0, 0)\n }\n subtable.alternateSets[pos] = substitution.by\n }\n\n /**\n * Add a ligature (lookup type 4)\n * Ligatures with more components must be stored ahead of those with fewer components in order to be found\n * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...)\n * @param {Object} ligature - { sub: [ids], by: id }\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.addLigature = function (feature, ligature, script, language) {\n var lookupTable = this.getLookupTables(script, language, feature, 4, true)[0]\n var subtable = lookupTable.subtables[0]\n if (!subtable) {\n subtable = {\n // lookup type 4 subtable, format 1, coverage format 1\n substFormat: 1,\n coverage: { format: 1, glyphs: [] },\n ligatureSets: [],\n }\n lookupTable.subtables[0] = subtable\n }\n check.assert(\n subtable.coverage.format === 1,\n 'Ligature: unable to modify coverage table format ' + subtable.coverage.format,\n )\n var coverageGlyph = ligature.sub[0]\n var ligComponents = ligature.sub.slice(1)\n var ligatureTable = {\n ligGlyph: ligature.by,\n components: ligComponents,\n }\n var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph)\n if (pos >= 0) {\n // ligatureSet already exists\n var ligatureSet = subtable.ligatureSets[pos]\n for (var i = 0; i < ligatureSet.length; i++) {\n // If ligature already exists, return.\n if (arraysEqual(ligatureSet[i].components, ligComponents)) {\n return\n }\n }\n // ligature does not exist: add it.\n ligatureSet.push(ligatureTable)\n } else {\n // Create a new ligatureSet and add coverage for the first glyph.\n pos = -1 - pos\n subtable.coverage.glyphs.splice(pos, 0, coverageGlyph)\n subtable.ligatureSets.splice(pos, 0, [ligatureTable])\n }\n }\n\n /**\n * List all feature data for a given script and language.\n * @param {string} feature - 4-letter feature name\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n * @return {Array} substitutions - The list of substitutions.\n */\n Substitution.prototype.getFeature = function (feature, script, language) {\n if (/ss\\d\\d/.test(feature)) {\n // ss01 - ss20\n return this.getSingle(feature, script, language)\n }\n switch (feature) {\n case 'aalt':\n case 'salt':\n return this.getSingle(feature, script, language).concat(this.getAlternates(feature, script, language))\n case 'dlig':\n case 'liga':\n case 'rlig':\n return this.getLigatures(feature, script, language)\n case 'ccmp':\n return this.getMultiple(feature, script, language).concat(this.getLigatures(feature, script, language))\n case 'stch':\n return this.getMultiple(feature, script, language)\n }\n return undefined\n }\n\n /**\n * Add a substitution to a feature for a given script and language.\n * @param {string} feature - 4-letter feature name\n * @param {Object} sub - the substitution to add (an object like { sub: id or [ids], by: id or [ids] })\n * @param {string} [script='DFLT']\n * @param {string} [language='dflt']\n */\n Substitution.prototype.add = function (feature, sub, script, language) {\n if (/ss\\d\\d/.test(feature)) {\n // ss01 - ss20\n return this.addSingle(feature, sub, script, language)\n }\n switch (feature) {\n case 'aalt':\n case 'salt':\n if (typeof sub.by === 'number') {\n return this.addSingle(feature, sub, script, language)\n }\n return this.addAlternate(feature, sub, script, language)\n case 'dlig':\n case 'liga':\n case 'rlig':\n return this.addLigature(feature, sub, script, language)\n case 'ccmp':\n if (sub.by instanceof Array) {\n return this.addMultiple(feature, sub, script, language)\n }\n return this.addLigature(feature, sub, script, language)\n }\n return undefined\n }\n\n function checkArgument(expression, message) {\n if (!expression) {\n throw message\n }\n }\n\n // The `glyf` table describes the glyphs in TrueType outline format.\n\n // Parse the coordinate data for a glyph.\n function parseGlyphCoordinate(p, flag, previousValue, shortVectorBitMask, sameBitMask) {\n var v\n if ((flag & shortVectorBitMask) > 0) {\n // The coordinate is 1 byte long.\n v = p.parseByte()\n // The `same` bit is re-used for short values to signify the sign of the value.\n if ((flag & sameBitMask) === 0) {\n v = -v\n }\n\n v = previousValue + v\n } else {\n // The coordinate is 2 bytes long.\n // If the `same` bit is set, the coordinate is the same as the previous coordinate.\n if ((flag & sameBitMask) > 0) {\n v = previousValue\n } else {\n // Parse the coordinate as a signed 16-bit delta value.\n v = previousValue + p.parseShort()\n }\n }\n\n return v\n }\n\n // Parse a TrueType glyph.\n function parseGlyph(glyph, data, start) {\n var p = new parse.Parser(data, start)\n glyph.numberOfContours = p.parseShort()\n glyph._xMin = p.parseShort()\n glyph._yMin = p.parseShort()\n glyph._xMax = p.parseShort()\n glyph._yMax = p.parseShort()\n var flags\n var flag\n\n if (glyph.numberOfContours > 0) {\n // This glyph is not a composite.\n var endPointIndices = (glyph.endPointIndices = [])\n for (var i = 0; i < glyph.numberOfContours; i += 1) {\n endPointIndices.push(p.parseUShort())\n }\n\n glyph.instructionLength = p.parseUShort()\n glyph.instructions = []\n for (var i$1 = 0; i$1 < glyph.instructionLength; i$1 += 1) {\n glyph.instructions.push(p.parseByte())\n }\n\n var numberOfCoordinates = endPointIndices[endPointIndices.length - 1] + 1\n flags = []\n for (var i$2 = 0; i$2 < numberOfCoordinates; i$2 += 1) {\n flag = p.parseByte()\n flags.push(flag)\n // If bit 3 is set, we repeat this flag n times, where n is the next byte.\n if ((flag & 8) > 0) {\n var repeatCount = p.parseByte()\n for (var j = 0; j < repeatCount; j += 1) {\n flags.push(flag)\n i$2 += 1\n }\n }\n }\n\n check.argument(flags.length === numberOfCoordinates, 'Bad flags.')\n\n if (endPointIndices.length > 0) {\n var points = []\n var point\n // X/Y coordinates are relative to the previous point, except for the first point which is relative to 0,0.\n if (numberOfCoordinates > 0) {\n for (var i$3 = 0; i$3 < numberOfCoordinates; i$3 += 1) {\n flag = flags[i$3]\n point = {}\n point.onCurve = !!(flag & 1)\n point.lastPointOfContour = endPointIndices.indexOf(i$3) >= 0\n points.push(point)\n }\n\n var px = 0\n for (var i$4 = 0; i$4 < numberOfCoordinates; i$4 += 1) {\n flag = flags[i$4]\n point = points[i$4]\n point.x = parseGlyphCoordinate(p, flag, px, 2, 16)\n px = point.x\n }\n\n var py = 0\n for (var i$5 = 0; i$5 < numberOfCoordinates; i$5 += 1) {\n flag = flags[i$5]\n point = points[i$5]\n point.y = parseGlyphCoordinate(p, flag, py, 4, 32)\n py = point.y\n }\n }\n\n glyph.points = points\n } else {\n glyph.points = []\n }\n } else if (glyph.numberOfContours === 0) {\n glyph.points = []\n } else {\n glyph.isComposite = true\n glyph.points = []\n glyph.components = []\n var moreComponents = true\n while (moreComponents) {\n flags = p.parseUShort()\n var component = {\n glyphIndex: p.parseUShort(),\n xScale: 1,\n scale01: 0,\n scale10: 0,\n yScale: 1,\n dx: 0,\n dy: 0,\n }\n if ((flags & 1) > 0) {\n // The arguments are words\n if ((flags & 2) > 0) {\n // values are offset\n component.dx = p.parseShort()\n component.dy = p.parseShort()\n } else {\n // values are matched points\n component.matchedPoints = [p.parseUShort(), p.parseUShort()]\n }\n } else {\n // The arguments are bytes\n if ((flags & 2) > 0) {\n // values are offset\n component.dx = p.parseChar()\n component.dy = p.parseChar()\n } else {\n // values are matched points\n component.matchedPoints = [p.parseByte(), p.parseByte()]\n }\n }\n\n if ((flags & 8) > 0) {\n // We have a scale\n component.xScale = component.yScale = p.parseF2Dot14()\n } else if ((flags & 64) > 0) {\n // We have an X / Y scale\n component.xScale = p.parseF2Dot14()\n component.yScale = p.parseF2Dot14()\n } else if ((flags & 128) > 0) {\n // We have a 2x2 transformation\n component.xScale = p.parseF2Dot14()\n component.scale01 = p.parseF2Dot14()\n component.scale10 = p.parseF2Dot14()\n component.yScale = p.parseF2Dot14()\n }\n\n glyph.components.push(component)\n moreComponents = !!(flags & 32)\n }\n if (flags & 0x100) {\n // We have instructions\n glyph.instructionLength = p.parseUShort()\n glyph.instructions = []\n for (var i$6 = 0; i$6 < glyph.instructionLength; i$6 += 1) {\n glyph.instructions.push(p.parseByte())\n }\n }\n }\n }\n\n // Transform an array of points and return a new array.\n function transformPoints(points, transform) {\n var newPoints = []\n for (var i = 0; i < points.length; i += 1) {\n var pt = points[i]\n var newPt = {\n x: transform.xScale * pt.x + transform.scale01 * pt.y + transform.dx,\n y: transform.scale10 * pt.x + transform.yScale * pt.y + transform.dy,\n onCurve: pt.onCurve,\n lastPointOfContour: pt.lastPointOfContour,\n }\n newPoints.push(newPt)\n }\n\n return newPoints\n }\n\n function getContours(points) {\n var contours = []\n var currentContour = []\n for (var i = 0; i < points.length; i += 1) {\n var pt = points[i]\n currentContour.push(pt)\n if (pt.lastPointOfContour) {\n contours.push(currentContour)\n currentContour = []\n }\n }\n\n check.argument(currentContour.length === 0, 'There are still points left in the current contour.')\n return contours\n }\n\n // Convert the TrueType glyph outline to a Path.\n function getPath(points) {\n var p = new Path()\n if (!points) {\n return p\n }\n\n var contours = getContours(points)\n\n for (var contourIndex = 0; contourIndex < contours.length; ++contourIndex) {\n var contour = contours[contourIndex]\n\n var prev = null\n var curr = contour[contour.length - 1]\n var next = contour[0]\n\n if (curr.onCurve) {\n p.moveTo(curr.x, curr.y)\n } else {\n if (next.onCurve) {\n p.moveTo(next.x, next.y)\n } else {\n // If both first and last points are off-curve, start at their middle.\n var start = { x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5 }\n p.moveTo(start.x, start.y)\n }\n }\n\n for (var i = 0; i < contour.length; ++i) {\n prev = curr\n curr = next\n next = contour[(i + 1) % contour.length]\n\n if (curr.onCurve) {\n // This is a straight line.\n p.lineTo(curr.x, curr.y)\n } else {\n var prev2 = prev\n var next2 = next\n\n if (!prev.onCurve) {\n prev2 = { x: (curr.x + prev.x) * 0.5, y: (curr.y + prev.y) * 0.5 }\n }\n\n if (!next.onCurve) {\n next2 = { x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5 }\n }\n\n p.quadraticCurveTo(curr.x, curr.y, next2.x, next2.y)\n }\n }\n\n p.closePath()\n }\n return p\n }\n\n function buildPath(glyphs, glyph) {\n if (glyph.isComposite) {\n for (var j = 0; j < glyph.components.length; j += 1) {\n var component = glyph.components[j]\n var componentGlyph = glyphs.get(component.glyphIndex)\n // Force the ttfGlyphLoader to parse the glyph.\n componentGlyph.getPath()\n if (componentGlyph.points) {\n var transformedPoints = void 0\n if (component.matchedPoints === undefined) {\n // component positioned by offset\n transformedPoints = transformPoints(componentGlyph.points, component)\n } else {\n // component positioned by matched points\n if (\n component.matchedPoints[0] > glyph.points.length - 1 ||\n component.matchedPoints[1] > componentGlyph.points.length - 1\n ) {\n throw Error('Matched points out of range in ' + glyph.name)\n }\n var firstPt = glyph.points[component.matchedPoints[0]]\n var secondPt = componentGlyph.points[component.matchedPoints[1]]\n var transform = {\n xScale: component.xScale,\n scale01: component.scale01,\n scale10: component.scale10,\n yScale: component.yScale,\n dx: 0,\n dy: 0,\n }\n secondPt = transformPoints([secondPt], transform)[0]\n transform.dx = firstPt.x - secondPt.x\n transform.dy = firstPt.y - secondPt.y\n transformedPoints = transformPoints(componentGlyph.points, transform)\n }\n glyph.points = glyph.points.concat(transformedPoints)\n }\n }\n }\n\n return getPath(glyph.points)\n }\n\n function parseGlyfTableAll(data, start, loca, font) {\n var glyphs = new glyphset.GlyphSet(font)\n\n // The last element of the loca table is invalid.\n for (var i = 0; i < loca.length - 1; i += 1) {\n var offset = loca[i]\n var nextOffset = loca[i + 1]\n if (offset !== nextOffset) {\n glyphs.push(i, glyphset.ttfGlyphLoader(font, i, parseGlyph, data, start + offset, buildPath))\n } else {\n glyphs.push(i, glyphset.glyphLoader(font, i))\n }\n }\n\n return glyphs\n }\n\n function parseGlyfTableOnLowMemory(data, start, loca, font) {\n var glyphs = new glyphset.GlyphSet(font)\n\n font._push = function (i) {\n var offset = loca[i]\n var nextOffset = loca[i + 1]\n if (offset !== nextOffset) {\n glyphs.push(i, glyphset.ttfGlyphLoader(font, i, parseGlyph, data, start + offset, buildPath))\n } else {\n glyphs.push(i, glyphset.glyphLoader(font, i))\n }\n }\n\n return glyphs\n }\n\n // Parse all the glyphs according to the offsets from the `loca` table.\n function parseGlyfTable(data, start, loca, font, opt) {\n if (opt.lowMemory) {\n return parseGlyfTableOnLowMemory(data, start, loca, font)\n } else {\n return parseGlyfTableAll(data, start, loca, font)\n }\n }\n\n var glyf = { getPath: getPath, parse: parseGlyfTable }\n\n /* A TrueType font hinting interpreter.\n *\n * (c) 2017 Axel Kittenberger\n *\n * This interpreter has been implemented according to this documentation:\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM05/Chap5.html\n *\n * According to the documentation F24DOT6 values are used for pixels.\n * That means calculation is 1/64 pixel accurate and uses integer operations.\n * However, Javascript has floating point operations by default and only\n * those are available. One could make a case to simulate the 1/64 accuracy\n * exactly by truncating after every division operation\n * (for example with << 0) to get pixel exactly results as other TrueType\n * implementations. It may make sense since some fonts are pixel optimized\n * by hand using DELTAP instructions. The current implementation doesn't\n * and rather uses full floating point precision.\n *\n * xScale, yScale and rotation is currently ignored.\n *\n * A few non-trivial instructions are missing as I didn't encounter yet\n * a font that used them to test a possible implementation.\n *\n * Some fonts seem to use undocumented features regarding the twilight zone.\n * Only some of them are implemented as they were encountered.\n *\n * The exports.DEBUG statements are removed on the minified distribution file.\n */\n\n var instructionTable\n var exec\n var execGlyph\n var execComponent\n\n /*\n * Creates a hinting object.\n *\n * There ought to be exactly one\n * for each truetype font that is used for hinting.\n */\n function Hinting(font) {\n // the font this hinting object is for\n this.font = font\n\n this.getCommands = function (hPoints) {\n return glyf.getPath(hPoints).commands\n }\n\n // cached states\n this._fpgmState = this._prepState = undefined\n\n // errorState\n // 0 ... all okay\n // 1 ... had an error in a glyf,\n // continue working but stop spamming\n // the console\n // 2 ... error at prep, stop hinting at this ppem\n // 3 ... error at fpeg, stop hinting for this font at all\n this._errorState = 0\n }\n\n /*\n * Not rounding.\n */\n function roundOff(v) {\n return v\n }\n\n /*\n * Rounding to grid.\n */\n function roundToGrid(v) {\n //Rounding in TT is supposed to \"symmetrical around zero\"\n return Math.sign(v) * Math.round(Math.abs(v))\n }\n\n /*\n * Rounding to double grid.\n */\n function roundToDoubleGrid(v) {\n return (Math.sign(v) * Math.round(Math.abs(v * 2))) / 2\n }\n\n /*\n * Rounding to half grid.\n */\n function roundToHalfGrid(v) {\n return Math.sign(v) * (Math.round(Math.abs(v) + 0.5) - 0.5)\n }\n\n /*\n * Rounding to up to grid.\n */\n function roundUpToGrid(v) {\n return Math.sign(v) * Math.ceil(Math.abs(v))\n }\n\n /*\n * Rounding to down to grid.\n */\n function roundDownToGrid(v) {\n return Math.sign(v) * Math.floor(Math.abs(v))\n }\n\n /*\n * Super rounding.\n */\n var roundSuper = function (v) {\n var period = this.srPeriod\n var phase = this.srPhase\n var threshold = this.srThreshold\n var sign = 1\n\n if (v < 0) {\n v = -v\n sign = -1\n }\n\n v += threshold - phase\n\n v = Math.trunc(v / period) * period\n\n v += phase\n\n // according to http://xgridfit.sourceforge.net/round.html\n if (v < 0) {\n return phase * sign\n }\n\n return v * sign\n }\n\n /*\n * Unit vector of x-axis.\n */\n var xUnitVector = {\n x: 1,\n\n y: 0,\n\n axis: 'x',\n\n // Gets the projected distance between two points.\n // o1/o2 ... if true, respective original position is used.\n distance: function (p1, p2, o1, o2) {\n return (o1 ? p1.xo : p1.x) - (o2 ? p2.xo : p2.x)\n },\n\n // Moves point p so the moved position has the same relative\n // position to the moved positions of rp1 and rp2 than the\n // original positions had.\n //\n // See APPENDIX on INTERPOLATE at the bottom of this file.\n interpolate: function (p, rp1, rp2, pv) {\n var do1\n var do2\n var doa1\n var doa2\n var dm1\n var dm2\n var dt\n\n if (!pv || pv === this) {\n do1 = p.xo - rp1.xo\n do2 = p.xo - rp2.xo\n dm1 = rp1.x - rp1.xo\n dm2 = rp2.x - rp2.xo\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n p.x = p.xo + (dm1 + dm2) / 2\n return\n }\n\n p.x = p.xo + (dm1 * doa2 + dm2 * doa1) / dt\n return\n }\n\n do1 = pv.distance(p, rp1, true, true)\n do2 = pv.distance(p, rp2, true, true)\n dm1 = pv.distance(rp1, rp1, false, true)\n dm2 = pv.distance(rp2, rp2, false, true)\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n xUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true)\n return\n }\n\n xUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true)\n },\n\n // Slope of line normal to this\n normalSlope: Number.NEGATIVE_INFINITY,\n\n // Sets the point 'p' relative to point 'rp'\n // by the distance 'd'.\n //\n // See APPENDIX on SETRELATIVE at the bottom of this file.\n //\n // p ... point to set\n // rp ... reference point\n // d ... distance on projection vector\n // pv ... projection vector (undefined = this)\n // org ... if true, uses the original position of rp as reference.\n setRelative: function (p, rp, d, pv, org) {\n if (!pv || pv === this) {\n p.x = (org ? rp.xo : rp.x) + d\n return\n }\n\n var rpx = org ? rp.xo : rp.x\n var rpy = org ? rp.yo : rp.y\n var rpdx = rpx + d * pv.x\n var rpdy = rpy + d * pv.y\n\n p.x = rpdx + (p.y - rpdy) / pv.normalSlope\n },\n\n // Slope of vector line.\n slope: 0,\n\n // Touches the point p.\n touch: function (p) {\n p.xTouched = true\n },\n\n // Tests if a point p is touched.\n touched: function (p) {\n return p.xTouched\n },\n\n // Untouches the point p.\n untouch: function (p) {\n p.xTouched = false\n },\n }\n\n /*\n * Unit vector of y-axis.\n */\n var yUnitVector = {\n x: 0,\n\n y: 1,\n\n axis: 'y',\n\n // Gets the projected distance between two points.\n // o1/o2 ... if true, respective original position is used.\n distance: function (p1, p2, o1, o2) {\n return (o1 ? p1.yo : p1.y) - (o2 ? p2.yo : p2.y)\n },\n\n // Moves point p so the moved position has the same relative\n // position to the moved positions of rp1 and rp2 than the\n // original positions had.\n //\n // See APPENDIX on INTERPOLATE at the bottom of this file.\n interpolate: function (p, rp1, rp2, pv) {\n var do1\n var do2\n var doa1\n var doa2\n var dm1\n var dm2\n var dt\n\n if (!pv || pv === this) {\n do1 = p.yo - rp1.yo\n do2 = p.yo - rp2.yo\n dm1 = rp1.y - rp1.yo\n dm2 = rp2.y - rp2.yo\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n p.y = p.yo + (dm1 + dm2) / 2\n return\n }\n\n p.y = p.yo + (dm1 * doa2 + dm2 * doa1) / dt\n return\n }\n\n do1 = pv.distance(p, rp1, true, true)\n do2 = pv.distance(p, rp2, true, true)\n dm1 = pv.distance(rp1, rp1, false, true)\n dm2 = pv.distance(rp2, rp2, false, true)\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n yUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true)\n return\n }\n\n yUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true)\n },\n\n // Slope of line normal to this.\n normalSlope: 0,\n\n // Sets the point 'p' relative to point 'rp'\n // by the distance 'd'\n //\n // See APPENDIX on SETRELATIVE at the bottom of this file.\n //\n // p ... point to set\n // rp ... reference point\n // d ... distance on projection vector\n // pv ... projection vector (undefined = this)\n // org ... if true, uses the original position of rp as reference.\n setRelative: function (p, rp, d, pv, org) {\n if (!pv || pv === this) {\n p.y = (org ? rp.yo : rp.y) + d\n return\n }\n\n var rpx = org ? rp.xo : rp.x\n var rpy = org ? rp.yo : rp.y\n var rpdx = rpx + d * pv.x\n var rpdy = rpy + d * pv.y\n\n p.y = rpdy + pv.normalSlope * (p.x - rpdx)\n },\n\n // Slope of vector line.\n slope: Number.POSITIVE_INFINITY,\n\n // Touches the point p.\n touch: function (p) {\n p.yTouched = true\n },\n\n // Tests if a point p is touched.\n touched: function (p) {\n return p.yTouched\n },\n\n // Untouches the point p.\n untouch: function (p) {\n p.yTouched = false\n },\n }\n\n Object.freeze(xUnitVector)\n Object.freeze(yUnitVector)\n\n /*\n * Creates a unit vector that is not x- or y-axis.\n */\n function UnitVector(x, y) {\n this.x = x\n this.y = y\n this.axis = undefined\n this.slope = y / x\n this.normalSlope = -x / y\n Object.freeze(this)\n }\n\n /*\n * Gets the projected distance between two points.\n * o1/o2 ... if true, respective original position is used.\n */\n UnitVector.prototype.distance = function (p1, p2, o1, o2) {\n return this.x * xUnitVector.distance(p1, p2, o1, o2) + this.y * yUnitVector.distance(p1, p2, o1, o2)\n }\n\n /*\n * Moves point p so the moved position has the same relative\n * position to the moved positions of rp1 and rp2 than the\n * original positions had.\n *\n * See APPENDIX on INTERPOLATE at the bottom of this file.\n */\n UnitVector.prototype.interpolate = function (p, rp1, rp2, pv) {\n var dm1\n var dm2\n var do1\n var do2\n var doa1\n var doa2\n var dt\n\n do1 = pv.distance(p, rp1, true, true)\n do2 = pv.distance(p, rp2, true, true)\n dm1 = pv.distance(rp1, rp1, false, true)\n dm2 = pv.distance(rp2, rp2, false, true)\n doa1 = Math.abs(do1)\n doa2 = Math.abs(do2)\n dt = doa1 + doa2\n\n if (dt === 0) {\n this.setRelative(p, p, (dm1 + dm2) / 2, pv, true)\n return\n }\n\n this.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true)\n }\n\n /*\n * Sets the point 'p' relative to point 'rp'\n * by the distance 'd'\n *\n * See APPENDIX on SETRELATIVE at the bottom of this file.\n *\n * p ... point to set\n * rp ... reference point\n * d ... distance on projection vector\n * pv ... projection vector (undefined = this)\n * org ... if true, uses the original position of rp as reference.\n */\n UnitVector.prototype.setRelative = function (p, rp, d, pv, org) {\n pv = pv || this\n\n var rpx = org ? rp.xo : rp.x\n var rpy = org ? rp.yo : rp.y\n var rpdx = rpx + d * pv.x\n var rpdy = rpy + d * pv.y\n\n var pvns = pv.normalSlope\n var fvs = this.slope\n\n var px = p.x\n var py = p.y\n\n p.x = (fvs * px - pvns * rpdx + rpdy - py) / (fvs - pvns)\n p.y = fvs * (p.x - px) + py\n }\n\n /*\n * Touches the point p.\n */\n UnitVector.prototype.touch = function (p) {\n p.xTouched = true\n p.yTouched = true\n }\n\n /*\n * Returns a unit vector with x/y coordinates.\n */\n function getUnitVector(x, y) {\n var d = Math.sqrt(x * x + y * y)\n\n x /= d\n y /= d\n\n if (x === 1 && y === 0) {\n return xUnitVector\n } else if (x === 0 && y === 1) {\n return yUnitVector\n } else {\n return new UnitVector(x, y)\n }\n }\n\n /*\n * Creates a point in the hinting engine.\n */\n function HPoint(x, y, lastPointOfContour, onCurve) {\n this.x = this.xo = Math.round(x * 64) / 64 // hinted x value and original x-value\n this.y = this.yo = Math.round(y * 64) / 64 // hinted y value and original y-value\n\n this.lastPointOfContour = lastPointOfContour\n this.onCurve = onCurve\n this.prevPointOnContour = undefined\n this.nextPointOnContour = undefined\n this.xTouched = false\n this.yTouched = false\n\n Object.preventExtensions(this)\n }\n\n /*\n * Returns the next touched point on the contour.\n *\n * v ... unit vector to test touch axis.\n */\n HPoint.prototype.nextTouched = function (v) {\n var p = this.nextPointOnContour\n\n while (!v.touched(p) && p !== this) {\n p = p.nextPointOnContour\n }\n\n return p\n }\n\n /*\n * Returns the previous touched point on the contour\n *\n * v ... unit vector to test touch axis.\n */\n HPoint.prototype.prevTouched = function (v) {\n var p = this.prevPointOnContour\n\n while (!v.touched(p) && p !== this) {\n p = p.prevPointOnContour\n }\n\n return p\n }\n\n /*\n * The zero point.\n */\n var HPZero = Object.freeze(new HPoint(0, 0))\n\n /*\n * The default state of the interpreter.\n *\n * Note: Freezing the defaultState and then deriving from it\n * makes the V8 Javascript engine going awkward,\n * so this is avoided, albeit the defaultState shouldn't\n * ever change.\n */\n var defaultState = {\n cvCutIn: 17 / 16, // control value cut in\n deltaBase: 9,\n deltaShift: 0.125,\n loop: 1, // loops some instructions\n minDis: 1, // minimum distance\n autoFlip: true,\n }\n\n /*\n * The current state of the interpreter.\n *\n * env ... 'fpgm' or 'prep' or 'glyf'\n * prog ... the program\n */\n function State(env, prog) {\n this.env = env\n this.stack = []\n this.prog = prog\n\n switch (env) {\n case 'glyf':\n this.zp0 = this.zp1 = this.zp2 = 1\n this.rp0 = this.rp1 = this.rp2 = 0\n /* fall through */\n case 'prep':\n this.fv = this.pv = this.dpv = xUnitVector\n this.round = roundToGrid\n }\n }\n\n /*\n * Executes a glyph program.\n *\n * This does the hinting for each glyph.\n *\n * Returns an array of moved points.\n *\n * glyph: the glyph to hint\n * ppem: the size the glyph is rendered for\n */\n Hinting.prototype.exec = function (glyph, ppem) {\n if (typeof ppem !== 'number') {\n throw new Error('Point size is not a number!')\n }\n\n // Received a fatal error, don't do any hinting anymore.\n if (this._errorState > 2) {\n return\n }\n\n var font = this.font\n var prepState = this._prepState\n\n if (!prepState || prepState.ppem !== ppem) {\n var fpgmState = this._fpgmState\n\n if (!fpgmState) {\n // Executes the fpgm state.\n // This is used by fonts to define functions.\n State.prototype = defaultState\n\n fpgmState = this._fpgmState = new State('fpgm', font.tables.fpgm)\n\n fpgmState.funcs = []\n fpgmState.font = font\n\n if (exports.DEBUG) {\n console.log('---EXEC FPGM---')\n fpgmState.step = -1\n }\n\n try {\n exec(fpgmState)\n } catch (e) {\n console.log('Hinting error in FPGM:' + e)\n this._errorState = 3\n return\n }\n }\n\n // Executes the prep program for this ppem setting.\n // This is used by fonts to set cvt values\n // depending on to be rendered font size.\n\n State.prototype = fpgmState\n prepState = this._prepState = new State('prep', font.tables.prep)\n\n prepState.ppem = ppem\n\n // Creates a copy of the cvt table\n // and scales it to the current ppem setting.\n var oCvt = font.tables.cvt\n if (oCvt) {\n var cvt = (prepState.cvt = new Array(oCvt.length))\n var scale = ppem / font.unitsPerEm\n for (var c = 0; c < oCvt.length; c++) {\n cvt[c] = oCvt[c] * scale\n }\n } else {\n prepState.cvt = []\n }\n\n if (exports.DEBUG) {\n console.log('---EXEC PREP---')\n prepState.step = -1\n }\n\n try {\n exec(prepState)\n } catch (e) {\n if (this._errorState < 2) {\n console.log('Hinting error in PREP:' + e)\n }\n this._errorState = 2\n }\n }\n\n if (this._errorState > 1) {\n return\n }\n\n try {\n return execGlyph(glyph, prepState)\n } catch (e) {\n if (this._errorState < 1) {\n console.log('Hinting error:' + e)\n console.log('Note: further hinting errors are silenced')\n }\n this._errorState = 1\n return undefined\n }\n }\n\n /*\n * Executes the hinting program for a glyph.\n */\n execGlyph = function (glyph, prepState) {\n // original point positions\n var xScale = prepState.ppem / prepState.font.unitsPerEm\n var yScale = xScale\n var components = glyph.components\n var contours\n var gZone\n var state\n\n State.prototype = prepState\n if (!components) {\n state = new State('glyf', glyph.instructions)\n if (exports.DEBUG) {\n console.log('---EXEC GLYPH---')\n state.step = -1\n }\n execComponent(glyph, state, xScale, yScale)\n gZone = state.gZone\n } else {\n var font = prepState.font\n gZone = []\n contours = []\n for (var i = 0; i < components.length; i++) {\n var c = components[i]\n var cg = font.glyphs.get(c.glyphIndex)\n\n state = new State('glyf', cg.instructions)\n\n if (exports.DEBUG) {\n console.log('---EXEC COMP ' + i + '---')\n state.step = -1\n }\n\n execComponent(cg, state, xScale, yScale)\n // appends the computed points to the result array\n // post processes the component points\n var dx = Math.round(c.dx * xScale)\n var dy = Math.round(c.dy * yScale)\n var gz = state.gZone\n var cc = state.contours\n for (var pi = 0; pi < gz.length; pi++) {\n var p = gz[pi]\n p.xTouched = p.yTouched = false\n p.xo = p.x = p.x + dx\n p.yo = p.y = p.y + dy\n }\n\n var gLen = gZone.length\n gZone.push.apply(gZone, gz)\n for (var j = 0; j < cc.length; j++) {\n contours.push(cc[j] + gLen)\n }\n }\n\n if (glyph.instructions && !state.inhibitGridFit) {\n // the composite has instructions on its own\n state = new State('glyf', glyph.instructions)\n\n state.gZone = state.z0 = state.z1 = state.z2 = gZone\n\n state.contours = contours\n\n // note: HPZero cannot be used here, since\n // the point might be modified\n gZone.push(new HPoint(0, 0), new HPoint(Math.round(glyph.advanceWidth * xScale), 0))\n\n if (exports.DEBUG) {\n console.log('---EXEC COMPOSITE---')\n state.step = -1\n }\n\n exec(state)\n\n gZone.length -= 2\n }\n }\n\n return gZone\n }\n\n /*\n * Executes the hinting program for a component of a multi-component glyph\n * or of the glyph itself for a non-component glyph.\n */\n execComponent = function (glyph, state, xScale, yScale) {\n var points = glyph.points || []\n var pLen = points.length\n var gZone = (state.gZone = state.z0 = state.z1 = state.z2 = [])\n var contours = (state.contours = [])\n\n // Scales the original points and\n // makes copies for the hinted points.\n var cp // current point\n for (var i = 0; i < pLen; i++) {\n cp = points[i]\n\n gZone[i] = new HPoint(cp.x * xScale, cp.y * yScale, cp.lastPointOfContour, cp.onCurve)\n }\n\n // Chain links the contours.\n var sp // start point\n var np // next point\n\n for (var i$1 = 0; i$1 < pLen; i$1++) {\n cp = gZone[i$1]\n\n if (!sp) {\n sp = cp\n contours.push(i$1)\n }\n\n if (cp.lastPointOfContour) {\n cp.nextPointOnContour = sp\n sp.prevPointOnContour = cp\n sp = undefined\n } else {\n np = gZone[i$1 + 1]\n cp.nextPointOnContour = np\n np.prevPointOnContour = cp\n }\n }\n\n if (state.inhibitGridFit) {\n return\n }\n\n if (exports.DEBUG) {\n console.log('PROCESSING GLYPH', state.stack)\n for (var i$2 = 0; i$2 < pLen; i$2++) {\n console.log(i$2, gZone[i$2].x, gZone[i$2].y)\n }\n }\n\n gZone.push(new HPoint(0, 0), new HPoint(Math.round(glyph.advanceWidth * xScale), 0))\n\n exec(state)\n\n // Removes the extra points.\n gZone.length -= 2\n\n if (exports.DEBUG) {\n console.log('FINISHED GLYPH', state.stack)\n for (var i$3 = 0; i$3 < pLen; i$3++) {\n console.log(i$3, gZone[i$3].x, gZone[i$3].y)\n }\n }\n }\n\n /*\n * Executes the program loaded in state.\n */\n exec = function (state) {\n var prog = state.prog\n\n if (!prog) {\n return\n }\n\n var pLen = prog.length\n var ins\n\n for (state.ip = 0; state.ip < pLen; state.ip++) {\n if (exports.DEBUG) {\n state.step++\n }\n ins = instructionTable[prog[state.ip]]\n\n if (!ins) {\n throw new Error('unknown instruction: 0x' + Number(prog[state.ip]).toString(16))\n }\n\n ins(state)\n\n // very extensive debugging for each step\n /*\n if (exports.DEBUG) {\n var da;\n if (state.gZone) {\n da = [];\n for (let i = 0; i < state.gZone.length; i++)\n {\n da.push(i + ' ' +\n state.gZone[i].x * 64 + ' ' +\n state.gZone[i].y * 64 + ' ' +\n (state.gZone[i].xTouched ? 'x' : '') +\n (state.gZone[i].yTouched ? 'y' : '')\n );\n }\n console.log('GZ', da);\n }\n\n if (state.tZone) {\n da = [];\n for (let i = 0; i < state.tZone.length; i++) {\n da.push(i + ' ' +\n state.tZone[i].x * 64 + ' ' +\n state.tZone[i].y * 64 + ' ' +\n (state.tZone[i].xTouched ? 'x' : '') +\n (state.tZone[i].yTouched ? 'y' : '')\n );\n }\n console.log('TZ', da);\n }\n\n if (state.stack.length > 10) {\n console.log(\n state.stack.length,\n '...', state.stack.slice(state.stack.length - 10)\n );\n } else {\n console.log(state.stack.length, state.stack);\n }\n }\n */\n }\n }\n\n /*\n * Initializes the twilight zone.\n *\n * This is only done if a SZPx instruction\n * refers to the twilight zone.\n */\n function initTZone(state) {\n var tZone = (state.tZone = new Array(state.gZone.length))\n\n // no idea if this is actually correct...\n for (var i = 0; i < tZone.length; i++) {\n tZone[i] = new HPoint(0, 0)\n }\n }\n\n /*\n * Skips the instruction pointer ahead over an IF/ELSE block.\n * handleElse .. if true breaks on matching ELSE\n */\n function skip(state, handleElse) {\n var prog = state.prog\n var ip = state.ip\n var nesting = 1\n var ins\n\n do {\n ins = prog[++ip]\n if (ins === 0x58) {\n // IF\n nesting++\n } else if (ins === 0x59) {\n // EIF\n nesting--\n } else if (ins === 0x40) {\n // NPUSHB\n ip += prog[ip + 1] + 1\n } else if (ins === 0x41) {\n // NPUSHW\n ip += 2 * prog[ip + 1] + 1\n } else if (ins >= 0xb0 && ins <= 0xb7) {\n // PUSHB\n ip += ins - 0xb0 + 1\n } else if (ins >= 0xb8 && ins <= 0xbf) {\n // PUSHW\n ip += (ins - 0xb8 + 1) * 2\n } else if (handleElse && nesting === 1 && ins === 0x1b) {\n // ELSE\n break\n }\n } while (nesting > 0)\n\n state.ip = ip\n }\n\n /*----------------------------------------------------------*\n * And then a lot of instructions... *\n *----------------------------------------------------------*/\n\n // SVTCA[a] Set freedom and projection Vectors To Coordinate Axis\n // 0x00-0x01\n function SVTCA(v, state) {\n if (exports.DEBUG) {\n console.log(state.step, 'SVTCA[' + v.axis + ']')\n }\n\n state.fv = state.pv = state.dpv = v\n }\n\n // SPVTCA[a] Set Projection Vector to Coordinate Axis\n // 0x02-0x03\n function SPVTCA(v, state) {\n if (exports.DEBUG) {\n console.log(state.step, 'SPVTCA[' + v.axis + ']')\n }\n\n state.pv = state.dpv = v\n }\n\n // SFVTCA[a] Set Freedom Vector to Coordinate Axis\n // 0x04-0x05\n function SFVTCA(v, state) {\n if (exports.DEBUG) {\n console.log(state.step, 'SFVTCA[' + v.axis + ']')\n }\n\n state.fv = v\n }\n\n // SPVTL[a] Set Projection Vector To Line\n // 0x06-0x07\n function SPVTL(a, state) {\n var stack = state.stack\n var p2i = stack.pop()\n var p1i = stack.pop()\n var p2 = state.z2[p2i]\n var p1 = state.z1[p1i]\n\n if (exports.DEBUG) {\n console.log('SPVTL[' + a + ']', p2i, p1i)\n }\n\n var dx\n var dy\n\n if (!a) {\n dx = p1.x - p2.x\n dy = p1.y - p2.y\n } else {\n dx = p2.y - p1.y\n dy = p1.x - p2.x\n }\n\n state.pv = state.dpv = getUnitVector(dx, dy)\n }\n\n // SFVTL[a] Set Freedom Vector To Line\n // 0x08-0x09\n function SFVTL(a, state) {\n var stack = state.stack\n var p2i = stack.pop()\n var p1i = stack.pop()\n var p2 = state.z2[p2i]\n var p1 = state.z1[p1i]\n\n if (exports.DEBUG) {\n console.log('SFVTL[' + a + ']', p2i, p1i)\n }\n\n var dx\n var dy\n\n if (!a) {\n dx = p1.x - p2.x\n dy = p1.y - p2.y\n } else {\n dx = p2.y - p1.y\n dy = p1.x - p2.x\n }\n\n state.fv = getUnitVector(dx, dy)\n }\n\n // SPVFS[] Set Projection Vector From Stack\n // 0x0A\n function SPVFS(state) {\n var stack = state.stack\n var y = stack.pop()\n var x = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SPVFS[]', y, x)\n }\n\n state.pv = state.dpv = getUnitVector(x, y)\n }\n\n // SFVFS[] Set Freedom Vector From Stack\n // 0x0B\n function SFVFS(state) {\n var stack = state.stack\n var y = stack.pop()\n var x = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SPVFS[]', y, x)\n }\n\n state.fv = getUnitVector(x, y)\n }\n\n // GPV[] Get Projection Vector\n // 0x0C\n function GPV(state) {\n var stack = state.stack\n var pv = state.pv\n\n if (exports.DEBUG) {\n console.log(state.step, 'GPV[]')\n }\n\n stack.push(pv.x * 0x4000)\n stack.push(pv.y * 0x4000)\n }\n\n // GFV[] Get Freedom Vector\n // 0x0C\n function GFV(state) {\n var stack = state.stack\n var fv = state.fv\n\n if (exports.DEBUG) {\n console.log(state.step, 'GFV[]')\n }\n\n stack.push(fv.x * 0x4000)\n stack.push(fv.y * 0x4000)\n }\n\n // SFVTPV[] Set Freedom Vector To Projection Vector\n // 0x0E\n function SFVTPV(state) {\n state.fv = state.pv\n\n if (exports.DEBUG) {\n console.log(state.step, 'SFVTPV[]')\n }\n }\n\n // ISECT[] moves point p to the InterSECTion of two lines\n // 0x0F\n function ISECT(state) {\n var stack = state.stack\n var pa0i = stack.pop()\n var pa1i = stack.pop()\n var pb0i = stack.pop()\n var pb1i = stack.pop()\n var pi = stack.pop()\n var z0 = state.z0\n var z1 = state.z1\n var pa0 = z0[pa0i]\n var pa1 = z0[pa1i]\n var pb0 = z1[pb0i]\n var pb1 = z1[pb1i]\n var p = state.z2[pi]\n\n if (exports.DEBUG) {\n console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi)\n }\n\n // math from\n // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line\n\n var x1 = pa0.x\n var y1 = pa0.y\n var x2 = pa1.x\n var y2 = pa1.y\n var x3 = pb0.x\n var y3 = pb0.y\n var x4 = pb1.x\n var y4 = pb1.y\n\n var div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)\n var f1 = x1 * y2 - y1 * x2\n var f2 = x3 * y4 - y3 * x4\n\n p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div\n p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div\n }\n\n // SRP0[] Set Reference Point 0\n // 0x10\n function SRP0(state) {\n state.rp0 = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SRP0[]', state.rp0)\n }\n }\n\n // SRP1[] Set Reference Point 1\n // 0x11\n function SRP1(state) {\n state.rp1 = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SRP1[]', state.rp1)\n }\n }\n\n // SRP1[] Set Reference Point 2\n // 0x12\n function SRP2(state) {\n state.rp2 = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SRP2[]', state.rp2)\n }\n }\n\n // SZP0[] Set Zone Pointer 0\n // 0x13\n function SZP0(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZP0[]', n)\n }\n\n state.zp0 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z0 = state.tZone\n break\n case 1:\n state.z0 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SZP1[] Set Zone Pointer 1\n // 0x14\n function SZP1(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZP1[]', n)\n }\n\n state.zp1 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z1 = state.tZone\n break\n case 1:\n state.z1 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SZP2[] Set Zone Pointer 2\n // 0x15\n function SZP2(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZP2[]', n)\n }\n\n state.zp2 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z2 = state.tZone\n break\n case 1:\n state.z2 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SZPS[] Set Zone PointerS\n // 0x16\n function SZPS(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SZPS[]', n)\n }\n\n state.zp0 = state.zp1 = state.zp2 = n\n\n switch (n) {\n case 0:\n if (!state.tZone) {\n initTZone(state)\n }\n state.z0 = state.z1 = state.z2 = state.tZone\n break\n case 1:\n state.z0 = state.z1 = state.z2 = state.gZone\n break\n default:\n throw new Error('Invalid zone pointer')\n }\n }\n\n // SLOOP[] Set LOOP variable\n // 0x17\n function SLOOP(state) {\n state.loop = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SLOOP[]', state.loop)\n }\n }\n\n // RTG[] Round To Grid\n // 0x18\n function RTG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RTG[]')\n }\n\n state.round = roundToGrid\n }\n\n // RTHG[] Round To Half Grid\n // 0x19\n function RTHG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RTHG[]')\n }\n\n state.round = roundToHalfGrid\n }\n\n // SMD[] Set Minimum Distance\n // 0x1A\n function SMD(state) {\n var d = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SMD[]', d)\n }\n\n state.minDis = d / 0x40\n }\n\n // ELSE[] ELSE clause\n // 0x1B\n function ELSE(state) {\n // This instruction has been reached by executing a then branch\n // so it just skips ahead until matching EIF.\n //\n // In case the IF was negative the IF[] instruction already\n // skipped forward over the ELSE[]\n\n if (exports.DEBUG) {\n console.log(state.step, 'ELSE[]')\n }\n\n skip(state, false)\n }\n\n // JMPR[] JuMP Relative\n // 0x1C\n function JMPR(state) {\n var o = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'JMPR[]', o)\n }\n\n // A jump by 1 would do nothing.\n state.ip += o - 1\n }\n\n // SCVTCI[] Set Control Value Table Cut-In\n // 0x1D\n function SCVTCI(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SCVTCI[]', n)\n }\n\n state.cvCutIn = n / 0x40\n }\n\n // DUP[] DUPlicate top stack element\n // 0x20\n function DUP(state) {\n var stack = state.stack\n\n if (exports.DEBUG) {\n console.log(state.step, 'DUP[]')\n }\n\n stack.push(stack[stack.length - 1])\n }\n\n // POP[] POP top stack element\n // 0x21\n function POP(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'POP[]')\n }\n\n state.stack.pop()\n }\n\n // CLEAR[] CLEAR the stack\n // 0x22\n function CLEAR(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'CLEAR[]')\n }\n\n state.stack.length = 0\n }\n\n // SWAP[] SWAP the top two elements on the stack\n // 0x23\n function SWAP(state) {\n var stack = state.stack\n\n var a = stack.pop()\n var b = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SWAP[]')\n }\n\n stack.push(a)\n stack.push(b)\n }\n\n // DEPTH[] DEPTH of the stack\n // 0x24\n function DEPTH(state) {\n var stack = state.stack\n\n if (exports.DEBUG) {\n console.log(state.step, 'DEPTH[]')\n }\n\n stack.push(stack.length)\n }\n\n // LOOPCALL[] LOOPCALL function\n // 0x2A\n function LOOPCALL(state) {\n var stack = state.stack\n var fn = stack.pop()\n var c = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'LOOPCALL[]', fn, c)\n }\n\n // saves callers program\n var cip = state.ip\n var cprog = state.prog\n\n state.prog = state.funcs[fn]\n\n // executes the function\n for (var i = 0; i < c; i++) {\n exec(state)\n\n if (exports.DEBUG) {\n console.log(++state.step, i + 1 < c ? 'next loopcall' : 'done loopcall', i)\n }\n }\n\n // restores the callers program\n state.ip = cip\n state.prog = cprog\n }\n\n // CALL[] CALL function\n // 0x2B\n function CALL(state) {\n var fn = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'CALL[]', fn)\n }\n\n // saves callers program\n var cip = state.ip\n var cprog = state.prog\n\n state.prog = state.funcs[fn]\n\n // executes the function\n exec(state)\n\n // restores the callers program\n state.ip = cip\n state.prog = cprog\n\n if (exports.DEBUG) {\n console.log(++state.step, 'returning from', fn)\n }\n }\n\n // CINDEX[] Copy the INDEXed element to the top of the stack\n // 0x25\n function CINDEX(state) {\n var stack = state.stack\n var k = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'CINDEX[]', k)\n }\n\n // In case of k == 1, it copies the last element after popping\n // thus stack.length - k.\n stack.push(stack[stack.length - k])\n }\n\n // MINDEX[] Move the INDEXed element to the top of the stack\n // 0x26\n function MINDEX(state) {\n var stack = state.stack\n var k = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MINDEX[]', k)\n }\n\n stack.push(stack.splice(stack.length - k, 1)[0])\n }\n\n // FDEF[] Function DEFinition\n // 0x2C\n function FDEF(state) {\n if (state.env !== 'fpgm') {\n throw new Error('FDEF not allowed here')\n }\n var stack = state.stack\n var prog = state.prog\n var ip = state.ip\n\n var fn = stack.pop()\n var ipBegin = ip\n\n if (exports.DEBUG) {\n console.log(state.step, 'FDEF[]', fn)\n }\n\n while (prog[++ip] !== 0x2d) {}\n\n state.ip = ip\n state.funcs[fn] = prog.slice(ipBegin + 1, ip)\n }\n\n // MDAP[a] Move Direct Absolute Point\n // 0x2E-0x2F\n function MDAP(round, state) {\n var pi = state.stack.pop()\n var p = state.z0[pi]\n var fv = state.fv\n var pv = state.pv\n\n if (exports.DEBUG) {\n console.log(state.step, 'MDAP[' + round + ']', pi)\n }\n\n var d = pv.distance(p, HPZero)\n\n if (round) {\n d = state.round(d)\n }\n\n fv.setRelative(p, HPZero, d, pv)\n fv.touch(p)\n\n state.rp0 = state.rp1 = pi\n }\n\n // IUP[a] Interpolate Untouched Points through the outline\n // 0x30\n function IUP(v, state) {\n var z2 = state.z2\n var pLen = z2.length - 2\n var cp\n var pp\n var np\n\n if (exports.DEBUG) {\n console.log(state.step, 'IUP[' + v.axis + ']')\n }\n\n for (var i = 0; i < pLen; i++) {\n cp = z2[i] // current point\n\n // if this point has been touched go on\n if (v.touched(cp)) {\n continue\n }\n\n pp = cp.prevTouched(v)\n\n // no point on the contour has been touched?\n if (pp === cp) {\n continue\n }\n\n np = cp.nextTouched(v)\n\n if (pp === np) {\n // only one point on the contour has been touched\n // so simply moves the point like that\n\n v.setRelative(cp, cp, v.distance(pp, pp, false, true), v, true)\n }\n\n v.interpolate(cp, pp, np, v)\n }\n }\n\n // SHP[] SHift Point using reference point\n // 0x32-0x33\n function SHP(a, state) {\n var stack = state.stack\n var rpi = a ? state.rp1 : state.rp2\n var rp = (a ? state.z0 : state.z1)[rpi]\n var fv = state.fv\n var pv = state.pv\n var loop = state.loop\n var z2 = state.z2\n\n while (loop--) {\n var pi = stack.pop()\n var p = z2[pi]\n\n var d = pv.distance(rp, rp, false, true)\n fv.setRelative(p, p, d, pv)\n fv.touch(p)\n\n if (exports.DEBUG) {\n console.log(\n state.step,\n (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'SHP[' + (a ? 'rp1' : 'rp2') + ']',\n pi,\n )\n }\n }\n\n state.loop = 1\n }\n\n // SHC[] SHift Contour using reference point\n // 0x36-0x37\n function SHC(a, state) {\n var stack = state.stack\n var rpi = a ? state.rp1 : state.rp2\n var rp = (a ? state.z0 : state.z1)[rpi]\n var fv = state.fv\n var pv = state.pv\n var ci = stack.pop()\n var sp = state.z2[state.contours[ci]]\n var p = sp\n\n if (exports.DEBUG) {\n console.log(state.step, 'SHC[' + a + ']', ci)\n }\n\n var d = pv.distance(rp, rp, false, true)\n\n do {\n if (p !== rp) {\n fv.setRelative(p, p, d, pv)\n }\n p = p.nextPointOnContour\n } while (p !== sp)\n }\n\n // SHZ[] SHift Zone using reference point\n // 0x36-0x37\n function SHZ(a, state) {\n var stack = state.stack\n var rpi = a ? state.rp1 : state.rp2\n var rp = (a ? state.z0 : state.z1)[rpi]\n var fv = state.fv\n var pv = state.pv\n\n var e = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SHZ[' + a + ']', e)\n }\n\n var z\n switch (e) {\n case 0:\n z = state.tZone\n break\n case 1:\n z = state.gZone\n break\n default:\n throw new Error('Invalid zone')\n }\n\n var p\n var d = pv.distance(rp, rp, false, true)\n var pLen = z.length - 2\n for (var i = 0; i < pLen; i++) {\n p = z[i]\n fv.setRelative(p, p, d, pv)\n //if (p !== rp) fv.setRelative(p, p, d, pv);\n }\n }\n\n // SHPIX[] SHift point by a PIXel amount\n // 0x38\n function SHPIX(state) {\n var stack = state.stack\n var loop = state.loop\n var fv = state.fv\n var d = stack.pop() / 0x40\n var z2 = state.z2\n\n while (loop--) {\n var pi = stack.pop()\n var p = z2[pi]\n\n if (exports.DEBUG) {\n console.log(state.step, (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'SHPIX[]', pi, d)\n }\n\n fv.setRelative(p, p, d)\n fv.touch(p)\n }\n\n state.loop = 1\n }\n\n // IP[] Interpolate Point\n // 0x39\n function IP(state) {\n var stack = state.stack\n var rp1i = state.rp1\n var rp2i = state.rp2\n var loop = state.loop\n var rp1 = state.z0[rp1i]\n var rp2 = state.z1[rp2i]\n var fv = state.fv\n var pv = state.dpv\n var z2 = state.z2\n\n while (loop--) {\n var pi = stack.pop()\n var p = z2[pi]\n\n if (exports.DEBUG) {\n console.log(\n state.step,\n (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'IP[]',\n pi,\n rp1i,\n '<->',\n rp2i,\n )\n }\n\n fv.interpolate(p, rp1, rp2, pv)\n\n fv.touch(p)\n }\n\n state.loop = 1\n }\n\n // MSIRP[a] Move Stack Indirect Relative Point\n // 0x3A-0x3B\n function MSIRP(a, state) {\n var stack = state.stack\n var d = stack.pop() / 64\n var pi = stack.pop()\n var p = state.z1[pi]\n var rp0 = state.z0[state.rp0]\n var fv = state.fv\n var pv = state.pv\n\n fv.setRelative(p, rp0, d, pv)\n fv.touch(p)\n\n if (exports.DEBUG) {\n console.log(state.step, 'MSIRP[' + a + ']', d, pi)\n }\n\n state.rp1 = state.rp0\n state.rp2 = pi\n if (a) {\n state.rp0 = pi\n }\n }\n\n // ALIGNRP[] Align to reference point.\n // 0x3C\n function ALIGNRP(state) {\n var stack = state.stack\n var rp0i = state.rp0\n var rp0 = state.z0[rp0i]\n var loop = state.loop\n var fv = state.fv\n var pv = state.pv\n var z1 = state.z1\n\n while (loop--) {\n var pi = stack.pop()\n var p = z1[pi]\n\n if (exports.DEBUG) {\n console.log(state.step, (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + 'ALIGNRP[]', pi)\n }\n\n fv.setRelative(p, rp0, 0, pv)\n fv.touch(p)\n }\n\n state.loop = 1\n }\n\n // RTG[] Round To Double Grid\n // 0x3D\n function RTDG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RTDG[]')\n }\n\n state.round = roundToDoubleGrid\n }\n\n // MIAP[a] Move Indirect Absolute Point\n // 0x3E-0x3F\n function MIAP(round, state) {\n var stack = state.stack\n var n = stack.pop()\n var pi = stack.pop()\n var p = state.z0[pi]\n var fv = state.fv\n var pv = state.pv\n var cv = state.cvt[n]\n\n if (exports.DEBUG) {\n console.log(state.step, 'MIAP[' + round + ']', n, '(', cv, ')', pi)\n }\n\n var d = pv.distance(p, HPZero)\n\n if (round) {\n if (Math.abs(d - cv) < state.cvCutIn) {\n d = cv\n }\n\n d = state.round(d)\n }\n\n fv.setRelative(p, HPZero, d, pv)\n\n if (state.zp0 === 0) {\n p.xo = p.x\n p.yo = p.y\n }\n\n fv.touch(p)\n\n state.rp0 = state.rp1 = pi\n }\n\n // NPUSB[] PUSH N Bytes\n // 0x40\n function NPUSHB(state) {\n var prog = state.prog\n var ip = state.ip\n var stack = state.stack\n\n var n = prog[++ip]\n\n if (exports.DEBUG) {\n console.log(state.step, 'NPUSHB[]', n)\n }\n\n for (var i = 0; i < n; i++) {\n stack.push(prog[++ip])\n }\n\n state.ip = ip\n }\n\n // NPUSHW[] PUSH N Words\n // 0x41\n function NPUSHW(state) {\n var ip = state.ip\n var prog = state.prog\n var stack = state.stack\n var n = prog[++ip]\n\n if (exports.DEBUG) {\n console.log(state.step, 'NPUSHW[]', n)\n }\n\n for (var i = 0; i < n; i++) {\n var w = (prog[++ip] << 8) | prog[++ip]\n if (w & 0x8000) {\n w = -((w ^ 0xffff) + 1)\n }\n stack.push(w)\n }\n\n state.ip = ip\n }\n\n // WS[] Write Store\n // 0x42\n function WS(state) {\n var stack = state.stack\n var store = state.store\n\n if (!store) {\n store = state.store = []\n }\n\n var v = stack.pop()\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'WS', v, l)\n }\n\n store[l] = v\n }\n\n // RS[] Read Store\n // 0x43\n function RS(state) {\n var stack = state.stack\n var store = state.store\n\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'RS', l)\n }\n\n var v = (store && store[l]) || 0\n\n stack.push(v)\n }\n\n // WCVTP[] Write Control Value Table in Pixel units\n // 0x44\n function WCVTP(state) {\n var stack = state.stack\n\n var v = stack.pop()\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'WCVTP', v, l)\n }\n\n state.cvt[l] = v / 0x40\n }\n\n // RCVT[] Read Control Value Table entry\n // 0x45\n function RCVT(state) {\n var stack = state.stack\n var cvte = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'RCVT', cvte)\n }\n\n stack.push(state.cvt[cvte] * 0x40)\n }\n\n // GC[] Get Coordinate projected onto the projection vector\n // 0x46-0x47\n function GC(a, state) {\n var stack = state.stack\n var pi = stack.pop()\n var p = state.z2[pi]\n\n if (exports.DEBUG) {\n console.log(state.step, 'GC[' + a + ']', pi)\n }\n\n stack.push(state.dpv.distance(p, HPZero, a, false) * 0x40)\n }\n\n // MD[a] Measure Distance\n // 0x49-0x4A\n function MD(a, state) {\n var stack = state.stack\n var pi2 = stack.pop()\n var pi1 = stack.pop()\n var p2 = state.z1[pi2]\n var p1 = state.z0[pi1]\n var d = state.dpv.distance(p1, p2, a, a)\n\n if (exports.DEBUG) {\n console.log(state.step, 'MD[' + a + ']', pi2, pi1, '->', d)\n }\n\n state.stack.push(Math.round(d * 64))\n }\n\n // MPPEM[] Measure Pixels Per EM\n // 0x4B\n function MPPEM(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'MPPEM[]')\n }\n state.stack.push(state.ppem)\n }\n\n // FLIPON[] set the auto FLIP Boolean to ON\n // 0x4D\n function FLIPON(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'FLIPON[]')\n }\n state.autoFlip = true\n }\n\n // LT[] Less Than\n // 0x50\n function LT(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'LT[]', e2, e1)\n }\n\n stack.push(e1 < e2 ? 1 : 0)\n }\n\n // LTEQ[] Less Than or EQual\n // 0x53\n function LTEQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'LTEQ[]', e2, e1)\n }\n\n stack.push(e1 <= e2 ? 1 : 0)\n }\n\n // GTEQ[] Greater Than\n // 0x52\n function GT(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'GT[]', e2, e1)\n }\n\n stack.push(e1 > e2 ? 1 : 0)\n }\n\n // GTEQ[] Greater Than or EQual\n // 0x53\n function GTEQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'GTEQ[]', e2, e1)\n }\n\n stack.push(e1 >= e2 ? 1 : 0)\n }\n\n // EQ[] EQual\n // 0x54\n function EQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'EQ[]', e2, e1)\n }\n\n stack.push(e2 === e1 ? 1 : 0)\n }\n\n // NEQ[] Not EQual\n // 0x55\n function NEQ(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'NEQ[]', e2, e1)\n }\n\n stack.push(e2 !== e1 ? 1 : 0)\n }\n\n // ODD[] ODD\n // 0x56\n function ODD(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ODD[]', n)\n }\n\n stack.push(Math.trunc(n) % 2 ? 1 : 0)\n }\n\n // EVEN[] EVEN\n // 0x57\n function EVEN(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'EVEN[]', n)\n }\n\n stack.push(Math.trunc(n) % 2 ? 0 : 1)\n }\n\n // IF[] IF test\n // 0x58\n function IF(state) {\n var test = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'IF[]', test)\n }\n\n // if test is true it just continues\n // if not the ip is skipped until matching ELSE or EIF\n if (!test) {\n skip(state, true)\n\n if (exports.DEBUG) {\n console.log(state.step, 'EIF[]')\n }\n }\n }\n\n // EIF[] End IF\n // 0x59\n function EIF(state) {\n // this can be reached normally when\n // executing an else branch.\n // -> just ignore it\n\n if (exports.DEBUG) {\n console.log(state.step, 'EIF[]')\n }\n }\n\n // AND[] logical AND\n // 0x5A\n function AND(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'AND[]', e2, e1)\n }\n\n stack.push(e2 && e1 ? 1 : 0)\n }\n\n // OR[] logical OR\n // 0x5B\n function OR(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'OR[]', e2, e1)\n }\n\n stack.push(e2 || e1 ? 1 : 0)\n }\n\n // NOT[] logical NOT\n // 0x5C\n function NOT(state) {\n var stack = state.stack\n var e = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'NOT[]', e)\n }\n\n stack.push(e ? 0 : 1)\n }\n\n // DELTAP1[] DELTA exception P1\n // DELTAP2[] DELTA exception P2\n // DELTAP3[] DELTA exception P3\n // 0x5D, 0x71, 0x72\n function DELTAP123(b, state) {\n var stack = state.stack\n var n = stack.pop()\n var fv = state.fv\n var pv = state.pv\n var ppem = state.ppem\n var base = state.deltaBase + (b - 1) * 16\n var ds = state.deltaShift\n var z0 = state.z0\n\n if (exports.DEBUG) {\n console.log(state.step, 'DELTAP[' + b + ']', n, stack)\n }\n\n for (var i = 0; i < n; i++) {\n var pi = stack.pop()\n var arg = stack.pop()\n var appem = base + ((arg & 0xf0) >> 4)\n if (appem !== ppem) {\n continue\n }\n\n var mag = (arg & 0x0f) - 8\n if (mag >= 0) {\n mag++\n }\n if (exports.DEBUG) {\n console.log(state.step, 'DELTAPFIX', pi, 'by', mag * ds)\n }\n\n var p = z0[pi]\n fv.setRelative(p, p, mag * ds, pv)\n }\n }\n\n // SDB[] Set Delta Base in the graphics state\n // 0x5E\n function SDB(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SDB[]', n)\n }\n\n state.deltaBase = n\n }\n\n // SDS[] Set Delta Shift in the graphics state\n // 0x5F\n function SDS(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SDS[]', n)\n }\n\n state.deltaShift = Math.pow(0.5, n)\n }\n\n // ADD[] ADD\n // 0x60\n function ADD(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ADD[]', n2, n1)\n }\n\n stack.push(n1 + n2)\n }\n\n // SUB[] SUB\n // 0x61\n function SUB(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SUB[]', n2, n1)\n }\n\n stack.push(n1 - n2)\n }\n\n // DIV[] DIV\n // 0x62\n function DIV(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'DIV[]', n2, n1)\n }\n\n stack.push((n1 * 64) / n2)\n }\n\n // MUL[] MUL\n // 0x63\n function MUL(state) {\n var stack = state.stack\n var n2 = stack.pop()\n var n1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MUL[]', n2, n1)\n }\n\n stack.push((n1 * n2) / 64)\n }\n\n // ABS[] ABSolute value\n // 0x64\n function ABS(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ABS[]', n)\n }\n\n stack.push(Math.abs(n))\n }\n\n // NEG[] NEGate\n // 0x65\n function NEG(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'NEG[]', n)\n }\n\n stack.push(-n)\n }\n\n // FLOOR[] FLOOR\n // 0x66\n function FLOOR(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'FLOOR[]', n)\n }\n\n stack.push(Math.floor(n / 0x40) * 0x40)\n }\n\n // CEILING[] CEILING\n // 0x67\n function CEILING(state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'CEILING[]', n)\n }\n\n stack.push(Math.ceil(n / 0x40) * 0x40)\n }\n\n // ROUND[ab] ROUND value\n // 0x68-0x6B\n function ROUND(dt, state) {\n var stack = state.stack\n var n = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ROUND[]')\n }\n\n stack.push(state.round(n / 0x40) * 0x40)\n }\n\n // WCVTF[] Write Control Value Table in Funits\n // 0x70\n function WCVTF(state) {\n var stack = state.stack\n var v = stack.pop()\n var l = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'WCVTF[]', v, l)\n }\n\n state.cvt[l] = (v * state.ppem) / state.font.unitsPerEm\n }\n\n // DELTAC1[] DELTA exception C1\n // DELTAC2[] DELTA exception C2\n // DELTAC3[] DELTA exception C3\n // 0x73, 0x74, 0x75\n function DELTAC123(b, state) {\n var stack = state.stack\n var n = stack.pop()\n var ppem = state.ppem\n var base = state.deltaBase + (b - 1) * 16\n var ds = state.deltaShift\n\n if (exports.DEBUG) {\n console.log(state.step, 'DELTAC[' + b + ']', n, stack)\n }\n\n for (var i = 0; i < n; i++) {\n var c = stack.pop()\n var arg = stack.pop()\n var appem = base + ((arg & 0xf0) >> 4)\n if (appem !== ppem) {\n continue\n }\n\n var mag = (arg & 0x0f) - 8\n if (mag >= 0) {\n mag++\n }\n\n var delta = mag * ds\n\n if (exports.DEBUG) {\n console.log(state.step, 'DELTACFIX', c, 'by', delta)\n }\n\n state.cvt[c] += delta\n }\n }\n\n // SROUND[] Super ROUND\n // 0x76\n function SROUND(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'SROUND[]', n)\n }\n\n state.round = roundSuper\n\n var period\n\n switch (n & 0xc0) {\n case 0x00:\n period = 0.5\n break\n case 0x40:\n period = 1\n break\n case 0x80:\n period = 2\n break\n default:\n throw new Error('invalid SROUND value')\n }\n\n state.srPeriod = period\n\n switch (n & 0x30) {\n case 0x00:\n state.srPhase = 0\n break\n case 0x10:\n state.srPhase = 0.25 * period\n break\n case 0x20:\n state.srPhase = 0.5 * period\n break\n case 0x30:\n state.srPhase = 0.75 * period\n break\n default:\n throw new Error('invalid SROUND value')\n }\n\n n &= 0x0f\n\n if (n === 0) {\n state.srThreshold = 0\n } else {\n state.srThreshold = (n / 8 - 0.5) * period\n }\n }\n\n // S45ROUND[] Super ROUND 45 degrees\n // 0x77\n function S45ROUND(state) {\n var n = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'S45ROUND[]', n)\n }\n\n state.round = roundSuper\n\n var period\n\n switch (n & 0xc0) {\n case 0x00:\n period = Math.sqrt(2) / 2\n break\n case 0x40:\n period = Math.sqrt(2)\n break\n case 0x80:\n period = 2 * Math.sqrt(2)\n break\n default:\n throw new Error('invalid S45ROUND value')\n }\n\n state.srPeriod = period\n\n switch (n & 0x30) {\n case 0x00:\n state.srPhase = 0\n break\n case 0x10:\n state.srPhase = 0.25 * period\n break\n case 0x20:\n state.srPhase = 0.5 * period\n break\n case 0x30:\n state.srPhase = 0.75 * period\n break\n default:\n throw new Error('invalid S45ROUND value')\n }\n\n n &= 0x0f\n\n if (n === 0) {\n state.srThreshold = 0\n } else {\n state.srThreshold = (n / 8 - 0.5) * period\n }\n }\n\n // ROFF[] Round Off\n // 0x7A\n function ROFF(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'ROFF[]')\n }\n\n state.round = roundOff\n }\n\n // RUTG[] Round Up To Grid\n // 0x7C\n function RUTG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RUTG[]')\n }\n\n state.round = roundUpToGrid\n }\n\n // RDTG[] Round Down To Grid\n // 0x7D\n function RDTG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RDTG[]')\n }\n\n state.round = roundDownToGrid\n }\n\n // SCANCTRL[] SCAN conversion ConTRoL\n // 0x85\n function SCANCTRL(state) {\n var n = state.stack.pop()\n\n // ignored by opentype.js\n\n if (exports.DEBUG) {\n console.log(state.step, 'SCANCTRL[]', n)\n }\n }\n\n // SDPVTL[a] Set Dual Projection Vector To Line\n // 0x86-0x87\n function SDPVTL(a, state) {\n var stack = state.stack\n var p2i = stack.pop()\n var p1i = stack.pop()\n var p2 = state.z2[p2i]\n var p1 = state.z1[p1i]\n\n if (exports.DEBUG) {\n console.log(state.step, 'SDPVTL[' + a + ']', p2i, p1i)\n }\n\n var dx\n var dy\n\n if (!a) {\n dx = p1.x - p2.x\n dy = p1.y - p2.y\n } else {\n dx = p2.y - p1.y\n dy = p1.x - p2.x\n }\n\n state.dpv = getUnitVector(dx, dy)\n }\n\n // GETINFO[] GET INFOrmation\n // 0x88\n function GETINFO(state) {\n var stack = state.stack\n var sel = stack.pop()\n var r = 0\n\n if (exports.DEBUG) {\n console.log(state.step, 'GETINFO[]', sel)\n }\n\n // v35 as in no subpixel hinting\n if (sel & 0x01) {\n r = 35\n }\n\n // TODO rotation and stretch currently not supported\n // and thus those GETINFO are always 0.\n\n // opentype.js is always gray scaling\n if (sel & 0x20) {\n r |= 0x1000\n }\n\n stack.push(r)\n }\n\n // ROLL[] ROLL the top three stack elements\n // 0x8A\n function ROLL(state) {\n var stack = state.stack\n var a = stack.pop()\n var b = stack.pop()\n var c = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'ROLL[]')\n }\n\n stack.push(b)\n stack.push(a)\n stack.push(c)\n }\n\n // MAX[] MAXimum of top two stack elements\n // 0x8B\n function MAX(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MAX[]', e2, e1)\n }\n\n stack.push(Math.max(e1, e2))\n }\n\n // MIN[] MINimum of top two stack elements\n // 0x8C\n function MIN(state) {\n var stack = state.stack\n var e2 = stack.pop()\n var e1 = stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'MIN[]', e2, e1)\n }\n\n stack.push(Math.min(e1, e2))\n }\n\n // SCANTYPE[] SCANTYPE\n // 0x8D\n function SCANTYPE(state) {\n var n = state.stack.pop()\n // ignored by opentype.js\n if (exports.DEBUG) {\n console.log(state.step, 'SCANTYPE[]', n)\n }\n }\n\n // INSTCTRL[] INSTCTRL\n // 0x8D\n function INSTCTRL(state) {\n var s = state.stack.pop()\n var v = state.stack.pop()\n\n if (exports.DEBUG) {\n console.log(state.step, 'INSTCTRL[]', s, v)\n }\n\n switch (s) {\n case 1:\n state.inhibitGridFit = !!v\n return\n case 2:\n state.ignoreCvt = !!v\n return\n default:\n throw new Error('invalid INSTCTRL[] selector')\n }\n }\n\n // PUSHB[abc] PUSH Bytes\n // 0xB0-0xB7\n function PUSHB(n, state) {\n var stack = state.stack\n var prog = state.prog\n var ip = state.ip\n\n if (exports.DEBUG) {\n console.log(state.step, 'PUSHB[' + n + ']')\n }\n\n for (var i = 0; i < n; i++) {\n stack.push(prog[++ip])\n }\n\n state.ip = ip\n }\n\n // PUSHW[abc] PUSH Words\n // 0xB8-0xBF\n function PUSHW(n, state) {\n var ip = state.ip\n var prog = state.prog\n var stack = state.stack\n\n if (exports.DEBUG) {\n console.log(state.ip, 'PUSHW[' + n + ']')\n }\n\n for (var i = 0; i < n; i++) {\n var w = (prog[++ip] << 8) | prog[++ip]\n if (w & 0x8000) {\n w = -((w ^ 0xffff) + 1)\n }\n stack.push(w)\n }\n\n state.ip = ip\n }\n\n // MDRP[abcde] Move Direct Relative Point\n // 0xD0-0xEF\n // (if indirect is 0)\n //\n // and\n //\n // MIRP[abcde] Move Indirect Relative Point\n // 0xE0-0xFF\n // (if indirect is 1)\n\n function MDRP_MIRP(indirect, setRp0, keepD, ro, dt, state) {\n var stack = state.stack\n var cvte = indirect && stack.pop()\n var pi = stack.pop()\n var rp0i = state.rp0\n var rp = state.z0[rp0i]\n var p = state.z1[pi]\n\n var md = state.minDis\n var fv = state.fv\n var pv = state.dpv\n var od // original distance\n var d // moving distance\n var sign // sign of distance\n var cv\n\n d = od = pv.distance(p, rp, true, true)\n sign = d >= 0 ? 1 : -1 // Math.sign would be 0 in case of 0\n\n // TODO consider autoFlip\n d = Math.abs(d)\n\n if (indirect) {\n cv = state.cvt[cvte]\n\n if (ro && Math.abs(d - cv) < state.cvCutIn) {\n d = cv\n }\n }\n\n if (keepD && d < md) {\n d = md\n }\n\n if (ro) {\n d = state.round(d)\n }\n\n fv.setRelative(p, rp, sign * d, pv)\n fv.touch(p)\n\n if (exports.DEBUG) {\n console.log(\n state.step,\n (indirect ? 'MIRP[' : 'MDRP[') +\n (setRp0 ? 'M' : 'm') +\n (keepD ? '>' : '_') +\n (ro ? 'R' : '_') +\n (dt === 0 ? 'Gr' : dt === 1 ? 'Bl' : dt === 2 ? 'Wh' : '') +\n ']',\n indirect ? cvte + '(' + state.cvt[cvte] + ',' + cv + ')' : '',\n pi,\n '(d =',\n od,\n '->',\n sign * d,\n ')',\n )\n }\n\n state.rp1 = state.rp0\n state.rp2 = pi\n if (setRp0) {\n state.rp0 = pi\n }\n }\n\n /*\n * The instruction table.\n */\n instructionTable = [\n /* 0x00 */ SVTCA.bind(undefined, yUnitVector),\n /* 0x01 */ SVTCA.bind(undefined, xUnitVector),\n /* 0x02 */ SPVTCA.bind(undefined, yUnitVector),\n /* 0x03 */ SPVTCA.bind(undefined, xUnitVector),\n /* 0x04 */ SFVTCA.bind(undefined, yUnitVector),\n /* 0x05 */ SFVTCA.bind(undefined, xUnitVector),\n /* 0x06 */ SPVTL.bind(undefined, 0),\n /* 0x07 */ SPVTL.bind(undefined, 1),\n /* 0x08 */ SFVTL.bind(undefined, 0),\n /* 0x09 */ SFVTL.bind(undefined, 1),\n /* 0x0A */ SPVFS,\n /* 0x0B */ SFVFS,\n /* 0x0C */ GPV,\n /* 0x0D */ GFV,\n /* 0x0E */ SFVTPV,\n /* 0x0F */ ISECT,\n /* 0x10 */ SRP0,\n /* 0x11 */ SRP1,\n /* 0x12 */ SRP2,\n /* 0x13 */ SZP0,\n /* 0x14 */ SZP1,\n /* 0x15 */ SZP2,\n /* 0x16 */ SZPS,\n /* 0x17 */ SLOOP,\n /* 0x18 */ RTG,\n /* 0x19 */ RTHG,\n /* 0x1A */ SMD,\n /* 0x1B */ ELSE,\n /* 0x1C */ JMPR,\n /* 0x1D */ SCVTCI,\n /* 0x1E */ undefined, // TODO SSWCI\n /* 0x1F */ undefined, // TODO SSW\n /* 0x20 */ DUP,\n /* 0x21 */ POP,\n /* 0x22 */ CLEAR,\n /* 0x23 */ SWAP,\n /* 0x24 */ DEPTH,\n /* 0x25 */ CINDEX,\n /* 0x26 */ MINDEX,\n /* 0x27 */ undefined, // TODO ALIGNPTS\n /* 0x28 */ undefined,\n /* 0x29 */ undefined, // TODO UTP\n /* 0x2A */ LOOPCALL,\n /* 0x2B */ CALL,\n /* 0x2C */ FDEF,\n /* 0x2D */ undefined, // ENDF (eaten by FDEF)\n /* 0x2E */ MDAP.bind(undefined, 0),\n /* 0x2F */ MDAP.bind(undefined, 1),\n /* 0x30 */ IUP.bind(undefined, yUnitVector),\n /* 0x31 */ IUP.bind(undefined, xUnitVector),\n /* 0x32 */ SHP.bind(undefined, 0),\n /* 0x33 */ SHP.bind(undefined, 1),\n /* 0x34 */ SHC.bind(undefined, 0),\n /* 0x35 */ SHC.bind(undefined, 1),\n /* 0x36 */ SHZ.bind(undefined, 0),\n /* 0x37 */ SHZ.bind(undefined, 1),\n /* 0x38 */ SHPIX,\n /* 0x39 */ IP,\n /* 0x3A */ MSIRP.bind(undefined, 0),\n /* 0x3B */ MSIRP.bind(undefined, 1),\n /* 0x3C */ ALIGNRP,\n /* 0x3D */ RTDG,\n /* 0x3E */ MIAP.bind(undefined, 0),\n /* 0x3F */ MIAP.bind(undefined, 1),\n /* 0x40 */ NPUSHB,\n /* 0x41 */ NPUSHW,\n /* 0x42 */ WS,\n /* 0x43 */ RS,\n /* 0x44 */ WCVTP,\n /* 0x45 */ RCVT,\n /* 0x46 */ GC.bind(undefined, 0),\n /* 0x47 */ GC.bind(undefined, 1),\n /* 0x48 */ undefined, // TODO SCFS\n /* 0x49 */ MD.bind(undefined, 0),\n /* 0x4A */ MD.bind(undefined, 1),\n /* 0x4B */ MPPEM,\n /* 0x4C */ undefined, // TODO MPS\n /* 0x4D */ FLIPON,\n /* 0x4E */ undefined, // TODO FLIPOFF\n /* 0x4F */ undefined, // TODO DEBUG\n /* 0x50 */ LT,\n /* 0x51 */ LTEQ,\n /* 0x52 */ GT,\n /* 0x53 */ GTEQ,\n /* 0x54 */ EQ,\n /* 0x55 */ NEQ,\n /* 0x56 */ ODD,\n /* 0x57 */ EVEN,\n /* 0x58 */ IF,\n /* 0x59 */ EIF,\n /* 0x5A */ AND,\n /* 0x5B */ OR,\n /* 0x5C */ NOT,\n /* 0x5D */ DELTAP123.bind(undefined, 1),\n /* 0x5E */ SDB,\n /* 0x5F */ SDS,\n /* 0x60 */ ADD,\n /* 0x61 */ SUB,\n /* 0x62 */ DIV,\n /* 0x63 */ MUL,\n /* 0x64 */ ABS,\n /* 0x65 */ NEG,\n /* 0x66 */ FLOOR,\n /* 0x67 */ CEILING,\n /* 0x68 */ ROUND.bind(undefined, 0),\n /* 0x69 */ ROUND.bind(undefined, 1),\n /* 0x6A */ ROUND.bind(undefined, 2),\n /* 0x6B */ ROUND.bind(undefined, 3),\n /* 0x6C */ undefined, // TODO NROUND[ab]\n /* 0x6D */ undefined, // TODO NROUND[ab]\n /* 0x6E */ undefined, // TODO NROUND[ab]\n /* 0x6F */ undefined, // TODO NROUND[ab]\n /* 0x70 */ WCVTF,\n /* 0x71 */ DELTAP123.bind(undefined, 2),\n /* 0x72 */ DELTAP123.bind(undefined, 3),\n /* 0x73 */ DELTAC123.bind(undefined, 1),\n /* 0x74 */ DELTAC123.bind(undefined, 2),\n /* 0x75 */ DELTAC123.bind(undefined, 3),\n /* 0x76 */ SROUND,\n /* 0x77 */ S45ROUND,\n /* 0x78 */ undefined, // TODO JROT[]\n /* 0x79 */ undefined, // TODO JROF[]\n /* 0x7A */ ROFF,\n /* 0x7B */ undefined,\n /* 0x7C */ RUTG,\n /* 0x7D */ RDTG,\n /* 0x7E */ POP, // actually SANGW, supposed to do only a pop though\n /* 0x7F */ POP, // actually AA, supposed to do only a pop though\n /* 0x80 */ undefined, // TODO FLIPPT\n /* 0x81 */ undefined, // TODO FLIPRGON\n /* 0x82 */ undefined, // TODO FLIPRGOFF\n /* 0x83 */ undefined,\n /* 0x84 */ undefined,\n /* 0x85 */ SCANCTRL,\n /* 0x86 */ SDPVTL.bind(undefined, 0),\n /* 0x87 */ SDPVTL.bind(undefined, 1),\n /* 0x88 */ GETINFO,\n /* 0x89 */ undefined, // TODO IDEF\n /* 0x8A */ ROLL,\n /* 0x8B */ MAX,\n /* 0x8C */ MIN,\n /* 0x8D */ SCANTYPE,\n /* 0x8E */ INSTCTRL,\n /* 0x8F */ undefined,\n /* 0x90 */ undefined,\n /* 0x91 */ undefined,\n /* 0x92 */ undefined,\n /* 0x93 */ undefined,\n /* 0x94 */ undefined,\n /* 0x95 */ undefined,\n /* 0x96 */ undefined,\n /* 0x97 */ undefined,\n /* 0x98 */ undefined,\n /* 0x99 */ undefined,\n /* 0x9A */ undefined,\n /* 0x9B */ undefined,\n /* 0x9C */ undefined,\n /* 0x9D */ undefined,\n /* 0x9E */ undefined,\n /* 0x9F */ undefined,\n /* 0xA0 */ undefined,\n /* 0xA1 */ undefined,\n /* 0xA2 */ undefined,\n /* 0xA3 */ undefined,\n /* 0xA4 */ undefined,\n /* 0xA5 */ undefined,\n /* 0xA6 */ undefined,\n /* 0xA7 */ undefined,\n /* 0xA8 */ undefined,\n /* 0xA9 */ undefined,\n /* 0xAA */ undefined,\n /* 0xAB */ undefined,\n /* 0xAC */ undefined,\n /* 0xAD */ undefined,\n /* 0xAE */ undefined,\n /* 0xAF */ undefined,\n /* 0xB0 */ PUSHB.bind(undefined, 1),\n /* 0xB1 */ PUSHB.bind(undefined, 2),\n /* 0xB2 */ PUSHB.bind(undefined, 3),\n /* 0xB3 */ PUSHB.bind(undefined, 4),\n /* 0xB4 */ PUSHB.bind(undefined, 5),\n /* 0xB5 */ PUSHB.bind(undefined, 6),\n /* 0xB6 */ PUSHB.bind(undefined, 7),\n /* 0xB7 */ PUSHB.bind(undefined, 8),\n /* 0xB8 */ PUSHW.bind(undefined, 1),\n /* 0xB9 */ PUSHW.bind(undefined, 2),\n /* 0xBA */ PUSHW.bind(undefined, 3),\n /* 0xBB */ PUSHW.bind(undefined, 4),\n /* 0xBC */ PUSHW.bind(undefined, 5),\n /* 0xBD */ PUSHW.bind(undefined, 6),\n /* 0xBE */ PUSHW.bind(undefined, 7),\n /* 0xBF */ PUSHW.bind(undefined, 8),\n /* 0xC0 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 0),\n /* 0xC1 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 1),\n /* 0xC2 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 2),\n /* 0xC3 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 3),\n /* 0xC4 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 0),\n /* 0xC5 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 1),\n /* 0xC6 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 2),\n /* 0xC7 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 3),\n /* 0xC8 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 0),\n /* 0xC9 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 1),\n /* 0xCA */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 2),\n /* 0xCB */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 3),\n /* 0xCC */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 0),\n /* 0xCD */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 1),\n /* 0xCE */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 2),\n /* 0xCF */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 3),\n /* 0xD0 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 0),\n /* 0xD1 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 1),\n /* 0xD2 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 2),\n /* 0xD3 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 3),\n /* 0xD4 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 0),\n /* 0xD5 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 1),\n /* 0xD6 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 2),\n /* 0xD7 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 3),\n /* 0xD8 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 0),\n /* 0xD9 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 1),\n /* 0xDA */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 2),\n /* 0xDB */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 3),\n /* 0xDC */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 0),\n /* 0xDD */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 1),\n /* 0xDE */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 2),\n /* 0xDF */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 3),\n /* 0xE0 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 0),\n /* 0xE1 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 1),\n /* 0xE2 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 2),\n /* 0xE3 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 3),\n /* 0xE4 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 0),\n /* 0xE5 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 1),\n /* 0xE6 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 2),\n /* 0xE7 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 3),\n /* 0xE8 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 0),\n /* 0xE9 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 1),\n /* 0xEA */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 2),\n /* 0xEB */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 3),\n /* 0xEC */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 0),\n /* 0xED */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 1),\n /* 0xEE */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 2),\n /* 0xEF */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 3),\n /* 0xF0 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 0),\n /* 0xF1 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 1),\n /* 0xF2 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 2),\n /* 0xF3 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 3),\n /* 0xF4 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 0),\n /* 0xF5 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 1),\n /* 0xF6 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 2),\n /* 0xF7 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 3),\n /* 0xF8 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 0),\n /* 0xF9 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 1),\n /* 0xFA */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 2),\n /* 0xFB */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 3),\n /* 0xFC */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 0),\n /* 0xFD */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 1),\n /* 0xFE */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 2),\n /* 0xFF */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 3),\n ]\n\n /*****************************\n Mathematical Considerations\n******************************\n\nfv ... refers to freedom vector\npv ... refers to projection vector\nrp ... refers to reference point\np ... refers to to point being operated on\nd ... refers to distance\n\nSETRELATIVE:\n============\n\ncase freedom vector == x-axis:\n------------------------------\n\n (pv)\n .-'\n rpd .-'\n .-*\n d .-'90°'\n .-' '\n .-' '\n *-' ' b\n rp '\n '\n '\n p *----------*-------------- (fv)\n pm\n\n rpdx = rpx + d * pv.x\n rpdy = rpy + d * pv.y\n\n equation of line b\n\n y - rpdy = pvns * (x- rpdx)\n\n y = p.y\n\n x = rpdx + ( p.y - rpdy ) / pvns\n\n\ncase freedom vector == y-axis:\n------------------------------\n\n * pm\n |\\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\\n | \\ b\n | \\\n | \\\n | \\ .-' (pv)\n | 90° \\.-'\n | .-'* rpd\n | .-'\n * *-' d\n p rp\n\n rpdx = rpx + d * pv.x\n rpdy = rpy + d * pv.y\n\n equation of line b:\n pvns ... normal slope to pv\n\n y - rpdy = pvns * (x - rpdx)\n\n x = p.x\n\n y = rpdy + pvns * (p.x - rpdx)\n\n\n\ngeneric case:\n-------------\n\n\n .'(fv)\n .'\n .* pm\n .' !\n .' .\n .' !\n .' . b\n .' !\n * .\n p !\n 90° . ... (pv)\n ...-*-'''\n ...---''' rpd\n ...---''' d\n *--'''\n rp\n\n rpdx = rpx + d * pv.x\n rpdy = rpy + d * pv.y\n\n equation of line b:\n pvns... normal slope to pv\n\n y - rpdy = pvns * (x - rpdx)\n\n equation of freedom vector line:\n fvs ... slope of freedom vector (=fy/fx)\n\n y - py = fvs * (x - px)\n\n\n on pm both equations are true for same x/y\n\n y - rpdy = pvns * (x - rpdx)\n\n y - py = fvs * (x - px)\n\n form to y and set equal:\n\n pvns * (x - rpdx) + rpdy = fvs * (x - px) + py\n\n expand:\n\n pvns * x - pvns * rpdx + rpdy = fvs * x - fvs * px + py\n\n switch:\n\n fvs * x - fvs * px + py = pvns * x - pvns * rpdx + rpdy\n\n solve for x:\n\n fvs * x - pvns * x = fvs * px - pvns * rpdx - py + rpdy\n\n\n\n fvs * px - pvns * rpdx + rpdy - py\n x = -----------------------------------\n fvs - pvns\n\n and:\n\n y = fvs * (x - px) + py\n\n\n\nINTERPOLATE:\n============\n\nExamples of point interpolation.\n\nThe weight of the movement of the reference point gets bigger\nthe further the other reference point is away, thus the safest\noption (that is avoiding 0/0 divisions) is to weight the\noriginal distance of the other point by the sum of both distances.\n\nIf the sum of both distances is 0, then move the point by the\narithmetic average of the movement of both reference points.\n\n\n\n\n (+6)\n rp1o *---->*rp1\n . . (+12)\n . . rp2o *---------->* rp2\n . . . .\n . . . .\n . 10 20 . .\n |.........|...................| .\n . . .\n . . (+8) .\n po *------>*p .\n . . .\n . 12 . 24 .\n |...........|.......................|\n 36\n\n\n-------\n\n\n\n (+10)\n rp1o *-------->*rp1\n . . (-10)\n . . rp2 *<---------* rpo2\n . . . .\n . . . .\n . 10 . 30 . .\n |.........|.............................|\n . .\n . (+5) .\n po *--->* p .\n . . .\n . . 20 .\n |....|..............|\n 5 15\n\n\n-------\n\n\n (+10)\n rp1o *-------->*rp1\n . .\n . .\n rp2o *-------->*rp2\n\n\n (+10)\n po *-------->* p\n\n-------\n\n\n (+10)\n rp1o *-------->*rp1\n . .\n . .(+30)\n rp2o *---------------------------->*rp2\n\n\n (+25)\n po *----------------------->* p\n\n\n\nvim: set ts=4 sw=4 expandtab:\n*****/\n\n /**\n * Converts a string into a list of tokens.\n */\n\n /**\n * Create a new token\n * @param {string} char a single char\n */\n function Token(char) {\n this.char = char\n this.state = {}\n this.activeState = null\n }\n\n /**\n * Create a new context range\n * @param {number} startIndex range start index\n * @param {number} endOffset range end index offset\n * @param {string} contextName owner context name\n */\n function ContextRange(startIndex, endOffset, contextName) {\n this.contextName = contextName\n this.startIndex = startIndex\n this.endOffset = endOffset\n }\n\n /**\n * Check context start and end\n * @param {string} contextName a unique context name\n * @param {function} checkStart a predicate function the indicates a context's start\n * @param {function} checkEnd a predicate function the indicates a context's end\n */\n function ContextChecker(contextName, checkStart, checkEnd) {\n this.contextName = contextName\n this.openRange = null\n this.ranges = []\n this.checkStart = checkStart\n this.checkEnd = checkEnd\n }\n\n /**\n * @typedef ContextParams\n * @type Object\n * @property {array} context context items\n * @property {number} currentIndex current item index\n */\n\n /**\n * Create a context params\n * @param {array} context a list of items\n * @param {number} currentIndex current item index\n */\n function ContextParams(context, currentIndex) {\n this.context = context\n this.index = currentIndex\n this.length = context.length\n this.current = context[currentIndex]\n this.backtrack = context.slice(0, currentIndex)\n this.lookahead = context.slice(currentIndex + 1)\n }\n\n /**\n * Create an event instance\n * @param {string} eventId event unique id\n */\n function Event(eventId) {\n this.eventId = eventId\n this.subscribers = []\n }\n\n /**\n * Initialize a core events and auto subscribe required event handlers\n * @param {any} events an object that enlists core events handlers\n */\n function initializeCoreEvents(events) {\n var this$1 = this\n\n var coreEvents = [\n 'start',\n 'end',\n 'next',\n 'newToken',\n 'contextStart',\n 'contextEnd',\n 'insertToken',\n 'removeToken',\n 'removeRange',\n 'replaceToken',\n 'replaceRange',\n 'composeRUD',\n 'updateContextsRanges',\n ]\n\n coreEvents.forEach(function (eventId) {\n Object.defineProperty(this$1.events, eventId, {\n value: new Event(eventId),\n })\n })\n\n if (!!events) {\n coreEvents.forEach(function (eventId) {\n var event = events[eventId]\n if (typeof event === 'function') {\n this$1.events[eventId].subscribe(event)\n }\n })\n }\n var requiresContextUpdate = [\n 'insertToken',\n 'removeToken',\n 'removeRange',\n 'replaceToken',\n 'replaceRange',\n 'composeRUD',\n ]\n requiresContextUpdate.forEach(function (eventId) {\n this$1.events[eventId].subscribe(this$1.updateContextsRanges)\n })\n }\n\n /**\n * Converts a string into a list of tokens\n * @param {any} events tokenizer core events\n */\n function Tokenizer(events) {\n this.tokens = []\n this.registeredContexts = {}\n this.contextCheckers = []\n this.events = {}\n this.registeredModifiers = []\n\n initializeCoreEvents.call(this, events)\n }\n\n /**\n * Sets the state of a token, usually called by a state modifier.\n * @param {string} key state item key\n * @param {any} value state item value\n */\n Token.prototype.setState = function (key, value) {\n this.state[key] = value\n this.activeState = { key: key, value: this.state[key] }\n return this.activeState\n }\n\n Token.prototype.getState = function (stateId) {\n return this.state[stateId] || null\n }\n\n /**\n * Checks if an index exists in the tokens list.\n * @param {number} index token index\n */\n Tokenizer.prototype.inboundIndex = function (index) {\n return index >= 0 && index < this.tokens.length\n }\n\n /**\n * Compose and apply a list of operations (replace, update, delete)\n * @param {array} RUDs replace, update and delete operations\n * TODO: Perf. Optimization (lengthBefore === lengthAfter ? dispatch once)\n */\n Tokenizer.prototype.composeRUD = function (RUDs) {\n var this$1 = this\n\n var silent = true\n var state = RUDs.map(function (RUD) {\n return this$1[RUD[0]].apply(this$1, RUD.slice(1).concat(silent))\n })\n var hasFAILObject = function (obj) {\n return typeof obj === 'object' && obj.hasOwnProperty('FAIL')\n }\n if (state.every(hasFAILObject)) {\n return {\n FAIL: \"composeRUD: one or more operations hasn't completed successfully\",\n report: state.filter(hasFAILObject),\n }\n }\n this.dispatch('composeRUD', [\n state.filter(function (op) {\n return !hasFAILObject(op)\n }),\n ])\n }\n\n /**\n * Replace a range of tokens with a list of tokens\n * @param {number} startIndex range start index\n * @param {number} offset range offset\n * @param {token} tokens a list of tokens to replace\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.replaceRange = function (startIndex, offset, tokens, silent) {\n offset = offset !== null ? offset : this.tokens.length\n var isTokenType = tokens.every(function (token) {\n return token instanceof Token\n })\n if (!isNaN(startIndex) && this.inboundIndex(startIndex) && isTokenType) {\n var replaced = this.tokens.splice.apply(this.tokens, [startIndex, offset].concat(tokens))\n if (!silent) {\n this.dispatch('replaceToken', [startIndex, offset, tokens])\n }\n return [replaced, tokens]\n } else {\n return { FAIL: 'replaceRange: invalid tokens or startIndex.' }\n }\n }\n\n /**\n * Replace a token with another token\n * @param {number} index token index\n * @param {token} token a token to replace\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.replaceToken = function (index, token, silent) {\n if (!isNaN(index) && this.inboundIndex(index) && token instanceof Token) {\n var replaced = this.tokens.splice(index, 1, token)\n if (!silent) {\n this.dispatch('replaceToken', [index, token])\n }\n return [replaced[0], token]\n } else {\n return { FAIL: 'replaceToken: invalid token or index.' }\n }\n }\n\n /**\n * Removes a range of tokens\n * @param {number} startIndex range start index\n * @param {number} offset range offset\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.removeRange = function (startIndex, offset, silent) {\n offset = !isNaN(offset) ? offset : this.tokens.length\n var tokens = this.tokens.splice(startIndex, offset)\n if (!silent) {\n this.dispatch('removeRange', [tokens, startIndex, offset])\n }\n return tokens\n }\n\n /**\n * Remove a token at a certain index\n * @param {number} index token index\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.removeToken = function (index, silent) {\n if (!isNaN(index) && this.inboundIndex(index)) {\n var token = this.tokens.splice(index, 1)\n if (!silent) {\n this.dispatch('removeToken', [token, index])\n }\n return token\n } else {\n return { FAIL: 'removeToken: invalid token index.' }\n }\n }\n\n /**\n * Insert a list of tokens at a certain index\n * @param {array} tokens a list of tokens to insert\n * @param {number} index insert the list of tokens at index\n * @param {boolean} silent dispatch events and update context ranges\n */\n Tokenizer.prototype.insertToken = function (tokens, index, silent) {\n var tokenType = tokens.every(function (token) {\n return token instanceof Token\n })\n if (tokenType) {\n this.tokens.splice.apply(this.tokens, [index, 0].concat(tokens))\n if (!silent) {\n this.dispatch('insertToken', [tokens, index])\n }\n return tokens\n } else {\n return { FAIL: 'insertToken: invalid token(s).' }\n }\n }\n\n /**\n * A state modifier that is called on 'newToken' event\n * @param {string} modifierId state modifier id\n * @param {function} condition a predicate function that returns true or false\n * @param {function} modifier a function to update token state\n */\n Tokenizer.prototype.registerModifier = function (modifierId, condition, modifier) {\n this.events.newToken.subscribe(function (token, contextParams) {\n var conditionParams = [token, contextParams]\n var canApplyModifier = condition === null || condition.apply(this, conditionParams) === true\n var modifierParams = [token, contextParams]\n if (canApplyModifier) {\n var newStateValue = modifier.apply(this, modifierParams)\n token.setState(modifierId, newStateValue)\n }\n })\n this.registeredModifiers.push(modifierId)\n }\n\n /**\n * Subscribe a handler to an event\n * @param {function} eventHandler an event handler function\n */\n Event.prototype.subscribe = function (eventHandler) {\n if (typeof eventHandler === 'function') {\n return this.subscribers.push(eventHandler) - 1\n } else {\n return { FAIL: \"invalid '\" + this.eventId + \"' event handler\" }\n }\n }\n\n /**\n * Unsubscribe an event handler\n * @param {string} subsId subscription id\n */\n Event.prototype.unsubscribe = function (subsId) {\n this.subscribers.splice(subsId, 1)\n }\n\n /**\n * Sets context params current value index\n * @param {number} index context params current value index\n */\n ContextParams.prototype.setCurrentIndex = function (index) {\n this.index = index\n this.current = this.context[index]\n this.backtrack = this.context.slice(0, index)\n this.lookahead = this.context.slice(index + 1)\n }\n\n /**\n * Get an item at an offset from the current value\n * example (current value is 3):\n * 1 2 [3] 4 5 | items values\n * -2 -1 0 1 2 | offset values\n * @param {number} offset an offset from current value index\n */\n ContextParams.prototype.get = function (offset) {\n switch (true) {\n case offset === 0:\n return this.current\n case offset < 0 && Math.abs(offset) <= this.backtrack.length:\n return this.backtrack.slice(offset)[0]\n case offset > 0 && offset <= this.lookahead.length:\n return this.lookahead[offset - 1]\n default:\n return null\n }\n }\n\n /**\n * Converts a context range into a string value\n * @param {contextRange} range a context range\n */\n Tokenizer.prototype.rangeToText = function (range) {\n if (range instanceof ContextRange) {\n return this.getRangeTokens(range)\n .map(function (token) {\n return token.char\n })\n .join('')\n }\n }\n\n /**\n * Converts all tokens into a string\n */\n Tokenizer.prototype.getText = function () {\n return this.tokens\n .map(function (token) {\n return token.char\n })\n .join('')\n }\n\n /**\n * Get a context by name\n * @param {string} contextName context name to get\n */\n Tokenizer.prototype.getContext = function (contextName) {\n var context = this.registeredContexts[contextName]\n return !!context ? context : null\n }\n\n /**\n * Subscribes a new event handler to an event\n * @param {string} eventName event name to subscribe to\n * @param {function} eventHandler a function to be invoked on event\n */\n Tokenizer.prototype.on = function (eventName, eventHandler) {\n var event = this.events[eventName]\n if (!!event) {\n return event.subscribe(eventHandler)\n } else {\n return null\n }\n }\n\n /**\n * Dispatches an event\n * @param {string} eventName event name\n * @param {any} args event handler arguments\n */\n Tokenizer.prototype.dispatch = function (eventName, args) {\n var this$1 = this\n\n var event = this.events[eventName]\n if (event instanceof Event) {\n event.subscribers.forEach(function (subscriber) {\n subscriber.apply(this$1, args || [])\n })\n }\n }\n\n /**\n * Register a new context checker\n * @param {string} contextName a unique context name\n * @param {function} contextStartCheck a predicate function that returns true on context start\n * @param {function} contextEndCheck a predicate function that returns true on context end\n * TODO: call tokenize on registration to update context ranges with the new context.\n */\n Tokenizer.prototype.registerContextChecker = function (contextName, contextStartCheck, contextEndCheck) {\n if (!!this.getContext(contextName)) {\n return {\n FAIL: \"context name '\" + contextName + \"' is already registered.\",\n }\n }\n if (typeof contextStartCheck !== 'function') {\n return {\n FAIL: 'missing context start check.',\n }\n }\n if (typeof contextEndCheck !== 'function') {\n return {\n FAIL: 'missing context end check.',\n }\n }\n var contextCheckers = new ContextChecker(contextName, contextStartCheck, contextEndCheck)\n this.registeredContexts[contextName] = contextCheckers\n this.contextCheckers.push(contextCheckers)\n return contextCheckers\n }\n\n /**\n * Gets a context range tokens\n * @param {contextRange} range a context range\n */\n Tokenizer.prototype.getRangeTokens = function (range) {\n var endIndex = range.startIndex + range.endOffset\n return [].concat(this.tokens.slice(range.startIndex, endIndex))\n }\n\n /**\n * Gets the ranges of a context\n * @param {string} contextName context name\n */\n Tokenizer.prototype.getContextRanges = function (contextName) {\n var context = this.getContext(contextName)\n if (!!context) {\n return context.ranges\n } else {\n return { FAIL: \"context checker '\" + contextName + \"' is not registered.\" }\n }\n }\n\n /**\n * Resets context ranges to run context update\n */\n Tokenizer.prototype.resetContextsRanges = function () {\n var registeredContexts = this.registeredContexts\n for (var contextName in registeredContexts) {\n if (registeredContexts.hasOwnProperty(contextName)) {\n var context = registeredContexts[contextName]\n context.ranges = []\n }\n }\n }\n\n /**\n * Updates context ranges\n */\n Tokenizer.prototype.updateContextsRanges = function () {\n this.resetContextsRanges()\n var chars = this.tokens.map(function (token) {\n return token.char\n })\n for (var i = 0; i < chars.length; i++) {\n var contextParams = new ContextParams(chars, i)\n this.runContextCheck(contextParams)\n }\n this.dispatch('updateContextsRanges', [this.registeredContexts])\n }\n\n /**\n * Sets the end offset of an open range\n * @param {number} offset range end offset\n * @param {string} contextName context name\n */\n Tokenizer.prototype.setEndOffset = function (offset, contextName) {\n var startIndex = this.getContext(contextName).openRange.startIndex\n var range = new ContextRange(startIndex, offset, contextName)\n var ranges = this.getContext(contextName).ranges\n range.rangeId = contextName + '.' + ranges.length\n ranges.push(range)\n this.getContext(contextName).openRange = null\n return range\n }\n\n /**\n * Runs a context check on the current context\n * @param {contextParams} contextParams current context params\n */\n Tokenizer.prototype.runContextCheck = function (contextParams) {\n var this$1 = this\n\n var index = contextParams.index\n this.contextCheckers.forEach(function (contextChecker) {\n var contextName = contextChecker.contextName\n var openRange = this$1.getContext(contextName).openRange\n if (!openRange && contextChecker.checkStart(contextParams)) {\n openRange = new ContextRange(index, null, contextName)\n this$1.getContext(contextName).openRange = openRange\n this$1.dispatch('contextStart', [contextName, index])\n }\n if (!!openRange && contextChecker.checkEnd(contextParams)) {\n var offset = index - openRange.startIndex + 1\n var range = this$1.setEndOffset(offset, contextName)\n this$1.dispatch('contextEnd', [contextName, range])\n }\n })\n }\n\n /**\n * Converts a text into a list of tokens\n * @param {string} text a text to tokenize\n */\n Tokenizer.prototype.tokenize = function (text) {\n this.tokens = []\n this.resetContextsRanges()\n var chars = Array.from(text)\n this.dispatch('start')\n for (var i = 0; i < chars.length; i++) {\n var char = chars[i]\n var contextParams = new ContextParams(chars, i)\n this.dispatch('next', [contextParams])\n this.runContextCheck(contextParams)\n var token = new Token(char)\n this.tokens.push(token)\n this.dispatch('newToken', [token, contextParams])\n }\n this.dispatch('end', [this.tokens])\n return this.tokens\n }\n\n // ╭─┄┄┄────────────────────────┄─────────────────────────────────────────────╮\n // ┊ Character Class Assertions ┊ Checks if a char belongs to a certain class ┊\n // ╰─╾──────────────────────────┄─────────────────────────────────────────────╯\n // jscs:disable maximumLineLength\n /**\n * Check if a char is Arabic\n * @param {string} c a single char\n */\n function isArabicChar(c) {\n return /[\\u0600-\\u065F\\u066A-\\u06D2\\u06FA-\\u06FF]/.test(c)\n }\n\n /**\n * Check if a char is an isolated arabic char\n * @param {string} c a single char\n */\n function isIsolatedArabicChar(char) {\n return /[\\u0630\\u0690\\u0621\\u0631\\u0661\\u0671\\u0622\\u0632\\u0672\\u0692\\u06C2\\u0623\\u0673\\u0693\\u06C3\\u0624\\u0694\\u06C4\\u0625\\u0675\\u0695\\u06C5\\u06E5\\u0676\\u0696\\u06C6\\u0627\\u0677\\u0697\\u06C7\\u0648\\u0688\\u0698\\u06C8\\u0689\\u0699\\u06C9\\u068A\\u06CA\\u066B\\u068B\\u06CB\\u068C\\u068D\\u06CD\\u06FD\\u068E\\u06EE\\u06FE\\u062F\\u068F\\u06CF\\u06EF]/.test(\n char,\n )\n }\n\n /**\n * Check if a char is an Arabic Tashkeel char\n * @param {string} c a single char\n */\n function isTashkeelArabicChar(char) {\n return /[\\u0600-\\u0605\\u060C-\\u060E\\u0610-\\u061B\\u061E\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED]/.test(\n char,\n )\n }\n\n /**\n * Check if a char is Latin\n * @param {string} c a single char\n */\n function isLatinChar(c) {\n return /[A-z]/.test(c)\n }\n\n /**\n * Check if a char is whitespace char\n * @param {string} c a single char\n */\n function isWhiteSpace(c) {\n return /\\s/.test(c)\n }\n\n /**\n * Query a feature by some of it's properties to lookup a glyph substitution.\n */\n\n /**\n * Create feature query instance\n * @param {Font} font opentype font instance\n */\n function FeatureQuery(font) {\n this.font = font\n this.features = {}\n }\n\n /**\n * @typedef SubstitutionAction\n * @type Object\n * @property {number} id substitution type\n * @property {string} tag feature tag\n * @property {any} substitution substitution value(s)\n */\n\n /**\n * Create a substitution action instance\n * @param {SubstitutionAction} action\n */\n function SubstitutionAction(action) {\n this.id = action.id\n this.tag = action.tag\n this.substitution = action.substitution\n }\n\n /**\n * Lookup a coverage table\n * @param {number} glyphIndex glyph index\n * @param {CoverageTable} coverage coverage table\n */\n function lookupCoverage(glyphIndex, coverage) {\n if (!glyphIndex) {\n return -1\n }\n switch (coverage.format) {\n case 1:\n return coverage.glyphs.indexOf(glyphIndex)\n\n case 2:\n var ranges = coverage.ranges\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i]\n if (glyphIndex >= range.start && glyphIndex <= range.end) {\n var offset = glyphIndex - range.start\n return range.index + offset\n }\n }\n break\n default:\n return -1 // not found\n }\n return -1\n }\n\n /**\n * Handle a single substitution - format 1\n * @param {ContextParams} contextParams context params to lookup\n */\n function singleSubstitutionFormat1(glyphIndex, subtable) {\n var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (substituteIndex === -1) {\n return null\n }\n return glyphIndex + subtable.deltaGlyphId\n }\n\n /**\n * Handle a single substitution - format 2\n * @param {ContextParams} contextParams context params to lookup\n */\n function singleSubstitutionFormat2(glyphIndex, subtable) {\n var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (substituteIndex === -1) {\n return null\n }\n return subtable.substitute[substituteIndex]\n }\n\n /**\n * Lookup a list of coverage tables\n * @param {any} coverageList a list of coverage tables\n * @param {ContextParams} contextParams context params to lookup\n */\n function lookupCoverageList(coverageList, contextParams) {\n var lookupList = []\n for (var i = 0; i < coverageList.length; i++) {\n var coverage = coverageList[i]\n var glyphIndex = contextParams.current\n glyphIndex = Array.isArray(glyphIndex) ? glyphIndex[0] : glyphIndex\n var lookupIndex = lookupCoverage(glyphIndex, coverage)\n if (lookupIndex !== -1) {\n lookupList.push(lookupIndex)\n }\n }\n if (lookupList.length !== coverageList.length) {\n return -1\n }\n return lookupList\n }\n\n /**\n * Handle chaining context substitution - format 3\n * @param {ContextParams} contextParams context params to lookup\n */\n function chainingSubstitutionFormat3(contextParams, subtable) {\n var lookupsCount =\n subtable.inputCoverage.length + subtable.lookaheadCoverage.length + subtable.backtrackCoverage.length\n if (contextParams.context.length < lookupsCount) {\n return []\n }\n // INPUT LOOKUP //\n var inputLookups = lookupCoverageList(subtable.inputCoverage, contextParams)\n if (inputLookups === -1) {\n return []\n }\n // LOOKAHEAD LOOKUP //\n var lookaheadOffset = subtable.inputCoverage.length - 1\n if (contextParams.lookahead.length < subtable.lookaheadCoverage.length) {\n return []\n }\n var lookaheadContext = contextParams.lookahead.slice(lookaheadOffset)\n while (lookaheadContext.length && isTashkeelArabicChar(lookaheadContext[0].char)) {\n lookaheadContext.shift()\n }\n var lookaheadParams = new ContextParams(lookaheadContext, 0)\n var lookaheadLookups = lookupCoverageList(subtable.lookaheadCoverage, lookaheadParams)\n // BACKTRACK LOOKUP //\n var backtrackContext = [].concat(contextParams.backtrack)\n backtrackContext.reverse()\n while (backtrackContext.length && isTashkeelArabicChar(backtrackContext[0].char)) {\n backtrackContext.shift()\n }\n if (backtrackContext.length < subtable.backtrackCoverage.length) {\n return []\n }\n var backtrackParams = new ContextParams(backtrackContext, 0)\n var backtrackLookups = lookupCoverageList(subtable.backtrackCoverage, backtrackParams)\n var contextRulesMatch =\n inputLookups.length === subtable.inputCoverage.length &&\n lookaheadLookups.length === subtable.lookaheadCoverage.length &&\n backtrackLookups.length === subtable.backtrackCoverage.length\n var substitutions = []\n if (contextRulesMatch) {\n for (var i = 0; i < subtable.lookupRecords.length; i++) {\n var lookupRecord = subtable.lookupRecords[i]\n var lookupListIndex = lookupRecord.lookupListIndex\n var lookupTable = this.getLookupByIndex(lookupListIndex)\n for (var s = 0; s < lookupTable.subtables.length; s++) {\n var subtable$1 = lookupTable.subtables[s]\n var lookup = this.getLookupMethod(lookupTable, subtable$1)\n var substitutionType = this.getSubstitutionType(lookupTable, subtable$1)\n if (substitutionType === '12') {\n for (var n = 0; n < inputLookups.length; n++) {\n var glyphIndex = contextParams.get(n)\n var substitution = lookup(glyphIndex)\n if (substitution) {\n substitutions.push(substitution)\n }\n }\n }\n }\n }\n }\n return substitutions\n }\n\n /**\n * Handle ligature substitution - format 1\n * @param {ContextParams} contextParams context params to lookup\n */\n function ligatureSubstitutionFormat1(contextParams, subtable) {\n // COVERAGE LOOKUP //\n var glyphIndex = contextParams.current\n var ligSetIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (ligSetIndex === -1) {\n return null\n }\n // COMPONENTS LOOKUP\n // (!) note, components are ordered in the written direction.\n var ligature\n var ligatureSet = subtable.ligatureSets[ligSetIndex]\n for (var s = 0; s < ligatureSet.length; s++) {\n ligature = ligatureSet[s]\n for (var l = 0; l < ligature.components.length; l++) {\n var lookaheadItem = contextParams.lookahead[l]\n var component = ligature.components[l]\n if (lookaheadItem !== component) {\n break\n }\n if (l === ligature.components.length - 1) {\n return ligature\n }\n }\n }\n return null\n }\n\n /**\n * Handle decomposition substitution - format 1\n * @param {number} glyphIndex glyph index\n * @param {any} subtable subtable\n */\n function decompositionSubstitutionFormat1(glyphIndex, subtable) {\n var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage)\n if (substituteIndex === -1) {\n return null\n }\n return subtable.sequences[substituteIndex]\n }\n\n /**\n * Get default script features indexes\n */\n FeatureQuery.prototype.getDefaultScriptFeaturesIndexes = function () {\n var scripts = this.font.tables.gsub.scripts\n for (var s = 0; s < scripts.length; s++) {\n var script = scripts[s]\n if (script.tag === 'DFLT') {\n return script.script.defaultLangSys.featureIndexes\n }\n }\n return []\n }\n\n /**\n * Get feature indexes of a specific script\n * @param {string} scriptTag script tag\n */\n FeatureQuery.prototype.getScriptFeaturesIndexes = function (scriptTag) {\n var tables = this.font.tables\n if (!tables.gsub) {\n return []\n }\n if (!scriptTag) {\n return this.getDefaultScriptFeaturesIndexes()\n }\n var scripts = this.font.tables.gsub.scripts\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i]\n if (script.tag === scriptTag && script.script.defaultLangSys) {\n return script.script.defaultLangSys.featureIndexes\n } else {\n var langSysRecords = script.langSysRecords\n if (!!langSysRecords) {\n for (var j = 0; j < langSysRecords.length; j++) {\n var langSysRecord = langSysRecords[j]\n if (langSysRecord.tag === scriptTag) {\n var langSys = langSysRecord.langSys\n return langSys.featureIndexes\n }\n }\n }\n }\n }\n return this.getDefaultScriptFeaturesIndexes()\n }\n\n /**\n * Map a feature tag to a gsub feature\n * @param {any} features gsub features\n * @param {string} scriptTag script tag\n */\n FeatureQuery.prototype.mapTagsToFeatures = function (features, scriptTag) {\n var tags = {}\n for (var i = 0; i < features.length; i++) {\n var tag = features[i].tag\n var feature = features[i].feature\n tags[tag] = feature\n }\n this.features[scriptTag].tags = tags\n }\n\n /**\n * Get features of a specific script\n * @param {string} scriptTag script tag\n */\n FeatureQuery.prototype.getScriptFeatures = function (scriptTag) {\n var features = this.features[scriptTag]\n if (this.features.hasOwnProperty(scriptTag)) {\n return features\n }\n var featuresIndexes = this.getScriptFeaturesIndexes(scriptTag)\n if (!featuresIndexes) {\n return null\n }\n var gsub = this.font.tables.gsub\n features = featuresIndexes.map(function (index) {\n return gsub.features[index]\n })\n this.features[scriptTag] = features\n this.mapTagsToFeatures(features, scriptTag)\n return features\n }\n\n /**\n * Get substitution type\n * @param {any} lookupTable lookup table\n * @param {any} subtable subtable\n */\n FeatureQuery.prototype.getSubstitutionType = function (lookupTable, subtable) {\n var lookupType = lookupTable.lookupType.toString()\n var substFormat = subtable.substFormat.toString()\n return lookupType + substFormat\n }\n\n /**\n * Get lookup method\n * @param {any} lookupTable lookup table\n * @param {any} subtable subtable\n */\n FeatureQuery.prototype.getLookupMethod = function (lookupTable, subtable) {\n var this$1 = this\n\n var substitutionType = this.getSubstitutionType(lookupTable, subtable)\n switch (substitutionType) {\n case '11':\n return function (glyphIndex) {\n return singleSubstitutionFormat1.apply(this$1, [glyphIndex, subtable])\n }\n case '12':\n return function (glyphIndex) {\n return singleSubstitutionFormat2.apply(this$1, [glyphIndex, subtable])\n }\n case '63':\n return function (contextParams) {\n return chainingSubstitutionFormat3.apply(this$1, [contextParams, subtable])\n }\n case '41':\n return function (contextParams) {\n return ligatureSubstitutionFormat1.apply(this$1, [contextParams, subtable])\n }\n case '21':\n return function (glyphIndex) {\n return decompositionSubstitutionFormat1.apply(this$1, [glyphIndex, subtable])\n }\n default:\n throw new Error(\n 'lookupType: ' +\n lookupTable.lookupType +\n ' - ' +\n 'substFormat: ' +\n subtable.substFormat +\n ' ' +\n 'is not yet supported',\n )\n }\n }\n\n /**\n * [ LOOKUP TYPES ]\n * -------------------------------\n * Single 1;\n * Multiple 2;\n * Alternate 3;\n * Ligature 4;\n * Context 5;\n * ChainingContext 6;\n * ExtensionSubstitution 7;\n * ReverseChainingContext 8;\n * -------------------------------\n *\n */\n\n /**\n * @typedef FQuery\n * @type Object\n * @param {string} tag feature tag\n * @param {string} script feature script\n * @param {ContextParams} contextParams context params\n */\n\n /**\n * Lookup a feature using a query parameters\n * @param {FQuery} query feature query\n */\n FeatureQuery.prototype.lookupFeature = function (query) {\n var contextParams = query.contextParams\n var currentIndex = contextParams.index\n var feature = this.getFeature({\n tag: query.tag,\n script: query.script,\n })\n if (!feature) {\n return new Error(\n \"font '\" +\n this.font.names.fullName.en +\n \"' \" +\n \"doesn't support feature '\" +\n query.tag +\n \"' \" +\n \"for script '\" +\n query.script +\n \"'.\",\n )\n }\n var lookups = this.getFeatureLookups(feature)\n var substitutions = [].concat(contextParams.context)\n for (var l = 0; l < lookups.length; l++) {\n var lookupTable = lookups[l]\n var subtables = this.getLookupSubtables(lookupTable)\n for (var s = 0; s < subtables.length; s++) {\n var subtable = subtables[s]\n var substType = this.getSubstitutionType(lookupTable, subtable)\n var lookup = this.getLookupMethod(lookupTable, subtable)\n var substitution = void 0\n switch (substType) {\n case '11':\n substitution = lookup(contextParams.current)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 11,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '12':\n substitution = lookup(contextParams.current)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 12,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '63':\n substitution = lookup(contextParams)\n if (Array.isArray(substitution) && substitution.length) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 63,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '41':\n substitution = lookup(contextParams)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 41,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n case '21':\n substitution = lookup(contextParams.current)\n if (substitution) {\n substitutions.splice(\n currentIndex,\n 1,\n new SubstitutionAction({\n id: 21,\n tag: query.tag,\n substitution: substitution,\n }),\n )\n }\n break\n }\n contextParams = new ContextParams(substitutions, currentIndex)\n if (Array.isArray(substitution) && !substitution.length) {\n continue\n }\n substitution = null\n }\n }\n return substitutions.length ? substitutions : null\n }\n\n /**\n * Checks if a font supports a specific features\n * @param {FQuery} query feature query object\n */\n FeatureQuery.prototype.supports = function (query) {\n if (!query.script) {\n return false\n }\n this.getScriptFeatures(query.script)\n var supportedScript = this.features.hasOwnProperty(query.script)\n if (!query.tag) {\n return supportedScript\n }\n var supportedFeature = this.features[query.script].some(function (feature) {\n return feature.tag === query.tag\n })\n return supportedScript && supportedFeature\n }\n\n /**\n * Get lookup table subtables\n * @param {any} lookupTable lookup table\n */\n FeatureQuery.prototype.getLookupSubtables = function (lookupTable) {\n return lookupTable.subtables || null\n }\n\n /**\n * Get lookup table by index\n * @param {number} index lookup table index\n */\n FeatureQuery.prototype.getLookupByIndex = function (index) {\n var lookups = this.font.tables.gsub.lookups\n return lookups[index] || null\n }\n\n /**\n * Get lookup tables for a feature\n * @param {string} feature\n */\n FeatureQuery.prototype.getFeatureLookups = function (feature) {\n // TODO: memoize\n return feature.lookupListIndexes.map(this.getLookupByIndex.bind(this))\n }\n\n /**\n * Query a feature by it's properties\n * @param {any} query an object that describes the properties of a query\n */\n FeatureQuery.prototype.getFeature = function getFeature(query) {\n if (!this.font) {\n return { FAIL: 'No font was found' }\n }\n if (!this.features.hasOwnProperty(query.script)) {\n this.getScriptFeatures(query.script)\n }\n var scriptFeatures = this.features[query.script]\n if (!scriptFeatures) {\n return { FAIL: 'No feature for script ' + query.script }\n }\n if (!scriptFeatures.tags[query.tag]) {\n return null\n }\n return this.features[query.script].tags[query.tag]\n }\n\n /**\n * Arabic word context checkers\n */\n\n function arabicWordStartCheck(contextParams) {\n var char = contextParams.current\n var prevChar = contextParams.get(-1)\n return (\n // ? arabic first char\n (prevChar === null && isArabicChar(char)) ||\n // ? arabic char preceded with a non arabic char\n (!isArabicChar(prevChar) && isArabicChar(char))\n )\n }\n\n function arabicWordEndCheck(contextParams) {\n var nextChar = contextParams.get(1)\n return (\n // ? last arabic char\n nextChar === null ||\n // ? next char is not arabic\n !isArabicChar(nextChar)\n )\n }\n\n var arabicWordCheck = {\n startCheck: arabicWordStartCheck,\n endCheck: arabicWordEndCheck,\n }\n\n /**\n * Arabic sentence context checkers\n */\n\n function arabicSentenceStartCheck(contextParams) {\n var char = contextParams.current\n var prevChar = contextParams.get(-1)\n return (\n // ? an arabic char preceded with a non arabic char\n (isArabicChar(char) || isTashkeelArabicChar(char)) && !isArabicChar(prevChar)\n )\n }\n\n function arabicSentenceEndCheck(contextParams) {\n var nextChar = contextParams.get(1)\n switch (true) {\n case nextChar === null:\n return true\n case !isArabicChar(nextChar) && !isTashkeelArabicChar(nextChar):\n var nextIsWhitespace = isWhiteSpace(nextChar)\n if (!nextIsWhitespace) {\n return true\n }\n if (nextIsWhitespace) {\n var arabicCharAhead = false\n arabicCharAhead = contextParams.lookahead.some(function (c) {\n return isArabicChar(c) || isTashkeelArabicChar(c)\n })\n if (!arabicCharAhead) {\n return true\n }\n }\n break\n default:\n return false\n }\n }\n\n var arabicSentenceCheck = {\n startCheck: arabicSentenceStartCheck,\n endCheck: arabicSentenceEndCheck,\n }\n\n /**\n * Apply single substitution format 1\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function singleSubstitutionFormat1$1(action, tokens, index) {\n tokens[index].setState(action.tag, action.substitution)\n }\n\n /**\n * Apply single substitution format 2\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function singleSubstitutionFormat2$1(action, tokens, index) {\n tokens[index].setState(action.tag, action.substitution)\n }\n\n /**\n * Apply chaining context substitution format 3\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function chainingSubstitutionFormat3$1(action, tokens, index) {\n action.substitution.forEach(function (subst, offset) {\n var token = tokens[index + offset]\n token.setState(action.tag, subst)\n })\n }\n\n /**\n * Apply ligature substitution format 1\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function ligatureSubstitutionFormat1$1(action, tokens, index) {\n var token = tokens[index]\n token.setState(action.tag, action.substitution.ligGlyph)\n var compsCount = action.substitution.components.length\n for (var i = 0; i < compsCount; i++) {\n token = tokens[index + i + 1]\n token.setState('deleted', true)\n }\n }\n\n /**\n * Supported substitutions\n */\n var SUBSTITUTIONS = {\n 11: singleSubstitutionFormat1$1,\n 12: singleSubstitutionFormat2$1,\n 63: chainingSubstitutionFormat3$1,\n 41: ligatureSubstitutionFormat1$1,\n }\n\n /**\n * Apply substitutions to a list of tokens\n * @param {Array} substitutions substitutions\n * @param {any} tokens a list of tokens\n * @param {number} index token index\n */\n function applySubstitution(action, tokens, index) {\n if (action instanceof SubstitutionAction && SUBSTITUTIONS[action.id]) {\n SUBSTITUTIONS[action.id](action, tokens, index)\n }\n }\n\n /**\n * Apply Arabic presentation forms to a range of tokens\n */\n\n /**\n * Check if a char can be connected to it's preceding char\n * @param {ContextParams} charContextParams context params of a char\n */\n function willConnectPrev(charContextParams) {\n var backtrack = [].concat(charContextParams.backtrack)\n for (var i = backtrack.length - 1; i >= 0; i--) {\n var prevChar = backtrack[i]\n var isolated = isIsolatedArabicChar(prevChar)\n var tashkeel = isTashkeelArabicChar(prevChar)\n if (!isolated && !tashkeel) {\n return true\n }\n if (isolated) {\n return false\n }\n }\n return false\n }\n\n /**\n * Check if a char can be connected to it's proceeding char\n * @param {ContextParams} charContextParams context params of a char\n */\n function willConnectNext(charContextParams) {\n if (isIsolatedArabicChar(charContextParams.current)) {\n return false\n }\n for (var i = 0; i < charContextParams.lookahead.length; i++) {\n var nextChar = charContextParams.lookahead[i]\n var tashkeel = isTashkeelArabicChar(nextChar)\n if (!tashkeel) {\n return true\n }\n }\n return false\n }\n\n /**\n * Apply arabic presentation forms to a list of tokens\n * @param {ContextRange} range a range of tokens\n */\n function arabicPresentationForms(range) {\n var this$1 = this\n\n var script = 'arab'\n var tags = this.featuresTags[script]\n var tokens = this.tokenizer.getRangeTokens(range)\n if (tokens.length === 1) {\n return\n }\n var contextParams = new ContextParams(\n tokens.map(function (token) {\n return token.getState('glyphIndex')\n }),\n 0,\n )\n var charContextParams = new ContextParams(\n tokens.map(function (token) {\n return token.char\n }),\n 0,\n )\n tokens.forEach(function (token, index) {\n if (isTashkeelArabicChar(token.char)) {\n return\n }\n contextParams.setCurrentIndex(index)\n charContextParams.setCurrentIndex(index)\n var CONNECT = 0 // 2 bits 00 (10: can connect next) (01: can connect prev)\n if (willConnectPrev(charContextParams)) {\n CONNECT |= 1\n }\n if (willConnectNext(charContextParams)) {\n CONNECT |= 2\n }\n var tag\n switch (CONNECT) {\n case 1:\n tag = 'fina'\n break\n case 2:\n tag = 'init'\n break\n case 3:\n tag = 'medi'\n break\n }\n if (tags.indexOf(tag) === -1) {\n return\n }\n var substitutions = this$1.query.lookupFeature({\n tag: tag,\n script: script,\n contextParams: contextParams,\n })\n if (substitutions instanceof Error) {\n return console.info(substitutions.message)\n }\n substitutions.forEach(function (action, index) {\n if (action instanceof SubstitutionAction) {\n applySubstitution(action, tokens, index)\n contextParams.context[index] = action.substitution\n }\n })\n })\n }\n\n /**\n * Apply Arabic required ligatures feature to a range of tokens\n */\n\n /**\n * Update context params\n * @param {any} tokens a list of tokens\n * @param {number} index current item index\n */\n function getContextParams(tokens, index) {\n var context = tokens.map(function (token) {\n return token.activeState.value\n })\n return new ContextParams(context, index || 0)\n }\n\n /**\n * Apply Arabic required ligatures to a context range\n * @param {ContextRange} range a range of tokens\n */\n function arabicRequiredLigatures(range) {\n var this$1 = this\n\n var script = 'arab'\n var tokens = this.tokenizer.getRangeTokens(range)\n var contextParams = getContextParams(tokens)\n contextParams.context.forEach(function (glyphIndex, index) {\n contextParams.setCurrentIndex(index)\n var substitutions = this$1.query.lookupFeature({\n tag: 'rlig',\n script: script,\n contextParams: contextParams,\n })\n if (substitutions.length) {\n substitutions.forEach(function (action) {\n return applySubstitution(action, tokens, index)\n })\n contextParams = getContextParams(tokens)\n }\n })\n }\n\n /**\n * Latin word context checkers\n */\n\n function latinWordStartCheck(contextParams) {\n var char = contextParams.current\n var prevChar = contextParams.get(-1)\n return (\n // ? latin first char\n (prevChar === null && isLatinChar(char)) ||\n // ? latin char preceded with a non latin char\n (!isLatinChar(prevChar) && isLatinChar(char))\n )\n }\n\n function latinWordEndCheck(contextParams) {\n var nextChar = contextParams.get(1)\n return (\n // ? last latin char\n nextChar === null ||\n // ? next char is not latin\n !isLatinChar(nextChar)\n )\n }\n\n var latinWordCheck = {\n startCheck: latinWordStartCheck,\n endCheck: latinWordEndCheck,\n }\n\n /**\n * Apply Latin ligature feature to a range of tokens\n */\n\n /**\n * Update context params\n * @param {any} tokens a list of tokens\n * @param {number} index current item index\n */\n function getContextParams$1(tokens, index) {\n var context = tokens.map(function (token) {\n return token.activeState.value\n })\n return new ContextParams(context, index || 0)\n }\n\n /**\n * Apply Arabic required ligatures to a context range\n * @param {ContextRange} range a range of tokens\n */\n function latinLigature(range) {\n var this$1 = this\n\n var script = 'latn'\n var tokens = this.tokenizer.getRangeTokens(range)\n var contextParams = getContextParams$1(tokens)\n contextParams.context.forEach(function (glyphIndex, index) {\n contextParams.setCurrentIndex(index)\n var substitutions = this$1.query.lookupFeature({\n tag: 'liga',\n script: script,\n contextParams: contextParams,\n })\n if (substitutions.length) {\n substitutions.forEach(function (action) {\n return applySubstitution(action, tokens, index)\n })\n contextParams = getContextParams$1(tokens)\n }\n })\n }\n\n /**\n * Infer bidirectional properties for a given text and apply\n * the corresponding layout rules.\n */\n\n /**\n * Create Bidi. features\n * @param {string} baseDir text base direction. value either 'ltr' or 'rtl'\n */\n function Bidi(baseDir) {\n this.baseDir = baseDir || 'ltr'\n this.tokenizer = new Tokenizer()\n this.featuresTags = {}\n }\n\n /**\n * Sets Bidi text\n * @param {string} text a text input\n */\n Bidi.prototype.setText = function (text) {\n this.text = text\n }\n\n /**\n * Store essential context checks:\n * arabic word check for applying gsub features\n * arabic sentence check for adjusting arabic layout\n */\n Bidi.prototype.contextChecks = {\n latinWordCheck: latinWordCheck,\n arabicWordCheck: arabicWordCheck,\n arabicSentenceCheck: arabicSentenceCheck,\n }\n\n /**\n * Register arabic word check\n */\n function registerContextChecker(checkId) {\n var check = this.contextChecks[checkId + 'Check']\n return this.tokenizer.registerContextChecker(checkId, check.startCheck, check.endCheck)\n }\n\n /**\n * Perform pre tokenization procedure then\n * tokenize text input\n */\n function tokenizeText() {\n registerContextChecker.call(this, 'latinWord')\n registerContextChecker.call(this, 'arabicWord')\n registerContextChecker.call(this, 'arabicSentence')\n return this.tokenizer.tokenize(this.text)\n }\n\n /**\n * Reverse arabic sentence layout\n * TODO: check base dir before applying adjustments - priority low\n */\n function reverseArabicSentences() {\n var this$1 = this\n\n var ranges = this.tokenizer.getContextRanges('arabicSentence')\n ranges.forEach(function (range) {\n var rangeTokens = this$1.tokenizer.getRangeTokens(range)\n this$1.tokenizer.replaceRange(range.startIndex, range.endOffset, rangeTokens.reverse())\n })\n }\n\n /**\n * Register supported features tags\n * @param {script} script script tag\n * @param {Array} tags features tags list\n */\n Bidi.prototype.registerFeatures = function (script, tags) {\n var this$1 = this\n\n var supportedTags = tags.filter(function (tag) {\n return this$1.query.supports({ script: script, tag: tag })\n })\n if (!this.featuresTags.hasOwnProperty(script)) {\n this.featuresTags[script] = supportedTags\n } else {\n this.featuresTags[script] = this.featuresTags[script].concat(supportedTags)\n }\n }\n\n /**\n * Apply GSUB features\n * @param {Array} tagsList a list of features tags\n * @param {string} script a script tag\n * @param {Font} font opentype font instance\n */\n Bidi.prototype.applyFeatures = function (font, features) {\n if (!font) {\n throw new Error('No valid font was provided to apply features')\n }\n if (!this.query) {\n this.query = new FeatureQuery(font)\n }\n for (var f = 0; f < features.length; f++) {\n var feature = features[f]\n if (!this.query.supports({ script: feature.script })) {\n continue\n }\n this.registerFeatures(feature.script, feature.tags)\n }\n }\n\n /**\n * Register a state modifier\n * @param {string} modifierId state modifier id\n * @param {function} condition a predicate function that returns true or false\n * @param {function} modifier a modifier function to set token state\n */\n Bidi.prototype.registerModifier = function (modifierId, condition, modifier) {\n this.tokenizer.registerModifier(modifierId, condition, modifier)\n }\n\n /**\n * Check if 'glyphIndex' is registered\n */\n function checkGlyphIndexStatus() {\n if (this.tokenizer.registeredModifiers.indexOf('glyphIndex') === -1) {\n throw new Error('glyphIndex modifier is required to apply ' + 'arabic presentation features.')\n }\n }\n\n /**\n * Apply arabic presentation forms features\n */\n function applyArabicPresentationForms() {\n var this$1 = this\n\n var script = 'arab'\n if (!this.featuresTags.hasOwnProperty(script)) {\n return\n }\n checkGlyphIndexStatus.call(this)\n var ranges = this.tokenizer.getContextRanges('arabicWord')\n ranges.forEach(function (range) {\n arabicPresentationForms.call(this$1, range)\n })\n }\n\n /**\n * Apply required arabic ligatures\n */\n function applyArabicRequireLigatures() {\n var this$1 = this\n\n var script = 'arab'\n if (!this.featuresTags.hasOwnProperty(script)) {\n return\n }\n var tags = this.featuresTags[script]\n if (tags.indexOf('rlig') === -1) {\n return\n }\n checkGlyphIndexStatus.call(this)\n var ranges = this.tokenizer.getContextRanges('arabicWord')\n ranges.forEach(function (range) {\n arabicRequiredLigatures.call(this$1, range)\n })\n }\n\n /**\n * Apply required arabic ligatures\n */\n function applyLatinLigatures() {\n var this$1 = this\n\n var script = 'latn'\n if (!this.featuresTags.hasOwnProperty(script)) {\n return\n }\n var tags = this.featuresTags[script]\n if (tags.indexOf('liga') === -1) {\n return\n }\n checkGlyphIndexStatus.call(this)\n var ranges = this.tokenizer.getContextRanges('latinWord')\n ranges.forEach(function (range) {\n latinLigature.call(this$1, range)\n })\n }\n\n /**\n * Check if a context is registered\n * @param {string} contextId context id\n */\n Bidi.prototype.checkContextReady = function (contextId) {\n return !!this.tokenizer.getContext(contextId)\n }\n\n /**\n * Apply features to registered contexts\n */\n Bidi.prototype.applyFeaturesToContexts = function () {\n if (this.checkContextReady('arabicWord')) {\n applyArabicPresentationForms.call(this)\n applyArabicRequireLigatures.call(this)\n }\n if (this.checkContextReady('latinWord')) {\n applyLatinLigatures.call(this)\n }\n if (this.checkContextReady('arabicSentence')) {\n reverseArabicSentences.call(this)\n }\n }\n\n /**\n * process text input\n * @param {string} text an input text\n */\n Bidi.prototype.processText = function (text) {\n if (!this.text || this.text !== text) {\n this.setText(text)\n tokenizeText.call(this)\n this.applyFeaturesToContexts()\n }\n }\n\n /**\n * Process a string of text to identify and adjust\n * bidirectional text entities.\n * @param {string} text input text\n */\n Bidi.prototype.getBidiText = function (text) {\n this.processText(text)\n return this.tokenizer.getText()\n }\n\n /**\n * Get the current state index of each token\n * @param {text} text an input text\n */\n Bidi.prototype.getTextGlyphs = function (text) {\n this.processText(text)\n var indexes = []\n for (var i = 0; i < this.tokenizer.tokens.length; i++) {\n var token = this.tokenizer.tokens[i]\n if (token.state.deleted) {\n continue\n }\n var index = token.activeState.value\n indexes.push(Array.isArray(index) ? index[0] : index)\n }\n return indexes\n }\n\n // The Font object\n\n /**\n * @typedef FontOptions\n * @type Object\n * @property {Boolean} empty - whether to create a new empty font\n * @property {string} familyName\n * @property {string} styleName\n * @property {string=} fullName\n * @property {string=} postScriptName\n * @property {string=} designer\n * @property {string=} designerURL\n * @property {string=} manufacturer\n * @property {string=} manufacturerURL\n * @property {string=} license\n * @property {string=} licenseURL\n * @property {string=} version\n * @property {string=} description\n * @property {string=} copyright\n * @property {string=} trademark\n * @property {Number} unitsPerEm\n * @property {Number} ascender\n * @property {Number} descender\n * @property {Number} createdTimestamp\n * @property {string=} weightClass\n * @property {string=} widthClass\n * @property {string=} fsSelection\n */\n\n /**\n * A Font represents a loaded OpenType font file.\n * It contains a set of glyphs and methods to draw text on a drawing context,\n * or to get a path representing the text.\n * @exports opentype.Font\n * @class\n * @param {FontOptions}\n * @constructor\n */\n function Font(options) {\n options = options || {}\n options.tables = options.tables || {}\n\n if (!options.empty) {\n // Check that we've provided the minimum set of names.\n checkArgument(options.familyName, 'When creating a new Font object, familyName is required.')\n checkArgument(options.styleName, 'When creating a new Font object, styleName is required.')\n checkArgument(options.unitsPerEm, 'When creating a new Font object, unitsPerEm is required.')\n checkArgument(options.ascender, 'When creating a new Font object, ascender is required.')\n checkArgument(options.descender <= 0, 'When creating a new Font object, negative descender value is required.')\n\n // OS X will complain if the names are empty, so we put a single space everywhere by default.\n this.names = {\n fontFamily: { en: options.familyName || ' ' },\n fontSubfamily: { en: options.styleName || ' ' },\n fullName: { en: options.fullName || options.familyName + ' ' + options.styleName },\n // postScriptName may not contain any whitespace\n postScriptName: { en: options.postScriptName || (options.familyName + options.styleName).replace(/\\s/g, '') },\n designer: { en: options.designer || ' ' },\n designerURL: { en: options.designerURL || ' ' },\n manufacturer: { en: options.manufacturer || ' ' },\n manufacturerURL: { en: options.manufacturerURL || ' ' },\n license: { en: options.license || ' ' },\n licenseURL: { en: options.licenseURL || ' ' },\n version: { en: options.version || 'Version 0.1' },\n description: { en: options.description || ' ' },\n copyright: { en: options.copyright || ' ' },\n trademark: { en: options.trademark || ' ' },\n }\n this.unitsPerEm = options.unitsPerEm || 1000\n this.ascender = options.ascender\n this.descender = options.descender\n this.createdTimestamp = options.createdTimestamp\n this.tables = Object.assign(options.tables, {\n os2: Object.assign(\n {\n usWeightClass: options.weightClass || this.usWeightClasses.MEDIUM,\n usWidthClass: options.widthClass || this.usWidthClasses.MEDIUM,\n fsSelection: options.fsSelection || this.fsSelectionValues.REGULAR,\n },\n options.tables.os2,\n ),\n })\n }\n\n this.supported = true // Deprecated: parseBuffer will throw an error if font is not supported.\n this.glyphs = new glyphset.GlyphSet(this, options.glyphs || [])\n this.encoding = new DefaultEncoding(this)\n this.position = new Position(this)\n this.substitution = new Substitution(this)\n this.tables = this.tables || {}\n\n // needed for low memory mode only.\n this._push = null\n this._hmtxTableData = {}\n\n Object.defineProperty(this, 'hinting', {\n get: function () {\n if (this._hinting) {\n return this._hinting\n }\n if (this.outlinesFormat === 'truetype') {\n return (this._hinting = new Hinting(this))\n }\n },\n })\n }\n\n /**\n * Check if the font has a glyph for the given character.\n * @param {string}\n * @return {Boolean}\n */\n Font.prototype.hasChar = function (c) {\n return this.encoding.charToGlyphIndex(c) !== null\n }\n\n /**\n * Convert the given character to a single glyph index.\n * Note that this function assumes that there is a one-to-one mapping between\n * the given character and a glyph; for complex scripts this might not be the case.\n * @param {string}\n * @return {Number}\n */\n Font.prototype.charToGlyphIndex = function (s) {\n return this.encoding.charToGlyphIndex(s)\n }\n\n /**\n * Convert the given character to a single Glyph object.\n * Note that this function assumes that there is a one-to-one mapping between\n * the given character and a glyph; for complex scripts this might not be the case.\n * @param {string}\n * @return {opentype.Glyph}\n */\n Font.prototype.charToGlyph = function (c) {\n var glyphIndex = this.charToGlyphIndex(c)\n var glyph = this.glyphs.get(glyphIndex)\n if (!glyph) {\n // .notdef\n glyph = this.glyphs.get(0)\n }\n\n return glyph\n }\n\n /**\n * Update features\n * @param {any} options features options\n */\n Font.prototype.updateFeatures = function (options) {\n // TODO: update all features options not only 'latn'.\n return this.defaultRenderOptions.features.map(function (feature) {\n if (feature.script === 'latn') {\n return {\n script: 'latn',\n tags: feature.tags.filter(function (tag) {\n return options[tag]\n }),\n }\n } else {\n return feature\n }\n })\n }\n\n /**\n * Convert the given text to a list of Glyph objects.\n * Note that there is no strict one-to-one mapping between characters and\n * glyphs, so the list of returned glyphs can be larger or smaller than the\n * length of the given string.\n * @param {string}\n * @param {GlyphRenderOptions} [options]\n * @return {opentype.Glyph[]}\n */\n Font.prototype.stringToGlyphs = function (s, options) {\n var this$1 = this\n\n var bidi = new Bidi()\n\n // Create and register 'glyphIndex' state modifier\n var charToGlyphIndexMod = function (token) {\n return this$1.charToGlyphIndex(token.char)\n }\n bidi.registerModifier('glyphIndex', null, charToGlyphIndexMod)\n\n // roll-back to default features\n var features = options ? this.updateFeatures(options.features) : this.defaultRenderOptions.features\n\n bidi.applyFeatures(this, features)\n\n var indexes = bidi.getTextGlyphs(s)\n\n var length = indexes.length\n\n // convert glyph indexes to glyph objects\n var glyphs = new Array(length)\n var notdef = this.glyphs.get(0)\n for (var i = 0; i < length; i += 1) {\n glyphs[i] = this.glyphs.get(indexes[i]) || notdef\n }\n return glyphs\n }\n\n /**\n * @param {string}\n * @return {Number}\n */\n Font.prototype.nameToGlyphIndex = function (name) {\n return this.glyphNames.nameToGlyphIndex(name)\n }\n\n /**\n * @param {string}\n * @return {opentype.Glyph}\n */\n Font.prototype.nameToGlyph = function (name) {\n var glyphIndex = this.nameToGlyphIndex(name)\n var glyph = this.glyphs.get(glyphIndex)\n if (!glyph) {\n // .notdef\n glyph = this.glyphs.get(0)\n }\n\n return glyph\n }\n\n /**\n * @param {Number}\n * @return {String}\n */\n Font.prototype.glyphIndexToName = function (gid) {\n if (!this.glyphNames.glyphIndexToName) {\n return ''\n }\n\n return this.glyphNames.glyphIndexToName(gid)\n }\n\n /**\n * Retrieve the value of the kerning pair between the left glyph (or its index)\n * and the right glyph (or its index). If no kerning pair is found, return 0.\n * The kerning value gets added to the advance width when calculating the spacing\n * between glyphs.\n * For GPOS kerning, this method uses the default script and language, which covers\n * most use cases. To have greater control, use font.position.getKerningValue .\n * @param {opentype.Glyph} leftGlyph\n * @param {opentype.Glyph} rightGlyph\n * @return {Number}\n */\n Font.prototype.getKerningValue = function (leftGlyph, rightGlyph) {\n leftGlyph = leftGlyph.index || leftGlyph\n rightGlyph = rightGlyph.index || rightGlyph\n var gposKerning = this.position.defaultKerningTables\n if (gposKerning) {\n return this.position.getKerningValue(gposKerning, leftGlyph, rightGlyph)\n }\n // \"kern\" table\n return this.kerningPairs[leftGlyph + ',' + rightGlyph] || 0\n }\n\n /**\n * @typedef GlyphRenderOptions\n * @type Object\n * @property {string} [script] - script used to determine which features to apply. By default, 'DFLT' or 'latn' is used.\n * See https://www.microsoft.com/typography/otspec/scripttags.htm\n * @property {string} [language='dflt'] - language system used to determine which features to apply.\n * See https://www.microsoft.com/typography/developers/opentype/languagetags.aspx\n * @property {boolean} [kerning=true] - whether to include kerning values\n * @property {object} [features] - OpenType Layout feature tags. Used to enable or disable the features of the given script/language system.\n * See https://www.microsoft.com/typography/otspec/featuretags.htm\n */\n Font.prototype.defaultRenderOptions = {\n kerning: true,\n features: [\n /**\n * these 4 features are required to render Arabic text properly\n * and shouldn't be turned off when rendering arabic text.\n */\n { script: 'arab', tags: ['init', 'medi', 'fina', 'rlig'] },\n { script: 'latn', tags: ['liga', 'rlig'] },\n ],\n }\n\n /**\n * Helper function that invokes the given callback for each glyph in the given text.\n * The callback gets `(glyph, x, y, fontSize, options)`.* @param {string} text\n * @param {string} text - The text to apply.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @param {Function} callback\n */\n Font.prototype.forEachGlyph = function (text, x, y, fontSize, options, callback) {\n x = x !== undefined ? x : 0\n y = y !== undefined ? y : 0\n fontSize = fontSize !== undefined ? fontSize : 72\n options = Object.assign({}, this.defaultRenderOptions, options)\n var fontScale = (1 / this.unitsPerEm) * fontSize\n var glyphs = this.stringToGlyphs(text, options)\n var kerningLookups\n if (options.kerning) {\n var script = options.script || this.position.getDefaultScriptName()\n kerningLookups = this.position.getKerningTables(script, options.language)\n }\n for (var i = 0; i < glyphs.length; i += 1) {\n var glyph = glyphs[i]\n callback.call(this, glyph, x, y, fontSize, options)\n if (glyph.advanceWidth) {\n x += glyph.advanceWidth * fontScale\n }\n\n if (options.kerning && i < glyphs.length - 1) {\n // We should apply position adjustment lookups in a more generic way.\n // Here we only use the xAdvance value.\n var kerningValue = kerningLookups\n ? this.position.getKerningValue(kerningLookups, glyph.index, glyphs[i + 1].index)\n : this.getKerningValue(glyph, glyphs[i + 1])\n x += kerningValue * fontScale\n }\n\n if (options.letterSpacing) {\n x += options.letterSpacing * fontSize\n } else if (options.tracking) {\n x += (options.tracking / 1000) * fontSize\n }\n }\n return x\n }\n\n /**\n * Create a Path object that represents the given text.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @return {opentype.Path}\n */\n Font.prototype.getPath = function (text, x, y, fontSize, options) {\n var fullPath = new Path()\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n var glyphPath = glyph.getPath(gX, gY, gFontSize, options, this)\n fullPath.extend(glyphPath)\n })\n return fullPath\n }\n\n /**\n * Create an array of Path objects that represent the glyphs of a given text.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @return {opentype.Path[]}\n */\n Font.prototype.getPaths = function (text, x, y, fontSize, options) {\n var glyphPaths = []\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n var glyphPath = glyph.getPath(gX, gY, gFontSize, options, this)\n glyphPaths.push(glyphPath)\n })\n\n return glyphPaths\n }\n\n /**\n * Returns the advance width of a text.\n *\n * This is something different than Path.getBoundingBox() as for example a\n * suffixed whitespace increases the advanceWidth but not the bounding box\n * or an overhanging letter like a calligraphic 'f' might have a quite larger\n * bounding box than its advance width.\n *\n * This corresponds to canvas2dContext.measureText(text).width\n *\n * @param {string} text - The text to create.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n * @return advance width\n */\n Font.prototype.getAdvanceWidth = function (text, fontSize, options) {\n return this.forEachGlyph(text, 0, 0, fontSize, options, function () {})\n }\n\n /**\n * Draw the text on the given drawing context.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n */\n Font.prototype.draw = function (ctx, text, x, y, fontSize, options) {\n this.getPath(text, x, y, fontSize, options).draw(ctx)\n }\n\n /**\n * Draw the points of all glyphs in the text.\n * On-curve points will be drawn in blue, off-curve points will be drawn in red.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n */\n Font.prototype.drawPoints = function (ctx, text, x, y, fontSize, options) {\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n glyph.drawPoints(ctx, gX, gY, gFontSize)\n })\n }\n\n /**\n * Draw lines indicating important font measurements for all glyphs in the text.\n * Black lines indicate the origin of the coordinate system (point 0,0).\n * Blue lines indicate the glyph bounding box.\n * Green line indicates the advance width of the glyph.\n * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas.\n * @param {string} text - The text to create.\n * @param {number} [x=0] - Horizontal position of the beginning of the text.\n * @param {number} [y=0] - Vertical position of the *baseline* of the text.\n * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`.\n * @param {GlyphRenderOptions=} options\n */\n Font.prototype.drawMetrics = function (ctx, text, x, y, fontSize, options) {\n this.forEachGlyph(text, x, y, fontSize, options, function (glyph, gX, gY, gFontSize) {\n glyph.drawMetrics(ctx, gX, gY, gFontSize)\n })\n }\n\n /**\n * @param {string}\n * @return {string}\n */\n Font.prototype.getEnglishName = function (name) {\n var translations = this.names[name]\n if (translations) {\n return translations.en\n }\n }\n\n /**\n * Validate\n */\n Font.prototype.validate = function () {\n var _this = this\n\n function assert(predicate) {}\n\n function assertNamePresent(name) {\n var englishName = _this.getEnglishName(name)\n assert(englishName && englishName.trim().length > 0)\n }\n\n // Identification information\n assertNamePresent('fontFamily')\n assertNamePresent('weightName')\n assertNamePresent('manufacturer')\n assertNamePresent('copyright')\n assertNamePresent('version')\n\n // Dimension information\n assert(this.unitsPerEm > 0)\n }\n\n /**\n * Convert the font object to a SFNT data structure.\n * This structure contains all the necessary tables and metadata to create a binary OTF file.\n * @return {opentype.Table}\n */\n Font.prototype.toTables = function () {\n return sfnt.fontToTable(this)\n }\n /**\n * @deprecated Font.toBuffer is deprecated. Use Font.toArrayBuffer instead.\n */\n Font.prototype.toBuffer = function () {\n console.warn('Font.toBuffer is deprecated. Use Font.toArrayBuffer instead.')\n return this.toArrayBuffer()\n }\n /**\n * Converts a `opentype.Font` into an `ArrayBuffer`\n * @return {ArrayBuffer}\n */\n Font.prototype.toArrayBuffer = function () {\n var sfntTable = this.toTables()\n var bytes = sfntTable.encode()\n var buffer = new ArrayBuffer(bytes.length)\n var intArray = new Uint8Array(buffer)\n for (var i = 0; i < bytes.length; i++) {\n intArray[i] = bytes[i]\n }\n\n return buffer\n }\n\n /**\n * @private\n */\n Font.prototype.fsSelectionValues = {\n ITALIC: 0x001, //1\n UNDERSCORE: 0x002, //2\n NEGATIVE: 0x004, //4\n OUTLINED: 0x008, //8\n STRIKEOUT: 0x010, //16\n BOLD: 0x020, //32\n REGULAR: 0x040, //64\n USER_TYPO_METRICS: 0x080, //128\n WWS: 0x100, //256\n OBLIQUE: 0x200, //512\n }\n\n /**\n * @private\n */\n Font.prototype.usWidthClasses = {\n ULTRA_CONDENSED: 1,\n EXTRA_CONDENSED: 2,\n CONDENSED: 3,\n SEMI_CONDENSED: 4,\n MEDIUM: 5,\n SEMI_EXPANDED: 6,\n EXPANDED: 7,\n EXTRA_EXPANDED: 8,\n ULTRA_EXPANDED: 9,\n }\n\n /**\n * @private\n */\n Font.prototype.usWeightClasses = {\n THIN: 100,\n EXTRA_LIGHT: 200,\n LIGHT: 300,\n NORMAL: 400,\n MEDIUM: 500,\n SEMI_BOLD: 600,\n BOLD: 700,\n EXTRA_BOLD: 800,\n BLACK: 900,\n }\n\n // The `fvar` table stores font variation axes and instances.\n\n function addName(name, names) {\n var nameString = JSON.stringify(name)\n var nameID = 256\n for (var nameKey in names) {\n var n = parseInt(nameKey)\n if (!n || n < 256) {\n continue\n }\n\n if (JSON.stringify(names[nameKey]) === nameString) {\n return n\n }\n\n if (nameID <= n) {\n nameID = n + 1\n }\n }\n\n names[nameID] = name\n return nameID\n }\n\n function makeFvarAxis(n, axis, names) {\n var nameID = addName(axis.name, names)\n return [\n { name: 'tag_' + n, type: 'TAG', value: axis.tag },\n { name: 'minValue_' + n, type: 'FIXED', value: axis.minValue << 16 },\n { name: 'defaultValue_' + n, type: 'FIXED', value: axis.defaultValue << 16 },\n { name: 'maxValue_' + n, type: 'FIXED', value: axis.maxValue << 16 },\n { name: 'flags_' + n, type: 'USHORT', value: 0 },\n { name: 'nameID_' + n, type: 'USHORT', value: nameID },\n ]\n }\n\n function parseFvarAxis(data, start, names) {\n var axis = {}\n var p = new parse.Parser(data, start)\n axis.tag = p.parseTag()\n axis.minValue = p.parseFixed()\n axis.defaultValue = p.parseFixed()\n axis.maxValue = p.parseFixed()\n p.skip('uShort', 1) // reserved for flags; no values defined\n axis.name = names[p.parseUShort()] || {}\n return axis\n }\n\n function makeFvarInstance(n, inst, axes, names) {\n var nameID = addName(inst.name, names)\n var fields = [\n { name: 'nameID_' + n, type: 'USHORT', value: nameID },\n { name: 'flags_' + n, type: 'USHORT', value: 0 },\n ]\n\n for (var i = 0; i < axes.length; ++i) {\n var axisTag = axes[i].tag\n fields.push({\n name: 'axis_' + n + ' ' + axisTag,\n type: 'FIXED',\n value: inst.coordinates[axisTag] << 16,\n })\n }\n\n return fields\n }\n\n function parseFvarInstance(data, start, axes, names) {\n var inst = {}\n var p = new parse.Parser(data, start)\n inst.name = names[p.parseUShort()] || {}\n p.skip('uShort', 1) // reserved for flags; no values defined\n\n inst.coordinates = {}\n for (var i = 0; i < axes.length; ++i) {\n inst.coordinates[axes[i].tag] = p.parseFixed()\n }\n\n return inst\n }\n\n function makeFvarTable(fvar, names) {\n var result = new table.Table('fvar', [\n { name: 'version', type: 'ULONG', value: 0x10000 },\n { name: 'offsetToData', type: 'USHORT', value: 0 },\n { name: 'countSizePairs', type: 'USHORT', value: 2 },\n { name: 'axisCount', type: 'USHORT', value: fvar.axes.length },\n { name: 'axisSize', type: 'USHORT', value: 20 },\n { name: 'instanceCount', type: 'USHORT', value: fvar.instances.length },\n { name: 'instanceSize', type: 'USHORT', value: 4 + fvar.axes.length * 4 },\n ])\n result.offsetToData = result.sizeOf()\n\n for (var i = 0; i < fvar.axes.length; i++) {\n result.fields = result.fields.concat(makeFvarAxis(i, fvar.axes[i], names))\n }\n\n for (var j = 0; j < fvar.instances.length; j++) {\n result.fields = result.fields.concat(makeFvarInstance(j, fvar.instances[j], fvar.axes, names))\n }\n\n return result\n }\n\n function parseFvarTable(data, start, names) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseULong()\n check.argument(tableVersion === 0x00010000, 'Unsupported fvar table version.')\n var offsetToData = p.parseOffset16()\n // Skip countSizePairs.\n p.skip('uShort', 1)\n var axisCount = p.parseUShort()\n var axisSize = p.parseUShort()\n var instanceCount = p.parseUShort()\n var instanceSize = p.parseUShort()\n\n var axes = []\n for (var i = 0; i < axisCount; i++) {\n axes.push(parseFvarAxis(data, start + offsetToData + i * axisSize, names))\n }\n\n var instances = []\n var instanceStart = start + offsetToData + axisCount * axisSize\n for (var j = 0; j < instanceCount; j++) {\n instances.push(parseFvarInstance(data, instanceStart + j * instanceSize, axes, names))\n }\n\n return { axes: axes, instances: instances }\n }\n\n var fvar = { make: makeFvarTable, parse: parseFvarTable }\n\n // The `GDEF` table contains various glyph properties\n\n var attachList = function () {\n return {\n coverage: this.parsePointer(Parser.coverage),\n attachPoints: this.parseList(Parser.pointer(Parser.uShortList)),\n }\n }\n\n var caretValue = function () {\n var format = this.parseUShort()\n check.argument(format === 1 || format === 2 || format === 3, 'Unsupported CaretValue table version.')\n if (format === 1) {\n return { coordinate: this.parseShort() }\n } else if (format === 2) {\n return { pointindex: this.parseShort() }\n } else if (format === 3) {\n // Device / Variation Index tables unsupported\n return { coordinate: this.parseShort() }\n }\n }\n\n var ligGlyph = function () {\n return this.parseList(Parser.pointer(caretValue))\n }\n\n var ligCaretList = function () {\n return {\n coverage: this.parsePointer(Parser.coverage),\n ligGlyphs: this.parseList(Parser.pointer(ligGlyph)),\n }\n }\n\n var markGlyphSets = function () {\n this.parseUShort() // Version\n return this.parseList(Parser.pointer(Parser.coverage))\n }\n\n function parseGDEFTable(data, start) {\n start = start || 0\n var p = new Parser(data, start)\n var tableVersion = p.parseVersion(1)\n check.argument(\n tableVersion === 1 || tableVersion === 1.2 || tableVersion === 1.3,\n 'Unsupported GDEF table version.',\n )\n var gdef = {\n version: tableVersion,\n classDef: p.parsePointer(Parser.classDef),\n attachList: p.parsePointer(attachList),\n ligCaretList: p.parsePointer(ligCaretList),\n markAttachClassDef: p.parsePointer(Parser.classDef),\n }\n if (tableVersion >= 1.2) {\n gdef.markGlyphSets = p.parsePointer(markGlyphSets)\n }\n return gdef\n }\n var gdef = { parse: parseGDEFTable }\n\n // The `GPOS` table contains kerning pairs, among other things.\n\n var subtableParsers$1 = new Array(10) // subtableParsers[0] is unused\n\n // https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-1-single-adjustment-positioning-subtable\n // this = Parser instance\n subtableParsers$1[1] = function parseLookup1() {\n var start = this.offset + this.relativeOffset\n var posformat = this.parseUShort()\n if (posformat === 1) {\n return {\n posFormat: 1,\n coverage: this.parsePointer(Parser.coverage),\n value: this.parseValueRecord(),\n }\n } else if (posformat === 2) {\n return {\n posFormat: 2,\n coverage: this.parsePointer(Parser.coverage),\n values: this.parseValueRecordList(),\n }\n }\n check.assert(false, '0x' + start.toString(16) + ': GPOS lookup type 1 format must be 1 or 2.')\n }\n\n // https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-2-pair-adjustment-positioning-subtable\n subtableParsers$1[2] = function parseLookup2() {\n var start = this.offset + this.relativeOffset\n var posFormat = this.parseUShort()\n check.assert(\n posFormat === 1 || posFormat === 2,\n '0x' + start.toString(16) + ': GPOS lookup type 2 format must be 1 or 2.',\n )\n var coverage = this.parsePointer(Parser.coverage)\n var valueFormat1 = this.parseUShort()\n var valueFormat2 = this.parseUShort()\n if (posFormat === 1) {\n // Adjustments for Glyph Pairs\n return {\n posFormat: posFormat,\n coverage: coverage,\n valueFormat1: valueFormat1,\n valueFormat2: valueFormat2,\n pairSets: this.parseList(\n Parser.pointer(\n Parser.list(function () {\n return {\n // pairValueRecord\n secondGlyph: this.parseUShort(),\n value1: this.parseValueRecord(valueFormat1),\n value2: this.parseValueRecord(valueFormat2),\n }\n }),\n ),\n ),\n }\n } else if (posFormat === 2) {\n var classDef1 = this.parsePointer(Parser.classDef)\n var classDef2 = this.parsePointer(Parser.classDef)\n var class1Count = this.parseUShort()\n var class2Count = this.parseUShort()\n return {\n // Class Pair Adjustment\n posFormat: posFormat,\n coverage: coverage,\n valueFormat1: valueFormat1,\n valueFormat2: valueFormat2,\n classDef1: classDef1,\n classDef2: classDef2,\n class1Count: class1Count,\n class2Count: class2Count,\n classRecords: this.parseList(\n class1Count,\n Parser.list(class2Count, function () {\n return {\n value1: this.parseValueRecord(valueFormat1),\n value2: this.parseValueRecord(valueFormat2),\n }\n }),\n ),\n }\n }\n }\n\n subtableParsers$1[3] = function parseLookup3() {\n return { error: 'GPOS Lookup 3 not supported' }\n }\n subtableParsers$1[4] = function parseLookup4() {\n return { error: 'GPOS Lookup 4 not supported' }\n }\n subtableParsers$1[5] = function parseLookup5() {\n return { error: 'GPOS Lookup 5 not supported' }\n }\n subtableParsers$1[6] = function parseLookup6() {\n return { error: 'GPOS Lookup 6 not supported' }\n }\n subtableParsers$1[7] = function parseLookup7() {\n return { error: 'GPOS Lookup 7 not supported' }\n }\n subtableParsers$1[8] = function parseLookup8() {\n return { error: 'GPOS Lookup 8 not supported' }\n }\n subtableParsers$1[9] = function parseLookup9() {\n return { error: 'GPOS Lookup 9 not supported' }\n }\n\n // https://docs.microsoft.com/en-us/typography/opentype/spec/gpos\n function parseGposTable(data, start) {\n start = start || 0\n var p = new Parser(data, start)\n var tableVersion = p.parseVersion(1)\n check.argument(tableVersion === 1 || tableVersion === 1.1, 'Unsupported GPOS table version ' + tableVersion)\n\n if (tableVersion === 1) {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers$1),\n }\n } else {\n return {\n version: tableVersion,\n scripts: p.parseScriptList(),\n features: p.parseFeatureList(),\n lookups: p.parseLookupList(subtableParsers$1),\n variations: p.parseFeatureVariationsList(),\n }\n }\n }\n\n // GPOS Writing //////////////////////////////////////////////\n // NOT SUPPORTED\n var subtableMakers$1 = new Array(10)\n\n function makeGposTable(gpos) {\n return new table.Table('GPOS', [\n { name: 'version', type: 'ULONG', value: 0x10000 },\n { name: 'scripts', type: 'TABLE', value: new table.ScriptList(gpos.scripts) },\n { name: 'features', type: 'TABLE', value: new table.FeatureList(gpos.features) },\n { name: 'lookups', type: 'TABLE', value: new table.LookupList(gpos.lookups, subtableMakers$1) },\n ])\n }\n\n var gpos = { parse: parseGposTable, make: makeGposTable }\n\n // The `kern` table contains kerning pairs.\n\n function parseWindowsKernTable(p) {\n var pairs = {}\n // Skip nTables.\n p.skip('uShort')\n var subtableVersion = p.parseUShort()\n check.argument(subtableVersion === 0, 'Unsupported kern sub-table version.')\n // Skip subtableLength, subtableCoverage\n p.skip('uShort', 2)\n var nPairs = p.parseUShort()\n // Skip searchRange, entrySelector, rangeShift.\n p.skip('uShort', 3)\n for (var i = 0; i < nPairs; i += 1) {\n var leftIndex = p.parseUShort()\n var rightIndex = p.parseUShort()\n var value = p.parseShort()\n pairs[leftIndex + ',' + rightIndex] = value\n }\n return pairs\n }\n\n function parseMacKernTable(p) {\n var pairs = {}\n // The Mac kern table stores the version as a fixed (32 bits) but we only loaded the first 16 bits.\n // Skip the rest.\n p.skip('uShort')\n var nTables = p.parseULong()\n //check.argument(nTables === 1, 'Only 1 subtable is supported (got ' + nTables + ').');\n if (nTables > 1) {\n console.warn('Only the first kern subtable is supported.')\n }\n p.skip('uLong')\n var coverage = p.parseUShort()\n var subtableVersion = coverage & 0xff\n p.skip('uShort')\n if (subtableVersion === 0) {\n var nPairs = p.parseUShort()\n // Skip searchRange, entrySelector, rangeShift.\n p.skip('uShort', 3)\n for (var i = 0; i < nPairs; i += 1) {\n var leftIndex = p.parseUShort()\n var rightIndex = p.parseUShort()\n var value = p.parseShort()\n pairs[leftIndex + ',' + rightIndex] = value\n }\n }\n return pairs\n }\n\n // Parse the `kern` table which contains kerning pairs.\n function parseKernTable(data, start) {\n var p = new parse.Parser(data, start)\n var tableVersion = p.parseUShort()\n if (tableVersion === 0) {\n return parseWindowsKernTable(p)\n } else if (tableVersion === 1) {\n return parseMacKernTable(p)\n } else {\n throw new Error('Unsupported kern table version (' + tableVersion + ').')\n }\n }\n\n var kern = { parse: parseKernTable }\n\n // The `loca` table stores the offsets to the locations of the glyphs in the font.\n\n // Parse the `loca` table. This table stores the offsets to the locations of the glyphs in the font,\n // relative to the beginning of the glyphData table.\n // The number of glyphs stored in the `loca` table is specified in the `maxp` table (under numGlyphs)\n // The loca table has two versions: a short version where offsets are stored as uShorts, and a long\n // version where offsets are stored as uLongs. The `head` table specifies which version to use\n // (under indexToLocFormat).\n function parseLocaTable(data, start, numGlyphs, shortVersion) {\n var p = new parse.Parser(data, start)\n var parseFn = shortVersion ? p.parseUShort : p.parseULong\n // There is an extra entry after the last index element to compute the length of the last glyph.\n // That's why we use numGlyphs + 1.\n var glyphOffsets = []\n for (var i = 0; i < numGlyphs + 1; i += 1) {\n var glyphOffset = parseFn.call(p)\n if (shortVersion) {\n // The short table version stores the actual offset divided by 2.\n glyphOffset *= 2\n }\n\n glyphOffsets.push(glyphOffset)\n }\n\n return glyphOffsets\n }\n\n var loca = { parse: parseLocaTable }\n\n // opentype.js\n\n // Table Directory Entries //////////////////////////////////////////////\n /**\n * Parses OpenType table entries.\n * @param {DataView}\n * @param {Number}\n * @return {Object[]}\n */\n function parseOpenTypeTableEntries(data, numTables) {\n var tableEntries = []\n var p = 12\n for (var i = 0; i < numTables; i += 1) {\n var tag = parse.getTag(data, p)\n var checksum = parse.getULong(data, p + 4)\n var offset = parse.getULong(data, p + 8)\n var length = parse.getULong(data, p + 12)\n tableEntries.push({ tag: tag, checksum: checksum, offset: offset, length: length, compression: false })\n p += 16\n }\n\n return tableEntries\n }\n\n /**\n * Parses WOFF table entries.\n * @param {DataView}\n * @param {Number}\n * @return {Object[]}\n */\n function parseWOFFTableEntries(data, numTables) {\n var tableEntries = []\n var p = 44 // offset to the first table directory entry.\n for (var i = 0; i < numTables; i += 1) {\n var tag = parse.getTag(data, p)\n var offset = parse.getULong(data, p + 4)\n var compLength = parse.getULong(data, p + 8)\n var origLength = parse.getULong(data, p + 12)\n var compression = void 0\n if (compLength < origLength) {\n compression = 'WOFF'\n } else {\n compression = false\n }\n\n tableEntries.push({\n tag: tag,\n offset: offset,\n compression: compression,\n compressedLength: compLength,\n length: origLength,\n })\n p += 20\n }\n\n return tableEntries\n }\n\n /**\n * @typedef TableData\n * @type Object\n * @property {DataView} data - The DataView\n * @property {number} offset - The data offset.\n */\n\n /**\n * @param {DataView}\n * @param {Object}\n * @return {TableData}\n */\n function uncompressTable(data, tableEntry) {\n if (tableEntry.compression === 'WOFF') {\n var inBuffer = new Uint8Array(data.buffer, tableEntry.offset + 2, tableEntry.compressedLength - 2)\n var outBuffer = new Uint8Array(tableEntry.length)\n tinyInflate(inBuffer, outBuffer)\n if (outBuffer.byteLength !== tableEntry.length) {\n throw new Error('Decompression error: ' + tableEntry.tag + \" decompressed length doesn't match recorded length\")\n }\n\n var view = new DataView(outBuffer.buffer, 0)\n return { data: view, offset: 0 }\n } else {\n return { data: data, offset: tableEntry.offset }\n }\n }\n\n // Public API ///////////////////////////////////////////////////////////\n\n /**\n * Parse the OpenType file data (as an ArrayBuffer) and return a Font object.\n * Throws an error if the font could not be parsed.\n * @param {ArrayBuffer}\n * @param {Object} opt - options for parsing\n * @return {opentype.Font}\n */\n function parseBuffer(buffer, opt) {\n opt = opt === undefined || opt === null ? {} : opt\n\n var indexToLocFormat\n var ltagTable\n\n // Since the constructor can also be called to create new fonts from scratch, we indicate this\n // should be an empty font that we'll fill with our own data.\n var font = new Font({ empty: true })\n\n // OpenType fonts use big endian byte ordering.\n // We can't rely on typed array view types, because they operate with the endianness of the host computer.\n // Instead we use DataViews where we can specify endianness.\n var data = new DataView(buffer, 0)\n var numTables\n var tableEntries = []\n var signature = parse.getTag(data, 0)\n if (signature === String.fromCharCode(0, 1, 0, 0) || signature === 'true' || signature === 'typ1') {\n font.outlinesFormat = 'truetype'\n numTables = parse.getUShort(data, 4)\n tableEntries = parseOpenTypeTableEntries(data, numTables)\n } else if (signature === 'OTTO') {\n font.outlinesFormat = 'cff'\n numTables = parse.getUShort(data, 4)\n tableEntries = parseOpenTypeTableEntries(data, numTables)\n } else if (signature === 'wOFF') {\n var flavor = parse.getTag(data, 4)\n if (flavor === String.fromCharCode(0, 1, 0, 0)) {\n font.outlinesFormat = 'truetype'\n } else if (flavor === 'OTTO') {\n font.outlinesFormat = 'cff'\n } else {\n throw new Error('Unsupported OpenType flavor ' + signature)\n }\n\n numTables = parse.getUShort(data, 12)\n tableEntries = parseWOFFTableEntries(data, numTables)\n } else {\n throw new Error('Unsupported OpenType signature ' + signature)\n }\n\n var cffTableEntry\n var fvarTableEntry\n var glyfTableEntry\n var gdefTableEntry\n var gposTableEntry\n var gsubTableEntry\n var hmtxTableEntry\n var kernTableEntry\n var locaTableEntry\n var nameTableEntry\n var metaTableEntry\n var p\n\n for (var i = 0; i < numTables; i += 1) {\n var tableEntry = tableEntries[i]\n var table = void 0\n switch (tableEntry.tag) {\n case 'cmap':\n table = uncompressTable(data, tableEntry)\n font.tables.cmap = cmap.parse(table.data, table.offset)\n font.encoding = new CmapEncoding(font.tables.cmap)\n break\n case 'cvt ':\n table = uncompressTable(data, tableEntry)\n p = new parse.Parser(table.data, table.offset)\n font.tables.cvt = p.parseShortList(tableEntry.length / 2)\n break\n case 'fvar':\n fvarTableEntry = tableEntry\n break\n case 'fpgm':\n table = uncompressTable(data, tableEntry)\n p = new parse.Parser(table.data, table.offset)\n font.tables.fpgm = p.parseByteList(tableEntry.length)\n break\n case 'head':\n table = uncompressTable(data, tableEntry)\n font.tables.head = head.parse(table.data, table.offset)\n font.unitsPerEm = font.tables.head.unitsPerEm\n indexToLocFormat = font.tables.head.indexToLocFormat\n break\n case 'hhea':\n table = uncompressTable(data, tableEntry)\n font.tables.hhea = hhea.parse(table.data, table.offset)\n font.ascender = font.tables.hhea.ascender\n font.descender = font.tables.hhea.descender\n font.numberOfHMetrics = font.tables.hhea.numberOfHMetrics\n break\n case 'hmtx':\n hmtxTableEntry = tableEntry\n break\n case 'ltag':\n table = uncompressTable(data, tableEntry)\n ltagTable = ltag.parse(table.data, table.offset)\n break\n case 'maxp':\n table = uncompressTable(data, tableEntry)\n font.tables.maxp = maxp.parse(table.data, table.offset)\n font.numGlyphs = font.tables.maxp.numGlyphs\n break\n case 'name':\n nameTableEntry = tableEntry\n break\n case 'OS/2':\n table = uncompressTable(data, tableEntry)\n font.tables.os2 = os2.parse(table.data, table.offset)\n break\n case 'post':\n table = uncompressTable(data, tableEntry)\n font.tables.post = post.parse(table.data, table.offset)\n font.glyphNames = new GlyphNames(font.tables.post)\n break\n case 'prep':\n table = uncompressTable(data, tableEntry)\n p = new parse.Parser(table.data, table.offset)\n font.tables.prep = p.parseByteList(tableEntry.length)\n break\n case 'glyf':\n glyfTableEntry = tableEntry\n break\n case 'loca':\n locaTableEntry = tableEntry\n break\n case 'CFF ':\n cffTableEntry = tableEntry\n break\n case 'kern':\n kernTableEntry = tableEntry\n break\n case 'GDEF':\n gdefTableEntry = tableEntry\n break\n case 'GPOS':\n gposTableEntry = tableEntry\n break\n case 'GSUB':\n gsubTableEntry = tableEntry\n break\n case 'meta':\n metaTableEntry = tableEntry\n break\n }\n }\n\n var nameTable = uncompressTable(data, nameTableEntry)\n font.tables.name = _name.parse(nameTable.data, nameTable.offset, ltagTable)\n font.names = font.tables.name\n\n if (glyfTableEntry && locaTableEntry) {\n var shortVersion = indexToLocFormat === 0\n var locaTable = uncompressTable(data, locaTableEntry)\n var locaOffsets = loca.parse(locaTable.data, locaTable.offset, font.numGlyphs, shortVersion)\n var glyfTable = uncompressTable(data, glyfTableEntry)\n font.glyphs = glyf.parse(glyfTable.data, glyfTable.offset, locaOffsets, font, opt)\n } else if (cffTableEntry) {\n var cffTable = uncompressTable(data, cffTableEntry)\n cff.parse(cffTable.data, cffTable.offset, font, opt)\n } else {\n throw new Error(\"Font doesn't contain TrueType or CFF outlines.\")\n }\n\n var hmtxTable = uncompressTable(data, hmtxTableEntry)\n hmtx.parse(font, hmtxTable.data, hmtxTable.offset, font.numberOfHMetrics, font.numGlyphs, font.glyphs, opt)\n addGlyphNames(font, opt)\n\n if (kernTableEntry) {\n var kernTable = uncompressTable(data, kernTableEntry)\n font.kerningPairs = kern.parse(kernTable.data, kernTable.offset)\n } else {\n font.kerningPairs = {}\n }\n\n if (gdefTableEntry) {\n var gdefTable = uncompressTable(data, gdefTableEntry)\n font.tables.gdef = gdef.parse(gdefTable.data, gdefTable.offset)\n }\n\n if (gposTableEntry) {\n var gposTable = uncompressTable(data, gposTableEntry)\n font.tables.gpos = gpos.parse(gposTable.data, gposTable.offset)\n font.position.init()\n }\n\n if (gsubTableEntry) {\n var gsubTable = uncompressTable(data, gsubTableEntry)\n font.tables.gsub = gsub.parse(gsubTable.data, gsubTable.offset)\n }\n\n if (fvarTableEntry) {\n var fvarTable = uncompressTable(data, fvarTableEntry)\n font.tables.fvar = fvar.parse(fvarTable.data, fvarTable.offset, font.names)\n }\n\n if (metaTableEntry) {\n var metaTable = uncompressTable(data, metaTableEntry)\n font.tables.meta = meta.parse(metaTable.data, metaTable.offset)\n font.metas = font.tables.meta\n }\n\n return font\n }\n\n return { parseBuffer }\n})()\n\nexport { parseBuffer as parse }\n", "import {\n Texture,\n DataTextureLoader,\n DataUtils,\n FloatType,\n HalfFloatType,\n LinearFilter,\n RedFormat,\n RGBAFormat,\n} from 'three'\nimport { unzlibSync } from 'fflate'\n\n/**\n * OpenEXR loader currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression.\n * Supports reading as UnsignedByte, HalfFloat and Float type data texture.\n *\n * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita\n * implementation, so I have preserved their copyright notices.\n */\n\n// /*\n// Copyright (c) 2014 - 2017, Syoyo Fujita\n// All rights reserved.\n\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n// * Neither the name of the Syoyo Fujita nor the\n// names of its contributors may be used to endorse or promote products\n// derived from this software without specific prior written permission.\n\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n// DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n// */\n\n// // TinyEXR contains some OpenEXR code, which is licensed under ------------\n\n// ///////////////////////////////////////////////////////////////////////////\n// //\n// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas\n// // Digital Ltd. LLC\n// //\n// // All rights reserved.\n// //\n// // Redistribution and use in source and binary forms, with or without\n// // modification, are permitted provided that the following conditions are\n// // met:\n// // * Redistributions of source code must retain the above copyright\n// // notice, this list of conditions and the following disclaimer.\n// // * Redistributions in binary form must reproduce the above\n// // copyright notice, this list of conditions and the following disclaimer\n// // in the documentation and/or other materials provided with the\n// // distribution.\n// // * Neither the name of Industrial Light & Magic nor the names of\n// // its contributors may be used to endorse or promote products derived\n// // from this software without specific prior written permission.\n// //\n// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n// //\n// ///////////////////////////////////////////////////////////////////////////\n\n// // End of OpenEXR license -------------------------------------------------\n\nconst hasColorSpace = 'colorSpace' in new Texture()\n\nclass EXRLoader extends DataTextureLoader {\n constructor(manager) {\n super(manager)\n\n this.type = HalfFloatType\n }\n\n parse(buffer) {\n const USHORT_RANGE = 1 << 16\n const BITMAP_SIZE = USHORT_RANGE >> 3\n\n const HUF_ENCBITS = 16 // literal (value) bit length\n const HUF_DECBITS = 14 // decoding bit size (>= 8)\n\n const HUF_ENCSIZE = (1 << HUF_ENCBITS) + 1 // encoding table size\n const HUF_DECSIZE = 1 << HUF_DECBITS // decoding table size\n const HUF_DECMASK = HUF_DECSIZE - 1\n\n const NBITS = 16\n const A_OFFSET = 1 << (NBITS - 1)\n const MOD_MASK = (1 << NBITS) - 1\n\n const SHORT_ZEROCODE_RUN = 59\n const LONG_ZEROCODE_RUN = 63\n const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN\n\n const ULONG_SIZE = 8\n const FLOAT32_SIZE = 4\n const INT32_SIZE = 4\n const INT16_SIZE = 2\n const INT8_SIZE = 1\n\n const STATIC_HUFFMAN = 0\n const DEFLATE = 1\n\n const UNKNOWN = 0\n const LOSSY_DCT = 1\n const RLE = 2\n\n const logBase = Math.pow(2.7182818, 2.2)\n\n function reverseLutFromBitmap(bitmap, lut) {\n var k = 0\n\n for (var i = 0; i < USHORT_RANGE; ++i) {\n if (i == 0 || bitmap[i >> 3] & (1 << (i & 7))) {\n lut[k++] = i\n }\n }\n\n var n = k - 1\n\n while (k < USHORT_RANGE) lut[k++] = 0\n\n return n\n }\n\n function hufClearDecTable(hdec) {\n for (var i = 0; i < HUF_DECSIZE; i++) {\n hdec[i] = {}\n hdec[i].len = 0\n hdec[i].lit = 0\n hdec[i].p = null\n }\n }\n\n const getBitsReturn = { l: 0, c: 0, lc: 0 }\n\n function getBits(nBits, c, lc, uInt8Array, inOffset) {\n while (lc < nBits) {\n c = (c << 8) | parseUint8Array(uInt8Array, inOffset)\n lc += 8\n }\n\n lc -= nBits\n\n getBitsReturn.l = (c >> lc) & ((1 << nBits) - 1)\n getBitsReturn.c = c\n getBitsReturn.lc = lc\n }\n\n const hufTableBuffer = new Array(59)\n\n function hufCanonicalCodeTable(hcode) {\n for (var i = 0; i <= 58; ++i) hufTableBuffer[i] = 0\n for (var i = 0; i < HUF_ENCSIZE; ++i) hufTableBuffer[hcode[i]] += 1\n\n var c = 0\n\n for (var i = 58; i > 0; --i) {\n var nc = (c + hufTableBuffer[i]) >> 1\n hufTableBuffer[i] = c\n c = nc\n }\n\n for (var i = 0; i < HUF_ENCSIZE; ++i) {\n var l = hcode[i]\n if (l > 0) hcode[i] = l | (hufTableBuffer[l]++ << 6)\n }\n }\n\n function hufUnpackEncTable(uInt8Array, inDataView, inOffset, ni, im, iM, hcode) {\n var p = inOffset\n var c = 0\n var lc = 0\n\n for (; im <= iM; im++) {\n if (p.value - inOffset.value > ni) return false\n\n getBits(6, c, lc, uInt8Array, p)\n\n var l = getBitsReturn.l\n c = getBitsReturn.c\n lc = getBitsReturn.lc\n\n hcode[im] = l\n\n if (l == LONG_ZEROCODE_RUN) {\n if (p.value - inOffset.value > ni) {\n throw 'Something wrong with hufUnpackEncTable'\n }\n\n getBits(8, c, lc, uInt8Array, p)\n\n var zerun = getBitsReturn.l + SHORTEST_LONG_RUN\n c = getBitsReturn.c\n lc = getBitsReturn.lc\n\n if (im + zerun > iM + 1) {\n throw 'Something wrong with hufUnpackEncTable'\n }\n\n while (zerun--) hcode[im++] = 0\n\n im--\n } else if (l >= SHORT_ZEROCODE_RUN) {\n var zerun = l - SHORT_ZEROCODE_RUN + 2\n\n if (im + zerun > iM + 1) {\n throw 'Something wrong with hufUnpackEncTable'\n }\n\n while (zerun--) hcode[im++] = 0\n\n im--\n }\n }\n\n hufCanonicalCodeTable(hcode)\n }\n\n function hufLength(code) {\n return code & 63\n }\n\n function hufCode(code) {\n return code >> 6\n }\n\n function hufBuildDecTable(hcode, im, iM, hdecod) {\n for (; im <= iM; im++) {\n var c = hufCode(hcode[im])\n var l = hufLength(hcode[im])\n\n if (c >> l) {\n throw 'Invalid table entry'\n }\n\n if (l > HUF_DECBITS) {\n var pl = hdecod[c >> (l - HUF_DECBITS)]\n\n if (pl.len) {\n throw 'Invalid table entry'\n }\n\n pl.lit++\n\n if (pl.p) {\n var p = pl.p\n pl.p = new Array(pl.lit)\n\n for (var i = 0; i < pl.lit - 1; ++i) {\n pl.p[i] = p[i]\n }\n } else {\n pl.p = new Array(1)\n }\n\n pl.p[pl.lit - 1] = im\n } else if (l) {\n var plOffset = 0\n\n for (var i = 1 << (HUF_DECBITS - l); i > 0; i--) {\n var pl = hdecod[(c << (HUF_DECBITS - l)) + plOffset]\n\n if (pl.len || pl.p) {\n throw 'Invalid table entry'\n }\n\n pl.len = l\n pl.lit = im\n\n plOffset++\n }\n }\n }\n\n return true\n }\n\n const getCharReturn = { c: 0, lc: 0 }\n\n function getChar(c, lc, uInt8Array, inOffset) {\n c = (c << 8) | parseUint8Array(uInt8Array, inOffset)\n lc += 8\n\n getCharReturn.c = c\n getCharReturn.lc = lc\n }\n\n const getCodeReturn = { c: 0, lc: 0 }\n\n function getCode(po, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outBufferOffset, outBufferEndOffset) {\n if (po == rlc) {\n if (lc < 8) {\n getChar(c, lc, uInt8Array, inOffset)\n c = getCharReturn.c\n lc = getCharReturn.lc\n }\n\n lc -= 8\n\n var cs = c >> lc\n var cs = new Uint8Array([cs])[0]\n\n if (outBufferOffset.value + cs > outBufferEndOffset) {\n return false\n }\n\n var s = outBuffer[outBufferOffset.value - 1]\n\n while (cs-- > 0) {\n outBuffer[outBufferOffset.value++] = s\n }\n } else if (outBufferOffset.value < outBufferEndOffset) {\n outBuffer[outBufferOffset.value++] = po\n } else {\n return false\n }\n\n getCodeReturn.c = c\n getCodeReturn.lc = lc\n }\n\n function UInt16(value) {\n return value & 0xffff\n }\n\n function Int16(value) {\n var ref = UInt16(value)\n return ref > 0x7fff ? ref - 0x10000 : ref\n }\n\n const wdec14Return = { a: 0, b: 0 }\n\n function wdec14(l, h) {\n var ls = Int16(l)\n var hs = Int16(h)\n\n var hi = hs\n var ai = ls + (hi & 1) + (hi >> 1)\n\n var as = ai\n var bs = ai - hi\n\n wdec14Return.a = as\n wdec14Return.b = bs\n }\n\n function wdec16(l, h) {\n var m = UInt16(l)\n var d = UInt16(h)\n\n var bb = (m - (d >> 1)) & MOD_MASK\n var aa = (d + bb - A_OFFSET) & MOD_MASK\n\n wdec14Return.a = aa\n wdec14Return.b = bb\n }\n\n function wav2Decode(buffer, j, nx, ox, ny, oy, mx) {\n var w14 = mx < 1 << 14\n var n = nx > ny ? ny : nx\n var p = 1\n var p2\n\n while (p <= n) p <<= 1\n\n p >>= 1\n p2 = p\n p >>= 1\n\n while (p >= 1) {\n var py = 0\n var ey = py + oy * (ny - p2)\n var oy1 = oy * p\n var oy2 = oy * p2\n var ox1 = ox * p\n var ox2 = ox * p2\n var i00, i01, i10, i11\n\n for (; py <= ey; py += oy2) {\n var px = py\n var ex = py + ox * (nx - p2)\n\n for (; px <= ex; px += ox2) {\n var p01 = px + ox1\n var p10 = px + oy1\n var p11 = p10 + ox1\n\n if (w14) {\n wdec14(buffer[px + j], buffer[p10 + j])\n\n i00 = wdec14Return.a\n i10 = wdec14Return.b\n\n wdec14(buffer[p01 + j], buffer[p11 + j])\n\n i01 = wdec14Return.a\n i11 = wdec14Return.b\n\n wdec14(i00, i01)\n\n buffer[px + j] = wdec14Return.a\n buffer[p01 + j] = wdec14Return.b\n\n wdec14(i10, i11)\n\n buffer[p10 + j] = wdec14Return.a\n buffer[p11 + j] = wdec14Return.b\n } else {\n wdec16(buffer[px + j], buffer[p10 + j])\n\n i00 = wdec14Return.a\n i10 = wdec14Return.b\n\n wdec16(buffer[p01 + j], buffer[p11 + j])\n\n i01 = wdec14Return.a\n i11 = wdec14Return.b\n\n wdec16(i00, i01)\n\n buffer[px + j] = wdec14Return.a\n buffer[p01 + j] = wdec14Return.b\n\n wdec16(i10, i11)\n\n buffer[p10 + j] = wdec14Return.a\n buffer[p11 + j] = wdec14Return.b\n }\n }\n\n if (nx & p) {\n var p10 = px + oy1\n\n if (w14) wdec14(buffer[px + j], buffer[p10 + j])\n else wdec16(buffer[px + j], buffer[p10 + j])\n\n i00 = wdec14Return.a\n buffer[p10 + j] = wdec14Return.b\n\n buffer[px + j] = i00\n }\n }\n\n if (ny & p) {\n var px = py\n var ex = py + ox * (nx - p2)\n\n for (; px <= ex; px += ox2) {\n var p01 = px + ox1\n\n if (w14) wdec14(buffer[px + j], buffer[p01 + j])\n else wdec16(buffer[px + j], buffer[p01 + j])\n\n i00 = wdec14Return.a\n buffer[p01 + j] = wdec14Return.b\n\n buffer[px + j] = i00\n }\n }\n\n p2 = p\n p >>= 1\n }\n\n return py\n }\n\n function hufDecode(\n encodingTable,\n decodingTable,\n uInt8Array,\n inDataView,\n inOffset,\n ni,\n rlc,\n no,\n outBuffer,\n outOffset,\n ) {\n var c = 0\n var lc = 0\n var outBufferEndOffset = no\n var inOffsetEnd = Math.trunc(inOffset.value + (ni + 7) / 8)\n\n while (inOffset.value < inOffsetEnd) {\n getChar(c, lc, uInt8Array, inOffset)\n\n c = getCharReturn.c\n lc = getCharReturn.lc\n\n while (lc >= HUF_DECBITS) {\n var index = (c >> (lc - HUF_DECBITS)) & HUF_DECMASK\n var pl = decodingTable[index]\n\n if (pl.len) {\n lc -= pl.len\n\n getCode(pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset)\n\n c = getCodeReturn.c\n lc = getCodeReturn.lc\n } else {\n if (!pl.p) {\n throw 'hufDecode issues'\n }\n\n var j\n\n for (j = 0; j < pl.lit; j++) {\n var l = hufLength(encodingTable[pl.p[j]])\n\n while (lc < l && inOffset.value < inOffsetEnd) {\n getChar(c, lc, uInt8Array, inOffset)\n\n c = getCharReturn.c\n lc = getCharReturn.lc\n }\n\n if (lc >= l) {\n if (hufCode(encodingTable[pl.p[j]]) == ((c >> (lc - l)) & ((1 << l) - 1))) {\n lc -= l\n\n getCode(\n pl.p[j],\n rlc,\n c,\n lc,\n uInt8Array,\n inDataView,\n inOffset,\n outBuffer,\n outOffset,\n outBufferEndOffset,\n )\n\n c = getCodeReturn.c\n lc = getCodeReturn.lc\n\n break\n }\n }\n }\n\n if (j == pl.lit) {\n throw 'hufDecode issues'\n }\n }\n }\n }\n\n var i = (8 - ni) & 7\n\n c >>= i\n lc -= i\n\n while (lc > 0) {\n var pl = decodingTable[(c << (HUF_DECBITS - lc)) & HUF_DECMASK]\n\n if (pl.len) {\n lc -= pl.len\n\n getCode(pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset)\n\n c = getCodeReturn.c\n lc = getCodeReturn.lc\n } else {\n throw 'hufDecode issues'\n }\n }\n\n return true\n }\n\n function hufUncompress(uInt8Array, inDataView, inOffset, nCompressed, outBuffer, nRaw) {\n var outOffset = { value: 0 }\n var initialInOffset = inOffset.value\n\n var im = parseUint32(inDataView, inOffset)\n var iM = parseUint32(inDataView, inOffset)\n\n inOffset.value += 4\n\n var nBits = parseUint32(inDataView, inOffset)\n\n inOffset.value += 4\n\n if (im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE) {\n throw 'Something wrong with HUF_ENCSIZE'\n }\n\n var freq = new Array(HUF_ENCSIZE)\n var hdec = new Array(HUF_DECSIZE)\n\n hufClearDecTable(hdec)\n\n var ni = nCompressed - (inOffset.value - initialInOffset)\n\n hufUnpackEncTable(uInt8Array, inDataView, inOffset, ni, im, iM, freq)\n\n if (nBits > 8 * (nCompressed - (inOffset.value - initialInOffset))) {\n throw 'Something wrong with hufUncompress'\n }\n\n hufBuildDecTable(freq, im, iM, hdec)\n\n hufDecode(freq, hdec, uInt8Array, inDataView, inOffset, nBits, iM, nRaw, outBuffer, outOffset)\n }\n\n function applyLut(lut, data, nData) {\n for (var i = 0; i < nData; ++i) {\n data[i] = lut[data[i]]\n }\n }\n\n function predictor(source) {\n for (var t = 1; t < source.length; t++) {\n var d = source[t - 1] + source[t] - 128\n source[t] = d\n }\n }\n\n function interleaveScalar(source, out) {\n var t1 = 0\n var t2 = Math.floor((source.length + 1) / 2)\n var s = 0\n var stop = source.length - 1\n\n while (true) {\n if (s > stop) break\n out[s++] = source[t1++]\n\n if (s > stop) break\n out[s++] = source[t2++]\n }\n }\n\n function decodeRunLength(source) {\n var size = source.byteLength\n var out = new Array()\n var p = 0\n\n var reader = new DataView(source)\n\n while (size > 0) {\n var l = reader.getInt8(p++)\n\n if (l < 0) {\n var count = -l\n size -= count + 1\n\n for (var i = 0; i < count; i++) {\n out.push(reader.getUint8(p++))\n }\n } else {\n var count = l\n size -= 2\n\n var value = reader.getUint8(p++)\n\n for (var i = 0; i < count + 1; i++) {\n out.push(value)\n }\n }\n }\n\n return out\n }\n\n function lossyDctDecode(cscSet, rowPtrs, channelData, acBuffer, dcBuffer, outBuffer) {\n var dataView = new DataView(outBuffer.buffer)\n\n var width = channelData[cscSet.idx[0]].width\n var height = channelData[cscSet.idx[0]].height\n\n var numComp = 3\n\n var numFullBlocksX = Math.floor(width / 8.0)\n var numBlocksX = Math.ceil(width / 8.0)\n var numBlocksY = Math.ceil(height / 8.0)\n var leftoverX = width - (numBlocksX - 1) * 8\n var leftoverY = height - (numBlocksY - 1) * 8\n\n var currAcComp = { value: 0 }\n var currDcComp = new Array(numComp)\n var dctData = new Array(numComp)\n var halfZigBlock = new Array(numComp)\n var rowBlock = new Array(numComp)\n var rowOffsets = new Array(numComp)\n\n for (let comp = 0; comp < numComp; ++comp) {\n rowOffsets[comp] = rowPtrs[cscSet.idx[comp]]\n currDcComp[comp] = comp < 1 ? 0 : currDcComp[comp - 1] + numBlocksX * numBlocksY\n dctData[comp] = new Float32Array(64)\n halfZigBlock[comp] = new Uint16Array(64)\n rowBlock[comp] = new Uint16Array(numBlocksX * 64)\n }\n\n for (let blocky = 0; blocky < numBlocksY; ++blocky) {\n var maxY = 8\n\n if (blocky == numBlocksY - 1) maxY = leftoverY\n\n var maxX = 8\n\n for (let blockx = 0; blockx < numBlocksX; ++blockx) {\n if (blockx == numBlocksX - 1) maxX = leftoverX\n\n for (let comp = 0; comp < numComp; ++comp) {\n halfZigBlock[comp].fill(0)\n\n // set block DC component\n halfZigBlock[comp][0] = dcBuffer[currDcComp[comp]++]\n // set block AC components\n unRleAC(currAcComp, acBuffer, halfZigBlock[comp])\n\n // UnZigZag block to float\n unZigZag(halfZigBlock[comp], dctData[comp])\n // decode float dct\n dctInverse(dctData[comp])\n }\n\n if (numComp == 3) {\n csc709Inverse(dctData)\n }\n\n for (let comp = 0; comp < numComp; ++comp) {\n convertToHalf(dctData[comp], rowBlock[comp], blockx * 64)\n }\n } // blockx\n\n let offset = 0\n\n for (let comp = 0; comp < numComp; ++comp) {\n const type = channelData[cscSet.idx[comp]].type\n\n for (let y = 8 * blocky; y < 8 * blocky + maxY; ++y) {\n offset = rowOffsets[comp][y]\n\n for (let blockx = 0; blockx < numFullBlocksX; ++blockx) {\n const src = blockx * 64 + (y & 0x7) * 8\n\n dataView.setUint16(offset + 0 * INT16_SIZE * type, rowBlock[comp][src + 0], true)\n dataView.setUint16(offset + 1 * INT16_SIZE * type, rowBlock[comp][src + 1], true)\n dataView.setUint16(offset + 2 * INT16_SIZE * type, rowBlock[comp][src + 2], true)\n dataView.setUint16(offset + 3 * INT16_SIZE * type, rowBlock[comp][src + 3], true)\n\n dataView.setUint16(offset + 4 * INT16_SIZE * type, rowBlock[comp][src + 4], true)\n dataView.setUint16(offset + 5 * INT16_SIZE * type, rowBlock[comp][src + 5], true)\n dataView.setUint16(offset + 6 * INT16_SIZE * type, rowBlock[comp][src + 6], true)\n dataView.setUint16(offset + 7 * INT16_SIZE * type, rowBlock[comp][src + 7], true)\n\n offset += 8 * INT16_SIZE * type\n }\n }\n\n // handle partial X blocks\n if (numFullBlocksX != numBlocksX) {\n for (let y = 8 * blocky; y < 8 * blocky + maxY; ++y) {\n const offset = rowOffsets[comp][y] + 8 * numFullBlocksX * INT16_SIZE * type\n const src = numFullBlocksX * 64 + (y & 0x7) * 8\n\n for (let x = 0; x < maxX; ++x) {\n dataView.setUint16(offset + x * INT16_SIZE * type, rowBlock[comp][src + x], true)\n }\n }\n }\n } // comp\n } // blocky\n\n var halfRow = new Uint16Array(width)\n var dataView = new DataView(outBuffer.buffer)\n\n // convert channels back to float, if needed\n for (var comp = 0; comp < numComp; ++comp) {\n channelData[cscSet.idx[comp]].decoded = true\n var type = channelData[cscSet.idx[comp]].type\n\n if (channelData[comp].type != 2) continue\n\n for (var y = 0; y < height; ++y) {\n const offset = rowOffsets[comp][y]\n\n for (var x = 0; x < width; ++x) {\n halfRow[x] = dataView.getUint16(offset + x * INT16_SIZE * type, true)\n }\n\n for (var x = 0; x < width; ++x) {\n dataView.setFloat32(offset + x * INT16_SIZE * type, decodeFloat16(halfRow[x]), true)\n }\n }\n }\n }\n\n function unRleAC(currAcComp, acBuffer, halfZigBlock) {\n var acValue\n var dctComp = 1\n\n while (dctComp < 64) {\n acValue = acBuffer[currAcComp.value]\n\n if (acValue == 0xff00) {\n dctComp = 64\n } else if (acValue >> 8 == 0xff) {\n dctComp += acValue & 0xff\n } else {\n halfZigBlock[dctComp] = acValue\n dctComp++\n }\n\n currAcComp.value++\n }\n }\n\n function unZigZag(src, dst) {\n dst[0] = decodeFloat16(src[0])\n dst[1] = decodeFloat16(src[1])\n dst[2] = decodeFloat16(src[5])\n dst[3] = decodeFloat16(src[6])\n dst[4] = decodeFloat16(src[14])\n dst[5] = decodeFloat16(src[15])\n dst[6] = decodeFloat16(src[27])\n dst[7] = decodeFloat16(src[28])\n dst[8] = decodeFloat16(src[2])\n dst[9] = decodeFloat16(src[4])\n\n dst[10] = decodeFloat16(src[7])\n dst[11] = decodeFloat16(src[13])\n dst[12] = decodeFloat16(src[16])\n dst[13] = decodeFloat16(src[26])\n dst[14] = decodeFloat16(src[29])\n dst[15] = decodeFloat16(src[42])\n dst[16] = decodeFloat16(src[3])\n dst[17] = decodeFloat16(src[8])\n dst[18] = decodeFloat16(src[12])\n dst[19] = decodeFloat16(src[17])\n\n dst[20] = decodeFloat16(src[25])\n dst[21] = decodeFloat16(src[30])\n dst[22] = decodeFloat16(src[41])\n dst[23] = decodeFloat16(src[43])\n dst[24] = decodeFloat16(src[9])\n dst[25] = decodeFloat16(src[11])\n dst[26] = decodeFloat16(src[18])\n dst[27] = decodeFloat16(src[24])\n dst[28] = decodeFloat16(src[31])\n dst[29] = decodeFloat16(src[40])\n\n dst[30] = decodeFloat16(src[44])\n dst[31] = decodeFloat16(src[53])\n dst[32] = decodeFloat16(src[10])\n dst[33] = decodeFloat16(src[19])\n dst[34] = decodeFloat16(src[23])\n dst[35] = decodeFloat16(src[32])\n dst[36] = decodeFloat16(src[39])\n dst[37] = decodeFloat16(src[45])\n dst[38] = decodeFloat16(src[52])\n dst[39] = decodeFloat16(src[54])\n\n dst[40] = decodeFloat16(src[20])\n dst[41] = decodeFloat16(src[22])\n dst[42] = decodeFloat16(src[33])\n dst[43] = decodeFloat16(src[38])\n dst[44] = decodeFloat16(src[46])\n dst[45] = decodeFloat16(src[51])\n dst[46] = decodeFloat16(src[55])\n dst[47] = decodeFloat16(src[60])\n dst[48] = decodeFloat16(src[21])\n dst[49] = decodeFloat16(src[34])\n\n dst[50] = decodeFloat16(src[37])\n dst[51] = decodeFloat16(src[47])\n dst[52] = decodeFloat16(src[50])\n dst[53] = decodeFloat16(src[56])\n dst[54] = decodeFloat16(src[59])\n dst[55] = decodeFloat16(src[61])\n dst[56] = decodeFloat16(src[35])\n dst[57] = decodeFloat16(src[36])\n dst[58] = decodeFloat16(src[48])\n dst[59] = decodeFloat16(src[49])\n\n dst[60] = decodeFloat16(src[57])\n dst[61] = decodeFloat16(src[58])\n dst[62] = decodeFloat16(src[62])\n dst[63] = decodeFloat16(src[63])\n }\n\n function dctInverse(data) {\n const a = 0.5 * Math.cos(3.14159 / 4.0)\n const b = 0.5 * Math.cos(3.14159 / 16.0)\n const c = 0.5 * Math.cos(3.14159 / 8.0)\n const d = 0.5 * Math.cos((3.0 * 3.14159) / 16.0)\n const e = 0.5 * Math.cos((5.0 * 3.14159) / 16.0)\n const f = 0.5 * Math.cos((3.0 * 3.14159) / 8.0)\n const g = 0.5 * Math.cos((7.0 * 3.14159) / 16.0)\n\n var alpha = new Array(4)\n var beta = new Array(4)\n var theta = new Array(4)\n var gamma = new Array(4)\n\n for (var row = 0; row < 8; ++row) {\n var rowPtr = row * 8\n\n alpha[0] = c * data[rowPtr + 2]\n alpha[1] = f * data[rowPtr + 2]\n alpha[2] = c * data[rowPtr + 6]\n alpha[3] = f * data[rowPtr + 6]\n\n beta[0] = b * data[rowPtr + 1] + d * data[rowPtr + 3] + e * data[rowPtr + 5] + g * data[rowPtr + 7]\n beta[1] = d * data[rowPtr + 1] - g * data[rowPtr + 3] - b * data[rowPtr + 5] - e * data[rowPtr + 7]\n beta[2] = e * data[rowPtr + 1] - b * data[rowPtr + 3] + g * data[rowPtr + 5] + d * data[rowPtr + 7]\n beta[3] = g * data[rowPtr + 1] - e * data[rowPtr + 3] + d * data[rowPtr + 5] - b * data[rowPtr + 7]\n\n theta[0] = a * (data[rowPtr + 0] + data[rowPtr + 4])\n theta[3] = a * (data[rowPtr + 0] - data[rowPtr + 4])\n theta[1] = alpha[0] + alpha[3]\n theta[2] = alpha[1] - alpha[2]\n\n gamma[0] = theta[0] + theta[1]\n gamma[1] = theta[3] + theta[2]\n gamma[2] = theta[3] - theta[2]\n gamma[3] = theta[0] - theta[1]\n\n data[rowPtr + 0] = gamma[0] + beta[0]\n data[rowPtr + 1] = gamma[1] + beta[1]\n data[rowPtr + 2] = gamma[2] + beta[2]\n data[rowPtr + 3] = gamma[3] + beta[3]\n\n data[rowPtr + 4] = gamma[3] - beta[3]\n data[rowPtr + 5] = gamma[2] - beta[2]\n data[rowPtr + 6] = gamma[1] - beta[1]\n data[rowPtr + 7] = gamma[0] - beta[0]\n }\n\n for (var column = 0; column < 8; ++column) {\n alpha[0] = c * data[16 + column]\n alpha[1] = f * data[16 + column]\n alpha[2] = c * data[48 + column]\n alpha[3] = f * data[48 + column]\n\n beta[0] = b * data[8 + column] + d * data[24 + column] + e * data[40 + column] + g * data[56 + column]\n beta[1] = d * data[8 + column] - g * data[24 + column] - b * data[40 + column] - e * data[56 + column]\n beta[2] = e * data[8 + column] - b * data[24 + column] + g * data[40 + column] + d * data[56 + column]\n beta[3] = g * data[8 + column] - e * data[24 + column] + d * data[40 + column] - b * data[56 + column]\n\n theta[0] = a * (data[column] + data[32 + column])\n theta[3] = a * (data[column] - data[32 + column])\n\n theta[1] = alpha[0] + alpha[3]\n theta[2] = alpha[1] - alpha[2]\n\n gamma[0] = theta[0] + theta[1]\n gamma[1] = theta[3] + theta[2]\n gamma[2] = theta[3] - theta[2]\n gamma[3] = theta[0] - theta[1]\n\n data[0 + column] = gamma[0] + beta[0]\n data[8 + column] = gamma[1] + beta[1]\n data[16 + column] = gamma[2] + beta[2]\n data[24 + column] = gamma[3] + beta[3]\n\n data[32 + column] = gamma[3] - beta[3]\n data[40 + column] = gamma[2] - beta[2]\n data[48 + column] = gamma[1] - beta[1]\n data[56 + column] = gamma[0] - beta[0]\n }\n }\n\n function csc709Inverse(data) {\n for (var i = 0; i < 64; ++i) {\n var y = data[0][i]\n var cb = data[1][i]\n var cr = data[2][i]\n\n data[0][i] = y + 1.5747 * cr\n data[1][i] = y - 0.1873 * cb - 0.4682 * cr\n data[2][i] = y + 1.8556 * cb\n }\n }\n\n function convertToHalf(src, dst, idx) {\n for (var i = 0; i < 64; ++i) {\n dst[idx + i] = DataUtils.toHalfFloat(toLinear(src[i]))\n }\n }\n\n function toLinear(float) {\n if (float <= 1) {\n return Math.sign(float) * Math.pow(Math.abs(float), 2.2)\n } else {\n return Math.sign(float) * Math.pow(logBase, Math.abs(float) - 1.0)\n }\n }\n\n function uncompressRAW(info) {\n return new DataView(info.array.buffer, info.offset.value, info.size)\n }\n\n function uncompressRLE(info) {\n var compressed = info.viewer.buffer.slice(info.offset.value, info.offset.value + info.size)\n\n var rawBuffer = new Uint8Array(decodeRunLength(compressed))\n var tmpBuffer = new Uint8Array(rawBuffer.length)\n\n predictor(rawBuffer) // revert predictor\n\n interleaveScalar(rawBuffer, tmpBuffer) // interleave pixels\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressZIP(info) {\n var compressed = info.array.slice(info.offset.value, info.offset.value + info.size)\n var rawBuffer = unzlibSync(compressed)\n var tmpBuffer = new Uint8Array(rawBuffer.length)\n\n predictor(rawBuffer) // revert predictor\n\n interleaveScalar(rawBuffer, tmpBuffer) // interleave pixels\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressPIZ(info) {\n var inDataView = info.viewer\n var inOffset = { value: info.offset.value }\n\n var outBuffer = new Uint16Array(info.width * info.scanlineBlockSize * (info.channels * info.type))\n var bitmap = new Uint8Array(BITMAP_SIZE)\n\n // Setup channel info\n var outBufferEnd = 0\n var pizChannelData = new Array(info.channels)\n for (var i = 0; i < info.channels; i++) {\n pizChannelData[i] = {}\n pizChannelData[i]['start'] = outBufferEnd\n pizChannelData[i]['end'] = pizChannelData[i]['start']\n pizChannelData[i]['nx'] = info.width\n pizChannelData[i]['ny'] = info.lines\n pizChannelData[i]['size'] = info.type\n\n outBufferEnd += pizChannelData[i].nx * pizChannelData[i].ny * pizChannelData[i].size\n }\n\n // Read range compression data\n\n var minNonZero = parseUint16(inDataView, inOffset)\n var maxNonZero = parseUint16(inDataView, inOffset)\n\n if (maxNonZero >= BITMAP_SIZE) {\n throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE'\n }\n\n if (minNonZero <= maxNonZero) {\n for (var i = 0; i < maxNonZero - minNonZero + 1; i++) {\n bitmap[i + minNonZero] = parseUint8(inDataView, inOffset)\n }\n }\n\n // Reverse LUT\n var lut = new Uint16Array(USHORT_RANGE)\n var maxValue = reverseLutFromBitmap(bitmap, lut)\n\n var length = parseUint32(inDataView, inOffset)\n\n // Huffman decoding\n hufUncompress(info.array, inDataView, inOffset, length, outBuffer, outBufferEnd)\n\n // Wavelet decoding\n for (var i = 0; i < info.channels; ++i) {\n var cd = pizChannelData[i]\n\n for (var j = 0; j < pizChannelData[i].size; ++j) {\n wav2Decode(outBuffer, cd.start + j, cd.nx, cd.size, cd.ny, cd.nx * cd.size, maxValue)\n }\n }\n\n // Expand the pixel data to their original range\n applyLut(lut, outBuffer, outBufferEnd)\n\n // Rearrange the pixel data into the format expected by the caller.\n var tmpOffset = 0\n var tmpBuffer = new Uint8Array(outBuffer.buffer.byteLength)\n for (var y = 0; y < info.lines; y++) {\n for (var c = 0; c < info.channels; c++) {\n var cd = pizChannelData[c]\n\n var n = cd.nx * cd.size\n var cp = new Uint8Array(outBuffer.buffer, cd.end * INT16_SIZE, n * INT16_SIZE)\n\n tmpBuffer.set(cp, tmpOffset)\n tmpOffset += n * INT16_SIZE\n cd.end += n\n }\n }\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressPXR(info) {\n var compressed = info.array.slice(info.offset.value, info.offset.value + info.size)\n var rawBuffer = unzlibSync(compressed)\n\n const sz = info.lines * info.channels * info.width\n const tmpBuffer = info.type == 1 ? new Uint16Array(sz) : new Uint32Array(sz)\n\n let tmpBufferEnd = 0\n let writePtr = 0\n const ptr = new Array(4)\n\n for (let y = 0; y < info.lines; y++) {\n for (let c = 0; c < info.channels; c++) {\n let pixel = 0\n\n switch (info.type) {\n case 1:\n ptr[0] = tmpBufferEnd\n ptr[1] = ptr[0] + info.width\n tmpBufferEnd = ptr[1] + info.width\n\n for (let j = 0; j < info.width; ++j) {\n const diff = (rawBuffer[ptr[0]++] << 8) | rawBuffer[ptr[1]++]\n\n pixel += diff\n\n tmpBuffer[writePtr] = pixel\n writePtr++\n }\n\n break\n\n case 2:\n ptr[0] = tmpBufferEnd\n ptr[1] = ptr[0] + info.width\n ptr[2] = ptr[1] + info.width\n tmpBufferEnd = ptr[2] + info.width\n\n for (let j = 0; j < info.width; ++j) {\n const diff = (rawBuffer[ptr[0]++] << 24) | (rawBuffer[ptr[1]++] << 16) | (rawBuffer[ptr[2]++] << 8)\n\n pixel += diff\n\n tmpBuffer[writePtr] = pixel\n writePtr++\n }\n\n break\n }\n }\n }\n\n return new DataView(tmpBuffer.buffer)\n }\n\n function uncompressDWA(info) {\n var inDataView = info.viewer\n var inOffset = { value: info.offset.value }\n var outBuffer = new Uint8Array(info.width * info.lines * (info.channels * info.type * INT16_SIZE))\n\n // Read compression header information\n var dwaHeader = {\n version: parseInt64(inDataView, inOffset),\n unknownUncompressedSize: parseInt64(inDataView, inOffset),\n unknownCompressedSize: parseInt64(inDataView, inOffset),\n acCompressedSize: parseInt64(inDataView, inOffset),\n dcCompressedSize: parseInt64(inDataView, inOffset),\n rleCompressedSize: parseInt64(inDataView, inOffset),\n rleUncompressedSize: parseInt64(inDataView, inOffset),\n rleRawSize: parseInt64(inDataView, inOffset),\n totalAcUncompressedCount: parseInt64(inDataView, inOffset),\n totalDcUncompressedCount: parseInt64(inDataView, inOffset),\n acCompression: parseInt64(inDataView, inOffset),\n }\n\n if (dwaHeader.version < 2) {\n throw 'EXRLoader.parse: ' + EXRHeader.compression + ' version ' + dwaHeader.version + ' is unsupported'\n }\n\n // Read channel ruleset information\n var channelRules = new Array()\n var ruleSize = parseUint16(inDataView, inOffset) - INT16_SIZE\n\n while (ruleSize > 0) {\n var name = parseNullTerminatedString(inDataView.buffer, inOffset)\n var value = parseUint8(inDataView, inOffset)\n var compression = (value >> 2) & 3\n var csc = (value >> 4) - 1\n var index = new Int8Array([csc])[0]\n var type = parseUint8(inDataView, inOffset)\n\n channelRules.push({\n name: name,\n index: index,\n type: type,\n compression: compression,\n })\n\n ruleSize -= name.length + 3\n }\n\n // Classify channels\n var channels = EXRHeader.channels\n var channelData = new Array(info.channels)\n\n for (var i = 0; i < info.channels; ++i) {\n var cd = (channelData[i] = {})\n var channel = channels[i]\n\n cd.name = channel.name\n cd.compression = UNKNOWN\n cd.decoded = false\n cd.type = channel.pixelType\n cd.pLinear = channel.pLinear\n cd.width = info.width\n cd.height = info.lines\n }\n\n var cscSet = {\n idx: new Array(3),\n }\n\n for (var offset = 0; offset < info.channels; ++offset) {\n var cd = channelData[offset]\n\n for (var i = 0; i < channelRules.length; ++i) {\n var rule = channelRules[i]\n\n if (cd.name == rule.name) {\n cd.compression = rule.compression\n\n if (rule.index >= 0) {\n cscSet.idx[rule.index] = offset\n }\n\n cd.offset = offset\n }\n }\n }\n\n // Read DCT - AC component data\n if (dwaHeader.acCompressedSize > 0) {\n switch (dwaHeader.acCompression) {\n case STATIC_HUFFMAN:\n var acBuffer = new Uint16Array(dwaHeader.totalAcUncompressedCount)\n hufUncompress(\n info.array,\n inDataView,\n inOffset,\n dwaHeader.acCompressedSize,\n acBuffer,\n dwaHeader.totalAcUncompressedCount,\n )\n break\n\n case DEFLATE:\n var compressed = info.array.slice(inOffset.value, inOffset.value + dwaHeader.totalAcUncompressedCount)\n var data = unzlibSync(compressed)\n var acBuffer = new Uint16Array(data.buffer)\n inOffset.value += dwaHeader.totalAcUncompressedCount\n break\n }\n }\n\n // Read DCT - DC component data\n if (dwaHeader.dcCompressedSize > 0) {\n var zlibInfo = {\n array: info.array,\n offset: inOffset,\n size: dwaHeader.dcCompressedSize,\n }\n var dcBuffer = new Uint16Array(uncompressZIP(zlibInfo).buffer)\n inOffset.value += dwaHeader.dcCompressedSize\n }\n\n // Read RLE compressed data\n if (dwaHeader.rleRawSize > 0) {\n var compressed = info.array.slice(inOffset.value, inOffset.value + dwaHeader.rleCompressedSize)\n var data = unzlibSync(compressed)\n var rleBuffer = decodeRunLength(data.buffer)\n\n inOffset.value += dwaHeader.rleCompressedSize\n }\n\n // Prepare outbuffer data offset\n var outBufferEnd = 0\n var rowOffsets = new Array(channelData.length)\n for (var i = 0; i < rowOffsets.length; ++i) {\n rowOffsets[i] = new Array()\n }\n\n for (var y = 0; y < info.lines; ++y) {\n for (var chan = 0; chan < channelData.length; ++chan) {\n rowOffsets[chan].push(outBufferEnd)\n outBufferEnd += channelData[chan].width * info.type * INT16_SIZE\n }\n }\n\n // Lossy DCT decode RGB channels\n lossyDctDecode(cscSet, rowOffsets, channelData, acBuffer, dcBuffer, outBuffer)\n\n // Decode other channels\n for (var i = 0; i < channelData.length; ++i) {\n var cd = channelData[i]\n\n if (cd.decoded) continue\n\n switch (cd.compression) {\n case RLE:\n var row = 0\n var rleOffset = 0\n\n for (var y = 0; y < info.lines; ++y) {\n var rowOffsetBytes = rowOffsets[i][row]\n\n for (var x = 0; x < cd.width; ++x) {\n for (var byte = 0; byte < INT16_SIZE * cd.type; ++byte) {\n outBuffer[rowOffsetBytes++] = rleBuffer[rleOffset + byte * cd.width * cd.height]\n }\n\n rleOffset++\n }\n\n row++\n }\n\n break\n\n case LOSSY_DCT: // skip\n\n default:\n throw 'EXRLoader.parse: unsupported channel compression'\n }\n }\n\n return new DataView(outBuffer.buffer)\n }\n\n function parseNullTerminatedString(buffer, offset) {\n var uintBuffer = new Uint8Array(buffer)\n var endOffset = 0\n\n while (uintBuffer[offset.value + endOffset] != 0) {\n endOffset += 1\n }\n\n var stringValue = new TextDecoder().decode(uintBuffer.slice(offset.value, offset.value + endOffset))\n\n offset.value = offset.value + endOffset + 1\n\n return stringValue\n }\n\n function parseFixedLengthString(buffer, offset, size) {\n var stringValue = new TextDecoder().decode(new Uint8Array(buffer).slice(offset.value, offset.value + size))\n\n offset.value = offset.value + size\n\n return stringValue\n }\n\n function parseRational(dataView, offset) {\n var x = parseInt32(dataView, offset)\n var y = parseUint32(dataView, offset)\n\n return [x, y]\n }\n\n function parseTimecode(dataView, offset) {\n var x = parseUint32(dataView, offset)\n var y = parseUint32(dataView, offset)\n\n return [x, y]\n }\n\n function parseInt32(dataView, offset) {\n var Int32 = dataView.getInt32(offset.value, true)\n\n offset.value = offset.value + INT32_SIZE\n\n return Int32\n }\n\n function parseUint32(dataView, offset) {\n var Uint32 = dataView.getUint32(offset.value, true)\n\n offset.value = offset.value + INT32_SIZE\n\n return Uint32\n }\n\n function parseUint8Array(uInt8Array, offset) {\n var Uint8 = uInt8Array[offset.value]\n\n offset.value = offset.value + INT8_SIZE\n\n return Uint8\n }\n\n function parseUint8(dataView, offset) {\n var Uint8 = dataView.getUint8(offset.value)\n\n offset.value = offset.value + INT8_SIZE\n\n return Uint8\n }\n\n const parseInt64 = function (dataView, offset) {\n let int\n\n if ('getBigInt64' in DataView.prototype) {\n int = Number(dataView.getBigInt64(offset.value, true))\n } else {\n int = dataView.getUint32(offset.value + 4, true) + Number(dataView.getUint32(offset.value, true) << 32)\n }\n\n offset.value += ULONG_SIZE\n\n return int\n }\n\n function parseFloat32(dataView, offset) {\n var float = dataView.getFloat32(offset.value, true)\n\n offset.value += FLOAT32_SIZE\n\n return float\n }\n\n function decodeFloat32(dataView, offset) {\n return DataUtils.toHalfFloat(parseFloat32(dataView, offset))\n }\n\n // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript\n function decodeFloat16(binary) {\n var exponent = (binary & 0x7c00) >> 10,\n fraction = binary & 0x03ff\n\n return (\n (binary >> 15 ? -1 : 1) *\n (exponent\n ? exponent === 0x1f\n ? fraction\n ? NaN\n : Infinity\n : Math.pow(2, exponent - 15) * (1 + fraction / 0x400)\n : 6.103515625e-5 * (fraction / 0x400))\n )\n }\n\n function parseUint16(dataView, offset) {\n var Uint16 = dataView.getUint16(offset.value, true)\n\n offset.value += INT16_SIZE\n\n return Uint16\n }\n\n function parseFloat16(buffer, offset) {\n return decodeFloat16(parseUint16(buffer, offset))\n }\n\n function parseChlist(dataView, buffer, offset, size) {\n var startOffset = offset.value\n var channels = []\n\n while (offset.value < startOffset + size - 1) {\n var name = parseNullTerminatedString(buffer, offset)\n var pixelType = parseInt32(dataView, offset)\n var pLinear = parseUint8(dataView, offset)\n offset.value += 3 // reserved, three chars\n var xSampling = parseInt32(dataView, offset)\n var ySampling = parseInt32(dataView, offset)\n\n channels.push({\n name: name,\n pixelType: pixelType,\n pLinear: pLinear,\n xSampling: xSampling,\n ySampling: ySampling,\n })\n }\n\n offset.value += 1\n\n return channels\n }\n\n function parseChromaticities(dataView, offset) {\n var redX = parseFloat32(dataView, offset)\n var redY = parseFloat32(dataView, offset)\n var greenX = parseFloat32(dataView, offset)\n var greenY = parseFloat32(dataView, offset)\n var blueX = parseFloat32(dataView, offset)\n var blueY = parseFloat32(dataView, offset)\n var whiteX = parseFloat32(dataView, offset)\n var whiteY = parseFloat32(dataView, offset)\n\n return {\n redX: redX,\n redY: redY,\n greenX: greenX,\n greenY: greenY,\n blueX: blueX,\n blueY: blueY,\n whiteX: whiteX,\n whiteY: whiteY,\n }\n }\n\n function parseCompression(dataView, offset) {\n var compressionCodes = [\n 'NO_COMPRESSION',\n 'RLE_COMPRESSION',\n 'ZIPS_COMPRESSION',\n 'ZIP_COMPRESSION',\n 'PIZ_COMPRESSION',\n 'PXR24_COMPRESSION',\n 'B44_COMPRESSION',\n 'B44A_COMPRESSION',\n 'DWAA_COMPRESSION',\n 'DWAB_COMPRESSION',\n ]\n\n var compression = parseUint8(dataView, offset)\n\n return compressionCodes[compression]\n }\n\n function parseBox2i(dataView, offset) {\n var xMin = parseUint32(dataView, offset)\n var yMin = parseUint32(dataView, offset)\n var xMax = parseUint32(dataView, offset)\n var yMax = parseUint32(dataView, offset)\n\n return { xMin: xMin, yMin: yMin, xMax: xMax, yMax: yMax }\n }\n\n function parseLineOrder(dataView, offset) {\n var lineOrders = ['INCREASING_Y']\n\n var lineOrder = parseUint8(dataView, offset)\n\n return lineOrders[lineOrder]\n }\n\n function parseV2f(dataView, offset) {\n var x = parseFloat32(dataView, offset)\n var y = parseFloat32(dataView, offset)\n\n return [x, y]\n }\n\n function parseV3f(dataView, offset) {\n var x = parseFloat32(dataView, offset)\n var y = parseFloat32(dataView, offset)\n var z = parseFloat32(dataView, offset)\n\n return [x, y, z]\n }\n\n function parseValue(dataView, buffer, offset, type, size) {\n if (type === 'string' || type === 'stringvector' || type === 'iccProfile') {\n return parseFixedLengthString(buffer, offset, size)\n } else if (type === 'chlist') {\n return parseChlist(dataView, buffer, offset, size)\n } else if (type === 'chromaticities') {\n return parseChromaticities(dataView, offset)\n } else if (type === 'compression') {\n return parseCompression(dataView, offset)\n } else if (type === 'box2i') {\n return parseBox2i(dataView, offset)\n } else if (type === 'lineOrder') {\n return parseLineOrder(dataView, offset)\n } else if (type === 'float') {\n return parseFloat32(dataView, offset)\n } else if (type === 'v2f') {\n return parseV2f(dataView, offset)\n } else if (type === 'v3f') {\n return parseV3f(dataView, offset)\n } else if (type === 'int') {\n return parseInt32(dataView, offset)\n } else if (type === 'rational') {\n return parseRational(dataView, offset)\n } else if (type === 'timecode') {\n return parseTimecode(dataView, offset)\n } else if (type === 'preview') {\n offset.value += size\n return 'skipped'\n } else {\n offset.value += size\n return undefined\n }\n }\n\n function parseHeader(dataView, buffer, offset) {\n const EXRHeader = {}\n\n if (dataView.getUint32(0, true) != 20000630) {\n // magic\n throw \"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.\"\n }\n\n EXRHeader.version = dataView.getUint8(4)\n\n const spec = dataView.getUint8(5) // fullMask\n\n EXRHeader.spec = {\n singleTile: !!(spec & 2),\n longName: !!(spec & 4),\n deepFormat: !!(spec & 8),\n multiPart: !!(spec & 16),\n }\n\n // start of header\n\n offset.value = 8 // start at 8 - after pre-amble\n\n var keepReading = true\n\n while (keepReading) {\n var attributeName = parseNullTerminatedString(buffer, offset)\n\n if (attributeName == 0) {\n keepReading = false\n } else {\n var attributeType = parseNullTerminatedString(buffer, offset)\n var attributeSize = parseUint32(dataView, offset)\n var attributeValue = parseValue(dataView, buffer, offset, attributeType, attributeSize)\n\n if (attributeValue === undefined) {\n console.warn(`EXRLoader.parse: skipped unknown header attribute type \\'${attributeType}\\'.`)\n } else {\n EXRHeader[attributeName] = attributeValue\n }\n }\n }\n\n if ((spec & ~0x04) != 0) {\n // unsupported tiled, deep-image, multi-part\n console.error('EXRHeader:', EXRHeader)\n throw 'THREE.EXRLoader: provided file is currently unsupported.'\n }\n\n return EXRHeader\n }\n\n function setupDecoder(EXRHeader, dataView, uInt8Array, offset, outputType) {\n const EXRDecoder = {\n size: 0,\n viewer: dataView,\n array: uInt8Array,\n offset: offset,\n width: EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1,\n height: EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1,\n channels: EXRHeader.channels.length,\n bytesPerLine: null,\n lines: null,\n inputSize: null,\n type: EXRHeader.channels[0].pixelType,\n uncompress: null,\n getter: null,\n format: null,\n [hasColorSpace ? 'colorSpace' : 'encoding']: null,\n }\n\n switch (EXRHeader.compression) {\n case 'NO_COMPRESSION':\n EXRDecoder.lines = 1\n EXRDecoder.uncompress = uncompressRAW\n break\n\n case 'RLE_COMPRESSION':\n EXRDecoder.lines = 1\n EXRDecoder.uncompress = uncompressRLE\n break\n\n case 'ZIPS_COMPRESSION':\n EXRDecoder.lines = 1\n EXRDecoder.uncompress = uncompressZIP\n break\n\n case 'ZIP_COMPRESSION':\n EXRDecoder.lines = 16\n EXRDecoder.uncompress = uncompressZIP\n break\n\n case 'PIZ_COMPRESSION':\n EXRDecoder.lines = 32\n EXRDecoder.uncompress = uncompressPIZ\n break\n\n case 'PXR24_COMPRESSION':\n EXRDecoder.lines = 16\n EXRDecoder.uncompress = uncompressPXR\n break\n\n case 'DWAA_COMPRESSION':\n EXRDecoder.lines = 32\n EXRDecoder.uncompress = uncompressDWA\n break\n\n case 'DWAB_COMPRESSION':\n EXRDecoder.lines = 256\n EXRDecoder.uncompress = uncompressDWA\n break\n\n default:\n throw 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported'\n }\n\n EXRDecoder.scanlineBlockSize = EXRDecoder.lines\n\n if (EXRDecoder.type == 1) {\n // half\n switch (outputType) {\n case FloatType:\n EXRDecoder.getter = parseFloat16\n EXRDecoder.inputSize = INT16_SIZE\n break\n\n case HalfFloatType:\n EXRDecoder.getter = parseUint16\n EXRDecoder.inputSize = INT16_SIZE\n break\n }\n } else if (EXRDecoder.type == 2) {\n // float\n switch (outputType) {\n case FloatType:\n EXRDecoder.getter = parseFloat32\n EXRDecoder.inputSize = FLOAT32_SIZE\n break\n\n case HalfFloatType:\n EXRDecoder.getter = decodeFloat32\n EXRDecoder.inputSize = FLOAT32_SIZE\n }\n } else {\n throw 'EXRLoader.parse: unsupported pixelType ' + EXRDecoder.type + ' for ' + EXRHeader.compression + '.'\n }\n\n EXRDecoder.blockCount = (EXRHeader.dataWindow.yMax + 1) / EXRDecoder.scanlineBlockSize\n\n for (var i = 0; i < EXRDecoder.blockCount; i++) parseInt64(dataView, offset) // scanlineOffset\n\n // we should be passed the scanline offset table, ready to start reading pixel data.\n\n // RGB images will be converted to RGBA format, preventing software emulation in select devices.\n EXRDecoder.outputChannels = EXRDecoder.channels == 3 ? 4 : EXRDecoder.channels\n const size = EXRDecoder.width * EXRDecoder.height * EXRDecoder.outputChannels\n\n switch (outputType) {\n case FloatType:\n EXRDecoder.byteArray = new Float32Array(size)\n\n // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten\n if (EXRDecoder.channels < EXRDecoder.outputChannels) EXRDecoder.byteArray.fill(1, 0, size)\n\n break\n\n case HalfFloatType:\n EXRDecoder.byteArray = new Uint16Array(size)\n\n if (EXRDecoder.channels < EXRDecoder.outputChannels) EXRDecoder.byteArray.fill(0x3c00, 0, size) // Uint16Array holds half float data, 0x3C00 is 1\n\n break\n\n default:\n console.error('THREE.EXRLoader: unsupported type: ', outputType)\n break\n }\n\n EXRDecoder.bytesPerLine = EXRDecoder.width * EXRDecoder.inputSize * EXRDecoder.channels\n\n if (EXRDecoder.outputChannels == 4) EXRDecoder.format = RGBAFormat\n else EXRDecoder.format = RedFormat\n\n if (hasColorSpace) EXRDecoder.colorSpace = 'srgb-linear'\n else EXRDecoder.encoding = 3000 // LinearEncoding\n\n return EXRDecoder\n }\n\n // start parsing file [START]\n\n const bufferDataView = new DataView(buffer)\n const uInt8Array = new Uint8Array(buffer)\n const offset = { value: 0 }\n\n // get header information and validate format.\n const EXRHeader = parseHeader(bufferDataView, buffer, offset)\n\n // get input compression information and prepare decoding.\n const EXRDecoder = setupDecoder(EXRHeader, bufferDataView, uInt8Array, offset, this.type)\n\n const tmpOffset = { value: 0 }\n const channelOffsets = { R: 0, G: 1, B: 2, A: 3, Y: 0 }\n\n for (\n let scanlineBlockIdx = 0;\n scanlineBlockIdx < EXRDecoder.height / EXRDecoder.scanlineBlockSize;\n scanlineBlockIdx++\n ) {\n const line = parseUint32(bufferDataView, offset) // line_no\n EXRDecoder.size = parseUint32(bufferDataView, offset) // data_len\n EXRDecoder.lines =\n line + EXRDecoder.scanlineBlockSize > EXRDecoder.height\n ? EXRDecoder.height - line\n : EXRDecoder.scanlineBlockSize\n\n const isCompressed = EXRDecoder.size < EXRDecoder.lines * EXRDecoder.bytesPerLine\n const viewer = isCompressed ? EXRDecoder.uncompress(EXRDecoder) : uncompressRAW(EXRDecoder)\n\n offset.value += EXRDecoder.size\n\n for (let line_y = 0; line_y < EXRDecoder.scanlineBlockSize; line_y++) {\n const true_y = line_y + scanlineBlockIdx * EXRDecoder.scanlineBlockSize\n if (true_y >= EXRDecoder.height) break\n\n for (let channelID = 0; channelID < EXRDecoder.channels; channelID++) {\n const cOff = channelOffsets[EXRHeader.channels[channelID].name]\n\n for (let x = 0; x < EXRDecoder.width; x++) {\n tmpOffset.value =\n (line_y * (EXRDecoder.channels * EXRDecoder.width) + channelID * EXRDecoder.width + x) *\n EXRDecoder.inputSize\n const outIndex =\n (EXRDecoder.height - 1 - true_y) * (EXRDecoder.width * EXRDecoder.outputChannels) +\n x * EXRDecoder.outputChannels +\n cOff\n EXRDecoder.byteArray[outIndex] = EXRDecoder.getter(viewer, tmpOffset)\n }\n }\n }\n }\n\n return {\n header: EXRHeader,\n width: EXRDecoder.width,\n height: EXRDecoder.height,\n data: EXRDecoder.byteArray,\n format: EXRDecoder.format,\n [hasColorSpace ? 'colorSpace' : 'encoding']: EXRDecoder[hasColorSpace ? 'colorSpace' : 'encoding'],\n type: this.type,\n }\n }\n\n setDataType(value) {\n this.type = value\n return this\n }\n\n load(url, onLoad, onProgress, onError) {\n function onLoadCallback(texture, texData) {\n if (hasColorSpace) texture.colorSpace = texData.colorSpace\n else texture.encoding = texData.encoding\n texture.minFilter = LinearFilter\n texture.magFilter = LinearFilter\n texture.generateMipmaps = false\n texture.flipY = false\n\n if (onLoad) onLoad(texture, texData)\n }\n\n return super.load(url, onLoadCallback, onProgress, onError)\n }\n}\n\nexport { EXRLoader }\n", "import {\n CompressedTexture,\n FileLoader,\n LinearFilter,\n LinearMipmapLinearFilter,\n Loader,\n RGBAFormat,\n RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format,\n RGB_ETC1_Format,\n RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format,\n UnsignedByteType,\n} from 'three'\n\n/**\n * Loader for Basis Universal GPU Texture Codec.\n *\n * Basis Universal is a \"supercompressed\" GPU texture and texture video\n * compression system that outputs a highly compressed intermediate file format\n * (.basis) that can be quickly transcoded to a wide variety of GPU texture\n * compression formats.\n *\n * This loader parallelizes the transcoding process across a configurable number\n * of web workers, before transferring the transcoded compressed texture back\n * to the main thread.\n */\n\nconst _taskCache = new WeakMap()\n\nclass BasisTextureLoader extends Loader {\n /* CONSTANTS */\n\n static BasisFormat = {\n ETC1S: 0,\n UASTC_4x4: 1,\n }\n\n static TranscoderFormat = {\n ETC1: 0,\n ETC2: 1,\n BC1: 2,\n BC3: 3,\n BC4: 4,\n BC5: 5,\n BC7_M6_OPAQUE_ONLY: 6,\n BC7_M5: 7,\n PVRTC1_4_RGB: 8,\n PVRTC1_4_RGBA: 9,\n ASTC_4x4: 10,\n ATC_RGB: 11,\n ATC_RGBA_INTERPOLATED_ALPHA: 12,\n RGBA32: 13,\n RGB565: 14,\n BGR565: 15,\n RGBA4444: 16,\n }\n\n static EngineFormat = {\n RGBAFormat: RGBAFormat,\n RGBA_ASTC_4x4_Format: RGBA_ASTC_4x4_Format,\n RGBA_BPTC_Format: RGBA_BPTC_Format,\n RGBA_ETC2_EAC_Format: RGBA_ETC2_EAC_Format,\n RGBA_PVRTC_4BPPV1_Format: RGBA_PVRTC_4BPPV1_Format,\n RGBA_S3TC_DXT5_Format: RGBA_S3TC_DXT5_Format,\n RGB_ETC1_Format: RGB_ETC1_Format,\n RGB_ETC2_Format: RGB_ETC2_Format,\n RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format,\n RGB_S3TC_DXT1_Format: RGB_S3TC_DXT1_Format,\n }\n\n /* WEB WORKER */\n\n static BasisWorker = function () {\n let config\n let transcoderPending\n let BasisModule\n\n const EngineFormat = _EngineFormat\n const TranscoderFormat = _TranscoderFormat\n const BasisFormat = _BasisFormat\n\n onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'init':\n config = message.config\n init(message.transcoderBinary)\n break\n\n case 'transcode':\n transcoderPending.then(() => {\n try {\n const { width, height, hasAlpha, mipmaps, format } = message.taskConfig.lowLevel\n ? transcodeLowLevel(message.taskConfig)\n : transcode(message.buffers[0])\n\n const buffers = []\n\n for (let i = 0; i < mipmaps.length; ++i) {\n buffers.push(mipmaps[i].data.buffer)\n }\n\n self.postMessage({ type: 'transcode', id: message.id, width, height, hasAlpha, mipmaps, format }, buffers)\n } catch (error) {\n console.error(error)\n\n self.postMessage({ type: 'error', id: message.id, error: error.message })\n }\n })\n break\n }\n }\n\n function init(wasmBinary) {\n transcoderPending = new Promise((resolve) => {\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve }\n BASIS(BasisModule)\n }).then(() => {\n BasisModule.initializeBasis()\n })\n }\n\n function transcodeLowLevel(taskConfig) {\n const { basisFormat, width, height, hasAlpha } = taskConfig\n\n const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha)\n\n const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat)\n\n assert(BasisModule.isFormatSupported(transcoderFormat), 'THREE.BasisTextureLoader: Unsupported format.')\n\n const mipmaps = []\n\n if (basisFormat === BasisFormat.ETC1S) {\n const transcoder = new BasisModule.LowLevelETC1SImageTranscoder()\n\n const { endpointCount, endpointsData, selectorCount, selectorsData, tablesData } = taskConfig.globalData\n\n try {\n let ok\n\n ok = transcoder.decodePalettes(endpointCount, endpointsData, selectorCount, selectorsData)\n\n assert(ok, 'THREE.BasisTextureLoader: decodePalettes() failed.')\n\n ok = transcoder.decodeTables(tablesData)\n\n assert(ok, 'THREE.BasisTextureLoader: decodeTables() failed.')\n\n for (let i = 0; i < taskConfig.levels.length; i++) {\n const level = taskConfig.levels[i]\n const imageDesc = taskConfig.globalData.imageDescs[i]\n\n const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height)\n const dst = new Uint8Array(dstByteLength)\n\n ok = transcoder.transcodeImage(\n transcoderFormat,\n dst,\n dstByteLength / blockByteLength,\n level.data,\n getWidthInBlocks(transcoderFormat, level.width),\n getHeightInBlocks(transcoderFormat, level.height),\n level.width,\n level.height,\n level.index,\n imageDesc.rgbSliceByteOffset,\n imageDesc.rgbSliceByteLength,\n imageDesc.alphaSliceByteOffset,\n imageDesc.alphaSliceByteLength,\n imageDesc.imageFlags,\n hasAlpha,\n false,\n 0,\n 0,\n )\n\n assert(ok, 'THREE.BasisTextureLoader: transcodeImage() failed for level ' + level.index + '.')\n\n mipmaps.push({ data: dst, width: level.width, height: level.height })\n }\n } finally {\n transcoder.delete()\n }\n } else {\n for (let i = 0; i < taskConfig.levels.length; i++) {\n const level = taskConfig.levels[i]\n\n const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height)\n const dst = new Uint8Array(dstByteLength)\n\n const ok = BasisModule.transcodeUASTCImage(\n transcoderFormat,\n dst,\n dstByteLength / blockByteLength,\n level.data,\n getWidthInBlocks(transcoderFormat, level.width),\n getHeightInBlocks(transcoderFormat, level.height),\n level.width,\n level.height,\n level.index,\n 0,\n level.data.byteLength,\n 0,\n hasAlpha,\n false,\n 0,\n 0,\n -1,\n -1,\n )\n\n assert(ok, 'THREE.BasisTextureLoader: transcodeUASTCImage() failed for level ' + level.index + '.')\n\n mipmaps.push({ data: dst, width: level.width, height: level.height })\n }\n }\n\n return { width, height, hasAlpha, mipmaps, format: engineFormat }\n }\n\n function transcode(buffer) {\n const basisFile = new BasisModule.BasisFile(new Uint8Array(buffer))\n\n const basisFormat = basisFile.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S\n const width = basisFile.getImageWidth(0, 0)\n const height = basisFile.getImageHeight(0, 0)\n const levels = basisFile.getNumLevels(0)\n const hasAlpha = basisFile.getHasAlpha()\n\n function cleanup() {\n basisFile.close()\n basisFile.delete()\n }\n\n const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha)\n\n if (!width || !height || !levels) {\n cleanup()\n throw new Error('THREE.BasisTextureLoader:\tInvalid texture')\n }\n\n if (!basisFile.startTranscoding()) {\n cleanup()\n throw new Error('THREE.BasisTextureLoader: .startTranscoding failed')\n }\n\n const mipmaps = []\n\n for (let mip = 0; mip < levels; mip++) {\n const mipWidth = basisFile.getImageWidth(0, mip)\n const mipHeight = basisFile.getImageHeight(0, mip)\n const dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, transcoderFormat))\n\n const status = basisFile.transcodeImage(dst, 0, mip, transcoderFormat, 0, hasAlpha)\n\n if (!status) {\n cleanup()\n throw new Error('THREE.BasisTextureLoader: .transcodeImage failed.')\n }\n\n mipmaps.push({ data: dst, width: mipWidth, height: mipHeight })\n }\n\n cleanup()\n\n return { width, height, hasAlpha, mipmaps, format: engineFormat }\n }\n\n //\n\n // Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC),\n // device capabilities, and texture dimensions. The list below ranks the formats separately\n // for ETC1S and UASTC.\n //\n // In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at\n // significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently\n // chooses RGBA32 only as a last resort and does not expose that option to the caller.\n const FORMAT_OPTIONS = [\n {\n if: 'astcSupported',\n basisFormat: [BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],\n engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],\n priorityETC1S: Infinity,\n priorityUASTC: 1,\n needsPowerOfTwo: false,\n },\n {\n if: 'bptcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],\n engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],\n priorityETC1S: 3,\n priorityUASTC: 2,\n needsPowerOfTwo: false,\n },\n {\n if: 'dxtSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],\n engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],\n priorityETC1S: 4,\n priorityUASTC: 5,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc2Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],\n engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],\n priorityETC1S: 1,\n priorityUASTC: 3,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc1Supported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC1],\n engineFormat: [EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format],\n priorityETC1S: 2,\n priorityUASTC: 4,\n needsPowerOfTwo: false,\n },\n {\n if: 'pvrtcSupported',\n basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],\n transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],\n engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],\n priorityETC1S: 5,\n priorityUASTC: 6,\n needsPowerOfTwo: true,\n },\n ]\n\n const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityETC1S - b.priorityETC1S\n })\n const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function (a, b) {\n return a.priorityUASTC - b.priorityUASTC\n })\n\n function getTranscoderFormat(basisFormat, width, height, hasAlpha) {\n let transcoderFormat\n let engineFormat\n\n const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS\n\n for (let i = 0; i < options.length; i++) {\n const opt = options[i]\n\n if (!config[opt.if]) continue\n if (!opt.basisFormat.includes(basisFormat)) continue\n if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height))) continue\n\n transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0]\n engineFormat = opt.engineFormat[hasAlpha ? 1 : 0]\n\n return { transcoderFormat, engineFormat }\n }\n\n console.warn('THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32.')\n\n transcoderFormat = TranscoderFormat.RGBA32\n engineFormat = EngineFormat.RGBAFormat\n\n return { transcoderFormat, engineFormat }\n }\n\n function assert(ok, message) {\n if (!ok) throw new Error(message)\n }\n\n function getWidthInBlocks(transcoderFormat, width) {\n return Math.ceil(width / BasisModule.getFormatBlockWidth(transcoderFormat))\n }\n\n function getHeightInBlocks(transcoderFormat, height) {\n return Math.ceil(height / BasisModule.getFormatBlockHeight(transcoderFormat))\n }\n\n function getTranscodedImageByteLength(transcoderFormat, width, height) {\n const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat)\n\n if (BasisModule.formatIsUncompressed(transcoderFormat)) {\n return width * height * blockByteLength\n }\n\n if (transcoderFormat === TranscoderFormat.PVRTC1_4_RGB || transcoderFormat === TranscoderFormat.PVRTC1_4_RGBA) {\n // GL requires extra padding for very small textures:\n // https://www.khronos.org/registry/OpenGL/extensions/IMG/IMG_texture_compression_pvrtc.txt\n const paddedWidth = (width + 3) & ~3\n const paddedHeight = (height + 3) & ~3\n\n return (Math.max(8, paddedWidth) * Math.max(8, paddedHeight) * 4 + 7) / 8\n }\n\n return getWidthInBlocks(transcoderFormat, width) * getHeightInBlocks(transcoderFormat, height) * blockByteLength\n }\n\n function isPowerOfTwo(value) {\n if (value <= 2) return true\n\n return (value & (value - 1)) === 0 && value !== 0\n }\n }\n\n constructor(manager) {\n super(manager)\n\n this.transcoderPath = ''\n this.transcoderBinary = null\n this.transcoderPending = null\n\n this.workerLimit = 4\n this.workerPool = []\n this.workerNextTaskID = 1\n this.workerSourceURL = ''\n this.workerConfig = null\n }\n\n setTranscoderPath(path) {\n this.transcoderPath = path\n\n return this\n }\n\n setWorkerLimit(workerLimit) {\n this.workerLimit = workerLimit\n\n return this\n }\n\n detectSupport(renderer) {\n this.workerConfig = {\n astcSupported: renderer.extensions.has('WEBGL_compressed_texture_astc'),\n etc1Supported: renderer.extensions.has('WEBGL_compressed_texture_etc1'),\n etc2Supported: renderer.extensions.has('WEBGL_compressed_texture_etc'),\n dxtSupported: renderer.extensions.has('WEBGL_compressed_texture_s3tc'),\n bptcSupported: renderer.extensions.has('EXT_texture_compression_bptc'),\n pvrtcSupported:\n renderer.extensions.has('WEBGL_compressed_texture_pvrtc') ||\n renderer.extensions.has('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n }\n\n return this\n }\n\n load(url, onLoad, onProgress, onError) {\n const loader = new FileLoader(this.manager)\n\n loader.setResponseType('arraybuffer')\n loader.setWithCredentials(this.withCredentials)\n\n const texture = new CompressedTexture()\n\n loader.load(\n url,\n (buffer) => {\n // Check for an existing task using this buffer. A transferred buffer cannot be transferred\n // again from this thread.\n if (_taskCache.has(buffer)) {\n const cachedTask = _taskCache.get(buffer)\n\n return cachedTask.promise.then(onLoad).catch(onError)\n }\n\n this._createTexture([buffer])\n .then(function (_texture) {\n texture.copy(_texture)\n texture.needsUpdate = true\n\n if (onLoad) onLoad(texture)\n })\n .catch(onError)\n },\n onProgress,\n onError,\n )\n\n return texture\n }\n\n /** Low-level transcoding API, exposed for use by KTX2Loader. */\n parseInternalAsync(options) {\n const { levels } = options\n\n const buffers = new Set()\n\n for (let i = 0; i < levels.length; i++) {\n buffers.add(levels[i].data.buffer)\n }\n\n return this._createTexture(Array.from(buffers), { ...options, lowLevel: true })\n }\n\n /**\n * @param {ArrayBuffer[]} buffers\n * @param {object?} config\n * @return {Promise}\n */\n _createTexture(buffers, config = {}) {\n let worker\n let taskID\n\n const taskConfig = config\n let taskCost = 0\n\n for (let i = 0; i < buffers.length; i++) {\n taskCost += buffers[i].byteLength\n }\n\n const texturePending = this._allocateWorker(taskCost)\n .then((_worker) => {\n worker = _worker\n taskID = this.workerNextTaskID++\n\n return new Promise((resolve, reject) => {\n worker._callbacks[taskID] = { resolve, reject }\n\n worker.postMessage({ type: 'transcode', id: taskID, buffers: buffers, taskConfig: taskConfig }, buffers)\n })\n })\n .then((message) => {\n const { mipmaps, width, height, format } = message\n\n const texture = new CompressedTexture(mipmaps, width, height, format, UnsignedByteType)\n texture.minFilter = mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter\n texture.magFilter = LinearFilter\n texture.generateMipmaps = false\n texture.needsUpdate = true\n\n return texture\n })\n\n // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)\n texturePending\n .catch(() => true)\n .then(() => {\n if (worker && taskID) {\n worker._taskLoad -= taskCost\n delete worker._callbacks[taskID]\n }\n })\n\n // Cache the task result.\n _taskCache.set(buffers[0], { promise: texturePending })\n\n return texturePending\n }\n\n _initTranscoder() {\n if (!this.transcoderPending) {\n // Load transcoder wrapper.\n const jsLoader = new FileLoader(this.manager)\n jsLoader.setPath(this.transcoderPath)\n jsLoader.setWithCredentials(this.withCredentials)\n const jsContent = new Promise((resolve, reject) => {\n jsLoader.load('basis_transcoder.js', resolve, undefined, reject)\n })\n\n // Load transcoder WASM binary.\n const binaryLoader = new FileLoader(this.manager)\n binaryLoader.setPath(this.transcoderPath)\n binaryLoader.setResponseType('arraybuffer')\n binaryLoader.setWithCredentials(this.withCredentials)\n const binaryContent = new Promise((resolve, reject) => {\n binaryLoader.load('basis_transcoder.wasm', resolve, undefined, reject)\n })\n\n this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent, binaryContent]) => {\n const fn = BasisTextureLoader.BasisWorker.toString()\n\n const body = [\n '/* constants */',\n 'let _EngineFormat = ' + JSON.stringify(BasisTextureLoader.EngineFormat),\n 'let _TranscoderFormat = ' + JSON.stringify(BasisTextureLoader.TranscoderFormat),\n 'let _BasisFormat = ' + JSON.stringify(BasisTextureLoader.BasisFormat),\n '/* basis_transcoder.js */',\n jsContent,\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}')),\n ].join('\\n')\n\n this.workerSourceURL = URL.createObjectURL(new Blob([body]))\n this.transcoderBinary = binaryContent\n })\n }\n\n return this.transcoderPending\n }\n\n _allocateWorker(taskCost) {\n return this._initTranscoder().then(() => {\n if (this.workerPool.length < this.workerLimit) {\n const worker = new Worker(this.workerSourceURL)\n\n worker._callbacks = {}\n worker._taskLoad = 0\n\n worker.postMessage({\n type: 'init',\n config: this.workerConfig,\n transcoderBinary: this.transcoderBinary,\n })\n\n worker.onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'transcode':\n worker._callbacks[message.id].resolve(message)\n break\n\n case 'error':\n worker._callbacks[message.id].reject(message)\n break\n\n default:\n console.error('THREE.BasisTextureLoader: Unexpected message, \"' + message.type + '\"')\n }\n }\n\n this.workerPool.push(worker)\n } else {\n this.workerPool.sort(function (a, b) {\n return a._taskLoad > b._taskLoad ? -1 : 1\n })\n }\n\n const worker = this.workerPool[this.workerPool.length - 1]\n\n worker._taskLoad += taskCost\n\n return worker\n })\n }\n\n dispose() {\n for (let i = 0; i < this.workerPool.length; i++) {\n this.workerPool[i].terminate()\n }\n\n this.workerPool.length = 0\n\n return this\n }\n}\n\nexport { BasisTextureLoader }\n", "import {\n BufferAttribute,\n BufferGeometry,\n Color,\n FileLoader,\n Group,\n LineBasicMaterial,\n LineSegments,\n Loader,\n Matrix4,\n Mesh,\n MeshStandardMaterial,\n ShaderMaterial,\n UniformsLib,\n UniformsUtils,\n Vector3,\n Ray,\n REVISION,\n} from 'three'\n\n// Special surface finish tag types.\n// Note: \"MATERIAL\" tag (e.g. GLITTER, SPECKLE) is not implemented\nconst FINISH_TYPE_DEFAULT = 0\nconst FINISH_TYPE_CHROME = 1\nconst FINISH_TYPE_PEARLESCENT = 2\nconst FINISH_TYPE_RUBBER = 3\nconst FINISH_TYPE_MATTE_METALLIC = 4\nconst FINISH_TYPE_METAL = 5\n\n// State machine to search a subobject path.\n// The LDraw standard establishes these various possible subfolders.\nconst FILE_LOCATION_AS_IS = 0\nconst FILE_LOCATION_TRY_PARTS = 1\nconst FILE_LOCATION_TRY_P = 2\nconst FILE_LOCATION_TRY_MODELS = 3\nconst FILE_LOCATION_TRY_RELATIVE = 4\nconst FILE_LOCATION_TRY_ABSOLUTE = 5\nconst FILE_LOCATION_NOT_FOUND = 6\n\nconst MAIN_COLOUR_CODE = '16'\nconst MAIN_EDGE_COLOUR_CODE = '24'\n\nconst _tempVec0 = new Vector3()\nconst _tempVec1 = new Vector3()\n\nclass LDrawConditionalLineMaterial extends ShaderMaterial {\n constructor(parameters) {\n super({\n uniforms: UniformsUtils.merge([\n UniformsLib.fog,\n {\n diffuse: {\n value: new Color(),\n },\n opacity: {\n value: 1.0,\n },\n },\n ]),\n\n vertexShader: /* glsl */ `\n attribute vec3 control0;\n attribute vec3 control1;\n attribute vec3 direction;\n varying float discardFlag;\n\n #include \n #include \n #include \n #include \n #include \n\n void main() {\n #include \n\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n // Transform the line segment ends and control points into camera clip space\n vec4 c0 = projectionMatrix * modelViewMatrix * vec4(control0, 1.0);\n vec4 c1 = projectionMatrix * modelViewMatrix * vec4(control1, 1.0);\n vec4 p0 = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n vec4 p1 = projectionMatrix * modelViewMatrix * vec4(position + direction, 1.0);\n\n c0.xy /= c0.w;\n c1.xy /= c1.w;\n p0.xy /= p0.w;\n p1.xy /= p1.w;\n\n // Get the direction of the segment and an orthogonal vector\n vec2 dir = p1.xy - p0.xy;\n vec2 norm = vec2(-dir.y, dir.x);\n\n // Get control point directions from the line\n vec2 c0dir = c0.xy - p1.xy;\n vec2 c1dir = c1.xy - p1.xy;\n\n // If the vectors to the controls points are pointed in different directions away\n // from the line segment then the line should not be drawn.\n float d0 = dot(normalize(norm), normalize(c0dir));\n float d1 = dot(normalize(norm), normalize(c1dir));\n discardFlag = float(sign(d0) != sign(d1));\n\n #include \n #include \n #include \n }\n `,\n\n fragmentShader: /* glsl */ `\n uniform vec3 diffuse;\n uniform float opacity;\n varying float discardFlag;\n\n #include \n #include \n #include \n #include \n #include \n\n void main() {\n if (discardFlag > 0.5) discard;\n\n #include \n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include \n #include \n outgoingLight = diffuseColor.rgb; // simple shader\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include \n #include <${parseInt(REVISION.replace(/\\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>\n #include \n #include \n }\n `,\n })\n\n Object.defineProperties(this, {\n opacity: {\n get: function () {\n return this.uniforms.opacity.value\n },\n\n set: function (value) {\n this.uniforms.opacity.value = value\n },\n },\n\n color: {\n get: function () {\n return this.uniforms.diffuse.value\n },\n },\n })\n\n this.setValues(parameters)\n this.isLDrawConditionalLineMaterial = true\n }\n}\n\nclass ConditionalLineSegments extends LineSegments {\n constructor(geometry, material) {\n super(geometry, material)\n this.isConditionalLine = true\n }\n}\n\nfunction generateFaceNormals(faces) {\n for (let i = 0, l = faces.length; i < l; i++) {\n const face = faces[i]\n const vertices = face.vertices\n const v0 = vertices[0]\n const v1 = vertices[1]\n const v2 = vertices[2]\n\n _tempVec0.subVectors(v1, v0)\n _tempVec1.subVectors(v2, v1)\n face.faceNormal = new Vector3().crossVectors(_tempVec0, _tempVec1).normalize()\n }\n}\n\nconst _ray = new Ray()\nfunction smoothNormals(faces, lineSegments, checkSubSegments = false) {\n // NOTE: 1e2 is pretty coarse but was chosen to quantize the resulting value because\n // it allows edges to be smoothed as expected (see minifig arms).\n // --\n // And the vector values are initialize multiplied by 1 + 1e-10 to account for floating\n // point errors on vertices along quantization boundaries. Ie after matrix multiplication\n // vertices that should be merged might be set to \"1.7\" and \"1.6999...\" meaning they won't\n // get merged. This added epsilon attempts to push these error values to the same quantized\n // value for the sake of hashing. See \"AT-ST mini\" dishes. See mrdoob/three#23169.\n\n const hashMultiplier = (1 + 1e-10) * 1e2\n function hashVertex(v) {\n const x = ~~(v.x * hashMultiplier)\n const y = ~~(v.y * hashMultiplier)\n const z = ~~(v.z * hashMultiplier)\n\n return `${x},${y},${z}`\n }\n\n function hashEdge(v0, v1) {\n return `${hashVertex(v0)}_${hashVertex(v1)}`\n }\n\n // converts the two vertices to a ray with a normalized direction and origin of 0, 0, 0 projected\n // onto the original line.\n function toNormalizedRay(v0, v1, targetRay) {\n targetRay.direction.subVectors(v1, v0).normalize()\n\n const scalar = v0.dot(targetRay.direction)\n targetRay.origin.copy(v0).addScaledVector(targetRay.direction, -scalar)\n\n return targetRay\n }\n\n function hashRay(ray) {\n return hashEdge(ray.origin, ray.direction)\n }\n\n const hardEdges = new Set()\n const hardEdgeRays = new Map()\n const halfEdgeList = {}\n const normals = []\n\n // Save the list of hard edges by hash\n for (let i = 0, l = lineSegments.length; i < l; i++) {\n const ls = lineSegments[i]\n const vertices = ls.vertices\n const v0 = vertices[0]\n const v1 = vertices[1]\n hardEdges.add(hashEdge(v0, v1))\n hardEdges.add(hashEdge(v1, v0))\n\n // only generate the hard edge ray map if we're checking subsegments because it's more expensive to check\n // and requires more memory.\n if (checkSubSegments) {\n // add both ray directions to the map\n const ray = toNormalizedRay(v0, v1, new Ray())\n const rh1 = hashRay(ray)\n if (!hardEdgeRays.has(rh1)) {\n toNormalizedRay(v1, v0, ray)\n const rh2 = hashRay(ray)\n\n const info = {\n ray,\n distances: [],\n }\n\n hardEdgeRays.set(rh1, info)\n hardEdgeRays.set(rh2, info)\n }\n\n // store both segments ends in min, max order in the distances array to check if a face edge is a\n // subsegment later.\n const info = hardEdgeRays.get(rh1)\n let d0 = info.ray.direction.dot(v0)\n let d1 = info.ray.direction.dot(v1)\n if (d0 > d1) {\n ;[d0, d1] = [d1, d0]\n }\n\n info.distances.push(d0, d1)\n }\n }\n\n // track the half edges associated with each triangle\n for (let i = 0, l = faces.length; i < l; i++) {\n const tri = faces[i]\n const vertices = tri.vertices\n const vertCount = vertices.length\n for (let i2 = 0; i2 < vertCount; i2++) {\n const index = i2\n const next = (i2 + 1) % vertCount\n const v0 = vertices[index]\n const v1 = vertices[next]\n const hash = hashEdge(v0, v1)\n\n // don't add the triangle if the edge is supposed to be hard\n if (hardEdges.has(hash)) {\n continue\n }\n\n // if checking subsegments then check to see if this edge lies on a hard edge ray and whether its within any ray bounds\n if (checkSubSegments) {\n toNormalizedRay(v0, v1, _ray)\n\n const rayHash = hashRay(_ray)\n if (hardEdgeRays.has(rayHash)) {\n const info = hardEdgeRays.get(rayHash)\n const { ray, distances } = info\n let d0 = ray.direction.dot(v0)\n let d1 = ray.direction.dot(v1)\n\n if (d0 > d1) {\n ;[d0, d1] = [d1, d0]\n }\n\n // return early if the face edge is found to be a subsegment of a line edge meaning the edge will have \"hard\" normals\n let found = false\n for (let i = 0, l = distances.length; i < l; i += 2) {\n if (d0 >= distances[i] && d1 <= distances[i + 1]) {\n found = true\n break\n }\n }\n\n if (found) {\n continue\n }\n }\n }\n\n const info = {\n index: index,\n tri: tri,\n }\n halfEdgeList[hash] = info\n }\n }\n\n // Iterate until we've tried to connect all faces to share normals\n while (true) {\n // Stop if there are no more faces left\n let halfEdge = null\n for (const key in halfEdgeList) {\n halfEdge = halfEdgeList[key]\n break\n }\n\n if (halfEdge === null) {\n break\n }\n\n // Exhaustively find all connected faces\n const queue = [halfEdge]\n while (queue.length > 0) {\n // initialize all vertex normals in this triangle\n const tri = queue.pop().tri\n const vertices = tri.vertices\n const vertNormals = tri.normals\n const faceNormal = tri.faceNormal\n\n // Check if any edge is connected to another triangle edge\n const vertCount = vertices.length\n for (let i2 = 0; i2 < vertCount; i2++) {\n const index = i2\n const next = (i2 + 1) % vertCount\n const v0 = vertices[index]\n const v1 = vertices[next]\n\n // delete this triangle from the list so it won't be found again\n const hash = hashEdge(v0, v1)\n delete halfEdgeList[hash]\n\n const reverseHash = hashEdge(v1, v0)\n const otherInfo = halfEdgeList[reverseHash]\n if (otherInfo) {\n const otherTri = otherInfo.tri\n const otherIndex = otherInfo.index\n const otherNormals = otherTri.normals\n const otherVertCount = otherNormals.length\n const otherFaceNormal = otherTri.faceNormal\n\n // NOTE: If the angle between faces is > 67.5 degrees then assume it's\n // hard edge. There are some cases where the line segments do not line up exactly\n // with or span multiple triangle edges (see Lunar Vehicle wheels).\n if (Math.abs(otherTri.faceNormal.dot(tri.faceNormal)) < 0.25) {\n continue\n }\n\n // if this triangle has already been traversed then it won't be in\n // the halfEdgeList. If it has not then add it to the queue and delete\n // it so it won't be found again.\n if (reverseHash in halfEdgeList) {\n queue.push(otherInfo)\n delete halfEdgeList[reverseHash]\n }\n\n // share the first normal\n const otherNext = (otherIndex + 1) % otherVertCount\n if (vertNormals[index] && otherNormals[otherNext] && vertNormals[index] !== otherNormals[otherNext]) {\n otherNormals[otherNext].norm.add(vertNormals[index].norm)\n vertNormals[index].norm = otherNormals[otherNext].norm\n }\n\n let sharedNormal1 = vertNormals[index] || otherNormals[otherNext]\n if (sharedNormal1 === null) {\n // it's possible to encounter an edge of a triangle that has already been traversed meaning\n // both edges already have different normals defined and shared. To work around this we create\n // a wrapper object so when those edges are merged the normals can be updated everywhere.\n sharedNormal1 = { norm: new Vector3() }\n normals.push(sharedNormal1.norm)\n }\n\n if (vertNormals[index] === null) {\n vertNormals[index] = sharedNormal1\n sharedNormal1.norm.add(faceNormal)\n }\n\n if (otherNormals[otherNext] === null) {\n otherNormals[otherNext] = sharedNormal1\n sharedNormal1.norm.add(otherFaceNormal)\n }\n\n // share the second normal\n if (vertNormals[next] && otherNormals[otherIndex] && vertNormals[next] !== otherNormals[otherIndex]) {\n otherNormals[otherIndex].norm.add(vertNormals[next].norm)\n vertNormals[next].norm = otherNormals[otherIndex].norm\n }\n\n let sharedNormal2 = vertNormals[next] || otherNormals[otherIndex]\n if (sharedNormal2 === null) {\n sharedNormal2 = { norm: new Vector3() }\n normals.push(sharedNormal2.norm)\n }\n\n if (vertNormals[next] === null) {\n vertNormals[next] = sharedNormal2\n sharedNormal2.norm.add(faceNormal)\n }\n\n if (otherNormals[otherIndex] === null) {\n otherNormals[otherIndex] = sharedNormal2\n sharedNormal2.norm.add(otherFaceNormal)\n }\n }\n }\n }\n }\n\n // The normals of each face have been added up so now we average them by normalizing the vector.\n for (let i = 0, l = normals.length; i < l; i++) {\n normals[i].normalize()\n }\n}\n\nfunction isPartType(type) {\n return type === 'Part' || type === 'Unofficial_Part'\n}\n\nfunction isPrimitiveType(type) {\n return /primitive/i.test(type) || type === 'Subpart'\n}\n\nclass LineParser {\n constructor(line, lineNumber) {\n this.line = line\n this.lineLength = line.length\n this.currentCharIndex = 0\n this.currentChar = ' '\n this.lineNumber = lineNumber\n }\n\n seekNonSpace() {\n while (this.currentCharIndex < this.lineLength) {\n this.currentChar = this.line.charAt(this.currentCharIndex)\n\n if (this.currentChar !== ' ' && this.currentChar !== '\\t') {\n return\n }\n\n this.currentCharIndex++\n }\n }\n\n getToken() {\n const pos0 = this.currentCharIndex++\n\n // Seek space\n while (this.currentCharIndex < this.lineLength) {\n this.currentChar = this.line.charAt(this.currentCharIndex)\n\n if (this.currentChar === ' ' || this.currentChar === '\\t') {\n break\n }\n\n this.currentCharIndex++\n }\n\n const pos1 = this.currentCharIndex\n\n this.seekNonSpace()\n\n return this.line.substring(pos0, pos1)\n }\n\n getVector() {\n return new Vector3(parseFloat(this.getToken()), parseFloat(this.getToken()), parseFloat(this.getToken()))\n }\n\n getRemainingString() {\n return this.line.substring(this.currentCharIndex, this.lineLength)\n }\n\n isAtTheEnd() {\n return this.currentCharIndex >= this.lineLength\n }\n\n setToEnd() {\n this.currentCharIndex = this.lineLength\n }\n\n getLineNumberString() {\n return this.lineNumber >= 0 ? ' at line ' + this.lineNumber : ''\n }\n}\n\n// Fetches and parses an intermediate representation of LDraw parts files.\nclass LDrawParsedCache {\n constructor(loader) {\n this.loader = loader\n this._cache = {}\n }\n\n cloneResult(original) {\n const result = {}\n\n // vertices are transformed and normals computed before being converted to geometry\n // so these pieces must be cloned.\n result.faces = original.faces.map((face) => {\n return {\n colorCode: face.colorCode,\n material: face.material,\n vertices: face.vertices.map((v) => v.clone()),\n normals: face.normals.map(() => null),\n faceNormal: null,\n }\n })\n\n result.conditionalSegments = original.conditionalSegments.map((face) => {\n return {\n colorCode: face.colorCode,\n material: face.material,\n vertices: face.vertices.map((v) => v.clone()),\n controlPoints: face.controlPoints.map((v) => v.clone()),\n }\n })\n\n result.lineSegments = original.lineSegments.map((face) => {\n return {\n colorCode: face.colorCode,\n material: face.material,\n vertices: face.vertices.map((v) => v.clone()),\n }\n })\n\n // none if this is subsequently modified\n result.type = original.type\n result.category = original.category\n result.keywords = original.keywords\n result.subobjects = original.subobjects\n result.totalFaces = original.totalFaces\n result.startingConstructionStep = original.startingConstructionStep\n result.materials = original.materials\n result.group = null\n return result\n }\n\n async fetchData(fileName) {\n let triedLowerCase = false\n let locationState = FILE_LOCATION_AS_IS\n while (locationState !== FILE_LOCATION_NOT_FOUND) {\n let subobjectURL = fileName\n switch (locationState) {\n case FILE_LOCATION_AS_IS:\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_PARTS:\n subobjectURL = 'parts/' + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_P:\n subobjectURL = 'p/' + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_MODELS:\n subobjectURL = 'models/' + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_RELATIVE:\n subobjectURL = fileName.substring(0, fileName.lastIndexOf('/') + 1) + subobjectURL\n locationState = locationState + 1\n break\n\n case FILE_LOCATION_TRY_ABSOLUTE:\n if (triedLowerCase) {\n // Try absolute path\n locationState = FILE_LOCATION_NOT_FOUND\n } else {\n // Next attempt is lower case\n fileName = fileName.toLowerCase()\n subobjectURL = fileName\n triedLowerCase = true\n locationState = FILE_LOCATION_AS_IS\n }\n\n break\n }\n\n const loader = this.loader\n const fileLoader = new FileLoader(loader.manager)\n fileLoader.setPath(loader.partsLibraryPath)\n fileLoader.setRequestHeader(loader.requestHeader)\n fileLoader.setWithCredentials(loader.withCredentials)\n\n try {\n const text = await fileLoader.loadAsync(subobjectURL)\n return text\n } catch {\n continue\n }\n }\n\n throw new Error('LDrawLoader: Subobject \"' + fileName + '\" could not be loaded.')\n }\n\n parse(text, fileName = null) {\n const loader = this.loader\n\n // final results\n const faces = []\n const lineSegments = []\n const conditionalSegments = []\n const subobjects = []\n const materials = {}\n\n const getLocalMaterial = (colorCode) => {\n return materials[colorCode] || null\n }\n\n let type = 'Model'\n let category = null\n let keywords = null\n let totalFaces = 0\n\n // split into lines\n if (text.indexOf('\\r\\n') !== -1) {\n // This is faster than String.split with regex that splits on both\n text = text.replace(/\\r\\n/g, '\\n')\n }\n\n const lines = text.split('\\n')\n const numLines = lines.length\n\n let parsingEmbeddedFiles = false\n let currentEmbeddedFileName = null\n let currentEmbeddedText = null\n\n let bfcCertified = false\n let bfcCCW = true\n let bfcInverted = false\n let bfcCull = true\n\n let startingConstructionStep = false\n\n // Parse all line commands\n for (let lineIndex = 0; lineIndex < numLines; lineIndex++) {\n const line = lines[lineIndex]\n\n if (line.length === 0) continue\n\n if (parsingEmbeddedFiles) {\n if (line.startsWith('0 FILE ')) {\n // Save previous embedded file in the cache\n this.setData(currentEmbeddedFileName, currentEmbeddedText)\n\n // New embedded text file\n currentEmbeddedFileName = line.substring(7)\n currentEmbeddedText = ''\n } else {\n currentEmbeddedText += line + '\\n'\n }\n\n continue\n }\n\n const lp = new LineParser(line, lineIndex + 1)\n lp.seekNonSpace()\n\n if (lp.isAtTheEnd()) {\n // Empty line\n continue\n }\n\n // Parse the line type\n const lineType = lp.getToken()\n\n let material\n let colorCode\n let segment\n let ccw\n let doubleSided\n let v0, v1, v2, v3, c0, c1\n\n switch (lineType) {\n // Line type 0: Comment or META\n case '0':\n // Parse meta directive\n const meta = lp.getToken()\n\n if (meta) {\n switch (meta) {\n case '!LDRAW_ORG':\n type = lp.getToken()\n break\n\n case '!COLOUR':\n material = loader.parseColorMetaDirective(lp)\n if (material) {\n materials[material.userData.code] = material\n } else {\n console.warn('LDrawLoader: Error parsing material' + lp.getLineNumberString())\n }\n\n break\n\n case '!CATEGORY':\n category = lp.getToken()\n break\n\n case '!KEYWORDS':\n const newKeywords = lp.getRemainingString().split(',')\n if (newKeywords.length > 0) {\n if (!keywords) {\n keywords = []\n }\n\n newKeywords.forEach(function (keyword) {\n keywords.push(keyword.trim())\n })\n }\n\n break\n\n case 'FILE':\n if (lineIndex > 0) {\n // Start embedded text files parsing\n parsingEmbeddedFiles = true\n currentEmbeddedFileName = lp.getRemainingString()\n currentEmbeddedText = ''\n\n bfcCertified = false\n bfcCCW = true\n }\n\n break\n\n case 'BFC':\n // Changes to the backface culling state\n while (!lp.isAtTheEnd()) {\n const token = lp.getToken()\n\n switch (token) {\n case 'CERTIFY':\n case 'NOCERTIFY':\n bfcCertified = token === 'CERTIFY'\n bfcCCW = true\n\n break\n\n case 'CW':\n case 'CCW':\n bfcCCW = token === 'CCW'\n\n break\n\n case 'INVERTNEXT':\n bfcInverted = true\n\n break\n\n case 'CLIP':\n case 'NOCLIP':\n bfcCull = token === 'CLIP'\n\n break\n\n default:\n console.warn('THREE.LDrawLoader: BFC directive \"' + token + '\" is unknown.')\n\n break\n }\n }\n\n break\n\n case 'STEP':\n startingConstructionStep = true\n\n break\n\n default:\n // Other meta directives are not implemented\n break\n }\n }\n\n break\n\n // Line type 1: Sub-object file\n case '1':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n\n const posX = parseFloat(lp.getToken())\n const posY = parseFloat(lp.getToken())\n const posZ = parseFloat(lp.getToken())\n const m0 = parseFloat(lp.getToken())\n const m1 = parseFloat(lp.getToken())\n const m2 = parseFloat(lp.getToken())\n const m3 = parseFloat(lp.getToken())\n const m4 = parseFloat(lp.getToken())\n const m5 = parseFloat(lp.getToken())\n const m6 = parseFloat(lp.getToken())\n const m7 = parseFloat(lp.getToken())\n const m8 = parseFloat(lp.getToken())\n\n const matrix = new Matrix4().set(m0, m1, m2, posX, m3, m4, m5, posY, m6, m7, m8, posZ, 0, 0, 0, 1)\n\n let fileName = lp.getRemainingString().trim().replace(/\\\\/g, '/')\n\n if (loader.fileMap[fileName]) {\n // Found the subobject path in the preloaded file path map\n fileName = loader.fileMap[fileName]\n } else {\n // Standardized subfolders\n if (fileName.startsWith('s/')) {\n fileName = 'parts/' + fileName\n } else if (fileName.startsWith('48/')) {\n fileName = 'p/' + fileName\n }\n }\n\n subobjects.push({\n material: material,\n colorCode: colorCode,\n matrix: matrix,\n fileName: fileName,\n inverted: bfcInverted,\n startingConstructionStep: startingConstructionStep,\n })\n\n bfcInverted = false\n\n break\n\n // Line type 2: Line segment\n case '2':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n v0 = lp.getVector()\n v1 = lp.getVector()\n\n segment = {\n material: material,\n colorCode: colorCode,\n vertices: [v0, v1],\n }\n\n lineSegments.push(segment)\n\n break\n\n // Line type 5: Conditional Line segment\n case '5':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n v0 = lp.getVector()\n v1 = lp.getVector()\n c0 = lp.getVector()\n c1 = lp.getVector()\n\n segment = {\n material: material,\n colorCode: colorCode,\n vertices: [v0, v1],\n controlPoints: [c0, c1],\n }\n\n conditionalSegments.push(segment)\n\n break\n\n // Line type 3: Triangle\n case '3':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n ccw = bfcCCW\n doubleSided = !bfcCertified || !bfcCull\n\n if (ccw === true) {\n v0 = lp.getVector()\n v1 = lp.getVector()\n v2 = lp.getVector()\n } else {\n v2 = lp.getVector()\n v1 = lp.getVector()\n v0 = lp.getVector()\n }\n\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v0, v1, v2],\n normals: [null, null, null],\n })\n totalFaces++\n\n if (doubleSided === true) {\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v2, v1, v0],\n normals: [null, null, null],\n })\n totalFaces++\n }\n\n break\n\n // Line type 4: Quadrilateral\n case '4':\n colorCode = lp.getToken()\n material = getLocalMaterial(colorCode)\n ccw = bfcCCW\n doubleSided = !bfcCertified || !bfcCull\n\n if (ccw === true) {\n v0 = lp.getVector()\n v1 = lp.getVector()\n v2 = lp.getVector()\n v3 = lp.getVector()\n } else {\n v3 = lp.getVector()\n v2 = lp.getVector()\n v1 = lp.getVector()\n v0 = lp.getVector()\n }\n\n // specifically place the triangle diagonal in the v0 and v1 slots so we can\n // account for the doubling of vertices later when smoothing normals.\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v0, v1, v2, v3],\n normals: [null, null, null, null],\n })\n totalFaces += 2\n\n if (doubleSided === true) {\n faces.push({\n material: material,\n colorCode: colorCode,\n faceNormal: null,\n vertices: [v3, v2, v1, v0],\n normals: [null, null, null, null],\n })\n totalFaces += 2\n }\n\n break\n\n default:\n throw new Error('LDrawLoader: Unknown line type \"' + lineType + '\"' + lp.getLineNumberString() + '.')\n }\n }\n\n if (parsingEmbeddedFiles) {\n this.setData(currentEmbeddedFileName, currentEmbeddedText)\n }\n\n return {\n faces,\n conditionalSegments,\n lineSegments,\n type,\n category,\n keywords,\n subobjects,\n totalFaces,\n startingConstructionStep,\n materials,\n fileName,\n group: null,\n }\n }\n\n // returns an (optionally cloned) instance of the data\n getData(fileName, clone = true) {\n const key = fileName.toLowerCase()\n const result = this._cache[key]\n if (result === null || result instanceof Promise) {\n return null\n }\n\n if (clone) {\n return this.cloneResult(result)\n } else {\n return result\n }\n }\n\n // kicks off a fetch and parse of the requested data if it hasn't already been loaded. Returns when\n // the data is ready to use and can be retrieved synchronously with \"getData\".\n async ensureDataLoaded(fileName) {\n const key = fileName.toLowerCase()\n if (!(key in this._cache)) {\n // replace the promise with a copy of the parsed data for immediate processing\n this._cache[key] = this.fetchData(fileName).then((text) => {\n const info = this.parse(text, fileName)\n this._cache[key] = info\n return info\n })\n }\n\n await this._cache[key]\n }\n\n // sets the data in the cache from parsed data\n setData(fileName, text) {\n const key = fileName.toLowerCase()\n this._cache[key] = this.parse(text, fileName)\n }\n}\n\n// returns the material for an associated color code. If the color code is 16 for a face or 24 for\n// an edge then the passthroughColorCode is used.\nfunction getMaterialFromCode(colorCode, parentColorCode, materialHierarchy, forEdge) {\n const isPassthrough = (!forEdge && colorCode === MAIN_COLOUR_CODE) || (forEdge && colorCode === MAIN_EDGE_COLOUR_CODE)\n if (isPassthrough) {\n colorCode = parentColorCode\n }\n\n return materialHierarchy[colorCode] || null\n}\n\n// Class used to parse and build LDraw parts as three.js objects and cache them if they're a \"Part\" type.\nclass LDrawPartsGeometryCache {\n constructor(loader) {\n this.loader = loader\n this.parseCache = new LDrawParsedCache(loader)\n this._cache = {}\n }\n\n // Convert the given file information into a mesh by processing subobjects.\n async processIntoMesh(info) {\n const loader = this.loader\n const parseCache = this.parseCache\n const faceMaterials = new Set()\n\n // Processes the part subobject information to load child parts and merge geometry onto part\n // piece object.\n const processInfoSubobjects = async (info, subobject = null) => {\n const subobjects = info.subobjects\n const promises = []\n\n // Trigger load of all subobjects. If a subobject isn't a primitive then load it as a separate\n // group which lets instruction steps apply correctly.\n for (let i = 0, l = subobjects.length; i < l; i++) {\n const subobject = subobjects[i]\n const promise = parseCache.ensureDataLoaded(subobject.fileName).then(() => {\n const subobjectInfo = parseCache.getData(subobject.fileName, false)\n if (!isPrimitiveType(subobjectInfo.type)) {\n return this.loadModel(subobject.fileName).catch((error) => {\n console.warn(error)\n return null\n })\n }\n\n return processInfoSubobjects(parseCache.getData(subobject.fileName), subobject)\n })\n\n promises.push(promise)\n }\n\n const group = new Group()\n group.userData.category = info.category\n group.userData.keywords = info.keywords\n info.group = group\n\n const subobjectInfos = await Promise.all(promises)\n for (let i = 0, l = subobjectInfos.length; i < l; i++) {\n const subobject = info.subobjects[i]\n const subobjectInfo = subobjectInfos[i]\n\n if (subobjectInfo === null) {\n // the subobject failed to load\n continue\n }\n\n // if the subobject was loaded as a separate group then apply the parent scopes materials\n if (subobjectInfo.isGroup) {\n const subobjectGroup = subobjectInfo\n subobject.matrix.decompose(subobjectGroup.position, subobjectGroup.quaternion, subobjectGroup.scale)\n subobjectGroup.userData.startingConstructionStep = subobject.startingConstructionStep\n subobjectGroup.name = subobject.fileName\n\n loader.applyMaterialsToMesh(subobjectGroup, subobject.colorCode, info.materials)\n\n group.add(subobjectGroup)\n continue\n }\n\n // add the subobject group if it has children in case it has both children and primitives\n if (subobjectInfo.group.children.length) {\n group.add(subobjectInfo.group)\n }\n\n // transform the primitives into the local space of the parent piece and append them to\n // to the parent primitives list.\n const parentLineSegments = info.lineSegments\n const parentConditionalSegments = info.conditionalSegments\n const parentFaces = info.faces\n\n const lineSegments = subobjectInfo.lineSegments\n const conditionalSegments = subobjectInfo.conditionalSegments\n\n const faces = subobjectInfo.faces\n const matrix = subobject.matrix\n const inverted = subobject.inverted\n const matrixScaleInverted = matrix.determinant() < 0\n const colorCode = subobject.colorCode\n\n const lineColorCode = colorCode === MAIN_COLOUR_CODE ? MAIN_EDGE_COLOUR_CODE : colorCode\n for (let i = 0, l = lineSegments.length; i < l; i++) {\n const ls = lineSegments[i]\n const vertices = ls.vertices\n vertices[0].applyMatrix4(matrix)\n vertices[1].applyMatrix4(matrix)\n ls.colorCode = ls.colorCode === MAIN_EDGE_COLOUR_CODE ? lineColorCode : ls.colorCode\n ls.material = ls.material || getMaterialFromCode(ls.colorCode, ls.colorCode, info.materials, true)\n\n parentLineSegments.push(ls)\n }\n\n for (let i = 0, l = conditionalSegments.length; i < l; i++) {\n const os = conditionalSegments[i]\n const vertices = os.vertices\n const controlPoints = os.controlPoints\n vertices[0].applyMatrix4(matrix)\n vertices[1].applyMatrix4(matrix)\n controlPoints[0].applyMatrix4(matrix)\n controlPoints[1].applyMatrix4(matrix)\n os.colorCode = os.colorCode === MAIN_EDGE_COLOUR_CODE ? lineColorCode : os.colorCode\n os.material = os.material || getMaterialFromCode(os.colorCode, os.colorCode, info.materials, true)\n\n parentConditionalSegments.push(os)\n }\n\n for (let i = 0, l = faces.length; i < l; i++) {\n const tri = faces[i]\n const vertices = tri.vertices\n for (let i = 0, l = vertices.length; i < l; i++) {\n vertices[i].applyMatrix4(matrix)\n }\n\n tri.colorCode = tri.colorCode === MAIN_COLOUR_CODE ? colorCode : tri.colorCode\n tri.material = tri.material || getMaterialFromCode(tri.colorCode, colorCode, info.materials, false)\n faceMaterials.add(tri.colorCode)\n\n // If the scale of the object is negated then the triangle winding order\n // needs to be flipped.\n if (matrixScaleInverted !== inverted) {\n vertices.reverse()\n }\n\n parentFaces.push(tri)\n }\n\n info.totalFaces += subobjectInfo.totalFaces\n }\n\n // Apply the parent subobjects pass through material code to this object. This is done several times due\n // to material scoping.\n if (subobject) {\n loader.applyMaterialsToMesh(group, subobject.colorCode, info.materials)\n }\n\n return info\n }\n\n // Track material use to see if we need to use the normal smooth slow path for hard edges.\n for (let i = 0, l = info.faces; i < l; i++) {\n faceMaterials.add(info.faces[i].colorCode)\n }\n\n await processInfoSubobjects(info)\n\n if (loader.smoothNormals) {\n const checkSubSegments = faceMaterials.size > 1\n generateFaceNormals(info.faces)\n smoothNormals(info.faces, info.lineSegments, checkSubSegments)\n }\n\n // Add the primitive objects and metadata.\n const group = info.group\n if (info.faces.length > 0) {\n group.add(createObject(info.faces, 3, false, info.totalFaces))\n }\n\n if (info.lineSegments.length > 0) {\n group.add(createObject(info.lineSegments, 2))\n }\n\n if (info.conditionalSegments.length > 0) {\n group.add(createObject(info.conditionalSegments, 2, true))\n }\n\n return group\n }\n\n hasCachedModel(fileName) {\n return fileName !== null && fileName.toLowerCase() in this._cache\n }\n\n async getCachedModel(fileName) {\n if (fileName !== null && this.hasCachedModel(fileName)) {\n const key = fileName.toLowerCase()\n const group = await this._cache[key]\n return group.clone()\n } else {\n return null\n }\n }\n\n // Loads and parses the model with the given file name. Returns a cached copy if available.\n async loadModel(fileName) {\n const parseCache = this.parseCache\n const key = fileName.toLowerCase()\n if (this.hasCachedModel(fileName)) {\n // Return cached model if available.\n return this.getCachedModel(fileName)\n } else {\n // Otherwise parse a new model.\n // Ensure the file data is loaded and pre parsed.\n await parseCache.ensureDataLoaded(fileName)\n\n const info = parseCache.getData(fileName)\n const promise = this.processIntoMesh(info)\n\n // Now that the file has loaded it's possible that another part parse has been waiting in parallel\n // so check the cache again to see if it's been added since the last async operation so we don't\n // do unnecessary work.\n if (this.hasCachedModel(fileName)) {\n return this.getCachedModel(fileName)\n }\n\n // Cache object if it's a part so it can be reused later.\n if (isPartType(info.type)) {\n this._cache[key] = promise\n }\n\n // return a copy\n const group = await promise\n return group.clone()\n }\n }\n\n // parses the given model text into a renderable object. Returns cached copy if available.\n async parseModel(text) {\n const parseCache = this.parseCache\n const info = parseCache.parse(text)\n if (isPartType(info.type) && this.hasCachedModel(info.fileName)) {\n return this.getCachedModel(info.fileName)\n }\n\n return this.processIntoMesh(info)\n }\n}\n\nfunction sortByMaterial(a, b) {\n if (a.colorCode === b.colorCode) {\n return 0\n }\n\n if (a.colorCode < b.colorCode) {\n return -1\n }\n\n return 1\n}\n\nfunction createObject(elements, elementSize, isConditionalSegments = false, totalElements = null) {\n // Creates a LineSegments (elementSize = 2) or a Mesh (elementSize = 3 )\n // With per face / segment material, implemented with mesh groups and materials array\n\n // Sort the faces or line segments by color code to make later the mesh groups\n elements.sort(sortByMaterial)\n\n if (totalElements === null) {\n totalElements = elements.length\n }\n\n const positions = new Float32Array(elementSize * totalElements * 3)\n const normals = elementSize === 3 ? new Float32Array(elementSize * totalElements * 3) : null\n const materials = []\n\n const quadArray = new Array(6)\n const bufferGeometry = new BufferGeometry()\n let prevMaterial = null\n let index0 = 0\n let numGroupVerts = 0\n let offset = 0\n\n for (let iElem = 0, nElem = elements.length; iElem < nElem; iElem++) {\n const elem = elements[iElem]\n let vertices = elem.vertices\n if (vertices.length === 4) {\n quadArray[0] = vertices[0]\n quadArray[1] = vertices[1]\n quadArray[2] = vertices[2]\n quadArray[3] = vertices[0]\n quadArray[4] = vertices[2]\n quadArray[5] = vertices[3]\n vertices = quadArray\n }\n\n for (let j = 0, l = vertices.length; j < l; j++) {\n const v = vertices[j]\n const index = offset + j * 3\n positions[index + 0] = v.x\n positions[index + 1] = v.y\n positions[index + 2] = v.z\n }\n\n // create the normals array if this is a set of faces\n if (elementSize === 3) {\n if (!elem.faceNormal) {\n const v0 = vertices[0]\n const v1 = vertices[1]\n const v2 = vertices[2]\n _tempVec0.subVectors(v1, v0)\n _tempVec1.subVectors(v2, v1)\n elem.faceNormal = new Vector3().crossVectors(_tempVec0, _tempVec1).normalize()\n }\n\n let elemNormals = elem.normals\n if (elemNormals.length === 4) {\n quadArray[0] = elemNormals[0]\n quadArray[1] = elemNormals[1]\n quadArray[2] = elemNormals[2]\n quadArray[3] = elemNormals[0]\n quadArray[4] = elemNormals[2]\n quadArray[5] = elemNormals[3]\n elemNormals = quadArray\n }\n\n for (let j = 0, l = elemNormals.length; j < l; j++) {\n // use face normal if a vertex normal is not provided\n let n = elem.faceNormal\n if (elemNormals[j]) {\n n = elemNormals[j].norm\n }\n\n const index = offset + j * 3\n normals[index + 0] = n.x\n normals[index + 1] = n.y\n normals[index + 2] = n.z\n }\n }\n\n if (prevMaterial !== elem.colorCode) {\n if (prevMaterial !== null) {\n bufferGeometry.addGroup(index0, numGroupVerts, materials.length - 1)\n }\n\n const material = elem.material\n if (material !== null) {\n if (elementSize === 3) {\n materials.push(material)\n } else if (elementSize === 2) {\n if (material !== null) {\n if (isConditionalSegments) {\n materials.push(material.userData.edgeMaterial.userData.conditionalEdgeMaterial)\n } else {\n materials.push(material.userData.edgeMaterial)\n }\n } else {\n materials.push(null)\n }\n }\n } else {\n // If a material has not been made available yet then keep the color code string in the material array\n // to save the spot for the material once a parent scopes materials are being applied to the object.\n materials.push(elem.colorCode)\n }\n\n prevMaterial = elem.colorCode\n index0 = offset / 3\n numGroupVerts = vertices.length\n } else {\n numGroupVerts += vertices.length\n }\n\n offset += 3 * vertices.length\n }\n\n if (numGroupVerts > 0) {\n bufferGeometry.addGroup(index0, Infinity, materials.length - 1)\n }\n\n bufferGeometry.setAttribute('position', new BufferAttribute(positions, 3))\n\n if (normals !== null) {\n bufferGeometry.setAttribute('normal', new BufferAttribute(normals, 3))\n }\n\n let object3d = null\n\n if (elementSize === 2) {\n if (isConditionalSegments) {\n object3d = new ConditionalLineSegments(bufferGeometry, materials.length === 1 ? materials[0] : materials)\n } else {\n object3d = new LineSegments(bufferGeometry, materials.length === 1 ? materials[0] : materials)\n }\n } else if (elementSize === 3) {\n object3d = new Mesh(bufferGeometry, materials.length === 1 ? materials[0] : materials)\n }\n\n if (isConditionalSegments) {\n object3d.isConditionalLine = true\n\n const controlArray0 = new Float32Array(elements.length * 3 * 2)\n const controlArray1 = new Float32Array(elements.length * 3 * 2)\n const directionArray = new Float32Array(elements.length * 3 * 2)\n for (let i = 0, l = elements.length; i < l; i++) {\n const os = elements[i]\n const vertices = os.vertices\n const controlPoints = os.controlPoints\n const c0 = controlPoints[0]\n const c1 = controlPoints[1]\n const v0 = vertices[0]\n const v1 = vertices[1]\n const index = i * 3 * 2\n controlArray0[index + 0] = c0.x\n controlArray0[index + 1] = c0.y\n controlArray0[index + 2] = c0.z\n controlArray0[index + 3] = c0.x\n controlArray0[index + 4] = c0.y\n controlArray0[index + 5] = c0.z\n\n controlArray1[index + 0] = c1.x\n controlArray1[index + 1] = c1.y\n controlArray1[index + 2] = c1.z\n controlArray1[index + 3] = c1.x\n controlArray1[index + 4] = c1.y\n controlArray1[index + 5] = c1.z\n\n directionArray[index + 0] = v1.x - v0.x\n directionArray[index + 1] = v1.y - v0.y\n directionArray[index + 2] = v1.z - v0.z\n directionArray[index + 3] = v1.x - v0.x\n directionArray[index + 4] = v1.y - v0.y\n directionArray[index + 5] = v1.z - v0.z\n }\n\n bufferGeometry.setAttribute('control0', new BufferAttribute(controlArray0, 3, false))\n bufferGeometry.setAttribute('control1', new BufferAttribute(controlArray1, 3, false))\n bufferGeometry.setAttribute('direction', new BufferAttribute(directionArray, 3, false))\n }\n\n return object3d\n}\n\n//\n\nclass LDrawLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n // Array of THREE.Material\n this.materials = []\n this.materialLibrary = {}\n\n // This also allows to handle the embedded text files (\"0 FILE\" lines)\n this.partsCache = new LDrawPartsGeometryCache(this)\n\n // This object is a map from file names to paths. It agilizes the paths search. If it is not set then files will be searched by trial and error.\n this.fileMap = {}\n\n // Initializes the materials library with default materials\n this.setMaterials([])\n\n // If this flag is set to true the vertex normals will be smoothed.\n this.smoothNormals = true\n\n // The path to load parts from the LDraw parts library from.\n this.partsLibraryPath = ''\n }\n\n setPartsLibraryPath(path) {\n this.partsLibraryPath = path\n return this\n }\n\n async preloadMaterials(url) {\n const fileLoader = new FileLoader(this.manager)\n fileLoader.setPath(this.path)\n fileLoader.setRequestHeader(this.requestHeader)\n fileLoader.setWithCredentials(this.withCredentials)\n\n const text = await fileLoader.loadAsync(url)\n const colorLineRegex = /^0 !COLOUR/\n const lines = text.split(/[\\n\\r]/g)\n const materials = []\n for (let i = 0, l = lines.length; i < l; i++) {\n const line = lines[i]\n if (colorLineRegex.test(line)) {\n const directive = line.replace(colorLineRegex, '')\n const material = this.parseColorMetaDirective(new LineParser(directive))\n materials.push(material)\n }\n }\n\n this.setMaterials(materials)\n }\n\n load(url, onLoad, onProgress, onError) {\n const fileLoader = new FileLoader(this.manager)\n fileLoader.setPath(this.path)\n fileLoader.setRequestHeader(this.requestHeader)\n fileLoader.setWithCredentials(this.withCredentials)\n fileLoader.load(\n url,\n (text) => {\n this.partsCache\n .parseModel(text, this.materialLibrary)\n .then((group) => {\n this.applyMaterialsToMesh(group, MAIN_COLOUR_CODE, this.materialLibrary, true)\n this.computeConstructionSteps(group)\n onLoad(group)\n })\n .catch(onError)\n },\n onProgress,\n onError,\n )\n }\n\n parse(text, onLoad) {\n this.partsCache.parseModel(text, this.materialLibrary).then((group) => {\n this.computeConstructionSteps(group)\n onLoad(group)\n })\n }\n\n setMaterials(materials) {\n this.materialLibrary = {}\n this.materials = []\n for (let i = 0, l = materials.length; i < l; i++) {\n this.addMaterial(materials[i])\n }\n\n // Add default main triangle and line edge materials (used in pieces that can be colored with a main color)\n this.addMaterial(this.parseColorMetaDirective(new LineParser('Main_Colour CODE 16 VALUE #FF8080 EDGE #333333')))\n this.addMaterial(this.parseColorMetaDirective(new LineParser('Edge_Colour CODE 24 VALUE #A0A0A0 EDGE #333333')))\n\n return this\n }\n\n setFileMap(fileMap) {\n this.fileMap = fileMap\n\n return this\n }\n\n addMaterial(material) {\n // Adds a material to the material library which is on top of the parse scopes stack. And also to the materials array\n\n const matLib = this.materialLibrary\n if (!matLib[material.userData.code]) {\n this.materials.push(material)\n matLib[material.userData.code] = material\n }\n\n return this\n }\n\n getMaterial(colorCode) {\n if (colorCode.startsWith('0x2')) {\n // Special 'direct' material value (RGB color)\n const color = colorCode.substring(3)\n\n return this.parseColorMetaDirective(\n new LineParser('Direct_Color_' + color + ' CODE -1 VALUE #' + color + ' EDGE #' + color + ''),\n )\n }\n\n return this.materialLibrary[colorCode] || null\n }\n\n // Applies the appropriate materials to a prebuilt hierarchy of geometry. Assumes that color codes are present\n // in the material array if they need to be filled in.\n applyMaterialsToMesh(group, parentColorCode, materialHierarchy, finalMaterialPass = false) {\n // find any missing materials as indicated by a color code string and replace it with a material from the current material lib\n const loader = this\n const parentIsPassthrough = parentColorCode === MAIN_COLOUR_CODE\n group.traverse((c) => {\n if (c.isMesh || c.isLineSegments) {\n if (Array.isArray(c.material)) {\n for (let i = 0, l = c.material.length; i < l; i++) {\n if (!c.material[i].isMaterial) {\n c.material[i] = getMaterial(c, c.material[i])\n }\n }\n } else if (!c.material.isMaterial) {\n c.material = getMaterial(c, c.material)\n }\n }\n })\n\n // Returns the appropriate material for the object (line or face) given color code. If the code is \"pass through\"\n // (24 for lines, 16 for edges) then the pass through color code is used. If that is also pass through then it's\n // simply returned for the subsequent material application.\n function getMaterial(c, colorCode) {\n // if our parent is a passthrough color code and we don't have the current material color available then\n // return early.\n if (parentIsPassthrough && !(colorCode in materialHierarchy) && !finalMaterialPass) {\n return colorCode\n }\n\n const forEdge = c.isLineSegments || c.isConditionalLine\n const isPassthrough =\n (!forEdge && colorCode === MAIN_COLOUR_CODE) || (forEdge && colorCode === MAIN_EDGE_COLOUR_CODE)\n if (isPassthrough) {\n colorCode = parentColorCode\n }\n\n let material = null\n if (colorCode in materialHierarchy) {\n material = materialHierarchy[colorCode]\n } else if (finalMaterialPass) {\n // see if we can get the final material from from the \"getMaterial\" function which will attempt to\n // parse the \"direct\" colors\n material = loader.getMaterial(colorCode)\n if (material === null) {\n // otherwise throw an error if this is final opportunity to set the material\n throw new Error(`LDrawLoader: Material properties for code ${colorCode} not available.`)\n }\n } else {\n return colorCode\n }\n\n if (c.isLineSegments) {\n material = material.userData.edgeMaterial\n\n if (c.isConditionalLine) {\n material = material.userData.conditionalEdgeMaterial\n }\n }\n\n return material\n }\n }\n\n getMainMaterial() {\n return this.getMaterial(MAIN_COLOUR_CODE)\n }\n\n getMainEdgeMaterial() {\n return this.getMaterial(MAIN_EDGE_COLOUR_CODE)\n }\n\n parseColorMetaDirective(lineParser) {\n // Parses a color definition and returns a THREE.Material\n\n let code = null\n\n // Triangle and line colors\n let color = 0xff00ff\n let edgeColor = 0xff00ff\n\n // Transparency\n let alpha = 1\n let isTransparent = false\n // Self-illumination:\n let luminance = 0\n\n let finishType = FINISH_TYPE_DEFAULT\n\n let edgeMaterial = null\n\n const name = lineParser.getToken()\n if (!name) {\n throw new Error(\n 'LDrawLoader: Material name was expected after \"!COLOUR tag' + lineParser.getLineNumberString() + '.',\n )\n }\n\n // Parse tag tokens and their parameters\n let token = null\n while (true) {\n token = lineParser.getToken()\n\n if (!token) {\n break\n }\n\n switch (token.toUpperCase()) {\n case 'CODE':\n code = lineParser.getToken()\n break\n\n case 'VALUE':\n color = lineParser.getToken()\n if (color.startsWith('0x')) {\n color = '#' + color.substring(2)\n } else if (!color.startsWith('#')) {\n throw new Error(\n 'LDrawLoader: Invalid color while parsing material' + lineParser.getLineNumberString() + '.',\n )\n }\n\n break\n\n case 'EDGE':\n edgeColor = lineParser.getToken()\n if (edgeColor.startsWith('0x')) {\n edgeColor = '#' + edgeColor.substring(2)\n } else if (!edgeColor.startsWith('#')) {\n // Try to see if edge color is a color code\n edgeMaterial = this.getMaterial(edgeColor)\n if (!edgeMaterial) {\n throw new Error(\n 'LDrawLoader: Invalid edge color while parsing material' + lineParser.getLineNumberString() + '.',\n )\n }\n\n // Get the edge material for this triangle material\n edgeMaterial = edgeMaterial.userData.edgeMaterial\n }\n\n break\n\n case 'ALPHA':\n alpha = parseInt(lineParser.getToken())\n\n if (isNaN(alpha)) {\n throw new Error(\n 'LDrawLoader: Invalid alpha value in material definition' + lineParser.getLineNumberString() + '.',\n )\n }\n\n alpha = Math.max(0, Math.min(1, alpha / 255))\n\n if (alpha < 1) {\n isTransparent = true\n }\n\n break\n\n case 'LUMINANCE':\n luminance = parseInt(lineParser.getToken())\n\n if (isNaN(luminance)) {\n throw new Error(\n 'LDrawLoader: Invalid luminance value in material definition' + LineParser.getLineNumberString() + '.',\n )\n }\n\n luminance = Math.max(0, Math.min(1, luminance / 255))\n\n break\n\n case 'CHROME':\n finishType = FINISH_TYPE_CHROME\n break\n\n case 'PEARLESCENT':\n finishType = FINISH_TYPE_PEARLESCENT\n break\n\n case 'RUBBER':\n finishType = FINISH_TYPE_RUBBER\n break\n\n case 'MATTE_METALLIC':\n finishType = FINISH_TYPE_MATTE_METALLIC\n break\n\n case 'METAL':\n finishType = FINISH_TYPE_METAL\n break\n\n case 'MATERIAL':\n // Not implemented\n lineParser.setToEnd()\n break\n\n default:\n throw new Error(\n 'LDrawLoader: Unknown token \"' +\n token +\n '\" while parsing material' +\n lineParser.getLineNumberString() +\n '.',\n )\n }\n }\n\n let material = null\n\n switch (finishType) {\n case FINISH_TYPE_DEFAULT:\n material = new MeshStandardMaterial({ color: color, roughness: 0.3, metalness: 0 })\n break\n\n case FINISH_TYPE_PEARLESCENT:\n // Try to imitate pearlescency by making the surface glossy\n material = new MeshStandardMaterial({ color: color, roughness: 0.3, metalness: 0.25 })\n break\n\n case FINISH_TYPE_CHROME:\n // Mirror finish surface\n material = new MeshStandardMaterial({ color: color, roughness: 0, metalness: 1 })\n break\n\n case FINISH_TYPE_RUBBER:\n // Rubber finish\n material = new MeshStandardMaterial({ color: color, roughness: 0.9, metalness: 0 })\n break\n\n case FINISH_TYPE_MATTE_METALLIC:\n // Brushed metal finish\n material = new MeshStandardMaterial({ color: color, roughness: 0.8, metalness: 0.4 })\n break\n\n case FINISH_TYPE_METAL:\n // Average metal finish\n material = new MeshStandardMaterial({ color: color, roughness: 0.2, metalness: 0.85 })\n break\n\n default:\n // Should not happen\n break\n }\n\n material.transparent = isTransparent\n material.premultipliedAlpha = true\n material.opacity = alpha\n material.depthWrite = !isTransparent\n\n material.polygonOffset = true\n material.polygonOffsetFactor = 1\n\n if (luminance !== 0) {\n material.emissive.set(material.color).multiplyScalar(luminance)\n }\n\n if (!edgeMaterial) {\n // This is the material used for edges\n edgeMaterial = new LineBasicMaterial({\n color: edgeColor,\n transparent: isTransparent,\n opacity: alpha,\n depthWrite: !isTransparent,\n })\n edgeMaterial.userData.code = code\n edgeMaterial.name = name + ' - Edge'\n\n // This is the material used for conditional edges\n edgeMaterial.userData.conditionalEdgeMaterial = new LDrawConditionalLineMaterial({\n fog: true,\n transparent: isTransparent,\n depthWrite: !isTransparent,\n color: edgeColor,\n opacity: alpha,\n })\n }\n\n material.userData.code = code\n material.name = name\n\n material.userData.edgeMaterial = edgeMaterial\n\n this.addMaterial(material)\n\n return material\n }\n\n computeConstructionSteps(model) {\n // Sets userdata.constructionStep number in Group objects and userData.numConstructionSteps number in the root Group object.\n\n let stepNumber = 0\n\n model.traverse((c) => {\n if (c.isGroup) {\n if (c.userData.startingConstructionStep) {\n stepNumber++\n }\n\n c.userData.constructionStep = stepNumber\n }\n })\n\n model.userData.numConstructionSteps = stepNumber + 1\n }\n}\n\nexport { LDrawLoader }\n", "import {\n BufferGeometry,\n FileLoader,\n Float32BufferAttribute,\n Group,\n LineBasicMaterial,\n LineSegments,\n Loader,\n Material,\n Mesh,\n MeshPhongMaterial,\n Points,\n PointsMaterial,\n Vector3,\n} from 'three'\n\n// o object_name | g group_name\nconst _object_pattern = /^[og]\\s*(.+)?/\n// mtllib file_reference\nconst _material_library_pattern = /^mtllib /\n// usemtl material_name\nconst _material_use_pattern = /^usemtl /\n// usemap map_name\nconst _map_use_pattern = /^usemap /\n\nconst _vA = new Vector3()\nconst _vB = new Vector3()\nconst _vC = new Vector3()\n\nconst _ab = new Vector3()\nconst _cb = new Vector3()\n\nfunction ParserState() {\n const state = {\n objects: [],\n object: {},\n\n vertices: [],\n normals: [],\n colors: [],\n uvs: [],\n\n materials: {},\n materialLibraries: [],\n\n startObject: function (name, fromDeclaration) {\n // If the current object (initial from reset) is not from a g/o declaration in the parsed\n // file. We need to use it for the first parsed g/o to keep things in sync.\n if (this.object && this.object.fromDeclaration === false) {\n this.object.name = name\n this.object.fromDeclaration = fromDeclaration !== false\n return\n }\n\n const previousMaterial =\n this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined\n\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true)\n }\n\n this.object = {\n name: name || '',\n fromDeclaration: fromDeclaration !== false,\n\n geometry: {\n vertices: [],\n normals: [],\n colors: [],\n uvs: [],\n hasUVIndices: false,\n },\n materials: [],\n smooth: true,\n\n startMaterial: function (name, libraries) {\n const previous = this._finalize(false)\n\n // New usemtl declaration overwrites an inherited material, except if faces were declared\n // after the material, then it must be preserved for proper MultiMaterial continuation.\n if (previous && (previous.inherited || previous.groupCount <= 0)) {\n this.materials.splice(previous.index, 1)\n }\n\n const material = {\n index: this.materials.length,\n name: name || '',\n mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : '',\n smooth: previous !== undefined ? previous.smooth : this.smooth,\n groupStart: previous !== undefined ? previous.groupEnd : 0,\n groupEnd: -1,\n groupCount: -1,\n inherited: false,\n\n clone: function (index) {\n const cloned = {\n index: typeof index === 'number' ? index : this.index,\n name: this.name,\n mtllib: this.mtllib,\n smooth: this.smooth,\n groupStart: 0,\n groupEnd: -1,\n groupCount: -1,\n inherited: false,\n }\n cloned.clone = this.clone.bind(cloned)\n return cloned\n },\n }\n\n this.materials.push(material)\n\n return material\n },\n\n currentMaterial: function () {\n if (this.materials.length > 0) {\n return this.materials[this.materials.length - 1]\n }\n\n return undefined\n },\n\n _finalize: function (end) {\n const lastMultiMaterial = this.currentMaterial()\n if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {\n lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3\n lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart\n lastMultiMaterial.inherited = false\n }\n\n // Ignore objects tail materials if no face declarations followed them before a new o/g started.\n if (end && this.materials.length > 1) {\n for (let mi = this.materials.length - 1; mi >= 0; mi--) {\n if (this.materials[mi].groupCount <= 0) {\n this.materials.splice(mi, 1)\n }\n }\n }\n\n // Guarantee at least one empty material, this makes the creation later more straight forward.\n if (end && this.materials.length === 0) {\n this.materials.push({\n name: '',\n smooth: this.smooth,\n })\n }\n\n return lastMultiMaterial\n },\n }\n\n // Inherit previous objects material.\n // Spec tells us that a declared material must be set to all objects until a new material is declared.\n // If a usemtl declaration is encountered while this new object is being parsed, it will\n // overwrite the inherited material. Exception being that there was already face declarations\n // to the inherited material, then it will be preserved for proper MultiMaterial continuation.\n\n if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {\n const declared = previousMaterial.clone(0)\n declared.inherited = true\n this.object.materials.push(declared)\n }\n\n this.objects.push(this.object)\n },\n\n finalize: function () {\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true)\n }\n },\n\n parseVertexIndex: function (value, len) {\n const index = parseInt(value, 10)\n return (index >= 0 ? index - 1 : index + len / 3) * 3\n },\n\n parseNormalIndex: function (value, len) {\n const index = parseInt(value, 10)\n return (index >= 0 ? index - 1 : index + len / 3) * 3\n },\n\n parseUVIndex: function (value, len) {\n const index = parseInt(value, 10)\n return (index >= 0 ? index - 1 : index + len / 2) * 2\n },\n\n addVertex: function (a, b, c) {\n const src = this.vertices\n const dst = this.object.geometry.vertices\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n dst.push(src[b + 0], src[b + 1], src[b + 2])\n dst.push(src[c + 0], src[c + 1], src[c + 2])\n },\n\n addVertexPoint: function (a) {\n const src = this.vertices\n const dst = this.object.geometry.vertices\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n },\n\n addVertexLine: function (a) {\n const src = this.vertices\n const dst = this.object.geometry.vertices\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n },\n\n addNormal: function (a, b, c) {\n const src = this.normals\n const dst = this.object.geometry.normals\n\n dst.push(src[a + 0], src[a + 1], src[a + 2])\n dst.push(src[b + 0], src[b + 1], src[b + 2])\n dst.push(src[c + 0], src[c + 1], src[c + 2])\n },\n\n addFaceNormal: function (a, b, c) {\n const src = this.vertices\n const dst = this.object.geometry.normals\n\n _vA.fromArray(src, a)\n _vB.fromArray(src, b)\n _vC.fromArray(src, c)\n\n _cb.subVectors(_vC, _vB)\n _ab.subVectors(_vA, _vB)\n _cb.cross(_ab)\n\n _cb.normalize()\n\n dst.push(_cb.x, _cb.y, _cb.z)\n dst.push(_cb.x, _cb.y, _cb.z)\n dst.push(_cb.x, _cb.y, _cb.z)\n },\n\n addColor: function (a, b, c) {\n const src = this.colors\n const dst = this.object.geometry.colors\n\n if (src[a] !== undefined) dst.push(src[a + 0], src[a + 1], src[a + 2])\n if (src[b] !== undefined) dst.push(src[b + 0], src[b + 1], src[b + 2])\n if (src[c] !== undefined) dst.push(src[c + 0], src[c + 1], src[c + 2])\n },\n\n addUV: function (a, b, c) {\n const src = this.uvs\n const dst = this.object.geometry.uvs\n\n dst.push(src[a + 0], src[a + 1])\n dst.push(src[b + 0], src[b + 1])\n dst.push(src[c + 0], src[c + 1])\n },\n\n addDefaultUV: function () {\n const dst = this.object.geometry.uvs\n\n dst.push(0, 0)\n dst.push(0, 0)\n dst.push(0, 0)\n },\n\n addUVLine: function (a) {\n const src = this.uvs\n const dst = this.object.geometry.uvs\n\n dst.push(src[a + 0], src[a + 1])\n },\n\n addFace: function (a, b, c, ua, ub, uc, na, nb, nc) {\n const vLen = this.vertices.length\n\n let ia = this.parseVertexIndex(a, vLen)\n let ib = this.parseVertexIndex(b, vLen)\n let ic = this.parseVertexIndex(c, vLen)\n\n this.addVertex(ia, ib, ic)\n this.addColor(ia, ib, ic)\n\n // normals\n\n if (na !== undefined && na !== '') {\n const nLen = this.normals.length\n\n ia = this.parseNormalIndex(na, nLen)\n ib = this.parseNormalIndex(nb, nLen)\n ic = this.parseNormalIndex(nc, nLen)\n\n this.addNormal(ia, ib, ic)\n } else {\n this.addFaceNormal(ia, ib, ic)\n }\n\n // uvs\n\n if (ua !== undefined && ua !== '') {\n const uvLen = this.uvs.length\n\n ia = this.parseUVIndex(ua, uvLen)\n ib = this.parseUVIndex(ub, uvLen)\n ic = this.parseUVIndex(uc, uvLen)\n\n this.addUV(ia, ib, ic)\n\n this.object.geometry.hasUVIndices = true\n } else {\n // add placeholder values (for inconsistent face definitions)\n\n this.addDefaultUV()\n }\n },\n\n addPointGeometry: function (vertices) {\n this.object.geometry.type = 'Points'\n\n const vLen = this.vertices.length\n\n for (let vi = 0, l = vertices.length; vi < l; vi++) {\n const index = this.parseVertexIndex(vertices[vi], vLen)\n\n this.addVertexPoint(index)\n this.addColor(index)\n }\n },\n\n addLineGeometry: function (vertices, uvs) {\n this.object.geometry.type = 'Line'\n\n const vLen = this.vertices.length\n const uvLen = this.uvs.length\n\n for (let vi = 0, l = vertices.length; vi < l; vi++) {\n this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen))\n }\n\n for (let uvi = 0, l = uvs.length; uvi < l; uvi++) {\n this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen))\n }\n },\n }\n\n state.startObject('', false)\n\n return state\n}\n\n//\n\nclass OBJLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n this.materials = null\n }\n\n load(url, onLoad, onProgress, onError) {\n const scope = this\n\n const loader = new FileLoader(this.manager)\n loader.setPath(this.path)\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n loader.load(\n url,\n function (text) {\n try {\n onLoad(scope.parse(text))\n } catch (e) {\n if (onError) {\n onError(e)\n } else {\n console.error(e)\n }\n\n scope.manager.itemError(url)\n }\n },\n onProgress,\n onError,\n )\n }\n\n setMaterials(materials) {\n this.materials = materials\n\n return this\n }\n\n parse(text) {\n const state = new ParserState()\n\n if (text.indexOf('\\r\\n') !== -1) {\n // This is faster than String.split with regex that splits on both\n text = text.replace(/\\r\\n/g, '\\n')\n }\n\n if (text.indexOf('\\\\\\n') !== -1) {\n // join lines separated by a line continuation character (\\)\n text = text.replace(/\\\\\\n/g, '')\n }\n\n const lines = text.split('\\n')\n let line = '',\n lineFirstChar = ''\n let lineLength = 0\n let result = []\n\n // Faster to just trim left side of the line. Use if available.\n const trimLeft = typeof ''.trimLeft === 'function'\n\n for (let i = 0, l = lines.length; i < l; i++) {\n line = lines[i]\n\n line = trimLeft ? line.trimLeft() : line.trim()\n\n lineLength = line.length\n\n if (lineLength === 0) continue\n\n lineFirstChar = line.charAt(0)\n\n // @todo invoke passed in handler if any\n if (lineFirstChar === '#') continue\n\n if (lineFirstChar === 'v') {\n const data = line.split(/\\s+/)\n\n switch (data[0]) {\n case 'v':\n state.vertices.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]))\n if (data.length >= 7) {\n state.colors.push(parseFloat(data[4]), parseFloat(data[5]), parseFloat(data[6]))\n } else {\n // if no colors are defined, add placeholders so color and vertex indices match\n\n state.colors.push(undefined, undefined, undefined)\n }\n\n break\n case 'vn':\n state.normals.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]))\n break\n case 'vt':\n state.uvs.push(parseFloat(data[1]), parseFloat(data[2]))\n break\n }\n } else if (lineFirstChar === 'f') {\n const lineData = line.substr(1).trim()\n const vertexData = lineData.split(/\\s+/)\n const faceVertices = []\n\n // Parse the face vertex data into an easy to work with format\n\n for (let j = 0, jl = vertexData.length; j < jl; j++) {\n const vertex = vertexData[j]\n\n if (vertex.length > 0) {\n const vertexParts = vertex.split('/')\n faceVertices.push(vertexParts)\n }\n }\n\n // Draw an edge between the first vertex and all subsequent vertices to form an n-gon\n\n const v1 = faceVertices[0]\n\n for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) {\n const v2 = faceVertices[j]\n const v3 = faceVertices[j + 1]\n\n state.addFace(v1[0], v2[0], v3[0], v1[1], v2[1], v3[1], v1[2], v2[2], v3[2])\n }\n } else if (lineFirstChar === 'l') {\n const lineParts = line.substring(1).trim().split(' ')\n let lineVertices = []\n const lineUVs = []\n\n if (line.indexOf('/') === -1) {\n lineVertices = lineParts\n } else {\n for (let li = 0, llen = lineParts.length; li < llen; li++) {\n const parts = lineParts[li].split('/')\n\n if (parts[0] !== '') lineVertices.push(parts[0])\n if (parts[1] !== '') lineUVs.push(parts[1])\n }\n }\n\n state.addLineGeometry(lineVertices, lineUVs)\n } else if (lineFirstChar === 'p') {\n const lineData = line.substr(1).trim()\n const pointData = lineData.split(' ')\n\n state.addPointGeometry(pointData)\n } else if ((result = _object_pattern.exec(line)) !== null) {\n // o object_name\n // or\n // g group_name\n\n // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869\n // let name = result[ 0 ].substr( 1 ).trim();\n const name = (' ' + result[0].substr(1).trim()).substr(1)\n\n state.startObject(name)\n } else if (_material_use_pattern.test(line)) {\n // material\n\n state.object.startMaterial(line.substring(7).trim(), state.materialLibraries)\n } else if (_material_library_pattern.test(line)) {\n // mtl file\n\n state.materialLibraries.push(line.substring(7).trim())\n } else if (_map_use_pattern.test(line)) {\n // the line is parsed but ignored since the loader assumes textures are defined MTL files\n // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method)\n\n console.warn(\n 'THREE.OBJLoader: Rendering identifier \"usemap\" not supported. Textures must be defined in MTL files.',\n )\n } else if (lineFirstChar === 's') {\n result = line.split(' ')\n\n // smooth shading\n\n // @todo Handle files that have varying smooth values for a set of faces inside one geometry,\n // but does not define a usemtl for each face set.\n // This should be detected and a dummy material created (later MultiMaterial and geometry groups).\n // This requires some care to not create extra material on each smooth value for \"normal\" obj files.\n // where explicit usemtl defines geometry groups.\n // Example asset: examples/models/obj/cerberus/Cerberus.obj\n\n /*\n * http://paulbourke.net/dataformats/obj/\n * or\n * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf\n *\n * From chapter \"Grouping\" Syntax explanation \"s group_number\":\n * \"group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.\n * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form\n * surfaces, smoothing groups are either turned on or off; there is no difference between values greater\n * than 0.\"\n */\n if (result.length > 1) {\n const value = result[1].trim().toLowerCase()\n state.object.smooth = value !== '0' && value !== 'off'\n } else {\n // ZBrush can produce \"s\" lines #11707\n state.object.smooth = true\n }\n\n const material = state.object.currentMaterial()\n if (material) material.smooth = state.object.smooth\n } else {\n // Handle null terminated files without exception\n if (line === '\\0') continue\n\n console.warn('THREE.OBJLoader: Unexpected line: \"' + line + '\"')\n }\n }\n\n state.finalize()\n\n const container = new Group()\n container.materialLibraries = [].concat(state.materialLibraries)\n\n const hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0)\n\n if (hasPrimitives === true) {\n for (let i = 0, l = state.objects.length; i < l; i++) {\n const object = state.objects[i]\n const geometry = object.geometry\n const materials = object.materials\n const isLine = geometry.type === 'Line'\n const isPoints = geometry.type === 'Points'\n let hasVertexColors = false\n\n // Skip o/g line declarations that did not follow with any faces\n if (geometry.vertices.length === 0) continue\n\n const buffergeometry = new BufferGeometry()\n\n buffergeometry.setAttribute('position', new Float32BufferAttribute(geometry.vertices, 3))\n\n if (geometry.normals.length > 0) {\n buffergeometry.setAttribute('normal', new Float32BufferAttribute(geometry.normals, 3))\n }\n\n if (geometry.colors.length > 0) {\n hasVertexColors = true\n buffergeometry.setAttribute('color', new Float32BufferAttribute(geometry.colors, 3))\n }\n\n if (geometry.hasUVIndices === true) {\n buffergeometry.setAttribute('uv', new Float32BufferAttribute(geometry.uvs, 2))\n }\n\n // Create materials\n\n const createdMaterials = []\n\n for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {\n const sourceMaterial = materials[mi]\n const materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors\n let material = state.materials[materialHash]\n\n if (this.materials !== null) {\n material = this.materials.create(sourceMaterial.name)\n\n // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.\n if (isLine && material && !(material instanceof LineBasicMaterial)) {\n const materialLine = new LineBasicMaterial()\n Material.prototype.copy.call(materialLine, material)\n materialLine.color.copy(material.color)\n material = materialLine\n } else if (isPoints && material && !(material instanceof PointsMaterial)) {\n const materialPoints = new PointsMaterial({ size: 10, sizeAttenuation: false })\n Material.prototype.copy.call(materialPoints, material)\n materialPoints.color.copy(material.color)\n materialPoints.map = material.map\n material = materialPoints\n }\n }\n\n if (material === undefined) {\n if (isLine) {\n material = new LineBasicMaterial()\n } else if (isPoints) {\n material = new PointsMaterial({ size: 1, sizeAttenuation: false })\n } else {\n material = new MeshPhongMaterial()\n }\n\n material.name = sourceMaterial.name\n material.flatShading = sourceMaterial.smooth ? false : true\n material.vertexColors = hasVertexColors\n\n state.materials[materialHash] = material\n }\n\n createdMaterials.push(material)\n }\n\n // Create mesh\n\n let mesh\n\n if (createdMaterials.length > 1) {\n for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {\n const sourceMaterial = materials[mi]\n buffergeometry.addGroup(sourceMaterial.groupStart, sourceMaterial.groupCount, mi)\n }\n\n if (isLine) {\n mesh = new LineSegments(buffergeometry, createdMaterials)\n } else if (isPoints) {\n mesh = new Points(buffergeometry, createdMaterials)\n } else {\n mesh = new Mesh(buffergeometry, createdMaterials)\n }\n } else {\n if (isLine) {\n mesh = new LineSegments(buffergeometry, createdMaterials[0])\n } else if (isPoints) {\n mesh = new Points(buffergeometry, createdMaterials[0])\n } else {\n mesh = new Mesh(buffergeometry, createdMaterials[0])\n }\n }\n\n mesh.name = object.name\n\n container.add(mesh)\n }\n } else {\n // if there is only the default parser state object with no geometry data, interpret data as point cloud\n\n if (state.vertices.length > 0) {\n const material = new PointsMaterial({ size: 1, sizeAttenuation: false })\n\n const buffergeometry = new BufferGeometry()\n\n buffergeometry.setAttribute('position', new Float32BufferAttribute(state.vertices, 3))\n\n if (state.colors.length > 0 && state.colors[0] !== undefined) {\n buffergeometry.setAttribute('color', new Float32BufferAttribute(state.colors, 3))\n material.vertexColors = true\n }\n\n const points = new Points(buffergeometry, material)\n container.add(points)\n }\n }\n\n return container\n }\n}\n\nexport { OBJLoader }\n", "import { CompressedTextureLoader } from 'three'\n\n/**\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\n *\n * ported from https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.khronosTextureContainer.ts\n */\n\nclass KTXLoader extends CompressedTextureLoader {\n constructor(manager) {\n super(manager)\n }\n\n parse(buffer, loadMipmaps) {\n const ktx = new KhronosTextureContainer(buffer, 1)\n\n return {\n mipmaps: ktx.mipmaps(loadMipmaps),\n width: ktx.pixelWidth,\n height: ktx.pixelHeight,\n format: ktx.glInternalFormat,\n isCubemap: ktx.numberOfFaces === 6,\n mipmapCount: ktx.numberOfMipmapLevels,\n }\n }\n}\n\nconst HEADER_LEN = 12 + 13 * 4 // identifier + header elements (not including key value meta-data pairs)\n// load types\nconst COMPRESSED_2D = 0 // uses a gl.compressedTexImage2D()\n//const COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\n//const TEX_2D = 2; // uses a gl.texImage2D()\n//const TEX_3D = 3; // uses a gl.texImage3D()\n\nclass KhronosTextureContainer {\n /**\n * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file\n * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or\n * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented\n * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented\n */\n constructor(arrayBuffer, facesExpected /*, threeDExpected, textureArrayExpected */) {\n this.arrayBuffer = arrayBuffer\n\n // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is:\n // '´', 'K', 'T', 'X', ' ', '1', '1', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A\n const identifier = new Uint8Array(this.arrayBuffer, 0, 12)\n if (\n identifier[0] !== 0xab ||\n identifier[1] !== 0x4b ||\n identifier[2] !== 0x54 ||\n identifier[3] !== 0x58 ||\n identifier[4] !== 0x20 ||\n identifier[5] !== 0x31 ||\n identifier[6] !== 0x31 ||\n identifier[7] !== 0xbb ||\n identifier[8] !== 0x0d ||\n identifier[9] !== 0x0a ||\n identifier[10] !== 0x1a ||\n identifier[11] !== 0x0a\n ) {\n console.error('texture missing KTX identifier')\n return\n }\n\n // load the reset of the header in native 32 bit uint\n const dataSize = Uint32Array.BYTES_PER_ELEMENT\n const headerDataView = new DataView(this.arrayBuffer, 12, 13 * dataSize)\n const endianness = headerDataView.getUint32(0, true)\n const littleEndian = endianness === 0x04030201\n\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian) // must be 0 for compressed textures\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian) // must be 1 for compressed textures\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian) // must be 0 for compressed textures\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian) // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian) // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian) // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian) // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian) // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian) // used for texture arrays\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian) // used for cubemap textures, should either be 1 or 6\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian) // number of levels; disregard possibility of 0 for compressed textures\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian) // the amount of space after the header for meta-data\n\n // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing.\n if (this.glType !== 0) {\n console.warn('only compressed formats currently supported')\n return\n } else {\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels)\n }\n\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\n console.warn('only 2D textures currently supported')\n return\n }\n\n if (this.numberOfArrayElements !== 0) {\n console.warn('texture arrays not currently supported')\n return\n }\n\n if (this.numberOfFaces !== facesExpected) {\n console.warn('number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces)\n return\n }\n\n // we now have a completely validated file, so could use existence of loadType as success\n // would need to make this more elaborate & adjust checks above to support more than one load type\n this.loadType = COMPRESSED_2D\n }\n\n mipmaps(loadMipmaps) {\n const mipmaps = []\n\n // initialize width & height for level 1\n let dataOffset = HEADER_LEN + this.bytesOfKeyValueData\n let width = this.pixelWidth\n let height = this.pixelHeight\n const mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1\n\n for (let level = 0; level < mipmapCount; level++) {\n const imageSize = new Int32Array(this.arrayBuffer, dataOffset, 1)[0] // size per face, since not supporting array cubemaps\n dataOffset += 4 // size of the image + 4 for the imageSize field\n\n for (let face = 0; face < this.numberOfFaces; face++) {\n const byteArray = new Uint8Array(this.arrayBuffer, dataOffset, imageSize)\n\n mipmaps.push({ data: byteArray, width: width, height: height })\n\n dataOffset += imageSize\n dataOffset += 3 - ((imageSize + 3) % 4) // add padding for odd sized image\n }\n\n width = Math.max(1.0, width * 0.5)\n height = Math.max(1.0, height * 0.5)\n }\n\n return mipmaps\n }\n}\n\nexport { KTXLoader }\n", "import { BufferAttribute, BufferGeometry, FileLoader, Loader } from 'three'\n\nconst _taskCache = new WeakMap()\n\nclass DRACOLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n this.decoderPath = ''\n this.decoderConfig = {}\n this.decoderBinary = null\n this.decoderPending = null\n\n this.workerLimit = 4\n this.workerPool = []\n this.workerNextTaskID = 1\n this.workerSourceURL = ''\n\n this.defaultAttributeIDs = {\n position: 'POSITION',\n normal: 'NORMAL',\n color: 'COLOR',\n uv: 'TEX_COORD',\n }\n this.defaultAttributeTypes = {\n position: 'Float32Array',\n normal: 'Float32Array',\n color: 'Float32Array',\n uv: 'Float32Array',\n }\n }\n\n setDecoderPath(path) {\n this.decoderPath = path\n\n return this\n }\n\n setDecoderConfig(config) {\n this.decoderConfig = config\n\n return this\n }\n\n setWorkerLimit(workerLimit) {\n this.workerLimit = workerLimit\n\n return this\n }\n\n load(url, onLoad, onProgress, onError) {\n const loader = new FileLoader(this.manager)\n\n loader.setPath(this.path)\n loader.setResponseType('arraybuffer')\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n (buffer) => {\n const taskConfig = {\n attributeIDs: this.defaultAttributeIDs,\n attributeTypes: this.defaultAttributeTypes,\n useUniqueIDs: false,\n }\n\n this.decodeGeometry(buffer, taskConfig).then(onLoad).catch(onError)\n },\n onProgress,\n onError,\n )\n }\n\n /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */\n decodeDracoFile(buffer, callback, attributeIDs, attributeTypes) {\n const taskConfig = {\n attributeIDs: attributeIDs || this.defaultAttributeIDs,\n attributeTypes: attributeTypes || this.defaultAttributeTypes,\n useUniqueIDs: !!attributeIDs,\n }\n\n this.decodeGeometry(buffer, taskConfig).then(callback)\n }\n\n decodeGeometry(buffer, taskConfig) {\n // TODO: For backward-compatibility, support 'attributeTypes' objects containing\n // references (rather than names) to typed array constructors. These must be\n // serialized before sending them to the worker.\n for (const attribute in taskConfig.attributeTypes) {\n const type = taskConfig.attributeTypes[attribute]\n\n if (type.BYTES_PER_ELEMENT !== undefined) {\n taskConfig.attributeTypes[attribute] = type.name\n }\n }\n\n //\n\n const taskKey = JSON.stringify(taskConfig)\n\n // Check for an existing task using this buffer. A transferred buffer cannot be transferred\n // again from this thread.\n if (_taskCache.has(buffer)) {\n const cachedTask = _taskCache.get(buffer)\n\n if (cachedTask.key === taskKey) {\n return cachedTask.promise\n } else if (buffer.byteLength === 0) {\n // Technically, it would be possible to wait for the previous task to complete,\n // transfer the buffer back, and decode again with the second configuration. That\n // is complex, and I don't know of any reason to decode a Draco buffer twice in\n // different ways, so this is left unimplemented.\n throw new Error(\n 'THREE.DRACOLoader: Unable to re-decode a buffer with different ' +\n 'settings. Buffer has already been transferred.',\n )\n }\n }\n\n //\n\n let worker\n const taskID = this.workerNextTaskID++\n const taskCost = buffer.byteLength\n\n // Obtain a worker and assign a task, and construct a geometry instance\n // when the task completes.\n const geometryPending = this._getWorker(taskID, taskCost)\n .then((_worker) => {\n worker = _worker\n\n return new Promise((resolve, reject) => {\n worker._callbacks[taskID] = { resolve, reject }\n\n worker.postMessage({ type: 'decode', id: taskID, taskConfig, buffer }, [buffer])\n\n // this.debug();\n })\n })\n .then((message) => this._createGeometry(message.geometry))\n\n // Remove task from the task list.\n // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)\n geometryPending\n .catch(() => true)\n .then(() => {\n if (worker && taskID) {\n this._releaseTask(worker, taskID)\n\n // this.debug();\n }\n })\n\n // Cache the task result.\n _taskCache.set(buffer, {\n key: taskKey,\n promise: geometryPending,\n })\n\n return geometryPending\n }\n\n _createGeometry(geometryData) {\n const geometry = new BufferGeometry()\n\n if (geometryData.index) {\n geometry.setIndex(new BufferAttribute(geometryData.index.array, 1))\n }\n\n for (let i = 0; i < geometryData.attributes.length; i++) {\n const attribute = geometryData.attributes[i]\n const name = attribute.name\n const array = attribute.array\n const itemSize = attribute.itemSize\n\n geometry.setAttribute(name, new BufferAttribute(array, itemSize))\n }\n\n return geometry\n }\n\n _loadLibrary(url, responseType) {\n const loader = new FileLoader(this.manager)\n loader.setPath(this.decoderPath)\n loader.setResponseType(responseType)\n loader.setWithCredentials(this.withCredentials)\n\n return new Promise((resolve, reject) => {\n loader.load(url, resolve, undefined, reject)\n })\n }\n\n preload() {\n this._initDecoder()\n\n return this\n }\n\n _initDecoder() {\n if (this.decoderPending) return this.decoderPending\n\n const useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js'\n const librariesPending = []\n\n if (useJS) {\n librariesPending.push(this._loadLibrary('draco_decoder.js', 'text'))\n } else {\n librariesPending.push(this._loadLibrary('draco_wasm_wrapper.js', 'text'))\n librariesPending.push(this._loadLibrary('draco_decoder.wasm', 'arraybuffer'))\n }\n\n this.decoderPending = Promise.all(librariesPending).then((libraries) => {\n const jsContent = libraries[0]\n\n if (!useJS) {\n this.decoderConfig.wasmBinary = libraries[1]\n }\n\n const fn = DRACOWorker.toString()\n\n const body = [\n '/* draco decoder */',\n jsContent,\n '',\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}')),\n ].join('\\n')\n\n this.workerSourceURL = URL.createObjectURL(new Blob([body]))\n })\n\n return this.decoderPending\n }\n\n _getWorker(taskID, taskCost) {\n return this._initDecoder().then(() => {\n if (this.workerPool.length < this.workerLimit) {\n const worker = new Worker(this.workerSourceURL)\n\n worker._callbacks = {}\n worker._taskCosts = {}\n worker._taskLoad = 0\n\n worker.postMessage({ type: 'init', decoderConfig: this.decoderConfig })\n\n worker.onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'decode':\n worker._callbacks[message.id].resolve(message)\n break\n\n case 'error':\n worker._callbacks[message.id].reject(message)\n break\n\n default:\n console.error('THREE.DRACOLoader: Unexpected message, \"' + message.type + '\"')\n }\n }\n\n this.workerPool.push(worker)\n } else {\n this.workerPool.sort(function (a, b) {\n return a._taskLoad > b._taskLoad ? -1 : 1\n })\n }\n\n const worker = this.workerPool[this.workerPool.length - 1]\n worker._taskCosts[taskID] = taskCost\n worker._taskLoad += taskCost\n return worker\n })\n }\n\n _releaseTask(worker, taskID) {\n worker._taskLoad -= worker._taskCosts[taskID]\n delete worker._callbacks[taskID]\n delete worker._taskCosts[taskID]\n }\n\n debug() {\n console.log(\n 'Task load: ',\n this.workerPool.map((worker) => worker._taskLoad),\n )\n }\n\n dispose() {\n for (let i = 0; i < this.workerPool.length; ++i) {\n this.workerPool[i].terminate()\n }\n\n this.workerPool.length = 0\n\n return this\n }\n}\n\n/* WEB WORKER */\n\nfunction DRACOWorker() {\n let decoderConfig\n let decoderPending\n\n onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'init':\n decoderConfig = message.decoderConfig\n decoderPending = new Promise(function (resolve /*, reject*/) {\n decoderConfig.onModuleLoaded = function (draco) {\n // Module is Promise-like. Wrap before resolving to avoid loop.\n resolve({ draco: draco })\n }\n\n DracoDecoderModule(decoderConfig)\n })\n break\n\n case 'decode':\n const buffer = message.buffer\n const taskConfig = message.taskConfig\n decoderPending.then((module) => {\n const draco = module.draco\n const decoder = new draco.Decoder()\n const decoderBuffer = new draco.DecoderBuffer()\n decoderBuffer.Init(new Int8Array(buffer), buffer.byteLength)\n\n try {\n const geometry = decodeGeometry(draco, decoder, decoderBuffer, taskConfig)\n\n const buffers = geometry.attributes.map((attr) => attr.array.buffer)\n\n if (geometry.index) buffers.push(geometry.index.array.buffer)\n\n self.postMessage({ type: 'decode', id: message.id, geometry }, buffers)\n } catch (error) {\n console.error(error)\n\n self.postMessage({ type: 'error', id: message.id, error: error.message })\n } finally {\n draco.destroy(decoderBuffer)\n draco.destroy(decoder)\n }\n })\n break\n }\n }\n\n function decodeGeometry(draco, decoder, decoderBuffer, taskConfig) {\n const attributeIDs = taskConfig.attributeIDs\n const attributeTypes = taskConfig.attributeTypes\n\n let dracoGeometry\n let decodingStatus\n\n const geometryType = decoder.GetEncodedGeometryType(decoderBuffer)\n\n if (geometryType === draco.TRIANGULAR_MESH) {\n dracoGeometry = new draco.Mesh()\n decodingStatus = decoder.DecodeBufferToMesh(decoderBuffer, dracoGeometry)\n } else if (geometryType === draco.POINT_CLOUD) {\n dracoGeometry = new draco.PointCloud()\n decodingStatus = decoder.DecodeBufferToPointCloud(decoderBuffer, dracoGeometry)\n } else {\n throw new Error('THREE.DRACOLoader: Unexpected geometry type.')\n }\n\n if (!decodingStatus.ok() || dracoGeometry.ptr === 0) {\n throw new Error('THREE.DRACOLoader: Decoding failed: ' + decodingStatus.error_msg())\n }\n\n const geometry = { index: null, attributes: [] }\n\n // Gather all vertex attributes.\n for (const attributeName in attributeIDs) {\n const attributeType = self[attributeTypes[attributeName]]\n\n let attribute\n let attributeID\n\n // A Draco file may be created with default vertex attributes, whose attribute IDs\n // are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,\n // a Draco file may contain a custom set of attributes, identified by known unique\n // IDs. glTF files always do the latter, and `.drc` files typically do the former.\n if (taskConfig.useUniqueIDs) {\n attributeID = attributeIDs[attributeName]\n attribute = decoder.GetAttributeByUniqueId(dracoGeometry, attributeID)\n } else {\n attributeID = decoder.GetAttributeId(dracoGeometry, draco[attributeIDs[attributeName]])\n\n if (attributeID === -1) continue\n\n attribute = decoder.GetAttribute(dracoGeometry, attributeID)\n }\n\n geometry.attributes.push(decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute))\n }\n\n // Add index.\n if (geometryType === draco.TRIANGULAR_MESH) {\n geometry.index = decodeIndex(draco, decoder, dracoGeometry)\n }\n\n draco.destroy(dracoGeometry)\n\n return geometry\n }\n\n function decodeIndex(draco, decoder, dracoGeometry) {\n const numFaces = dracoGeometry.num_faces()\n const numIndices = numFaces * 3\n const byteLength = numIndices * 4\n\n const ptr = draco._malloc(byteLength)\n decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr)\n const index = new Uint32Array(draco.HEAPF32.buffer, ptr, numIndices).slice()\n draco._free(ptr)\n\n return { array: index, itemSize: 1 }\n }\n\n function decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute) {\n const numComponents = attribute.num_components()\n const numPoints = dracoGeometry.num_points()\n const numValues = numPoints * numComponents\n const byteLength = numValues * attributeType.BYTES_PER_ELEMENT\n const dataType = getDracoDataType(draco, attributeType)\n\n const ptr = draco._malloc(byteLength)\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, dataType, byteLength, ptr)\n const array = new attributeType(draco.HEAPF32.buffer, ptr, numValues).slice()\n draco._free(ptr)\n\n return {\n name: attributeName,\n array: array,\n itemSize: numComponents,\n }\n }\n\n function getDracoDataType(draco, attributeType) {\n switch (attributeType) {\n case Float32Array:\n return draco.DT_FLOAT32\n case Int8Array:\n return draco.DT_INT8\n case Int16Array:\n return draco.DT_INT16\n case Int32Array:\n return draco.DT_INT32\n case Uint8Array:\n return draco.DT_UINT8\n case Uint16Array:\n return draco.DT_UINT16\n case Uint32Array:\n return draco.DT_UINT32\n }\n }\n}\n\nexport { DRACOLoader }\n", "class LWO2Parser {\n constructor(IFFParser) {\n this.IFF = IFFParser\n }\n\n parseBlock() {\n this.IFF.debugger.offset = this.IFF.reader.offset\n this.IFF.debugger.closeForms()\n\n const blockID = this.IFF.reader.getIDTag()\n let length = this.IFF.reader.getUint32() // size of data in bytes\n if (length > this.IFF.reader.dv.byteLength - this.IFF.reader.offset) {\n this.IFF.reader.offset -= 4\n length = this.IFF.reader.getUint16()\n }\n\n this.IFF.debugger.dataOffset = this.IFF.reader.offset\n this.IFF.debugger.length = length\n\n // Data types may be found in either LWO2 OR LWO3 spec\n switch (blockID) {\n case 'FORM': // form blocks may consist of sub -chunks or sub-forms\n this.IFF.parseForm(length)\n break\n\n // SKIPPED CHUNKS\n // if break; is called directly, the position in the lwoTree is not created\n // any sub chunks and forms are added to the parent form instead\n // MISC skipped\n case 'ICON': // Thumbnail Icon Image\n case 'VMPA': // Vertex Map Parameter\n case 'BBOX': // bounding box\n // case 'VMMD':\n // case 'VTYP':\n\n // normal maps can be specified, normally on models imported from other applications. Currently ignored\n case 'NORM':\n\n // ENVL FORM skipped\n case 'PRE ':\n case 'POST':\n case 'KEY ':\n case 'SPAN':\n\n // CLIP FORM skipped\n case 'TIME':\n case 'CLRS':\n case 'CLRA':\n case 'FILT':\n case 'DITH':\n case 'CONT':\n case 'BRIT':\n case 'SATR':\n case 'HUE ':\n case 'GAMM':\n case 'NEGA':\n case 'IFLT':\n case 'PFLT':\n\n // Image Map Layer skipped\n case 'PROJ':\n case 'AXIS':\n case 'AAST':\n case 'PIXB':\n case 'AUVO':\n case 'STCK':\n\n // Procedural Textures skipped\n case 'PROC':\n case 'VALU':\n case 'FUNC':\n\n // Gradient Textures skipped\n case 'PNAM':\n case 'INAM':\n case 'GRST':\n case 'GREN':\n case 'GRPT':\n case 'FKEY':\n case 'IKEY':\n\n // Texture Mapping Form skipped\n case 'CSYS':\n\n // Surface CHUNKs skipped\n case 'OPAQ': // top level 'opacity' checkbox\n case 'CMAP': // clip map\n\n // Surface node CHUNKS skipped\n // These mainly specify the node editor setup in LW\n case 'NLOC':\n case 'NZOM':\n case 'NVER':\n case 'NSRV':\n case 'NVSK': // unknown\n case 'NCRD':\n case 'WRPW': // image wrap w ( for cylindrical and spherical projections)\n case 'WRPH': // image wrap h\n case 'NMOD':\n case 'NSEL':\n case 'NPRW':\n case 'NPLA':\n case 'NODS':\n case 'VERS':\n case 'ENUM':\n case 'TAG ':\n case 'OPAC':\n\n // Car Material CHUNKS\n case 'CGMD':\n case 'CGTY':\n case 'CGST':\n case 'CGEN':\n case 'CGTS':\n case 'CGTE':\n case 'OSMP':\n case 'OMDE':\n case 'OUTR':\n case 'FLAG':\n\n case 'TRNL':\n case 'GLOW':\n case 'GVAL': // glow intensity\n case 'SHRP':\n case 'RFOP':\n case 'RSAN':\n case 'TROP':\n case 'RBLR':\n case 'TBLR':\n case 'CLRH':\n case 'CLRF':\n case 'ADTR':\n case 'LINE':\n case 'ALPH':\n case 'VCOL':\n case 'ENAB':\n this.IFF.debugger.skipped = true\n this.IFF.reader.skip(length)\n break\n\n case 'SURF':\n this.IFF.parseSurfaceLwo2(length)\n break\n\n case 'CLIP':\n this.IFF.parseClipLwo2(length)\n break\n\n // Texture node chunks (not in spec)\n case 'IPIX': // usePixelBlending\n case 'IMIP': // useMipMaps\n case 'IMOD': // imageBlendingMode\n case 'AMOD': // unknown\n case 'IINV': // imageInvertAlpha\n case 'INCR': // imageInvertColor\n case 'IAXS': // imageAxis ( for non-UV maps)\n case 'IFOT': // imageFallofType\n case 'ITIM': // timing for animated textures\n case 'IWRL':\n case 'IUTI':\n case 'IINX':\n case 'IINY':\n case 'IINZ':\n case 'IREF': // possibly a VX for reused texture nodes\n if (length === 4) this.IFF.currentNode[blockID] = this.IFF.reader.getInt32()\n else this.IFF.reader.skip(length)\n break\n\n case 'OTAG':\n this.IFF.parseObjectTag()\n break\n\n case 'LAYR':\n this.IFF.parseLayer(length)\n break\n\n case 'PNTS':\n this.IFF.parsePoints(length)\n break\n\n case 'VMAP':\n this.IFF.parseVertexMapping(length)\n break\n\n case 'AUVU':\n case 'AUVN':\n this.IFF.reader.skip(length - 1)\n this.IFF.reader.getVariableLengthIndex() // VX\n break\n\n case 'POLS':\n this.IFF.parsePolygonList(length)\n break\n\n case 'TAGS':\n this.IFF.parseTagStrings(length)\n break\n\n case 'PTAG':\n this.IFF.parsePolygonTagMapping(length)\n break\n\n case 'VMAD':\n this.IFF.parseVertexMapping(length, true)\n break\n\n // Misc CHUNKS\n case 'DESC': // Description Line\n this.IFF.currentForm.description = this.IFF.reader.getString()\n break\n\n case 'TEXT':\n case 'CMNT':\n case 'NCOM':\n this.IFF.currentForm.comment = this.IFF.reader.getString()\n break\n\n // Envelope Form\n case 'NAME':\n this.IFF.currentForm.channelName = this.IFF.reader.getString()\n break\n\n // Image Map Layer\n case 'WRAP':\n this.IFF.currentForm.wrap = { w: this.IFF.reader.getUint16(), h: this.IFF.reader.getUint16() }\n break\n\n case 'IMAG':\n const index = this.IFF.reader.getVariableLengthIndex()\n this.IFF.currentForm.imageIndex = index\n break\n\n // Texture Mapping Form\n case 'OREF':\n this.IFF.currentForm.referenceObject = this.IFF.reader.getString()\n break\n\n case 'ROID':\n this.IFF.currentForm.referenceObjectID = this.IFF.reader.getUint32()\n break\n\n // Surface Blocks\n case 'SSHN':\n this.IFF.currentSurface.surfaceShaderName = this.IFF.reader.getString()\n break\n\n case 'AOVN':\n this.IFF.currentSurface.surfaceCustomAOVName = this.IFF.reader.getString()\n break\n\n // Nodal Blocks\n case 'NSTA':\n this.IFF.currentForm.disabled = this.IFF.reader.getUint16()\n break\n\n case 'NRNM':\n this.IFF.currentForm.realName = this.IFF.reader.getString()\n break\n\n case 'NNME':\n this.IFF.currentForm.refName = this.IFF.reader.getString()\n this.IFF.currentSurface.nodes[this.IFF.currentForm.refName] = this.IFF.currentForm\n break\n\n // Nodal Blocks : connections\n case 'INME':\n if (!this.IFF.currentForm.nodeName) this.IFF.currentForm.nodeName = []\n this.IFF.currentForm.nodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINN':\n if (!this.IFF.currentForm.inputNodeName) this.IFF.currentForm.inputNodeName = []\n this.IFF.currentForm.inputNodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINM':\n if (!this.IFF.currentForm.inputName) this.IFF.currentForm.inputName = []\n this.IFF.currentForm.inputName.push(this.IFF.reader.getString())\n break\n\n case 'IONM':\n if (!this.IFF.currentForm.inputOutputName) this.IFF.currentForm.inputOutputName = []\n this.IFF.currentForm.inputOutputName.push(this.IFF.reader.getString())\n break\n\n case 'FNAM':\n this.IFF.currentForm.fileName = this.IFF.reader.getString()\n break\n\n case 'CHAN': // NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored\n if (length === 4) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag()\n else this.IFF.reader.skip(length)\n break\n\n // LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format\n case 'SMAN':\n const maxSmoothingAngle = this.IFF.reader.getFloat32()\n this.IFF.currentSurface.attributes.smooth = maxSmoothingAngle < 0 ? false : true\n break\n\n // LWO2: Basic Surface Parameters\n case 'COLR':\n this.IFF.currentSurface.attributes.Color = { value: this.IFF.reader.getFloat32Array(3) }\n this.IFF.reader.skip(2) // VX: envelope\n break\n\n case 'LUMI':\n this.IFF.currentSurface.attributes.Luminosity = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'SPEC':\n this.IFF.currentSurface.attributes.Specular = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'DIFF':\n this.IFF.currentSurface.attributes.Diffuse = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'REFL':\n this.IFF.currentSurface.attributes.Reflection = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'GLOS':\n this.IFF.currentSurface.attributes.Glossiness = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'TRAN':\n this.IFF.currentSurface.attributes.opacity = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'BUMP':\n this.IFF.currentSurface.attributes.bumpStrength = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'SIDE':\n this.IFF.currentSurface.attributes.side = this.IFF.reader.getUint16()\n break\n\n case 'RIMG':\n this.IFF.currentSurface.attributes.reflectionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'RIND':\n this.IFF.currentSurface.attributes.refractiveIndex = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'TIMG':\n this.IFF.currentSurface.attributes.refractionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'IMAP':\n this.IFF.reader.skip(2)\n break\n\n case 'TMAP':\n this.IFF.debugger.skipped = true\n this.IFF.reader.skip(length) // needs implementing\n break\n\n case 'IUVI': // uv channel name\n this.IFF.currentNode.UVChannel = this.IFF.reader.getString(length)\n break\n\n case 'IUTL': // widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge\n this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32()\n break\n case 'IVTL': // heightWrappingMode\n this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32()\n break\n\n // LWO2 USE\n case 'BLOK':\n // skip\n break\n\n default:\n this.IFF.parseUnknownCHUNK(blockID, length)\n }\n\n if (blockID != 'FORM') {\n this.IFF.debugger.node = 1\n this.IFF.debugger.nodeID = blockID\n this.IFF.debugger.log()\n }\n\n if (this.IFF.reader.offset >= this.IFF.currentFormEnd) {\n this.IFF.currentForm = this.IFF.parentForm\n }\n }\n}\n\nexport { LWO2Parser }\n", "class LWO3Parser {\n constructor(IFFParser) {\n this.IFF = IFFParser\n }\n\n parseBlock() {\n this.IFF.debugger.offset = this.IFF.reader.offset\n this.IFF.debugger.closeForms()\n\n const blockID = this.IFF.reader.getIDTag()\n const length = this.IFF.reader.getUint32() // size of data in bytes\n\n this.IFF.debugger.dataOffset = this.IFF.reader.offset\n this.IFF.debugger.length = length\n\n // Data types may be found in either LWO2 OR LWO3 spec\n switch (blockID) {\n case 'FORM': // form blocks may consist of sub -chunks or sub-forms\n this.IFF.parseForm(length)\n break\n\n // SKIPPED CHUNKS\n // MISC skipped\n case 'ICON': // Thumbnail Icon Image\n case 'VMPA': // Vertex Map Parameter\n case 'BBOX': // bounding box\n // case 'VMMD':\n // case 'VTYP':\n\n // normal maps can be specified, normally on models imported from other applications. Currently ignored\n case 'NORM':\n\n // ENVL FORM skipped\n case 'PRE ': // Pre-loop behavior for the keyframe\n case 'POST': // Post-loop behavior for the keyframe\n case 'KEY ':\n case 'SPAN':\n\n // CLIP FORM skipped\n case 'TIME':\n case 'CLRS':\n case 'CLRA':\n case 'FILT':\n case 'DITH':\n case 'CONT':\n case 'BRIT':\n case 'SATR':\n case 'HUE ':\n case 'GAMM':\n case 'NEGA':\n case 'IFLT':\n case 'PFLT':\n\n // Image Map Layer skipped\n case 'PROJ':\n case 'AXIS':\n case 'AAST':\n case 'PIXB':\n case 'STCK':\n\n // Procedural Textures skipped\n case 'VALU':\n\n // Gradient Textures skipped\n case 'PNAM':\n case 'INAM':\n case 'GRST':\n case 'GREN':\n case 'GRPT':\n case 'FKEY':\n case 'IKEY':\n\n // Texture Mapping Form skipped\n case 'CSYS':\n\n // Surface CHUNKs skipped\n case 'OPAQ': // top level 'opacity' checkbox\n case 'CMAP': // clip map\n\n // Surface node CHUNKS skipped\n // These mainly specify the node editor setup in LW\n case 'NLOC':\n case 'NZOM':\n case 'NVER':\n case 'NSRV':\n case 'NCRD':\n case 'NMOD':\n case 'NSEL':\n case 'NPRW':\n case 'NPLA':\n case 'VERS':\n case 'ENUM':\n case 'TAG ':\n\n // Car Material CHUNKS\n case 'CGMD':\n case 'CGTY':\n case 'CGST':\n case 'CGEN':\n case 'CGTS':\n case 'CGTE':\n case 'OSMP':\n case 'OMDE':\n case 'OUTR':\n case 'FLAG':\n\n case 'TRNL':\n case 'SHRP':\n case 'RFOP':\n case 'RSAN':\n case 'TROP':\n case 'RBLR':\n case 'TBLR':\n case 'CLRH':\n case 'CLRF':\n case 'ADTR':\n case 'GLOW':\n case 'LINE':\n case 'ALPH':\n case 'VCOL':\n case 'ENAB':\n this.IFF.debugger.skipped = true\n this.IFF.reader.skip(length)\n break\n\n // Texture node chunks (not in spec)\n case 'IPIX': // usePixelBlending\n case 'IMIP': // useMipMaps\n case 'IMOD': // imageBlendingMode\n case 'AMOD': // unknown\n case 'IINV': // imageInvertAlpha\n case 'INCR': // imageInvertColor\n case 'IAXS': // imageAxis ( for non-UV maps)\n case 'IFOT': // imageFallofType\n case 'ITIM': // timing for animated textures\n case 'IWRL':\n case 'IUTI':\n case 'IINX':\n case 'IINY':\n case 'IINZ':\n case 'IREF': // possibly a VX for reused texture nodes\n if (length === 4) this.IFF.currentNode[blockID] = this.IFF.reader.getInt32()\n else this.IFF.reader.skip(length)\n break\n\n case 'OTAG':\n this.IFF.parseObjectTag()\n break\n\n case 'LAYR':\n this.IFF.parseLayer(length)\n break\n\n case 'PNTS':\n this.IFF.parsePoints(length)\n break\n\n case 'VMAP':\n this.IFF.parseVertexMapping(length)\n break\n\n case 'POLS':\n this.IFF.parsePolygonList(length)\n break\n\n case 'TAGS':\n this.IFF.parseTagStrings(length)\n break\n\n case 'PTAG':\n this.IFF.parsePolygonTagMapping(length)\n break\n\n case 'VMAD':\n this.IFF.parseVertexMapping(length, true)\n break\n\n // Misc CHUNKS\n case 'DESC': // Description Line\n this.IFF.currentForm.description = this.IFF.reader.getString()\n break\n\n case 'TEXT':\n case 'CMNT':\n case 'NCOM':\n this.IFF.currentForm.comment = this.IFF.reader.getString()\n break\n\n // Envelope Form\n case 'NAME':\n this.IFF.currentForm.channelName = this.IFF.reader.getString()\n break\n\n // Image Map Layer\n case 'WRAP':\n this.IFF.currentForm.wrap = { w: this.IFF.reader.getUint16(), h: this.IFF.reader.getUint16() }\n break\n\n case 'IMAG':\n const index = this.IFF.reader.getVariableLengthIndex()\n this.IFF.currentForm.imageIndex = index\n break\n\n // Texture Mapping Form\n case 'OREF':\n this.IFF.currentForm.referenceObject = this.IFF.reader.getString()\n break\n\n case 'ROID':\n this.IFF.currentForm.referenceObjectID = this.IFF.reader.getUint32()\n break\n\n // Surface Blocks\n case 'SSHN':\n this.IFF.currentSurface.surfaceShaderName = this.IFF.reader.getString()\n break\n\n case 'AOVN':\n this.IFF.currentSurface.surfaceCustomAOVName = this.IFF.reader.getString()\n break\n\n // Nodal Blocks\n case 'NSTA':\n this.IFF.currentForm.disabled = this.IFF.reader.getUint16()\n break\n\n case 'NRNM':\n this.IFF.currentForm.realName = this.IFF.reader.getString()\n break\n\n case 'NNME':\n this.IFF.currentForm.refName = this.IFF.reader.getString()\n this.IFF.currentSurface.nodes[this.IFF.currentForm.refName] = this.IFF.currentForm\n break\n\n // Nodal Blocks : connections\n case 'INME':\n if (!this.IFF.currentForm.nodeName) this.IFF.currentForm.nodeName = []\n this.IFF.currentForm.nodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINN':\n if (!this.IFF.currentForm.inputNodeName) this.IFF.currentForm.inputNodeName = []\n this.IFF.currentForm.inputNodeName.push(this.IFF.reader.getString())\n break\n\n case 'IINM':\n if (!this.IFF.currentForm.inputName) this.IFF.currentForm.inputName = []\n this.IFF.currentForm.inputName.push(this.IFF.reader.getString())\n break\n\n case 'IONM':\n if (!this.IFF.currentForm.inputOutputName) this.IFF.currentForm.inputOutputName = []\n this.IFF.currentForm.inputOutputName.push(this.IFF.reader.getString())\n break\n\n case 'FNAM':\n this.IFF.currentForm.fileName = this.IFF.reader.getString()\n break\n\n case 'CHAN': // NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored\n if (length === 4) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag()\n else this.IFF.reader.skip(length)\n break\n\n // LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format\n case 'SMAN':\n const maxSmoothingAngle = this.IFF.reader.getFloat32()\n this.IFF.currentSurface.attributes.smooth = maxSmoothingAngle < 0 ? false : true\n break\n\n // LWO2: Basic Surface Parameters\n case 'COLR':\n this.IFF.currentSurface.attributes.Color = { value: this.IFF.reader.getFloat32Array(3) }\n this.IFF.reader.skip(2) // VX: envelope\n break\n\n case 'LUMI':\n this.IFF.currentSurface.attributes.Luminosity = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'SPEC':\n this.IFF.currentSurface.attributes.Specular = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'DIFF':\n this.IFF.currentSurface.attributes.Diffuse = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'REFL':\n this.IFF.currentSurface.attributes.Reflection = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'GLOS':\n this.IFF.currentSurface.attributes.Glossiness = { value: this.IFF.reader.getFloat32() }\n this.IFF.reader.skip(2)\n break\n\n case 'TRAN':\n this.IFF.currentSurface.attributes.opacity = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'BUMP':\n this.IFF.currentSurface.attributes.bumpStrength = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'SIDE':\n this.IFF.currentSurface.attributes.side = this.IFF.reader.getUint16()\n break\n\n case 'RIMG':\n this.IFF.currentSurface.attributes.reflectionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'RIND':\n this.IFF.currentSurface.attributes.refractiveIndex = this.IFF.reader.getFloat32()\n this.IFF.reader.skip(2)\n break\n\n case 'TIMG':\n this.IFF.currentSurface.attributes.refractionMap = this.IFF.reader.getVariableLengthIndex()\n break\n\n case 'IMAP':\n this.IFF.currentSurface.attributes.imageMapIndex = this.IFF.reader.getUint32()\n break\n\n case 'IUVI': // uv channel name\n this.IFF.currentNode.UVChannel = this.IFF.reader.getString(length)\n break\n\n case 'IUTL': // widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge\n this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32()\n break\n case 'IVTL': // heightWrappingMode\n this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32()\n break\n\n default:\n this.IFF.parseUnknownCHUNK(blockID, length)\n }\n\n if (blockID != 'FORM') {\n this.IFF.debugger.node = 1\n this.IFF.debugger.nodeID = blockID\n this.IFF.debugger.log()\n }\n\n if (this.IFF.reader.offset >= this.IFF.currentFormEnd) {\n this.IFF.currentForm = this.IFF.parentForm\n }\n }\n}\n\nexport { LWO3Parser }\n", "import {\n Box3,\n Float32BufferAttribute,\n InstancedBufferGeometry,\n InstancedInterleavedBuffer,\n InterleavedBufferAttribute,\n Sphere,\n Vector3,\n WireframeGeometry,\n} from 'three'\n\nconst _box = new Box3()\nconst _vector = new Vector3()\n\nclass LineSegmentsGeometry extends InstancedBufferGeometry {\n constructor() {\n super()\n\n this.isLineSegmentsGeometry = true\n\n this.type = 'LineSegmentsGeometry'\n\n const positions = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0]\n const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2]\n const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]\n\n this.setIndex(index)\n this.setAttribute('position', new Float32BufferAttribute(positions, 3))\n this.setAttribute('uv', new Float32BufferAttribute(uvs, 2))\n }\n\n applyMatrix4(matrix) {\n const start = this.attributes.instanceStart\n const end = this.attributes.instanceEnd\n\n if (start !== undefined) {\n start.applyMatrix4(matrix)\n\n end.applyMatrix4(matrix)\n\n start.needsUpdate = true\n }\n\n if (this.boundingBox !== null) {\n this.computeBoundingBox()\n }\n\n if (this.boundingSphere !== null) {\n this.computeBoundingSphere()\n }\n\n return this\n }\n\n setPositions(array) {\n let lineSegments\n\n if (array instanceof Float32Array) {\n lineSegments = array\n } else if (Array.isArray(array)) {\n lineSegments = new Float32Array(array)\n }\n\n const instanceBuffer = new InstancedInterleavedBuffer(lineSegments, 6, 1) // xyz, xyz\n\n this.setAttribute('instanceStart', new InterleavedBufferAttribute(instanceBuffer, 3, 0)) // xyz\n this.setAttribute('instanceEnd', new InterleavedBufferAttribute(instanceBuffer, 3, 3)) // xyz\n\n //\n\n this.computeBoundingBox()\n this.computeBoundingSphere()\n\n return this\n }\n\n setColors(array, itemSize = 3) {\n let colors\n\n if (array instanceof Float32Array) {\n colors = array\n } else if (Array.isArray(array)) {\n colors = new Float32Array(array)\n }\n\n const instanceColorBuffer = new InstancedInterleavedBuffer(colors, itemSize * 2, 1) // rgb(a), rgb(a)\n\n this.setAttribute('instanceColorStart', new InterleavedBufferAttribute(instanceColorBuffer, itemSize, 0)) // rgb(a)\n this.setAttribute('instanceColorEnd', new InterleavedBufferAttribute(instanceColorBuffer, itemSize, itemSize)) // rgb(a)\n\n return this\n }\n\n fromWireframeGeometry(geometry) {\n this.setPositions(geometry.attributes.position.array)\n\n return this\n }\n\n fromEdgesGeometry(geometry) {\n this.setPositions(geometry.attributes.position.array)\n\n return this\n }\n\n fromMesh(mesh) {\n this.fromWireframeGeometry(new WireframeGeometry(mesh.geometry))\n\n // set colors, maybe\n\n return this\n }\n\n fromLineSegments(lineSegments) {\n const geometry = lineSegments.geometry\n\n this.setPositions(geometry.attributes.position.array) // assumes non-indexed\n\n // set colors, maybe\n\n return this\n }\n\n computeBoundingBox() {\n if (this.boundingBox === null) {\n this.boundingBox = new Box3()\n }\n\n const start = this.attributes.instanceStart\n const end = this.attributes.instanceEnd\n\n if (start !== undefined && end !== undefined) {\n this.boundingBox.setFromBufferAttribute(start)\n\n _box.setFromBufferAttribute(end)\n\n this.boundingBox.union(_box)\n }\n }\n\n computeBoundingSphere() {\n if (this.boundingSphere === null) {\n this.boundingSphere = new Sphere()\n }\n\n if (this.boundingBox === null) {\n this.computeBoundingBox()\n }\n\n const start = this.attributes.instanceStart\n const end = this.attributes.instanceEnd\n\n if (start !== undefined && end !== undefined) {\n const center = this.boundingSphere.center\n\n this.boundingBox.getCenter(center)\n\n let maxRadiusSq = 0\n\n for (let i = 0, il = start.count; i < il; i++) {\n _vector.fromBufferAttribute(start, i)\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector))\n\n _vector.fromBufferAttribute(end, i)\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector))\n }\n\n this.boundingSphere.radius = Math.sqrt(maxRadiusSq)\n\n if (isNaN(this.boundingSphere.radius)) {\n console.error(\n 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.',\n this,\n )\n }\n }\n }\n\n toJSON() {\n // todo\n }\n\n applyMatrix(matrix) {\n console.warn('THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().')\n\n return this.applyMatrix4(matrix)\n }\n}\n\nexport { LineSegmentsGeometry }\n", "import { InstancedInterleavedBuffer, InterleavedBufferAttribute, Mesh, Vector3 } from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nconst _start = new Vector3()\nconst _end = new Vector3()\n\nclass Wireframe extends Mesh {\n constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isWireframe = true\n\n this.type = 'Wireframe'\n }\n\n // for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n computeLineDistances() {\n const geometry = this.geometry\n\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n const lineDistances = new Float32Array(2 * instanceStart.count)\n\n for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {\n _start.fromBufferAttribute(instanceStart, i)\n _end.fromBufferAttribute(instanceEnd, i)\n\n lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1]\n lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end)\n }\n\n const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1) // d0, d1\n\n geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)) // d0\n geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)) // d1\n\n return this\n }\n}\n\nexport { Wireframe }\n", "import {\n Box3,\n InstancedInterleavedBuffer,\n InterleavedBufferAttribute,\n Line3,\n MathUtils,\n Matrix4,\n Mesh,\n Sphere,\n Vector3,\n Vector4,\n} from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nconst _start = new Vector3()\nconst _end = new Vector3()\n\nconst _start4 = new Vector4()\nconst _end4 = new Vector4()\n\nconst _ssOrigin = new Vector4()\nconst _ssOrigin3 = new Vector3()\nconst _mvMatrix = new Matrix4()\nconst _line = new Line3()\nconst _closestPoint = new Vector3()\n\nconst _box = new Box3()\nconst _sphere = new Sphere()\nconst _clipToWorldVector = new Vector4()\n\nlet _ray, _instanceStart, _instanceEnd, _lineWidth\n\n// Returns the margin required to expand by in world space given the distance from the camera,\n// line width, resolution, and camera projection\nfunction getWorldSpaceHalfWidth(camera, distance, resolution) {\n // transform into clip space, adjust the x and y values by the pixel width offset, then\n // transform back into world space to get world offset. Note clip space is [-1, 1] so full\n // width does not need to be halved.\n _clipToWorldVector.set(0, 0, -distance, 1.0).applyMatrix4(camera.projectionMatrix)\n _clipToWorldVector.multiplyScalar(1.0 / _clipToWorldVector.w)\n _clipToWorldVector.x = _lineWidth / resolution.width\n _clipToWorldVector.y = _lineWidth / resolution.height\n _clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse)\n _clipToWorldVector.multiplyScalar(1.0 / _clipToWorldVector.w)\n\n return Math.abs(Math.max(_clipToWorldVector.x, _clipToWorldVector.y))\n}\n\nfunction raycastWorldUnits(lineSegments, intersects) {\n for (let i = 0, l = _instanceStart.count; i < l; i++) {\n _line.start.fromBufferAttribute(_instanceStart, i)\n _line.end.fromBufferAttribute(_instanceEnd, i)\n\n const pointOnLine = new Vector3()\n const point = new Vector3()\n\n _ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine)\n const isInside = point.distanceTo(pointOnLine) < _lineWidth * 0.5\n\n if (isInside) {\n intersects.push({\n point,\n pointOnLine,\n distance: _ray.origin.distanceTo(point),\n object: lineSegments,\n face: null,\n faceIndex: i,\n uv: null,\n uv2: null,\n })\n }\n }\n}\n\nfunction raycastScreenSpace(lineSegments, camera, intersects) {\n const projectionMatrix = camera.projectionMatrix\n const material = lineSegments.material\n const resolution = material.resolution\n const matrixWorld = lineSegments.matrixWorld\n\n const geometry = lineSegments.geometry\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n\n const near = -camera.near\n\n //\n\n // pick a point 1 unit out along the ray to avoid the ray origin\n // sitting at the camera origin which will cause \"w\" to be 0 when\n // applying the projection matrix.\n _ray.at(1, _ssOrigin)\n\n // ndc space [ - 1.0, 1.0 ]\n _ssOrigin.w = 1\n _ssOrigin.applyMatrix4(camera.matrixWorldInverse)\n _ssOrigin.applyMatrix4(projectionMatrix)\n _ssOrigin.multiplyScalar(1 / _ssOrigin.w)\n\n // screen space\n _ssOrigin.x *= resolution.x / 2\n _ssOrigin.y *= resolution.y / 2\n _ssOrigin.z = 0\n\n _ssOrigin3.copy(_ssOrigin)\n\n _mvMatrix.multiplyMatrices(camera.matrixWorldInverse, matrixWorld)\n\n for (let i = 0, l = instanceStart.count; i < l; i++) {\n _start4.fromBufferAttribute(instanceStart, i)\n _end4.fromBufferAttribute(instanceEnd, i)\n\n _start4.w = 1\n _end4.w = 1\n\n // camera space\n _start4.applyMatrix4(_mvMatrix)\n _end4.applyMatrix4(_mvMatrix)\n\n // skip the segment if it's entirely behind the camera\n const isBehindCameraNear = _start4.z > near && _end4.z > near\n if (isBehindCameraNear) {\n continue\n }\n\n // trim the segment if it extends behind camera near\n if (_start4.z > near) {\n const deltaDist = _start4.z - _end4.z\n const t = (_start4.z - near) / deltaDist\n _start4.lerp(_end4, t)\n } else if (_end4.z > near) {\n const deltaDist = _end4.z - _start4.z\n const t = (_end4.z - near) / deltaDist\n _end4.lerp(_start4, t)\n }\n\n // clip space\n _start4.applyMatrix4(projectionMatrix)\n _end4.applyMatrix4(projectionMatrix)\n\n // ndc space [ - 1.0, 1.0 ]\n _start4.multiplyScalar(1 / _start4.w)\n _end4.multiplyScalar(1 / _end4.w)\n\n // screen space\n _start4.x *= resolution.x / 2\n _start4.y *= resolution.y / 2\n\n _end4.x *= resolution.x / 2\n _end4.y *= resolution.y / 2\n\n // create 2d segment\n _line.start.copy(_start4)\n _line.start.z = 0\n\n _line.end.copy(_end4)\n _line.end.z = 0\n\n // get closest point on ray to segment\n const param = _line.closestPointToPointParameter(_ssOrigin3, true)\n _line.at(param, _closestPoint)\n\n // check if the intersection point is within clip space\n const zPos = MathUtils.lerp(_start4.z, _end4.z, param)\n const isInClipSpace = zPos >= -1 && zPos <= 1\n\n const isInside = _ssOrigin3.distanceTo(_closestPoint) < _lineWidth * 0.5\n\n if (isInClipSpace && isInside) {\n _line.start.fromBufferAttribute(instanceStart, i)\n _line.end.fromBufferAttribute(instanceEnd, i)\n\n _line.start.applyMatrix4(matrixWorld)\n _line.end.applyMatrix4(matrixWorld)\n\n const pointOnLine = new Vector3()\n const point = new Vector3()\n\n _ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine)\n\n intersects.push({\n point: point,\n pointOnLine: pointOnLine,\n distance: _ray.origin.distanceTo(point),\n object: lineSegments,\n face: null,\n faceIndex: i,\n uv: null,\n uv2: null,\n })\n }\n }\n}\n\nclass LineSegments2 extends Mesh {\n constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isLineSegments2 = true\n\n this.type = 'LineSegments2'\n }\n\n // for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n computeLineDistances() {\n const geometry = this.geometry\n\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n const lineDistances = new Float32Array(2 * instanceStart.count)\n\n for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {\n _start.fromBufferAttribute(instanceStart, i)\n _end.fromBufferAttribute(instanceEnd, i)\n\n lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1]\n lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end)\n }\n\n const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1) // d0, d1\n\n geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)) // d0\n geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)) // d1\n\n return this\n }\n\n raycast(raycaster, intersects) {\n const worldUnits = this.material.worldUnits\n const camera = raycaster.camera\n\n if (camera === null && !worldUnits) {\n console.error(\n 'LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.',\n )\n }\n\n const threshold = raycaster.params.Line2 !== undefined ? raycaster.params.Line2.threshold || 0 : 0\n\n _ray = raycaster.ray\n\n const matrixWorld = this.matrixWorld\n const geometry = this.geometry\n const material = this.material\n\n _lineWidth = material.linewidth + threshold\n\n _instanceStart = geometry.attributes.instanceStart\n _instanceEnd = geometry.attributes.instanceEnd\n\n // check if we intersect the sphere bounds\n if (geometry.boundingSphere === null) {\n geometry.computeBoundingSphere()\n }\n\n _sphere.copy(geometry.boundingSphere).applyMatrix4(matrixWorld)\n\n // increase the sphere bounds by the worst case line screen space width\n let sphereMargin\n if (worldUnits) {\n sphereMargin = _lineWidth * 0.5\n } else {\n const distanceToSphere = Math.max(camera.near, _sphere.distanceToPoint(_ray.origin))\n sphereMargin = getWorldSpaceHalfWidth(camera, distanceToSphere, material.resolution)\n }\n\n _sphere.radius += sphereMargin\n\n if (_ray.intersectsSphere(_sphere) === false) {\n return\n }\n\n // check if we intersect the box bounds\n if (geometry.boundingBox === null) {\n geometry.computeBoundingBox()\n }\n\n _box.copy(geometry.boundingBox).applyMatrix4(matrixWorld)\n\n // increase the box bounds by the worst case line width\n let boxMargin\n if (worldUnits) {\n boxMargin = _lineWidth * 0.5\n } else {\n const distanceToBox = Math.max(camera.near, _box.distanceToPoint(_ray.origin))\n boxMargin = getWorldSpaceHalfWidth(camera, distanceToBox, material.resolution)\n }\n\n _box.expandByScalar(boxMargin)\n\n if (_ray.intersectsBox(_box) === false) {\n return\n }\n\n if (worldUnits) {\n raycastWorldUnits(this, intersects)\n } else {\n raycastScreenSpace(this, camera, intersects)\n }\n }\n}\n\nexport { LineSegments2 }\n", "import { BufferGeometry, Float32BufferAttribute, LineSegments, LineBasicMaterial, Vector3 } from 'three'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\n\nclass VertexTangentsHelper extends LineSegments {\n constructor(object, size = 1, color = 0x00ffff) {\n const geometry = new BufferGeometry()\n\n const nTangents = object.geometry.attributes.tangent.count\n const positions = new Float32BufferAttribute(nTangents * 2 * 3, 3)\n\n geometry.setAttribute('position', positions)\n\n super(geometry, new LineBasicMaterial({ color, toneMapped: false }))\n\n this.object = object\n this.size = size\n this.type = 'VertexTangentsHelper'\n\n //\n\n this.matrixAutoUpdate = false\n\n this.update()\n }\n\n update() {\n this.object.updateMatrixWorld(true)\n\n const matrixWorld = this.object.matrixWorld\n\n const position = this.geometry.attributes.position\n\n //\n\n const objGeometry = this.object.geometry\n\n const objPos = objGeometry.attributes.position\n\n const objTan = objGeometry.attributes.tangent\n\n let idx = 0\n\n // for simplicity, ignore index and drawcalls, and render every tangent\n\n for (let j = 0, jl = objPos.count; j < jl; j++) {\n _v1.fromBufferAttribute(objPos, j).applyMatrix4(matrixWorld)\n\n _v2.fromBufferAttribute(objTan, j)\n\n _v2.transformDirection(matrixWorld).multiplyScalar(this.size).add(_v1)\n\n position.setXYZ(idx, _v1.x, _v1.y, _v1.z)\n\n idx = idx + 1\n\n position.setXYZ(idx, _v2.x, _v2.y, _v2.z)\n\n idx = idx + 1\n }\n\n position.needsUpdate = true\n }\n\n dispose() {\n this.geometry.dispose()\n this.material.dispose()\n }\n}\n\nexport { VertexTangentsHelper }\n", "import { BufferGeometry, Float32BufferAttribute, LineSegments, LineBasicMaterial, Matrix3, Vector3 } from 'three'\n\nconst _v1 = new Vector3()\nconst _v2 = new Vector3()\nconst _normalMatrix = new Matrix3()\n\nclass VertexNormalsHelper extends LineSegments {\n constructor(object, size = 1, color = 0xff0000) {\n const geometry = new BufferGeometry()\n\n const nNormals = object.geometry.attributes.normal.count\n const positions = new Float32BufferAttribute(nNormals * 2 * 3, 3)\n\n geometry.setAttribute('position', positions)\n\n super(geometry, new LineBasicMaterial({ color, toneMapped: false }))\n\n this.object = object\n this.size = size\n this.type = 'VertexNormalsHelper'\n\n //\n\n this.matrixAutoUpdate = false\n\n this.update()\n }\n\n update() {\n this.object.updateMatrixWorld(true)\n\n _normalMatrix.getNormalMatrix(this.object.matrixWorld)\n\n const matrixWorld = this.object.matrixWorld\n\n const position = this.geometry.attributes.position\n\n //\n\n const objGeometry = this.object.geometry\n\n if (objGeometry) {\n const objPos = objGeometry.attributes.position\n\n const objNorm = objGeometry.attributes.normal\n\n let idx = 0\n\n // for simplicity, ignore index and drawcalls, and render every normal\n\n for (let j = 0, jl = objPos.count; j < jl; j++) {\n _v1.fromBufferAttribute(objPos, j).applyMatrix4(matrixWorld)\n\n _v2.fromBufferAttribute(objNorm, j)\n\n _v2.applyMatrix3(_normalMatrix).normalize().multiplyScalar(this.size).add(_v1)\n\n position.setXYZ(idx, _v1.x, _v1.y, _v1.z)\n\n idx = idx + 1\n\n position.setXYZ(idx, _v2.x, _v2.y, _v2.z)\n\n idx = idx + 1\n }\n }\n\n position.needsUpdate = true\n }\n\n dispose() {\n this.geometry.dispose()\n this.material.dispose()\n }\n}\n\nexport { VertexNormalsHelper }\n", "import {\n Box3,\n BufferAttribute,\n BufferGeometry,\n Color,\n EventDispatcher,\n Float32BufferAttribute,\n Matrix3,\n Matrix4,\n MathUtils,\n Object3D,\n Sphere,\n Vector2,\n Vector3,\n} from 'three'\n\nconst _m1 = new Matrix4()\nconst _obj = new Object3D()\nconst _offset = new Vector3()\n\nclass Geometry extends EventDispatcher {\n static createBufferGeometryFromObject(object) {\n let buffergeometry = new BufferGeometry()\n\n const geometry = object.geometry\n\n if (object.isPoints || object.isLine) {\n const positions = new Float32BufferAttribute(geometry.vertices.length * 3, 3)\n const colors = new Float32BufferAttribute(geometry.colors.length * 3, 3)\n\n buffergeometry.setAttribute('position', positions.copyVector3sArray(geometry.vertices))\n buffergeometry.setAttribute('color', colors.copyColorsArray(geometry.colors))\n\n if (geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length) {\n const lineDistances = new Float32BufferAttribute(geometry.lineDistances.length, 1)\n\n buffergeometry.setAttribute('lineDistance', lineDistances.copyArray(geometry.lineDistances))\n }\n\n if (geometry.boundingSphere !== null) {\n buffergeometry.boundingSphere = geometry.boundingSphere.clone()\n }\n\n if (geometry.boundingBox !== null) {\n buffergeometry.boundingBox = geometry.boundingBox.clone()\n }\n } else if (object.isMesh) {\n buffergeometry = geometry.toBufferGeometry()\n }\n\n return buffergeometry\n }\n\n constructor() {\n super()\n this.isGeometry = true\n this.uuid = MathUtils.generateUUID()\n\n this.name = ''\n this.type = 'Geometry'\n\n this.vertices = []\n this.colors = []\n this.faces = []\n this.faceVertexUvs = [[]]\n\n this.morphTargets = []\n this.morphNormals = []\n\n this.skinWeights = []\n this.skinIndices = []\n\n this.lineDistances = []\n\n this.boundingBox = null\n this.boundingSphere = null\n\n // update flags\n\n this.elementsNeedUpdate = false\n this.verticesNeedUpdate = false\n this.uvsNeedUpdate = false\n this.normalsNeedUpdate = false\n this.colorsNeedUpdate = false\n this.lineDistancesNeedUpdate = false\n this.groupsNeedUpdate = false\n }\n\n applyMatrix4(matrix) {\n const normalMatrix = new Matrix3().getNormalMatrix(matrix)\n\n for (let i = 0, il = this.vertices.length; i < il; i++) {\n const vertex = this.vertices[i]\n vertex.applyMatrix4(matrix)\n }\n\n for (let i = 0, il = this.faces.length; i < il; i++) {\n const face = this.faces[i]\n face.normal.applyMatrix3(normalMatrix).normalize()\n\n for (let j = 0, jl = face.vertexNormals.length; j < jl; j++) {\n face.vertexNormals[j].applyMatrix3(normalMatrix).normalize()\n }\n }\n\n if (this.boundingBox !== null) {\n this.computeBoundingBox()\n }\n\n if (this.boundingSphere !== null) {\n this.computeBoundingSphere()\n }\n\n this.verticesNeedUpdate = true\n this.normalsNeedUpdate = true\n\n return this\n }\n\n rotateX(angle) {\n // rotate geometry around world x-axis\n\n _m1.makeRotationX(angle)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n rotateY(angle) {\n // rotate geometry around world y-axis\n\n _m1.makeRotationY(angle)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n rotateZ(angle) {\n // rotate geometry around world z-axis\n\n _m1.makeRotationZ(angle)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n translate(x, y, z) {\n // translate geometry\n\n _m1.makeTranslation(x, y, z)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n scale(x, y, z) {\n // scale geometry\n\n _m1.makeScale(x, y, z)\n\n this.applyMatrix4(_m1)\n\n return this\n }\n\n lookAt(vector) {\n _obj.lookAt(vector)\n\n _obj.updateMatrix()\n\n this.applyMatrix4(_obj.matrix)\n\n return this\n }\n\n fromBufferGeometry(geometry) {\n const scope = this\n\n const index = geometry.index !== null ? geometry.index : undefined\n const attributes = geometry.attributes\n\n if (attributes.position === undefined) {\n console.error('THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.')\n return this\n }\n\n const position = attributes.position\n const normal = attributes.normal\n const color = attributes.color\n const uv = attributes.uv\n const uv2 = attributes.uv2\n\n if (uv2 !== undefined) this.faceVertexUvs[1] = []\n\n for (let i = 0; i < position.count; i++) {\n scope.vertices.push(new Vector3().fromBufferAttribute(position, i))\n\n if (color !== undefined) {\n scope.colors.push(new Color().fromBufferAttribute(color, i))\n }\n }\n\n function addFace(a, b, c, materialIndex) {\n const vertexColors =\n color === undefined ? [] : [scope.colors[a].clone(), scope.colors[b].clone(), scope.colors[c].clone()]\n\n const vertexNormals =\n normal === undefined\n ? []\n : [\n new Vector3().fromBufferAttribute(normal, a),\n new Vector3().fromBufferAttribute(normal, b),\n new Vector3().fromBufferAttribute(normal, c),\n ]\n\n const face = new Face3(a, b, c, vertexNormals, vertexColors, materialIndex)\n\n scope.faces.push(face)\n\n if (uv !== undefined) {\n scope.faceVertexUvs[0].push([\n new Vector2().fromBufferAttribute(uv, a),\n new Vector2().fromBufferAttribute(uv, b),\n new Vector2().fromBufferAttribute(uv, c),\n ])\n }\n\n if (uv2 !== undefined) {\n scope.faceVertexUvs[1].push([\n new Vector2().fromBufferAttribute(uv2, a),\n new Vector2().fromBufferAttribute(uv2, b),\n new Vector2().fromBufferAttribute(uv2, c),\n ])\n }\n }\n\n const groups = geometry.groups\n\n if (groups.length > 0) {\n for (let i = 0; i < groups.length; i++) {\n const group = groups[i]\n\n const start = group.start\n const count = group.count\n\n for (let j = start, jl = start + count; j < jl; j += 3) {\n if (index !== undefined) {\n addFace(index.getX(j), index.getX(j + 1), index.getX(j + 2), group.materialIndex)\n } else {\n addFace(j, j + 1, j + 2, group.materialIndex)\n }\n }\n }\n } else {\n if (index !== undefined) {\n for (let i = 0; i < index.count; i += 3) {\n addFace(index.getX(i), index.getX(i + 1), index.getX(i + 2))\n }\n } else {\n for (let i = 0; i < position.count; i += 3) {\n addFace(i, i + 1, i + 2)\n }\n }\n }\n\n this.computeFaceNormals()\n\n if (geometry.boundingBox !== null) {\n this.boundingBox = geometry.boundingBox.clone()\n }\n\n if (geometry.boundingSphere !== null) {\n this.boundingSphere = geometry.boundingSphere.clone()\n }\n\n return this\n }\n\n center() {\n this.computeBoundingBox()\n\n this.boundingBox.getCenter(_offset).negate()\n\n this.translate(_offset.x, _offset.y, _offset.z)\n\n return this\n }\n\n normalize() {\n this.computeBoundingSphere()\n\n const center = this.boundingSphere.center\n const radius = this.boundingSphere.radius\n\n const s = radius === 0 ? 1 : 1.0 / radius\n\n const matrix = new Matrix4()\n matrix.set(s, 0, 0, -s * center.x, 0, s, 0, -s * center.y, 0, 0, s, -s * center.z, 0, 0, 0, 1)\n\n this.applyMatrix4(matrix)\n\n return this\n }\n\n computeFaceNormals() {\n const cb = new Vector3(),\n ab = new Vector3()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vA = this.vertices[face.a]\n const vB = this.vertices[face.b]\n const vC = this.vertices[face.c]\n\n cb.subVectors(vC, vB)\n ab.subVectors(vA, vB)\n cb.cross(ab)\n\n cb.normalize()\n\n face.normal.copy(cb)\n }\n }\n\n computeVertexNormals(areaWeighted = true) {\n const vertices = new Array(this.vertices.length)\n\n for (let v = 0, vl = this.vertices.length; v < vl; v++) {\n vertices[v] = new Vector3()\n }\n\n if (areaWeighted) {\n // vertex normals weighted by triangle areas\n // http://www.iquilezles.org/www/articles/normals/normals.htm\n\n const cb = new Vector3(),\n ab = new Vector3()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vA = this.vertices[face.a]\n const vB = this.vertices[face.b]\n const vC = this.vertices[face.c]\n\n cb.subVectors(vC, vB)\n ab.subVectors(vA, vB)\n cb.cross(ab)\n\n vertices[face.a].add(cb)\n vertices[face.b].add(cb)\n vertices[face.c].add(cb)\n }\n } else {\n this.computeFaceNormals()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n vertices[face.a].add(face.normal)\n vertices[face.b].add(face.normal)\n vertices[face.c].add(face.normal)\n }\n }\n\n for (let v = 0, vl = this.vertices.length; v < vl; v++) {\n vertices[v].normalize()\n }\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vertexNormals = face.vertexNormals\n\n if (vertexNormals.length === 3) {\n vertexNormals[0].copy(vertices[face.a])\n vertexNormals[1].copy(vertices[face.b])\n vertexNormals[2].copy(vertices[face.c])\n } else {\n vertexNormals[0] = vertices[face.a].clone()\n vertexNormals[1] = vertices[face.b].clone()\n vertexNormals[2] = vertices[face.c].clone()\n }\n }\n\n if (this.faces.length > 0) {\n this.normalsNeedUpdate = true\n }\n }\n\n computeFlatVertexNormals() {\n this.computeFaceNormals()\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const vertexNormals = face.vertexNormals\n\n if (vertexNormals.length === 3) {\n vertexNormals[0].copy(face.normal)\n vertexNormals[1].copy(face.normal)\n vertexNormals[2].copy(face.normal)\n } else {\n vertexNormals[0] = face.normal.clone()\n vertexNormals[1] = face.normal.clone()\n vertexNormals[2] = face.normal.clone()\n }\n }\n\n if (this.faces.length > 0) {\n this.normalsNeedUpdate = true\n }\n }\n\n computeMorphNormals() {\n // save original normals\n // - create temp variables on first access\n // otherwise just copy (for faster repeated calls)\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n if (!face.__originalFaceNormal) {\n face.__originalFaceNormal = face.normal.clone()\n } else {\n face.__originalFaceNormal.copy(face.normal)\n }\n\n if (!face.__originalVertexNormals) face.__originalVertexNormals = []\n\n for (let i = 0, il = face.vertexNormals.length; i < il; i++) {\n if (!face.__originalVertexNormals[i]) {\n face.__originalVertexNormals[i] = face.vertexNormals[i].clone()\n } else {\n face.__originalVertexNormals[i].copy(face.vertexNormals[i])\n }\n }\n }\n\n // use temp geometry to compute face and vertex normals for each morph\n\n const tmpGeo = new Geometry()\n tmpGeo.faces = this.faces\n\n for (let i = 0, il = this.morphTargets.length; i < il; i++) {\n // create on first access\n\n if (!this.morphNormals[i]) {\n this.morphNormals[i] = {}\n this.morphNormals[i].faceNormals = []\n this.morphNormals[i].vertexNormals = []\n\n const dstNormalsFace = this.morphNormals[i].faceNormals\n const dstNormalsVertex = this.morphNormals[i].vertexNormals\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const faceNormal = new Vector3()\n const vertexNormals = {\n a: new Vector3(),\n b: new Vector3(),\n c: new Vector3(),\n }\n\n dstNormalsFace.push(faceNormal)\n dstNormalsVertex.push(vertexNormals)\n }\n }\n\n const morphNormals = this.morphNormals[i]\n\n // set vertices to morph target\n\n tmpGeo.vertices = this.morphTargets[i].vertices\n\n // compute morph normals\n\n tmpGeo.computeFaceNormals()\n tmpGeo.computeVertexNormals()\n\n // store morph normals\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n const faceNormal = morphNormals.faceNormals[f]\n const vertexNormals = morphNormals.vertexNormals[f]\n\n faceNormal.copy(face.normal)\n\n vertexNormals.a.copy(face.vertexNormals[0])\n vertexNormals.b.copy(face.vertexNormals[1])\n vertexNormals.c.copy(face.vertexNormals[2])\n }\n }\n\n // restore original normals\n\n for (let f = 0, fl = this.faces.length; f < fl; f++) {\n const face = this.faces[f]\n\n face.normal = face.__originalFaceNormal\n face.vertexNormals = face.__originalVertexNormals\n }\n }\n\n computeBoundingBox() {\n if (this.boundingBox === null) {\n this.boundingBox = new Box3()\n }\n\n this.boundingBox.setFromPoints(this.vertices)\n }\n\n computeBoundingSphere() {\n if (this.boundingSphere === null) {\n this.boundingSphere = new Sphere()\n }\n\n this.boundingSphere.setFromPoints(this.vertices)\n }\n\n merge(geometry, matrix, materialIndexOffset = 0) {\n if (!(geometry && geometry.isGeometry)) {\n console.error('THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry)\n return\n }\n\n let normalMatrix\n const vertexOffset = this.vertices.length,\n vertices1 = this.vertices,\n vertices2 = geometry.vertices,\n faces1 = this.faces,\n faces2 = geometry.faces,\n colors1 = this.colors,\n colors2 = geometry.colors\n\n if (matrix !== undefined) {\n normalMatrix = new Matrix3().getNormalMatrix(matrix)\n }\n\n // vertices\n\n for (let i = 0, il = vertices2.length; i < il; i++) {\n const vertex = vertices2[i]\n\n const vertexCopy = vertex.clone()\n\n if (matrix !== undefined) vertexCopy.applyMatrix4(matrix)\n\n vertices1.push(vertexCopy)\n }\n\n // colors\n\n for (let i = 0, il = colors2.length; i < il; i++) {\n colors1.push(colors2[i].clone())\n }\n\n // faces\n\n for (let i = 0, il = faces2.length; i < il; i++) {\n const face = faces2[i]\n let normal, color\n const faceVertexNormals = face.vertexNormals,\n faceVertexColors = face.vertexColors\n\n const faceCopy = new Face3(face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset)\n faceCopy.normal.copy(face.normal)\n\n if (normalMatrix !== undefined) {\n faceCopy.normal.applyMatrix3(normalMatrix).normalize()\n }\n\n for (let j = 0, jl = faceVertexNormals.length; j < jl; j++) {\n normal = faceVertexNormals[j].clone()\n\n if (normalMatrix !== undefined) {\n normal.applyMatrix3(normalMatrix).normalize()\n }\n\n faceCopy.vertexNormals.push(normal)\n }\n\n faceCopy.color.copy(face.color)\n\n for (let j = 0, jl = faceVertexColors.length; j < jl; j++) {\n color = faceVertexColors[j]\n faceCopy.vertexColors.push(color.clone())\n }\n\n faceCopy.materialIndex = face.materialIndex + materialIndexOffset\n\n faces1.push(faceCopy)\n }\n\n // uvs\n\n for (let i = 0, il = geometry.faceVertexUvs.length; i < il; i++) {\n const faceVertexUvs2 = geometry.faceVertexUvs[i]\n\n if (this.faceVertexUvs[i] === undefined) this.faceVertexUvs[i] = []\n\n for (let j = 0, jl = faceVertexUvs2.length; j < jl; j++) {\n const uvs2 = faceVertexUvs2[j],\n uvsCopy = []\n\n for (let k = 0, kl = uvs2.length; k < kl; k++) {\n uvsCopy.push(uvs2[k].clone())\n }\n\n this.faceVertexUvs[i].push(uvsCopy)\n }\n }\n }\n\n mergeMesh(mesh) {\n if (!(mesh && mesh.isMesh)) {\n console.error('THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh)\n return\n }\n\n if (mesh.matrixAutoUpdate) mesh.updateMatrix()\n\n this.merge(mesh.geometry, mesh.matrix)\n }\n\n /*\n * Checks for duplicate vertices with hashmap.\n * Duplicated vertices are removed\n * and faces' vertices are updated.\n */\n\n mergeVertices(precisionPoints = 4) {\n const verticesMap = {} // Hashmap for looking up vertices by position coordinates (and making sure they are unique)\n const unique = [],\n changes = []\n\n const precision = Math.pow(10, precisionPoints)\n\n for (let i = 0, il = this.vertices.length; i < il; i++) {\n const v = this.vertices[i]\n const key = `${Math.round(v.x * precision)}_${Math.round(v.y * precision)}_${Math.round(v.z * precision)}`\n\n if (verticesMap[key] === undefined) {\n verticesMap[key] = i\n unique.push(this.vertices[i])\n changes[i] = unique.length - 1\n } else {\n //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);\n changes[i] = changes[verticesMap[key]]\n }\n }\n\n // if faces are completely degenerate after merging vertices, we\n // have to remove them from the geometry.\n const faceIndicesToRemove = []\n\n for (let i = 0, il = this.faces.length; i < il; i++) {\n const face = this.faces[i]\n\n face.a = changes[face.a]\n face.b = changes[face.b]\n face.c = changes[face.c]\n\n const indices = [face.a, face.b, face.c]\n\n // if any duplicate vertices are found in a Face3\n // we have to remove the face as nothing can be saved\n for (let n = 0; n < 3; n++) {\n if (indices[n] === indices[(n + 1) % 3]) {\n faceIndicesToRemove.push(i)\n break\n }\n }\n }\n\n for (let i = faceIndicesToRemove.length - 1; i >= 0; i--) {\n const idx = faceIndicesToRemove[i]\n\n this.faces.splice(idx, 1)\n\n for (let j = 0, jl = this.faceVertexUvs.length; j < jl; j++) {\n this.faceVertexUvs[j].splice(idx, 1)\n }\n }\n\n // Use unique set of vertices\n\n const diff = this.vertices.length - unique.length\n this.vertices = unique\n return diff\n }\n\n setFromPoints(points) {\n this.vertices = []\n\n for (let i = 0, l = points.length; i < l; i++) {\n const point = points[i]\n this.vertices.push(new Vector3(point.x, point.y, point.z || 0))\n }\n\n return this\n }\n\n sortFacesByMaterialIndex() {\n const faces = this.faces\n const length = faces.length\n\n // tag faces\n\n for (let i = 0; i < length; i++) {\n faces[i]._id = i\n }\n\n // sort faces\n\n function materialIndexSort(a, b) {\n return a.materialIndex - b.materialIndex\n }\n\n faces.sort(materialIndexSort)\n\n // sort uvs\n\n const uvs1 = this.faceVertexUvs[0]\n const uvs2 = this.faceVertexUvs[1]\n\n let newUvs1, newUvs2\n\n if (uvs1 && uvs1.length === length) newUvs1 = []\n if (uvs2 && uvs2.length === length) newUvs2 = []\n\n for (let i = 0; i < length; i++) {\n const id = faces[i]._id\n\n if (newUvs1) newUvs1.push(uvs1[id])\n if (newUvs2) newUvs2.push(uvs2[id])\n }\n\n if (newUvs1) this.faceVertexUvs[0] = newUvs1\n if (newUvs2) this.faceVertexUvs[1] = newUvs2\n }\n\n toJSON() {\n const data = {\n metadata: {\n version: 4.5,\n type: 'Geometry',\n generator: 'Geometry.toJSON',\n },\n }\n\n // standard Geometry serialization\n\n data.uuid = this.uuid\n data.type = this.type\n if (this.name !== '') data.name = this.name\n\n if (this.parameters !== undefined) {\n const parameters = this.parameters\n\n for (let key in parameters) {\n if (parameters[key] !== undefined) data[key] = parameters[key]\n }\n\n return data\n }\n\n const vertices = []\n\n for (let i = 0; i < this.vertices.length; i++) {\n const vertex = this.vertices[i]\n vertices.push(vertex.x, vertex.y, vertex.z)\n }\n\n const faces = []\n const normals = []\n const normalsHash = {}\n const colors = []\n const colorsHash = {}\n const uvs = []\n const uvsHash = {}\n\n for (let i = 0; i < this.faces.length; i++) {\n const face = this.faces[i]\n\n const hasMaterial = true\n const hasFaceUv = false // deprecated\n const hasFaceVertexUv = this.faceVertexUvs[0][i] !== undefined\n const hasFaceNormal = face.normal.length() > 0\n const hasFaceVertexNormal = face.vertexNormals.length > 0\n const hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1\n const hasFaceVertexColor = face.vertexColors.length > 0\n\n let faceType = 0\n\n faceType = setBit(faceType, 0, 0) // isQuad\n faceType = setBit(faceType, 1, hasMaterial)\n faceType = setBit(faceType, 2, hasFaceUv)\n faceType = setBit(faceType, 3, hasFaceVertexUv)\n faceType = setBit(faceType, 4, hasFaceNormal)\n faceType = setBit(faceType, 5, hasFaceVertexNormal)\n faceType = setBit(faceType, 6, hasFaceColor)\n faceType = setBit(faceType, 7, hasFaceVertexColor)\n\n faces.push(faceType)\n faces.push(face.a, face.b, face.c)\n faces.push(face.materialIndex)\n\n if (hasFaceVertexUv) {\n const faceVertexUvs = this.faceVertexUvs[0][i]\n\n faces.push(getUvIndex(faceVertexUvs[0]), getUvIndex(faceVertexUvs[1]), getUvIndex(faceVertexUvs[2]))\n }\n\n if (hasFaceNormal) {\n faces.push(getNormalIndex(face.normal))\n }\n\n if (hasFaceVertexNormal) {\n const vertexNormals = face.vertexNormals\n\n faces.push(getNormalIndex(vertexNormals[0]), getNormalIndex(vertexNormals[1]), getNormalIndex(vertexNormals[2]))\n }\n\n if (hasFaceColor) {\n faces.push(getColorIndex(face.color))\n }\n\n if (hasFaceVertexColor) {\n const vertexColors = face.vertexColors\n\n faces.push(getColorIndex(vertexColors[0]), getColorIndex(vertexColors[1]), getColorIndex(vertexColors[2]))\n }\n }\n\n function setBit(value, position, enabled) {\n return enabled ? value | (1 << position) : value & ~(1 << position)\n }\n\n function getNormalIndex(normal) {\n const hash = normal.x.toString() + normal.y.toString() + normal.z.toString()\n\n if (normalsHash[hash] !== undefined) {\n return normalsHash[hash]\n }\n\n normalsHash[hash] = normals.length / 3\n normals.push(normal.x, normal.y, normal.z)\n\n return normalsHash[hash]\n }\n\n function getColorIndex(color) {\n const hash = color.r.toString() + color.g.toString() + color.b.toString()\n\n if (colorsHash[hash] !== undefined) {\n return colorsHash[hash]\n }\n\n colorsHash[hash] = colors.length\n colors.push(color.getHex())\n\n return colorsHash[hash]\n }\n\n function getUvIndex(uv) {\n const hash = uv.x.toString() + uv.y.toString()\n\n if (uvsHash[hash] !== undefined) {\n return uvsHash[hash]\n }\n\n uvsHash[hash] = uvs.length / 2\n uvs.push(uv.x, uv.y)\n\n return uvsHash[hash]\n }\n\n data.data = {}\n\n data.data.vertices = vertices\n data.data.normals = normals\n if (colors.length > 0) data.data.colors = colors\n if (uvs.length > 0) data.data.uvs = [uvs] // temporal backward compatibility\n data.data.faces = faces\n\n return data\n }\n\n clone() {\n /*\n\t\t // Handle primitives\n\n\t\t const parameters = this.parameters;\n\n\t\t if ( parameters !== undefined ) {\n\n\t\t const values = [];\n\n\t\t for ( const key in parameters ) {\n\n\t\t values.push( parameters[ key ] );\n\n\t\t }\n\n\t\t const geometry = Object.create( this.constructor.prototype );\n\t\t this.constructor.apply( geometry, values );\n\t\t return geometry;\n\n\t\t }\n\n\t\t return new this.constructor().copy( this );\n\t\t */\n\n return new Geometry().copy(this)\n }\n\n copy(source) {\n // reset\n\n this.vertices = []\n this.colors = []\n this.faces = []\n this.faceVertexUvs = [[]]\n this.morphTargets = []\n this.morphNormals = []\n this.skinWeights = []\n this.skinIndices = []\n this.lineDistances = []\n this.boundingBox = null\n this.boundingSphere = null\n\n // name\n\n this.name = source.name\n\n // vertices\n\n const vertices = source.vertices\n\n for (let i = 0, il = vertices.length; i < il; i++) {\n this.vertices.push(vertices[i].clone())\n }\n\n // colors\n\n const colors = source.colors\n\n for (let i = 0, il = colors.length; i < il; i++) {\n this.colors.push(colors[i].clone())\n }\n\n // faces\n\n const faces = source.faces\n\n for (let i = 0, il = faces.length; i < il; i++) {\n this.faces.push(faces[i].clone())\n }\n\n // face vertex uvs\n\n for (let i = 0, il = source.faceVertexUvs.length; i < il; i++) {\n const faceVertexUvs = source.faceVertexUvs[i]\n\n if (this.faceVertexUvs[i] === undefined) {\n this.faceVertexUvs[i] = []\n }\n\n for (let j = 0, jl = faceVertexUvs.length; j < jl; j++) {\n const uvs = faceVertexUvs[j],\n uvsCopy = []\n\n for (let k = 0, kl = uvs.length; k < kl; k++) {\n const uv = uvs[k]\n\n uvsCopy.push(uv.clone())\n }\n\n this.faceVertexUvs[i].push(uvsCopy)\n }\n }\n\n // morph targets\n\n const morphTargets = source.morphTargets\n\n for (let i = 0, il = morphTargets.length; i < il; i++) {\n const morphTarget = {}\n morphTarget.name = morphTargets[i].name\n\n // vertices\n\n if (morphTargets[i].vertices !== undefined) {\n morphTarget.vertices = []\n\n for (let j = 0, jl = morphTargets[i].vertices.length; j < jl; j++) {\n morphTarget.vertices.push(morphTargets[i].vertices[j].clone())\n }\n }\n\n // normals\n\n if (morphTargets[i].normals !== undefined) {\n morphTarget.normals = []\n\n for (let j = 0, jl = morphTargets[i].normals.length; j < jl; j++) {\n morphTarget.normals.push(morphTargets[i].normals[j].clone())\n }\n }\n\n this.morphTargets.push(morphTarget)\n }\n\n // morph normals\n\n const morphNormals = source.morphNormals\n\n for (let i = 0, il = morphNormals.length; i < il; i++) {\n const morphNormal = {}\n\n // vertex normals\n\n if (morphNormals[i].vertexNormals !== undefined) {\n morphNormal.vertexNormals = []\n\n for (let j = 0, jl = morphNormals[i].vertexNormals.length; j < jl; j++) {\n const srcVertexNormal = morphNormals[i].vertexNormals[j]\n const destVertexNormal = {}\n\n destVertexNormal.a = srcVertexNormal.a.clone()\n destVertexNormal.b = srcVertexNormal.b.clone()\n destVertexNormal.c = srcVertexNormal.c.clone()\n\n morphNormal.vertexNormals.push(destVertexNormal)\n }\n }\n\n // face normals\n\n if (morphNormals[i].faceNormals !== undefined) {\n morphNormal.faceNormals = []\n\n for (let j = 0, jl = morphNormals[i].faceNormals.length; j < jl; j++) {\n morphNormal.faceNormals.push(morphNormals[i].faceNormals[j].clone())\n }\n }\n\n this.morphNormals.push(morphNormal)\n }\n\n // skin weights\n\n const skinWeights = source.skinWeights\n\n for (let i = 0, il = skinWeights.length; i < il; i++) {\n this.skinWeights.push(skinWeights[i].clone())\n }\n\n // skin indices\n\n const skinIndices = source.skinIndices\n\n for (let i = 0, il = skinIndices.length; i < il; i++) {\n this.skinIndices.push(skinIndices[i].clone())\n }\n\n // line distances\n\n const lineDistances = source.lineDistances\n\n for (let i = 0, il = lineDistances.length; i < il; i++) {\n this.lineDistances.push(lineDistances[i])\n }\n\n // bounding box\n\n const boundingBox = source.boundingBox\n\n if (boundingBox !== null) {\n this.boundingBox = boundingBox.clone()\n }\n\n // bounding sphere\n\n const boundingSphere = source.boundingSphere\n\n if (boundingSphere !== null) {\n this.boundingSphere = boundingSphere.clone()\n }\n\n // update flags\n\n this.elementsNeedUpdate = source.elementsNeedUpdate\n this.verticesNeedUpdate = source.verticesNeedUpdate\n this.uvsNeedUpdate = source.uvsNeedUpdate\n this.normalsNeedUpdate = source.normalsNeedUpdate\n this.colorsNeedUpdate = source.colorsNeedUpdate\n this.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate\n this.groupsNeedUpdate = source.groupsNeedUpdate\n\n return this\n }\n\n toBufferGeometry() {\n const geometry = new DirectGeometry().fromGeometry(this)\n\n const buffergeometry = new BufferGeometry()\n\n const positions = new Float32Array(geometry.vertices.length * 3)\n buffergeometry.setAttribute('position', new BufferAttribute(positions, 3).copyVector3sArray(geometry.vertices))\n\n if (geometry.normals.length > 0) {\n const normals = new Float32Array(geometry.normals.length * 3)\n buffergeometry.setAttribute('normal', new BufferAttribute(normals, 3).copyVector3sArray(geometry.normals))\n }\n\n if (geometry.colors.length > 0) {\n const colors = new Float32Array(geometry.colors.length * 3)\n buffergeometry.setAttribute('color', new BufferAttribute(colors, 3).copyColorsArray(geometry.colors))\n }\n\n if (geometry.uvs.length > 0) {\n const uvs = new Float32Array(geometry.uvs.length * 2)\n buffergeometry.setAttribute('uv', new BufferAttribute(uvs, 2).copyVector2sArray(geometry.uvs))\n }\n\n if (geometry.uvs2.length > 0) {\n const uvs2 = new Float32Array(geometry.uvs2.length * 2)\n buffergeometry.setAttribute('uv2', new BufferAttribute(uvs2, 2).copyVector2sArray(geometry.uvs2))\n }\n\n // groups\n\n buffergeometry.groups = geometry.groups\n\n // morphs\n\n for (let name in geometry.morphTargets) {\n const array = []\n const morphTargets = geometry.morphTargets[name]\n\n for (let i = 0, l = morphTargets.length; i < l; i++) {\n const morphTarget = morphTargets[i]\n\n const attribute = new Float32BufferAttribute(morphTarget.data.length * 3, 3)\n attribute.name = morphTarget.name\n\n array.push(attribute.copyVector3sArray(morphTarget.data))\n }\n\n buffergeometry.morphAttributes[name] = array\n }\n\n // skinning\n\n if (geometry.skinIndices.length > 0) {\n const skinIndices = new Float32BufferAttribute(geometry.skinIndices.length * 4, 4)\n buffergeometry.setAttribute('skinIndex', skinIndices.copyVector4sArray(geometry.skinIndices))\n }\n\n if (geometry.skinWeights.length > 0) {\n const skinWeights = new Float32BufferAttribute(geometry.skinWeights.length * 4, 4)\n buffergeometry.setAttribute('skinWeight', skinWeights.copyVector4sArray(geometry.skinWeights))\n }\n\n //\n\n if (geometry.boundingSphere !== null) {\n buffergeometry.boundingSphere = geometry.boundingSphere.clone()\n }\n\n if (geometry.boundingBox !== null) {\n buffergeometry.boundingBox = geometry.boundingBox.clone()\n }\n\n return buffergeometry\n }\n\n computeTangents() {\n console.error('THREE.Geometry: .computeTangents() has been removed.')\n }\n\n computeLineDistances() {\n console.error(\n 'THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.',\n )\n }\n\n applyMatrix(matrix) {\n console.warn('THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().')\n return this.applyMatrix4(matrix)\n }\n\n dispose() {\n this.dispatchEvent({ type: 'dispose' })\n }\n}\n\nclass DirectGeometry {\n constructor() {\n this.vertices = []\n this.normals = []\n this.colors = []\n this.uvs = []\n this.uvs2 = []\n\n this.groups = []\n\n this.morphTargets = {}\n\n this.skinWeights = []\n this.skinIndices = []\n\n // this.lineDistances = [];\n\n this.boundingBox = null\n this.boundingSphere = null\n\n // update flags\n\n this.verticesNeedUpdate = false\n this.normalsNeedUpdate = false\n this.colorsNeedUpdate = false\n this.uvsNeedUpdate = false\n this.groupsNeedUpdate = false\n }\n\n computeGroups(geometry) {\n const groups = []\n\n let group, i\n let materialIndex = undefined\n\n const faces = geometry.faces\n\n for (i = 0; i < faces.length; i++) {\n const face = faces[i]\n\n // materials\n\n if (face.materialIndex !== materialIndex) {\n materialIndex = face.materialIndex\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n group = {\n start: i * 3,\n materialIndex,\n }\n }\n }\n\n if (group !== undefined) {\n group.count = i * 3 - group.start\n groups.push(group)\n }\n\n this.groups = groups\n }\n\n fromGeometry(geometry) {\n const faces = geometry.faces\n const vertices = geometry.vertices\n const faceVertexUvs = geometry.faceVertexUvs\n\n const hasFaceVertexUv = faceVertexUvs[0] && faceVertexUvs[0].length > 0\n const hasFaceVertexUv2 = faceVertexUvs[1] && faceVertexUvs[1].length > 0\n\n // morphs\n\n const morphTargets = geometry.morphTargets\n const morphTargetsLength = morphTargets.length\n\n let morphTargetsPosition\n\n if (morphTargetsLength > 0) {\n morphTargetsPosition = []\n\n for (let i = 0; i < morphTargetsLength; i++) {\n morphTargetsPosition[i] = {\n name: morphTargets[i].name,\n data: [],\n }\n }\n\n this.morphTargets.position = morphTargetsPosition\n }\n\n const morphNormals = geometry.morphNormals\n const morphNormalsLength = morphNormals.length\n\n let morphTargetsNormal\n\n if (morphNormalsLength > 0) {\n morphTargetsNormal = []\n\n for (let i = 0; i < morphNormalsLength; i++) {\n morphTargetsNormal[i] = {\n name: morphNormals[i].name,\n data: [],\n }\n }\n\n this.morphTargets.normal = morphTargetsNormal\n }\n\n // skins\n\n const skinIndices = geometry.skinIndices\n const skinWeights = geometry.skinWeights\n\n const hasSkinIndices = skinIndices.length === vertices.length\n const hasSkinWeights = skinWeights.length === vertices.length\n\n //\n\n if (vertices.length > 0 && faces.length === 0) {\n console.error('THREE.DirectGeometry: Faceless geometries are not supported.')\n }\n\n for (let i = 0; i < faces.length; i++) {\n const face = faces[i]\n\n this.vertices.push(vertices[face.a], vertices[face.b], vertices[face.c])\n\n const vertexNormals = face.vertexNormals\n\n if (vertexNormals.length === 3) {\n this.normals.push(vertexNormals[0], vertexNormals[1], vertexNormals[2])\n } else {\n const normal = face.normal\n\n this.normals.push(normal, normal, normal)\n }\n\n const vertexColors = face.vertexColors\n\n if (vertexColors.length === 3) {\n this.colors.push(vertexColors[0], vertexColors[1], vertexColors[2])\n } else {\n const color = face.color\n\n this.colors.push(color, color, color)\n }\n\n if (hasFaceVertexUv === true) {\n const vertexUvs = faceVertexUvs[0][i]\n\n if (vertexUvs !== undefined) {\n this.uvs.push(vertexUvs[0], vertexUvs[1], vertexUvs[2])\n } else {\n console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i)\n\n this.uvs.push(new Vector2(), new Vector2(), new Vector2())\n }\n }\n\n if (hasFaceVertexUv2 === true) {\n const vertexUvs = faceVertexUvs[1][i]\n\n if (vertexUvs !== undefined) {\n this.uvs2.push(vertexUvs[0], vertexUvs[1], vertexUvs[2])\n } else {\n console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i)\n\n this.uvs2.push(new Vector2(), new Vector2(), new Vector2())\n }\n }\n\n // morphs\n\n for (let j = 0; j < morphTargetsLength; j++) {\n const morphTarget = morphTargets[j].vertices\n\n morphTargetsPosition[j].data.push(morphTarget[face.a], morphTarget[face.b], morphTarget[face.c])\n }\n\n for (let j = 0; j < morphNormalsLength; j++) {\n const morphNormal = morphNormals[j].vertexNormals[i]\n\n morphTargetsNormal[j].data.push(morphNormal.a, morphNormal.b, morphNormal.c)\n }\n\n // skins\n\n if (hasSkinIndices) {\n this.skinIndices.push(skinIndices[face.a], skinIndices[face.b], skinIndices[face.c])\n }\n\n if (hasSkinWeights) {\n this.skinWeights.push(skinWeights[face.a], skinWeights[face.b], skinWeights[face.c])\n }\n }\n\n this.computeGroups(geometry)\n\n this.verticesNeedUpdate = geometry.verticesNeedUpdate\n this.normalsNeedUpdate = geometry.normalsNeedUpdate\n this.colorsNeedUpdate = geometry.colorsNeedUpdate\n this.uvsNeedUpdate = geometry.uvsNeedUpdate\n this.groupsNeedUpdate = geometry.groupsNeedUpdate\n\n if (geometry.boundingSphere !== null) {\n this.boundingSphere = geometry.boundingSphere.clone()\n }\n\n if (geometry.boundingBox !== null) {\n this.boundingBox = geometry.boundingBox.clone()\n }\n\n return this\n }\n}\n\nclass Face3 {\n constructor(a, b, c, normal, color, materialIndex = 0) {\n this.a = a\n this.b = b\n this.c = c\n\n this.normal = normal && normal.isVector3 ? normal : new Vector3()\n this.vertexNormals = Array.isArray(normal) ? normal : []\n\n this.color = color && color.isColor ? color : new Color()\n this.vertexColors = Array.isArray(color) ? color : []\n\n this.materialIndex = materialIndex\n }\n\n clone() {\n return new this.constructor().copy(this)\n }\n\n copy(source) {\n this.a = source.a\n this.b = source.b\n this.c = source.c\n\n this.normal.copy(source.normal)\n this.color.copy(source.color)\n\n this.materialIndex = source.materialIndex\n\n for (let i = 0, il = source.vertexNormals.length; i < il; i++) {\n this.vertexNormals[i] = source.vertexNormals[i].clone()\n }\n\n for (let i = 0, il = source.vertexColors.length; i < il; i++) {\n this.vertexColors[i] = source.vertexColors[i].clone()\n }\n\n return this\n }\n}\n\nexport { Face3, Geometry }\n", "// This file is part of meshoptimizer library and is distributed under the terms of MIT License.\n// Copyright (C) 2016-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)\n\ntype API = {\n ready: Promise\n supported: boolean\n decodeVertexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, filter?: string) => void\n decodeIndexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void\n decodeIndexSequence: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void\n decodeGltfBuffer: (\n target: Uint8Array,\n count: number,\n size: number,\n source: Uint8Array,\n mode: string,\n filter?: string,\n ) => void\n}\n\nlet generated: API\n\nconst MeshoptDecoder = () => {\n if (generated) return generated\n\n // Built with clang version 11.0.0 (https://github.com/llvm/llvm-project.git 0160ad802e899c2922bc9b29564080c22eb0908c)\n // Built from meshoptimizer 0.14\n const wasm_base =\n 'B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2B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fb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB'\n\n // Uses bulk-memory and simd extensions\n const 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\n // Used to unpack wasm\n const wasmpack = new Uint8Array([\n 32,\n 0,\n 65,\n 253,\n 3,\n 1,\n 2,\n 34,\n 4,\n 106,\n 6,\n 5,\n 11,\n 8,\n 7,\n 20,\n 13,\n 33,\n 12,\n 16,\n 128,\n 9,\n 116,\n 64,\n 19,\n 113,\n 127,\n 15,\n 10,\n 21,\n 22,\n 14,\n 255,\n 66,\n 24,\n 54,\n 136,\n 107,\n 18,\n 23,\n 192,\n 26,\n 114,\n 118,\n 132,\n 17,\n 77,\n 101,\n 130,\n 144,\n 27,\n 87,\n 131,\n 44,\n 45,\n 74,\n 156,\n 154,\n 70,\n 167,\n ])\n\n if (typeof WebAssembly !== 'object') {\n // This module requires WebAssembly to function\n return {\n supported: false,\n }\n }\n\n let wasm = wasm_base\n\n if (WebAssembly.validate(detector)) {\n wasm = wasm_simd\n }\n\n let instance: any // WebAssembly.Instance\n\n const promise = WebAssembly.instantiate(unpack(wasm), {}).then((result) => {\n instance = result.instance\n instance.exports.__wasm_call_ctors()\n })\n\n function unpack(data: string) {\n const result = new Uint8Array(data.length)\n for (let i = 0; i < data.length; ++i) {\n const ch = data.charCodeAt(i)\n result[i] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62\n }\n let write = 0\n for (let i = 0; i < data.length; ++i) {\n result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i]\n }\n return result.buffer.slice(0, write)\n }\n\n function decode(\n fun: Function,\n target: Uint8Array,\n count: number,\n size: number,\n source: Uint8Array,\n filter?: Function,\n ) {\n const sbrk = instance.exports.sbrk\n const count4 = (count + 3) & ~3 // pad for SIMD filter\n const tp = sbrk(count4 * size)\n const sp = sbrk(source.length)\n const heap = new Uint8Array(instance.exports.memory.buffer)\n heap.set(source, sp)\n const res = fun(tp, count, size, sp, source.length)\n if (res === 0 && filter) {\n filter(tp, count4, size)\n }\n target.set(heap.subarray(tp, tp + count * size))\n sbrk(tp - sbrk(0))\n if (res !== 0) {\n throw new Error(`Malformed buffer data: ${res}`)\n }\n }\n\n const filters = {\n // legacy index-based enums for glTF\n 0: '',\n 1: 'meshopt_decodeFilterOct',\n 2: 'meshopt_decodeFilterQuat',\n 3: 'meshopt_decodeFilterExp',\n // string-based enums for glTF\n NONE: '',\n OCTAHEDRAL: 'meshopt_decodeFilterOct',\n QUATERNION: 'meshopt_decodeFilterQuat',\n EXPONENTIAL: 'meshopt_decodeFilterExp',\n }\n\n const decoders = {\n // legacy index-based enums for glTF\n 0: 'meshopt_decodeVertexBuffer',\n 1: 'meshopt_decodeIndexBuffer',\n 2: 'meshopt_decodeIndexSequence',\n // string-based enums for glTF\n ATTRIBUTES: 'meshopt_decodeVertexBuffer',\n TRIANGLES: 'meshopt_decodeIndexBuffer',\n INDICES: 'meshopt_decodeIndexSequence',\n }\n\n generated = {\n ready: promise,\n supported: true,\n decodeVertexBuffer(target, count, size, source, filter) {\n decode(\n instance.exports.meshopt_decodeVertexBuffer,\n target,\n count,\n size,\n source,\n instance.exports[filters[filter as keyof typeof filters]],\n )\n },\n decodeIndexBuffer(target, count, size, source) {\n decode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source)\n },\n decodeIndexSequence(target, count, size, source) {\n decode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source)\n },\n decodeGltfBuffer(target, count, size, source, mode, filter) {\n decode(\n instance.exports[decoders[mode as keyof typeof decoders]],\n target,\n count,\n size,\n source,\n instance.exports[filters[filter as keyof typeof filters]],\n )\n },\n }\n\n return generated\n}\n\nexport { MeshoptDecoder }\n", "// @ts-nocheck\n/* eslint-disable */\n\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 'use strict';\n\n // Built with clang version 14.0.4\n // Built from meshoptimizer 0.18\n var wasm_base =\n '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 =\n '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 var detector = new Uint8Array([\n 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,\n 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11\n ]);\n var wasmpack = new Uint8Array([\n 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,\n 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,\n 29, 73, 115\n ]);\n\n if (typeof WebAssembly !== 'object') {\n return {\n supported: false\n };\n }\n\n var wasm = WebAssembly.validate(detector) ? wasm_simd : wasm_base;\n\n var instance;\n\n var ready = WebAssembly.instantiate(unpack(wasm), {}).then(function (result) {\n instance = result.instance;\n instance.exports.__wasm_call_ctors();\n });\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) {\n result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];\n }\n return result.buffer.slice(0, write);\n }\n\n function decode(fun, target, count, size, source, filter) {\n var sbrk = instance.exports.sbrk;\n var count4 = (count + 3) & ~3;\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) {\n filter(tp, count4, size);\n }\n target.set(heap.subarray(tp, tp + count * size));\n sbrk(tp - sbrk(0));\n if (res != 0) {\n throw new Error('Malformed buffer data: ' + res);\n }\n }\n\n var filters = {\n NONE: '',\n OCTAHEDRAL: 'meshopt_decodeFilterOct',\n QUATERNION: 'meshopt_decodeFilterQuat',\n EXPONENTIAL: 'meshopt_decodeFilterExp'\n };\n\n var decoders = {\n ATTRIBUTES: 'meshopt_decodeVertexBuffer',\n TRIANGLES: 'meshopt_decodeIndexBuffer',\n INDICES: 'meshopt_decodeIndexSequence'\n };\n\n var workers = [];\n var requestId = 0;\n\n function createWorker(url) {\n var worker = {\n object: new Worker(url),\n pending: 0,\n requests: {}\n };\n\n worker.object.onmessage = function (event) {\n var data = event.data;\n\n worker.pending -= data.count;\n worker.requests[data.id][data.action](data.value);\n\n delete worker.requests[data.id];\n };\n\n return worker;\n }\n\n function initWorkers(count) {\n var source =\n 'var instance; var ready = WebAssembly.instantiate(new Uint8Array([' +\n new Uint8Array(unpack(wasm)) +\n ']), {})' +\n '.then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });' +\n 'self.onmessage = workerProcess;' +\n decode.toString() +\n workerProcess.toString();\n\n var blob = new Blob([source], { type: 'text/javascript' });\n var url = URL.createObjectURL(blob);\n\n for (var i = 0; i < count; ++i) {\n workers[i] = createWorker(url);\n }\n\n URL.revokeObjectURL(url);\n }\n\n function decodeWorker(count, size, source, mode, filter) {\n var worker = workers[0];\n\n for (var i = 1; i < workers.length; ++i) {\n if (workers[i].pending < worker.pending) {\n worker = workers[i];\n }\n }\n\n return new Promise(function (resolve, reject) {\n var data = new Uint8Array(source);\n var id = requestId++;\n\n worker.pending += count;\n worker.requests[id] = { resolve: resolve, reject: reject };\n worker.object.postMessage({ id: id, count: count, size: size, source: data, mode: mode, filter: filter }, [\n data.buffer\n ]);\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({ id: data.id, count: data.count, action: 'resolve', value: target }, [target.buffer]);\n } catch (error) {\n self.postMessage({ id: data.id, count: data.count, action: 'reject', 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(\n instance.exports.meshopt_decodeVertexBuffer,\n target,\n count,\n size,\n source,\n instance.exports[filters[filter]]\n );\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) {\n return decodeWorker(count, size, source, decoders[mode], filters[filter]);\n }\n\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\nexport { MeshoptDecoder };\n"], + "mappings": ";iqBAAA,IAAAA,GAAAC,EAAAC,GAAA,KAAAF,GAAA,CAAC,ICAD,IAAAG,EAAAC,GAAA,QCAA,IAAAC,EAAAC,GAAA,QCAA,IAAAC,G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O,CAAE,EACrB,aAAc,CAAE,MAAO,CAAE,EACzB,UAAW,CAAE,MAAO,EAAM,EAC1B,QAAS,CAAE,MAAO,EAAM,CAC1B,EAEA,aAAc,CACZ,oBAEA,gBAEA,aACA,2EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,qCACA,0CACA,yBACA,sBACA,0BACA,uBACA,yBACA,4BACA,8BACA,yBACA,6BACA,4BACA,8BACA,wBACA,yBACA,yBACA,yBACA,yBACA,uBACA,wBACA,qBACA,wBACA,0BACA,4BACA,oBACA,0BACA,yBAEA,6CAGA,mCAEA,IAEA,oCAGA,iCAEA,IAEA,2BAGA,+EAEA,IAEA,4GAGA,uDACA,wBAEA,+BAEA,8CAEA,0CAEA,8CAEA,yBACA,qGACA,wFACA,MAEA,uCAEA,2CACA,+EACA,wDAEA,yCAEA,gEACA,uCACA,uCACA,kCACA,6FAEA,KAEA,sBAEA,IAEA,gBAGA,gBACA,YACA,YACA,YACA,YACA,gBACA,gBACA,gBACA,gBAEA,KAEA,iCAGA,gFACA,0EACA,wCACA,+BAEA,yCAEA,wCACA,mEACA,6EAEA,KAEA,kCACA,eAEA,IAEA,6EAGA,sDAEA,yBAEA,mCACA,mCACA,mCACA,mCAEA,8BAEA,mCACA,mCACA,mCACA,mCAEA,YAEA,mCACA,mCACA,mCACA,mCAEA,KAEA,gFACA,gFACA,gFACA,gFACA,sEACA,uEACA,uEACA,uEACA,iCAEA,eAEA,IAEA,+EAGA,WAGA,0DACA,iCACA,2EACA,0EACA,6DACA,mEACA,yDACA,gHACA,2GACA,qDACA,sGAGA,iBACA,yDACA,yDAGA,2BAEA,+CACA,8EACA,0CACA,0CAEA,KAGA,sFACA,gFACA,wCACA,wCACA,sCACA,sCACA,0DACA,0DAEA,aAEA,IAEA,mDAGA,4CACA,mCACA,gDACA,6CACA,qDACA,6CACA,oDACA,uCACA,mDACA,uCACA,YACA,mCACA,KAEA,IAEA,gBAEA,sBAGA,oDACA,gCACA,uDAGA,kE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CACZ,oBAEA,gBAEA,aACA,6EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,uBACA,yBAEA,4BACA,4BAEA,oBAEA,gBAEA,0CAEA,mCAEA,gFAEA,uBACA,yBAEA,GAAA,EACA,KAAK;CAAI,CACb,cCtCO,IAAMC,GAAa,CACxB,SAAU,CACR,SAAU,CAAE,MAAO,IAAK,EACxB,WAAY,CAAE,MAAO,IAAIC,GAAQ,EAAI,KAAM,EAAI,GAAG,CAAE,CACtD,EAEA,aAAc,CACZ,oBAEA,gBAEA,aACA,6EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,yBACA,GACA,8BACA,GACA,2BACA,GACA,oBACA,GACA,6FACA,GACA,uFACA,kEACA,wBACA,uCACA,+CACA,KACA,uEACA,KACA,wEACA,wEACA,cACA,uEACA,sEACA,0EACA,4EACA,6EACA,oEACA,wEACA,sEACA,KACA,0EACA,uEACA,wEACA,uEACA,2EACA,yEACA,wEACA,yEACA,kEACA,2EACA,0EACA,KACA,uFACA,GACA,oBACA,0BACA,iCACA,GACA,+BACA,GACA,iFACA,0BACA,SACA,kDACA,4DACA,yEACA,SACA,gCACA,SACA,iFACA,wBACA,8BACA,SACA,iFACA,wBACA,8BACA,SACA,iFACA,sBACA,4BACA,SACA,iFACA,sBACA,4BACA,SACA,iFACA,sBACA,4BACA,SACA,iFACA,6BACA,SACA,2CACA,sEACA,mEACA,8DACA,SACA,6EACA,2EACA,SACA,oDACA,wCACA,wCACA,iEACA,gDACA,SACA,iBACA,kBACA,SACA,mCACA,SACA,iFACA,0BACA,SACA,+CACA,6DACA,4EACA,yEACA,iCACA,SACA,iBACA,kBACA,SACA,gCACA,SACA,iFACA,uBACA,SACA,6CACA,6DACA,SACA,wDACA,yEACA,mEACA,SACA,6BACA,SACA,iFACA,iCACA,SACA,iCACA,SACA,gDACA,2CACA,SACA,gCACA,2CACA,aACA,+BACA,2CACA,aACA,gCACA,2CACA,aACA,qCACA,2CACA,aACA,SACA,iFACA,6BACA,SACA,oDACA,4DACA,SACA,6BACA,uCACA,aACA,gCACA,uCACA,aACA,+BACA,uCACA,aACA,iCACA,uCACA,aACA,SACA,GACA,GACA,iFACA,sDACA,iFACA,qEACA,iFACA,8BACA,SACA,oCACA,uEACA,uDACA,mEACA,SACA,iBACA,iFACA,2EACA,iFACA,8CACA,SACA,eACA,iFACA,8EACA,8DACA,gEACA,kEACA,6DACA,SACA,qCACA,SACA,GACA,GACA,iFACA,GACA,oDACA,GACA,iFACA,GACA,iFACA,4DACA,iFACA,kCACA,gCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,GACA,iFACA,yDACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,gCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,SACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,SACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,mCACA,SACA,GACA,iFACA,sDACA,iFACA,kCACA,iCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,kCACA,mCACA,mCACA,SACA,GACA,GACA,GACA,iFACA,GACA,8CACA,GACA,iFACA,2EACA,4BACA,kCACA,8BACA,8BACA,8BACA,8BACA,6BACA,6BACA,6BACA,6BACA,6BACA,4CACA,gCACA,QACA,4BACA,mCACA,8BACA,gCACA,gCACA,gCACA,4BACA,8BACA,8BACA,8BACA,qCACA,SACA,iFACA,2BACA,kDACA,kEACA,SACA,iFACA,2BACA,mBACA,uBACA,uBACA,iDACA,6DACA,uDACA,wCACA,0EACA,YACA,2EACA,aACA,oCACA,wDACA,6DACA,4EACA,6DACA,4EACA,aACA,SACA,iFACA,2BACA,2CACA,qDACA,oEACA,oCACA,wDACA,6DACA,4EACA,6DACA,4EACA,aACA,SACA,iFACA,yBACA,8BACA,gCACA,gEACA,4EACA,SACA,iFACA,yBACA,4BACA,4DACA,iEACA,0EACA,SACA,iFACA,yBACA,4BACA,4DACA,iEACA,0EACA,+DACA,wEACA,+DACA,wEACA,SACA,GACA,GACA,iFACA,2DACA,iFACA,gCACA,6DACA,QACA,6DACA,SACA,GACA,GACA,GACA,GACA,iFACA,GACA,kDACA,GACA,iFACA,qBACA,iFACA,8BACA,SACA,oFACA,gCACA,sBACA,SACA,sEACA,oFACA,qCACA,sCACA,oCACA,SACA,8BACA,4DACA,sCACA,iEACA,mBACA,SACA,iEACA,4EACA,+DACA,4DACA,8CACA,SACA,iEACA,4EACA,+DACA,4DACA,8CACA,SACA,oCACA,+CACA,wCACA,yCACA,sCACA,SACA,oCACA,+CACA,oEACA,mCACA,gCACA,gCACA,wCACA,yCACA,wCACA,yCACA,yCACA,SACA,oCACA,kDACA,+CACA,0CACA,2CACA,0CACA,2CACA,0CACA,SACA,oCACA,+DACA,+CACA,0CACA,2CACA,0CACA,2CACA,6CACA,SACA,oCACA,yDACA,gDACA,0DACA,oCACA,uCACA,8CACA,yEACA,6BACA,iCACA,mCACA,SACA,oCACA,iEACA,gDACA,2EACA,uCACA,+BACA,2BACA,gCACA,qCACA,0CACA,SACA,oCACA,qEACA,gDACA,oDACA,iFACA,0CACA,2CACA,sDACA,4CACA,+CACA,uDACA,wDACA,wEACA,6CACA,SACA,oCACA,iEACA,gDACA,oEACA,wDACA,2CACA,iEACA,yEACA,4DACA,uCACA,yBACA,qEACA,0CACA,SACA,oCACA,iEACA,gDACA,oEACA,wDACA,2CACA,6DACA,yEACA,+EACA,+CACA,kEACA,qDACA,0CACA,SACA,oCACA,qEACA,gDACA,oDACA,+EACA,sDACA,qCACA,+DACA,oDACA,0BACA,oDACA,sDACA,4CACA,+CACA,uDACA,wDACA,wEACA,6CACA,SACA,oDACA,yDACA,0EACA,2DACA,iDACA,wCACA,MACA,iFACA,uBACA,sBACA,sBACA,oCACA,kCACA,wDACA,4CACA,wCACA,oBACA,wCACA,qBACA,iBACA,wCACA,4DACA,iFACA,gBACA,4DACA,iFACA,iBACA,kCACA,qCACA,iBACA,iCACA,iCACA,kCACA,kCACA,iCACA,iCACA,YACA,oDACA,wCACA,oCACA,gBACA,oCACA,iBACA,mCACA,8GACA,8GACA,8GACA,8GACA,gBACA,wGACA,wGACA,wGACA,wGACA,iBACA,aACA,iFACA,2CACA,2CACA,4CACA,4CACA,2CACA,2CACA,+CACA,+CACA,sEACA,6CACA,oFACA,oDACA,iFACA,oBACA,kCACA,2BACA,gBACA,4BACA,iBACA,iFACA,oCACA,mCACA,+GACA,+GACA,+GACA,+GACA,gBACA,yGACA,yGACA,yGACA,yGACA,iBACA,YACA,uGACA,uGACA,aACA,iFACA,wCACA,wCACA,4CACA,8CACA,qDACA,qDACA,iFACA,4CACA,4CACA,uDACA,uDACA,iFACA,4CACA,4CACA,qEACA,qEACA,uDACA,uDACA,uDACA,uDACA,iFACA,sDACA,oDACA,gDACA,6DACA,iFACA,mCACA,mCACA,uDACA,0DACA,iFACA,2CACA,2CACA,wCACA,wCACA,yDACA,gEACA,0CACA,kEACA,iFACA,uBACA,uBACA,uBACA,wBACA,2DACA,2DACA,gDACA,gDACA,iFACA,uBACA,mDACA,mDACA,uBACA,mDACA,mDACA,kDACA,4DACA,6CACA,4DACA,iFACA,kCACA,qDACA,+CACA,6CACA,2CACA,iFACA,gCACA,gCACA,wDACA,wDACA,sDACA,sDACA,8CACA,sDACA,sDACA,iFACA,mBACA,oEACA,oEACA,yDACA,yDACA,mDACA,mDACA,0DACA,0DACA,yCACA,0DACA,0DACA,iFACA,oCACA,uBACA,wEACA,wEACA,6DACA,6DACA,uDACA,uDACA,8DACA,8DACA,6CACA,8DACA,8DACA,iFACA,wCACA,2BACA,4EACA,4EACA,iEACA,iEACA,2DACA,2DACA,kEACA,kEACA,iDACA,kEACA,kEACA,iFACA,4CACA,+BACA,gFACA,gFACA,qEACA,qEACA,+DACA,+DACA,sEACA,sEACA,qDACA,sEACA,sEACA,iFACA,gDACA,mCACA,oFACA,oFACA,yEACA,yEACA,mEACA,mEACA,0EACA,0EACA,yDACA,0EACA,0EACA,iFACA,oDACA,uCACA,wFACA,wFACA,6EACA,6EACA,uEACA,uEACA,8EACA,8EACA,6DACA,8EACA,8EACA,iFACA,gCACA,mBACA,oEACA,oEACA,yDACA,yDACA,mDACA,mDACA,0DACA,0DACA,yCACA,0DACA,0DACA,iFACA,oCACA,uBACA,wEACA,wEACA,6DACA,6DACA,uDACA,uDACA,8DACA,8DACA,6CACA,8DACA,8DACA,iFACA,yCACA,2BACA,4EACA,4EACA,iEACA,iEACA,2DACA,2DACA,mEACA,mEACA,iDACA,mEACA,mEACA,iFACA,6CACA,+BACA,gFACA,gFACA,qEACA,qEACA,+DACA,+DACA,uEACA,uEACA,qDACA,uEACA,uEACA,iFACA,iDACA,mCACA,oFACA,oFACA,yEACA,yEACA,mEACA,mEACA,2EACA,2EACA,yDACA,2EACA,2EACA,iFACA,wBACA,6BACA,iFACA,oBACA,yBACA,iFACA,gBACA,qBACA,iFACA,YACA,iBACA,iFACA,QACA,aACA,iFACA,4BACA,iCACA,iFACA,wBACA,6BACA,iFACA,oBACA,yBACA,iFACA,gBACA,qBACA,iFACA,YACA,iBACA,iFACA,QACA,iFACA,wCACA,wCACA,4CACA,4CACA,iFACA,4DACA,4CACA,4DACA,gDACA,iFACA,yCACA,uCACA,8DACA,6CACA,8DACA,uDACA,iFACA,gEACA,mEACA,8DACA,8DACA,8BACA,wCACA,YACA,+DACA,aACA,IACA,iFACA,SACA,GACA,gBACA,oCACA,WACA,iBACA,gBACA,gBACA,gBACA,kBACA,iBACA,iBACA,iBACA,YACA,aACA,cACA,WACA,WACA,WACA,gBACA,OACA,GACA,wDACA,iDACA,GAAA,EACA,KAAK;CAAI,CACb,EC7kCOC,IAAAC,IAAAC,IAAA,IAAMC,GAAc,CACzB,SAAU,CACR,SAAU,CAAE,MAAO,IAAK,EACxB,YAAa,CAAE,MAAO,IAAK,EAC3B,aAAc,CAAE,MAAO,IAAK,EAC5B,eAAgB,CAAE,MAAO,GAAK,EAC9B,WAAY,CAAE,MAAO,MAAQ,CAC/B,EAEA,aAAc,CACZ,oBAEA,gBAEA,aACA,6EAEA,GAAA,EACA,KAAK;CAAI,EAEX,eAAgB,CACd,6BACA,8BACA,gCACA,4BAEA,8BAEA,oBAEA,gBAEA,8BACA,yBACA,aACA,kBAEA,kDAEA,6CACA,wCAEA,oEAEA,iFAEA,qFACA,sCAEA,qFACA,sCAEA,sFACA,sCAEA,sFACA,sCAEA,uFACA,sCAEA,uFACA,sCAEA,sFACA,sCAEA,wDACA,gGAEA,iFAEA,GAAA,EACA,KAAK;CAAI,CACb,cCvEO,IAAMC,GAAiB,CAC5B,SAAU,CACR,SAAU,CAAE,MAAO,IAAK,EACxB,OAAQ,CAAE,MAAO,IAAIC,GAAQ,IAAK,G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ACA,OACA,QACA,YACA,OACA,QACA,UACA,WACA,KACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,cACA,YACA,eACA,cACA,aACA,YACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,YACA,MACA,aACA,aACA,aACA,OACA,WACA,WACA,MACA,SACA,UACA,WACA,cACA,eACA,gBACA,gBACA,iBACA,KACA,KACA,SACA,SACA,YACA,iBACA,YACA,SACA,iBACA,eACA,gBACA,iBACA,WACA,cACA,eACA,QACA,QACA,aACA,QACA,SACA,QACA,YACA,WACA,OACA,UACA,eACA,SACA,QACA,SACA,KACA,cACA,SACA,SACA,KACA,eACA,KACA,WACA,SACA,SACA,KACA,aACA,cACA,aACA,KACA,YACA,MACA,UACA,YACA,QACA,aACA,SACA,YACA,SACA,QACA,gBACA,cACA,aACA,QACA,MACA,WACA,gBACA,YACA,SACA,cACA,YACA,SACA,QACA,SACA,WACA,SACA,cACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,YACA,SACA,SACA,cACA,YACA,SACA,QACA,SACA,WACA,SACA,cACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,YACA,SACA,cACA,oBACA,iBACA,iBACA,iBACA,aACA,oBACA,qBACA,SACA,iBACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,gBACA,sBACA,iBACA,gBACA,YACA,YACA,eACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,KACA,MACA,MACA,oBACA,qBACA,kBACA,iBACA,aACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,gBACA,YACA,SACA,aACA,kBACA,eACA,cACA,cACA,cACA,gBACA,aACA,aACA,iBACA,cACA,aACA,iBACA,cACA,YACA,eACA,oBACA,YACA,eACA,cACA,eACA,WACA,YACA,eACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,iBACA,iBACA,gBACA,cACA,cACA,mBACA,cACA,iBACA,aACA,UACA,gBACA,cACA,cACA,mBACA,iBACA,cACA,cACA,mBACA,iBACA,WACA,cACA,cACA,cACA,mBACA,cACA,iBACA,UACA,cACA,cACA,cACA,mBACA,iBACA,cACA,aACA,iBACA,UACA,UACA,UACA,UACA,QACA,OACA,OACA,QACA,SACA,UACA,QACA,UACD,EAEGC,GAAsB,CACxB,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,QACA,SACA,WACA,aACA,SACA,UACA,YACA,aACA,YACA,aACA,WACA,OACA,QACA,SACA,SACA,QACA,OACA,MACA,MACA,QACA,OACA,OACA,MACA,QACA,QACA,OACA,QACA,YACA,OACA,QACA,UACA,WACA,KACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,cACA,YACA,eACA,cACA,aACA,YACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,YACA,MACA,aACA,aACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,aACA,OACA,WACA,WACA,MACA,SACA,UACA,WACA,cACA,eACA,gBACA,gBACA,iBACA,KACA,KACA,GACA,SACA,SACA,YACA,iBACA,GACA,YACA,SACA,iBACA,eACA,gBACA,iBACA,WACA,cACA,GACA,eACA,GACA,QACA,QACA,aACA,QACA,SACA,QACA,YACA,WACA,GACA,OACA,UACA,GACA,eACA,SACA,QACA,SACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,KACA,GACA,cACA,GACA,GACA,GACA,GACA,SACA,SACA,KACA,eACA,GACA,GACA,GACA,GACA,GACA,KACA,GACA,GACA,GACA,WACA,GACA,GACA,SACA,SACA,KACA,YACD,EAEGC,GAAoB,CACtB,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,QACA,cACA,oBACA,GACA,iBACA,iBACA,iBACA,aACA,oBACA,qBACA,iBACA,iBACA,QACA,SACA,SACA,WACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,QACA,YACA,gBACA,sBACA,iBACA,gBACA,GACA,YACA,YACA,eACA,YACA,YACA,GACA,GACA,YACA,GACA,GACA,YACA,YACA,YACA,YACA,GACA,GACA,YACA,YACA,YACA,GACA,KACA,KACA,KACA,MACA,MACA,oBACA,GACA,qBACA,kBACA,iBACA,aACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,gBACA,YACA,SACA,aACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,kBACA,eACA,cACA,GACA,GACA,cACA,cACA,gBACA,aACA,aACA,GACA,iBACA,GACA,GACA,cACA,GACA,GACA,aACA,iBACA,GACA,GACA,cACA,YACA,eACA,GACA,GACA,GACA,aACA,UACA,gBACA,oBACA,YACA,eACA,cACA,eACA,WACA,YACA,GACA,GACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,cACA,cACA,gBACA,eACA,eACA,cACA,gBACA,gBACA,eACA,eACA,iBACA,iBACA,gBACA,cACA,cACA,mBACA,cACA,iBACA,aACA,UACA,gBACA,cACA,cACA,mBACA,iBACA,cACA,cACA,mBACA,iBACA,WACA,cACA,cACA,cACA,mBACA,cACA,iBACA,UACA,cACA,cACA,cACA,mBACA,iBACA,cACA,aACA,gBACD,EAEGC,GAAgB,CAClB,UACA,QACA,mBACA,QACA,SACA,WACA,aACA,SACA,UACA,YACA,cACA,YACA,aACA,WACA,OACA,QACA,SACA,SACA,QACA,OACA,MACA,MACA,QACA,OACA,OACA,MACA,QACA,QACA,OACA,QACA,YACA,OACA,QACA,UACA,WACA,KACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,cACA,YACA,eACA,cACA,aACA,QACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,YACA,MACA,aACA,aACA,YACA,QACA,WACA,SACA,SACA,YACA,YACA,SACA,SACA,cACA,YACA,SACA,QACA,WACA,SACA,SACA,cACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,SACA,cACA,YACA,SACA,SACA,OACA,WACA,UACA,SACA,YACA,aACA,aACA,YACA,YACA,QACA,WACA,WACA,KACA,SACA,WACA,YACA,YACA,eACA,MACA,KACA,cACA,YACA,UACA,KACA,WACA,cACA,eACA,QACA,KACA,SACA,eACA,aACA,aACA,UACA,SACA,cACA,QACA,gBACA,iBACA,WACA,mBACA,SACA,SACA,SACA,KACA,KACA,SACA,SACA,eACA,gBACA,YACA,aACA,SACA,UACA,YACA,YACA,WACA,WACA,gBACA,iBACA,KACA,KACA,YACA,iBACA,iBACA,eACA,cACA,cACA,cACA,SACA,YACA,SACA,SACA,cACA,YACA,SACA,SACA,cACA,QACA,SACA,SACA,cACA,SACA,WACA,aACA,QACA,SACA,QACA,YACA,OACA,UACA,eACA,SACA,QACA,SACA,SACA,SACA,SACA,SACA,SACA,YACA,MACA,MACA,SACA,SACA,QACA,QACA,QACA,WACA,cACA,cACA,gBACA,UACA,aACA,gBACA,QACA,SACA,SACA,aACA,WACA,WACA,SACA,SACA,SACA,SACA,QACD,EAWD,SAASC,GAAgBC,EAAM,CAC7B,KAAK,KAAOA,CACb,CAEDD,GAAgB,UAAU,iBAAmB,SAAUzN,EAAG,CACxD,IAAIoM,EAAOpM,EAAE,YAAY,CAAC,EACtBuM,EAAS,KAAK,KAAK,OACvB,GAAIA,GACF,QAAS/P,EAAI,EAAGA,EAAI+P,EAAO,OAAQ/P,GAAK,EAEtC,QADImQ,EAAQJ,EAAO,IAAI/P,CAAC,EACf0G,EAAI,EAAGA,EAAIyJ,EAAM,SAAS,OAAQzJ,GAAK,EAC9C,GAAIyJ,EAAM,SAASzJ,CAAC,IAAMkJ,EACxB,OAAO5P,EAKf,OAAO,IACR,EAQD,SAASmR,GAAa7C,EAAM,CAC1B,KAAK,KAAOA,CACb,CAMD6C,GAAa,UAAU,iBAAmB,SAAU3N,EAAG,CACrD,O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uB,SAAUH,EAAOC,EAAMC,EAAQoB,EAAMnB,EAAQ,CAClE,OAAIS,EAAQ,OAAS,EACZS,EAAarB,EAAOC,EAAMC,EAAQS,EAASW,CAAI,EAAGZ,EAAQP,CAAM,CAAC,EAGnEb,EAAM,KAAK,UAAY,CAC5B,IAAIS,EAAS,IAAI,WAAWC,EAAQC,CAAI,EACxC,OAAAJ,EAAOR,EAAS,QAAQsB,EAASW,CAAI,CAAC,EAAGvB,EAAQC,EAAOC,EAAMC,EAAQb,EAAS,QAAQqB,EAAQP,CAAM,CAAC,CAAC,EAChGJ,CACT,CAAC,CACH,CACF,CACF,EAAG,EpJjKI,IAAM4B,GAAqBC,GAChC,WAA6DA,CAAW,GAoL1E,IAAMC,GAAS,IAAIC,GACnBD,GAAO,kBAAkBE,EAAc,EAEvC,IAAMC,GAAc,IAAIC,GACxBD,GAAY,eAAe,yDAAyD,EACpFH,GAAO,eAAeG,EAAW,EH3NjC,IAAOE,GAAQC,GAAO,CACpB,KAAM,QACN,WAAYC,GAAkB,UAAU,EACxC,SAAU,wBACZ,CAAC,EFJDC,GAAO,UAAU,CACf,MAAAC,GACA,cAAe,QACf,UAAW,EACb,CAAC", "names": ["define_module_default", "init_define_module", "__esmMin", "init_define_process_env", "__esmMin", "init_define_process_env_NODE_PATH", "__esmMin", "react_exports", "__export", "Children", "Component", "Fragment", "Profiler", "PureComponent", "StrictMode", "Suspense", "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED", "cloneElement", "createContext", "createElement", "createFactory", "createRef", "react_default", "forwardRef", "isValidElement", "lazy", "memo", "useCallback", "useContext", "useDebugValue", "useEffect", "useImperativeHandle", "useLayoutEffect", "useMemo", "useReducer", "useRef", "useState", "version", "init_react", "__esmMin", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "require_react_reconciler_constants_production_min", "__commonJSMin", "exports", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "require_constants", "__commonJSMin", "exports", "module", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "require_scheduler_production_min", "__commonJSMin", "exports", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "f", "a", "b", "c", "d", "e", "g", "h", "k", "w", "m", "C", "n", "x", "l", "p", "q", "r", "t", "u", "v", "y", "z", "A", "B", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "require_scheduler", "__commonJSMin", "exports", "module", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "require_react_reconciler_production_min", "__commonJSMin", "exports", "module", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "$$$hostConfig", "aa", "ba", "ca", "n", "a", "b", "c", "ea", "fa", "ha", "ia", "ja", "ka", "la", "ma", "na", "oa", "pa", "qa", "ra", "sa", "ta", "ua", "va", "xa", "ya", "za", "Aa", "d", "e", "f", "g", "h", "Ba", "Ca", "Da", "Ea", "Fa", "Ga", "Ha", "Ia", "Ja", "Ka", "La", "Ma", "Na", "Oa", "Pa", "Qa", "Ra", "Sa", "Ta", "Ua", "Va", "p", "Wa", "Xa", "Ya", "Za", "$a", "ab", "bb", "cb", "db", "eb", "fb", "gb", "hb", "ib", "jb", "kb", "lb", "mb", "nb", "ob", "pb", "qb", "rb", "sb", "tb", "ub", "vb", "wb", "xb", "yb", "zb", "Ab", "Bb", "Cb", "Db", "Eb", "Fb", "Gb", "Hb", "Ib", "Jb", "Kb", "Lb", "Mb", "Nb", "Ob", "Pb", "Qb", "Rb", "Sb", "Tb", "Ub", "Vb", "Wb", "Xb", "Yb", "Zb", "$b", "ac", "bc", "cc", "l", "k", "dc", "ec", "fc", "gc", "x", "y", "hc", "A", "B", "ic", "jc", "C", "kc", "lc", "mc", "nc", "oc", "qc", "pc", "rc", "sc", "tc", "uc", "vc", "wc", "xc", "yc", "zc", "Ac", "Bc", "Cc", "Dc", "D", "Ec", "Fc", "Gc", "Hc", "Ic", "E", "Jc", "Kc", "Lc", "Mc", "Nc", "Oc", "Pc", "Qc", "Rc", "Sc", "Tc", "Uc", "Vc", "Wc", "Xc", "Yc", "Zc", "$c", "ad", "bd", "cd", "dd", "ed", "fd", "gd", "hd", "id", "jd", "kd", "ld", "md", "nd", "od", "pd", "qd", "rd", "F", "G", "sd", "td", "ud", "m", "v", "r", "z", "q", "N", "vd", "wd", "xd", "yd", "Bd", "H", "zd", "Ad", "Cd", "Dd", "Ed", "Fd", "Gd", "Hd", "Id", "Jd", "Kd", "Ld", "Md", "Nd", "Od", "Pd", "Qd", "Rd", "Sd", "Td", "Ud", "I", "Vd", "Wd", "Xd", "Yd", "Zd", "$d", "ae", "be", "ce", "de", "ee", "fe", "ge", "he", "ie", "je", "ke", "le", "me", "ne", "w", "u", "t", "V", "da", "oe", "pe", "qe", "re", "se", "te", "ue", "ve", "we", "xe", "ye", "J", "ze", "Ae", "Be", "Ce", "De", "Ee", "K", "L", "M", "Fe", "Ge", "He", "Ie", "O", "Je", "Ke", "Le", "Me", "Ne", "Oe", "Pe", "Qe", "Re", "Se", "Te", "Ue", "Ve", "We", "Xe", "Ye", "Ze", "$e", "af", "bf", "cf", "df", "ef", "ff", "gf", "hf", "jf", "kf", "lf", "mf", "nf", "of", "pf", "qf", "rf", "sf", "tf", "uf", "vf", "wf", "xf", "yf", "zf", "Af", "Bf", "Cf", "Df", "Ef", "Ff", "Gf", "Hf", "If", "Jf", "Kf", "Lf", "Mf", "Nf", "Of", "Pf", "Qf", "P", "Rf", "Sf", "Q", "Tf", "Uf", "Vf", "Wf", "Xf", "R", "Yf", "Zf", "$f", "ag", "bg", "cg", "dg", "eg", "fg", "gg", "hg", "ig", "jg", "kg", "lg", "mg", "ng", "og", "pg", "qg", "rg", "sg", "tg", "ug", "vg", "wg", "xg", "yg", "zg", "Ag", "S", "Bg", "T", "Cg", "Dg", "Eg", "Fg", "Gg", "Hg", "Ig", "Jg", "Kg", "Lg", "Mg", "Ng", "Og", "Pg", "Qg", "Rg", "Sg", "Tg", "Ug", "wa", "Vg", "Wg", "Xg", "Yg", "Zg", "$g", "ah", "bh", "ch", "dh", "eh", "fh", "gh", "hh", "ih", "jh", "kh", "lh", "mh", "nh", "U", "W", "X", "oh", "ph", "qh", "rh", "Y", "sh", "th", "uh", "vh", "wh", "xh", "yh", "zh", "Ah", "Bh", "Z", "Ch", "Dh", "Eh", "Fh", "Gh", "Hh", "Ih", "Jh", "Kh", "Lh", "Mh", "Nh", "Oh", "Ph", "Qh", "Rh", "Sh", "Th", "Uh", "Vh", "Wh", "Xh", "Yh", "Zh", "$h", "ai", "bi", "ci", "di", "ei", "require_react_reconciler", "__commonJSMin", "exports", "module", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "require_react_jsx_runtime_production_min", "__commonJSMin", "exports", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "f", "k", "l", "m", "n", "p", "q", "c", "a", "g", "b", "d", "e", "h", "require_jsx_runtime", "__commonJSMin", "exports", "module", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "require_debounce", "__commonJSMin", "exports", "module", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "debounce", "func", "wait", "immediate", "timeout", "args", "context", "timestamp", "result", "later", "last", "debounced", "callNow", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "addons_default", "addons", "types", "mockChannel", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "theming_default", "CacheProvider", "ClassNames", "Global", "ThemeProvider", "background", "color", "convert", "create", "createCache", "createGlobal", "createReset", "css", "darken", "ensure", "ignoreSsrWarning", "isPropValid", "jsx", "keyframes", "lighten", "styled", "themes", "typography", "useTheme", "withTheme", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_react", "three_module_exports", "__export", "ACESFilmicToneMapping", "AddEquation", "AddOperation", "AdditiveAnimationBlendMode", "AdditiveBlending", "AgXToneMapping", "AlphaFormat", "AlwaysCompare", "AlwaysDepth", "AlwaysStencilFunc", "AmbientLight", "AnimationAction", "AnimationClip", "AnimationLoader", "AnimationMixer", "AnimationObjectGroup", "AnimationUtils", "ArcCurve", "ArrayCamera", "ArrowHelper", "AttachedBindMode", "Audio", "AudioAnalyser", "AudioContext", "AudioListener", "AudioLoader", "AxesHelper", "BackSide", "BasicDepthPacking", "BasicShadowMap", "BatchedMesh", "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", "ConstantAlphaFactor", "ConstantColorFactor", "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", "DetachedBindMode", "DirectionalLight", "DirectionalLightHelper", "DiscreteInterpolant", "DisplayP3ColorSpace", "DodecahedronGeometry", "DoubleSide", "DstAlphaFactor", "DstColorFactor", "DynamicCopyUsage", "DynamicDrawUsage", "DynamicReadUsage", "EdgesGeometry", "EllipseCurve", "EqualCompare", "EqualDepth", "EqualStencilFunc", "EquirectangularReflectionMapping", "EquirectangularRefractionMapping", "Euler", "EventDispatcher", "ExtrudeGeometry", "FileLoader", "Float16BufferAttribute", "Float32BufferAttribute", "FloatType", "Fog", "FogExp2", "FramebufferTexture", "FrontSide", "Frustum", "GLBufferAttribute", "GLSL1", "GLSL3", "GreaterCompare", "GreaterDepth", "GreaterEqualCompare", "GreaterEqualDepth", "GreaterEqualStencilFunc", "GreaterStencilFunc", "GridHelper", "Group", "HalfFloatType", "HemisphereLight", "HemisphereLightHelper", "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", "LinearDisplayP3ColorSpace", "LinearFilter", "LinearInterpolant", "LinearMipMapLinearFilter", "LinearMipMapNearestFilter", "LinearMipmapLinearFilter", "LinearMipmapNearestFilter", "LinearSRGBColorSpace", "LinearToneMapping", "LinearTransfer", "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", "NeutralToneMapping", "NeverCompare", "NeverDepth", "NeverStencilFunc", "NoBlending", "NoColorSpace", "NoToneMapping", "NormalAnimationBlendMode", "NormalBlending", "NotEqualCompare", "NotEqualDepth", "NotEqualStencilFunc", "NumberKeyframeTrack", "Object3D", "ObjectLoader", "ObjectSpaceNormalMap", "OctahedronGeometry", "OneFactor", "OneMinusConstantAlphaFactor", "OneMinusConstantColorFactor", "OneMinusDstAlphaFactor", "OneMinusDstColorFactor", "OneMinusSrcAlphaFactor", "OneMinusSrcColorFactor", "OrthographicCamera", "P3Primaries", "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", "RGBFormat", "RGBIntegerFormat", "RGB_BPTC_SIGNED_Format", "RGB_BPTC_UNSIGNED_Format", "RGB_ETC1_Format", "RGB_ETC2_Format", "RGB_PVRTC_2BPPV1_Format", "RGB_PVRTC_4BPPV1_Format", "RGB_S3TC_DXT1_Format", "RGFormat", "RGIntegerFormat", "RawShaderMaterial", "Ray", "Raycaster", "Rec709Primaries", "RectAreaLight", "RedFormat", "RedIntegerFormat", "ReinhardToneMapping", "RenderTarget", "RepeatWrapping", "ReplaceStencilOp", "ReverseSubtractEquation", "RingGeometry", "SIGNED_RED_GREEN_RGTC2_Format", "SIGNED_RED_RGTC1_Format", "SRGBColorSpace", "SRGBTransfer", "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", "TextureUtils", "TorusGeometry", "TorusKnotGeometry", "Triangle", "TriangleFanDrawMode", "TriangleStripDrawMode", "TrianglesDrawMode", "TubeGeometry", "UVMapping", "Uint16BufferAttribute", "Uint32BufferAttribute", "Uint8BufferAttribute", "Uint8ClampedBufferAttribute", "Uniform", "UniformsGroup", "UniformsLib", "UniformsUtils", "UnsignedByteType", "UnsignedInt248Type", "UnsignedInt5999Type", "UnsignedIntType", "UnsignedShort4444Type", "UnsignedShort5551Type", "UnsignedShortType", "VSMShadowMap", "Vector2", "Vector3", "Vector4", "VectorKeyframeTrack", "VideoTexture", "WebGL3DRenderTarget", "WebGLArrayRenderTarget", "WebGLCoordinateSystem", "WebGLCubeRenderTarget", "WebGLMultipleRenderTargets", "WebGLRenderTarget", "WebGLRenderer", "WebGLUtils", "WebGPUCoordinateSystem", "WireframeGeometry", "WrapAroundEnding", "ZeroCurvatureEnding", "ZeroFactor", "ZeroSlopeEnding", "ZeroStencilOp", "createCanvasElement", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "type", "listener", "listeners", "listenerArray", "index", "event", "array", "i", "l", "_lut", "_seed", "DEG2RAD", "RAD2DEG", "generateUUID", "d0", "d1", "d2", "d3", "clamp", "value", "min", "max", "euclideanModulo", "m", "mapLinear", "x", "a1", "a2", "b1", "b2", "inverseLerp", "y", "lerp", "damp", "lambda", "dt", "pingpong", "length", "smoothstep", "smootherstep", "randInt", "low", "high", "randFloat", "randFloatSpread", "range", "seededRandom", "s", "t", "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", "denormalize", "normalize", "_Vector2", "scalar", "v", "e", "minVal", "maxVal", "denominator", "theta", "dx", "dy", "alpha", "v1", "v2", "offset", "attribute", "center", "angle", "_Matrix3", "n11", "n12", "n13", "n21", "n22", "n23", "n31", "n32", "n33", "te", "me", "xAxis", "yAxis", "zAxis", "ae", "be", "a11", "a12", "a13", "a21", "a22", "a23", "a31", "a32", "a33", "b11", "b12", "b13", "b21", "b22", "b23", "b31", "b32", "b33", "d", "f", "g", "h", "t11", "t12", "t13", "det", "detInv", "tmp", "matrix4", "r", "tx", "ty", "sx", "sy", "rotation", "cx", "cy", "_m3", "matrix", "arrayNeedsUint32", "TYPED_ARRAYS", "getTypedArray", "buffer", "createElementNS", "name", "canvas", "_cache", "warnOnce", "message", "probeAsync", "gl", "sync", "interval", "resolve", "reject", "probe", "LINEAR_SRGB_TO_LINEAR_DISPLAY_P3", "LINEAR_DISPLAY_P3_TO_LINEAR_SRGB", "COLOR_SPACES", "color", "SUPPORTED_WORKING_COLOR_SPACES", "colorSpace", "sourceColorSpace", "targetColorSpace", "sourceToReference", "targetFromReference", "SRGBToLinear", "LinearToSRGB", "_canvas", "image", "context", "imageData", "data", "_sourceId", "meta", "isRootObject", "output", "url", "serializeImage", "_textureId", "_Texture", "mapping", "wrapS", "wrapT", "magFilter", "minFilter", "format", "anisotropy", "source", "uv", "_Vector4", "z", "w", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "xx", "yy", "zz", "xy", "xz", "yz", "width", "height", "options", "texture", "count", "depth", "il", "layerIndex", "dst", "dstOffset", "src0", "srcOffset0", "src1", "srcOffset1", "x0", "y0", "z0", "w0", "x1", "y1", "z1", "w1", "dir", "sqrSin", "len", "tDir", "quaternion", "euler", "update", "c1", "c3", "s1", "s3", "axis", "halfAngle", "trace", "vFrom", "vTo", "step", "qax", "qay", "qaz", "qaw", "qbx", "qby", "qbz", "qbw", "qb", "cosHalfTheta", "sqrSinHalfTheta", "sinHalfTheta", "halfTheta", "ratioA", "ratioB", "qa", "theta1", "theta2", "r1", "r2", "callback", "_Vector3", "_quaternion$4", "vx", "vy", "vz", "qx", "qy", "qz", "qw", "tz", "camera", "ax", "ay", "az", "bx", "by", "bz", "planeNormal", "_vector$c", "normal", "dz", "radius", "phi", "sinPhiRadius", "sz", "u", "_vector$b", "points", "size", "halfSize", "object", "precise", "box", "target", "point", "vector", "geometry", "positionAttribute", "_box$4", "children", "sphere", "plane", "triangle", "_center", "_extents", "_v0$2", "_v1$7", "_v2$4", "_f0", "_f1", "_f2", "axes", "satForAxes", "_triangleNormal", "_points", "_testAxis", "v0", "extents", "j", "p0", "p1", "p2", "_box$3", "_v1$6", "_v2$3", "optionalCenter", "maxRadiusSq", "radiusSum", "deltaLengthSq", "lengthSq", "delta", "_vector$a", "_segCenter", "_segDir", "_diff", "_edge1", "_edge2", "_normal$1", "origin", "direction", "ray", "directionDistance", "optionalPointOnRay", "optionalPointOnSegment", "segExtent", "a01", "b0", "s0", "sqrDist", "extDet", "invDet", "tca", "radius2", "thc", "t0", "t1", "distToPoint", "tmin", "tmax", "tymin", "tymax", "tzmin", "tzmax", "invdirx", "invdiry", "invdirz", "backfaceCulling", "DdN", "sign", "DdQxE2", "DdE1xQ", "QdN", "_Matrix4", "n14", "n24", "n34", "n41", "n42", "n43", "n44", "scaleX", "_v1$5", "scaleY", "scaleZ", "af", "bf", "ce", "cf", "de", "df", "ac", "ad", "bc", "bd", "_zero", "_one", "eye", "up", "_z", "_x", "_y", "a14", "a24", "a34", "a41", "a42", "a43", "a44", "b14", "b24", "b34", "b41", "b42", "b43", "b44", "t14", "scaleXSq", "scaleYSq", "scaleZSq", "yx", "zx", "zy", "position", "scale", "x2", "y2", "z2", "wx", "wy", "wz", "_m1$4", "invSX", "invSY", "invSZ", "left", "right", "top", "bottom", "near", "far", "coordinateSystem", "p", "zInv", "_matrix$2", "_quaternion$3", "_Euler", "newOrder", "channel", "layers", "_object3DId", "_v1$4", "_q1", "_m1$3", "_target", "_position$3", "_scale$2", "_quaternion$2", "_xAxis", "_yAxis", "_zAxis", "_addedEvent", "_removedEvent", "_childaddedEvent", "_childremovedEvent", "_Object3D", "onRotationChange", "onQuaternionChange", "distance", "parent", "id", "result", "force", "updateParents", "updateChildren", "bound", "serialize", "library", "element", "parameters", "shapes", "shape", "uuids", "animation", "geometries", "extractFromCache", "materials", "textures", "images", "skeletons", "animations", "nodes", "cache", "values", "key", "recursive", "child", "_v0$1", "_v1$3", "_v2$2", "_v3$2", "_vab", "_vac", "_vbc", "_vap", "_vbp", "_vcp", "_Triangle", "targetLengthSq", "dot00", "dot01", "dot02", "dot11", "dot12", "denom", "invDenom", "p3", "v3", "i0", "i1", "i2", "d4", "vc", "d5", "d6", "vb", "va", "_colorKeywords", "_hslA", "_hslB", "hue2rgb", "hex", "style", "handleAlpha", "string", "components", "_color", "hue", "saturation", "lightness", "color1", "color2", "_materialId", "newValue", "currentValue", "srcPlanes", "dstPlanes", "n", "_tables", "_generateTables", "floatView", "uint32View", "baseTable", "shiftTable", "mantissaTable", "exponentTable", "offsetTable", "toHalfFloat", "val", "fromHalfFloat", "_vector$9", "_vector2$1", "itemSize", "normalized", "start", "index1", "index2", "component", "_id$2", "_m1$2", "_obj", "_offset", "_box$2", "_boxMorphTargets", "_vector$8", "_BufferGeometry", "materialIndex", "normalMatrix", "tangent", "morphAttributesPosition", "morphAttribute", "morphTargetsRelative", "jl", "attributes", "normalAttribute", "uvAttribute", "tangentAttribute", "tan1", "tan2", "vA", "vB", "vC", "uvA", "uvB", "uvC", "sdir", "tdir", "handleTriangle", "groups", "group", "tmp2", "n2", "handleVertex", "pA", "pB", "pC", "nA", "nB", "nC", "cb", "ab", "normals", "convertBufferAttribute", "indices", "array2", "geometry2", "newAttribute", "morphAttributes", "morphArray", "hasMorphAttributes", "attributeArray", "boundingSphere", "boundingBox", "_inverseMatrix$3", "_ray$3", "_sphere$6", "_sphereHitAt", "_vA$1", "_vB$1", "_vC$1", "_tempA", "_morphA", "_uvA$1", "_uvB$1", "_uvC$1", "_normalA", "_normalB", "_normalC", "_intersectionPoint", "_intersectionPointWorld", "material", "keys", "ml", "morphPosition", "morphInfluences", "influence", "raycaster", "intersects", "matrixWorld", "rayLocalSpace", "intersection", "uv1", "drawRange", "groupMaterial", "end", "checkGeometryIntersection", "checkIntersection$1", "intersect", "face", "_BoxGeometry", "widthSegments", "heightSegments", "depthSegments", "scope", "vertices", "uvs", "numberOfVertices", "groupStart", "buildPlane", "udir", "vdir", "gridX", "gridY", "segmentWidth", "segmentHeight", "widthHalf", "heightHalf", "depthHalf", "gridX1", "gridY1", "vertexCounter", "groupCount", "iy", "ix", "cloneUniforms", "src", "property", "mergeUniforms", "uniforms", "merged", "cloneUniformsGroups", "getUnlitUniformColorSpace", "renderer", "currentRenderTarget", "default_vertex", "default_fragment", "extensions", "_v3$1", "_minTarget", "_maxTarget", "fov", "aspect", "focalLength", "vExtentSlope", "minTarget", "maxTarget", "fullWidth", "fullHeight", "view", "skew", "renderTarget", "cameraPX", "cameraNX", "cameraPY", "cameraNY", "cameraPZ", "cameraNZ", "cameras", "scene", "activeMipmapLevel", "currentActiveCubeFace", "currentActiveMipmapLevel", "currentXrEnabled", "generateMipmaps", "shader", "mesh", "currentMinFilter", "stencil", "_vector1", "_vector2", "_normalMatrix", "constant", "inverseNormalLength", "line", "startSign", "endSign", "optionalNormalMatrix", "referencePoint", "_sphere$5", "_vector$7", "p4", "p5", "planes", "frustum", "me0", "me1", "me2", "me3", "me4", "me5", "me6", "me7", "me8", "me9", "me10", "me11", "me12", "me13", "me14", "me15", "sprite", "negRadius", "WebGLAnimation", "isAnimating", "animationLoop", "requestId", "onAnimationFrame", "time", "frame", "WebGLAttributes", "buffers", "createBuffer", "bufferType", "usage", "updateBuffer", "updateRange", "updateRanges", "get", "remove", "cached", "_PlaneGeometry", "width_half", "height_half", "segment_width", "segment_height", "alphahash_fragment", "alphahash_pars_fragment", "alphamap_fragment", "alphamap_pars_fragment", "alphatest_fragment", "alphatest_pars_fragment", "aomap_fragment", "aomap_pars_fragment", "batching_pars_vertex", "batching_vertex", "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_vertex", "fog_vertex", "fog_pars_vertex", "fog_fragment", "fog_pars_fragment", "gradientmap_pars_fragment", "lightmap_pars_fragment", "lights_lambert_fragment", "lights_lambert_pars_fragment", "lights_pars_begin", "envmap_physical_pars_fragment", "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", "morphinstance_vertex", "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", "vertex$h", "fragment$h", "vertex$g", "fragment$g", "vertex$f", "fragment$f", "vertex$e", "fragment$e", "vertex$d", "fragment$d", "vertex$c", "fragment$c", "vertex$b", "fragment$b", "vertex$a", "fragment$a", "vertex$9", "fragment$9", "vertex$8", "fragment$8", "vertex$7", "fragment$7", "vertex$6", "fragment$6", "vertex$5", "fragment$5", "vertex$4", "fragment$4", "vertex$3", "fragment$3", "vertex$2", "fragment$2", "vertex$1", "fragment$1", "_rgb", "_e1$1", "_m1$1", "WebGLBackground", "cubemaps", "cubeuvmaps", "state", "objects", "premultipliedAlpha", "clearColor", "clearAlpha", "planeMesh", "boxMesh", "currentBackground", "currentBackgroundVersion", "currentTonemapping", "getBackground", "background", "render", "forceClear", "setClear", "environmentBlendMode", "addToRenderList", "renderList", "WebGLBindingStates", "maxVertexAttributes", "bindingStates", "defaultState", "createBindingState", "currentState", "forceUpdate", "setup", "program", "updateBuffers", "getBindingState", "bindVertexArrayObject", "needsUpdate", "saveCache", "setupVertexAttributes", "createVertexArrayObject", "vao", "deleteVertexArrayObject", "wireframe", "programMap", "stateMap", "newAttributes", "enabledAttributes", "attributeDivisors", "cachedAttributes", "geometryAttributes", "attributesNum", "programAttributes", "cachedAttribute", "geometryAttribute", "initAttributes", "enableAttribute", "enableAttributeAndDivisor", "meshPerAttribute", "disableUnusedAttributes", "vertexAttribPointer", "stride", "integer", "materialDefaultAttributeValues", "programAttribute", "bytesPerElement", "dispose", "reset", "geometryId", "programId", "releaseStatesOfGeometry", "releaseStatesOfProgram", "resetDefaultState", "WebGLBufferRenderer", "info", "mode", "setMode", "renderInstances", "primcount", "renderMultiDraw", "starts", "counts", "drawCount", "elementCount", "renderMultiDrawInstances", "extension", "WebGLCapabilities", "utils", "maxAnisotropy", "getMaxAnisotropy", "textureFormatReadable", "textureFormat", "textureTypeReadable", "textureType", "halfFloatSupportedByExt", "getMaxPrecision", "precision", "maxPrecision", "logarithmicDepthBuffer", "maxTextures", "maxVertexTextures", "maxTextureSize", "maxCubemapSize", "maxAttributes", "maxVertexUniforms", "maxVaryings", "maxFragmentUniforms", "vertexTextures", "maxSamples", "WebGLClipping", "properties", "globalState", "numGlobalPlanes", "localClippingEnabled", "renderingShadows", "viewNormalMatrix", "uniform", "enableLocalClipping", "enabled", "projectPlanes", "useCache", "clipIntersection", "clipShadows", "materialProperties", "resetGlobalState", "nGlobal", "lGlobal", "dstArray", "skipTransform", "nPlanes", "flatSize", "viewMatrix", "i4", "WebGLCubeMaps", "mapTextureMapping", "cubemap", "onTextureDispose", "scaleW", "scaleH", "LOD_MIN", "EXTRA_LOD_SIGMA", "MAX_SAMPLES", "_flatCamera", "_clearColor", "_oldTarget", "_oldActiveCubeFace", "_oldActiveMipmapLevel", "_oldXrEnabled", "PHI", "INV_PHI", "_axisDirections", "sigma", "cubeUVRenderTarget", "equirectangular", "_getCubemapMaterial", "_getEquirectMaterial", "cubeSize", "outputTarget", "_setViewport", "params", "_createRenderTarget", "_lodMax", "_createPlanes", "_getBlurShader", "tmpMesh", "cubeCamera", "upSign", "forwardSign", "originalAutoClear", "toneMapping", "backgroundMaterial", "backgroundBox", "useSolidColor", "col", "isCubeTexture", "autoClear", "poleAxis", "lodIn", "lodOut", "pingPongRenderTarget", "targetIn", "targetOut", "sigmaRadians", "blurMaterial", "STANDARD_DEVIATIONS", "blurMesh", "blurUniforms", "pixels", "radiansPerPixel", "sigmaPixels", "samples", "weights", "sum", "weight", "outputSize", "lodMax", "lodPlanes", "sizeLods", "sigmas", "lod", "totalLods", "sizeLod", "texelSize", "cubeFaces", "positionSize", "uvSize", "faceIndexSize", "faceIndex", "coordinates", "fill", "_getCommonVertexShader", "WebGLCubeUVMaps", "cubeUVmaps", "pmremGenerator", "isEquirectMap", "isCubeMap", "currentPMREMVersion", "isCubeTextureComplete", "cubemapUV", "WebGLExtensions", "getExtension", "WebGLGeometries", "wireframeAttributes", "onGeometryDispose", "updateWireframeAttribute", "geometryIndex", "geometryPosition", "version", "previousAttribute", "getWireframeAttribute", "currentAttribute", "WebGLIndexedBufferRenderer", "setIndex", "WebGLInfo", "memory", "instanceCount", "WebGLMorphtargets", "capabilities", "morphTextures", "morph", "objectInfluences", "morphTargetsCount", "entry", "disposeTexture", "hasMorphPosition", "hasMorphNormals", "hasMorphColors", "morphTargets", "morphNormals", "morphColors", "vertexDataCount", "vertexDataStride", "morphTarget", "morphNormal", "morphColor", "morphInfluencesSum", "morphBaseInfluence", "WebGLObjects", "updateMap", "buffergeometry", "onInstancedMeshDispose", "skeleton", "instancedMesh", "emptyTexture", "emptyShadowTexture", "emptyArrayTexture", "empty3dTexture", "emptyCubeTexture", "arrayCacheF32", "arrayCacheI32", "mat4array", "mat3array", "mat2array", "flatten", "nBlocks", "blockSize", "firstElem", "arraysEqual", "copyArray", "allocTexUnits", "setValueV1f", "setValueV2f", "setValueV3f", "setValueV4f", "setValueM2", "elements", "setValueM3", "setValueM4", "setValueV1i", "setValueV2i", "setValueV3i", "setValueV4i", "setValueV1ui", "setValueV2ui", "setValueV3ui", "setValueV4ui", "setValueT1", "unit", "emptyTexture2D", "setValueT3D1", "setValueT6", "setValueT2DArray1", "getSingularSetter", "setValueV1fArray", "setValueV2fArray", "setValueV3fArray", "setValueV4fArray", "setValueM2Array", "setValueM3Array", "setValueM4Array", "setValueV1iArray", "setValueV2iArray", "setValueV3iArray", "setValueV4iArray", "setValueV1uiArray", "setValueV2uiArray", "setValueV3uiArray", "setValueV4uiArray", "setValueT1Array", "units", "setValueT3DArray", "setValueT6Array", "setValueT2DArrayArray", "getPureArraySetter", "SingleUniform", "activeInfo", "addr", "PureArrayUniform", "StructuredUniform", "seq", "RePathPart", "addUniform", "container", "uniformObject", "parseUniform", "path", "pathLength", "match", "matchEnd", "idIsIndex", "subscript", "next", "WebGLUniforms", "WebGLShader", "COMPLETION_STATUS_KHR", "programIdCount", "handleSource", "errorLine", "lines", "lines2", "from", "to", "getEncodingComponents", "workingPrimaries", "encodingPrimaries", "gamutMapping", "getShaderErrors", "status", "errors", "errorMatches", "getTexelEncodingFunction", "functionName", "getToneMappingFunction", "toneMappingName", "generateVertexExtensions", "filterEmptyLine", "generateDefines", "defines", "chunks", "fetchAttributeLocations", "locationSize", "replaceLightNums", "numSpotLightCoords", "replaceClippingPlaneNums", "includePattern", "resolveIncludes", "includeReplacer", "shaderChunkMap", "include", "newInclude", "unrollLoopPattern", "unrollLoops", "loopReplacer", "snippet", "generatePrecision", "precisionstring", "generateShadowMapTypeDefine", "shadowMapTypeDefine", "generateEnvMapTypeDefine", "envMapTypeDefine", "generateEnvMapModeDefine", "envMapModeDefine", "generateEnvMapBlendingDefine", "envMapBlendingDefine", "generateCubeUVSize", "imageHeight", "maxMip", "texelHeight", "WebGLProgram", "cacheKey", "vertexShader", "fragmentShader", "envMapCubeUVSize", "customVertexExtensions", "customDefines", "prefixVertex", "prefixFragment", "versionString", "vertexGlsl", "fragmentGlsl", "glVertexShader", "glFragmentShader", "onFirstUse", "self", "programLog", "vertexLog", "fragmentLog", "runnable", "haveDiagnostics", "vertexErrors", "fragmentErrors", "cachedUniforms", "programReady", "_id$1", "WebGLShaderCache", "vertexShaderStage", "fragmentShaderStage", "materialShaders", "shaderStage", "set", "code", "stage", "WebGLShaderStage", "WebGLPrograms", "clipping", "_programLayers", "_customShaders", "_activeChannels", "programs", "SUPPORTS_VERTEX_TEXTURES", "shaderIDs", "getChannel", "getParameters", "lights", "shadows", "fog", "environment", "envMap", "envMapCubeUVHeight", "shaderID", "morphTextureStride", "customVertexShaderID", "customFragmentShaderID", "IS_INSTANCEDMESH", "IS_BATCHEDMESH", "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_DISPERSION", "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", "getProgramCacheKey", "getProgramCacheKeyParameters", "getProgramCacheKeyBooleans", "getUniforms", "acquireProgram", "pl", "preexistingProgram", "releaseProgram", "releaseShaderCache", "WebGLProperties", "map", "painterSortStable", "reversePainterSortStable", "WebGLRenderList", "renderItems", "renderItemsIndex", "opaque", "transmissive", "transparent", "init", "getNextRenderItem", "groupOrder", "renderItem", "push", "unshift", "sort", "customOpaqueSort", "customTransparentSort", "finish", "WebGLRenderLists", "lists", "renderCallDepth", "listArray", "list", "UniformsCache", "light", "ShadowUniformsCache", "nextVersion", "shadowCastingAndTexturingLightsFirst", "lightA", "lightB", "WebGLLights", "shadowCache", "vector3", "matrix42", "directionalLength", "pointLength", "spotLength", "rectAreaLength", "hemiLength", "numDirectionalShadows", "numPointShadows", "numSpotShadows", "numSpotMaps", "numSpotShadowsWithMaps", "numLightProbes", "intensity", "shadowMap", "shadow", "shadowUniforms", "hash", "setupView", "WebGLRenderState", "lightsArray", "shadowsArray", "pushLight", "pushShadow", "shadowLight", "setupLights", "setupLightsView", "WebGLRenderStates", "renderStates", "renderStateArray", "renderState", "vertex", "fragment", "WebGLShadowMap", "_frustum", "_shadowMapSize", "_viewportSize", "_viewport", "_depthMaterial", "_distanceMaterial", "_materialCache", "_maxTextureSize", "shadowSide", "shadowMaterialVertical", "shadowMaterialHorizontal", "fullScreenTri", "fullScreenMesh", "_previousType", "activeCubeFace", "_state", "toVSM", "fromVSM", "shadowFrameExtents", "pars", "viewportCount", "vp", "viewport", "renderObject", "VSMPass", "getDepthMaterial", "customMaterial", "keyA", "keyB", "materialsForVariant", "cachedMaterial", "onMaterialDispose", "shadowCamera", "k", "kl", "depthMaterial", "uuid", "WebGLState", "ColorBuffer", "locked", "currentColorMask", "currentColorClear", "colorMask", "lock", "DepthBuffer", "currentDepthMask", "currentDepthFunc", "currentDepthClear", "depthTest", "enable", "disable", "depthMask", "depthFunc", "StencilBuffer", "currentStencilMask", "currentStencilFunc", "currentStencilRef", "currentStencilFuncMask", "currentStencilFail", "currentStencilZFail", "currentStencilZPass", "currentStencilClear", "stencilTest", "stencilMask", "stencilFunc", "stencilRef", "stencilFail", "stencilZFail", "stencilZPass", "colorBuffer", "depthBuffer", "stencilBuffer", "uboBindings", "uboProgramMap", "enabledCapabilities", "currentBoundFramebuffers", "currentDrawbuffers", "defaultDrawbuffers", "currentProgram", "currentBlendingEnabled", "currentBlending", "currentBlendEquation", "currentBlendSrc", "currentBlendDst", "currentBlendEquationAlpha", "currentBlendSrcAlpha", "currentBlendDstAlpha", "currentBlendColor", "currentBlendAlpha", "currentPremultipledAlpha", "currentFlipSided", "currentCullFace", "currentLineWidth", "currentPolygonOffsetFactor", "currentPolygonOffsetUnits", "lineWidthAvailable", "glVersion", "currentTextureSlot", "currentBoundTextures", "scissorParam", "viewportParam", "currentScissor", "currentViewport", "createTexture", "dimensions", "emptyTextures", "setFlipSided", "setCullFace", "setBlending", "bindFramebuffer", "framebuffer", "drawBuffers", "useProgram", "equationToGL", "factorToGL", "blending", "blendEquation", "blendSrc", "blendDst", "blendEquationAlpha", "blendSrcAlpha", "blendDstAlpha", "blendColor", "blendAlpha", "setMaterial", "frontFaceCW", "flipSided", "stencilWrite", "setPolygonOffset", "cullFace", "setLineWidth", "polygonOffset", "factor", "setScissorTest", "scissorTest", "activeTexture", "webglSlot", "bindTexture", "webglType", "webglTexture", "boundTexture", "unbindTexture", "compressedTexImage2D", "error", "compressedTexImage3D", "texSubImage2D", "texSubImage3D", "compressedTexSubImage2D", "compressedTexSubImage3D", "texStorage2D", "texStorage3D", "texImage2D", "texImage3D", "scissor", "updateUBOMapping", "uniformsGroup", "blockIndex", "uniformBlockBinding", "contain", "imageAspect", "cover", "getByteLength", "typeByteLength", "getTextureTypeByteLength", "WebGLTextures", "_gl", "multisampledRTTExt", "supportsInvalidateFramebuffer", "_imageDimensions", "_videoTextures", "_sources", "useOffscreenCanvas", "createCanvas", "resizeImage", "needsNewCanvas", "maxSize", "getDimensions", "textureNeedsGenerateMipmaps", "generateMipmap", "getInternalFormat", "internalFormatName", "glFormat", "glType", "forceLinearTransfer", "internalFormat", "transfer", "getInternalDepthFormat", "useStencil", "depthType", "glInternalFormat", "getMipLevels", "deallocateTexture", "onRenderTargetDispose", "deallocateRenderTarget", "textureProperties", "webglTextures", "deleteTexture", "renderTargetProperties", "level", "attachmentProperties", "textureUnits", "resetTextureUnits", "allocateTextureUnit", "textureUnit", "getTextureCacheKey", "setTexture2D", "slot", "updateVideoTexture", "uploadTexture", "setTexture2DArray", "setTexture3D", "setTextureCube", "uploadCubeTexture", "wrappingToGL", "filterToGL", "compareToGL", "setTextureParameters", "initTexture", "forceUpload", "textureCacheKey", "sourceProperties", "texturePrimaries", "unpackConversion", "verifyColorSpace", "mipmap", "mipmaps", "useTexStorage", "allocateMemory", "dataReady", "levels", "layerByteLength", "layerData", "isCompressed", "isDataTexture", "cubeImage", "mipmapImage", "setupFrameBufferTexture", "attachment", "textureTarget", "useMultisampledRTT", "getRenderTargetSamples", "setupRenderBufferStorage", "renderbuffer", "isMultisample", "depthTexture", "glAttachmentType", "setupDepthTexture", "webglDepthTexture", "setupDepthRenderbuffer", "isCube", "rebindTextures", "colorTexture", "setupRenderTarget", "isMultipleRenderTargets", "glTextureType", "updateRenderTargetMipmap", "invalidationArrayRead", "invalidationArrayDraw", "updateMultisampleRenderTarget", "mask", "depthStyle", "convert", "_moveEvent", "WebXRController", "inputSource", "hand", "inputjoint", "referenceSpace", "inputPose", "gripPose", "handPose", "targetRay", "grip", "jointPose", "joint", "indexTip", "thumbTip", "distanceToPinch", "threshold", "_occlusion_vertex", "_occlusion_fragment", "WebXRDepthSensing", "depthData", "texProps", "cameraXR", "WebXRManager", "session", "framebufferScaleFactor", "referenceSpaceType", "foveation", "customReferenceSpace", "pose", "glBinding", "glProjLayer", "glBaseLayer", "xrFrame", "depthSensing", "initialRenderTarget", "newRenderTarget", "controllers", "controllerInputSources", "currentSize", "currentPixelRatio", "cameraL", "cameraR", "_currentDepthNear", "_currentDepthFar", "controller", "onSessionEvent", "controllerIndex", "onSessionEnd", "onInputSourcesChange", "space", "layerInit", "depthFormat", "glDepthFormat", "projectionlayerInit", "cameraLPos", "cameraRPos", "setProjectionFromUnion", "ipd", "projL", "projR", "topFov", "bottomFov", "leftFov", "rightFov", "zOffset", "xOffset", "near2", "far2", "left2", "right2", "top2", "bottom2", "updateCamera", "updateUserCamera", "onAnimationFrameCallback", "views", "cameraXRNeedsUpdate", "glSubImage", "enabledFeatures", "_e1", "_m1", "WebGLMaterials", "refreshTransformUniform", "refreshFogUniforms", "refreshMaterialUniforms", "pixelRatio", "transmissionRenderTarget", "refreshUniformsCommon", "refreshUniformsToon", "refreshUniformsPhong", "refreshUniformsStandard", "refreshUniformsPhysical", "refreshUniformsMatcap", "refreshUniformsDistance", "refreshUniformsLine", "refreshUniformsDash", "refreshUniformsPoints", "refreshUniformsSprites", "envMapRotation", "WebGLUniformsGroups", "updateList", "allocatedBindingPoints", "maxBindingPoints", "bind", "webglProgram", "prepareUniformsGroup", "onUniformsGroupsDispose", "updateBufferData", "bindingPointIndex", "allocateBindingPointIndex", "uniformArray", "hasUniformChanged", "arrayOffset", "getUniformSize", "indexArray", "indexString", "cachedObject", "chunkSize", "chunkOffsetUniform", "chunkOffset", "antialias", "preserveDrawingBuffer", "powerPreference", "failIfMajorPerformanceCaveat", "_alpha", "uintClearColor", "intClearColor", "currentRenderList", "currentRenderState", "renderListStack", "renderStateStack", "_this", "_isContextLost", "_currentActiveCubeFace", "_currentActiveMipmapLevel", "_currentRenderTarget", "_currentMaterialId", "_currentCamera", "_currentViewport", "_currentScissor", "_currentScissorTest", "_currentClearColor", "_currentClearAlpha", "_width", "_height", "_pixelRatio", "_opaqueSort", "_transparentSort", "_scissor", "_scissorTest", "_clippingEnabled", "_localClippingEnabled", "_projScreenMatrix", "_vector3", "_vector4", "_emptyScene", "_renderBackground", "getTargetPixelRatio", "getContext", "contextName", "contextAttributes", "onContextLost", "onContextRestore", "onContextCreationError", "programCache", "renderLists", "morphtargets", "bufferRenderer", "indexedBufferRenderer", "uniformsGroups", "initGLContext", "xr", "updateStyle", "boolean", "method", "bits", "isIntegerFormat", "targetFormat", "targetType", "isUnsignedType", "onXRSessionStart", "onXRSessionEnd", "infoAutoReset", "shadowMapEnabled", "shadowMapAutoUpdate", "shadowMapNeedsUpdate", "shadowMapType", "deallocateMaterial", "releaseMaterialProgramReferences", "setProgram", "rangeFactor", "drawStart", "drawEnd", "lineWidth", "maxInstanceCount", "prepareMaterial", "getProgram", "targetScene", "material2", "checkMaterialsReady", "depthSensingMesh", "projectObject", "opaqueObjects", "transmissiveObjects", "camera2", "renderTransmissionPass", "renderScene", "sortObjects", "transparentObjects", "renderObjects", "activeViewport", "currentToneMapping", "currentCameraViewport", "renderTargetNeedsUpdate", "currentSide", "overrideMaterial", "lightsStateVersion", "programCacheKey", "updateCommonMaterialProperties", "materialNeedsLights", "getUniformList", "progUniforms", "vertexAlphas", "vertexTangents", "needsProgramChange", "refreshProgram", "refreshMaterial", "refreshLights", "p_uniforms", "m_uniforms", "uCamPos", "markUniformsLightsNeedsUpdate", "defaultFramebuffer", "useDefaultFramebuffer", "isRenderTarget3D", "__webglFramebuffer", "layer", "activeCubeFaceIndex", "glBuffer", "levelScale", "srcTexture", "dstTexture", "srcRegion", "dstPosition", "minX", "minY", "dstX", "dstY", "currentUnpackRowLen", "currentUnpackImageHeight", "currentUnpackSkipPixels", "currentUnpackSkipRows", "currentUnpackSkipImages", "minZ", "dstZ", "glTarget", "_FogExp2", "density", "_Fog", "ib", "_vector$6", "_InterleavedBufferAttribute", "interleavedBuffer", "_geometry", "_intersectPoint", "_worldScale", "_mvPosition", "_alignedPosition", "_rotatedPosition", "_viewWorldMatrix", "_vA", "_vB", "_vC", "_uvA", "_uvB", "_uvC", "float32Array", "transformVertex", "vertexPosition", "mvPosition", "_v1$2", "_v2$1", "hysteresis", "levelDistance", "_basePosition", "_skinIndex", "_skinWeight", "_matrix4", "_vertex", "_sphere$4", "_inverseMatrix$2", "_ray$2", "bindMatrix", "skinWeight", "boneIndex", "_offsetMatrix", "_identityMatrix$1", "_Skeleton", "bones", "boneInverses", "inverse", "bone", "boneMatrices", "boneTexture", "json", "boneInverse", "_instanceLocalMatrix", "_instanceWorldMatrix", "_instanceIntersects", "_box3", "_identity", "_mesh$1", "_sphere$3", "dataIndex", "raycastTimes", "instanceId", "sortOpaque", "sortTransparent", "MultiDrawRenderList", "pool", "item", "_matrix$1", "_invMatrixWorld", "_identityMatrix", "_whiteColor", "_projScreenMatrix$2", "_box$1", "_sphere$2", "_vector$5", "_forward", "_temp", "_renderList", "_mesh", "_batchIntersects", "copyAttributeData", "targetOffset", "vertexCount", "maxVertexCount", "maxIndexCount", "matricesArray", "matricesTexture", "indirectArray", "indirectTexture", "colorsArray", "colorsTexture", "reference", "attributeName", "srcAttribute", "dstAttribute", "batchGeometry", "func", "geometryCount", "drawInfo", "drawId", "indexCount", "reservedRange", "lastRange", "reservedRanges", "drawRanges", "bounds", "hasIndex", "dstIndex", "srcIndex", "vertexStart", "indexStart", "posAttr", "iv", "inf", "multiDrawStarts", "multiDrawCounts", "perObjectFrustumCulled", "culled", "customSort", "_vStart", "_vEnd", "_inverseMatrix$1", "_ray$1", "_sphere$1", "_intersectPointOnRay", "_intersectPointOnSegment", "lineDistances", "localThreshold", "localThresholdSq", "checkIntersection", "thresholdSq", "_start", "_end", "_inverseMatrix", "_ray", "_sphere", "_position$2", "testPoint", "rayPointDistanceSq", "intersectPoint", "video", "updateVideo", "optionalTarget", "divisions", "lengths", "current", "last", "arcLengths", "targetArcLength", "comparison", "lengthBefore", "segmentLength", "segmentFraction", "t2", "pt1", "pt2", "segments", "closed", "tangents", "binormals", "vec", "mat", "aX", "aY", "xRadius", "yRadius", "aStartAngle", "aEndAngle", "aClockwise", "aRotation", "twoPi", "deltaAngle", "samePoints", "aRadius", "CubicPoly", "c0", "x3", "tension", "dt0", "dt1", "dt2", "t3", "px", "py", "pz", "curveType", "intPoint", "pow", "CatmullRom", "QuadraticBezierP0", "QuadraticBezierP1", "QuadraticBezierP2", "QuadraticBezier", "CubicBezierP0", "CubicBezierP1", "CubicBezierP2", "CubicBezierP3", "CubicBezier", "Curves", "curve", "startPoint", "endPoint", "lineType", "curveLengths", "diff", "lens", "sums", "curves", "resolution", "pts", "aCPx", "aCPy", "aCP1x", "aCP1y", "aCP2x", "aCP2y", "npts", "firstPoint", "lastPoint", "_LatheGeometry", "phiStart", "phiLength", "initNormals", "inverseSegments", "curNormal", "prevNormal", "base", "_CapsuleGeometry", "capSegments", "radialSegments", "_CircleGeometry", "thetaStart", "thetaLength", "segment", "_CylinderGeometry", "radiusTop", "radiusBottom", "openEnded", "halfHeight", "generateTorso", "generateCap", "slope", "indexRow", "sinTheta", "cosTheta", "centerIndexStart", "centerIndexEnd", "_ConeGeometry", "_PolyhedronGeometry", "detail", "vertexBuffer", "uvBuffer", "subdivide", "applyRadius", "generateUVs", "getVertexByIndex", "subdivideFace", "cols", "aj", "bj", "rows", "pushVertex", "azimuth", "inclination", "correctUVs", "correctSeam", "centroid", "azi", "correctUV", "_DodecahedronGeometry", "_v0", "_v1$1", "_normal", "_triangle", "thresholdAngle", "thresholdDot", "indexAttr", "positionAttr", "indexArr", "vertKeys", "hashes", "edgeData", "jNext", "vecHash0", "vecHash1", "reverseHash", "index0", "holesPts", "hole", "Earcut", "holeIndices", "dim", "hasHoles", "outerLen", "outerNode", "linkedList", "triangles", "maxX", "maxY", "invSize", "eliminateHoles", "earcutLinked", "clockwise", "signedArea", "insertNode", "equals", "removeNode", "filterPoints", "again", "area", "ear", "pass", "indexCurve", "stop", "prev", "isEarHashed", "isEar", "cureLocalIntersections", "splitEarcut", "pointInTriangle", "zOrder", "maxZ", "locallyInside", "isValidDiagonal", "splitPolygon", "queue", "getLeftmost", "compareX", "eliminateHole", "bridge", "findHoleBridge", "bridgeReverse", "hx", "hy", "mx", "my", "tanMin", "tan", "sectorContainsSector", "sortLinked", "tail", "numMerges", "pSize", "qSize", "inSize", "leftmost", "intersectsPolygon", "middleInside", "q1", "q2", "o1", "o2", "o3", "o4", "onSegment", "num", "inside", "Node", "an", "bp", "_ShapeUtils", "contour", "holes", "faces", "removeDupEndPts", "addContour", "holeIndex", "_ExtrudeGeometry", "verticesArray", "uvArray", "addShape", "placeholder", "curveSegments", "steps", "bevelEnabled", "bevelThickness", "bevelSize", "bevelOffset", "bevelSegments", "extrudePath", "uvgen", "WorldUVGenerator", "extrudePts", "extrudeByPath", "splineTube", "binormal", "position2", "shapePoints", "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", "buildLidFaces", "buildSideFaces", "f3", "layeroffset", "sidewalls", "sl", "slen1", "slen2", "f4", "addVertex", "nextIndex", "addUV", "vector2", "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", "_IcosahedronGeometry", "_OctahedronGeometry", "_RingGeometry", "innerRadius", "outerRadius", "thetaSegments", "phiSegments", "radiusStep", "thetaSegmentLevel", "_ShapeGeometry", "indexOffset", "shapeVertices", "shapeHoles", "shapeHole", "toJSON", "_SphereGeometry", "thetaEnd", "grid", "verticesRow", "uOffset", "_TetrahedronGeometry", "_TorusGeometry", "tube", "tubularSegments", "arc", "_TorusKnotGeometry", "P1", "P2", "B", "N", "calculatePositionOnCurve", "cu", "su", "quOverP", "cs", "_TubeGeometry", "frames", "P", "generateBufferData", "generateSegment", "generateIndices", "edges", "o", "ol", "isUniqueEdge", "hash1", "hash2", "Geometries", "reflectivity", "convertArray", "forceClone", "isTypedArray", "getKeyframeOrder", "times", "compareTime", "sortedArray", "nValues", "srcOffset", "flattenJSON", "jsonKeys", "valuePropertyName", "subclip", "sourceClip", "startFrame", "endFrame", "fps", "clip", "tracks", "track", "valueSize", "minStartTime", "makeClipAdditive", "targetClip", "referenceFrame", "referenceClip", "numTracks", "referenceTime", "referenceTrack", "referenceTrackType", "targetTrack", "referenceOffset", "referenceValueSize", "targetValueSize", "lastIndex", "referenceValue", "startIndex", "endIndex", "interpolant", "numTimes", "valueStart", "valueEnd", "parameterPositions", "sampleValues", "sampleSize", "resultBuffer", "pp", "validate_interval", "seek", "linear_scan", "forward_scan", "giveUpAt", "t1global", "mid", "iPrev", "iNext", "tPrev", "tNext", "halfDt", "o0", "oP", "oN", "wP", "wN", "ppp", "sP", "sN", "offset1", "offset0", "weight1", "weight0", "interpolation", "trackType", "factoryMethod", "timeOffset", "timeScale", "startTime", "endTime", "nKeys", "valid", "prevTime", "currTime", "smoothInterpolation", "writeIndex", "keep", "timeNext", "offsetP", "offsetN", "readOffset", "writeOffset", "TypedKeyframeTrack", "duration", "blendMode", "jsonTracks", "frameTime", "parseKeyframeTrack", "clipTracks", "morphTargetSequence", "noLoop", "numMorphTargets", "objectOrClipArray", "clipArray", "animationToMorphTargets", "pattern", "parts", "animationMorphTargets", "clips", "addNonemptyTrack", "trackName", "animationKeys", "propertyName", "destTracks", "clipName", "hierarchyTracks", "morphTargetNames", "morphTargetName", "animationKey", "boneName", "getTrackTypeForValueTypeName", "typeName", "file", "onLoad", "onProgress", "onError", "isLoading", "itemsLoaded", "itemsTotal", "urlModifier", "handlers", "transform", "regex", "loader", "manager", "crossOrigin", "resourcePath", "requestHeader", "loading", "HttpError", "response", "req", "mimeType", "responseType", "callbacks", "reader", "contentLength", "total", "lengthComputable", "loaded", "stream", "readData", "done", "text", "exec", "label", "decoder", "err", "loadTexture", "texDatas", "onImageLoad", "removeEventListeners", "onImageError", "urls", "texData", "skyColor", "groundColor", "_projScreenMatrix$1", "_lightPositionWorld$1", "_lookTarget$1", "LightShadow", "shadowMatrix", "viewportIndex", "SpotLightShadow", "penumbra", "decay", "power", "_lightPositionWorld", "_lookTarget", "PointLightShadow", "DirectionalLightShadow", "coefficients", "coeff", "sh", "shBasis", "_MaterialLoader", "getTexture", "normalScale", "materialLib", "interleavedBufferMap", "arrayBufferMap", "getInterleavedBuffer", "getArrayBuffer", "arrayBuffer", "typedArray", "bufferAttribute", "bufferAttributeConstr", "metadata", "hasImages", "bufferGeometryLoader", "loadImage", "deserializeImage", "imageArray", "currentUrl", "deserializedImage", "parseConstant", "TEXTURE_MAPPING", "TEXTURE_WRAPPING", "TEXTURE_FILTER", "getGeometry", "getMaterial", "instanceMatrix", "instanceColor", "objectAnimations", "imageBitmap", "fetchOptions", "promise", "res", "blob", "_context", "bufferCopy", "audioBuffer", "handleError", "_eyeRight", "_eyeLeft", "_projectionMatrix", "eyeSepHalf", "eyeSepOnProjection", "ymax", "xmin", "xmax", "autoStart", "now", "newTime", "_position$1", "_quaternion$1", "_scale$1", "_orientation$1", "audioNode", "mediaElement", "mediaStream", "delay", "filter", "_position", "_quaternion", "_scale", "_orientation", "coneInnerAngle", "coneOuterAngle", "coneOuterGain", "panner", "audio", "fftSize", "binding", "mixFunction", "mixFunctionAdditive", "setIdentity", "accuIndex", "currentWeight", "mix", "weightAdditive", "originalValueOffset", "targetIndex", "workOffset", "_RESERVED_CHARS_RE", "_reservedRe", "_wordChar", "_wordCharOrDot", "_directoryRe", "_nodeRe", "_objectRe", "_propertyRe", "_trackRe", "_supportedObjectNames", "Composite", "targetGroup", "optionalParsedPath", "parsedPath", "firstValidIndex", "bindings", "_PropertyBinding", "rootNode", "root", "matches", "results", "lastDot", "objectName", "nodeName", "searchNodeSubtree", "childNode", "subTreeNode", "dest", "targetArray", "sourceArray", "targetObject", "propertyIndex", "objectIndex", "nodeProperty", "versioning", "bindingType", "indicesByUUID", "paths", "parsedPaths", "nBindings", "knownObject", "nObjects", "nCachedObjects", "firstActiveIndex", "lastCachedObject", "bindingsForPath", "lastCached", "lastCachedIndex", "firstActiveObject", "firstActive", "lastObject", "indicesByPath", "lastBindingsIndex", "lastBindings", "lastBindingsPath", "mixer", "localRoot", "nTracks", "interpolants", "interpolantSettings", "repetitions", "fadeOutAction", "warp", "fadeInDuration", "fadeOutDuration", "startEndRatio", "endStartRatio", "fadeInAction", "weightInterpolant", "action", "startTimeScale", "endTimeScale", "timeScaleInterpolant", "deltaTime", "timeDirection", "timeRunning", "clipTime", "propertyMixers", "interpolantValue", "loop", "loopCount", "pingPong", "handle_stop", "loopDelta", "pending", "atStart", "atEnd", "settings", "weightNow", "weightThen", "_controlInterpolantsResultBuffer", "prototypeAction", "rootUuid", "bindingsByRoot", "bindingsByName", "clipUuid", "actionsForClip", "actions", "actionsByClip", "knownActions", "lastInactiveAction", "cacheIndex", "knownActionsForClip", "lastKnownAction", "byClipCacheIndex", "actionByRoot", "prevIndex", "lastActiveIndex", "firstInactiveAction", "firstInactiveIndex", "lastActiveAction", "bindingByName", "propBinding", "lastInactiveBinding", "firstInactiveBinding", "lastActiveBinding", "lastActiveInterpolant", "optionalRoot", "clipObject", "existingAction", "newAction", "nActions", "timeInSeconds", "actionsToRemove", "_Uniform", "_id", "uniformsSource", "elementSize", "_matrix", "coords", "ascSort", "propagate", "other", "_vector$4", "_startP", "_startEnd", "clampToLine", "startEnd2", "_vector$3", "positions", "coneLength", "coneWidth", "_vector$2", "_boneMatrix", "_matrixWorldInv", "getBoneList", "colors", "boneList", "sphereSize", "_vector$1", "_color1", "_color2", "sectors", "rings", "_v1", "_v2", "_v3", "_vector", "_camera", "pointMap", "addLine", "addPoint", "colorFrustum", "colorCone", "colorUp", "colorTarget", "colorCross", "cone", "cross", "colorAttribute", "setPoint", "_box", "positions2", "_axis", "_lineGeometry", "_coneGeometry", "headLength", "headWidth", "xAxisColor", "yAxisColor", "zAxisColor", "isCCW", "toShapesNoHoles", "inSubpaths", "tmpPath", "tmpShape", "isPointInsidePolygon", "inPolygon", "polyLen", "edgeLowPt", "edgeHighPt", "edgeDx", "edgeDy", "perpEdge", "isClockWise", "subPaths", "solid", "holesFirst", "betterShapeHoles", "newShapes", "newShapeHoles", "mainIdx", "tmpPoints", "ambiguous", "toChange", "sIdx", "sLen", "sho", "hIdx", "ho", "hole_unassigned", "s2Idx", "tmpHoles", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_react", "import_constants", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_react", "createStore", "createState", "state", "listeners", "setState", "partial", "replace", "nextState", "previousState", "listener", "getState", "subscribeWithSelector", "selector", "equalityFn", "currentSlice", "listenerToAdd", "nextSlice", "previousSlice", "api", "isSSR", "useIsomorphicLayoutEffect", "useEffect", "useLayoutEffect", "create", "useStore", "forceUpdate", "useReducer", "c", "stateRef", "useRef", "selectorRef", "equalityFnRef", "erroredRef", "currentSliceRef", "newStateSlice", "hasNewStateSlice", "stateBeforeSubscriptionRef", "nextStateSlice", "unsubscribe", "sliceToReturn", "useDebugValue", "items", "done", "import_react_reconciler", "import_scheduler", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "isPromise", "promise", "globalCache", "shallowEqualArrays", "arrA", "arrB", "equal", "a", "b", "len", "i", "query", "fn", "keys", "preload", "config", "entry", "index", "response", "error", "suspend", "clear", "keys", "globalCache", "entry", "shallowEqualArrays", "import_jsx_runtime", "threeTypes", "catalogue", "extend", "objects", "createRenderer", "_roots", "_getEventPriority", "createInstance", "type", "args", "attach", "props", "root", "name", "instance", "object", "prepare", "target", "BufferGeometry", "Material", "applyProps$1", "appendChild", "parentInstance", "child", "added", "_child$__r3f", "_parentInstance$__r3f", "updateInstance", "invalidateInstance", "insertBefore", "beforeChild", "_child$__r3f2", "_parentInstance$__r3f2", "restSiblings", "sibling", "index", "removeRecursive", "array", "parent", "dispose", "removeChild", "_parentInstance$__r3f3", "_child$__r3f3", "_child$__r3f5", "x", "detach", "_child$__r3f4", "removeInteractivity", "findInitialRoot", "isPrimitive", "shouldDispose", "_child$__r3f6", "callback", "switchInstance", "newProps", "fiber", "_instance$__r3f", "newInstance", "handleTextInstance", "Reconciler", "container", "scene", "parentHostContext", "_instance$__r3f2", "_type", "oldProps", "_instance$__r3f3", "argsNew", "cN", "restNew", "argsOld", "cO", "restOld", "value", "diff", "diffProps", "reconstruct", "_oldProps", "_props", "_int", "_instance$__r3f4", "localState", "_instance$__r3f5", "_instance$__r3f6", "is", "_window$document", "_window$navigator", "hasColorSpace", "getColorManagement", "_ColorManagement", "isOrthographicCamera", "def", "isRef", "obj", "useIsomorphicLayoutEffect", "useLayoutEffect", "useEffect", "useMutableCallback", "fn", "ref", "useRef", "Block", "set", "ErrorBoundary", "Component", "err", "DEFAULT", "DEFAULTS", "isDiffSet", "calculateDpr", "dpr", "_window$devicePixelRa", "getRootState", "_r3f", "a", "b", "arrays", "strict", "isObj", "isArr", "i", "buildGraph", "data", "p", "state", "resolve", "key", "entries", "last", "acc", "INDEX_REGEX", "previous", "kN", "rN", "cP", "kP", "rP", "remove", "changes", "previousKeys", "prop", "memoized", "__DEV__", "rootState", "prevHandlers", "isEvent", "keys", "SRGBColorSpace", "LinearSRGBColorSpace", "currentInstance", "targetProp", "reverseEntries", "ctor", "Layers", "isColor", "Color", "Texture", "RGBAFormat", "UnsignedByteType", "texture", "internal", "_instance$__r3f3$root", "updateCamera", "camera", "size", "makeId", "event", "getEventPriority", "_globalScope$event", "globalScope", "releaseInternalPointerCapture", "capturedMap", "captures", "pointerId", "captureData", "store", "o", "createEvents", "calculateDistance", "dx", "dy", "filterPointerEvents", "intersect", "filter", "duplicates", "intersections", "eventsObjects", "handleRaycast", "_state$previousRoot", "hits", "aState", "bState", "item", "id", "hit", "eventObject", "_r3f2", "handleIntersects", "delta", "raycaster", "pointer", "unprojectedPoint", "Vector3", "hasPointerCapture", "_internal$capturedMap", "_internal$capturedMap2", "setPointerCapture", "releasePointerCapture", "extractEventProps", "property", "raycastEvent", "capturesForPointer", "higher", "cancelPointer", "hoveredObj", "handlers", "pointerMissed", "handlePointer", "onPointerMissed", "isPointerMove", "isClickEvent", "onIntersect", "hoveredItem", "handler", "isRenderer", "def", "context", "createContext", "createStore", "invalidate", "advance", "rootState", "create", "set", "get", "position", "Vector3", "defaultTarget", "tempTarget", "getCurrentViewport", "camera", "target", "size", "width", "height", "top", "left", "aspect", "distance", "isOrthographicCamera", "fov", "h", "w", "performanceTimeout", "setPerformanceCurrent", "current", "state", "pointer", "Vector2", "frames", "timestamp", "runGlobalEffects", "Clock", "events", "updateStyle", "dpr", "resolved", "calculateDpr", "frameloop", "clock", "createRef", "ref", "priority", "store", "internal", "a", "b", "s", "oldSize", "oldDpr", "oldCamera", "viewport", "gl", "_size$updateStyle", "updateCamera", "i", "globalEffects", "globalAfterEffects", "globalTailEffects", "run", "effects", "timestamp", "callback", "flushGlobalEffects", "type", "globalEffects", "globalAfterEffects", "globalTailEffects", "subscribers", "subscription", "render$1", "state", "frame", "delta", "i", "createLoop", "roots", "running", "useFrameInProgress", "repeat", "loop", "root", "_state$gl$xr", "invalidate", "frames", "_state$gl$xr2", "advance", "runGlobalEffects", "memoizedLoaders", "loadingFn", "extensions", "onProgress", "Proto", "input", "loader", "res", "reject", "data", "buildGraph", "error", "useLoader", "keys", "results", "suspend", "is", "preload", "clear", "roots", "invalidate", "advance", "createLoop", "reconciler", "applyProps", "createRenderer", "getEventPriority", "shallowLoose", "createRendererInstance", "gl", "canvas", "customRenderer", "isRenderer", "WebGLRenderer", "computeInitialSize", "defaultSize", "defaultStyle", "width", "height", "top", "left", "updateStyle", "createRoot", "prevRoot", "prevFiber", "prevStore", "logRecoverableError", "store", "createStore", "fiber", "onCreated", "configured", "lastCamera", "props", "glConfig", "propsSize", "sceneOptions", "events", "onCreatedCallback", "shadows", "linear", "flat", "legacy", "orthographic", "frameloop", "dpr", "performance", "raycastOptions", "cameraOptions", "onPointerMissed", "state", "raycaster", "Raycaster", "params", "options", "isCamera", "Camera", "camera", "OrthographicCamera", "PerspectiveCamera", "scene", "Scene", "prepare", "_gl$xr", "handleXRFrame", "timestamp", "frame", "handleSessionChange", "xr", "oldEnabled", "oldType", "PCFSoftShadowMap", "_types$shadows", "types", "BasicShadowMap", "PCFShadowMap", "VSMShadowMap", "ColorManagement", "getColorManagement", "NoToneMapping", "ACESFilmicToneMapping", "size", "calculateDpr", "children", "Provider", "unmountComponentAtNode", "Provider", "store", "children", "onCreated", "rootElement", "useIsomorphicLayoutEffect", "state", "context", "unmountComponentAtNode", "canvas", "callback", "root", "roots", "fiber", "reconciler", "_state$gl", "_state$gl$renderLists", "_state$gl2", "_state$gl3", "dispose", "reconciler", "version", "init_react", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_react", "import_debounce", "useMeasure", "_temp", "debounce", "scroll", "polyfill", "offsetSize", "ResizeObserver", "bounds", "set", "useState", "state", "useRef", "scrollDebounce", "resizeDebounce", "mounted", "useEffect", "forceRefresh", "resizeChange", "scrollChange", "useMemo", "callback", "left", "top", "width", "height", "bottom", "right", "x", "y", "size", "areBoundsEqual", "createDebounce", "removeListeners", "element", "addListeners", "scrollContainer", "ref", "node", "findScrollContainers", "useOnWindowScroll", "useOnWindowResize", "onWindowResize", "cb", "onScroll", "enabled", "result", "overflow", "overflowX", "overflowY", "prop", "keys", "a", "b", "key", "traverseFiber", "fiber", "ascending", "selector", "child", "match", "wrapContext", "context", "FiberContext", "createContext", "FiberProvider", "Component", "createElement", "ReactCurrentOwner", "ReactCurrentDispatcher", "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED", "useFiber", "root", "useContext", "id", "useMemo", "maybeFiber", "node", "state", "useContextMap", "_a", "_b", "fiber", "useFiber", "contextMap", "useState", "node", "context", "FiberContext", "ReactCurrentDispatcher", "wrapContext", "useContextBridge", "useMemo", "Prev", "props", "createElement", "__spreadProps", "__spreadValues", "FiberProvider", "import_jsx_runtime", "import_constants", "import_react_reconciler", "import_scheduler", "DOM_EVENTS", "createPointerEvents", "store", "handlePointer", "createEvents", "event", "state", "previous", "acc", "key", "_internal$lastEvent", "events", "internal", "target", "_events$handlers", "set", "name", "eventName", "passive", "_events$handlers2", "CanvasImpl", "forwardRef", "children", "fallback", "resize", "style", "gl", "eventSource", "eventPrefix", "shadows", "linear", "flat", "legacy", "orthographic", "frameloop", "dpr", "performance", "raycaster", "camera", "scene", "onPointerMissed", "onCreated", "props", "forwardedRef", "useMemo", "extend", "three_module_exports", "Bridge", "useContextBridge", "containerRef", "containerRect", "useMeasure", "canvasRef", "useRef", "divRef", "useImperativeHandle", "handlePointerMissed", "useMutableCallback", "block", "setBlock", "useState", "error", "setError", "root", "useIsomorphicLayoutEffect", "canvas", "createRoot", "args", "isRef", "x", "y", "ErrorBoundary", "Suspense", "Block", "useEffect", "unmountComponentAtNode", "Canvas", "ref", "FiberProvider", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "_v1", "Vector3", "_line3", "Line3", "_plane", "Plane", "_closestPoint", "_triangle", "Triangle", "_v1", "Vector3", "_translationObject", "Vector3", "_quaternionObject", "Quaternion", "_scaleObject", "_translationWorld", "_quaternionWorld", "_scaleWorld", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "_vector", "Vector3", "_viewMatrix", "Matrix4", "_viewProjectionMatrix", "_a", "_b", "_position", "Vector3", "_quaternion", "Quaternion", "_scale", "_matrix", "Matrix4", "_matrix2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "matrix", "Matrix4", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "toTrianglesDrawMode", "geometry", "drawMode", "TrianglesDrawMode", "TriangleFanDrawMode", "TriangleStripDrawMode", "index", "indices", "position", "i", "numberOfTriangles", "newIndices", "newGeometry", "cb", "Vector3", "ab", "version", "REVISION", "readAsDataURL", "blob", "buffer", "data", "_renderer", "fullscreenQuadGeometry", "fullscreenQuadMaterial", "fullscreenQuad", "decompress", "texture", "maxTextureSize", "renderer", "PlaneGeometry", "ShaderMaterial", "Uniform", "Mesh", "_camera", "PerspectiveCamera", "_scene", "Scene", "WebGLRenderer", "readableTexture", "Texture", "KHR_mesh_quantization_ExtraAttrTypes", "GLTFExporter", "writer", "GLTFLightExtension", "GLTFMaterialsUnlitExtension", "GLTFMaterialsTransmissionExtension", "GLTFMaterialsVolumeExtension", "GLTFMaterialsIorExtension", "GLTFMaterialsSpecularExtension", "GLTFMaterialsClearcoatExtension", "GLTFMaterialsIridescenceExtension", "GLTFMaterialsSheenExtension", "GLTFMaterialsAnisotropyExtension", "GLTFMaterialsEmissiveStrengthExtension", "callback", "input", "onDone", "onError", "options", "GLTFWriter", "plugins", "i", "il", "scope", "resolve", "reject", "__publicField", "track", "time", "valueSize", "times", "values", "interpolant", "index", "clip", "root", "tracks", "mergedTracks", "sourceTracks", "sourceTrack", "sourceTrackBinding", "PropertyBinding", "sourceTrackNode", "InterpolateLinear", "targetCount", "targetIndex", "mergedTrack", "j", "sourceInterpolant", "keyframeIndex", "WEBGL_CONSTANTS", "KHR_MESH_QUANTIZATION", "THREE_TO_WEBGL", "NearestFilter", "NearestMipmapNearestFilter", "NearestMipmapLinearFilter", "LinearFilter", "LinearMipmapNearestFilter", "LinearMipmapLinearFilter", "ClampToEdgeWrapping", "RepeatWrapping", "MirroredRepeatWrapping", "PATH_PROPERTIES", "DEFAULT_SPECULAR_COLOR", "Color", "GLB_HEADER_BYTES", "GLB_HEADER_MAGIC", "GLB_VERSION", "GLB_CHUNK_PREFIX_BYTES", "GLB_CHUNK_TYPE_JSON", "GLB_CHUNK_TYPE_BIN", "equalArray", "array1", "array2", "element", "stringToArrayBuffer", "text", "isIdentityMatrix", "matrix", "getMinMax", "attribute", "start", "count", "output", "value", "MathUtils", "getPaddedBufferSize", "bufferSize", "getPaddedArrayBuffer", "arrayBuffer", "paddingByte", "paddedLength", "array", "getCanvas", "getToBlobPromise", "canvas", "mimeType", "quality", "buffers", "json", "extensionsUsed", "extensionsRequired", "extensionsUsedList", "extensionsRequiredList", "result", "binaryChunk", "binaryChunkPrefix", "jsonChunk", "jsonChunkPrefix", "header", "headerView", "totalByteLength", "uri", "object", "objectDef", "extensionName", "error", "isRelativeCopy", "uids", "normal", "v", "Vector3", "cache", "mapDef", "didTransform", "transformDef", "metalnessMap", "roughnessMap", "getEncodingConversion", "map", "c", "CompressedTexture", "metalness", "roughness", "width", "height", "context", "composite", "convert", "componentType", "target", "componentSize", "byteLength", "dataView", "offset", "a", "bufferViewDef", "geometry", "types", "minMax", "bufferViewTarget", "bufferView", "accessorDef", "image", "format", "flipY", "pending", "cachedImages", "key", "imageDef", "ctx", "RGBAFormat", "bufferViewIndex", "samplerDef", "textureDef", "ext", "material", "materialDef", "color", "metalRoughTexture", "metalRoughMapDef", "baseColorMapDef", "emissive", "emissiveMapDef", "normalMapDef", "occlusionMapDef", "DoubleSide", "mesh", "meshCacheKeyParts", "l", "meshCacheKey", "mode", "meshDef", "attributes", "primitives", "targets", "nameConversion", "version", "originalNormal", "modifiedAttribute", "attributeName", "BufferAttribute", "accessor", "weights", "targetNames", "reverseDictionary", "warned", "gltfAttributeName", "baseAttribute", "relativeAttribute", "jl", "isMultiMaterial", "materials", "groups", "primitive", "cacheKey", "attrType", "attrNamePrefix", "camera", "isOrtho", "cameraDef", "nodeMap", "channels", "samplers", "trackBinding", "trackNode", "trackProperty", "inputItemSize", "outputItemSize", "interpolation", "InterpolateDiscrete", "node", "skeleton", "rootJoint", "joints", "inverseBindMatrices", "temporaryBoneInverse", "Matrix4", "nodeDef", "rotation", "position", "scale", "meshIndex", "children", "child", "nodeIndex", "scene", "sceneDef", "nodes", "objects", "objectsWithoutScene", "func", "light", "lightDef", "lights", "extensionDef", "clearcoatMapDef", "clearcoatRoughnessMapDef", "clearcoatNormalMapDef", "iridescenceMapDef", "iridescenceThicknessMapDef", "transmissionMapDef", "thicknessMapDef", "specularIntensityMapDef", "specularColorMapDef", "sheenRoughnessMapDef", "sheenColorMapDef", "anisotropyMapDef", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "ch2", "wk", "c", "id", "msg", "transfer", "cb", "w", "e", "u8", "u16", "u32", "fleb", "fdeb", "clim", "freb", "eb", "start", "b", "i", "r", "j", "_a", "fl", "revfl", "_b", "fd", "revfd", "rev", "x", "hMap", "cd", "mb", "s", "l", "le", "co", "rvb", "sv", "r_1", "v", "m", "flt", "fdt", "flm", "flrm", "fdm", "fdrm", "max", "a", "bits", "d", "p", "o", "bits16", "shft", "slc", "n", "inflt", "dat", "buf", "st", "sl", "noBuf", "noSt", "cbuf", "bl", "nbuf", "final", "pos", "bt", "lm", "dm", "lbt", "dbt", "tbts", "type", "hLit", "hcLen", "tl", "ldt", "clt", "clb", "clbmsk", "clm", "lt", "dt", "t", "lms", "dms", "lpos", "sym", "add", "dsym", "end", "wbits", "wbits16", "hTree", "t2", "et", "i0", "i1", "i2", "maxSym", "tr", "mbt", "ln", "lft", "cst", "i2_1", "i2_2", "i2_3", "lc", "cl", "cli", "cln", "cls", "clen", "cf", "wfblk", "out", "wblk", "syms", "lf", "df", "li", "bs", "dlt", "mlb", "ddt", "mdb", "_c", "lclt", "nlc", "_d", "lcdt", "ndc", "lcfreq", "_e", "lct", "mlcb", "nlcc", "flen", "ftlen", "dtlen", "ll", "dl", "llm", "lcts", "it", "clct", "len", "dst", "deo", "dflt", "lvl", "plvl", "pre", "post", "lst", "opt", "msk_1", "prev", "head", "bs1_1", "bs2_1", "hsh", "lc_1", "wi", "hv", "imod", "pimod", "rem", "ch_1", "dif", "maxn", "maxd", "ml", "nl", "mmd", "md", "ti", "pti", "lin", "din", "crct", "k", "crc", "cr", "adler", "dopt", "mrg", "wcln", "fn", "fnStr", "td", "ks", "st_1", "spInd", "ch", "cbfs", "wrkr", "fns", "init", "td_1", "bInflt", "inflateSync", "pbf", "gu8", "bDflt", "deflateSync", "gze", "gzh", "gzhl", "wbytes", "guze", "gzs", "gzl", "zle", "zlh", "zule", "zlv", "astrm", "strm", "dat", "final", "ev", "astrmify", "fns", "opts", "init", "id", "t", "w", "wrkr", "err", "d", "f", "b2", "b", "b4", "b8", "wbytes", "v", "gzh", "c", "o", "fn", "i", "gzs", "flg", "st", "zs", "gzl", "l", "gzhl", "zlh", "lv", "fl", "zlv", "AsyncCmpStrm", "cb", "Deflate", "dopt", "chunk", "AsyncDeflate", "opts", "cb", "astrmify", "bDflt", "astrm", "Deflate", "AsyncCmpStrm", "ev", "strm", "deflateSync", "data", "opts", "dopt", "Inflate", "cb", "u8", "c", "l", "n", "final", "bts", "dt", "inflt", "slc", "chunk", "AsyncInflate", "cb", "astrmify", "bInflt", "astrm", "Inflate", "strm", "inflateSync", "data", "out", "inflt", "Gzip", "opts", "cb", "crc", "Deflate", "chunk", "final", "c", "f", "raw", "dopt", "gzhl", "gzh", "wbytes", "AsyncGzip", "opts", "cb", "astrmify", "bDflt", "gze", "astrm", "Deflate", "Gzip", "AsyncCmpStrm", "ev", "strm", "Gunzip", "cb", "Inflate", "chunk", "final", "s", "gzs", "AsyncGunzip", "cb", "astrmify", "bInflt", "guze", "astrm", "Inflate", "Gunzip", "strm", "Zlib", "opts", "cb", "adler", "Deflate", "chunk", "final", "c", "f", "raw", "dopt", "zlh", "wbytes", "AsyncZlib", "opts", "cb", "astrmify", "bDflt", "zle", "astrm", "Deflate", "Zlib", "AsyncCmpStrm", "ev", "strm", "Unzlib", "cb", "Inflate", "chunk", "final", "AsyncUnzlib", "cb", "astrmify", "bInflt", "zule", "astrm", "Inflate", "Unzlib", "strm", "Decompress", "cb", "Gunzip", "Inflate", "Unzlib", "chunk", "final", "n", "u8", "_this_1", "AsyncDecompress", "cb", "AsyncGunzip", "AsyncInflate", "AsyncUnzlib", "chunk", "final", "Decompress", "te", "td", "tds", "et", "dutf8", "d", "r", "i", "c", "eb", "slc", "DecodeUTF8", "cb", "chunk", "final", "dat", "u8", "_a", "ch", "np", "EncodeUTF8", "cb", "chunk", "final", "strToU8", "strToU8", "str", "latin1", "ar_1", "u8", "i", "te", "l", "ar", "ai", "w", "v", "n", "c", "slc", "strFromU8", "dat", "r", "td", "_a", "dutf8", "out", "ext", "dbf", "z64e", "d", "b", "b2", "b8", "exfl", "ex", "le", "k", "l", "wzh", "f", "fn", "u", "c", "ce", "co", "fl", "col", "exl", "wbytes", "dt", "y", "exf", "wzf", "o", "e", "ZipPassThrough", "filename", "crc", "chunk", "final", "ZipDeflate", "filename", "opts", "_this_1", "ZipPassThrough", "Deflate", "dat", "final", "dbf", "chunk", "e", "AsyncZipDeflate", "filename", "opts", "_this_1", "ZipPassThrough", "AsyncDeflate", "err", "dat", "final", "dbf", "chunk", "Zip", "cb", "file", "_this_1", "f", "strToU8", "fl", "com", "u", "hl", "exfl", "header", "u8", "wzh", "chks", "pAll", "_i", "chks_1", "chk", "tr", "ind", "uf", "mrg", "nxt", "cl", "err", "dat", "final", "dd", "wbytes", "bt", "l", "tl", "_a", "out", "_b", "_c", "wzf", "UnzipPassThrough", "data", "final", "UnzipInflate", "_this_1", "Inflate", "dat", "final", "data", "e", "AsyncUnzipInflate", "_", "sz", "_this_1", "Inflate", "dat", "final", "AsyncInflate", "err", "data", "slc", "Unzip", "cb", "UnzipPassThrough", "et", "chunk", "final", "_this_1", "len", "toAdd", "f", "i", "is", "buf", "u8", "l", "oc", "add", "_loop_2", "_a", "sig", "b4", "this_1", "bf", "b2", "cmp_1", "u", "dd", "fnl", "es", "chks_2", "sc_1", "su_1", "fn_1", "strFromU8", "z64e", "d_1", "file_1", "ctr", "err", "dat", "_i", "chks_3", "state_1", "decoder", "_DRACOExporter", "object", "options", "BufferGeometry", "geometry", "dracoEncoder", "encoder", "builder", "dracoObject", "Mesh", "vertices", "faces", "i", "normals", "uvs", "colors", "Points", "encodedData", "encodeSpeed", "decodeSpeed", "length", "outputData", "DRACOExporter", "__publicField", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "_q", "Quaternion", "_targetPos", "Vector3", "_targetVec", "_effectorPos", "_effectorVec", "_linkPos", "_invLinkQ", "_linkScale", "_axis", "_vector", "_matrix", "Matrix4", "_position", "Vector3", "_quaternion", "Quaternion", "_scale", "_matrixWorldInv", "Matrix4", "_q", "Quaternion", "ID_ATTR_NAME", "_identityMatrix", "Matrix4", "_zeroScaleMatrix", "batchingParsVertex", "batchingbaseVertex", "_Reflector", "Mesh", "geometry", "options", "PerspectiveCamera", "scope", "color", "Color", "textureWidth", "textureHeight", "clipBias", "shader", "multisample", "reflectorPlane", "Plane", "normal", "Vector3", "reflectorWorldPosition", "cameraWorldPosition", "rotationMatrix", "Matrix4", "lookAtPosition", "clipPlane", "Vector4", "view", "target", "q", "textureMatrix", "virtualCamera", "renderTarget", "WebGLRenderTarget", "HalfFloatType", "material", "ShaderMaterial", "UniformsUtils", "renderer", "scene", "camera", "projectionMatrix", "currentRenderTarget", "currentXrEnabled", "currentShadowAutoUpdate", "currentToneMapping", "isSRGB", "NoToneMapping", "viewport", "Reflector", "__publicField", "version", "_Refractor", "Mesh", "geometry", "options", "PerspectiveCamera", "scope", "color", "Color", "textureWidth", "textureHeight", "clipBias", "shader", "multisample", "virtualCamera", "refractorPlane", "Plane", "textureMatrix", "Matrix4", "renderTarget", "WebGLRenderTarget", "HalfFloatType", "ShaderMaterial", "UniformsUtils", "visible", "refractorWorldPosition", "Vector3", "cameraWorldPosition", "rotationMatrix", "view", "normal", "camera", "updateRefractorPlane", "position", "quaternion", "Quaternion", "scale", "updateVirtualCamera", "clipPlane", "clipVector", "Vector4", "q", "projectionMatrix", "updateTextureMatrix", "render", "renderer", "scene", "currentRenderTarget", "currentXrEnabled", "currentShadowAutoUpdate", "currentToneMapping", "isSRGB", "NoToneMapping", "viewport", "Refractor", "__publicField", "version", "_shadowMatrix", "Matrix4", "geometry", "BufferGeometry", "float32Array", "interleavedBuffer", "InterleavedBuffer", "InterleavedBufferAttribute", "_Lensflare", "Mesh", "MeshBasicMaterial", "positionScreen", "Vector3", "positionView", "tempMap", "DataTexture", "RGBAFormat", "NearestFilter", "ClampToEdgeWrapping", "occlusionMap", "material1a", "RawShaderMaterial", "material1b", "mesh1", "elements", "shader", "LensflareElement", "material2", "Color", "Vector2", "AdditiveBlending", "mesh2", "element", "scale", "screenPositionPixels", "validArea", "Box2", "viewport", "Vector4", "renderer", "scene", "camera", "invAspect", "halfViewportWidth", "halfViewportHeight", "size", "uniforms", "vecX", "vecY", "i", "l", "Lensflare", "__publicField", "texture", "distance", "color", "edgeTable", "triTable", "SimplexNoise", "r", "__publicField", "g", "x", "y", "z", "w", "xin", "yin", "n0", "n1", "n2", "F2", "s", "i", "j", "G2", "t", "X0", "Y0", "x0", "y0", "i1", "j1", "x1", "y1", "x2", "y2", "ii", "jj", "gi0", "gi1", "gi2", "t0", "t1", "t2", "zin", "n3", "F3", "k", "G3", "Z0", "z0", "k1", "i2", "j2", "k2", "z1", "z2", "x3", "y3", "z3", "kk", "gi3", "t3", "grad4", "simplex", "perm", "F4", "G4", "n4", "l", "W0", "w0", "c1", "c2", "c3", "c4", "c5", "c6", "c", "l1", "l2", "i3", "j3", "k3", "l3", "w1", "w2", "w3", "x4", "y4", "z4", "w4", "ll", "gi4", "t4", "_LightningStrike", "BufferGeometry", "rayParameters", "seeds", "i", "generator", "value", "seed", "dest", "source", "vecCopy", "v", "Vector3", "time", "SimplexNoise", "maxDrawableSegmentsPerSubRay", "maxVerts", "maxIndices", "Uint32BufferAttribute", "Float32BufferAttribute", "DynamicDrawUsage", "scope", "segment", "subray", "segmentCallback", "subrayIndex", "MathUtils", "random1", "lForwards", "middleRadius", "middleFraction", "timeDimension", "p", "newSegment1", "newSegment2", "pos", "up", "forwards", "radius", "u", "uv", "vertex", "indices", "lightningStrike", "period", "dutyCycle", "phase0", "phase", "currentCycle", "childSubraySeed", "isActive", "probability", "childSubray", "parentSeed", "vec1Pos", "vec2Forward", "vec3Side", "vec4Up", "parentSubray", "heightFactor", "sideWidthFactor", "minSideWidthFactor", "length", "angle", "LightningStrike", "__publicField", "_ReflectorForSSRPass", "Mesh", "geometry", "options", "scope", "color", "Color", "textureWidth", "textureHeight", "clipBias", "shader", "useDepthTexture", "yAxis", "Vector3", "vecTemp0", "vecTemp1", "Vector2", "val", "normal", "reflectorWorldPosition", "cameraWorldPosition", "rotationMatrix", "Matrix4", "lookAtPosition", "view", "target", "textureMatrix", "virtualCamera", "PerspectiveCamera", "depthTexture", "DepthTexture", "UnsignedShortType", "NearestFilter", "parameters", "HalfFloatType", "renderTarget", "WebGLRenderTarget", "material", "ShaderMaterial", "UniformsUtils", "globalPlanes", "Plane", "renderer", "scene", "camera", "currentRenderTarget", "currentXrEnabled", "currentShadowAutoUpdate", "currentClippingPlanes", "viewport", "ReflectorForSSRPass", "__publicField", "SkyShader", "Vector3", "version", "material", "ShaderMaterial", "UniformsUtils", "BackSide", "Sky", "Mesh", "BoxGeometry", "__publicField", "_Water2", "Mesh", "geometry", "options", "scope", "color", "Color", "textureWidth", "textureHeight", "clipBias", "flowDirection", "Vector2", "flowSpeed", "reflectivity", "scale", "shader", "encoding", "flowMap", "normalMap0", "normalMap1", "cycle", "halfCycle", "textureMatrix", "Matrix4", "clock", "Clock", "Reflector", "Refractor", "reflector", "refractor", "ShaderMaterial", "UniformsUtils", "UniformsLib", "RepeatWrapping", "updateTextureMatrix", "camera", "updateFlow", "delta", "config", "renderer", "scene", "Water2", "__publicField", "Vector4", "version", "_mipmapMaterial", "_getMipmapMaterial", "_mesh", "Mesh", "PlaneGeometry", "_flatCamera", "OrthographicCamera", "_getMipmapMaterial", "shaderMaterial", "RawShaderMaterial", "Vector2", "NoBlending", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "UnpackDepthRGBAShader", "BokehShader2", "Vector2", "BokehDepthShader", "_face", "Triangle", "_color", "Vector3", "a", "Vector3", "b", "R", "AbsR", "t", "xAxis", "yAxis", "zAxis", "v1", "size", "closestPoint", "rotationMatrix", "Matrix3", "aabb", "Box3", "matrix", "Matrix4", "inverse", "localRay", "Ray", "OBB", "center", "halfSize", "rotation", "obb", "result", "point", "x", "MathUtils", "y", "z", "box3", "sphere", "epsilon", "i", "j", "ra", "rb", "plane", "r", "d", "ray", "e", "sx", "sy", "sz", "invSX", "invSY", "invSZ", "_v1", "Vector3", "_v2", "_v3", "EPS", "Capsule", "_Capsule", "start", "end", "radius", "capsule", "target", "v", "p1x", "p1y", "p2x", "p2y", "minx", "maxx", "miny", "maxy", "box", "line1", "line2", "w", "a", "b", "d", "e", "t1", "t2", "divisor", "d1", "d2", "point1", "point2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init", "_p", "i", "_v1", "Vector3", "_v2", "_plane", "Plane", "_line1", "Line3", "_line2", "_sphere", "Sphere", "_capsule", "Capsule", "targetPosition", "Vector3", "_euler", "Euler", "_vector", "Vector3", "_PI_2", "_ray", "Ray", "_plane", "Plane", "TILT_LIMIT", "STATE", "INPUT", "_transformation", "Matrix4", "Pass", "__publicField", "width", "height", "renderer", "writeBuffer", "readBuffer", "deltaTime", "maskActive", "FullScreenQuad", "material", "OrthographicCamera", "PlaneGeometry", "Mesh", "value", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "HalftoneShader", "SMAAEdgesShader", "Vector2", "SMAAWeightsShader", "SMAABlendShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "FilmShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "CopyShader", "SSAOShader", "Vector2", "Matrix4", "SSAODepthShader", "SSAOBlurShader", "_SSAOPass", "Pass", "scene", "camera", "width", "height", "depthTexture", "DepthTexture", "DepthStencilFormat", "UnsignedInt248Type", "WebGLRenderTarget", "NearestFilter", "SSAOShader", "ShaderMaterial", "UniformsUtils", "NoBlending", "MeshNormalMaterial", "SSAOBlurShader", "SSAODepthShader", "CopyShader", "DstColorFactor", "ZeroFactor", "AddEquation", "DstAlphaFactor", "FullScreenQuad", "Color", "renderer", "writeBuffer", "LuminanceFormat", "CustomBlending", "passMaterial", "renderTarget", "clearColor", "clearAlpha", "originalClearAlpha", "originalAutoClear", "overrideMaterial", "kernelSize", "kernel", "i", "sample", "Vector3", "scale", "MathUtils", "SimplexNoise", "simplex", "size", "data", "x", "y", "z", "DataTexture", "RedFormat", "FloatType", "RepeatWrapping", "cache", "object", "visible", "SSAOPass", "__publicField", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "BokehShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "LuminosityShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "ToneMapShader", "LuminosityHighPassShader", "Color", "_UnrealBloomPass", "Pass", "resolution", "strength", "radius", "threshold", "Vector2", "Color", "resx", "resy", "WebGLRenderTarget", "HalfFloatType", "i", "renderTargetHorizonal", "renderTargetVertical", "highPassShader", "LuminosityHighPassShader", "UniformsUtils", "ShaderMaterial", "kernelSizeArray", "bloomFactors", "Vector3", "copyShader", "CopyShader", "AdditiveBlending", "MeshBasicMaterial", "FullScreenQuad", "width", "height", "renderer", "writeBuffer", "readBuffer", "deltaTime", "maskActive", "oldAutoClear", "inputRenderTarget", "kernelRadius", "nMips", "UnrealBloomPass", "__publicField", "SAOShader", "Vector2", "Matrix4", "DepthLimitedBlurShader", "Vector2", "BlurShaderUtils", "kernelRadius", "stdDev", "gaussian", "x", "weights", "i", "uvIncrement", "offsets", "shader", "SAOPass", "Pass", "scene", "camera", "useDepthTexture", "useNormals", "resolution", "Vector2", "Color", "WebGLRenderTarget", "HalfFloatType", "NearestFilter", "depthTexture", "DepthTexture", "UnsignedShortType", "MeshDepthMaterial", "RGBADepthPacking", "NoBlending", "MeshNormalMaterial", "ShaderMaterial", "SAOShader", "UniformsUtils", "DepthLimitedBlurShader", "CopyShader", "CustomBlending", "DstColorFactor", "ZeroFactor", "AddEquation", "DstAlphaFactor", "UnpackDepthRGBAShader", "FullScreenQuad", "renderer", "writeBuffer", "readBuffer", "oldAutoClear", "depthCutoff", "BlurShaderUtils", "outputMaterial", "passMaterial", "renderTarget", "clearColor", "clearAlpha", "originalClearAlpha", "originalAutoClear", "overrideMaterial", "width", "height", "__publicField", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "AfterimageShader", "DotScreenShader", "Vector2", "SSRShader", "Vector2", "Matrix4", "SSRDepthShader", "SSRBlurShader", "_SSRPass", "Pass", "renderer", "scene", "camera", "width", "height", "selects", "bouncing", "groundReflector", "SSRShader", "Color", "val", "depthTexture", "DepthTexture", "UnsignedShortType", "NearestFilter", "WebGLRenderTarget", "HalfFloatType", "ShaderMaterial", "UniformsUtils", "NoBlending", "MeshNormalMaterial", "MeshBasicMaterial", "SSRBlurShader", "SSRDepthShader", "CopyShader", "SrcAlphaFactor", "OneMinusSrcAlphaFactor", "AddEquation", "FullScreenQuad", "writeBuffer", "NormalBlending", "passMaterial", "renderTarget", "clearColor", "clearAlpha", "originalClearAlpha", "originalAutoClear", "overrideMaterial", "child", "SSRPass", "__publicField", "ConvolutionShader", "Vector2", "sigma", "gauss", "x", "kMaxKernelSize", "kernelSize", "halfWidth", "values", "sum", "i", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "decodeText", "array", "s", "i", "il", "SRGBColorSpace", "LinearSRGBColorSpace", "sRGBEncoding", "LinearEncoding", "GLTFLoader", "Loader", "manager", "parser", "GLTFMaterialsClearcoatExtension", "GLTFMaterialsDispersionExtension", "GLTFTextureBasisUExtension", "GLTFTextureWebPExtension", "GLTFTextureAVIFExtension", "GLTFMaterialsSheenExtension", "GLTFMaterialsTransmissionExtension", "GLTFMaterialsVolumeExtension", "GLTFMaterialsIorExtension", "GLTFMaterialsEmissiveStrengthExtension", "GLTFMaterialsSpecularExtension", "GLTFMaterialsIridescenceExtension", "GLTFMaterialsAnisotropyExtension", "GLTFMaterialsBumpExtension", "GLTFLightsExtension", "GLTFMeshoptCompression", "GLTFMeshGpuInstancing", "url", "onLoad", "onProgress", "onError", "scope", "resourcePath", "relativeUrl", "LoaderUtils", "_onError", "e", "loader", "FileLoader", "data", "gltf", "dracoLoader", "ktx2Loader", "meshoptDecoder", "callback", "path", "json", "extensions", "plugins", "decodeText", "BINARY_EXTENSION_HEADER_MAGIC", "EXTENSIONS", "GLTFBinaryExtension", "error", "GLTFParser", "i", "plugin", "extensionName", "extensionsRequired", "GLTFMaterialsUnlitExtension", "GLTFDracoMeshCompressionExtension", "GLTFTextureTransformExtension", "GLTFMeshQuantizationExtension", "resolve", "reject", "GLTFRegistry", "objects", "key", "object", "nodeDefs", "nodeIndex", "nodeLength", "nodeDef", "lightIndex", "cacheKey", "dependency", "lightDef", "lightNode", "color", "Color", "range", "DirectionalLight", "PointLight", "SpotLight", "assignExtrasToUserData", "type", "index", "self", "light", "MeshBasicMaterial", "materialParams", "materialDef", "pending", "metallicRoughness", "array", "materialIndex", "emissiveStrength", "MeshPhysicalMaterial", "extension", "scale", "Vector2", "colorFactor", "colorArray", "textureIndex", "textureDef", "name", "source", "handler", "isSupported", "image", "bufferView", "extensionDef", "buffer", "decoder", "res", "byteOffset", "byteLength", "count", "stride", "result", "meshDef", "primitive", "WEBGL_CONSTANTS", "attributesDef", "attributes", "accessor", "results", "nodeObject", "meshes", "instancedMeshes", "mesh", "m", "Matrix4", "p", "Vector3", "q", "Quaternion", "s", "instancedMesh", "InstancedMesh", "attributeName", "attr", "InstancedBufferAttribute", "Object3D", "BINARY_EXTENSION_HEADER_LENGTH", "BINARY_EXTENSION_CHUNK_TYPES", "headerView", "chunkContentsLength", "chunkView", "chunkIndex", "chunkLength", "chunkType", "contentArray", "bufferViewIndex", "gltfAttributeMap", "threeAttributeMap", "attributeNormalizedMap", "attributeTypeMap", "threeAttributeName", "ATTRIBUTES", "accessorDef", "componentType", "WEBGL_COMPONENT_TYPES", "geometry", "attribute", "normalized", "texture", "transform", "GLTFCubicSplineInterpolant", "Interpolant", "parameterPositions", "sampleValues", "sampleSize", "resultBuffer", "values", "valueSize", "offset", "i1", "t0", "t", "t1", "stride2", "stride3", "td", "pp", "ppp", "offset1", "offset0", "s2", "s3", "s0", "s1", "p0", "m0", "p1", "m1", "_q", "GLTFCubicSplineQuaternionInterpolant", "WEBGL_FILTERS", "NearestFilter", "LinearFilter", "NearestMipmapNearestFilter", "LinearMipmapNearestFilter", "NearestMipmapLinearFilter", "LinearMipmapLinearFilter", "WEBGL_WRAPPINGS", "ClampToEdgeWrapping", "MirroredRepeatWrapping", "RepeatWrapping", "WEBGL_TYPE_SIZES", "version", "PATH_PROPERTIES", "INTERPOLATION", "InterpolateLinear", "InterpolateDiscrete", "ALPHA_MODES", "createDefaultMaterial", "cache", "MeshStandardMaterial", "FrontSide", "addUnknownExtensionsToUserData", "knownExtensions", "objectDef", "gltfDef", "addMorphTargets", "targets", "hasMorphPosition", "hasMorphNormal", "hasMorphColor", "il", "target", "pendingPositionAccessors", "pendingNormalAccessors", "pendingColorAccessors", "pendingAccessor", "accessors", "morphPositions", "morphNormals", "morphColors", "updateMorphTargets", "targetNames", "createPrimitiveKey", "primitiveDef", "geometryKey", "dracoExtension", "createAttributesKey", "attributesKey", "keys", "getNormalizedComponentScale", "constructor", "getImageURIMimeType", "uri", "_identityMatrix", "options", "isSafari", "isFirefox", "firefoxVersion", "TextureLoader", "ImageBitmapLoader", "ext", "dependencies", "scene", "skinDefs", "meshDefs", "skinIndex", "skinLength", "joints", "ref", "updateMappings", "original", "clone", "mappings", "child", "func", "defs", "def", "bufferIndex", "bufferDef", "bufferViewDef", "accessorIndex", "itemSize", "TypedArray", "BufferAttribute", "pendingBufferViews", "bufferViews", "elementBytes", "itemBytes", "byteStride", "bufferAttribute", "ibSlice", "ibCacheKey", "ib", "InterleavedBuffer", "InterleavedBufferAttribute", "itemSizeIndices", "TypedArrayIndices", "byteOffsetIndices", "byteOffsetValues", "sparseIndices", "sparseValues", "sourceIndex", "sourceDef", "promise", "sampler", "URL", "sourceURI", "isObjectURL", "blob", "imageBitmap", "Texture", "mapName", "mapDef", "colorSpace", "gltfReference", "material", "useDerivativeTangents", "useVertexColors", "useFlatShading", "pointsMaterial", "PointsMaterial", "Material", "lineMaterial", "LineBasicMaterial", "cachedMaterial", "materialType", "materialExtensions", "kmuExtension", "DoubleSide", "alphaMode", "emissiveFactor", "originalName", "sanitizedName", "PropertyBinding", "primitives", "createDracoPrimitive", "addPrimitiveAttributes", "cached", "geometryPromise", "BufferGeometry", "meshIndex", "materials", "geometries", "SkinnedMesh", "Mesh", "toTrianglesDrawMode", "TriangleStripDrawMode", "TriangleFanDrawMode", "LineSegments", "Line", "LineLoop", "Points", "group", "Group", "cameraIndex", "camera", "cameraDef", "params", "PerspectiveCamera", "MathUtils", "OrthographicCamera", "skinDef", "inverseBindMatrices", "jointNodes", "bones", "boneInverses", "jointNode", "mat", "Skeleton", "animationIndex", "animationDef", "animationName", "pendingNodes", "pendingInputAccessors", "pendingOutputAccessors", "pendingSamplers", "pendingTargets", "channel", "input", "output", "nodes", "inputAccessors", "outputAccessors", "samplers", "tracks", "node", "inputAccessor", "outputAccessor", "createdTracks", "k", "AnimationClip", "o", "nodePending", "childPending", "childrenDef", "skeletonPending", "children", "skeleton", "nodeName", "meshPromise", "Bone", "matrix", "sceneIndex", "sceneDef", "nodeIds", "reduceAssociations", "reducedAssociations", "value", "targetName", "TypedKeyframeTrack", "NumberKeyframeTrack", "QuaternionKeyframeTrack", "VectorKeyframeTrack", "interpolation", "outputArray", "j", "jl", "track", "scaled", "interpolantType", "computeBounds", "box", "Box3", "min", "max", "boxScale", "maxDisplacement", "vector", "sphere", "Sphere", "assignAttributeAccessor", "gltfAttributeName", "YAXIS", "Vector3", "ZAXIS", "_VRButton", "renderer", "sessionInit", "button", "showEnterVR", "currentSession", "onSessionStarted", "session", "onSessionEnded", "_a", "optionalFeatures", "disableButton", "showWebXRNotFound", "stylizeElement", "element", "supported", "message", "VRButton", "__publicField", "MotionControllerConstants", "defaultComponentValues", "MotionControllerConstants", "_matrix", "Matrix4", "_vector", "Vector3", "tempNormal", "Vector3", "inverseProjectionMatrix", "Matrix4", "CSMFrustum", "_CSMFrustum", "data", "Vector3", "projectionMatrix", "maxFar", "isOrthographic", "v", "absZ", "breaks", "target", "i", "cascade", "j", "cameraMatrix", "_cameraToLightMatrix", "Matrix4", "_lightSpaceFrustum", "CSMFrustum", "_center", "Vector3", "_bbox", "Box3", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "ACESFilmicToneMappingShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "BasicShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "BleachBypassShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "BlendShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "BrightnessContrastShader", "ColorCorrectionShader", "Vector3", "ColorifyShader", "Color", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "DOFMipMapShader", "FXAAShader", "Vector2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "FocusShader", "FreiChenShader", "Vector2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "FresnelShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "GammaCorrectionShader", "GodRaysDepthMaskShader", "GodRaysGenerateShader", "Vector3", "GodRaysCombineShader", "GodRaysFakeSunShader", "Color", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "HorizontalTiltShiftShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "HueSaturationShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "KaleidoShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "MirrorShader", "NormalMapShader", "Vector2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "ParallaxShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "PixelShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "RGBShiftShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "SepiaShader", "SobelOperatorShader", "Vector2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "TechnicolorShader", "ToonShader1", "Vector3", "Color", "ToonShader2", "ToonShaderHatching", "ToonShaderDotted", "TriangleBlurShader", "Vector2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "VerticalTiltShiftShader", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "VignetteShader", "VolumeRenderShader1", "Vector3", "Vector2", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "WaterRefractionShader", "_pointer", "Vector2", "frustum", "Frustum", "center", "Vector3", "tmpPoint", "vecNear", "vecTopLeft", "vecTopRight", "vecDownRight", "vecDownLeft", "vecFarTopLeft", "vecFarTopRight", "vecFarDownRight", "vecFarDownLeft", "vectemp1", "vectemp2", "vectemp3", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "tempEuler", "Euler", "tempVec", "Vector3", "Font", "data", "__publicField", "text", "size", "_options", "shapes", "options", "paths", "createPaths", "p", "pl", "chars", "scale", "line_height", "offsetX", "offsetY", "i", "char", "ret", "createPath", "glyph", "path", "ShapePath", "x", "y", "cpx", "cpy", "cpx1", "cpy1", "cpx2", "cpy2", "outline", "l", "Data3DTexture", "Texture", "data", "width", "height", "depth", "NearestFilter", "ClampToEdgeWrapping", "XLoader", "classCallCheck", "instance", "Constructor", "createClass", "defineProperties", "target", "props", "i", "descriptor", "protoProps", "staticProps", "XboneInf", "XAnimationInfo", "XAnimationObj", "_flags", "XAnimationInfoArray", "refObj", "keys", "keyframe", "Vector3", "Quaternion", "XKeyFrameInfo", "manager", "Loader", "TextureLoader", "_arg", "_start", "onLoad", "onProgress", "onError", "_this", "loader", "FileLoader", "response", "e", "line", "readed", "find", "foundNewLine", "binData", "reader", "face_size", "n_faces", "expect", "fileLength", "index", "buf", "array_buffer", "decodeText", "data", "path", "LoaderUtils", "endRead", "_parent", "_end", "find1", "findEnd", "findNext", "_currentObject", "nameData", "word", "refs", "DataEnder", "nextStart", "_refs", "_this2", "breakFlag", "_obj", "Matrix4", "b", "Bone", "frame", "mode", "mode_local", "maxLength", "changeMode", "refO", "start", "bufferGeometry", "BufferGeometry", "position", "normals", "uvs", "skinIndices", "skinWeights", "l", "stride2", "stride3", "stride4", "Float32BufferAttribute", "Uint16BufferAttribute", "materialIndices", "group", "groups", "materialIndex", "currentMaterialIndex", "_nowMat", "MeshPhongMaterial", "FrontSide", "data2", "data3", "localObject", "fileName", "Vector2", "boneInf", "_i", "_RootName", "_bones", "putting", "mesh", "putBones", "bi", "boneIndex", "bb", "vi", "nowVertexID", "nowVal", "stride", "sk", "offsetList", "_bi", "SkinnedMesh", "_bufferGeometry", "Mesh", "worldBaseMx", "currentMxFrame", "boneList", "boneInverses", "bones", "bone", "gbone", "il", "skeleton", "Skeleton", "nowKeyType", "keyInfo", "frameFound", "mm", "frameValue", "animationObj", "_model", "_animation", "model", "animation", "put", "findAnimation", "c_key", "_c_key", "k", "AnimationClip", "AnimationMixer", "targetMatrix", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "CstParser", "Lexer", "createToken", "freeGlobal", "freeGlobal$1", "freeSelf", "root", "root$1", "Symbol$1", "Symbol$2", "objectProto$j", "hasOwnProperty$g", "nativeObjectToString$1", "symToStringTag$1", "getRawTag", "value", "isOwn", "tag", "unmasked", "result", "objectProto$i", "nativeObjectToString", "objectToString", "nullTag", "undefinedTag", "symToStringTag", "baseGetTag", "isObjectLike", "symbolTag$3", "isSymbol", "arrayMap", "array", "iteratee", "index", "length", "isArray", "isArray$1", "INFINITY$3", "symbolProto$2", "symbolToString", "baseToString", "reWhitespace", "trimmedEndIndex", "string", "reTrimStart", "baseTrim", "isObject", "type", "NAN", "reIsBadHex", "reIsBinary", "reIsOctal", "freeParseInt", "toNumber", "other", "isBinary", "INFINITY$2", "MAX_INTEGER", "toFinite", "sign", "toInteger", "remainder", "identity", "asyncTag", "funcTag$2", "genTag$1", "proxyTag", "isFunction", "coreJsData", "coreJsData$1", "maskSrcKey", "uid", "isMasked", "func", "funcProto$1", "funcToString$1", "toSource", "reRegExpChar", "reIsHostCtor", "funcProto", "objectProto$h", "funcToString", "hasOwnProperty$f", "reIsNative", "baseIsNative", "pattern", "getValue", "object", "key", "getNative", "WeakMap", "WeakMap$1", "objectCreate", "baseCreate", "proto", "baseCreate$1", "apply", "thisArg", "args", "noop", "copyArray", "source", "HOT_COUNT", "HOT_SPAN", "nativeNow", "shortOut", "count", "lastCalled", "stamp", "remaining", "constant", "defineProperty", "defineProperty$1", "baseSetToString", "setToString", "setToString$1", "arrayEach", "baseFindIndex", "predicate", "fromIndex", "fromRight", "baseIsNaN", "strictIndexOf", "baseIndexOf", "arrayIncludes", "MAX_SAFE_INTEGER$1", "reIsUint", "isIndex", "baseAssignValue", "eq", "objectProto$g", "hasOwnProperty$e", "assignValue", "objValue", "copyObject", "props", "customizer", "isNew", "newValue", "nativeMax$3", "overRest", "start", "transform", "otherArgs", "baseRest", "MAX_SAFE_INTEGER", "isLength", "isArrayLike", "isIterateeCall", "createAssigner", "assigner", "sources", "guard", "objectProto$f", "isPrototype", "Ctor", "baseTimes", "n", "argsTag$3", "baseIsArguments", "objectProto$e", "hasOwnProperty$d", "propertyIsEnumerable$1", "isArguments", "isArguments$1", "stubFalse", "freeExports$2", "freeModule$2", "define_module_default", "moduleExports$2", "Buffer$1", "nativeIsBuffer", "isBuffer", "isBuffer$1", "argsTag$2", "arrayTag$2", "boolTag$3", "dateTag$3", "errorTag$2", "funcTag$1", "mapTag$6", "numberTag$3", "objectTag$3", "regexpTag$4", "setTag$6", "stringTag$4", "weakMapTag$2", "arrayBufferTag$3", "dataViewTag$4", "float32Tag$2", "float64Tag$2", "int8Tag$2", "int16Tag$2", "int32Tag$2", "uint8Tag$2", "uint8ClampedTag$2", "uint16Tag$2", "uint32Tag$2", "typedArrayTags", "baseIsTypedArray", "baseUnary", "freeExports$1", "freeModule$1", "moduleExports$1", "freeProcess", "nodeUtil", "types", "nodeUtil$1", "nodeIsTypedArray", "isTypedArray", "isTypedArray$1", "objectProto$d", "hasOwnProperty$c", "arrayLikeKeys", "inherited", "isArr", "isArg", "isBuff", "isType", "skipIndexes", "overArg", "arg", "nativeKeys", "nativeKeys$1", "objectProto$c", "hasOwnProperty$b", "baseKeys", "keys", "objectProto$b", "hasOwnProperty$a", "assign", "assign$1", "nativeKeysIn", "objectProto$a", "hasOwnProperty$9", "baseKeysIn", "isProto", "keysIn", "reIsDeepProp", "reIsPlainProp", "isKey", "nativeCreate", "nativeCreate$1", "hashClear", "hashDelete", "HASH_UNDEFINED$2", "objectProto$9", "hasOwnProperty$8", "hashGet", "data", "objectProto$8", "hasOwnProperty$7", "hashHas", "HASH_UNDEFINED$1", "hashSet", "Hash", "entries", "entry", "listCacheClear", "assocIndexOf", "arrayProto", "splice", "listCacheDelete", "lastIndex", "listCacheGet", "listCacheHas", "listCacheSet", "ListCache", "Map$1", "Map$2", "mapCacheClear", "isKeyable", "getMapData", "map", "mapCacheDelete", "mapCacheGet", "mapCacheHas", "mapCacheSet", "size", "MapCache", "FUNC_ERROR_TEXT$1", "memoize", "resolver", "memoized", "cache", "MAX_MEMOIZE_SIZE", "memoizeCapped", "rePropName", "reEscapeChar", "stringToPath", "match", "number", "quote", "subString", "stringToPath$1", "toString", "castPath", "INFINITY$1", "toKey", "baseGet", "path", "get", "defaultValue", "arrayPush", "values", "offset", "spreadableSymbol", "isFlattenable", "baseFlatten", "depth", "isStrict", "flatten", "getPrototype", "getPrototype$1", "baseSlice", "end", "arrayReduce", "accumulator", "initAccum", "stackClear", "stackDelete", "stackGet", "stackHas", "LARGE_ARRAY_SIZE$2", "stackSet", "pairs", "Stack", "baseAssign", "baseAssignIn", "freeExports", "freeModule", "moduleExports", "Buffer", "allocUnsafe", "cloneBuffer", "buffer", "isDeep", "arrayFilter", "resIndex", "stubArray", "objectProto$7", "propertyIsEnumerable", "nativeGetSymbols$1", "getSymbols", "symbol", "getSymbols$1", "copySymbols", "nativeGetSymbols", "getSymbolsIn", "getSymbolsIn$1", "copySymbolsIn", "baseGetAllKeys", "keysFunc", "symbolsFunc", "getAllKeys", "getAllKeysIn", "DataView", "DataView$1", "Promise$1", "Promise$2", "Set", "Set$1", "mapTag$5", "objectTag$2", "promiseTag", "setTag$5", "weakMapTag$1", "dataViewTag$3", "dataViewCtorString", "mapCtorString", "promiseCtorString", "setCtorString", "weakMapCtorString", "getTag", "ctorString", "getTag$1", "objectProto$6", "hasOwnProperty$6", "initCloneArray", "Uint8Array", "Uint8Array$1", "cloneArrayBuffer", "arrayBuffer", "cloneDataView", "dataView", "reFlags", "cloneRegExp", "regexp", "symbolProto$1", "symbolValueOf$1", "cloneSymbol", "cloneTypedArray", "typedArray", "boolTag$2", "dateTag$2", "mapTag$4", "numberTag$2", "regexpTag$3", "setTag$4", "stringTag$3", "symbolTag$2", "arrayBufferTag$2", "dataViewTag$2", "float32Tag$1", "float64Tag$1", "int8Tag$1", "int16Tag$1", "int32Tag$1", "uint8Tag$1", "uint8ClampedTag$1", "uint16Tag$1", "uint32Tag$1", "initCloneByTag", "initCloneObject", "mapTag$3", "baseIsMap", "nodeIsMap", "isMap", "isMap$1", "setTag$3", "baseIsSet", "nodeIsSet", "isSet", "isSet$1", "CLONE_DEEP_FLAG", "CLONE_FLAT_FLAG", "CLONE_SYMBOLS_FLAG$1", "argsTag$1", "arrayTag$1", "boolTag$1", "dateTag$1", "errorTag$1", "funcTag", "genTag", "mapTag$2", "numberTag$1", "objectTag$1", "regexpTag$2", "setTag$2", "stringTag$2", "symbolTag$1", "weakMapTag", "arrayBufferTag$1", "dataViewTag$1", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "cloneableTags", "baseClone", "bitmask", "stack", "isFlat", "isFull", "isFunc", "stacked", "subValue", "CLONE_SYMBOLS_FLAG", "clone", "compact", "HASH_UNDEFINED", "setCacheAdd", "setCacheHas", "SetCache", "arraySome", "cacheHas", "COMPARE_PARTIAL_FLAG$5", "COMPARE_UNORDERED_FLAG$3", "equalArrays", "equalFunc", "isPartial", "arrLength", "othLength", "arrStacked", "othStacked", "seen", "arrValue", "othValue", "compared", "othIndex", "mapToArray", "setToArray", "set", "COMPARE_PARTIAL_FLAG$4", "COMPARE_UNORDERED_FLAG$2", "boolTag", "dateTag", "errorTag", "mapTag$1", "numberTag", "regexpTag$1", "setTag$1", "stringTag$1", "symbolTag", "arrayBufferTag", "dataViewTag", "symbolProto", "symbolValueOf", "equalByTag", "convert", "COMPARE_PARTIAL_FLAG$3", "objectProto$5", "hasOwnProperty$5", "equalObjects", "objProps", "objLength", "othProps", "objStacked", "skipCtor", "objCtor", "othCtor", "COMPARE_PARTIAL_FLAG$2", "argsTag", "arrayTag", "objectTag", "objectProto$4", "hasOwnProperty$4", "baseIsEqualDeep", "objIsArr", "othIsArr", "objTag", "othTag", "objIsObj", "othIsObj", "isSameTag", "objIsWrapped", "othIsWrapped", "objUnwrapped", "othUnwrapped", "baseIsEqual", "COMPARE_PARTIAL_FLAG$1", "COMPARE_UNORDERED_FLAG$1", "baseIsMatch", "matchData", "noCustomizer", "srcValue", "isStrictComparable", "getMatchData", "matchesStrictComparable", "baseMatches", "baseHasIn", "hasPath", "hasFunc", "hasIn", "COMPARE_PARTIAL_FLAG", "COMPARE_UNORDERED_FLAG", "baseMatchesProperty", "baseProperty", "basePropertyDeep", "property", "baseIteratee", "arrayAggregator", "setter", "createBaseFor", "iterable", "baseFor", "baseFor$1", "baseForOwn", "createBaseEach", "eachFunc", "collection", "baseEach", "baseEach$1", "baseAggregator", "createAggregator", "initializer", "objectProto$3", "hasOwnProperty$3", "defaults", "propsIndex", "propsLength", "defaults$1", "isArrayLikeObject", "arrayIncludesWith", "comparator", "LARGE_ARRAY_SIZE$1", "baseDifference", "includes", "isCommon", "valuesLength", "outer", "computed", "valuesIndex", "difference", "difference$1", "last", "drop", "dropRight", "castFunction", "forEach", "arrayEvery", "baseEvery", "every", "baseFilter", "filter", "createFind", "findIndexFunc", "nativeMax$2", "findIndex", "find", "find$1", "head", "baseMap", "flatMap", "objectProto$2", "hasOwnProperty$2", "groupBy", "groupBy$1", "objectProto$1", "hasOwnProperty$1", "baseHas", "has", "stringTag", "isString", "baseValues", "nativeMax$1", "nativeMax", "indexOf", "mapTag", "setTag", "objectProto", "hasOwnProperty", "isEmpty", "regexpTag", "baseIsRegExp", "nodeIsRegExp", "isRegExp", "isRegExp$1", "isUndefined", "FUNC_ERROR_TEXT", "negate", "baseSet", "nested", "basePickBy", "paths", "pickBy", "prop", "baseReduce", "reduce", "reject", "baseSome", "some", "INFINITY", "createSet", "createSet$1", "LARGE_ARRAY_SIZE", "baseUniq", "seenIndex", "uniq", "PRINT_ERROR", "msg", "PRINT_WARNING", "timer", "val", "toFastProperties", "toBecomeFast", "FakeConstructor", "fakeInstance", "fakeAccess", "tokenLabel$1", "tokType", "hasTokenLabel$1", "obj", "AbstractProduction", "_definition", "visitor", "prod", "NonTerminal", "options", "v", "definition", "Rule", "Alternative", "Option", "RepetitionMandatory", "RepetitionMandatoryWithSeparator", "Repetition", "RepetitionWithSeparator", "Alternation", "Terminal", "serializeGrammar", "topRules", "serializeProduction", "node", "convertDefinition", "serializedNonTerminal", "serializedTerminal", "GAstVisitor", "nodeAny", "isSequenceProd", "isOptionalProd", "alreadyVisited", "subProd", "isBranchingProd", "getProductionDslName", "RestWalker", "prevRest", "currRest", "terminal", "refProd", "flatProd", "fullOrRest", "optionProd", "atLeastOneProd", "fullAtLeastOneRest", "atLeastOneSepProd", "fullAtLeastOneSepRest", "restForRepetitionWithSeparator", "manyProd", "fullManyRest", "manySepProd", "fullManySepRest", "orProd", "alt", "prodWrapper", "repSepProd", "first", "firstForTerminal", "firstForSequence", "firstForBranching", "firstSet", "seq", "nextSubProdIdx", "hasInnerProdsRemaining", "currSubProd", "isLastInnerProdOptional", "allAlternativesFirsts", "innerProd", "IN", "ResyncFollowsWalker", "topProd", "followName", "buildBetweenProdsFollowPrefix", "fullRest", "restProd", "t_in_topProd_follows", "computeAllProdsFollows", "topProductions", "reSyncFollows", "currRefsFollow", "inner", "occurenceInParent", "cc", "char", "insertToSet", "item", "subItem", "addFlag", "flagObj", "flagKey", "ASSERT_EXISTS", "ASSERT_NEVER_REACH_HERE", "isCharacter", "digitsCharCodes", "i", "wordCharCodes", "whitespaceCodes", "hexDigitPattern", "decimalPattern", "decimalPatternNoZero", "RegExpParser", "newState", "input", "flags", "alts", "begin", "terms", "disjunction", "isBacktracking", "range", "atLeast", "atMost", "atom", "complement", "escapeCode", "letter", "escapedChar", "nextChar", "from", "to", "capturing", "groupAst", "howMuch", "prevState", "howMany", "hexString", "hexChar", "BaseRegExpVisitor", "child", "subChild", "regExpAstCache", "regExpParser", "getRegExpAst", "regExp", "regExpStr", "regExpAst", "clearRegExpParserCache", "complementErrorMessage", "failedOptimizationPrefixMsg", "getOptimizedStartCodesIndices", "ensureOptimizations", "ast", "firstCharOptimizedIndices", "e", "msgSuffix", "ignoreCase", "term", "addOptimizedIdxToResult", "code", "rangeCode", "minOptimizationVal", "minUnOptVal", "maxUnOptVal", "minOptIdx", "charCodeToOptimizedIndex", "maxOptIdx", "currOptIdx", "isOptionalQuantifier", "isWholeOptional", "optimizedCharIdx", "handleIgnoreCase", "upperChar", "lowerChar", "findCode", "setNode", "targetCharCodes", "codeOrRange", "targetCode", "quantifier", "CharCodeFinder", "canMatchCharCode", "charCodes", "charCodeFinder", "PATTERN", "DEFAULT_MODE", "MODES", "SUPPORT_STICKY", "analyzeTokenTypes", "tokenTypes", "action", "tracer", "initCharCodeToOptimizedIndexMap", "onlyRelevantTypes", "currType", "hasCustom", "allTransformedPatterns", "currPattern", "regExpSource", "addStickyFlag", "addStartOfInput", "escapedRegExpString", "wrappedRegExp", "patternIdxToType", "patternIdxToGroup", "patternIdxToLongerAltIdxArr", "patternIdxToPushMode", "patternIdxToPopMode", "clazz", "groupName", "longerAltType", "patternIdxToCanLineTerminator", "lineTerminatorCharCodes", "getCharCodes", "checkLineBreaksIssues", "patternIdxToIsCustom", "patternIdxToShort", "emptyGroups", "patternIdxToConfig", "isCustomPattern", "isShortPattern", "acc", "x", "idx", "canBeOptimized", "charCodeToPatternIdxToConfig", "currTokType", "charCode", "optimizedIdx", "addToMapOfArrays", "lastOptimizedIdx", "charOrInt", "currOptimizedIdx", "optimizedCodes", "validatePatterns", "validModesNames", "errors", "missingResult", "findMissingPatterns", "invalidResult", "findInvalidPatterns", "validTokenTypes", "validateRegExpPattern", "findInvalidGroupType", "findModesThatDoNotExist", "findUnreachablePatterns", "withRegExpPatterns", "findEndOfInputAnchor", "findStartOfInputAnchor", "findUnsupportedFlags", "findDuplicatePatterns", "findEmptyMatchRegExps", "tokenTypesWithMissingPattern", "LexerDefinitionErrorType", "valid", "tokenTypesWithInvalidPattern", "end_of_input", "EndAnchorFinder", "invalidRegex", "regexpAst", "endAnchorVisitor", "matchesEmptyString", "start_of_input", "StartAnchorFinder", "startAnchorVisitor", "invalidFlags", "found", "identicalPatterns", "outerType", "innerType", "duplicatePatterns", "currIdenticalSet", "setOfIdentical", "tokenTypeNames", "invalidTypes", "group", "validModes", "invalidModes", "canBeTested", "noMetaChar", "testIdx", "str", "tokenType", "testTokenType", "regExpArray", "performRuntimeChecks", "lexerDefinition", "trackLines", "lineTerminatorCharacters", "currModeValue", "currModeName", "currIdx", "longerAlt", "currLongerAlt", "performWarningRuntimeChecks", "warnings", "hasAnyLineBreak", "allTokenTypes", "concreteTokenTypes", "terminatorCharCodes", "currIssue", "warningDescriptor", "buildLineBreakIssueMessage", "cloneEmptyGroups", "clonedResult", "groupKeys", "currKey", "currGroupValue", "LineTerminatorOptimizedTester", "text", "len", "c", "details", "charsOrCodes", "numOrString", "charCodeToOptimizedIdxMap", "tokenStructuredMatcher", "tokInstance", "tokConstructor", "instanceType", "tokenStructuredMatcherNoCategories", "token", "tokenShortNameIdx", "tokenIdxToClass", "augmentTokenTypes", "tokenTypesAndParents", "expandCategories", "assignTokenDefaultProps", "assignCategoriesMapProp", "assignCategoriesTokensProp", "categories", "searching", "newCategories", "hasShortKeyProperty", "hasCategoriesProperty", "hasExtendingTokensTypesProperty", "hasExtendingTokensTypesMapProperty", "singleAssignCategoriesToksMap", "nextNode", "pathNode", "nextCategory", "newPath", "isTokenType", "defaultLexerErrorProvider", "fullText", "startOffset", "line", "column", "DEFAULT_LEXER_CONFIG", "config", "phaseDesc", "phaseImpl", "indent", "time", "traceMethod", "traceInitVal", "actualDefinition", "hasOnlySingleMode", "allModeNames", "currModDef", "currModName", "currAnalyzeResult", "allErrMessagesString", "error", "unOptimizedModes", "cannotBeOptimized", "modeName", "initialMode", "j", "k", "matchAltImage", "matchedImage", "payload", "altPayload", "imageLength", "newToken", "errLength", "orgText", "orgLength", "matchedTokensIndex", "guessedNumberOfTokens", "matchedTokens", "groups", "lineTerminatorPattern", "currModePatternsLength", "currCharCodeToPatternIdxToConfig", "modeStack", "emptyArray", "getPossiblePatterns", "getPossiblePatternsSlow", "getPossiblePatternsOptimized", "possiblePatterns", "pop_mode", "popToken", "newMode", "modeCanBeOptimized", "push_mode", "currConfig", "recoveryEnabled", "nextCharCode", "chosenPatternIdxToConfig", "chosenPatternsLength", "singleCharCode", "longerAltLength", "longerAltConfig", "longerAltPattern", "numOfLTsInMatch", "foundTerminator", "lastLTEndOffset", "errorStartOffset", "errorLine", "errorColumn", "foundResyncPoint", "pushMode", "newLastIndex", "lastLTIdx", "lastCharIsLT", "fixForEndingInLT", "oldColumn", "image", "tokenTypeIdx", "startLine", "startColumn", "tokenVector", "tokenToAdd", "tokenLabel", "hasTokenLabel", "PARENT", "CATEGORIES", "LABEL", "GROUP", "PUSH_MODE", "POP_MODE", "LONGER_ALT", "LINE_BREAKS", "START_CHARS_HINT", "createTokenInternal", "EOF", "createTokenInstance", "endOffset", "endLine", "endColumn", "tokenMatcher", "defaultParserErrorProvider", "expected", "actual", "previous", "ruleName", "firstRedundant", "expectedPathsPerAlt", "customUserDescription", "errPrefix", "errSuffix", "allLookAheadPaths", "currAltPaths", "nextValidTokenSequences", "currPath", "currTokenType", "calculatedDescription", "itemMsg", "expectedIterationPaths", "defaultGrammarResolverErrorProvider", "topLevelRule", "undefinedRule", "defaultGrammarValidatorErrorProvider", "duplicateProds", "getExtraProductionArgument", "topLevelName", "duplicateProd", "dslName", "extraArgument", "hasExplicitIndex", "rule", "pathMsg", "currTok", "occurrence", "currtok", "currMessage", "pathNames", "currRule", "leftRecursivePath", "resolveGrammar$1", "topLevels", "errMsgProvider", "refResolver", "GastRefResolverVisitor", "nameToTopRule", "ref", "ParserDefinitionErrorType", "AbstractNextPossibleTokensWalker", "NextAfterTokenWalker", "AbstractNextTerminalAfterProductionWalker", "topRule", "NextTerminalAfterManyWalker", "firstAfterMany", "NextTerminalAfterManySepWalker", "firstAfterManySep", "NextTerminalAfterAtLeastOneWalker", "firstAfterAtLeastOne", "NextTerminalAfterAtLeastOneSepWalker", "atleastOneSepProd", "firstAfterfirstAfterAtLeastOneSep", "possiblePathsFrom", "targetDef", "maxLength", "remainingPathWith", "nextDef", "getAlternativesForProd", "alternatives", "newDef", "currAlt", "nextPossibleTokensAfter", "initialDef", "tokMatcher", "maxLookAhead", "EXIT_NON_TERMINAL", "EXIT_NON_TERMINAL_ARR", "EXIT_ALTERNATIVE", "foundCompletePath", "tokenVectorLength", "minimalAlternativesIndex", "possiblePaths", "currDef", "currRuleStack", "currOccurrenceStack", "nextPath", "nextIdx", "actualToken", "newRuleStack", "newOccurrenceStack", "nextPathWithout", "nextPathWith", "secondIteration", "separatorGast", "nthRepetition", "currAltPath", "expandTopLevelRule", "newCurrOccurrenceStack", "PROD_TYPE", "getProdType", "buildLookaheadFuncForOr", "ruleGrammar", "maxLookahead", "hasPredicates", "dynamicTokensEnabled", "laFuncBuilder", "lookAheadPaths", "getLookaheadPathsForOr", "areTokenCategoriesNotUsed", "buildLookaheadFuncForOptionalProd", "prodType", "lookaheadBuilder", "getLookaheadPathsForOptionalProd", "buildAlternativesLookAheadFunc", "numOfAlts", "areAllOneTokenLookahead", "orAlts", "predicates", "t", "currNumOfPaths", "currPredicate", "currPathLength", "nextToken", "singleTokenAlts", "choiceToAlt", "currExtendingType", "buildSingleAlternativeLookaheadFunction", "numOfPaths", "singleTokensTypes", "expectedTokenUniqueKey", "RestDefinitionFinderWalker", "targetOccurrence", "targetProdType", "expectedProdType", "InsideDefinitionFinderVisitor", "targetRef", "expectedProdName", "initializeArrayOfArrays", "pathToHashKeys", "longerKeys", "currShorterKey", "categoriesKeySuffix", "isUniquePrefixHash", "altKnownPathsKeys", "searchPathKeys", "currAltIdx", "otherAltKnownPathsKeys", "searchIdx", "searchKey", "lookAheadSequenceFromAlternatives", "altsDefs", "partialAlts", "finalResult", "altsHashes", "dict", "newData", "pathLength", "currDataset", "altIdx", "currAltPathsAndSuffixes", "currPathIdx", "currPathPrefix", "suffixDef", "prefixKeys", "currAltResult", "containsPath", "newPartialPathsAndSuffixes", "insideDefVisitor", "insideDef", "afterDef", "insideFlat", "afterFlat", "alternative", "searchPath", "compareOtherPath", "otherPath", "searchTok", "otherTok", "isStrictPrefixOfPath", "prefix", "otherTokType", "singleAltPaths", "singlePath", "validateLookahead", "lookaheadValidationErrorMessages", "errorMessage", "validateGrammar$1", "grammarName", "duplicateErrors", "currTopLevel", "validateDuplicateProductions", "termsNamespaceConflictErrors", "checkTerminalAndNoneTerminalsNameSpace", "tooManyAltsErrors", "curRule", "validateTooManyAlts", "duplicateRulesError", "validateRuleDoesNotAlreadyExist", "collectorVisitor", "OccurrenceValidationCollector", "allRuleProductions", "productionGroups", "identifyProductionForDuplicates", "duplicates", "currGroup", "currDuplicates", "firstProd", "defError", "param", "subrule", "option", "manySep", "atLeastOne", "atLeastOneSep", "many", "or", "allRules", "className", "errMsg", "validateRuleIsOverridden", "definedRulesNames", "validateNoLeftRecursion", "nextNonTerminals", "getFirstNoneTerminal", "validNextSteps", "errorsFromNextSteps", "currRefRule", "currSubDef", "isFirstOptional", "hasMore", "rest", "OrCollector", "validateEmptyOrAlternative", "orCollector", "ors", "currOr", "exceptLast", "currAlternative", "possibleFirstInAlt", "validateAmbiguousAlternationAlternatives", "globalMaxLookahead", "currOccurrence", "actualMaxLookahead", "altsAmbiguityErrors", "checkAlternativesAmbiguities", "altsPrefixAmbiguityErrors", "checkPrefixAlternativesAmbiguities", "RepetitionCollector", "validateSomeNonEmptyLookaheadPath", "topLevelRules", "currTopRule", "currProd", "pathsInsideProduction", "alternation", "foundAmbiguousPaths", "identicalAmbiguities", "altsCurrPathAppearsIn", "currOtherAlt", "currOtherAltIdx", "currAmbDescriptor", "ambgIndices", "pathsAndIndices", "currPathsAndIdx", "currPathAndIdx", "targetIdx", "targetPath", "prefixAmbiguitiesPathsAndIndices", "searchPathAndIdx", "currAmbPathAndIdx", "tokenNames", "currToken", "currRuleName", "resolveGrammar", "actualOptions", "topRulesTable", "validateGrammar", "MISMATCHED_TOKEN_EXCEPTION", "NO_VIABLE_ALT_EXCEPTION", "EARLY_EXIT_EXCEPTION", "NOT_ALL_INPUT_PARSED_EXCEPTION", "RECOGNITION_EXCEPTION_NAMES", "isRecognitionException", "RecognitionException", "message", "MismatchedTokenException", "previousToken", "NoViableAltException", "NotAllInputParsedException", "EarlyExitException", "EOF_FOLLOW_KEY", "IN_RULE_RECOVERY_EXCEPTION", "InRuleRecoveryException", "Recoverable", "DEFAULT_PARSER_CONFIG", "attemptInRepetitionRecovery", "tokToInsert", "grammarRule", "grammarRuleArgs", "lookAheadFunc", "expectedTokType", "reSyncTokType", "savedLexerState", "resyncedTokens", "passedResyncPoint", "nextTokenWithoutResync", "generateErrorMessage", "expectTokAfterLastMatch", "nextTokIdx", "notStuck", "tokIdxInRule", "grammarPath", "follows", "nextTok", "expectedToken", "mismatchedTok", "possibleFollowsTokType", "followKey", "currentRuleReSyncSet", "allPossibleReSyncTokTypes", "foundMatch", "resyncTokType", "currRuleShortName", "currRuleIdx", "prevRuleShortName", "explicitRuleStack", "explicitOccurrenceStack", "followStack", "resyncTokens", "prodFunc", "lookaheadFunc", "dslMethodIdx", "prodOccurrence", "nextToksWalker", "pathRuleStack", "pathOccurrenceStack", "currShortName", "firstAfterRepInfo", "isEndOfRule", "BITS_FOR_METHOD_TYPE", "BITS_FOR_OCCURRENCE_IDX", "OR_IDX", "OPTION_IDX", "MANY_IDX", "AT_LEAST_ONE_IDX", "MANY_SEP_IDX", "AT_LEAST_ONE_SEP_IDX", "getKeyForAutomaticLookahead", "ruleIdx", "LLkLookaheadStrategy", "_a", "leftRecursionErrors", "emptyAltErrors", "ambiguousAltsErrors", "emptyRepetitionErrors", "rules", "LooksAhead", "repetition", "repetitionMandatory", "repetitionMandatoryWithSeparator", "repetitionWithSeparator", "collectMethods", "prodIdx", "laFunc", "prodKey", "prodMaxLookahead", "dslMethodName", "DslMethodsCollectorVisitor", "dslMethods", "setNodeLocationOnlyOffset", "currNodeLocation", "newLocationInfo", "setNodeLocationFull", "addTerminalToCst", "tokenTypeName", "addNoneTerminalToCst", "ruleResult", "NAME", "defineNameProp", "nameValue", "defaultVisit", "ctx", "childrenNames", "childrenNamesLength", "currChildName", "currChildArray", "currChildArrayLength", "currChild", "createBaseSemanticVisitorConstructor", "ruleNames", "derivedConstructor", "semanticProto", "cstNode", "semanticDefinitionErrors", "validateVisitor", "errorMessages", "currDefError", "createBaseVisitorConstructorWithDefaults", "baseConstructor", "withDefaultsProto", "CstVisitorDefinitionError", "visitorInstance", "validateMissingCstMethods", "missingRuleNames", "TreeBuilder", "fullRuleName", "ruleCstNode", "prevToken", "loc", "consumedToken", "rootCst", "ruleCstResult", "preCstNode", "newBaseCstVisitorConstructor", "newConstructor", "ruleStack", "occurrenceStack", "LexerAdapter", "newInput", "END_OF_FILE", "soughtIdx", "RecognizerApi", "impl", "ruleToCall", "actionORMethodDef", "altsOrOpts", "name", "implementation", "DEFAULT_RULE_CONFIG", "ruleImplementation", "ruleErrors", "orgState", "RecognizerEngine", "tokenVocabulary", "uniqueTokens", "noTokenCategoriesUsed", "tokenConstructor", "resyncEnabled", "recoveryValueFunc", "shortName", "invokeRuleWithTry", "cst", "resyncEnabledConfig", "isFirstInvokedRule", "reSyncEnabled", "recogError", "partialCstResult", "orgLookaheadFunction", "laKey", "separator", "separatorLookAheadFunc", "lookaheadFunction", "nextTerminalAfterWalker", "beforeIteration", "altIdxToTake", "firstRedundantTok", "eFromConsumption", "eFromInRuleRecovery", "savedErrors", "savedRuleStack", "fullName", "idxInCallingRule", "ErrorHandler", "newErrors", "userDefinedErrMsg", "insideProdPaths", "actualTokens", "errMsgTypes", "lookAheadPathsPerAlternative", "ContentAssist", "startRuleName", "precedingInput", "startRuleGast", "topRuleName", "topProduction", "RECORDING_NULL_OBJECT", "HANDLE_SEPARATOR", "MAX_METHOD_IDX", "RFT", "RECORDING_PHASE_TOKEN", "RECORDING_PHASE_CSTNODE", "GastRecorder", "arg1", "arg2", "that", "def", "newTopLevelRule", "originalError", "recordProd", "recordOrProd", "assertMethodIdxIsValid", "getIdxSuffix", "prevProd", "newNoneTerminal", "prodConstructor", "mainProdArg", "handleSep", "grammarAction", "newProd", "hasOptions", "newOrProd", "currAltFlat", "PerformanceTracer", "userTraceInitPerf", "traceIsNumber", "applyMixins", "derivedCtor", "baseCtors", "baseCtor", "baseProto", "propName", "basePropDescriptor", "Parser", "parserInstance", "defErrorsMsgs", "originalGrammarAction", "recordedRuleGast", "resolverErrors", "validationErrors", "lookaheadValidationErrors", "allFollows", "_b", "configClone", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "WorkerPool", "pool", "workerId", "worker", "i", "msg", "resolve", "transfer", "workerCreator", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "KTX2Container", "BufferReader", "data", "byteOffset", "byteLength", "littleEndian", "value", "left", "right", "len", "bytes", "maxByteLength", "term", "KTX2_ID", "decodeText", "buffer", "read", "id", "container", "headerByteLength", "headerReader", "levelCount", "dfdByteOffset", "dfdByteLength", "kvdByteOffset", "kvdByteLength", "sgdByteOffset", "sgdByteLength", "levelByteLength", "levelReader", "i", "dfdReader", "dfd", "sampleStart", "sampleWords", "numSamples", "sample", "kvdReader", "keyValueByteLength", "keyData", "key", "text", "kvPadding", "sgdReader", "endpointCount", "selectorCount", "endpointsByteLength", "selectorsByteLength", "tablesByteLength", "extendedByteLength", "imageDescs", "endpointsByteOffset", "selectorsByteOffset", "tablesByteOffset", "extendedByteOffset", "endpointsData", "selectorsData", "tablesData", "extendedData", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init", "instance", "heap", "IMPORT_OBJECT", "index", "ZSTDDecoder", "wasm", "response", "arrayBuffer", "result", "array", "uncompressedSize", "compressedSize", "compressedPtr", "uncompressedPtr", "actualSize", "dec", "CompressedCubeTexture", "CompressedTexture", "images", "format", "type", "CubeReflectionMapping", "CompressedArrayTexture", "CompressedTexture", "mipmaps", "width", "height", "depth", "format", "type", "ClampToEdgeWrapping", "LinearEncoding", "sRGBEncoding", "NoColorSpace", "DisplayP3ColorSpace", "LinearDisplayP3ColorSpace", "LinearSRGBColorSpace", "SRGBColorSpace", "_taskCache", "_activeLoaders", "_zstd", "_KTX2Loader", "Loader", "manager", "WorkerPool", "path", "num", "renderer", "jsLoader", "FileLoader", "jsContent", "binaryLoader", "binaryContent", "fn", "body", "worker", "transcoderBinary", "url", "onLoad", "onProgress", "onError", "loader", "buffer", "texture", "transcodeResult", "container", "faces", "width", "height", "format", "type", "error", "dfdFlags", "CompressedCubeTexture", "UnsignedByteType", "mipmaps", "CompressedArrayTexture", "CompressedTexture", "LinearFilter", "LinearMipmapLinearFilter", "colorSpace", "parseColorSpace", "config", "read", "createRawTexture", "taskConfig", "texturePending", "e", "KTX2Loader", "__publicField", "RGBAFormat", "RGBA_ASTC_4x4_Format", "RGBA_BPTC_Format", "RGBA_ETC2_EAC_Format", "RGBA_PVRTC_4BPPV1_Format", "RGBA_S3TC_DXT5_Format", "RGB_ETC1_Format", "RGB_ETC2_Format", "RGB_PVRTC_4BPPV1_Format", "RGB_S3TC_DXT1_Format", "transcoderPending", "BasisModule", "EngineFormat", "TranscoderFormat", "BasisFormat", "message", "init", "buffers", "hasAlpha", "transcode", "wasmBinary", "resolve", "ktx2File", "cleanup", "basisFormat", "layerCount", "levelCount", "faceCount", "transcoderFormat", "engineFormat", "getTranscoderFormat", "face", "mip", "layerMips", "mipWidth", "mipHeight", "layer", "levelInfo", "dst", "mipData", "concat", "FORMAT_OPTIONS", "ETC1S_OPTIONS", "a", "b", "UASTC_OPTIONS", "options", "i", "opt", "isPowerOfTwo", "value", "arrays", "totalByteLength", "array", "result", "byteOffset", "UNCOMPRESSED_FORMATS", "RGFormat", "RedFormat", "FORMAT_MAP", "RGBA_ASTC_6x6_Format", "TYPE_MAP", "FloatType", "HalfFloatType", "vkFormat", "zstd", "ZSTDDecoder", "levelIndex", "levelWidth", "levelHeight", "levelDepth", "level", "levelData", "data", "DataTexture", "Data3DTexture", "dfd", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "lottie", "flag", "value", "type", "sources", "destination", "i", "len", "sourcePrototype", "attr", "object", "prop", "prototype", "ProxyFunction", "AudioController", "audioFactory", "audio", "rateValue", "assetPath", "createRegularArray", "arr", "createTypedArrayFactory", "propertyNames", "val", "tOfVal", "absArr", "currentTime", "totalTime", "frameMultiplier", "totalLoops", "currentLoop", "firstFrame", "totalFrames", "target", "nativeError", "_count", "h", "s", "v", "g", "b", "f", "p", "q", "t", "r", "max", "min", "d", "color", "offset", "hsv", "colorMap", "hex", "_counterId", "processes", "workerFn", "workerInstance", "workerProxy", "path", "_workerSelf", "data", "createWorker", "fn", "blob", "url", "setupWorker", "e", "dataFunctionManager", "completeLayers", "layers", "comps", "layerData", "j", "jLen", "k", "kLen", "maskProps", "convertPathsToAbsoluteValues", "findCompLayers", "completeShapes", "completeText", "completeChars", "chars", "assets", "findComp", "id", "comp", "checkVersion", "minimum", "animVersionString", "animVersion", "checkText", "minimumVersion", "updateTextLayer", "textLayer", "documentData", "iterateLayers", "animationData", "checkChars", "charData", "checkPathProperties", "pathData", "checkColors", "iterateShapes", "shapes", "checkShapes", "completeClosingShapes", "completeData", "moduleOb", "formatResponse", "xhr", "contentTypeHeader", "loadAsset", "fullPath", "callback", "errorCallback", "response", "err", "animation", "event", "process", "createProcess", "onComplete", "onError", "loadAnimation", "processId", "loadData", "completeAnimation", "anim", "proxyImage", "canvas", "ctx", "imageLoaded", "footageLoaded", "getAssetsPath", "assetData", "assetsPath", "originalPath", "imagePath", "testImageLoaded", "img", "intervalId", "box", "createImageData", "ob", "createImgData", "createFootageData", "footageData", "loadAssets", "cb", "setPath", "setAssetsPath", "getAsset", "destroy", "loadedImages", "loadedFootages", "setCacheType", "elementHelper", "ImagePreloaderFactory", "eventName", "args", "callbacks", "parsePayloadLines", "payload", "lines", "keys", "line", "keysCount", "_markers", "markers", "_marker", "markerData", "registerComposition", "_thisProjectFunction", "name", "key", "params", "animType", "RendererClass", "wrapper", "wrapperAttributes", "loop", "autoplay", "prerender", "newLayers", "expressionsPlugin", "segments", "segment", "segmentPath", "animData", "error", "markerName", "marker", "isFrame", "numValue", "nextValue", "_isComplete", "init", "end", "pendingFrame", "forceFlag", "index", "element", "registeredAnimations", "initTime", "playingAnimationsNum", "_stopped", "_isFrozen", "removeElement", "ev", "animItem", "subtractPlayingCount", "registerAnimation", "setupAnimation", "getRegisteredAnimations", "lenAnims", "animations", "addPlayingCount", "activate", "setSpeed", "setDirection", "play", "resume", "nowTime", "elapsedTime", "first", "pause", "goToAndStop", "stop", "togglePause", "searchAnimations", "standalone", "renderer", "animElements", "body", "div", "resize", "freeze", "unfreeze", "setVolume", "mute", "unmute", "getBezierEasing", "beziers", "a", "c", "nm", "str", "bezEasing", "BezierEasing", "NEWTON_ITERATIONS", "NEWTON_MIN_SLOPE", "SUBDIVISION_PRECISION", "SUBDIVISION_MAX_ITERATIONS", "kSplineTableSize", "kSampleStepSize", "float32ArraySupported", "A", "aA1", "aA2", "B", "C", "calcBezier", "aT", "getSlope", "binarySubdivide", "aX", "aA", "aB", "mX1", "mX2", "currentX", "currentT", "newtonRaphsonIterate", "aGuessT", "currentSlope", "points", "x", "mY1", "mY2", "mSampleValues", "intervalStart", "currentSample", "lastSample", "dist", "guessForT", "initialSlope", "double", "initialLength", "_create", "_release", "_length", "_maxLength", "pool", "newElement", "release", "create", "math", "pointOnLine2D", "x1", "y1", "x2", "y2", "x3", "y3", "det1", "pointOnLine3D", "z1", "z2", "z3", "dist1", "dist2", "dist3", "diffDist", "getBezierLength", "pt1", "pt2", "pt3", "pt4", "curveSegments", "ptCoord", "perc", "addedLength", "ptDistance", "point", "lastPoint", "lengthData", "getSegmentsLength", "shapeData", "segmentsLength", "closed", "pathV", "pathO", "pathI", "lengths", "totalLength", "BezierData", "length", "PointData", "partial", "buildBezierData", "storedData", "bezierName", "bezierData", "getDistancePerc", "percents", "initPos", "lengthPos", "lPerc", "dir", "getPointInSegment", "percent", "t1", "u1", "ptX", "ptY", "bezierSegmentPoints", "getNewSegment", "startPerc", "endPerc", "t0", "u0", "u0u0u0", "t0u0u0_3", "t0t0u0_3", "t0t0t0", "u0u0u1", "t0u0u1_3", "t0t0u1_3", "t0t0t1", "u0u1u1", "t0u1u1_3", "t0t1u1_3", "t0t1t1", "u1u1u1", "t1u1u1_3", "t1t1u1_3", "t1t1t1", "initFrame", "mathAbs", "interpolateValue", "frameNum", "caching", "offsetTime", "newValue", "iterationIndex", "keyData", "nextKeyData", "keyframeMetadata", "fnc", "nextKeyTime", "keyTime", "endValue", "ind", "distanceInLine", "segmentPerc", "outX", "outY", "inX", "inY", "keyValue", "quatStart", "createQuaternion", "quatEnd", "time", "quaternionToEuler", "slerp", "out", "ax", "ay", "az", "aw", "bx", "by", "bz", "bw", "omega", "cosom", "sinom", "scale0", "scale1", "quat", "qx", "qy", "qz", "qw", "heading", "attitude", "bank", "values", "c1", "c2", "c3", "s1", "s2", "s3", "w", "y", "z", "getValueAtCurrentTime", "endTime", "renderResult", "setVValue", "multipliedValue", "processEffectsSequence", "finalValue", "addEffect", "effectFunction", "ValueProperty", "elem", "mult", "container", "MultiDimensionalProperty", "KeyframedValueProperty", "KeyframedMultidimensionalProperty", "to", "ti", "arrLen", "getProp", "pos", "replace", "vX", "vY", "oX", "oY", "iX", "iY", "newPath", "vertices", "outPoints", "inPoints", "cnt", "shapePath", "clone", "shape", "cloned", "factory", "newShapeCollection", "shapeCollection", "interpolateShape", "previousValue", "keyPropS", "keyPropE", "isHold", "vertexValue", "kf", "interpolateShapeCurrentTime", "lastFrame", "resetShape", "shapesEqual", "shape1", "shape2", "ShapeProperty", "KeyframedShapeProperty", "EllShapeProperty", "cPoint", "EllShapePropertyFactory", "p0", "p1", "s0", "_cw", "_v", "StarShapeProperty", "StarShapePropertyFactory", "numPts", "angle", "longFlag", "longRad", "shortRad", "longRound", "shortRound", "longPerimSegment", "shortPerimSegment", "rad", "roundness", "perimSegment", "currentAng", "ox", "oy", "RectShapeProperty", "RectShapePropertyFactory", "v0", "v1", "round", "getShapeProp", "dataProp", "getConstructorFunction", "getKeyframedConstructorFunction", "_cos", "_sin", "_tan", "_rnd", "reset", "rotate", "mCos", "mSin", "rotateX", "rotateY", "rotateZ", "shear", "sx", "sy", "skew", "skewFromAxis", "scale", "sz", "setTransform", "l", "m", "n", "o", "translate", "tx", "ty", "tz", "transform", "a2", "b2", "d2", "e2", "f2", "g2", "h2", "i2", "j2", "k2", "l2", "m2", "n2", "o2", "p2", "_p", "a1", "b1", "d1", "e1", "f1", "g1", "h1", "i1", "j1", "k1", "l1", "m1", "n1", "o1", "isIdentity", "equals", "matr", "cloneFromProps", "props", "applyToPoint", "applyToX", "applyToY", "applyToZ", "getInverseMatrix", "determinant", "inverseMatrix", "inversePoint", "pt", "inversePoints", "pts", "retPts", "applyToTriplePoints", "p4", "p5", "p12", "p13", "applyToPointArray", "applyToPointStringified", "toCSS", "cssValue", "roundMatrixProperty", "to2dCSS", "_a", "_b", "_c", "_d", "_e", "_f", "href", "prefix", "plugin", "variable", "vars", "pair", "define_module_default", "modifiers", "registerModifier", "getModifier", "shapeLength", "totalModifierLength", "shapeSegments", "segmentOb", "shapeS", "shapeE", "pathsData", "_isFirstFrame", "_s", "shapePaths", "totalShapeLength", "localShapeCollection", "edges", "newShapesData", "lastShapeInCollection", "lastShape", "newPaths", "newShape", "shapeSegment", "currentLengthData", "segmentCount", "segmentLength", "amount", "centerPoint", "pathLength", "clonedPath", "defaultVector", "applyToMatrix", "mat", "_mdf", "processKeys", "forceRender", "frameRate", "v2", "px", "py", "precalculateMatrix", "autoOrient", "addDynamicProperty", "TransformProperty", "getTransformProperty", "pMatrix", "rMatrix", "sMatrix", "inv", "scaleX", "scaleY", "elemsData", "elements", "newElements", "renderFlag", "items", "itemsTransform", "cont", "hasReloaded", "copies", "group", "elems", "transformData", "offsetModulo", "roundOffset", "pProps", "rProps", "sProps", "iteration", "currentV", "currentI", "currentO", "closerV", "distance", "newPosPerc", "rd", "fontData", "styles", "fWeight", "fStyle", "styleName", "maxWaitingTime", "emptyChar", "combinedCharacters", "surrogateModifiers", "zeroWidthJoiner", "trimFontOptions", "font", "familyArray", "enabledFamilies", "setUpNode", "family", "parentNode", "node", "width", "checkLoadedFonts", "loadedCount", "createHelper", "def", "engine", "helper", "fontProps", "tHelper", "tCanvasHelper", "measure", "text", "addFonts", "defs", "fontArr", "_pendingFonts", "shouldLoadFont", "loadedSelector", "sc", "addChars", "found", "getCharData", "char", "style", "measureText", "fontName", "size", "doubleSize", "singleSize", "getFontByName", "isModifier", "firstCharCode", "secondCharCode", "sum", "isZeroWidthJoiner", "isCombinedCharacter", "setIsLoaded", "Font", "fontPrototype", "component", "num", "MaskInterface", "mask", "MaskManager", "maskManager", "_masksInterfaces", "maskFunction", "defaultUnidimensionalValue", "defaultMultidimensionalValue", "completeProperty", "expressionValue", "property", "valueProp", "UnidimensionalPropertyInterface", "MultidimensionalPropertyInterface", "arrValue", "defaultGetter", "_thisFunction", "_px", "_py", "_pz", "_transformFactory", "getMatrix", "toWorldMat", "propMatrix", "transformMat", "toWorldVec", "toWorld", "fromWorldVec", "fromWorld", "applyPoint", "matrix", "invertPoint", "fromComp", "sampleImage", "transformInterface", "_registerMaskInterface", "_thisLayerFunction", "_registerEffectsInterface", "effects", "anchorPointDescriptor", "interfaceFunction", "parentPropertyGroup", "propertyName", "propertyGroup", "_propertyGroup", "createEffectsInterface", "effectElements", "effectsData", "createGroupInterface", "groupInterface", "createValueInterface", "expressionProperty", "view", "iterateElements", "groupInterfaceFactory", "fillInterfaceFactory", "strokeInterfaceFactory", "trimInterfaceFactory", "ellipseInterfaceFactory", "starInterfaceFactory", "rectInterfaceFactory", "roundedInterfaceFactory", "repeaterInterfaceFactory", "gradientFillInterfaceFactory", "defaultInterfaceFactory", "contentsInterfaceFactory", "interfaces", "transformInterfaceFactory", "content", "_dashPropertyGroup", "dashOb", "addPropertyToDashOb", "_interfaceFunction", "parentGroupWrapper", "_prevValue", "_sourceText", "stringValue", "blendModeEnums", "mode", "effectItem", "eff", "effectsInterface", "blendModeValue", "globalData", "isVisible", "outlineInterfaceFactory", "currentPropertyName", "currentProperty", "searchProperty", "propertyNameIndex", "dataInterfaceFactory", "timeRemapped", "totalVolume", "volumeValue", "layer", "pInterface", "parentName", "hierarchy", "pathValue", "fontsContainer", "finalMat", "transforms", "ptNew", "properties", "count", "currentMasks", "layerId", "rect", "expansor", "feMorph", "maskType", "maskRef", "filterID", "isFirstFrame", "pathNodes", "viewData", "pathString", "pathShapeValue", "createFilter", "createAlphaToLuminanceFilter", "filId", "skipCoordinates", "fil", "feColorMatrix", "source", "filterManager", "Effect", "layerElementParent", "gg", "masker", "maskGroup", "maskGrouper", "feCTr", "feFunc", "alphaRect", "cp", "clipId", "cpGroup", "_prototype", "position", "shouldBreakProcess", "transformers", "level", "styleOb", "cLength", "diff", "pathElement", "gradientId", "gfill", "stops", "maskElement", "opacityId", "maskId", "opFill", "mProps", "op", "_o", "_i", "shapeString", "_identityMatrix", "_matrixHelper", "createRenderFunction", "renderFill", "renderGradient", "renderGradientStroke", "renderStroke", "renderPath", "renderContentTransform", "renderNoop", "styleData", "itemData", "pathStringTransformed", "redraw", "lLen", "lvl", "paths", "iterations", "styleElem", "hasOpacity", "attr1", "attr2", "cValues", "oValues", "ang", "tempShapes", "areAnimated", "elementData", "GradientConstructor", "transformProperty", "ownTransformers", "shapeProperty", "itemsData", "prevViewData", "render", "ownStyles", "ownModifiers", "currentTransform", "modifier", "processedPos", "animatedContent", "sw", "fc", "updated", "obj", "_finalValue", "currentValue", "currentIndex", "textKeys", "charactersArray", "charCode", "shouldCombine", "fontManager", "letters", "newLineFlag", "anchorGrouping", "currentSize", "currentPos", "currentLine", "lineWidths", "lineWidth", "maxLineWidth", "trackingOffset", "boxWidth", "boxHeight", "currentHeight", "finalText", "lastSpaceIndex", "uncollapsedSpaces", "currentChar", "animators", "animatorData", "letterData", "based", "indexes", "currentInd", "newInd", "newData", "dData", "_canResize", "_fontValue", "floor", "TextSelectorPropFactory", "easer", "tot", "smoothness", "threshold", "newCharsFlag", "divisor", "getTextSelectorProp", "animatorProps", "defaultData", "textAnimatorAnimatables", "textData", "renderType", "lettersChangedFlag", "alignment", "matrixHelper", "renderedLettersCount", "xPos", "yPos", "pathInfo", "currentLength", "currentPoint", "pointInd", "segmentInd", "prevPoint", "partialLength", "tanAngle", "yOff", "firstLine", "animatorSelector", "letterValue", "offf", "xPathPos", "yPathPos", "initPathPos", "initSegmentInd", "initPointInd", "elemOpacity", "letterSw", "letterSc", "letterFc", "letterM", "letterP", "letterO", "animatorJustifyOffset", "animatorFirstCharOffset", "justifyOffsetMult", "lastIndex", "isNewLine", "animatorOffset", "rot", "shapeStr", "_fontSize", "lineNumber", "colorData", "textArray", "textContents", "currentTextContent", "shapeItem", "usesGlyphs", "tSpan", "singleShape", "tElement", "justify", "textContent", "cachedSpansLength", "childSpan", "glyphElement", "glyph", "textBox", "renderedLetters", "renderedLetter", "textSpan", "nextElement", "animationItem", "config", "ariaLabel", "titleElement", "titleId", "descElement", "descId", "newLength", "currentSavedOp", "sequence", "hasMasks", "forceRealStack", "transformsManager", "styledShape", "shouldRender", "ownTransforms", "parentTransform", "groupTransform", "nodes", "currentStyle", "isMain", "shapeNodes", "groupTransformMat", "grd", "opacity", "hasFill", "hasStroke", "commands", "pathArr", "commandsCounter", "lastFill", "lastStroke", "lastStrokeW", "imgW", "imgH", "imgRel", "canvasRel", "widthCrop", "heightCrop", "par", "cProps", "trProps", "actionFlag", "popped", "containerStyle", "origin", "elementWidth", "elementHeight", "elementRel", "animationRel", "fillType", "initExpressions", "stackCount", "registers", "pushExpression", "popExpression", "releaseInstances", "registerExpressionProperty", "expression", "global", "chunks", "digits", "rngname", "startdenom", "significance", "overflow", "nodecrypto", "seedrandom", "seed", "options", "shortseed", "mixkey", "flatten", "tostring", "autoseed", "arc4", "ARC4", "prng", "is_math_call", "state", "copy", "keylen", "me", "depth", "result", "typ", "stringseed", "smear", "browser", "plugins", "BMMath", "tOfV", "tOfA", "lenA", "retArr", "tOfB", "lenB", "mm", "arr1", "arr2", "vec", "tMin", "tMax", "value1", "value2", "_tMin", "rnd", "rndm", "inTangents", "outTangents", "arrPlaceholder", "inVertexPoint", "outVertexPoint", "wiggle", "freq", "amp", "iWiggle", "lenWiggle", "addedAmps", "periods", "duration", "elem1", "elem2", "fVec", "pitch", "yaw", "val1", "val2", "iKey", "lenKey", "obKey", "fr", "fps", "framesPerSecond", "_value", "searchExpressions", "getValueAtTime", "getSpeedAtTime", "delta", "speed", "getVelocityAtTime", "velocity", "getStaticValueAtTime", "setGroupProperty", "loopOut", "durationFlag", "currentFrame", "keyframes", "lastKeyFrame", "cycleDuration", "firstKeyFrame", "ret", "initV", "endV", "current", "repeats", "lastValue", "nextLastValue", "loopIn", "firstValue", "nextFirstValue", "smooth", "samples", "endFrame", "sampleFrequency", "sampleValue", "getTransformValueAtTime", "anchor", "skewAxis", "rotation", "rotationZ", "rotationY", "rotationX", "orientation", "positionX", "positionY", "positionZ", "getTransformStaticValueAtTime", "propertyGetProp", "getShapeValueAtTime", "ShapePropertyConstructorFunction", "KeyframedShapePropertyConstructorFunction", "ShapeExpressions", "accumulatedLength", "initIndex", "endIndex", "vectorType", "xLength", "yLength", "magnitude", "unitVector", "propertyGetShapeProp", "trims", "isKeyframed", "hasExpressions", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "parseBuffer", "TINF_OK", "TINF_DATA_ERROR", "Tree", "Data", "source", "dest", "sltree", "sdtree", "length_bits", "length_base", "dist_bits", "dist_base", "clcidx", "code_tree", "lengths", "tinf_build_bits_base", "bits", "base", "delta", "first", "i", "sum", "tinf_build_fixed_trees", "lt", "dt", "offs", "tinf_build_tree", "t", "off", "num", "tinf_getbit", "d", "bit", "tinf_read_bits", "val", "tinf_decode_symbol", "cur", "len", "tag", "tinf_decode_trees", "hlit", "hdist", "hclen", "length", "clen", "sym", "prev", "tinf_inflate_block_data", "dist", "tinf_inflate_uncompressed_block", "invlength", "tinf_uncompress", "bfinal", "btype", "res", "tinyInflate", "derive", "v0", "v1", "v2", "v3", "BoundingBox", "x", "y", "x0", "y0", "x1", "y1", "x2", "y2", "p0", "p1", "p2", "p3", "b", "a", "c", "b2ac", "t1", "t2", "cp1x", "cp1y", "cp2x", "cp2y", "Path", "pathOrCommands", "box", "startX", "startY", "prevX", "prevY", "cmd", "ctx", "decimalPlaces", "floatToString", "v", "packValues", "arguments$1", "s", "svg", "temporaryPath", "newPath", "fail", "message", "argument", "predicate", "check", "LIMIT16", "LIMIT32", "decode", "encode", "sizeOf", "constant", "value", "m", "epsilon", "nibbles", "ii", "out", "i$1", "ii$1", "data", "offset", "numBytes", "codePoints", "numChars", "j", "codepoint", "eightBitMacEncodings", "dataView", "dataLength", "encoding", "table", "result", "macEncodingTableCache", "macEncodingCacheKeys", "getMacEncodingTable", "e", "cacheKey", "cachedTable", "decodingTable", "encodingTable", "str", "isByteEncodable", "encodeVarDeltaRunAsZeroes", "deltas", "pos", "runLength", "numDeltas", "encodeVarDeltaRunAsBytes", "encodeVarDeltaRunAsWords", "l", "offsets", "encodedOffsets", "offSize", "offsetEncoder", "encodedOffset", "keys", "k", "type", "wmm", "ops", "cachedValue", "op", "encodingFunction", "sizeOfFunction", "subtables", "subtableOffsets", "field", "bytes", "o", "Table", "tableName", "fields", "options", "optionKeys", "ushortList", "itemName", "list", "count", "tableList", "records", "itemCallback", "recordList", "Coverage", "coverageTable", "RangeRecord", "ScriptList", "scriptListTable", "scriptRecord", "script", "defaultLangSys", "langSysRecord", "langSys", "FeatureList", "featureListTable", "featureRecord", "feature", "LookupList", "lookupListTable", "subtableMakers", "lookupTable", "subtableCallback", "getByte", "getUShort", "getShort", "getULong", "getFixed", "decimal", "fraction", "getTag", "getOffset", "getBytes", "startOffset", "endOffset", "bytesToString", "typeOffsets", "Parser", "string", "minorBase", "major", "minor", "amount", "recordDescription", "rec", "fieldName", "fieldType", "description", "struct", "valueFormat", "valueRecord", "valueCount", "values", "structOffset", "relativeOffset", "start", "subOffsets", "subList", "format", "ranges", "langSysTable", "lookupTableParsers", "lookupType", "lookupFlag", "useMarkFilteringSet", "majorVersion", "minorVersion", "featureVariations", "parse", "parseCmapTableFormat12", "cmap", "p", "groupCount", "startCharCode", "endCharCode", "startGlyphId", "parseCmapTableFormat4", "segCount", "endCountParser", "startCountParser", "idDeltaParser", "idRangeOffsetParser", "glyphIndexOffset", "glyphIndex", "endCount", "startCount", "idDelta", "idRangeOffset", "parseCmapTable", "platformId", "encodingId", "addSegment", "code", "addTerminatorSegment", "makeCmapTable", "glyphs", "isPlan0Only", "g", "cmapTable", "glyph", "segCountToRemove", "endCounts", "startCounts", "idDeltas", "idRangeOffsets", "glyphIds", "cmap12Groups", "segment", "cmap12Length", "cffStandardStrings", "cffStandardEncoding", "cffExpertEncoding", "standardNames", "DefaultEncoding", "font", "CmapEncoding", "CffEncoding", "charset", "charName", "GlyphNames", "post", "name", "gid", "addGlyphNamesAll", "glyphIndexMap", "charCodes", "addGlyphNamesToUnicodeMap", "addGlyphNames", "opt", "line", "draw", "getPathDefinition", "path", "_path", "Glyph", "unicode", "fontSize", "commands", "hPoints", "xScale", "yScale", "scale", "contours", "currentContour", "pt", "xCoords", "yCoords", "metrics", "drawCircles", "blueCircles", "redCircles", "xMin", "yMin", "xMax", "yMax", "advanceWidth", "defineDependentProperty", "externalName", "internalName", "newValue", "GlyphSet", "index", "unicodeObj", "loader", "glyphLoader", "ttfGlyphLoader", "parseGlyph", "position", "buildPath", "cffGlyphLoader", "parseCFFCharstring", "charstring", "glyphset", "equals", "calcCFFSubroutineBias", "subrs", "bias", "parseCFFIndex", "conversionFn", "objects", "objectOffset", "offsetSize", "parseCFFIndexLowMemory", "getCffIndexObject", "parseFloatOperand", "parser", "eof", "lookup", "n1", "n2", "parseOperand", "b0", "b1", "b2", "b3", "b4", "entriesToObject", "entries", "key", "parseCFFDict", "size", "operands", "getCFFString", "strings", "interpretDict", "dict", "meta", "newDict", "parseCFFHeader", "header", "TOP_DICT_META", "PRIVATE_DICT_META", "parseCFFTopDict", "parseCFFPrivateDict", "gatherCFFTopDicts", "cffIndex", "topDictArray", "iTopDict", "topDictData", "topDict", "privateSize", "privateOffset", "privateDict", "subrOffset", "subrIndex", "parseCFFCharset", "nGlyphs", "sid", "i$2", "parseCFFEncoding", "enc", "nCodes", "nRanges", "nLeft", "c1x", "c1y", "c2x", "c2y", "stack", "nStems", "haveWidth", "open", "subrsBias", "defaultWidthX", "nominalWidthX", "fdIndex", "fdDict", "width", "newContour", "parseStems", "hasWidthArg", "codeIndex", "subrCode", "jpx", "jpy", "c3x", "c3y", "c4x", "c4y", "parseCFFFDSelect", "fdArrayCount", "fdSelect", "iGid", "next", "iRange", "parseCFFTable", "nameIndex", "topDictIndex", "stringIndex", "globalSubrIndex", "fdArrayOffset", "fdSelectOffset", "fdArrayIndex", "fdArray", "privateDictOffset", "charStringsIndex", "charString", "encodeString", "makeHeader", "makeNameIndex", "fontNames", "makeDict", "attrs", "entry", "makeTopDict", "makeTopDictIndex", "makeStringIndex", "makeGlobalSubrIndex", "makeCharsets", "glyphNames", "glyphName", "glyphSID", "glyphToOps", "dx", "dy", "_13", "_23", "dx1", "dy1", "dx2", "dy2", "makeCharStringsIndex", "makePrivateDict", "makeCFFTable", "fontScale", "privateAttrs", "cff", "parseHeadTable", "head", "makeHeadTable", "timestamp", "createdTimestamp", "parseHheaTable", "hhea", "makeHheaTable", "parseHmtxTableAll", "numMetrics", "numGlyphs", "leftSideBearing", "parseHmtxTableOnLowMemory", "parseHmtxTable", "makeHmtxTable", "hmtx", "makeLtagTable", "tags", "stringPool", "stringPoolOffset", "parseLtagTable", "tableVersion", "numTags", "ltag", "parseMaxpTable", "maxp", "makeMaxpTable", "nameTableNames", "macLanguages", "macLanguageToScript", "windowsLanguages", "getLanguageCode", "platformID", "languageID", "utf16", "macScriptEncodings", "macLanguageEncodings", "getEncoding", "encodingID", "parseNameTable", "stringOffset", "nameID", "property", "byteLength", "language", "text", "translations", "reverseDict", "makeNameRecord", "findSubArray", "needle", "haystack", "needleLength", "limit", "loop", "addStringToPool", "pool", "makeNameTable", "names", "nameIDs", "namesWithNumericKeys", "nameTableIds", "id", "macLanguageIds", "windowsLanguageIds", "nameRecords", "lang", "macPlatform", "macLanguage", "macScript", "macEncoding", "macName", "macNameOffset", "winLanguage", "winName", "winNameOffset", "r", "_name", "unicodeRanges", "getUnicodeRange", "range", "parseOS2Table", "os2", "makeOS2Table", "parsePostTable", "nameLength", "makePostTable", "subtableParsers", "substFormat", "lookupRecordDesc", "glyphCount", "substCount", "extensionLookupType", "extensionParser", "parseGsubTable", "subtable", "sequenceSet", "alternateSet", "ligatureSet", "ligature", "returnTable", "chainRuleSet", "chainRule", "tableData", "record", "coverage", "returnTable$1", "makeGsubTable", "gsub", "parseMetaTable", "numDataMaps", "dataOffset", "makeMetaTable", "log2", "computeCheckSum", "makeTableRecord", "checkSum", "makeSfntTable", "tables", "sfnt", "highestPowerOf2", "recordFields", "tableFields", "tableLength", "tableRecord", "r1", "r2", "metricsForChar", "chars", "notFoundMetrics", "average", "vs", "fontToSfntTable", "xMins", "yMins", "xMaxs", "yMaxs", "advanceWidths", "leftSideBearings", "rightSideBearings", "firstCharIndex", "lastCharIndex", "ulUnicodeRange1", "ulUnicodeRange2", "ulUnicodeRange3", "ulUnicodeRange4", "globals", "headTable", "hheaTable", "maxpTable", "os2Table", "hmtxTable", "englishFamilyName", "englishStyleName", "englishFullName", "postScriptName", "n", "languageTags", "nameTable", "ltagTable", "postTable", "cffTable", "metaTable", "sfntTable", "checkSumAdjusted", "searchTag", "arr", "imin", "imax", "imid", "binSearch", "searchRange", "Layout", "create", "layout", "hasLatn", "scripts", "scr", "scriptTable", "featIndexes", "allFeatures", "featureTable", "lookupListIndexes", "allLookups", "classDefTable", "end", "Position", "kerningLookups", "leftIndex", "rightIndex", "covIndex", "pairSet", "pair", "class1", "class2", "pair$1", "Substitution", "arraysEqual", "ar1", "ar2", "getSubstFormat", "defaultSubtable", "substitutions", "lookupTables", "idx", "substitute", "replacements", "alternates", "alternateSets", "ligatures", "ligatureSets", "startGlyph", "ligSet", "lig", "substitution", "coverageGlyph", "ligComponents", "ligatureTable", "sub", "checkArgument", "expression", "parseGlyphCoordinate", "flag", "previousValue", "shortVectorBitMask", "sameBitMask", "flags", "endPointIndices", "numberOfCoordinates", "repeatCount", "points", "point", "i$3", "px", "i$4", "py", "i$5", "moreComponents", "component", "i$6", "transformPoints", "transform", "newPoints", "newPt", "getContours", "getPath", "contourIndex", "contour", "curr", "next2", "componentGlyph", "transformedPoints", "firstPt", "secondPt", "parseGlyfTableAll", "loca", "nextOffset", "parseGlyfTableOnLowMemory", "parseGlyfTable", "glyf", "instructionTable", "exec", "execGlyph", "execComponent", "Hinting", "roundOff", "roundToGrid", "roundToDoubleGrid", "roundToHalfGrid", "roundUpToGrid", "roundDownToGrid", "roundSuper", "period", "phase", "threshold", "sign", "xUnitVector", "o1", "o2", "rp1", "rp2", "pv", "do1", "do2", "doa1", "doa2", "dm1", "dm2", "rp", "org", "rpx", "rpy", "rpdx", "rpdy", "yUnitVector", "UnitVector", "pvns", "fvs", "getUnitVector", "HPoint", "lastPointOfContour", "onCurve", "HPZero", "defaultState", "State", "env", "prog", "ppem", "prepState", "fpgmState", "oCvt", "cvt", "components", "gZone", "state", "cg", "gz", "cc", "pi", "gLen", "pLen", "cp", "sp", "np", "ins", "initTZone", "tZone", "skip", "handleElse", "ip", "nesting", "SVTCA", "SPVTCA", "SFVTCA", "SPVTL", "p2i", "p1i", "SFVTL", "SPVFS", "SFVFS", "GPV", "GFV", "fv", "SFVTPV", "ISECT", "pa0i", "pa1i", "pb0i", "pb1i", "z0", "z1", "pa0", "pa1", "pb0", "pb1", "x3", "y3", "x4", "y4", "div", "f1", "f2", "SRP0", "SRP1", "SRP2", "SZP0", "SZP1", "SZP2", "SZPS", "SLOOP", "RTG", "RTHG", "SMD", "ELSE", "JMPR", "SCVTCI", "DUP", "POP", "CLEAR", "SWAP", "DEPTH", "LOOPCALL", "fn", "cip", "cprog", "CALL", "CINDEX", "MINDEX", "FDEF", "ipBegin", "MDAP", "round", "IUP", "z2", "pp", "SHP", "rpi", "SHC", "ci", "SHZ", "z", "SHPIX", "IP", "rp1i", "rp2i", "MSIRP", "rp0", "ALIGNRP", "rp0i", "RTDG", "MIAP", "cv", "NPUSHB", "NPUSHW", "w", "WS", "store", "RS", "WCVTP", "RCVT", "cvte", "GC", "MD", "pi2", "pi1", "MPPEM", "FLIPON", "LT", "e2", "e1", "LTEQ", "GT", "GTEQ", "EQ", "NEQ", "ODD", "EVEN", "IF", "test", "EIF", "AND", "OR", "NOT", "DELTAP123", "ds", "arg", "appem", "mag", "SDB", "SDS", "ADD", "SUB", "DIV", "MUL", "ABS", "NEG", "FLOOR", "CEILING", "ROUND", "WCVTF", "DELTAC123", "SROUND", "S45ROUND", "ROFF", "RUTG", "RDTG", "SCANCTRL", "SDPVTL", "GETINFO", "sel", "ROLL", "MAX", "MIN", "SCANTYPE", "INSTCTRL", "PUSHB", "PUSHW", "MDRP_MIRP", "indirect", "setRp0", "keepD", "ro", "md", "od", "Token", "char", "ContextRange", "startIndex", "contextName", "ContextChecker", "checkStart", "checkEnd", "ContextParams", "context", "currentIndex", "Event", "eventId", "initializeCoreEvents", "events", "this$1", "coreEvents", "event", "requiresContextUpdate", "Tokenizer", "stateId", "RUDs", "silent", "RUD", "hasFAILObject", "obj", "tokens", "isTokenType", "token", "replaced", "tokenType", "modifierId", "condition", "modifier", "contextParams", "conditionParams", "canApplyModifier", "modifierParams", "newStateValue", "eventHandler", "subsId", "eventName", "args", "subscriber", "contextStartCheck", "contextEndCheck", "contextCheckers", "endIndex", "registeredContexts", "contextChecker", "openRange", "isArabicChar", "isIsolatedArabicChar", "isTashkeelArabicChar", "isLatinChar", "isWhiteSpace", "FeatureQuery", "SubstitutionAction", "action", "lookupCoverage", "singleSubstitutionFormat1", "substituteIndex", "singleSubstitutionFormat2", "lookupCoverageList", "coverageList", "lookupList", "lookupIndex", "chainingSubstitutionFormat3", "lookupsCount", "inputLookups", "lookaheadOffset", "lookaheadContext", "lookaheadParams", "lookaheadLookups", "backtrackContext", "backtrackParams", "backtrackLookups", "contextRulesMatch", "lookupRecord", "lookupListIndex", "subtable$1", "substitutionType", "ligatureSubstitutionFormat1", "ligSetIndex", "lookaheadItem", "decompositionSubstitutionFormat1", "scriptTag", "langSysRecords", "features", "featuresIndexes", "query", "lookups", "substType", "supportedScript", "supportedFeature", "scriptFeatures", "arabicWordStartCheck", "prevChar", "arabicWordEndCheck", "nextChar", "arabicWordCheck", "arabicSentenceStartCheck", "arabicSentenceEndCheck", "nextIsWhitespace", "arabicCharAhead", "arabicSentenceCheck", "singleSubstitutionFormat1$1", "singleSubstitutionFormat2$1", "chainingSubstitutionFormat3$1", "subst", "ligatureSubstitutionFormat1$1", "compsCount", "SUBSTITUTIONS", "applySubstitution", "willConnectPrev", "charContextParams", "backtrack", "isolated", "tashkeel", "willConnectNext", "arabicPresentationForms", "CONNECT", "getContextParams", "arabicRequiredLigatures", "latinWordStartCheck", "latinWordEndCheck", "latinWordCheck", "getContextParams$1", "latinLigature", "Bidi", "baseDir", "registerContextChecker", "checkId", "tokenizeText", "reverseArabicSentences", "rangeTokens", "supportedTags", "f", "checkGlyphIndexStatus", "applyArabicPresentationForms", "applyArabicRequireLigatures", "applyLatinLigatures", "contextId", "indexes", "Font", "bidi", "charToGlyphIndexMod", "notdef", "leftGlyph", "rightGlyph", "gposKerning", "callback", "kerningValue", "fullPath", "gX", "gY", "gFontSize", "glyphPath", "glyphPaths", "_this", "assert", "assertNamePresent", "englishName", "buffer", "intArray", "addName", "nameString", "nameKey", "makeFvarAxis", "axis", "parseFvarAxis", "makeFvarInstance", "inst", "axes", "axisTag", "parseFvarInstance", "makeFvarTable", "fvar", "parseFvarTable", "offsetToData", "axisCount", "axisSize", "instanceCount", "instanceSize", "instances", "instanceStart", "attachList", "caretValue", "ligGlyph", "ligCaretList", "markGlyphSets", "parseGDEFTable", "gdef", "subtableParsers$1", "posformat", "posFormat", "valueFormat1", "valueFormat2", "classDef1", "classDef2", "class1Count", "class2Count", "parseGposTable", "subtableMakers$1", "makeGposTable", "gpos", "parseWindowsKernTable", "pairs", "subtableVersion", "nPairs", "parseMacKernTable", "nTables", "parseKernTable", "kern", "parseLocaTable", "shortVersion", "parseFn", "glyphOffsets", "glyphOffset", "parseOpenTypeTableEntries", "numTables", "tableEntries", "checksum", "parseWOFFTableEntries", "compLength", "origLength", "compression", "uncompressTable", "tableEntry", "inBuffer", "outBuffer", "view", "indexToLocFormat", "signature", "flavor", "cffTableEntry", "fvarTableEntry", "glyfTableEntry", "gdefTableEntry", "gposTableEntry", "gsubTableEntry", "hmtxTableEntry", "kernTableEntry", "locaTableEntry", "nameTableEntry", "metaTableEntry", "locaTable", "locaOffsets", "glyfTable", "kernTable", "gdefTable", "gposTable", "gsubTable", "fvarTable", "hasColorSpace", "Texture", "_taskCache", "_BasisTextureLoader", "Loader", "manager", "path", "workerLimit", "renderer", "url", "onLoad", "onProgress", "onError", "loader", "FileLoader", "texture", "CompressedTexture", "buffer", "_texture", "options", "levels", "buffers", "i", "config", "worker", "taskID", "taskConfig", "taskCost", "texturePending", "_worker", "resolve", "reject", "message", "mipmaps", "width", "height", "format", "UnsignedByteType", "LinearFilter", "LinearMipmapLinearFilter", "jsLoader", "jsContent", "binaryLoader", "binaryContent", "fn", "body", "e", "a", "b", "BasisTextureLoader", "__publicField", "RGBAFormat", "RGBA_ASTC_4x4_Format", "RGBA_BPTC_Format", "RGBA_ETC2_EAC_Format", "RGBA_PVRTC_4BPPV1_Format", "RGBA_S3TC_DXT5_Format", "RGB_ETC1_Format", "RGB_ETC2_Format", "RGB_PVRTC_4BPPV1_Format", "RGB_S3TC_DXT1_Format", "transcoderPending", "BasisModule", "EngineFormat", "TranscoderFormat", "BasisFormat", "init", "hasAlpha", "transcodeLowLevel", "transcode", "error", "wasmBinary", "basisFormat", "transcoderFormat", "engineFormat", "getTranscoderFormat", "blockByteLength", "assert", "transcoder", "endpointCount", "endpointsData", "selectorCount", "selectorsData", "tablesData", "ok", "level", "imageDesc", "dstByteLength", "getTranscodedImageByteLength", "dst", "getWidthInBlocks", "getHeightInBlocks", "basisFile", "cleanup", "mip", "mipWidth", "mipHeight", "FORMAT_OPTIONS", "ETC1S_OPTIONS", "UASTC_OPTIONS", "opt", "isPowerOfTwo", "paddedWidth", "paddedHeight", "value", "_tempVec0", "Vector3", "_tempVec1", "_ray", "Ray", "_vA", "Vector3", "_vB", "_vC", "_ab", "_cb", "HEADER_LEN", "_taskCache", "DRACOLoader", "Loader", "manager", "path", "config", "workerLimit", "url", "onLoad", "onProgress", "onError", "loader", "FileLoader", "buffer", "taskConfig", "callback", "attributeIDs", "attributeTypes", "attribute", "type", "taskKey", "cachedTask", "worker", "taskID", "taskCost", "geometryPending", "_worker", "resolve", "reject", "message", "geometryData", "geometry", "BufferGeometry", "BufferAttribute", "i", "name", "array", "itemSize", "responseType", "useJS", "librariesPending", "libraries", "jsContent", "fn", "DRACOWorker", "body", "e", "a", "b", "decoderConfig", "decoderPending", "draco", "module", "decoder", "decoderBuffer", "decodeGeometry", "buffers", "attr", "error", "dracoGeometry", "decodingStatus", "geometryType", "attributeName", "attributeType", "attributeID", "decodeAttribute", "decodeIndex", "numIndices", "byteLength", "ptr", "index", "numComponents", "numValues", "dataType", "getDracoDataType", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "_box", "Box3", "_vector", "Vector3", "_start", "Vector3", "_end", "_start", "Vector3", "_end", "_start4", "Vector4", "_end4", "_ssOrigin", "_ssOrigin3", "_mvMatrix", "Matrix4", "_line", "Line3", "_closestPoint", "_box", "Box3", "_sphere", "Sphere", "_clipToWorldVector", "_v1", "Vector3", "_v2", "_v1", "Vector3", "_v2", "_normalMatrix", "Matrix3", "_m1", "Matrix4", "_obj", "Object3D", "_offset", "Vector3", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "init_define_module", "init_define_process_env", "init_define_process_env_NODE_PATH", "MeshoptDecoder", "wasm_base", "wasm_simd", "detector", "wasmpack", "wasm", "instance", "ready", "unpack", "result", "data", "i", "ch", "write", "decode", "fun", "target", "count", "size", "source", "filter", "sbrk", "count4", "tp", "sp", "heap", "res", "filters", "decoders", "workers", "requestId", "createWorker", "url", "worker", "event", "initWorkers", "workerProcess", "blob", "decodeWorker", "mode", "resolve", "reject", "id", "error", "getStoryAssetPath", "publicAsset", "loader", "GLTFLoader", "MeshoptDecoder", "dracoLoader", "DRACOLoader", "theme_default", "create", "getStoryAssetPath", "addons", "theme_default"] }